[Scummvm-cvs-logs] CVS: scummvm/backends/fs/windows windows-fs.cpp,1.24,1.25

Torbjörn Andersson eriktorbjorn at users.sourceforge.net
Sun Feb 20 07:34:03 CET 2005


Update of /cvsroot/scummvm/scummvm/backends/fs/windows
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9303

Modified Files:
	windows-fs.cpp 
Log Message:
Fixed warning, hopefully without breaking anything. (GCC doesn't like
casting from "const char *" to "char *".)


Index: windows-fs.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/fs/windows/windows-fs.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- windows-fs.cpp	19 Feb 2005 16:00:22 -0000	1.24
+++ windows-fs.cpp	20 Feb 2005 15:33:14 -0000	1.25
@@ -54,7 +54,7 @@
 
 private:
 	static char *toAscii(TCHAR *x);
-	static TCHAR* toUnicode(char *x);
+	static const TCHAR* toUnicode(const char *x);
 	static void addFile (FSList &list, ListMode mode, const char *base, WIN32_FIND_DATA* find_data);
 };
 
@@ -70,12 +70,11 @@
 #endif
 }
 
-TCHAR* WindowsFilesystemNode::toUnicode(char *x) {
-
+const TCHAR* WindowsFilesystemNode::toUnicode(const char *x) {
 #ifndef UNICODE
-	return (TCHAR*)x;
+	return (const TCHAR *)x;
 #else
-	static TCHAR unicodeString[MAX_PATH];
+	static const TCHAR unicodeString[MAX_PATH];
 	MultiByteToWideChar(CP_ACP, 0, x, strlen(x) + 1, unicodeString, sizeof(unicodeString));
 	return unicodeString;
 #endif
@@ -150,7 +149,7 @@
 	_displayName = String(str + offset, len);
 
 	// Check whether it is a directory, and whether the file actually exists
-	DWORD fileAttribs = GetFileAttributes(toUnicode((char *)_path.c_str()));
+	DWORD fileAttribs = GetFileAttributes(toUnicode(_path.c_str()));
 
 	if (fileAttribs == 0xffffffff) {
 		_isValid = false;
@@ -199,8 +198,8 @@
 	else {
 		// Files enumeration
 		WIN32_FIND_DATA desc;
-		HANDLE			handle;
-		char			searchPath[MAX_PATH + 10];
+		HANDLE handle;
+		char searchPath[MAX_PATH + 10];
 
 		sprintf(searchPath, "%s*", _path.c_str());
 





More information about the Scummvm-git-logs mailing list