[Scummvm-cvs-logs] SF.net SVN: scummvm: [28230] scummvm/trunk/engines/drascula/drascula.cpp

eriktorbjorn at users.sourceforge.net eriktorbjorn at users.sourceforge.net
Fri Jul 27 06:23:22 CEST 2007


Revision: 28230
          http://scummvm.svn.sourceforge.net/scummvm/?rev=28230&view=rev
Author:   eriktorbjorn
Date:     2007-07-26 21:23:22 -0700 (Thu, 26 Jul 2007)

Log Message:
-----------
The strrev() function is non-standard. Replace with public domain version by
Bob Stout. (It would of course have been trivial to write my own, but Bob's
version does it in place, which is quite magical.)

Modified Paths:
--------------
    scummvm/trunk/engines/drascula/drascula.cpp

Modified: scummvm/trunk/engines/drascula/drascula.cpp
===================================================================
--- scummvm/trunk/engines/drascula/drascula.cpp	2007-07-27 01:59:23 UTC (rev 28229)
+++ scummvm/trunk/engines/drascula/drascula.cpp	2007-07-27 04:23:22 UTC (rev 28230)
@@ -2048,8 +2048,8 @@
 		palJuego[254][3] = 0;
 	} else if (cl == 7) {
 		palJuego[254][0] = 0x38;
-        palJuego[254][1] = 0;
-        palJuego[254][2] = 0;
+		palJuego[254][1] = 0;
+		palJuego[254][2] = 0;
 		palJuego[254][3] = 0;
 	} else if (cl == 8) {
 		palJuego[254][0] = 0x3F;
@@ -2080,6 +2080,22 @@
 	return (valor & 0x3F) * (valor > 0);
 }
 
+// Public domain strrev() function by Bob Stout.
+// Should perhaps be moved to common/util.cpp or similar.
+
+static char *scumm_strrev(char *str) {
+	char *p1, *p2;
+
+	if (!str || !*str)
+		return str;
+	for (p1 = str, p2 = str + strlen(str) - 1; p2 > p1; ++p1, --p2) {
+		*p1 ^= *p2;
+		*p2 ^= *p1;
+		*p1 ^= *p2;
+	}
+	return str;
+}
+
 void DrasculaEngine::centra_texto(char mensaje[], int x_texto, int y_texto) {
 	char bb[190], m2[190], m1[190] ,mb[10][40];
 	char m3[190];
@@ -2111,12 +2127,12 @@
 
 tut:
 	strcpy(bb, m1);
-	strrev(bb);
+	scumm_strrev(bb);
 
 	if (x_texto1 < x_texto2) {
 		strcpy(m3, strrchr(m1, ' '));
 		strcpy(m1, strstr(bb, " "));
-		strrev(m1);
+		scumm_strrev(m1);
 		m1[strlen(m1) - 1] = '\0';
 		strcat(m3, m2);
 		strcpy(m2, m3);
@@ -2129,9 +2145,9 @@
 
 	if (!strcmp(m2, ""))
 		goto imprimir;
-	strrev(m2);
+	scumm_strrev(m2);
 	m2[strlen(m2) - 1] = '\0';
-	strrev(m2);
+	scumm_strrev(m2);
 	strcpy(m1, m2);
 	strcpy(m2, "");
 	conta_f++;


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