winefile sync with ReactOS

Martin Fuchs martin-fuchs at gmx.net
Sun Sep 19 07:56:14 CDT 2004


Changelog:
- Handle "." and ".." as special case and move them at the very first beginning of directory listings
- remove unused variable wStringTableOffset


Index: winefile.c
===================================================================
RCS file: /home/wine/wine/programs/winefile/winefile.c,v
retrieving revision 1.18
diff -u -p -d -r1.18 winefile.c
--- winefile.c	24 Aug 2004 18:33:01 -0000	1.18
+++ winefile.c	19 Sep 2004 12:53:32 -0000
@@ -990,10 +990,16 @@ static void read_directory_shell(Entry* 
 /* directories first... */
 static int compareType(const WIN32_FIND_DATA* fd1, const WIN32_FIND_DATA* fd2)
 {
-	int dir1 = fd1->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY;
-	int dir2 = fd2->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY;
+	int order1 = fd1->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY;
+	int order2 = fd2->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY;
 
-	return dir2==dir1? 0: dir2<dir1? -1: 1;
+	/* Handle "." and ".." as special case and move them at the very first beginning. */
+	if (order1 && order2) {
+		order1 = fd1->cFileName[0]!='.'? 1: fd1->cFileName[1]=='.'? 2: fd1->cFileName[1]=='\0'? 3: 1;
+		order2 = fd2->cFileName[0]!='.'? 1: fd2->cFileName[1]=='.'? 2: fd2->cFileName[1]=='\0'? 3: 1;
+	}
+
+	return order2==order1? 0: order2<order1? -1: 1;
 }
 
 
Index: winefile.h
===================================================================
RCS file: /home/wine/wine/programs/winefile/winefile.h,v
retrieving revision 1.6
diff -u -p -d -r1.6 winefile.h
--- winefile.h	13 Aug 2003 01:18:37 -0000	1.6
+++ winefile.h	19 Sep 2004 12:53:32 -0000
@@ -143,8 +143,6 @@ typedef struct
   TCHAR		drives[BUFFER_LEN];
   BOOL		prescan_node;	/*TODO*/
 
-  UINT		wStringTableOffset;
-
 #ifdef _SHELL_FOLDERS
   IShellFolder*	iDesktop;
   IMalloc*		iMalloc;





More information about the wine-patches mailing list