[Scummvm-cvs-logs] CVS: scummvm/scumm scummvm.cpp,2.558,2.559

Chris Apers chrilith at users.sourceforge.net
Tue Jan 20 05:45:01 CET 2004


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv1462

Modified Files:
	scummvm.cpp 
Log Message:
Hack a bit MD5 to make it work on PalmOS

Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scummvm.cpp,v
retrieving revision 2.558
retrieving revision 2.559
diff -u -d -r2.558 -r2.559
--- scummvm.cpp	19 Jan 2004 19:47:47 -0000	2.558
+++ scummvm.cpp	20 Jan 2004 13:44:20 -0000	2.559
@@ -649,9 +649,20 @@
 	}
 	
 	if (md5_file(buf, md5sum)) {
+		// HACK : changed to this code since PalmOS doesn't handle correctly %02x.
+		// It returns only 8 chars string in upper case so i need to use hex[],
+		// copy last 2 chars to md5str and convert result to lower case
 		char md5str[32+1];
-		for (int j = 0; j < 16; j++)
-			sprintf(md5str+j*2, "%02x", md5sum[j]);
+		char hex[8+1];
+		for (int j = 0; j < 16; j++) {
+			sprintf(hex, "%02x", (int)md5sum[j]);
+			memcpy(md5str+j*2, hex + strlen(hex) - 2, 2);
+		}
+
+		for (int j = 0; j < 32; j++)
+			md5str[j] = tolower(md5str[j]);
+		// --
+		
 		md5str[32] = 0;
 		printf("%s  %s\n", md5str, buf);
 		const MD5Table *elem;





More information about the Scummvm-git-logs mailing list