[Scummvm-cvs-logs] SF.net SVN: scummvm: [22036] scummvm/trunk/engines/simon/string.cpp

eriktorbjorn at users.sourceforge.net eriktorbjorn at users.sourceforge.net
Wed Apr 19 07:19:05 CEST 2006


Revision: 22036
Author:   eriktorbjorn
Date:     2006-04-19 07:18:34 -0700 (Wed, 19 Apr 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=22036&view=rev

Log Message:
-----------
Fixed a potential bug when calculating the width of conversation option in FF.
This bug appears to have been present in the original as well, though the
chances of triggering it are small. (We did in at least one place, before
adding the number prefix to the string.)

Modified Paths:
--------------
    scummvm/trunk/engines/simon/string.cpp
Modified: scummvm/trunk/engines/simon/string.cpp
===================================================================
--- scummvm/trunk/engines/simon/string.cpp	2006-04-19 11:54:38 UTC (rev 22035)
+++ scummvm/trunk/engines/simon/string.cpp	2006-04-19 14:18:34 UTC (rev 22036)
@@ -129,13 +129,17 @@
 	char *convertedString2 = convertedString;
 	const char *string2 = string;
 	uint16 height = 15;
-	uint16 w = 620;
+	uint16 w = 0xFFFF;
 	uint16 b, pixels, x;
 
+	// It doesn't really matter what 'w' is to begin with, as long as it's
+	// something that cannot be generated by getPixelLength(). The original
+	// used 620, which was a potential problem.
+
 	while (1) {
 		string2 = getPixelLength(string, 620, pixels);
 		if (*string2 == 0x00) {
-			if (w == 620)
+			if (w == 0xFFFF)
 				w = pixels;
 			strcpy(convertedString2, string);
 			break;
@@ -145,7 +149,7 @@
 			pixels -= charWidth[chr];
 			string2--;
 		}
-		if (w == 620)
+		if (w == 0xFFFF)
 			w = pixels;
 		b = string2 - string;
 		strncpy(convertedString2, string, b);


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