Commit 75de8fe1 authored by Alexandre Julliard's avatar Alexandre Julliard

Added printf format checking to the ok() and trace() macros, and fixed

the resulting warnings.
parent ff9b9d4e
......@@ -54,7 +54,7 @@ static void test__hread( void )
filehandle = _lcreat( filename, 0 );
if (filehandle == HFILE_ERROR)
{
ok(0,"couldn't create file \"%s\" (err=%d)",filename,GetLastError());
ok(0,"couldn't create file \"%s\" (err=%ld)",filename,GetLastError());
return;
}
......@@ -64,7 +64,7 @@ static void test__hread( void )
filehandle = _lopen( filename, OF_READ );
ok( HFILE_ERROR != filehandle, "couldn't open file \"%s\" again (err=%d)", filename, GetLastError( ) );
ok( HFILE_ERROR != filehandle, "couldn't open file \"%s\" again (err=%ld)", filename, GetLastError( ) );
bytes_read = _hread( filehandle, buffer, 2 * strlen( sillytext ) );
......@@ -82,7 +82,7 @@ static void test__hread( void )
ok( HFILE_ERROR != _lclose( filehandle ), "_lclose complains" );
ok( DeleteFileA( filename ) != 0, "DeleteFile failed (%d)", GetLastError( ) );
ok( DeleteFileA( filename ) != 0, "DeleteFile failed (%ld)", GetLastError( ) );
}
......@@ -101,7 +101,7 @@ static void test__hwrite( void )
filehandle = _lcreat( filename, 0 );
if (filehandle == HFILE_ERROR)
{
ok(0,"couldn't create file \"%s\" (err=%d)",filename,GetLastError());
ok(0,"couldn't create file \"%s\" (err=%ld)",filename,GetLastError());
return;
}
......@@ -165,7 +165,7 @@ static void test__hwrite( void )
ok( HFILE_ERROR != _lclose( filehandle ), "_lclose complains" );
ok( DeleteFileA( filename ) != 0, "DeleteFile failed (%d)", GetLastError( ) );
ok( DeleteFileA( filename ) != 0, "DeleteFile failed (%ld)", GetLastError( ) );
}
......@@ -176,7 +176,7 @@ static void test__lclose( void )
filehandle = _lcreat( filename, 0 );
if (filehandle == HFILE_ERROR)
{
ok(0,"couldn't create file \"%s\" (err=%d)",filename,GetLastError());
ok(0,"couldn't create file \"%s\" (err=%ld)",filename,GetLastError());
return;
}
......@@ -188,7 +188,7 @@ static void test__lclose( void )
ok( HFILE_ERROR == _lclose(filehandle), "_lclose should whine about this" );
ok( DeleteFileA( filename ) != 0, "DeleteFile failed (%d)", GetLastError( ) );
ok( DeleteFileA( filename ) != 0, "DeleteFile failed (%ld)", GetLastError( ) );
}
......@@ -201,7 +201,7 @@ static void test__lcreat( void )
filehandle = _lcreat( filename, 0 );
if (filehandle == HFILE_ERROR)
{
ok(0,"couldn't create file \"%s\" (err=%d)",filename,GetLastError());
ok(0,"couldn't create file \"%s\" (err=%ld)",filename,GetLastError());
return;
}
......@@ -215,10 +215,10 @@ static void test__lcreat( void )
ok( INVALID_HANDLE_VALUE != FindFirstFileA( filename, &search_results ), "should be able to find file" );
ok( DeleteFileA(filename) != 0, "DeleteFile failed (%d)", GetLastError());
ok( DeleteFileA(filename) != 0, "DeleteFile failed (%ld)", GetLastError());
filehandle = _lcreat( filename, 1 ); /* readonly */
ok( HFILE_ERROR != filehandle, "couldn't create file \"%s\" (err=%d)", filename, GetLastError( ) );
ok( HFILE_ERROR != filehandle, "couldn't create file \"%s\" (err=%ld)", filename, GetLastError( ) );
ok( HFILE_ERROR != _hwrite( filehandle, sillytext, strlen( sillytext ) ), "_hwrite shouldn't be able to write never the less" );
......@@ -233,7 +233,7 @@ static void test__lcreat( void )
ok( DeleteFileA( filename ) != 0, "now it should be possible to delete the file!" );
filehandle = _lcreat( filename, 2 );
ok( HFILE_ERROR != filehandle, "couldn't create file \"%s\" (err=%d)", filename, GetLastError( ) );
ok( HFILE_ERROR != filehandle, "couldn't create file \"%s\" (err=%ld)", filename, GetLastError( ) );
ok( HFILE_ERROR != _hwrite( filehandle, sillytext, strlen( sillytext ) ), "_hwrite complains" );
......@@ -245,10 +245,10 @@ static void test__lcreat( void )
ok( INVALID_HANDLE_VALUE != FindFirstFileA( filename, &search_results ), "should STILL be able to find file" );
ok( DeleteFileA( filename ) != 0, "DeleteFile failed (%d)", GetLastError( ) );
ok( DeleteFileA( filename ) != 0, "DeleteFile failed (%ld)", GetLastError( ) );
filehandle = _lcreat( filename, 4 ); /* SYSTEM file */
ok( HFILE_ERROR != filehandle, "couldn't create file \"%s\" (err=%d)", filename, GetLastError( ) );
ok( HFILE_ERROR != filehandle, "couldn't create file \"%s\" (err=%ld)", filename, GetLastError( ) );
ok( HFILE_ERROR != _hwrite( filehandle, sillytext, strlen( sillytext ) ), "_hwrite complains" );
......@@ -260,7 +260,7 @@ static void test__lcreat( void )
ok( INVALID_HANDLE_VALUE != FindFirstFileA( filename, &search_results ), "should STILL be able to find file" );
ok( DeleteFileA( filename ) != 0, "DeleteFile failed (%d)", GetLastError( ) );
ok( DeleteFileA( filename ) != 0, "DeleteFile failed (%ld)", GetLastError( ) );
}
......@@ -274,7 +274,7 @@ void test__llseek( void )
filehandle = _lcreat( filename, 0 );
if (filehandle == HFILE_ERROR)
{
ok(0,"couldn't create file \"%s\" (err=%d)",filename,GetLastError());
ok(0,"couldn't create file \"%s\" (err=%ld)",filename,GetLastError());
return;
}
......@@ -296,7 +296,7 @@ void test__llseek( void )
ok( HFILE_ERROR != _llseek( filehandle, 1000000, FILE_END ), "should be able to seek past file; poor, poor Windows programmers" );
ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains" );
ok( DeleteFileA( filename ) != 0, "DeleteFile failed (%d)", GetLastError( ) );
ok( DeleteFileA( filename ) != 0, "DeleteFile failed (%ld)", GetLastError( ) );
}
......@@ -309,7 +309,7 @@ static void test__llopen( void )
filehandle = _lcreat( filename, 0 );
if (filehandle == HFILE_ERROR)
{
ok(0,"couldn't create file \"%s\" (err=%d)",filename,GetLastError());
ok(0,"couldn't create file \"%s\" (err=%ld)",filename,GetLastError());
return;
}
......@@ -333,7 +333,7 @@ static void test__llopen( void )
ok( HFILE_ERROR != _hwrite( filehandle, sillytext, strlen( sillytext ) ), "_hwrite should write just fine" );
ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains" );
ok( DeleteFileA( filename ) != 0, "DeleteFile failed (%d)", GetLastError( ) );
ok( DeleteFileA( filename ) != 0, "DeleteFile failed (%ld)", GetLastError( ) );
/* TODO - add tests for the SHARE modes - use two processes to pull this one off */
}
......@@ -349,7 +349,7 @@ static void test__lread( void )
filehandle = _lcreat( filename, 0 );
if (filehandle == HFILE_ERROR)
{
ok(0,"couldn't create file \"%s\" (err=%d)",filename,GetLastError());
ok(0,"couldn't create file \"%s\" (err=%ld)",filename,GetLastError());
return;
}
......@@ -359,7 +359,7 @@ static void test__lread( void )
filehandle = _lopen( filename, OF_READ );
ok( HFILE_ERROR != filehandle, "couldn't open file \"%s\" again (err=%d)", filename, GetLastError());
ok( HFILE_ERROR != filehandle, "couldn't open file \"%s\" again (err=%ld)", filename, GetLastError());
bytes_read = _lread( filehandle, buffer, 2 * strlen( sillytext ) );
......@@ -377,7 +377,7 @@ static void test__lread( void )
ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains" );
ok( DeleteFileA( filename ) != 0, "DeleteFile failed (%d)", GetLastError( ) );
ok( DeleteFileA( filename ) != 0, "DeleteFile failed (%ld)", GetLastError( ) );
}
......@@ -396,7 +396,7 @@ static void test__lwrite( void )
filehandle = _lcreat( filename, 0 );
if (filehandle == HFILE_ERROR)
{
ok(0,"couldn't create file \"%s\" (err=%d)",filename,GetLastError());
ok(0,"couldn't create file \"%s\" (err=%ld)",filename,GetLastError());
return;
}
......@@ -460,7 +460,7 @@ static void test__lwrite( void )
ok( HFILE_ERROR != _lclose( filehandle ), "_lclose complains" );
ok( DeleteFileA( filename ) != 0, "DeleteFile failed (%d)", GetLastError( ) );
ok( DeleteFileA( filename ) != 0, "DeleteFile failed (%ld)", GetLastError( ) );
}
......
......@@ -252,12 +252,12 @@ static void test_FunnyChars(CHAR *curdir,CHAR *filename,
if(todo) {
todo_wine {
ok(passfail.shorterror==ERROR_FILE_NOT_FOUND,
"%s: GetShortPathA returned %d and not %d",
"%s: GetShortPathA returned %ld and not %d",
errstr,passfail.shorterror,ERROR_FILE_NOT_FOUND);
}
} else {
ok(passfail.shorterror==ERROR_FILE_NOT_FOUND,
"%s: GetShortPathA returned %d and not %d",
"%s: GetShortPathA returned %ld and not %d",
errstr,passfail.shorterror,ERROR_FILE_NOT_FOUND);
}
} else {
......@@ -266,13 +266,13 @@ static void test_FunnyChars(CHAR *curdir,CHAR *filename,
/* Win2k returns ERROR_INVALID_NAME, Win98, wine return ERROR_FILE_NOT_FOUND */
ok(passfail.shorterror==ERROR_INVALID_NAME ||
passfail.shorterror==ERROR_FILE_NOT_FOUND,
"%s: GetShortPathA returned %d and not %d or %d",
"%s: GetShortPathA returned %ld and not %d or %d",
errstr,passfail.shorterror,ERROR_INVALID_NAME,ERROR_FILE_NOT_FOUND);
}
} else {
ok(passfail.shorterror==ERROR_INVALID_NAME ||
passfail.shorterror==ERROR_FILE_NOT_FOUND,
"%s: GetShortPathA returned %d and not %d or %d",
"%s: GetShortPathA returned %ld and not %d or %d",
errstr,passfail.shorterror,ERROR_INVALID_NAME,ERROR_FILE_NOT_FOUND);
}
}
......@@ -280,12 +280,12 @@ static void test_FunnyChars(CHAR *curdir,CHAR *filename,
ok(passfail.longlen==0,"GetLongPathNameA passed when it shouldn't have");
if(valid) {
ok(passfail.longerror==ERROR_FILE_NOT_FOUND,
"%s: GetLongPathA returned %d and not %d",
"%s: GetLongPathA returned %ld and not %d",
errstr,passfail.longerror,ERROR_FILE_NOT_FOUND);
} else {
ok(passfail.longerror==ERROR_INVALID_NAME ||
passfail.longerror==ERROR_FILE_NOT_FOUND,
"%s: GetLongPathA returned %d and not %d or %d'",
"%s: GetLongPathA returned %ld and not %d or %d'",
errstr, passfail.longerror,ERROR_INVALID_NAME,ERROR_FILE_NOT_FOUND);
}
}
......@@ -312,7 +312,7 @@ static void test_setdir(CHAR *olddir,CHAR *newdir,
"%s: SetCurrentDirectory did not change the directory, though it passed",
errstr);
ok(SetCurrentDirectoryA(olddir),
"%s: Couldn't set directory to it's original value");
"%s: Couldn't set directory to it's original value",errstr);
} else {
/* else thest that it fails correctly */
chklen=lstrlenA(olddir);
......@@ -343,7 +343,7 @@ static void test_InitPathA(CHAR *newdir)
lstrcpyA(tmpstr,"aaaaaaaa");
len1=GetTempPathA(len,tmpstr);
ok(len1==len+1,
"GetTempPathA should return string length %d instead of %d",len+1,len1);
"GetTempPathA should return string length %ld instead of %ld",len+1,len1);
if(WIN2K_PLUS(version)) {
/* in Win2k, the path won't be modified, but in win98, wine it is */
todo_wine {
......@@ -419,7 +419,7 @@ static void test_CurrentDirectoryA(CHAR *origdir, CHAR *newdir)
*/
lstrcpyA(tmpstr,"aaaaaaa");
len1=GetCurrentDirectoryA(len,tmpstr);
ok(len1==len+1, "GetCurrentDirectoryA returned %d instead of %d",len1,len+1);
ok(len1==len+1, "GetCurrentDirectoryA returned %ld instead of %ld",len1,len+1);
ok(lstrcmpiA(tmpstr,"aaaaaaa")==0,
"GetCurrentDirectoryA should not have modified the buffer");
/* SetCurrentDirectoryA shouldn't care whether the string has a
......@@ -571,14 +571,14 @@ static void test_PathNameA(CHAR *curdir)
ok(passfail.shortlen==0,"GetShortPathNameA passed when it shouldn't have");
ok(passfail.shorterror==ERROR_PATH_NOT_FOUND ||
passfail.shorterror==ERROR_FILE_NOT_FOUND,
"GetShortPathA returned %d and not 'ERROR_PATH_NOT_FOUND'",
"GetShortPathA returned %ld and not 'ERROR_PATH_NOT_FOUND'",
passfail.shorterror);
}
if(pGetLongPathNameA) {
ok(passfail.longlen==0,"GetLongPathNameA passed when it shouldn't have");
ok(passfail.longerror==ERROR_PATH_NOT_FOUND ||
passfail.longerror==ERROR_FILE_NOT_FOUND,
"GetLongPathA returned %d and not 'ERROR_PATH_NOT_FOUND'",
"GetLongPathA returned %ld and not 'ERROR_PATH_NOT_FOUND'",
passfail.longerror);
}
/* Now try a 8.3 directory, long file name */
......@@ -586,13 +586,13 @@ static void test_PathNameA(CHAR *curdir)
ok(passfail.shortlen==0,"GetShortPathNameA passed when it shouldn't have");
ok(passfail.shorterror==ERROR_PATH_NOT_FOUND ||
passfail.shorterror==ERROR_FILE_NOT_FOUND,
"GetShortPathA returned %d and not 'ERROR_PATH_NOT_FOUND'",
"GetShortPathA returned %ld and not 'ERROR_PATH_NOT_FOUND'",
passfail.shorterror);
if(pGetLongPathNameA) {
ok(passfail.longlen==0,"GetLongPathNameA passed when it shouldn't have");
ok(passfail.longerror==ERROR_PATH_NOT_FOUND ||
passfail.longerror==ERROR_FILE_NOT_FOUND,
"GetLongPathA returned %d and not 'ERROR_PATH_NOT_FOUND'",
"GetLongPathA returned %ld and not 'ERROR_PATH_NOT_FOUND'",
passfail.longerror);
}
/* Next is a long directory, 8.3 file */
......@@ -600,13 +600,13 @@ static void test_PathNameA(CHAR *curdir)
ok(passfail.shortlen==0,"GetShortPathNameA passed when it shouldn't have");
ok(passfail.shorterror==ERROR_PATH_NOT_FOUND ||
passfail.shorterror==ERROR_FILE_NOT_FOUND,
"GetShortPathA returned %d and not 'ERROR_PATH_NOT_FOUND'",
"GetShortPathA returned %ld and not 'ERROR_PATH_NOT_FOUND'",
passfail.shorterror);
if(pGetLongPathNameA) {
ok(passfail.longlen==0,"GetLongPathNameA passed when it shouldn't have");
ok(passfail.longerror==ERROR_PATH_NOT_FOUND ||
passfail.longerror==ERROR_FILE_NOT_FOUND,
"GetLongPathA returned %d and not 'ERROR_PATH_NOT_FOUND'",
"GetLongPathA returned %ld and not 'ERROR_PATH_NOT_FOUND'",
passfail.longerror);
}
/*Lastly a long directory, long file */
......@@ -614,13 +614,13 @@ static void test_PathNameA(CHAR *curdir)
ok(passfail.shortlen==0,"GetShortPathNameA passed when it shouldn't have");
ok(passfail.shorterror==ERROR_PATH_NOT_FOUND ||
passfail.shorterror==ERROR_FILE_NOT_FOUND,
"GetShortPathA returned %d and not 'ERROR_PATH_NOT_FOUND'",
"GetShortPathA returned %ld and not 'ERROR_PATH_NOT_FOUND'",
passfail.shorterror);
if(pGetLongPathNameA) {
ok(passfail.longlen==0,"GetLongPathNameA passed when it shouldn't have");
ok(passfail.longerror==ERROR_PATH_NOT_FOUND ||
passfail.longerror==ERROR_FILE_NOT_FOUND,
"GetLongPathA returned %d and not 'ERROR_PATH_NOT_FOUND'",
"GetLongPathA returned %ld and not 'ERROR_PATH_NOT_FOUND'",
passfail.longerror);
}
/* Next try directories ending with '\\' */
......@@ -635,25 +635,25 @@ static void test_PathNameA(CHAR *curdir)
todo_wine {
ok(passfail.shortlen==0,"GetShortPathNameA passed when it shouldn't have");
ok(passfail.shorterror==ERROR_FILE_NOT_FOUND,
"GetShortPathA returned %d and not 'ERROR_FILE_NOT_FOUND'",
"GetShortPathA returned %ld and not 'ERROR_FILE_NOT_FOUND'",
passfail.shorterror);
}
if(pGetLongPathNameA) {
ok(passfail.longlen==0,"GetLongPathNameA passed when it shouldn't have");
ok(passfail.longerror==ERROR_FILE_NOT_FOUND,
"GetLongPathA returned %d and not 'ERROR_FILE_NOT_FOUND'",
"GetLongPathA returned %ld and not 'ERROR_FILE_NOT_FOUND'",
passfail.longerror);
}
sprintf(tmpstr,"%s\\",NONDIR_LONG);
test_ValidPathA(curdir,"",tmpstr,tmpstr1,&passfail,"test16");
ok(passfail.shortlen==0,"GetShortPathNameA passed when it shouldn't have");
ok(passfail.shorterror==ERROR_FILE_NOT_FOUND,
"GetShortPathA returned %d and not 'ERROR_FILE_NOT_FOUND'",
"GetShortPathA returned %ld and not 'ERROR_FILE_NOT_FOUND'",
passfail.shorterror);
if(pGetLongPathNameA) {
ok(passfail.longlen==0,"GetLongPathNameA passed when it shouldn't have");
ok(passfail.longerror==ERROR_FILE_NOT_FOUND,
"GetLongPathA returned %d and not 'ERROR_FILE_NOT_FOUND'",
"GetLongPathA returned %ld and not 'ERROR_FILE_NOT_FOUND'",
passfail.longerror);
}
/* Now try some relative paths */
......@@ -718,7 +718,7 @@ START_TEST(path)
{
CHAR origdir[MAX_PATH],curdir[MAX_PATH];
version.dwOSVersionInfoSize=sizeof(OSVERSIONINFOA);
ok(GetVersionExA(&version),"GetVersionEx failed: %d",GetLastError());
ok(GetVersionExA(&version),"GetVersionEx failed: %ld",GetLastError());
pGetLongPathNameA = (void*)GetProcAddress( GetModuleHandleA("kernel32.dll"),
"GetLongPathNameA" );
test_InitPathA(curdir);
......
......@@ -331,8 +331,8 @@ static int strCmp(const char* s1, const char* s2, BOOL sensitive)
#define okChildString(sect, key, expect) \
do { \
char* result = getChildString(sect, key); \
ok(strCmp(result, expect, 1) == 0, "%s:%s expected %s, got %s", sect, key, expect, result); \
char* result = getChildString((sect), (key)); \
ok(strCmp(result, expect, 1) == 0, "%s:%s expected %s, got %s", (sect), (key), (expect)?(expect):"(null)", result); \
} while (0)
#define okChildIString(sect, key, expect) \
......@@ -346,8 +346,8 @@ static int strCmp(const char* s1, const char* s2, BOOL sensitive)
*/
#define okChildInt(sect, key, expect) \
do { \
int result = GetPrivateProfileIntA(sect, key, !expect, resfile); \
ok(result == expect, "%s:%s expected %d, but got %d\n", sect, key, expect, result); \
int result = GetPrivateProfileIntA((sect), (key), !(expect), resfile); \
ok(result == expect, "%s:%s expected %d, but got %d\n", (sect), (key), (int)(expect), result); \
} while (0)
static void test_Startup(void)
......
......@@ -182,14 +182,12 @@ VOID test_CreateThread_basic(DWORD version)
for(i=0;i<NUM_THREADS;i++) {
error=WaitForSingleObject(thread[i],5000);
ok(error==WAIT_OBJECT_0, "Thread did not complete within timelimit");
if(ok!=WAIT_OBJECT_0) {
TerminateThread(thread[i],1);
if(error!=WAIT_OBJECT_0) {
TerminateThread(thread[i],i+NUM_THREADS);
}
ok(GetExitCodeThread(thread[i],&exitCode),"Could not retrieve ext code");
todo_wine {
ok(exitCode==i+NUM_THREADS,"Thread returned an incorrect exit code");
}
}
/* Test that each thread executed in its parent's address space
(it was able to change threadmem and pass that change back to its parent)
and that each thread id was independant). Note that we prove that the
......
......@@ -40,19 +40,19 @@ static void create_test_entrys()
{
HKEY hKey;
ok(!RegCreateKeyA(HKEY_CURRENT_USER, "Software\\Wine\\Test", &hKey), "");
ok(!RegCreateKeyA(HKEY_CURRENT_USER, "Software\\Wine\\Test", &hKey), "RegCreateKeyA failed");
if (hKey)
{
ok(!RegSetValueExA(hKey,"Test1",0,REG_EXPAND_SZ, sTestpath1, strlen(sTestpath1)), "");
ok(!RegSetValueExA(hKey,"Test2",0,REG_SZ, sTestpath1, strlen(sTestpath1)), "");
ok(!RegSetValueExA(hKey,"Test3",0,REG_EXPAND_SZ, sTestpath2, strlen(sTestpath2)), "");
ok(!RegSetValueExA(hKey,"Test1",0,REG_EXPAND_SZ, sTestpath1, strlen(sTestpath1)), "RegSetValueExA failed");
ok(!RegSetValueExA(hKey,"Test2",0,REG_SZ, sTestpath1, strlen(sTestpath1)), "RegSetValueExA failed");
ok(!RegSetValueExA(hKey,"Test3",0,REG_EXPAND_SZ, sTestpath2, strlen(sTestpath2)), "RegSetValueExA failed");
RegCloseKey(hKey);
}
ExpandEnvironmentStringsA(sTestpath1, sExpTestpath1, sizeof(sExpTestpath1));
ExpandEnvironmentStringsA(sTestpath2, sExpTestpath2, sizeof(sExpTestpath2));
ok(strlen(sExpTestpath2) > 25, "%USERPROFILE% is set to a short value on this machine. we cant perform all tests.");
ok(strlen(sExpTestpath2) > 25, "%%USERPROFILE%% is set to a short value on this machine. we cant perform all tests.");
}
static void test_SHGetValue(void)
......@@ -64,14 +64,14 @@ static void test_SHGetValue(void)
strcpy(buf, sEmptyBuffer);
dwSize = MAX_PATH;
dwType = -1;
ok(! SHGetValueA(HKEY_CURRENT_USER, "Software\\Wine\\Test", "Test1", &dwType, buf, &dwSize), "");
ok(! SHGetValueA(HKEY_CURRENT_USER, "Software\\Wine\\Test", "Test1", &dwType, buf, &dwSize), "SHGetValueA failed");
ok( 0 == strcmp(sExpTestpath1, buf), "(%s,%s)", buf, sExpTestpath1);
ok( REG_SZ == dwType, "(%lx)", dwType);
strcpy(buf, sEmptyBuffer);
dwSize = MAX_PATH;
dwType = -1;
ok(! SHGetValueA(HKEY_CURRENT_USER, "Software\\Wine\\Test", "Test2", &dwType, buf, &dwSize), "");
ok(! SHGetValueA(HKEY_CURRENT_USER, "Software\\Wine\\Test", "Test2", &dwType, buf, &dwSize), "SHGetValueA failed");
ok( 0 == strcmp(sTestpath1, buf) , "(%s)", buf);
ok( REG_SZ == dwType , "(%lx)", dwType);
}
......@@ -81,7 +81,7 @@ static void test_SHGetTegPath(void)
char buf[MAX_PATH];
strcpy(buf, sEmptyBuffer);
ok(! SHRegGetPathA(HKEY_CURRENT_USER, "Software\\Wine\\Test", "Test1", buf, 0), "");
ok(! SHRegGetPathA(HKEY_CURRENT_USER, "Software\\Wine\\Test", "Test1", buf, 0), "SHRegGetPathA failed");
ok( 0 == strcmp(sExpTestpath1, buf) , "(%s)", buf);
}
......@@ -106,13 +106,13 @@ static void test_SHQUeryValueEx(void)
/*
* Case 1.1 All arguments are NULL
*/
ok(! SHQueryValueExA( hKey, "Test1", NULL, NULL, NULL, NULL), "");
ok(! SHQueryValueExA( hKey, "Test1", NULL, NULL, NULL, NULL), "SHQueryValueExA failed");
/*
* Case 1.2 dwType is set
*/
dwType = -1;
ok(! SHQueryValueExA( hKey, "Test1", NULL, &dwType, NULL, NULL), "");
ok(! SHQueryValueExA( hKey, "Test1", NULL, &dwType, NULL, NULL), "SHQueryValueExA failed");
ok( dwType == REG_SZ, "(%lu)", dwType);
/*
......@@ -120,15 +120,15 @@ static void test_SHQUeryValueEx(void)
* dwExpanded < dwUnExpanded
*/
dwSize = 6;
ok(! SHQueryValueExA( hKey, "Test1", NULL, NULL, NULL, &dwSize), "");
ok( dwSize == nUsedBuffer1, "(%lu,%lu)", dwSize, nUsedBuffer1);
ok(! SHQueryValueExA( hKey, "Test1", NULL, NULL, NULL, &dwSize), "SHQueryValueExA failed");
ok( dwSize == nUsedBuffer1, "(%lu,%u)", dwSize, nUsedBuffer1);
/*
* dwExpanded > dwUnExpanded
*/
dwSize = 6;
ok(! SHQueryValueExA( hKey, "Test3", NULL, NULL, NULL, &dwSize), "");
ok( dwSize == nUsedBuffer2, "(%lu,%lu)", dwSize, nUsedBuffer2);
ok(! SHQueryValueExA( hKey, "Test3", NULL, NULL, NULL, &dwSize), "SHQueryValueExA failed");
ok( dwSize == nUsedBuffer2, "(%lu,%u)", dwSize, nUsedBuffer2);
/*
......@@ -141,7 +141,7 @@ static void test_SHQUeryValueEx(void)
ok( dwRet == ERROR_MORE_DATA, "(%lu)", dwRet);
ok( 0 == strcmp(sEmptyBuffer, buf), "(%s)", buf);
ok( dwType == REG_SZ, "(%lu)" , dwType);
ok( dwSize == nUsedBuffer1, "(%lu,%lu)" , dwSize, nUsedBuffer1);
ok( dwSize == nUsedBuffer1, "(%lu,%u)" , dwSize, nUsedBuffer1);
/*
* string grows during expanding
......@@ -150,9 +150,9 @@ static void test_SHQUeryValueEx(void)
dwSize = 6;
dwType = -1;
dwRet = SHQueryValueExA( hKey, "Test3", NULL, &dwType, buf, &dwSize);
ok( ERROR_MORE_DATA == dwRet, "");
ok( ERROR_MORE_DATA == dwRet, "ERROR_MORE_DATA");
ok( 0 == strcmp(sEmptyBuffer, buf), "(%s)", buf);
ok( dwSize == nUsedBuffer2, "(%lu,%lu)" , dwSize, nUsedBuffer2);
ok( dwSize == nUsedBuffer2, "(%lu,%u)" , dwSize, nUsedBuffer2);
ok( dwType == REG_SZ, "(%lu)" , dwType);
/*
......@@ -161,10 +161,10 @@ static void test_SHQUeryValueEx(void)
strcpy(buf, sEmptyBuffer);
dwSize = 24;
dwType = -1;
ok( ERROR_MORE_DATA == SHQueryValueExA( hKey, "Test3", NULL, &dwType, buf, &dwSize), "");
ok( ERROR_MORE_DATA == SHQueryValueExA( hKey, "Test3", NULL, &dwType, buf, &dwSize), "Expected ERROR_MORE_DATA");
ok( 0 == strncmp(sExpTestpath2, buf, 24-1), "(%s)", buf);
ok( 24-1 == strlen(buf), "(%s)", buf);
ok( dwSize == nUsedBuffer2, "(%lu,%lu)" , dwSize, nUsedBuffer2);
ok( dwSize == nUsedBuffer2, "(%lu,%u)" , dwSize, nUsedBuffer2);
ok( dwType == REG_SZ, "(%lu)" , dwType);
/*
......@@ -175,7 +175,7 @@ static void test_SHQUeryValueEx(void)
dwType = -1;
dwRet = SHQueryValueExA( hKey, "Test3", NULL, &dwType, NULL, &dwSize);
ok( ERROR_SUCCESS == dwRet, "(%lu)", dwRet);
ok( dwSize == nUsedBuffer2, "(%lu,%lu)" , dwSize, nUsedBuffer2);
ok( dwSize == nUsedBuffer2, "(%lu,%u)" , dwSize, nUsedBuffer2);
ok( dwType == REG_SZ, "(%lu)" , dwType);
......
......@@ -108,9 +108,9 @@ BOOL ClassTest(HINSTANCE hInstance, BOOL global)
{
SetLastError(0);
ok(!SetClassLongW(hTestWnd,i*sizeof(DWORD),i+1),
"GetClassLongW(%d) initial value nonzero!");
"GetClassLongW(%ld) initial value nonzero!",i*sizeof(DWORD));
ok(!GetLastError(),
"SetClassLongW(%d) failed!");
"SetClassLongW(%ld) failed!",i*sizeof(DWORD));
}
/* test values of valid classwords that we set */
......@@ -153,15 +153,15 @@ BOOL ClassTest(HINSTANCE hInstance, BOOL global)
if(GetClassInfoW(0, str, &wc))
{
ok(wc.cbClsExtra == cls.cbClsExtra,
"cbClsExtra did not match %x!=%x");
"cbClsExtra did not match %x!=%x",wc.cbClsExtra,cls.cbClsExtra);
ok(wc.cbWndExtra == cls.cbWndExtra,
"cbWndExtra did not match %x!=%x");
"cbWndExtra did not match %x!=%x",wc.cbWndExtra,cls.cbWndExtra);
ok(wc.hbrBackground == cls.hbrBackground,
"hbrBackground did not match %x!=%x");
"hbrBackground did not match %x!=%x",wc.hbrBackground,cls.hbrBackground);
ok(wc.hCursor== cls.hCursor,
"hCursor did not match %x!=%x");
"hCursor did not match %x!=%x",wc.hCursor,cls.hCursor);
ok(!wc.hInstance,
"hInstance not zero for global class %x");
"hInstance not zero for global class %x",wc.hInstance);
}
else
ok(FALSE,"GetClassInfo (0) failed for global class!");
......
......@@ -184,7 +184,7 @@ static int do_synchronous_send ( SOCKET s, char *buf, int buflen, int sendlen )
int n = 1;
for ( p = buf; n > 0 && p < last; p += n )
n = send ( s, p, min ( sendlen, last - p ), 0 );
wsa_ok ( n, 0 <=, "do_synchronous_send (%x): error %d" );
wsa_ok ( n, 0 <=, "do_synchronous_send (%lx): error %d" );
return p - buf;
}
......@@ -194,7 +194,7 @@ static int do_synchronous_recv ( SOCKET s, char *buf, int buflen, int recvlen )
int n = 1;
for ( p = buf; n > 0 && p < last; p += n )
n = recv ( s, p, min ( recvlen, last - p ), 0 );
wsa_ok ( n, 0 <=, "do_synchronous_recv (%x): error %d:" );
wsa_ok ( n, 0 <=, "do_synchronous_recv (%lx): error %d:" );
return p - buf;
}
......@@ -305,7 +305,7 @@ static void client_start ( client_params *par )
static void client_stop (void)
{
client_memory *mem = TlsGetValue ( tls );
wsa_ok ( closesocket ( mem->s ), 0 ==, "closesocket error (%x): %d\n" );
wsa_ok ( closesocket ( mem->s ), 0 ==, "closesocket error (%lx): %d\n" );
LocalFree ( (HANDLE) mem->send_buf );
LocalFree ( (HANDLE) mem );
ExitThread(0);
......@@ -330,8 +330,8 @@ static VOID WINAPI simple_server ( server_params *par )
server_start ( par );
mem = TlsGetValue ( tls );
wsa_ok ( set_blocking ( mem->s, TRUE ), 0 ==, "simple_server (%x): failed to set blocking mode: %d");
wsa_ok ( listen ( mem->s, SOMAXCONN ), 0 ==, "simple_server (%x): listen failed: %d");
wsa_ok ( set_blocking ( mem->s, TRUE ), 0 ==, "simple_server (%lx): failed to set blocking mode: %d");
wsa_ok ( listen ( mem->s, SOMAXCONN ), 0 ==, "simple_server (%lx): listen failed: %d");
trace ( "simple_server (%x) ready\n", id );
SetEvent ( server_ready ); /* notify clients */
......@@ -343,7 +343,7 @@ static VOID WINAPI simple_server ( server_params *par )
/* accept a single connection */
tmp = sizeof ( mem->sock[0].peer );
mem->sock[0].s = accept ( mem->s, (struct sockaddr*) &mem->sock[0].peer, &tmp );
wsa_ok ( mem->sock[0].s, INVALID_SOCKET !=, "simple_server (%x): accept failed: %d" );
wsa_ok ( mem->sock[0].s, INVALID_SOCKET !=, "simple_server (%lx): accept failed: %d" );
ok ( mem->sock[0].peer.sin_addr.s_addr == inet_addr ( gen->inet_addr ),
"simple_server (%x): strange peer address", id );
......@@ -353,7 +353,7 @@ static VOID WINAPI simple_server ( server_params *par )
ok ( n_recvd == n_expected,
"simple_server (%x): received less data then expected: %d of %d", id, n_recvd, n_expected );
p = test_buffer ( mem->sock[0].buf, gen->chunk_size, gen->n_chunks );
ok ( p == NULL, "simple_server (%x): test pattern error: %d", p - mem->sock[0].buf);
ok ( p == NULL, "simple_server (%x): test pattern error: %d", id, p - mem->sock[0].buf);
/* Echo data back */
n_sent = do_synchronous_send ( mem->sock[0].s, mem->sock[0].buf, n_expected, par->buflen );
......@@ -362,7 +362,7 @@ static VOID WINAPI simple_server ( server_params *par )
/* cleanup */
read_zero_bytes ( mem->sock[0].s );
wsa_ok ( closesocket ( mem->sock[0].s ), 0 ==, "simple_server (%x): closesocket error: %d" );
wsa_ok ( closesocket ( mem->sock[0].s ), 0 ==, "simple_server (%lx): closesocket error: %d" );
mem->sock[0].s = INVALID_SOCKET;
}
......@@ -395,7 +395,7 @@ static VOID WINAPI simple_client ( client_params *par )
/* Connect */
wsa_ok ( connect ( mem->s, (struct sockaddr*) &mem->addr, sizeof ( mem->addr ) ),
0 ==, "simple_client (%x): connect error: %d" );
0 ==, "simple_client (%lx): connect error: %d" );
ok ( set_blocking ( mem->s, TRUE ) == 0,
"simple_client (%x): failed to set blocking mode", id );
trace ( "simple_client (%x) connected\n", id );
......@@ -406,7 +406,7 @@ static VOID WINAPI simple_client ( client_params *par )
"simple_client (%x): sent less data then expected: %d of %d", id, n_sent, n_expected );
/* shutdown send direction */
wsa_ok ( shutdown ( mem->s, SD_SEND ), 0 ==, "simple_client (%x): shutdown failed: %d" );
wsa_ok ( shutdown ( mem->s, SD_SEND ), 0 ==, "simple_client (%lx): shutdown failed: %d" );
/* Receive data echoed back & check it */
n_recvd = do_synchronous_recv ( mem->s, mem->recv_buf, n_expected, par->buflen );
......@@ -453,7 +453,7 @@ static void WINAPI event_client ( client_params *par )
tmp = WaitForSingleObject ( event, INFINITE );
ok ( tmp == WAIT_OBJECT_0, "event_client (%x): wait for connect event failed: %d", id, tmp );
err = WSAEnumNetworkEvents ( mem->s, event, &wsa_events );
wsa_ok ( err, 0 ==, "event_client (%x): WSAEnumNetworkEvents error: %d\n" );
wsa_ok ( err, 0 ==, "event_client (%lx): WSAEnumNetworkEvents error: %d\n" );
err = wsa_events.iErrorCode[ FD_CONNECT_BIT ];
ok ( err == 0, "event_client (%x): connect error: %d", id, err );
......@@ -471,10 +471,10 @@ static void WINAPI event_client ( client_params *par )
while ( TRUE )
{
err = WaitForSingleObject ( event, INFINITE );
ok ( err == WAIT_OBJECT_0, "event_client (%x): wait failed", id, tmp );
ok ( err == WAIT_OBJECT_0, "event_client (%x): wait failed", id );
err = WSAEnumNetworkEvents ( mem->s, event, &wsa_events );
wsa_ok ( err, 0 ==, "event_client (%x): WSAEnumNetworkEvents error: %d\n" );
wsa_ok ( err, 0 ==, "event_client (%lx): WSAEnumNetworkEvents error: %d\n" );
if ( wsa_events.lNetworkEvents & FD_WRITE )
{
......@@ -509,7 +509,7 @@ static void WINAPI event_client ( client_params *par )
ok ( err == 0, "event_client (%x): FD_READ error code: %d\n", id, err );
n = recv ( mem->s, recv_p, min ( recv_last - recv_p, par->buflen ), 0 );
wsa_ok ( n, 0 <=, "event_client (%x): recv error: %d\n" );
wsa_ok ( n, 0 <=, "event_client (%lx): recv error: %d\n" );
if ( err != 0 || n < 0 )
break;
else if ( n == 0 )
......@@ -610,7 +610,7 @@ static void do_test( test_setup *test )
{
for (i = 0; i <= n; i++)
{
trace ("terminating thread %08x\n", thread_id[i]);
trace ("terminating thread %08lx\n", thread_id[i]);
if ( WaitForSingleObject ( thread[i], 0 ) != WAIT_OBJECT_0 )
TerminateThread ( thread [i], 0 );
}
......
......@@ -30,11 +30,8 @@ extern int winetest_debug;
/* current platform */
extern const char *winetest_platform;
typedef int (*winetest_ok_funcptr)( int condition, const char *msg, ...);
typedef void (*winetest_trace_funcptr)( const char *msg, ...);
extern winetest_ok_funcptr winetest_set_ok_location( const char* file, int line );
extern winetest_trace_funcptr winetest_set_trace_location( const char* file, int line );
extern void winetest_set_ok_location( const char* file, int line );
extern void winetest_set_trace_location( const char* file, int line );
extern void winetest_start_todo( const char* platform );
extern int winetest_loop_todo(void);
extern void winetest_end_todo( const char* platform );
......@@ -42,8 +39,23 @@ extern int winetest_get_mainargs( char*** pargv );
#define START_TEST(name) void func_##name(void)
#define ok (*winetest_set_ok_location(__FILE__, __LINE__))
#define trace (*winetest_set_trace_location(__FILE__, __LINE__))
#ifdef __GNUC__
extern int winetest_ok( int condition, const char *msg, ... ) __attribute__((format (printf,2,3) ));
extern void winetest_trace( const char *msg, ... ) __attribute__((format (printf,1,2)));
#define ok(cond,args...) (winetest_set_ok_location(__FILE__, __LINE__), winetest_ok((cond),args))
#define trace(args...) (winetest_set_trace_location(__FILE__, __LINE__), winetest_trace(args))
#else /* __GNUC__ */
extern int winetest_ok( int condition, const char *msg, ... );
extern void winetest_trace( const char *msg, ... );
#define ok (winetest_set_ok_location(__FILE__, __LINE__), 0) ? 0 : winetest_ok
#define trace (winetest_set_trace_location(__FILE__, __LINE__), 0) ? (void)0 : winetest_trace
#endif /* __GNUC__ */
#define todo(platform) for (winetest_start_todo(platform); \
winetest_loop_todo(); \
......
......@@ -148,12 +148,11 @@ int winetest_ok( int condition, const char *msg, ... )
return 1;
}
winetest_ok_funcptr winetest_set_ok_location( const char* file, int line )
void winetest_set_ok_location( const char* file, int line )
{
tls_data* data=get_tls_data();
data->current_file=file;
data->current_line=line;
return &winetest_ok;
}
void winetest_trace( const char *msg, ... )
......@@ -170,12 +169,11 @@ void winetest_trace( const char *msg, ... )
}
}
winetest_trace_funcptr winetest_set_trace_location( const char* file, int line )
void winetest_set_trace_location( const char* file, int line )
{
tls_data* data=get_tls_data();
data->current_file=file;
data->current_line=line;
return &winetest_trace;
}
void winetest_start_todo( const char* platform )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment