winefile: Do not use the TEXT() macro on character constants. The implicit cast from char to WCHAR works as well in UNICODE mode.

Michael Stefaniuc mstefani at redhat.de
Wed Jun 27 15:54:56 CDT 2007


winefile.c uses a mixture of styles for comparisons: "a==b" and
"a == b" with the later style being in the majority. So i've changed
the comparisons in the lines i had to modify to the "a == b" style.
---
 programs/winefile/winefile.c |   64 +++++++++++++++++++++---------------------
 1 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/programs/winefile/winefile.c b/programs/winefile/winefile.c
index 7a0577e..860ecd2 100644
--- a/programs/winefile/winefile.c
+++ b/programs/winefile/winefile.c
@@ -455,7 +455,7 @@ static Entry* find_entry_win(Entry* dir, LPCTSTR name)
 		LPCTSTR q = entry->data.cFileName;
 
 		do {
-			if (!*p || *p==TEXT('\\') || *p==TEXT('/'))
+			if (!*p || *p == '\\' || *p == '/')
 				return entry;
 		} while(tolower(*p++) == tolower(*q++));
 
@@ -463,7 +463,7 @@ static Entry* find_entry_win(Entry* dir, LPCTSTR name)
 		q = entry->data.cAlternateFileName;
 
 		do {
-			if (!*p || *p==TEXT('\\') || *p==TEXT('/'))
+			if (!*p || *p == '\\' || *p == '/')
 				return entry;
 		} while(tolower(*p++) == tolower(*q++));
 	}
