From dd073bbb3f6ea8be4d8736e027ad06fe421cb0ee Mon Sep 17 00:00:00 2001 From: Francois Gouget Date: Mon, 14 Feb 2005 21:04:45 +0000 Subject: [PATCH] Cast the GetProcAddress() return value to avoid warnings about the function pointer being of the wrong type. Fix assorted signed/unsigned comparison warnings. --- dlls/advapi32/tests/security.c | 8 ++++---- dlls/gdi/tests/metafile.c | 9 ++++----- dlls/mlang/tests/mlang.c | 6 +++--- dlls/msvcrt/tests/file.c | 4 ++-- dlls/ntdll/tests/path.c | 4 ++-- 5 files changed, 15 insertions(+), 16 deletions(-) diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c index 8ff68049a73..07dd892f344 100644 --- a/dlls/advapi32/tests/security.c +++ b/dlls/advapi32/tests/security.c @@ -224,7 +224,7 @@ static void test_allocateLuid(void) LUID luid1, luid2; BOOL ret; - pAllocateLocallyUniqueId = GetProcAddress(hmod, "AllocateLocallyUniqueId"); + pAllocateLocallyUniqueId = (void*)GetProcAddress(hmod, "AllocateLocallyUniqueId"); if (!pAllocateLocallyUniqueId) return; ret = pAllocateLocallyUniqueId(&luid1); @@ -256,7 +256,7 @@ static void test_lookupPrivilegeName(void) BOOL ret; /* check whether it's available first */ - pLookupPrivilegeNameA = GetProcAddress(hmod, "LookupPrivilegeNameA"); + pLookupPrivilegeNameA = (void*)GetProcAddress(hmod, "LookupPrivilegeNameA"); if (!pLookupPrivilegeNameA) return; luid.LowPart = SE_CREATE_TOKEN_PRIVILEGE; ret = pLookupPrivilegeNameA(NULL, &luid, buf, &cchName); @@ -309,7 +309,7 @@ static void test_lookupPrivilegeName(void) struct NameToLUID { const char *name; - LONG lowPart; + DWORD lowPart; }; static void test_lookupPrivilegeValue(void) @@ -351,7 +351,7 @@ static void test_lookupPrivilegeValue(void) BOOL ret; /* check whether it's available first */ - pLookupPrivilegeValueA = GetProcAddress(hmod, "LookupPrivilegeValueA"); + pLookupPrivilegeValueA = (void*)GetProcAddress(hmod, "LookupPrivilegeValueA"); if (!pLookupPrivilegeValueA) return; ret = pLookupPrivilegeValueA(NULL, "SeCreateTokenPrivilege", &luid); if (!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) diff --git a/dlls/gdi/tests/metafile.c b/dlls/gdi/tests/metafile.c index 2e2922282ea..9eefd4da572 100644 --- a/dlls/gdi/tests/metafile.c +++ b/dlls/gdi/tests/metafile.c @@ -259,8 +259,7 @@ static const unsigned char MF_PATTERN_BRUSH_BITS[] = { static void dump_mf_bits (const HMETAFILE mf, const char *desc) { char buf[MF_BUFSIZE]; - UINT mfsize; - int i; + UINT mfsize, i; mfsize = GetMetaFileBitsEx (mf, MF_BUFSIZE, buf); ok (mfsize > 0, "%s: GetMetaFileBitsEx failed.\n", desc); @@ -286,12 +285,12 @@ static void dump_mf_bits (const HMETAFILE mf, const char *desc) * otherwise returns the number of non-matching bytes. */ -static int compare_mf_bits (const HMETAFILE mf, const char *bits, int bsize, +static int compare_mf_bits (const HMETAFILE mf, const char *bits, UINT bsize, const char *desc) { char buf[MF_BUFSIZE]; - UINT mfsize; - int i, diff; + UINT mfsize, i; + int diff; mfsize = GetMetaFileBitsEx (mf, MF_BUFSIZE, buf); ok (mfsize > 0, "%s: GetMetaFileBitsEx failed.\n", desc); diff --git a/dlls/mlang/tests/mlang.c b/dlls/mlang/tests/mlang.c index 98671f1d61f..d462172877f 100644 --- a/dlls/mlang/tests/mlang.c +++ b/dlls/mlang/tests/mlang.c @@ -51,7 +51,7 @@ static void test_multibyte_to_unicode_translations(IMultiLanguage2 *iML2) WCHAR stringW[] = {'J','u','s','t',' ','a',' ','t','e','s','t',' ','s','t','r','i','n','g',0}; char bufA[256]; WCHAR bufW[256]; - UINT lenA, lenW, expected_len; + int lenA, lenW, expected_len; HRESULT ret; HMODULE hMlang; FARPROC pConvertINetMultiByteToUnicode; @@ -105,7 +105,7 @@ static void test_multibyte_to_unicode_translations(IMultiLanguage2 *iML2) ret = IMultiLanguage2_ConvertStringToUnicode(iML2, NULL, CP_UNICODE, stringA, &lenA, bufW, &lenW); ok(ret == S_OK, "IMultiLanguage2_ConvertStringToUnicode failed: %08lx\n", ret); ok(lenA == lstrlenA(stringA), "expected lenA %u, got %u\n", lstrlenA(stringA), lenA); - ok(lenW == lstrlenW(stringW)/sizeof(WCHAR), "expected lenW %u, got %u\n", lstrlenW(stringW)/sizeof(WCHAR), lenW); + ok(lenW == lstrlenW(stringW)/(int)sizeof(WCHAR), "expected lenW %u, got %u\n", lstrlenW(stringW)/sizeof(WCHAR), lenW); ok(bufW[lenW] != 0, "buf should not be 0 terminated\n"); bufW[lenW] = 0; /* -1 doesn't include 0 terminator */ ok(!lstrcmpA((LPCSTR)bufW, stringA), "bufW/stringA mismatch\n"); @@ -176,7 +176,7 @@ static void test_multibyte_to_unicode_translations(IMultiLanguage2 *iML2) TRACE_2("Call IMultiLanguage2_ConvertStringFromUnicode\n"); ret = IMultiLanguage2_ConvertStringFromUnicode(iML2, NULL, CP_UNICODE, stringW, &lenW, bufA, &lenA); ok(ret == S_OK, "IMultiLanguage2_ConvertStringFromUnicode failed: %08lx\n", ret); - ok(lenA == lstrlenA(stringA) * sizeof(WCHAR), "expected lenA %u, got %u\n", lstrlenA(stringA) * sizeof(WCHAR), lenA); + ok(lenA == lstrlenA(stringA) * (int)sizeof(WCHAR), "expected lenA %u, got %u\n", lstrlenA(stringA) * sizeof(WCHAR), lenA); ok(lenW == lstrlenW(stringW), "expected lenW %u, got %u\n", lstrlenW(stringW), lenW); ok(bufA[lenA] != 0 && bufA[lenA+1] != 0, "buf should not be 0 terminated\n"); bufA[lenA] = 0; /* -1 doesn't include 0 terminator */ diff --git a/dlls/msvcrt/tests/file.c b/dlls/msvcrt/tests/file.c index eb9531702a3..5685d937604 100644 --- a/dlls/msvcrt/tests/file.c +++ b/dlls/msvcrt/tests/file.c @@ -71,7 +71,7 @@ static void test_fileops( void ) ok(feof(file) !=0,"feof doesn't signal EOF\n"); rewind(file); ok(fgets(buffer,strlen(outbuffer),file) !=0,"fgets failed unexpected\n"); - ok(lstrlenA(buffer) == strlen(outbuffer) -1,"fgets didn't read right size\n"); + ok(lstrlenA(buffer) == lstrlenA(outbuffer) -1,"fgets didn't read right size\n"); ok(fgets(buffer,sizeof(outbuffer),file) !=0,"fgets failed unexpected\n"); ok(strlen(buffer) == 1,"fgets dropped chars\n"); ok(buffer[0] == outbuffer[strlen(outbuffer)-1],"fgets exchanged chars\n"); @@ -83,7 +83,7 @@ static void test_fileops( void ) ok(feof(file) !=0,"feof doesn't signal EOF\n"); rewind(file); ok(fgetws(wbuffer,strlen(outbuffer),file) !=0,"fgetws failed unexpected\n"); - ok(lstrlenW(wbuffer) == (strlen(outbuffer) -1),"fgetws didn't read right size\n"); + ok(lstrlenW(wbuffer) == (lstrlenA(outbuffer) -1),"fgetws didn't read right size\n"); ok(fgetws(wbuffer,sizeof(outbuffer),file) !=0,"fgets failed unexpected\n"); ok(lstrlenW(wbuffer) == 1,"fgets dropped chars\n"); fclose (file); diff --git a/dlls/ntdll/tests/path.c b/dlls/ntdll/tests/path.c index 05c4eb637c0..2cf6ff307ac 100644 --- a/dlls/ntdll/tests/path.c +++ b/dlls/ntdll/tests/path.c @@ -35,7 +35,7 @@ static void test_RtlDetermineDosPathNameType(void) struct test { const char *path; - int ret; + UINT ret; }; static const struct test tests[] = @@ -255,7 +255,7 @@ static void test_RtlGetFullPathName_U() ULONG ret; WCHAR *file_part; DWORD reslen; - int len; + UINT len; for (test = tests; test->path; test++) {