[Scummvm-cvs-logs] CVS: scummvm/tools md5table.c,1.2,1.3

Gregory Montoir cyx at users.sourceforge.net
Wed Mar 30 12:21:15 CEST 2005


Update of /cvsroot/scummvm/scummvm/tools
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18590/tools

Modified Files:
	md5table.c 
Log Message:
Added warnings if duplicate md5s are found, as suggested in bug report #1167146

Index: md5table.c
===================================================================
RCS file: /cvsroot/scummvm/scummvm/tools/md5table.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- md5table.c	1 Jan 2005 16:09:25 -0000	1.2
+++ md5table.c	30 Mar 2005 20:20:06 -0000	1.3
@@ -264,9 +264,17 @@
 		fprintf(outFile, c_header, generationDate);
 		/* Now sort the MD5 table (this allows for binary searches) */
 		qsort(entriesBuffer, numEntries, entrySize, strcmp_wrapper);
-		/* Output the table */
-		for (i = 0; i < numEntries; ++i)
-			fprintf(outFile, entriesBuffer + i * entrySize);
+		/* Output the table and emit warnings if duplicate md5s are found */
+		buffer[0] = '\0';
+		for (i = 0; i < numEntries; ++i) {
+			const char *currentEntry = entriesBuffer + i * entrySize;
+			fprintf(outFile, currentEntry);
+			if (strncmp(currentEntry + 4, buffer, 32) == 0) {
+				warning("Duplicate MD5 found '%.32s'", buffer);
+			} else {
+				strncpy(buffer, currentEntry + 4, 32);
+			}
+		}
 		/* Finally, print the footer */
 		fprintf(outFile, c_footer);
 	}





More information about the Scummvm-git-logs mailing list