@@ -486,14 +486,14 @@ static Entry* read_tree_win(Root* root, LPCTSTR path, SORT_ORDER sortOrder, HWND
 #endif
 
 	while(entry) {
-		while(*s && *s!=TEXT('\\') && *s!=TEXT('/'))
+		while(*s && *s != '\\' && *s != '/')
 			*d++ = *s++;
 
-		while(*s==TEXT('\\') || *s==TEXT('/'))
+		while(*s == '\\' || *s == '/')
 			s++;
 
-		*d++ = TEXT('\\');
-		*d = TEXT('\0');
+		*d++ = '\\';
+		*d = '\0';
 
 		read_directory(entry, buffer, sortOrder, hwnd);
 
@@ -634,7 +634,7 @@ static Entry* find_entry_unix(Entry* dir, LPCTSTR name)
 		LPCTSTR q = entry->data.cFileName;
 
 		do {
-			if (!*p || *p==TEXT('/'))
+			if (!*p || *p == '/')
 				return entry;
 		} while(*p++ == *q++);
 	}
@@ -654,14 +654,14 @@ static Entry* read_tree_unix(Root* root, LPCTSTR path, SORT_ORDER sortOrder, HWN
 	entry->etype = ET_UNIX;
 
 	while(entry) {
-		while(*s && *s!=TEXT('/'))
+		while(*s && *s != '/')
 			*d++ = *s++;
 
-		while(*s == TEXT('/'))
+		while(*s == '/')
 			s++;
 
-		*d++ = TEXT('/');
-		*d = TEXT('\0');
+		*d++ = '/';
+		*d = '\0';
 
 		read_directory(entry, buffer, sortOrder, hwnd);
 
@@ -1195,8 +1195,8 @@ static int compareExt(const void* arg1, const void* arg2)
 	name1 = fd1->cFileName;
 	name2 = fd2->cFileName;
 
-	ext1 = _tcsrchr(name1, TEXT('.'));
-	ext2 = _tcsrchr(name2, TEXT('.'));
+	ext1 = _tcsrchr(name1, '.');
+	ext2 = _tcsrchr(name2, '.');
 
 	if (ext1)
 		ext1++;
@@ -1308,7 +1308,7 @@ static void read_directory(Entry* dir, LPCTSTR path, SORT_ORDER sortOrder, HWND
 			while(*s)
 				*d++ = *s++;
 
-			*d++ = TEXT('\\');
+			*d++ = '\\';
 
 			for(entry=dir->down; entry; entry=entry->next)
 				if (entry->data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
@@ -1331,7 +1331,7 @@ static void read_directory(Entry* dir, LPCTSTR path, SORT_ORDER sortOrder, HWND
 			while(*s)
 				*d++ = *s++;
 
-			*d++ = TEXT('/');
+			*d++ = '/';
 
 			for(entry=dir->down; entry; entry=entry->next)
 				if (entry->data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
@@ -1353,7 +1353,7 @@ static void read_directory(Entry* dir, LPCTSTR path, SORT_ORDER sortOrder, HWND
 			while(*s)
 				*d++ = *s++;
 
-			*d++ = TEXT('\\');
+			*d++ = '\\';
 
 			for(entry=dir->down; entry; entry=entry->next)
 				if (entry->data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
@@ -1521,7 +1521,7 @@ static void get_path(Entry* dir, PTSTR path)
 		SFGAOF attribs;
 		HRESULT hr = S_OK;
 
-		path[0] = TEXT('\0');
+		path[0] = '\0';
 
 		attribs = 0;
 
@@ -1546,7 +1546,7 @@ static void get_path(Entry* dir, PTSTR path)
 				name = entry->data.cFileName;
 				s = name;
 
-				for(l=0; *s && *s!=TEXT('/') && *s!=TEXT('\\'); s++)
+				for(l=0; *s && *s != '/' && *s != '\\'; s++)
 					l++;
 			}
 
@@ -1558,10 +1558,10 @@ static void get_path(Entry* dir, PTSTR path)
 
 #ifndef _NO_EXTENSIONS
 					if (entry->etype == ET_UNIX)
-						path[0] = TEXT('/');
+						path[0] = '/';
 					else
 #endif
-					path[0] = TEXT('\\');
+					path[0] = '\\';
 				}
 
 				entry = entry->up;
@@ -1576,13 +1576,13 @@ static void get_path(Entry* dir, PTSTR path)
 		if (!level) {
 #ifndef _NO_EXTENSIONS
 			if (entry->etype == ET_UNIX)
-				path[len++] = TEXT('/');
+				path[len++] = '/';
 			else
 #endif
-				path[len++] = TEXT('\\');
+				path[len++] = '\\';
 		}
 
-		path[len] = TEXT('\0');
+		path[len] = '\0';
 	}
 }
 
@@ -2651,7 +2651,7 @@ static void init_output(HWND hwnd)
 	if (GetNumberFormat(LOCALE_USER_DEFAULT, 0, s1000, 0, b, 16) > 4)
 		Globals.num_sep = b[1];
 	else
-		Globals.num_sep = TEXT('.');
+		Globals.num_sep = '.';
 
 	old_font = SelectObject(hdc, Globals.hfont);
 	GetTextExtentPoint32(hdc, sSpace, 1, &Globals.spaceSize);
@@ -2877,12 +2877,12 @@ static int insert_entries(Pane* pane, Entry* dir, LPCTSTR pattern, int filter_fl
 
 		if (entry->data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
 			/* don't display entries "." and ".." in the left pane */
-			if (pane->treePane && entry->data.cFileName[0]==TEXT('.'))
+			if (pane->treePane && entry->data.cFileName[0] == '.')
 				if (
 #ifndef _NO_EXTENSIONS
-					entry->data.cFileName[1]==TEXT('\0') ||
+					entry->data.cFileName[1] == '\0' ||
 #endif
-					(entry->data.cFileName[1]==TEXT('.') && entry->data.cFileName[2]==TEXT('\0')))
+					(entry->data.cFileName[1] == '.' && entry->data.cFileName[2] == '\0'))
 					continue;
 
 			/* filter directories in right pane */
@@ -3015,7 +3015,7 @@ static void format_date(const FILETIME* ft, TCHAR* buffer, int visible_cols)
 	FILETIME lft;
 	int len = 0;
 
-	*buffer = TEXT('\0');
+	*buffer = '\0';
 
 	if (!ft->dwLowDateTime && !ft->dwHighDateTime)
 		return;
@@ -3039,7 +3039,7 @@ static void format_date(const FILETIME* ft, TCHAR* buffer, int visible_cols)
 		buffer[len++] = ' ';
 
 		if (!GetTimeFormat(LOCALE_USER_DEFAULT, 0, &systime, 0, buffer+len, BUFFER_LEN-len))
-			buffer[len] = TEXT('\0');
+			buffer[len] = '\0';
 	}
 }
 
@@ -3200,11 +3200,11 @@ static void draw_item(Pane* pane, LPDRAWITEMSTRUCT dis, Entry* entry, int calcWi
 		attrs = entry->data.dwFileAttributes;
 
 		if (attrs & FILE_ATTRIBUTE_DIRECTORY) {
-			if (entry->data.cFileName[0]==TEXT('.') && entry->data.cFileName[1]==TEXT('.')
-					&& entry->data.cFileName[2]==TEXT('\0'))
+			if (entry->data.cFileName[0] == '.' && entry->data.cFileName[1] == '.'
+					&& entry->data.cFileName[2] == '\0')
 				img = IMG_FOLDER_UP;
 #ifndef _NO_EXTENSIONS
-			else if (entry->data.cFileName[0]==TEXT('.') && entry->data.cFileName[1]==TEXT('\0'))
+			else if (entry->data.cFileName[0] == '.' && entry->data.cFileName[1] == '\0')
 				img = IMG_FOLDER_CUR;
 #endif
 			else if (
-- 
1.5.0.6
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20070627/11aa20f4/attachment-0001.pgp


More information about the wine-patches mailing list