[Box Backup-commit] COMMIT r2416 - box/trunk/lib/win32

boxbackup-dev at boxbackup.org boxbackup-dev at boxbackup.org
Tue Dec 30 18:30:13 GMT 2008


Author: chris
Date: 2008-12-30 18:30:12 +0000 (Tue, 30 Dec 2008)
New Revision: 2416

Modified:
   box/trunk/lib/win32/emu.cpp
   box/trunk/lib/win32/emu.h
Log:
Change ConvertTo/FromUtf8 to take a std::string instead of a const char 
*, for convenience and C++ style.


Modified: box/trunk/lib/win32/emu.cpp
===================================================================
--- box/trunk/lib/win32/emu.cpp	2008-12-30 14:54:55 UTC (rev 2415)
+++ box/trunk/lib/win32/emu.cpp	2008-12-30 18:30:12 UTC (rev 2416)
@@ -468,24 +468,26 @@
 	return true;
 }
 
-bool ConvertToUtf8(const char* pString, std::string& rDest, int sourceCodePage)
+bool ConvertToUtf8(const std::string& rSource, std::string& rDest,
+	int sourceCodePage)
 {
-	return ConvertEncoding(pString, sourceCodePage, rDest, CP_UTF8);
+	return ConvertEncoding(rSource, sourceCodePage, rDest, CP_UTF8);
 }
 
-bool ConvertFromUtf8(const char* pString, std::string& rDest, int destCodePage)
+bool ConvertFromUtf8(const std::string& rSource, std::string& rDest,
+	int destCodePage)
 {
-	return ConvertEncoding(pString, CP_UTF8, rDest, destCodePage);
+	return ConvertEncoding(rSource, CP_UTF8, rDest, destCodePage);
 }
 
-bool ConvertConsoleToUtf8(const char* pString, std::string& rDest)
+bool ConvertConsoleToUtf8(const std::string& rSource, std::string& rDest)
 {
-	return ConvertEncoding(pString, GetConsoleCP(), rDest, CP_UTF8);
+	return ConvertToUtf8(rSource, rDest, GetConsoleCP());
 }
 
-bool ConvertUtf8ToConsole(const char* pString, std::string& rDest)
+bool ConvertUtf8ToConsole(const std::string& rSource, std::string& rDest)
 {
-	return ConvertEncoding(pString, CP_UTF8, rDest, GetConsoleOutputCP());
+	return ConvertFromUtf8(rSource, rDest, GetConsoleOutputCP());
 }
 
 // --------------------------------------------------------------------------

Modified: box/trunk/lib/win32/emu.h
===================================================================
--- box/trunk/lib/win32/emu.h	2008-12-30 14:54:55 UTC (rev 2415)
+++ box/trunk/lib/win32/emu.h	2008-12-30 18:30:12 UTC (rev 2416)
@@ -384,8 +384,8 @@
 	int sourceCodePage);
 bool ConvertFromUtf8 (const std::string& rSource, std::string& rDest,
 	int destCodePage);
-bool ConvertUtf8ToConsole(const char* pString, std::string& rDest);
-bool ConvertConsoleToUtf8(const char* pString, std::string& rDest);
+bool ConvertUtf8ToConsole(const std::string& rSource, std::string& rDest);
+bool ConvertConsoleToUtf8(const std::string& rSource, std::string& rDest);
 
 // Utility function which returns a default config file name,
 // based on the path of the current executable.




More information about the Boxbackup-commit mailing list