From 280bcf6e4a9b0faf54ef65ead93ce84c9f7b00a0 Mon Sep 17 00:00:00 2001 From: Mike McCormack Date: Sat, 27 Aug 2005 10:00:38 +0000 Subject: [PATCH] Fix gcc 4.0 warnings. --- dlls/advapi32/crypt_lmhash.c | 2 +- dlls/advapi32/crypt_sha.c | 4 ++-- dlls/advapi32/registry.c | 14 +++++++------- dlls/advapi32/service.c | 10 +++++----- dlls/advapi32/tests/crypt_lmhash.c | 4 ++-- dlls/advapi32/tests/crypt_md4.c | 2 +- dlls/advapi32/tests/crypt_md5.c | 2 +- dlls/cabinet/cabinet.h | 10 +++++----- dlls/comctl32/rebar.c | 2 +- dlls/comctl32/tab.c | 3 ++- programs/view/view.c | 4 ++-- 11 files changed, 29 insertions(+), 28 deletions(-) diff --git a/dlls/advapi32/crypt_lmhash.c b/dlls/advapi32/crypt_lmhash.c index 15f689d1dc..37468cd54c 100644 --- a/dlls/advapi32/crypt_lmhash.c +++ b/dlls/advapi32/crypt_lmhash.c @@ -49,7 +49,7 @@ static void CRYPT_LMhash( unsigned char *dst, const unsigned char *pwd, const in NTSTATUS WINAPI SystemFunction006( LPCSTR password, LPSTR hash ) { - CRYPT_LMhash( hash, password, strlen(password) ); + CRYPT_LMhash( (unsigned char*)hash, (unsigned char*)password, strlen(password) ); return STATUS_SUCCESS; } diff --git a/dlls/advapi32/crypt_sha.c b/dlls/advapi32/crypt_sha.c index 8cc03321ad..59043c8645 100644 --- a/dlls/advapi32/crypt_sha.c +++ b/dlls/advapi32/crypt_sha.c @@ -49,7 +49,7 @@ typedef struct { #define R4(v,w,x,y,z,i) z+=f4(w,x,y)+blk1(i)+0xCA62C1D6+rol(v,5);w=rol(w,30); /* Hash a single 512-bit block. This is the core of the algorithm. */ -void SHA1Transform(ULONG State[5], CHAR Buffer[64]) +void SHA1Transform(ULONG State[5], UCHAR Buffer[64]) { ULONG a, b, c, d, e; ULONG *Block; @@ -178,7 +178,7 @@ A_SHAFinal(PSHA_CTX Context, PULONG Result) Count = (ULONG*)(Buffer + Pad); Count[0] = DWORD2BE(LengthHi); Count[1] = DWORD2BE(LengthLo); - A_SHAUpdate(Context, Buffer, Pad + 8); + A_SHAUpdate(Context, (PCHAR)Buffer, Pad + 8); for (Index = 0; Index < 5; Index++) Result[Index] = DWORD2BE(Context->State[Index]); diff --git a/dlls/advapi32/registry.c b/dlls/advapi32/registry.c index 6971d75a6f..1e57cee91e 100644 --- a/dlls/advapi32/registry.c +++ b/dlls/advapi32/registry.c @@ -991,7 +991,7 @@ DWORD WINAPI RegSetValueExA( HKEY hkey, LPCSTR name, DWORD reserved, DWORD type, if (type == REG_SZ) { if (!data) return ERROR_INVALID_PARAMETER; - count = strlen(data) + 1; + count = strlen((const char *)data) + 1; } } else if (count && is_string(type)) @@ -1005,9 +1005,9 @@ DWORD WINAPI RegSetValueExA( HKEY hkey, LPCSTR name, DWORD reserved, DWORD type, if (is_string( type )) /* need to convert to Unicode */ { DWORD lenW; - RtlMultiByteToUnicodeSize( &lenW, data, count ); + RtlMultiByteToUnicodeSize( &lenW, (const char *)data, count ); if (!(dataW = HeapAlloc( GetProcessHeap(), 0, lenW ))) return ERROR_OUTOFMEMORY; - RtlMultiByteToUnicodeN( dataW, lenW, NULL, data, count ); + RtlMultiByteToUnicodeN( dataW, lenW, NULL, (const char *)data, count ); count = lenW; data = (BYTE *)dataW; } @@ -1232,7 +1232,7 @@ DWORD WINAPI RegQueryValueExA( HKEY hkey, LPCSTR name, LPDWORD reserved, LPDWORD if (len > *count) status = STATUS_BUFFER_OVERFLOW; else { - RtlUnicodeToMultiByteN( data, len, NULL, (WCHAR *)(buf_ptr + info_size), + RtlUnicodeToMultiByteN( (char*)data, len, NULL, (WCHAR *)(buf_ptr + info_size), total_size - info_size ); /* if the type is REG_SZ and data is not 0-terminated * and there is enough space in the buffer NT appends a \0 */ @@ -1285,7 +1285,7 @@ DWORD WINAPI RegQueryValueW( HKEY hkey, LPCWSTR name, LPWSTR data, LPLONG count { if ((ret = RegOpenKeyW( hkey, name, &subkey )) != ERROR_SUCCESS) return ret; } - ret = RegQueryValueExW( subkey, NULL, NULL, NULL, (LPBYTE)data, count ); + ret = RegQueryValueExW( subkey, NULL, NULL, NULL, (LPBYTE)data, (LPDWORD)count ); if (subkey != hkey) RegCloseKey( subkey ); if (ret == ERROR_FILE_NOT_FOUND) { @@ -1314,7 +1314,7 @@ DWORD WINAPI RegQueryValueA( HKEY hkey, LPCSTR name, LPSTR data, LPLONG count ) { if ((ret = RegOpenKeyA( hkey, name, &subkey )) != ERROR_SUCCESS) return ret; } - ret = RegQueryValueExA( subkey, NULL, NULL, NULL, (LPBYTE)data, count ); + ret = RegQueryValueExA( subkey, NULL, NULL, NULL, (LPBYTE)data, (LPDWORD)count ); if (subkey != hkey) RegCloseKey( subkey ); if (ret == ERROR_FILE_NOT_FOUND) { @@ -1731,7 +1731,7 @@ DWORD WINAPI RegEnumValueA( HKEY hkey, DWORD index, LPSTR value, LPDWORD val_cou if (len > *count) status = STATUS_BUFFER_OVERFLOW; else { - RtlUnicodeToMultiByteN( data, len, NULL, (WCHAR *)(buf_ptr + info->DataOffset), + RtlUnicodeToMultiByteN( (char*)data, len, NULL, (WCHAR *)(buf_ptr + info->DataOffset), total_size - info->DataOffset ); /* if the type is REG_SZ and data is not 0-terminated * and there is enough space in the buffer NT appends a \0 */ diff --git a/dlls/advapi32/service.c b/dlls/advapi32/service.c index 337d7d81e2..1cb4937df8 100644 --- a/dlls/advapi32/service.c +++ b/dlls/advapi32/service.c @@ -1637,7 +1637,7 @@ QueryServiceConfigA( SC_HANDLE hService, CHAR str_buffer[ MAX_PATH ]; LONG r; DWORD type, val, sz, total, n; - LPBYTE p; + LPSTR p; TRACE("%p %p %ld %p\n", hService, lpServiceConfig, cbBufSize, pcbBytesNeeded); @@ -1715,7 +1715,7 @@ QueryServiceConfigA( SC_HANDLE hService, lpServiceConfig->dwErrorControl = val; /* now do the strings */ - p = (LPBYTE) &lpServiceConfig[1]; + p = (LPSTR) &lpServiceConfig[1]; n = total - sizeof (QUERY_SERVICE_CONFIGA); sz = sizeof(str_buffer); @@ -1725,7 +1725,7 @@ QueryServiceConfigA( SC_HANDLE hService, sz = ExpandEnvironmentStringsA(str_buffer, p, n); if( 0 == sz || sz > n ) return FALSE; - lpServiceConfig->lpBinaryPathName = (LPSTR) p; + lpServiceConfig->lpBinaryPathName = p; p += sz; n -= sz; } @@ -1739,7 +1739,7 @@ QueryServiceConfigA( SC_HANDLE hService, r = RegQueryValueExA( hKey, szGroup, 0, &type, (LPBYTE)p, &sz ); if( ( r == ERROR_SUCCESS ) || ( type == REG_SZ ) ) { - lpServiceConfig->lpLoadOrderGroup = (LPSTR) p; + lpServiceConfig->lpLoadOrderGroup = p; p += sz; n -= sz; } @@ -1748,7 +1748,7 @@ QueryServiceConfigA( SC_HANDLE hService, r = RegQueryValueExA( hKey, szDependencies, 0, &type, (LPBYTE)p, &sz ); if( ( r == ERROR_SUCCESS ) || ( type == REG_SZ ) ) { - lpServiceConfig->lpDependencies = (LPSTR) p; + lpServiceConfig->lpDependencies = p; p += sz; n -= sz; } diff --git a/dlls/advapi32/tests/crypt_lmhash.c b/dlls/advapi32/tests/crypt_lmhash.c index 5a17f3d358..bf3eb478fd 100644 --- a/dlls/advapi32/tests/crypt_lmhash.c +++ b/dlls/advapi32/tests/crypt_lmhash.c @@ -29,9 +29,9 @@ fnSystemFunction006 pSystemFunction006; static void test_SystemFunction006(void) { - static unsigned char lmhash[16 + 1]; + char lmhash[16 + 1]; - unsigned char passwd[] = { 's','e','c','r','e','t', 0, 0, 0, 0, 0, 0, 0, 0 }; + char passwd[] = { 's','e','c','r','e','t', 0, 0, 0, 0, 0, 0, 0, 0 }; unsigned char expect[] = { 0x85, 0xf5, 0x28, 0x9f, 0x09, 0xdc, 0xa7, 0xeb, 0xaa, 0xd3, 0xb4, 0x35, 0xb5, 0x14, 0x04, 0xee }; diff --git a/dlls/advapi32/tests/crypt_md4.c b/dlls/advapi32/tests/crypt_md4.c index a7622e0dc7..3a68c88caa 100644 --- a/dlls/advapi32/tests/crypt_md4.c +++ b/dlls/advapi32/tests/crypt_md4.c @@ -51,7 +51,7 @@ static void test_md4_ctx(void) "In our business there is Sin" "In our bodies, there is Die"; - int size = strlen( message ); + int size = sizeof(message) - 1; HMODULE module; MD4_CTX ctx; diff --git a/dlls/advapi32/tests/crypt_md5.c b/dlls/advapi32/tests/crypt_md5.c index 5d1cefbc58..fe7197a7b0 100644 --- a/dlls/advapi32/tests/crypt_md5.c +++ b/dlls/advapi32/tests/crypt_md5.c @@ -51,7 +51,7 @@ static void test_md5_ctx(void) "In our business there is Sin" "In our bodies, there is Die"; - int size = strlen( message ); + int size = sizeof(message) - 1; HMODULE module; MD5_CTX ctx; diff --git a/dlls/cabinet/cabinet.h b/dlls/cabinet/cabinet.h index bb18ae097f..c70d63916e 100644 --- a/dlls/cabinet/cabinet.h +++ b/dlls/cabinet/cabinet.h @@ -324,15 +324,15 @@ typedef struct { cab_ULONG cDataBlocks; cab_ULONG cbFileRemainer; /* uncompressed, yet to be written data */ /* of spanned file of a spanning folder of a spanning cabinet */ - cab_UBYTE szFileNameCFDATA1[CB_MAX_FILENAME]; + char szFileNameCFDATA1[CB_MAX_FILENAME]; int handleCFDATA1; - cab_UBYTE szFileNameCFFILE1[CB_MAX_FILENAME]; + char szFileNameCFFILE1[CB_MAX_FILENAME]; int handleCFFILE1; - cab_UBYTE szFileNameCFDATA2[CB_MAX_FILENAME]; + char szFileNameCFDATA2[CB_MAX_FILENAME]; int handleCFDATA2; - cab_UBYTE szFileNameCFFILE2[CB_MAX_FILENAME]; + char szFileNameCFFILE2[CB_MAX_FILENAME]; int handleCFFILE2; - cab_UBYTE szFileNameCFFOLDER[CB_MAX_FILENAME]; + char szFileNameCFFOLDER[CB_MAX_FILENAME]; int handleCFFOLDER; cab_ULONG sizeFileCFDATA1; cab_ULONG sizeFileCFFILE1; diff --git a/dlls/comctl32/rebar.c b/dlls/comctl32/rebar.c index bccc822dd9..c5ed06a171 100644 --- a/dlls/comctl32/rebar.c +++ b/dlls/comctl32/rebar.c @@ -3935,7 +3935,7 @@ REBAR_LButtonDown (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) { REBAR_BAND *lpBand; UINT htFlags; - UINT iHitBand; + INT iHitBand; POINT ptMouseDown; ptMouseDown.x = (INT)LOWORD(lParam); ptMouseDown.y = (INT)HIWORD(lParam); diff --git a/dlls/comctl32/tab.c b/dlls/comctl32/tab.c index e085a49212..d5c0485514 100644 --- a/dlls/comctl32/tab.c +++ b/dlls/comctl32/tab.c @@ -601,7 +601,8 @@ static LRESULT TAB_LButtonDown (TAB_INFO *infoPtr, WPARAM wParam, LPARAM lParam) { POINT pt; - INT newItem, dummy; + INT newItem; + UINT dummy; if (infoPtr->hwndToolTip) TAB_RelayEvent (infoPtr->hwndToolTip, infoPtr->hwnd, diff --git a/programs/view/view.c b/programs/view/view.c index 138acec413..147cc45039 100644 --- a/programs/view/view.c +++ b/programs/view/view.c @@ -163,7 +163,7 @@ BOOL FileIsPlaceable( LPCSTR szFileName ) HMETAFILE GetPlaceableMetaFile( HWND hwnd, LPCSTR szFileName ) { - LPSTR lpData; + LPBYTE lpData; METAHEADER mfHeader; APMFILEHEADER APMHeader; HFILE fh; @@ -191,7 +191,7 @@ HMETAFILE GetPlaceableMetaFile( HWND hwnd, LPCSTR szFileName ) if (!_lread(fh, (LPSTR)&mfHeader, sizeof(METAHEADER))) return 0; - if (!(lpData = (LPSTR) GlobalAlloc(GPTR, (mfHeader.mtSize * 2L)))) return 0; + if (!(lpData = GlobalAlloc(GPTR, (mfHeader.mtSize * 2L)))) return 0; _llseek(fh, sizeof(APMFILEHEADER), 0); if (!_lread(fh, lpData, (UINT)(mfHeader.mtSize * 2L))) -- 2.32.0.93.g670b81a890