aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorGregory Montoir2005-03-30 20:20:06 +0000
committerGregory Montoir2005-03-30 20:20:06 +0000
commit63911718ee6d1c4c25d70c710d1d80e7747bb103 (patch)
tree8f977e89b995287eeeef74a0086c56b507e03788 /tools
parentc1b948ff12c8d2e9774c17f49795fde673e85520 (diff)
downloadscummvm-rg350-63911718ee6d1c4c25d70c710d1d80e7747bb103.tar.gz
scummvm-rg350-63911718ee6d1c4c25d70c710d1d80e7747bb103.tar.bz2
scummvm-rg350-63911718ee6d1c4c25d70c710d1d80e7747bb103.zip
Added warnings if duplicate md5s are found, as suggested in bug report #1167146
svn-id: r17299
Diffstat (limited to 'tools')
-rw-r--r--tools/md5table.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/tools/md5table.c b/tools/md5table.c
index ef1e714385..78b0c18963 100644
--- a/tools/md5table.c
+++ b/tools/md5table.c
@@ -264,9 +264,17 @@ int main(int argc, char *argv[])
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);
}