[Scummvm-cvs-logs] SF.net SVN: scummvm:[49871] scummvm/trunk/common

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Tue Jun 15 19:33:45 CEST 2010


Revision: 49871
          http://scummvm.svn.sourceforge.net/scummvm/?rev=49871&view=rev
Author:   lordhoto
Date:     2010-06-15 17:33:45 +0000 (Tue, 15 Jun 2010)

Log Message:
-----------
Use a Common::String instead of a fixed size array for _syslang in TranslationManager.

Modified Paths:
--------------
    scummvm/trunk/common/translation.cpp
    scummvm/trunk/common/translation.h

Modified: scummvm/trunk/common/translation.cpp
===================================================================
--- scummvm/trunk/common/translation.cpp	2010-06-15 17:14:38 UTC (rev 49870)
+++ scummvm/trunk/common/translation.cpp	2010-06-15 17:33:45 UTC (rev 49871)
@@ -52,17 +52,12 @@
 	const char *locale = setlocale(LC_ALL, "");
 
 	// Detect the language from the locale
-	if (!locale) {
-		strcpy(_syslang, "C");
-	} else {
-		int len = strlen(locale);
-		if (len > 5)
-			len = 5;
-		strncpy(_syslang, locale, len);
-		_syslang[len] = 0;
-	}
+	if (!locale)
+		_syslang = "C";
+	else
+		_syslang = locale;
 #else // DETECTLANG
-	strcpy(_syslang, "C");
+	_syslang = "C";
 #endif // DETECTLANG
 
 #ifdef TERMCONV
@@ -84,7 +79,7 @@
 
 void TranslationManager::setLanguage(const char *lang) {
 	if (*lang == '\0')
-		po2c_setlang(_syslang);
+		po2c_setlang(_syslang.c_str());
 	else
 		po2c_setlang(lang);
 

Modified: scummvm/trunk/common/translation.h
===================================================================
--- scummvm/trunk/common/translation.h	2010-06-15 17:14:38 UTC (rev 49870)
+++ scummvm/trunk/common/translation.h	2010-06-15 17:33:45 UTC (rev 49871)
@@ -61,7 +61,7 @@
  */
 class TranslationManager : public Singleton<TranslationManager> {
 private:
-	char _syslang[6];
+	Common::String _syslang;
 
 #ifdef TERMCONV
 	iconv_t _conversion;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list