[Scummvm-cvs-logs] SF.net SVN: scummvm:[52758] scummvm/trunk/engines/agos/saveload.cpp

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Fri Sep 17 14:54:01 CEST 2010


Revision: 52758
          http://scummvm.svn.sourceforge.net/scummvm/?rev=52758&view=rev
Author:   lordhoto
Date:     2010-09-17 12:54:00 +0000 (Fri, 17 Sep 2010)

Log Message:
-----------
I18N: Use a String instead of a char buffer.

This should improve r52751, since String does automatic memory handling, thus
no more buffer overflows should by possible by having a too large translated
string.

Modified Paths:
--------------
    scummvm/trunk/engines/agos/saveload.cpp

Modified: scummvm/trunk/engines/agos/saveload.cpp
===================================================================
--- scummvm/trunk/engines/agos/saveload.cpp	2010-09-17 12:37:59 UTC (rev 52757)
+++ scummvm/trunk/engines/agos/saveload.cpp	2010-09-17 12:54:00 UTC (rev 52758)
@@ -147,14 +147,14 @@
 	}
 
 	bool success;
-	char buf[80];
+	Common::String buf;
 
 	char *filename = genSaveName(_saveLoadSlot);
 	if (_saveLoadType == 2) {
 		Subroutine *sub;
 		success = loadGame(genSaveName(_saveLoadSlot));
 		if (!success) {
-			snprintf(buf, sizeof(buf), _("Failed to load game state from file:\n\n%s"), filename);
+			buf = Common::String::printf(_("Failed to load game state from file:\n\n%s"), filename);
 		} else if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) {
 			drawIconArray(2, me(), 0, 0);
 			setBitFlag(97, true);
@@ -189,7 +189,7 @@
 	} else {
 		success = saveGame(_saveLoadSlot, _saveLoadName);
 		if (!success)
-			snprintf(buf, sizeof(buf), _("Failed to save game state to file:\n\n%s"), filename);
+			buf = Common::String::printf(_("Failed to save game state to file:\n\n%s"), filename);
 	}
 
 	if (!success) {
@@ -197,7 +197,7 @@
 		dialog.runModal();
 
 	} else if (_saveLoadType == 1) {
-		snprintf(buf, sizeof(buf), _("Successfully saved game state in file:\n\n%s"), filename);
+		buf = Common::String::printf(_("Successfully saved game state in file:\n\n%s"), filename);
 		GUI::TimedMessageDialog dialog(buf, 1500);
 		dialog.runModal();
 


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