[Scummvm-cvs-logs] SF.net SVN: scummvm:[42176] scummvm/trunk/engines/gob/hotspots.cpp

drmccoy at users.sourceforge.net drmccoy at users.sourceforge.net
Mon Jul 6 15:52:47 CEST 2009


Revision: 42176
          http://scummvm.svn.sourceforge.net/scummvm/?rev=42176&view=rev
Author:   drmccoy
Date:     2009-07-06 13:52:47 +0000 (Mon, 06 Jul 2009)

Log Message:
-----------
Loop over the string instead of copying and then editing it (hopefully, the PSP GCC won't ICE again here :P)

Modified Paths:
--------------
    scummvm/trunk/engines/gob/hotspots.cpp

Modified: scummvm/trunk/engines/gob/hotspots.cpp
===================================================================
--- scummvm/trunk/engines/gob/hotspots.cpp	2009-07-06 13:09:50 UTC (rev 42175)
+++ scummvm/trunk/engines/gob/hotspots.cpp	2009-07-06 13:52:47 UTC (rev 42176)
@@ -1795,23 +1795,24 @@
 }
 
 void Hotspots::cleanFloatString(const Hotspot &spot) const {
-	static char tempStr[256];	//the static keyword is unnecessary, but was added to work around a PSP compiler ICE.
+	char *to, *from;
 
-	// Get the string
-	strncpy0(tempStr, GET_VARO_STR(spot.key), 255);
+	to = from = GET_VARO_STR(spot.key);
+	for (int i = 0; (i < 257) && (*from != '\0'); i++, from++) {
+		char c = *from;
 
-	// Remove spaces
-	char *ptr;
-	while ((ptr = strchr(tempStr, ' ')))
-		_vm->_util->cutFromStr(tempStr, (ptr - tempStr), 1);
+		// Skip spaces
+		if (c == ' ')
+			continue;
 
-	// Exchange decimal separator if needed
-	if (_vm->_global->_language == kLanguageBritish)
-		while ((ptr = strchr(tempStr, '.')))
-			*ptr = ',';
+		// Convert decimal separator if necessary
+		if ((_vm->_global->_language == kLanguageBritish) && (c == '.'))
+			c = ',';
 
-	// Write it back
-	WRITE_VARO_STR(spot.key, tempStr);
+		*to++ = c;
+	}
+
+	*to = '\0';
 }
 
 void Hotspots::checkStringMatch(const Hotspot &spot, const InputDesc &input,


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