Cast the GetProcAddress() return value to avoid warnings about the

function pointer being of the wrong type.
Fix assorted signed/unsigned comparison warnings.
This commit is contained in:
Francois Gouget 2005-02-14 21:04:45 +00:00 committed by Alexandre Julliard
parent e84f07de2a
commit dd073bbb3f
5 changed files with 15 additions and 16 deletions

View File

@ -224,7 +224,7 @@ static void test_allocateLuid(void)
LUID luid1, luid2; LUID luid1, luid2;
BOOL ret; BOOL ret;
pAllocateLocallyUniqueId = GetProcAddress(hmod, "AllocateLocallyUniqueId"); pAllocateLocallyUniqueId = (void*)GetProcAddress(hmod, "AllocateLocallyUniqueId");
if (!pAllocateLocallyUniqueId) return; if (!pAllocateLocallyUniqueId) return;
ret = pAllocateLocallyUniqueId(&luid1); ret = pAllocateLocallyUniqueId(&luid1);
@ -256,7 +256,7 @@ static void test_lookupPrivilegeName(void)
BOOL ret; BOOL ret;
/* check whether it's available first */ /* check whether it's available first */
pLookupPrivilegeNameA = GetProcAddress(hmod, "LookupPrivilegeNameA"); pLookupPrivilegeNameA = (void*)GetProcAddress(hmod, "LookupPrivilegeNameA");
if (!pLookupPrivilegeNameA) return; if (!pLookupPrivilegeNameA) return;
luid.LowPart = SE_CREATE_TOKEN_PRIVILEGE; luid.LowPart = SE_CREATE_TOKEN_PRIVILEGE;
ret = pLookupPrivilegeNameA(NULL, &luid, buf, &cchName); ret = pLookupPrivilegeNameA(NULL, &luid, buf, &cchName);
@ -309,7 +309,7 @@ static void test_lookupPrivilegeName(void)
struct NameToLUID struct NameToLUID
{ {
const char *name; const char *name;
LONG lowPart; DWORD lowPart;
}; };
static void test_lookupPrivilegeValue(void) static void test_lookupPrivilegeValue(void)
@ -351,7 +351,7 @@ static void test_lookupPrivilegeValue(void)
BOOL ret; BOOL ret;
/* check whether it's available first */ /* check whether it's available first */
pLookupPrivilegeValueA = GetProcAddress(hmod, "LookupPrivilegeValueA"); pLookupPrivilegeValueA = (void*)GetProcAddress(hmod, "LookupPrivilegeValueA");
if (!pLookupPrivilegeValueA) return; if (!pLookupPrivilegeValueA) return;
ret = pLookupPrivilegeValueA(NULL, "SeCreateTokenPrivilege", &luid); ret = pLookupPrivilegeValueA(NULL, "SeCreateTokenPrivilege", &luid);
if (!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) if (!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)

View File

