[Scummvm-cvs-logs] SF.net SVN: scummvm:[39371] scummvm/trunk/engines/sci/engine/kstring.cpp

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Fri Mar 13 17:31:38 CET 2009


Revision: 39371
          http://scummvm.svn.sourceforge.net/scummvm/?rev=39371&view=rev
Author:   fingolfin
Date:     2009-03-13 16:31:38 +0000 (Fri, 13 Mar 2009)

Log Message:
-----------
SCI: cleanup

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/kstring.cpp

Modified: scummvm/trunk/engines/sci/engine/kstring.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kstring.cpp	2009-03-13 10:36:57 UTC (rev 39370)
+++ scummvm/trunk/engines/sci/engine/kstring.cpp	2009-03-13 16:31:38 UTC (rev 39371)
@@ -407,7 +407,7 @@
 /* Simple heuristic to work around array handling peculiarity in SQ4:
 It uses StrAt() to read the individual elements, so we must determine
 whether a string is really a string or an array. */
-static int is_print_str(char *str) {
+static int is_print_str(const char *str) {
 	int printable = 0;
 	int len = strlen(str);
 
@@ -419,7 +419,8 @@
 		// to an unsigned char. Values outside this range (in this
 		// case, negative values) yield unpredictable results. Refer to:
 		// http://msdn.microsoft.com/en-us/library/ewx8s4kw.aspx
-		if (isprint((unsigned char)*str)) printable++;
+		if (isprint((byte)*str))
+			printable++;
 		str++;
 	}
 
@@ -428,20 +429,18 @@
 
 
 reg_t kStrAt(EngineState *s, int funct_nr, int argc, reg_t *argv) {
-	unsigned char *dest = (unsigned char *) kernel_dereference_bulk_pointer(s, argv[0], 0);
+	byte *dest = (byte *)kernel_dereference_bulk_pointer(s, argv[0], 0);
 	reg_t *dest2;
 
 	if (!dest) {
-		warning("Attempt to StrAt at invalid pointer "PREG"",
-		          PRINT_REG(argv[0]));
+		warning("Attempt to StrAt at invalid pointer "PREG"", PRINT_REG(argv[0]));
 		return NULL_REG;
 	}
 
 	if ((argc == 2) &&
 	        /* Our pathfinder already works around the issue we're trying to fix */
-	        (strcmp(s->seg_manager->getDescription(argv[0]),
-	                AVOIDPATH_DYNMEM_STRING) != 0)  &&
-	        ((strlen((const char*)dest) < 2) || (!is_print_str((char*)dest))))
+	        (strcmp(s->seg_manager->getDescription(argv[0]), AVOIDPATH_DYNMEM_STRING) != 0)  &&
+	        ((strlen((const char*)dest) < 2) || (!is_print_str((const char*)dest))))
 		/* SQ4 array handling detected */
 	{
 #ifndef SCUMM_BIG_ENDIAN
@@ -450,8 +449,9 @@
 		int odd = !(KP_UINT(argv[1]) & 1);
 #endif
 		dest2 = ((reg_t *) dest) + (KP_UINT(argv[1]) / 2);
-		dest = ((unsigned char *)(&dest2->offset)) + odd;
-	} else dest += KP_UINT(argv[1]);
+		dest = ((byte *)(&dest2->offset)) + odd;
+	} else
+		dest += KP_UINT(argv[1]);
 
 	s->r_acc = make_reg(0, *dest);
 


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