Correct use of the ok function II

Rein Klazes wijn at wanadoo.nl
Fri Dec 24 05:56:51 CST 2004


Hi,

Final batch of 75 fixes. 

Changelog:
        dlls/advapi32/tests     : security.c
        dlls/gdi/tests          : brush.c, gdiobj.c, metafile.c
        dlls/lzexpand/tests     : lzexpand_main.c
        dlls/mscms/tests        : profile.c
        dlls/msvcrt/tests       : file.c
        dlls/shell32/tests      : shellpath.c
        dlls/shlwapi/tests      : ordinal.c
        dlls/wininet/tests      : http.c

        Correct cases where arguments of ok() calls depend on the order
        in which they are evaluated.

Rein.
-------------- next part --------------
--- wine/dlls/advapi32/tests/security.c	2004-11-04 10:17:12.000000000 +0100
+++ mywine/dlls/advapi32/tests/security.c	2004-12-23 15:31:29.000000000 +0100
@@ -222,13 +222,15 @@ static void test_allocateLuid(void)
 
     ok(ret,
      "AllocateLocallyUniqueId failed: %ld\n", GetLastError());
-    ok(pAllocateLocallyUniqueId(&luid2),
+    ret = pAllocateLocallyUniqueId(&luid2);
+    ok( ret,
      "AllocateLocallyUniqueId failed: %ld\n", GetLastError());
     ok(luid1.LowPart > SE_MAX_WELL_KNOWN_PRIVILEGE || luid1.HighPart != 0,
      "AllocateLocallyUniqueId returned a well-known LUID\n");
     ok(luid1.LowPart != luid2.LowPart || luid1.HighPart != luid2.HighPart,
      "AllocateLocallyUniqueId returned non-unique LUIDs\n");
-    ok(!pAllocateLocallyUniqueId(NULL) && GetLastError() == ERROR_NOACCESS,
+    ret = pAllocateLocallyUniqueId(NULL);
+    ok( !ret && GetLastError() == ERROR_NOACCESS,
      "AllocateLocallyUniqueId(NULL) didn't return ERROR_NOACCESS: %ld\n",
      GetLastError());
 }
@@ -253,8 +255,8 @@ static void test_lookupPrivilegeName(voi
     /* check with a short buffer */
     cchName = 0;
     luid.LowPart = SE_CREATE_TOKEN_PRIVILEGE;
-    ok(!pLookupPrivilegeNameA(NULL, &luid, NULL, &cchName) &&
-     GetLastError() == ERROR_INSUFFICIENT_BUFFER,
+    ret = pLookupPrivilegeNameA(NULL, &luid, NULL, &cchName);
+    ok( !ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER,
      "LookupPrivilegeNameA didn't fail with ERROR_INSUFFICIENT_BUFFER: %ld\n",
      GetLastError());
     ok(cchName == strlen("SeCreateTokenPrivilege") + 1,
@@ -273,21 +275,22 @@ static void test_lookupPrivilegeName(voi
     {
         luid.LowPart = i;
         cchName = sizeof(buf);
-        ok(pLookupPrivilegeNameA(NULL, &luid, buf, &cchName),
+        ret = pLookupPrivilegeNameA(NULL, &luid, buf, &cchName);
+        ok( ret,
          "LookupPrivilegeNameA(0.%ld) failed: %ld\n", i, GetLastError());
     }
     /* check a bogus LUID */
     luid.LowPart = 0xdeadbeef;
     cchName = sizeof(buf);
-    ok(!pLookupPrivilegeNameA(NULL, &luid, buf, &cchName) &&
-     GetLastError() == ERROR_NO_SUCH_PRIVILEGE,
+    ret = pLookupPrivilegeNameA(NULL, &luid, buf, &cchName);
+    ok( !ret && GetLastError() == ERROR_NO_SUCH_PRIVILEGE,
      "LookupPrivilegeNameA didn't fail with ERROR_NO_SUCH_PRIVILEGE: %ld\n",
      GetLastError());
     /* check on a bogus system */
     luid.LowPart = SE_CREATE_TOKEN_PRIVILEGE;
     cchName = sizeof(buf);
-    ok(!pLookupPrivilegeNameA("b0gu5.Nam3", &luid, buf, &cchName) &&
-     GetLastError() == RPC_S_SERVER_UNAVAILABLE,
+    ret = pLookupPrivilegeNameA("b0gu5.Nam3", &luid, buf, &cchName);
+    ok( !ret && GetLastError() == RPC_S_SERVER_UNAVAILABLE,
      "LookupPrivilegeNameA didn't fail with RPC_S_SERVER_UNAVAILABLE: %ld\n",
      GetLastError());
 }
@@ -344,22 +347,23 @@ static void test_lookupPrivilegeValue(vo
         return;
 
     /* check a bogus system name */
-    ok(!pLookupPrivilegeValueA("b0gu5.Nam3", "SeCreateTokenPrivilege", &luid)
-     && GetLastError() == RPC_S_SERVER_UNAVAILABLE,
+    ret = pLookupPrivilegeValueA("b0gu5.Nam3", "SeCreateTokenPrivilege", &luid);
+    ok( !ret && GetLastError() == RPC_S_SERVER_UNAVAILABLE,
      "LookupPrivilegeValueA didn't fail with RPC_S_SERVER_UNAVAILABLE: %ld\n",
      GetLastError());
     /* check a NULL string */
-    ok(!pLookupPrivilegeValueA(NULL, 0, &luid) &&
-     GetLastError() == ERROR_NO_SUCH_PRIVILEGE,
+    ret = pLookupPrivilegeValueA(NULL, 0, &luid);
+    ok( !ret && GetLastError() == ERROR_NO_SUCH_PRIVILEGE,
      "LookupPrivilegeValueA didn't fail with ERROR_NO_SUCH_PRIVILEGE: %ld\n",
      GetLastError());
     /* check a bogus privilege name */
-    ok(!pLookupPrivilegeValueA(NULL, "SeBogusPrivilege", &luid) &&
-     GetLastError() == ERROR_NO_SUCH_PRIVILEGE,
+    ret = pLookupPrivilegeValueA(NULL, "SeBogusPrivilege", &luid);
+    ok( !ret && GetLastError() == ERROR_NO_SUCH_PRIVILEGE,
      "LookupPrivilegeValueA didn't fail with ERROR_NO_SUCH_PRIVILEGE: %ld\n",
      GetLastError());
     /* check case insensitive */
-    ok(pLookupPrivilegeValueA(NULL, "sEcREATEtOKENpRIVILEGE", &luid),
+    ret = pLookupPrivilegeValueA(NULL, "sEcREATEtOKENpRIVILEGE", &luid);
+    ok( ret,
      "LookupPrivilegeValueA(NULL, sEcREATEtOKENpRIVILEGE, &luid) failed: %ld\n",
      GetLastError());
     for (i = 0; i < sizeof(privs) / sizeof(privs[0]); i++)
--- wine/dlls/gdi/tests/brush.c	2004-11-24 19:09:20.000000000 +0100
+++ mywine/dlls/gdi/tests/brush.c	2004-12-23 15:51:18.000000000 +0100
@@ -45,6 +45,7 @@ static void test_solidbrush()
     HBRUSH stockBrush;
     LOGBRUSH br;
     size_t i;
+    INT ret;
 
     for(i=0; i<sizeof(stock)/sizeof(stock[0]); i++) {
         solidBrush = CreateSolidBrush(stock[i].color);
@@ -56,13 +57,15 @@ static void test_solidbrush()
         else
             stockBrush = NULL;
         memset(&br, sizeof(br), 0);
-        ok(GetObject(solidBrush, sizeof(br), &br)!=0, "GetObject on solid %s brush failed, error=%ld\n", stock[i].name, GetLastError());
+        ret = GetObject(solidBrush, sizeof(br), &br);
+        ok( ret !=0, "GetObject on solid %s brush failed, error=%ld\n", stock[i].name, GetLastError());
         ok(br.lbStyle==BS_SOLID, "%s brush has wrong style, got %d expected %d\n", stock[i].name, br.lbStyle, BS_SOLID);
         ok(br.lbColor==stock[i].color, "%s brush has wrong color, got 0x%08lx expected 0x%08lx\n", stock[i].name, br.lbColor, stock[i].color);
         
         if(stockBrush) {
             /* Sanity check, make sure the colors being compared do in fact have a stock brush */
-            ok(GetObject(stockBrush, sizeof(br), &br)!=0, "GetObject on stock %s brush failed, error=%ld\n", stock[i].name, GetLastError());
+            ret = GetObject(stockBrush, sizeof(br), &br);
+            ok( ret !=0, "GetObject on stock %s brush failed, error=%ld\n", stock[i].name, GetLastError());
             ok(br.lbColor==stock[i].color, "stock %s brush unexpected color, got 0x%08lx expected 0x%08lx\n", stock[i].name, br.lbColor, stock[i].color);
         }
 
--- wine/dlls/gdi/tests/gdiobj.c	2004-11-23 17:03:31.000000000 +0100
+++ mywine/dlls/gdi/tests/gdiobj.c	2004-12-23 15:55:53.000000000 +0100
@@ -211,6 +211,7 @@ static void test_gdi_objects(void)
     HDC hdc = GetDC(NULL);
     HPEN hp;
     int i;
+    BOOL ret;
 
     /* SelectObject() with a NULL DC returns 0 and sets ERROR_INVALID_HANDLE.
      * Note: Under XP at least invalid ptrs can also be passed, not just NULL;
@@ -244,9 +245,10 @@ static void test_gdi_objects(void)
        hp, GetLastError());
 
     /* DeleteObject does not SetLastError() on a null object */
-    ok(!DeleteObject(NULL) && !GetLastError(),
+    ret = DeleteObject(NULL);
+    ok( !ret && !GetLastError(),
        "DeleteObject(NULL obj), expected 0, NO_ERROR, got %d, 0x%08lx\n",
-       DeleteObject(NULL), GetLastError());
+       ret, GetLastError());
 
     /* GetObject does not SetLastError() on a null object */
     SetLastError(0);
--- wine/dlls/gdi/tests/metafile.c	2004-12-09 19:07:18.000000000 +0100
+++ mywine/dlls/gdi/tests/metafile.c	2004-12-23 16:24:21.000000000 +0100
@@ -38,6 +38,7 @@ static int CALLBACK emf_enum_proc(HDC hd
     const INT *dx;
     INT *orig_dx = (INT *)param;
     LOGFONTA device_lf;
+    INT ret;
 
     trace("hdc %p, emr->iType %ld, emr->nSize %ld, param %p\n",
            hdc, emr->iType, emr->nSize, (void *)param);
@@ -55,8 +56,8 @@ static int CALLBACK emf_enum_proc(HDC hd
         const EMREXTTEXTOUTA *emr_ExtTextOutA = (const EMREXTTEXTOUTA *)emr;
         dx = (const INT *)((const char *)emr + emr_ExtTextOutA->emrtext.offDx);
 
-        ok(GetObjectA(GetCurrentObject(hdc, OBJ_FONT), sizeof(device_lf), &device_lf) == sizeof(device_lf),
-           "GetObjectA error %ld\n", GetLastError());
+        ret = GetObjectA(GetCurrentObject(hdc, OBJ_FONT), sizeof(device_lf), &device_lf);
+        ok( ret == sizeof(device_lf), "GetObjectA error %ld\n", GetLastError());
 
         /* compare up to lfOutPrecision, other values are not interesting,
          * and in fact sometimes arbitrary adapted by Win9x.
@@ -79,8 +80,8 @@ static int CALLBACK emf_enum_proc(HDC hd
         const EMREXTTEXTOUTW *emr_ExtTextOutW = (const EMREXTTEXTOUTW *)emr;
         dx = (const INT *)((const char *)emr + emr_ExtTextOutW->emrtext.offDx);
 
-        ok(GetObjectA(GetCurrentObject(hdc, OBJ_FONT), sizeof(device_lf), &device_lf) == sizeof(device_lf),
-           "GetObjectA error %ld\n", GetLastError());
+        ret = GetObjectA(GetCurrentObject(hdc, OBJ_FONT), sizeof(device_lf), &device_lf);
+        ok( ret == sizeof(device_lf), "GetObjectA error %ld\n", GetLastError());
 
         /* compare up to lfOutPrecision, other values are not interesting,
          * and in fact sometimes arbitrary adapted by Win9x.
@@ -114,6 +115,7 @@ static void test_ExtTextOut(void)
     static const char text[] = "Simple text to test ExtTextOut on metafiles";
     INT i, len, dx[256];
     static const RECT rc = { 0, 0, 100, 100 };
+    BOOL ret;
 
     assert(sizeof(dx)/sizeof(dx[0]) >= lstrlenA(text));
 
@@ -145,8 +147,8 @@ static void test_ExtTextOut(void)
     len = lstrlenA(text);
     for (i = 0; i < len; i++)
     {
-        ok(GetCharWidthA(hdcDisplay, text[i], text[i], &dx[i]),
-           "GetCharWidthA error %ld\n", GetLastError());
+        ret = GetCharWidthA(hdcDisplay, text[i], text[i], &dx[i]);
+        ok( ret, "GetCharWidthA error %ld\n", GetLastError());
     }
     hFont = SelectObject(hdcDisplay, hFont);
 
@@ -161,33 +163,37 @@ static void test_ExtTextOut(void)
     hFont = SelectObject(hdcMetafile, hFont);
 
     /* 1. pass NULL lpDx */
-    ok(ExtTextOutA(hdcMetafile, 0, 0, 0, &rc, text, lstrlenA(text), NULL),
-       "ExtTextOutA error %ld\n", GetLastError());
+    ret = ExtTextOutA(hdcMetafile, 0, 0, 0, &rc, text, lstrlenA(text), NULL);
+    ok( ret, "ExtTextOutA error %ld\n", GetLastError());
 
     /* 2. pass custom lpDx */
-    ok(ExtTextOutA(hdcMetafile, 0, 20, 0, &rc, text, lstrlenA(text), dx),
-       "ExtTextOutA error %ld\n", GetLastError());
+    ret = ExtTextOutA(hdcMetafile, 0, 20, 0, &rc, text, lstrlenA(text), dx);
+    ok( ret, "ExtTextOutA error %ld\n", GetLastError());
 
     hFont = SelectObject(hdcMetafile, hFont);
-    ok(DeleteObject(hFont), "DeleteObject error %ld\n", GetLastError());
+    ret = DeleteObject(hFont);
+    ok( ret, "DeleteObject error %ld\n", GetLastError());
 
     hMetafile = CloseEnhMetaFile(hdcMetafile);
     ok(hMetafile != 0, "CloseEnhMetaFile error %ld\n", GetLastError());
 
     ok(!GetObjectType(hdcMetafile), "CloseEnhMetaFile has to destroy metafile hdc\n");
 
-    ok(PlayEnhMetaFile(hdcDisplay, hMetafile, &rc), "PlayEnhMetaFile error %ld\n", GetLastError());
+    ret = PlayEnhMetaFile(hdcDisplay, hMetafile, &rc);
+    ok( ret, "PlayEnhMetaFile error %ld\n", GetLastError());
 
-    ok(EnumEnhMetaFile(hdcDisplay, hMetafile, emf_enum_proc, dx, &rc),
-       "EnumEnhMetaFile error %ld\n", GetLastError());
+    ret = EnumEnhMetaFile(hdcDisplay, hMetafile, emf_enum_proc, dx, &rc);
+    ok( ret, "EnumEnhMetaFile error %ld\n", GetLastError());
 
     ok(emr_processed, "EnumEnhMetaFile couldn't find EMR_EXTTEXTOUTA or EMR_EXTTEXTOUTW record\n");
 
     ok(!EnumEnhMetaFile(hdcDisplay, hMetafile, emf_enum_proc, dx, NULL),
        "A valid hdc has to require a valid rc\n");
 
-    ok(DeleteEnhMetaFile(hMetafile), "DeleteEnhMetaFile error %ld\n", GetLastError());
-    ok(ReleaseDC(hwnd, hdcDisplay), "ReleaseDC error %ld\n", GetLastError());
+    ret = DeleteEnhMetaFile(hMetafile);
+    ok( ret, "DeleteEnhMetaFile error %ld\n", GetLastError());
+    ret = ReleaseDC(hwnd, hdcDisplay);
+    ok( ret, "ReleaseDC error %ld\n", GetLastError());
 }
 
 /* Win-format metafile (mfdrv) tests */
@@ -317,6 +323,7 @@ static void test_mf_Blank(void)
     HDC hdcMetafile;
     HMETAFILE hMetafile;
     INT caps;
+    BOOL ret;
 
     hdcMetafile = CreateMetaFileA(NULL);
     ok(hdcMetafile != 0, "CreateMetaFileA(NULL) error %ld\n", GetLastError());
@@ -335,7 +342,8 @@ static void test_mf_Blank(void)
         "mf_blank") != 0)
             dump_mf_bits (hMetafile, "mf_Blank");
 
-    ok(DeleteMetaFile(hMetafile), "DeleteMetaFile(%p) error %ld\n", hMetafile, GetLastError());
+    ret = DeleteMetaFile(hMetafile);
+    ok( ret, "DeleteMetaFile(%p) error %ld\n", hMetafile, GetLastError());
 }
 
 /* Simple APIs from mfdrv/graphics.c
@@ -346,14 +354,18 @@ static void test_mf_Graphics()
     HDC hdcMetafile;
     HMETAFILE hMetafile;
     POINT oldpoint;
+    BOOL ret;
 
     hdcMetafile = CreateMetaFileA(NULL);
     ok(hdcMetafile != 0, "CreateMetaFileA(NULL) error %ld\n", GetLastError());
     trace("hdcMetafile %p\n", hdcMetafile);
 
-    ok(MoveToEx(hdcMetafile, 1, 1, NULL), "MoveToEx error %ld.\n", GetLastError());
-    ok(LineTo(hdcMetafile, 2, 2), "LineTo error %ld.\n", GetLastError());
-    ok(MoveToEx(hdcMetafile, 1, 1, &oldpoint), "MoveToEx error %ld.\n", GetLastError());
+    ret = MoveToEx(hdcMetafile, 1, 1, NULL);
+    ok( ret, "MoveToEx error %ld.\n", GetLastError());
+    ret = LineTo(hdcMetafile, 2, 2);
+    ok( ret, "LineTo error %ld.\n", GetLastError());
+    ret = MoveToEx(hdcMetafile, 1, 1, &oldpoint);
+    ok( ret, "MoveToEx error %ld.\n", GetLastError());
 
 /* oldpoint gets garbage under Win XP, so the following test would
  * work under Wine but fails under Windows:
@@ -363,7 +375,8 @@ static void test_mf_Graphics()
  *       oldpoint.x, oldpoint.y);
  */
 
-    ok(Ellipse(hdcMetafile, 0, 0, 2, 2), "Ellipse error %ld.\n", GetLastError());
+    ret = Ellipse(hdcMetafile, 0, 0, 2, 2);
+    ok( ret, "Ellipse error %ld.\n", GetLastError());
 
     hMetafile = CloseMetaFile(hdcMetafile);
     ok(hMetafile != 0, "CloseMetaFile error %ld\n", GetLastError());
@@ -373,7 +386,8 @@ static void test_mf_Graphics()
         "mf_Graphics") != 0)
             dump_mf_bits (hMetafile, "mf_Graphics");
 
-    ok(DeleteMetaFile(hMetafile), "DeleteMetaFile(%p) error %ld\n",
+    ret = DeleteMetaFile(hMetafile);
+    ok( ret, "DeleteMetaFile(%p) error %ld\n",
         hMetafile, GetLastError());
 }
 
@@ -383,6 +397,7 @@ static void test_mf_PatternBrush(void)
     HMETAFILE hMetafile;
     LOGBRUSH *orig_lb;
     HBRUSH hBrush;
+    BOOL ret;
 
     orig_lb = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(LOGBRUSH));
 
@@ -409,9 +424,12 @@ static void test_mf_PatternBrush(void)
         "mf_Pattern_Brush") != 0)
             dump_mf_bits (hMetafile, "mf_Pattern_Brush");
 
-    ok(DeleteMetaFile(hMetafile), "DeleteMetaFile error %ld\n", GetLastError());
-    ok(DeleteObject(hBrush), "DeleteObject(HBRUSH) error %ld\n", GetLastError());
-    ok(DeleteObject((HBITMAP *)orig_lb->lbHatch), "DeleteObject(HBITMAP) error %ld\n",
+    ret = DeleteMetaFile(hMetafile);
+    ok( ret, "DeleteMetaFile error %ld\n", GetLastError());
+    ret = DeleteObject(hBrush);
+    ok( ret, "DeleteObject(HBRUSH) error %ld\n", GetLastError());
+    ret = DeleteObject((HBITMAP *)orig_lb->lbHatch);
+    ok( ret, "DeleteObject(HBITMAP) error %ld\n",
         GetLastError());
     HeapFree (GetProcessHeap(), 0, orig_lb);
 }
--- wine/dlls/lzexpand/tests/lzexpand_main.c	2004-11-21 17:05:14.000000000 +0100
+++ mywine/dlls/lzexpand/tests/lzexpand_main.c	2004-12-23 16:37:24.000000000 +0100
@@ -140,12 +140,13 @@ static void test_lzread(void)
   DWORD ret;
   int cfile;
   OFSTRUCT test;
+  BOOL retok;
 
   /* Create the compressed file. */
   file = CreateFile(filename_, GENERIC_WRITE, 0, NULL, CREATE_NEW, 0, 0);
   ok(file != INVALID_HANDLE_VALUE, "Could not create test file\n");
-  ok2(WriteFile(file, compressed_file, compressed_file_size, &ret, 0),
-     "WriteFile: error %ld\n", GetLastError());
+  retok = WriteFile(file, compressed_file, compressed_file_size, &ret, 0);
+  ok2( retok, "WriteFile: error %ld\n", GetLastError());
   ok(ret == compressed_file_size, "Wrote wrong number of bytes with WriteFile?\n");
   CloseHandle(file);
 
@@ -177,13 +178,14 @@ static void test_lzcopy(void)
   DWORD ret;
   int source, dest;
   OFSTRUCT stest, dtest;
+  BOOL retok;
 
   /* Create the compressed file. */
   file = CreateFile(filename_, GENERIC_WRITE, 0, NULL, CREATE_NEW, 0, 0);
   ok2(file != INVALID_HANDLE_VALUE, 
      "CreateFile: error %ld\n", GetLastError());
-  ok2(WriteFile(file, compressed_file, compressed_file_size, &ret, 0),
-     "WriteFile error %ld\n", GetLastError());
+  retok = WriteFile(file, compressed_file, compressed_file_size, &ret, 0);
+  ok2( retok, "WriteFile error %ld\n", GetLastError());
   ok(ret == compressed_file_size, "Wrote wrong number of bytes\n");
   CloseHandle(file);
 
@@ -203,8 +205,8 @@ static void test_lzcopy(void)
   ok2(file != INVALID_HANDLE_VALUE,
      "CreateFile: error %ld\n", GetLastError());
 
-  ok2(ReadFile(file, buf, uncompressed_data_size*2, &ret, 0) &&
-     ret == uncompressed_data_size, "ReadFile: error %ld\n", GetLastError());
+  retok = ReadFile(file, buf, uncompressed_data_size*2, &ret, 0);
+  ok2( retok && ret == uncompressed_data_size, "ReadFile: error %ld\n", GetLastError());
   /* Compare what we read with what we think we should read. */
   ok(!memcmp(buf, uncompressed_data, uncompressed_data_size),
      "buffer contents mismatch\n");
--- wine/dlls/mscms/tests/profile.c	2004-12-20 18:18:52.000000000 +0100
+++ mywine/dlls/mscms/tests/profile.c	2004-12-23 17:12:40.000000000 +0100
@@ -630,6 +630,7 @@ static void test_OpenColorProfileA()
 {
     PROFILE profile;
     HPROFILE handle;
+    BOOL ret;
 
     profile.dwType = PROFILE_FILENAME;
     profile.pProfileData = NULL;
@@ -670,7 +671,8 @@ static void test_OpenColorProfileA()
         handle = OpenColorProfileA( &profile, PROFILE_READ, 0, OPEN_EXISTING );
         ok( handle != NULL, "OpenColorProfileA() failed (%ld)\n", GetLastError() );
 
-        ok( CloseColorProfile( handle ), "CloseColorProfile() failed (%ld)\n", GetLastError() );
+        ret = CloseColorProfile( handle );
+        ok( ret, "CloseColorProfile() failed (%ld)\n", GetLastError() );
     }
 }
 
@@ -678,6 +680,7 @@ static void test_OpenColorProfileW()
 {
     PROFILE profile;
     HPROFILE handle;
+    BOOL ret;
 
     profile.dwType = PROFILE_FILENAME;
     profile.pProfileData = NULL;
@@ -718,7 +721,8 @@ static void test_OpenColorProfileW()
         handle = OpenColorProfileW( &profile, PROFILE_READ, 0, OPEN_EXISTING );
         ok( handle != NULL, "OpenColorProfileW() failed (%ld)\n", GetLastError() );
 
-        ok( CloseColorProfile( handle ), "CloseColorProfile() failed (%ld)\n", GetLastError() );
+        ret = CloseColorProfile( handle );
+        ok( ret, "CloseColorProfile() failed (%ld)\n", GetLastError() );
     }
 }
 
--- wine/dlls/msvcrt/tests/file.c	2004-12-20 18:18:55.000000000 +0100
+++ mywine/dlls/msvcrt/tests/file.c	2004-12-23 15:06:53.000000000 +0100
@@ -187,10 +187,12 @@ static void test_file_write_read( void )
   static const char mytext[]=  "This is test_file_write_read\nsecond line\n";
   static const char dostext[]= "This is test_file_write_read\r\nsecond line\r\n";
   char btext[LLEN];
+  int ret;
 
   tempf=_tempnam(".","wne");
-  ok((tempfd = _open(tempf,_O_CREAT|_O_TRUNC|_O_TEXT|_O_RDWR,
-                     _S_IREAD | _S_IWRITE)) != -1,
+  tempfd = _open(tempf,_O_CREAT|_O_TRUNC|_O_TEXT|_O_RDWR,
+                     _S_IREAD | _S_IWRITE);
+  ok( tempfd != -1,
      "Can't open '%s': %d\n", tempf, errno); /* open in TEXT mode */
   ok(_write(tempfd,mytext,strlen(mytext)) == lstrlenA(mytext),
      "_write _O_TEXT bad return value\n");
@@ -208,10 +210,12 @@ static void test_file_write_read( void )
   ok( memcmp(mytext,btext,strlen(mytext)) == 0,
       "problems with _O_TEXT _write / _read\n");
   _close(tempfd);
-  ok(unlink(tempf) !=-1 ,"Can't unlink '%s': %d\n", tempf, errno);
+  ret = unlink(tempf);
+  ok( ret !=-1 ,"Can't unlink '%s': %d\n", tempf, errno);
 
   tempf=_tempnam(".","wne");
-  ok((tempfd = _open(tempf,_O_CREAT|_O_TRUNC|_O_BINARY|_O_RDWR,0)) != -1,
+  tempfd = _open(tempf,_O_CREAT|_O_TRUNC|_O_BINARY|_O_RDWR,0);
+  ok( tempfd != -1,
      "Can't open '%s': %d\n", tempf, errno); /* open in BINARY mode */
   ok(_write(tempfd,dostext,strlen(dostext)) == lstrlenA(dostext),
      "_write _O_BINARY bad return value\n");
@@ -230,17 +234,21 @@ static void test_file_write_read( void )
       "problems with _O_BINARY _write / _O_TEXT _read\n");
   _close(tempfd);
 
-  ok(_chmod (tempf, _S_IREAD | _S_IWRITE) == 0,
+   ret =_chmod (tempf, _S_IREAD | _S_IWRITE);
+  ok( ret == 0,
      "Can't chmod '%s' to read-write: %d\n", tempf, errno);
-  ok(unlink(tempf) !=-1 ,"Can't unlink '%s': %d\n", tempf, errno);
+  ret = unlink(tempf);
+  ok( ret !=-1 ,"Can't unlink '%s': %d\n", tempf, errno);
 }
 
 static void test_file_inherit_child(const char* fd_s)
 {
     int fd = atoi(fd_s);
     char buffer[32];
+    int ret;
 
-    ok(write(fd, "Success", 8) == 8, "Couldn't write in child process on %d (%s)\n", fd, strerror(errno));
+    ret =write(fd, "Success", 8);
+    ok( ret == 8, "Couldn't write in child process on %d (%s)\n", fd, strerror(errno));
     lseek(fd, 0, SEEK_SET);
     ok(read(fd, buffer, sizeof (buffer)) == 8, "Couldn't read back the data\n");
     ok(memcmp(buffer, "Success", 8) == 0, "Couldn't read back the data\n");
@@ -249,8 +257,10 @@ static void test_file_inherit_child(cons
 static void test_file_inherit_child_no(const char* fd_s)
 {
     int fd = atoi(fd_s);
+    int ret;
 
-    ok(write(fd, "Success", 8) == -1 && errno == EBADF, 
+    ret = write(fd, "Success", 8);
+    ok( ret == -1 && errno == EBADF, 
        "Wrong write result in child process on %d (%s)\n", fd, strerror(errno));
 }
  
--- wine/dlls/shell32/tests/shellpath.c	2004-10-28 08:36:31.000000000 +0200
+++ mywine/dlls/shell32/tests/shellpath.c	2004-12-24 09:13:34.000000000 +0100
@@ -821,6 +821,7 @@ static void testNonExistentPath(void)
                 STARTUPINFOA startup;
                 PROCESS_INFORMATION info;
                 HRESULT hr;
+                BOOL ret;
 
                 wnsprintfA(buffer, sizeof(buffer), "%s tests/shellpath.c 1",
                  selfname);
@@ -856,8 +857,8 @@ static void testNonExistentPath(void)
                 ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0,
                  "child process termination\n");
 
-                ok(RemoveDirectoryA(modifiedPath),
-                 "RemoveDirectoryA failed: %ld\n", GetLastError());
+                ret = RemoveDirectoryA(modifiedPath);
+                ok( ret, "RemoveDirectoryA failed: %ld\n", GetLastError());
             }
         }
         else if (winetest_interactive)
--- wine/dlls/shlwapi/tests/ordinal.c	2004-12-20 18:19:15.000000000 +0100
+++ mywine/dlls/shlwapi/tests/ordinal.c	2004-12-24 09:26:19.000000000 +0100
@@ -205,12 +205,13 @@ static void test_alloc_shared()
     HANDLE hmem;
     int val;
     int* p;
+    BOOL ret;
 
     procid=GetCurrentProcessId();
     hmem=pSHAllocShared(NULL,10,procid);
     ok(hmem!=NULL,"SHAllocShared(NULL...) failed: %ld\n", GetLastError());
-    ok(pSHFreeShared(hmem, procid),
-       "SHFreeShared failed: %ld\n", GetLastError());
+    ret = pSHFreeShared(hmem, procid);
+    ok( ret, "SHFreeShared failed: %ld\n", GetLastError());
 
     val=0x12345678;
     hmem=pSHAllocShared(&val,4,procid);
@@ -220,10 +221,11 @@ static void test_alloc_shared()
     ok(p!=NULL,"SHLockShared failed: %ld\n", GetLastError());
     if (p!=NULL)
         ok(*p==val,"Wrong value in shared memory: %d instead of %d\n",*p,val);
-    ok(pSHUnlockShared(p),"SHUnlockShared failed: %ld\n", GetLastError());
+    ret = pSHUnlockShared(p);
+    ok( ret, "SHUnlockShared failed: %ld\n", GetLastError());
 
-    ok(pSHFreeShared(hmem, procid),
-       "SHFreeShared failed: %ld\n", GetLastError());
+    ret = pSHFreeShared(hmem, procid);
+    ok( ret, "SHFreeShared failed: %ld\n", GetLastError());
 }
 
 START_TEST(ordinal)
--- wine/dlls/wininet/tests/http.c	2004-10-30 08:55:07.000000000 +0200
+++ mywine/dlls/wininet/tests/http.c	2004-12-24 11:42:39.000000000 +0100
@@ -218,12 +218,13 @@ void InternetOpenUrlA_test(void)
   char protocol[32], hostName[1024], userName[1024];
   char password[1024], extra[1024], path[1024];
   DWORD size, readbytes, totalbytes=0;
+  BOOL ret;
   
   myhinternet = InternetOpen("Winetest",0,NULL,NULL,INTERNET_FLAG_NO_CACHE_WRITE);
   ok((myhinternet != 0), "InternetOpen failed, error %lx\n",GetLastError());
   size = 0x400;
-  ok (InternetCanonicalizeUrl(TEST_URL, buffer, &size,ICU_BROWSER_MODE),
-      "InternetCanonicalizeUrl failed, error %lx\n",GetLastError());
+  ret = InternetCanonicalizeUrl(TEST_URL, buffer, &size,ICU_BROWSER_MODE);
+  ok( ret, "InternetCanonicalizeUrl failed, error %lx\n",GetLastError());
   
   urlComponents.dwStructSize = sizeof(URL_COMPONENTSA);
   urlComponents.lpszScheme = protocol;
@@ -238,15 +239,16 @@ void InternetOpenUrlA_test(void)
   urlComponents.dwUrlPathLength = 2048;
   urlComponents.lpszExtraInfo = extra;
   urlComponents.dwExtraInfoLength = 1024;
-  ok((InternetCrackUrl(TEST_URL, 0,0,&urlComponents)),
-     "InternetCrackUrl failed, error %lx\n",GetLastError());
+  ret = InternetCrackUrl(TEST_URL, 0,0,&urlComponents);
+  ok( ret, "InternetCrackUrl failed, error %lx\n",GetLastError());
   SetLastError(0);
   myhttp = InternetOpenUrl(myhinternet, TEST_URL, 0, 0,
 			   INTERNET_FLAG_RELOAD|INTERNET_FLAG_NO_CACHE_WRITE|INTERNET_FLAG_TRANSFER_BINARY,0);
   if (GetLastError() == 12007)
     return; /* WinXP returns this when not connected to the net */
   ok((myhttp != 0),"InternetOpenUrl failed, error %lx\n",GetLastError());
-  ok(InternetReadFile(myhttp, buffer,0x400,&readbytes), "InternetReadFile failed, error %lx\n",GetLastError());
+  ret = InternetReadFile(myhttp, buffer,0x400,&readbytes);
+  ok( ret, "InternetReadFile failed, error %lx\n",GetLastError());
   totalbytes += readbytes;
   while (readbytes && InternetReadFile(myhttp, buffer,0x400,&readbytes))
     totalbytes += readbytes;
@@ -258,6 +260,7 @@ void InternetCrackUrl_test(void)
   URL_COMPONENTSA urlComponents;
   char protocol[32], hostName[1024], userName[1024];
   char password[1024], extra[1024], path[1024];
+  BOOL ret;
 
   urlComponents.dwStructSize = sizeof(URL_COMPONENTSA);
   urlComponents.lpszScheme = protocol;
@@ -272,8 +275,8 @@ void InternetCrackUrl_test(void)
   urlComponents.dwUrlPathLength = 2048;
   urlComponents.lpszExtraInfo = extra;
   urlComponents.dwExtraInfoLength = 1024;
-  ok((InternetCrackUrl(TEST_URL, 0,0,&urlComponents)),
-     "InternetCrackUrl failed, error %lx\n",GetLastError());
+  ret = InternetCrackUrl(TEST_URL, 0,0,&urlComponents);
+  ok( ret, "InternetCrackUrl failed, error %lx\n",GetLastError());
   ok((strcmp(TEST_URL_PATH,path) == 0),"path cracked wrong\n");
 }
 


More information about the wine-patches mailing list