@ -259,8 +259,7 @@ static const unsigned char MF_PATTERN_BRUSH_BITS[] = {
static void dump_mf_bits (const HMETAFILE mf, const char *desc) static void dump_mf_bits (const HMETAFILE mf, const char *desc)
{ {
char buf[MF_BUFSIZE]; char buf[MF_BUFSIZE];
UINT mfsize; UINT mfsize, i;
int i;
mfsize = GetMetaFileBitsEx (mf, MF_BUFSIZE, buf); mfsize = GetMetaFileBitsEx (mf, MF_BUFSIZE, buf);
ok (mfsize > 0, "%s: GetMetaFileBitsEx failed.\n", desc); 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. * 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) const char *desc)
{ {
char buf[MF_BUFSIZE]; char buf[MF_BUFSIZE];
UINT mfsize; UINT mfsize, i;
int i, diff; int diff;
mfsize = GetMetaFileBitsEx (mf, MF_BUFSIZE, buf); mfsize = GetMetaFileBitsEx (mf, MF_BUFSIZE, buf);
ok (mfsize > 0, "%s: GetMetaFileBitsEx failed.\n", desc); ok (mfsize > 0, "%s: GetMetaFileBitsEx failed.\n", desc);

View File

@ -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}; WCHAR stringW[] = {'J','u','s','t',' ','a',' ','t','e','s','t',' ','s','t','r','i','n','g',0};
char bufA[256]; char bufA[256];
WCHAR bufW[256]; WCHAR bufW[256];
UINT lenA, lenW, expected_len; int lenA, lenW, expected_len;
HRESULT ret; HRESULT ret;
HMODULE hMlang; HMODULE hMlang;
FARPROC pConvertINetMultiByteToUnicode; 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); ret = IMultiLanguage2_ConvertStringToUnicode(iML2, NULL, CP_UNICODE, stringA, &lenA, bufW, &lenW);
ok(ret == S_OK, "IMultiLanguage2_ConvertStringToUnicode failed: %08lx\n", ret); ok(ret == S_OK, "IMultiLanguage2_ConvertStringToUnicode failed: %08lx\n", ret);
ok(lenA == lstrlenA(stringA), "expected lenA %u, got %u\n", lstrlenA(stringA), lenA); 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"); ok(bufW[lenW] != 0, "buf should not be 0 terminated\n");
bufW[lenW] = 0; /* -1 doesn't include 0 terminator */ bufW[lenW] = 0; /* -1 doesn't include 0 terminator */
ok(!lstrcmpA((LPCSTR)bufW, stringA), "bufW/stringA mismatch\n"); 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"); TRACE_2("Call IMultiLanguage2_ConvertStringFromUnicode\n");
ret = IMultiLanguage2_ConvertStringFromUnicode(iML2, NULL, CP_UNICODE, stringW, &lenW, bufA, &lenA); ret = IMultiLanguage2_ConvertStringFromUnicode(iML2, NULL, CP_UNICODE, stringW, &lenW, bufA, &lenA);
ok(ret == S_OK, "IMultiLanguage2_ConvertStringFromUnicode failed: %08lx\n", ret); 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(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"); ok(bufA[lenA] != 0 && bufA[lenA+1] != 0, "buf should not be 0 terminated\n");
bufA[lenA] = 0; /* -1 doesn't include 0 terminator */ bufA[lenA] = 0; /* -1 doesn't include 0 terminator */

View File

@ -71,7 +71,7 @@ static void test_fileops( void )
ok(feof(file) !=0,"feof doesn't signal EOF\n"); ok(feof(file) !=0,"feof doesn't signal EOF\n");
rewind(file); rewind(file);
ok(fgets(buffer,strlen(outbuffer),file) !=0,"fgets failed unexpected\n"); 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(fgets(buffer,sizeof(outbuffer),file) !=0,"fgets failed unexpected\n");
ok(strlen(buffer) == 1,"fgets dropped chars\n"); ok(strlen(buffer) == 1,"fgets dropped chars\n");
ok(buffer[0] == outbuffer[strlen(outbuffer)-1],"fgets exchanged 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"); ok(feof(file) !=0,"feof doesn't signal EOF\n");
rewind(file); rewind(file);
ok(fgetws(wbuffer,strlen(outbuffer),file) !=0,"fgetws failed unexpected\n"); 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(fgetws(wbuffer,sizeof(outbuffer),file) !=0,"fgets failed unexpected\n");
ok(lstrlenW(wbuffer) == 1,"fgets dropped chars\n"); ok(lstrlenW(wbuffer) == 1,"fgets dropped chars\n");
fclose (file); fclose (file);

View File

@ -35,7 +35,7 @@ static void test_RtlDetermineDosPathNameType(void)
struct test struct test
{ {
const char *path; const char *path;
int ret; UINT ret;
}; };
static const struct test tests[] = static const struct test tests[] =
@ -255,7 +255,7 @@ static void test_RtlGetFullPathName_U()
ULONG ret; ULONG ret;
WCHAR *file_part; WCHAR *file_part;
DWORD reslen; DWORD reslen;
int len; UINT len;
for (test = tests; test->path; test++) for (test = tests; test->path; test++)
{ {