wine/dlls/kernel tests/path.c path.c

Alexandre Julliard julliard at wine.codeweavers.com
Sat Nov 12 13:09:06 CST 2005


ChangeSet ID:	21227
CVSROOT:	/opt/cvs-commit
Module name:	wine
Changes by:	julliard at winehq.org	2005/11/12 13:09:06

Modified files:
	dlls/kernel/tests: path.c 
	dlls/kernel    : path.c 

Log message:
	Phil Lodwick <Phil.Lodwick at EFI.COM>
	prefix can be NULL for GetTempFileNameW.

Patch: http://cvs.winehq.org/patch.py?id=21227

Old revision  New revision  Changes     Path
 1.31          1.32          +10 -1      wine/dlls/kernel/tests/path.c
 1.26          1.27          +3 -2       wine/dlls/kernel/path.c

Index: wine/dlls/kernel/tests/path.c
diff -u -p wine/dlls/kernel/tests/path.c:1.31 wine/dlls/kernel/tests/path.c:1.32
--- wine/dlls/kernel/tests/path.c:1.31	12 Nov 2005 19: 9: 6 -0000
+++ wine/dlls/kernel/tests/path.c	12 Nov 2005 19: 9: 6 -0000
@@ -335,9 +335,18 @@ static void test_InitPathA(CHAR *newdir,
   sprintf(tmpstr1,"pat%x.tmp",id & 0xffff);
   ok(lstrcmpiA(newdir+lstrlenA(tmppath),tmpstr)==0 ||
      lstrcmpiA(newdir+lstrlenA(tmppath),tmpstr1)==0,
-     "GetTempPath returned '%s' which doesn't match '%s' or '%s'. id=%x\n",
+     "GetTempFileNameA returned '%s' which doesn't match '%s' or '%s'. id=%x\n",
      newdir,tmpstr,tmpstr1,id);
 
+  ok((id=GetTempFileNameA(tmppath,NULL,0,newdir)),"GetTempFileNameA failed\n");
+  sprintf(tmpstr,"%.4x.tmp",id & 0xffff);
+  sprintf(tmpstr1,"%x.tmp",id & 0xffff);
+  ok(lstrcmpiA(newdir+lstrlenA(tmppath),tmpstr)==0 ||
+     lstrcmpiA(newdir+lstrlenA(tmppath),tmpstr1)==0,
+     "GetTempFileNameA returned '%s' which doesn't match '%s' or '%s'. id=%x\n",
+     newdir,tmpstr,tmpstr1,id);
+
+
 /* Find first valid drive letter that is neither newdir[0] nor curDrive */
   drives = GetLogicalDrives() & ~(1<<(newdir[0]-'A'));
   if( *curDrive != NOT_A_VALID_DRIVE)
Index: wine/dlls/kernel/path.c
diff -u -p wine/dlls/kernel/path.c:1.26 wine/dlls/kernel/path.c:1.27
--- wine/dlls/kernel/path.c:1.26	12 Nov 2005 19: 9: 6 -0000
+++ wine/dlls/kernel/path.c	12 Nov 2005 19: 9: 6 -0000
@@ -651,7 +651,7 @@ UINT WINAPI GetTempFileNameW( LPCWSTR pa
     int i;
     LPWSTR p;
 
-    if ( !path || !prefix || !buffer )
+    if ( !path || !buffer )
     {
         SetLastError( ERROR_INVALID_PARAMETER );
         return 0;
@@ -663,7 +663,8 @@ UINT WINAPI GetTempFileNameW( LPCWSTR pa
     /* add a \, if there isn't one  */
     if ((p == buffer) || (p[-1] != '\\')) *p++ = '\\';
 
-    for (i = 3; (i > 0) && (*prefix); i--) *p++ = *prefix++;
+    if (prefix)
+        for (i = 3; (i > 0) && (*prefix); i--) *p++ = *prefix++;
 
     unique &= 0xffff;
 



More information about the wine-cvs mailing list