[Scummvm-cvs-logs] SF.net SVN: scummvm: [25593] scummvm/trunk
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Wed Feb 14 22:59:57 CET 2007
Revision: 25593
http://scummvm.svn.sourceforge.net/scummvm/?rev=25593&view=rev
Author: fingolfin
Date: 2007-02-14 13:59:57 -0800 (Wed, 14 Feb 2007)
Log Message:
-----------
Make use of md5_file_string
Modified Paths:
--------------
scummvm/trunk/common/advancedDetector.cpp
scummvm/trunk/engines/lure/lure.cpp
scummvm/trunk/engines/scumm/file.cpp
scummvm/trunk/engines/scumm/plugin.cpp
scummvm/trunk/engines/scumm/plugin.h
scummvm/trunk/engines/scumm/scumm.cpp
Modified: scummvm/trunk/common/advancedDetector.cpp
===================================================================
--- scummvm/trunk/common/advancedDetector.cpp 2007-02-14 21:43:21 UTC (rev 25592)
+++ scummvm/trunk/common/advancedDetector.cpp 2007-02-14 21:59:57 UTC (rev 25593)
@@ -258,7 +258,6 @@
uint i;
char md5str[32+1];
- uint8 md5sum[16];
bool fileMissing;
const ADGameFileDescription *fileDesc;
@@ -295,12 +294,9 @@
if (!filesList.contains(tstr) && !filesList.contains(tstr2)) continue;
- if (!md5_file(*file, md5sum, params.md5Bytes)) continue;
- for (i = 0; i < 16; i++) {
- sprintf(md5str + i*2, "%02x", (int)md5sum[i]);
- }
- filesMD5[tstr] = String(md5str);
- filesMD5[tstr2] = String(md5str);
+ if (!md5_file_string(*file, md5str, params.md5Bytes))
+ continue;
+ filesMD5[tstr] = filesMD5[tstr2] = md5str;
debug(3, "> %s: %s", tstr.c_str(), md5str);
@@ -322,11 +318,8 @@
filesSize[tstr] = filesSize[tstr2] = (int32)testFile.size();
testFile.close();
- if (md5_file(file->_key.c_str(), md5sum, params.md5Bytes)) {
- for (i = 0; i < 16; i++) {
- sprintf(md5str + i*2, "%02x", (int)md5sum[i]);
- }
- filesMD5[tstr] = String(md5str);
+ if (md5_file_string(file->_key.c_str(), md5str, params.md5Bytes)) {
+ filesMD5[tstr] = md5str;
debug(3, "> %s: %s", tstr.c_str(), md5str);
}
}
Modified: scummvm/trunk/engines/lure/lure.cpp
===================================================================
--- scummvm/trunk/engines/lure/lure.cpp 2007-02-14 21:43:21 UTC (rev 25592)
+++ scummvm/trunk/engines/lure/lure.cpp 2007-02-14 21:59:57 UTC (rev 25593)
@@ -128,13 +128,9 @@
if (file == fslist.end())
return detectedGames;
- uint8 md5sum[16];
char md5str[32 + 1];
- if (Common::md5_file(*file, md5sum, kMD5FileSizeLimit)) {
- for (int i = 0; i < 16; i++) {
- sprintf(md5str + i * 2, "%02x", (int)md5sum[i]);
- }
+ if (Common::md5_file_string(*file, md5str, kMD5FileSizeLimit)) {
for (g = lure_games; g->gameid; g++) {
if (strcmp(g->md5sum, (char *)md5str) == 0) {
GameDescriptor dg(g->gameid, g->description, g->language);
@@ -224,7 +220,6 @@
// Do an md5 check
- uint8 md5sum[16];
char md5str[32 + 1];
const GameSettings *g;
bool found = false;
@@ -235,11 +230,7 @@
if (!Common::File::exists(g->checkFile))
continue;
- if (Common::md5_file(g->checkFile, md5sum, kMD5FileSizeLimit)) {
- for (int j = 0; j < 16; j++) {
- sprintf(md5str + j * 2, "%02x", (int)md5sum[j]);
- }
- } else
+ if (!Common::md5_file_string(g->checkFile, md5str, kMD5FileSizeLimit))
continue;
if (strcmp(g->md5sum, (char *)md5str) == 0) {
Modified: scummvm/trunk/engines/scumm/file.cpp
===================================================================
--- scummvm/trunk/engines/scumm/file.cpp 2007-02-14 21:43:21 UTC (rev 25592)
+++ scummvm/trunk/engines/scumm/file.cpp 2007-02-14 21:59:57 UTC (rev 25593)
@@ -1383,14 +1383,10 @@
}
bool ScummNESFile::open(const Common::String &filename, AccessMode mode) {
- uint8 md5sum[16];
if (_ROMset == kROMsetNum) {
- if (Common::md5_file(filename.c_str(), md5sum)) {
- char md5str[32+1];
- for (int j = 0; j < 16; j++) {
- sprintf(md5str + j*2, "%02x", (int)md5sum[j]);
- }
+ char md5str[32+1];
+ if (Common::md5_file_string(filename.c_str(), md5str)) {
if (!strcmp(md5str, "3905799e081b80a61d4460b7b733c206")) {
_ROMset = kROMsetUSA;
Modified: scummvm/trunk/engines/scumm/plugin.cpp
===================================================================
--- scummvm/trunk/engines/scumm/plugin.cpp 2007-02-14 21:43:21 UTC (rev 25592)
+++ scummvm/trunk/engines/scumm/plugin.cpp 2007-02-14 21:59:57 UTC (rev 25593)
@@ -971,7 +971,6 @@
struct DetectorDesc {
FilesystemNode node;
Common::String md5;
- uint8 md5sum[16];
const MD5Table *md5Entry; // Entry of the md5 table corresponding to this file, if any.
};
@@ -1013,7 +1012,6 @@
dr.game.gameid = 0;
dr.language = gfp->language;
dr.md5.clear();
- memset(dr.md5sum, 0, 16);
dr.extra = 0;
// ____ _ _
@@ -1034,19 +1032,13 @@
//
DetectorDesc &d = fileMD5Map[file];
if (d.md5.empty()) {
- uint8 md5sum[16];
- if (Common::md5_file(d.node, md5sum, kMD5FileSizeLimit)) {
- char md5str[32+1];
- for (int j = 0; j < 16; j++) {
- sprintf(md5str + j*2, "%02x", (int)md5sum[j]);
- }
+ char md5str[32+1];
+ if (Common::md5_file_string(d.node, md5str, kMD5FileSizeLimit)) {
d.md5 = md5str;
- memcpy(d.md5sum, md5sum, 16);
d.md5Entry = findInMD5Table(md5str);
dr.md5 = d.md5;
- memcpy(dr.md5sum, d.md5sum, 16);
if (d.md5Entry) {
// Exact match found
@@ -1117,7 +1109,6 @@
// the gfp record. We then try to decide for each whether it could be
// appropriate or not.
dr.md5 = d.md5;
- memcpy(dr.md5sum, d.md5sum, 16);
for (g = gameVariantsTable; g->gameid; ++g) {
// Skip over entries with a different gameid.
if (g->gameid[0] == 0 || scumm_stricmp(gfp->gameid, g->gameid))
Modified: scummvm/trunk/engines/scumm/plugin.h
===================================================================
--- scummvm/trunk/engines/scumm/plugin.h 2007-02-14 21:43:21 UTC (rev 25592)
+++ scummvm/trunk/engines/scumm/plugin.h 2007-02-14 21:59:57 UTC (rev 25593)
@@ -116,7 +116,6 @@
GameSettings game;
Common::Language language;
Common::String md5;
- uint8 md5sum[16];
const char *extra;
};
Modified: scummvm/trunk/engines/scumm/scumm.cpp
===================================================================
--- scummvm/trunk/engines/scumm/scumm.cpp 2007-02-14 21:43:21 UTC (rev 25592)
+++ scummvm/trunk/engines/scumm/scumm.cpp 2007-02-14 21:59:57 UTC (rev 25593)
@@ -119,8 +119,15 @@
}
_res = new ResourceManager(this);
- // Copy MD5 checksum
- memcpy(_gameMD5, dr.md5sum, 16);
+ // Convert MD5 checksum back into a digest
+ for (int i = 0; i < 16; ++i) {
+ char tmpStr[3] = "00";
+ uint tmpVal;
+ tmpStr[0] = dr.md5[2*i];
+ tmpStr[1] = dr.md5[2*i+1];
+ sscanf(tmpStr, "%x", &tmpVal);
+ _gameMD5[i] = (byte)tmpVal;
+ }
_fileHandle = 0;
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