aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/md5.cpp4
-rw-r--r--common/md5.h2
-rw-r--r--engines/gob/gob.cpp2
-rw-r--r--engines/kyra/plugin.cpp2
-rw-r--r--engines/lure/lure.cpp2
-rw-r--r--engines/saga/game.cpp2
-rw-r--r--engines/simon/game.cpp2
7 files changed, 11 insertions, 5 deletions
diff --git a/common/md5.cpp b/common/md5.cpp
index 39ef1f3e13..1962f8cb94 100644
--- a/common/md5.cpp
+++ b/common/md5.cpp
@@ -233,6 +233,10 @@ void md5_finish(md5_context *ctx, uint8 digest[16]) {
PUT_UINT32(ctx->state[3], digest, 12);
}
+bool md5_file(const FilesystemNode &file, uint8 digest[16], uint32 length) {
+ return md5_file(file.path().c_str(), digest, length);
+}
+
bool md5_file(const char *name, uint8 digest[16], uint32 length) {
File f;
diff --git a/common/md5.h b/common/md5.h
index b8e4a95464..b4b852b5c6 100644
--- a/common/md5.h
+++ b/common/md5.h
@@ -23,6 +23,7 @@
#define COMMON_MD5_H
#include "common/scummsys.h"
+#include "common/fs.h"
namespace Common {
@@ -37,6 +38,7 @@ void md5_update(md5_context *ctx, const uint8 *input, uint32 length);
void md5_finish(md5_context *ctx, uint8 digest[16]);
bool md5_file(const char *name, uint8 digest[16], uint32 length = 0);
+bool md5_file(const FilesystemNode &file, uint8 digest[16], uint32 length = 0);
} // End of namespace Common
diff --git a/engines/gob/gob.cpp b/engines/gob/gob.cpp
index 75dfb8727f..2629286b01 100644
--- a/engines/gob/gob.cpp
+++ b/engines/gob/gob.cpp
@@ -348,7 +348,7 @@ DetectedGameList Engine_GOB_detectGames(const FSList &fslist) {
uint8 md5sum[16];
char md5str[32 + 1];
- if (Common::md5_file(file->path().c_str(), md5sum, kMD5FileSizeLimit)) {
+ if (Common::md5_file(*file, md5sum, kMD5FileSizeLimit)) {
for (int i = 0; i < 16; i++) {
sprintf(md5str + i * 2, "%02x", (int)md5sum[i]);
}
diff --git a/engines/kyra/plugin.cpp b/engines/kyra/plugin.cpp
index 14d3355c04..de8864623b 100644
--- a/engines/kyra/plugin.cpp
+++ b/engines/kyra/plugin.cpp
@@ -195,7 +195,7 @@ DetectedGameList Engine_KYRA_detectGames(const FSList &fslist) {
uint8 md5sum[16];
char md5str[32 + 1];
- if (Common::md5_file(file->path().c_str(), md5sum, kMD5FileSizeLimit)) {
+ if (Common::md5_file(*file, md5sum, kMD5FileSizeLimit)) {
for (int i = 0; i < 16; i++) {
sprintf(md5str + i * 2, "%02x", (int)md5sum[i]);
}
diff --git a/engines/lure/lure.cpp b/engines/lure/lure.cpp
index 195d90b86e..2d0f69ecdd 100644
--- a/engines/lure/lure.cpp
+++ b/engines/lure/lure.cpp
@@ -129,7 +129,7 @@ DetectedGameList Engine_LURE_detectGames(const FSList &fslist) {
uint8 md5sum[16];
char md5str[32 + 1];
- if (Common::md5_file(file->path().c_str(), md5sum, kMD5FileSizeLimit)) {
+ if (Common::md5_file(*file, md5sum, kMD5FileSizeLimit)) {
for (int i = 0; i < 16; i++) {
sprintf(md5str + i * 2, "%02x", (int)md5sum[i]);
}
diff --git a/engines/saga/game.cpp b/engines/saga/game.cpp
index 5b917ea833..38b3d2fb59 100644
--- a/engines/saga/game.cpp
+++ b/engines/saga/game.cpp
@@ -132,7 +132,7 @@ static int detectGame(const FSList *fslist, Common::Language language, Common::P
if (!filesList.contains(tstr)) continue;
- if (!Common::md5_file(file->path().c_str(), md5sum, FILE_MD5_BYTES)) continue;
+ if (!Common::md5_file(*file, md5sum, FILE_MD5_BYTES)) continue;
for (j = 0; j < 16; j++) {
sprintf(md5str + j*2, "%02x", (int)md5sum[j]);
}
diff --git a/engines/simon/game.cpp b/engines/simon/game.cpp
index 75f5d33799..4e5987f3d3 100644
--- a/engines/simon/game.cpp
+++ b/engines/simon/game.cpp
@@ -1386,7 +1386,7 @@ static int detectGame(const FSList *fslist, Common::Language language, Common::P
if (!filesList.contains(tstr) && !filesList.contains(tstr2)) continue;
- if (!Common::md5_file(file->path().c_str(), md5sum, FILE_MD5_BYTES)) continue;
+ if (!Common::md5_file(*file, md5sum, FILE_MD5_BYTES)) continue;
for (j = 0; j < 16; j++) {
sprintf(md5str + j*2, "%02x", (int)md5sum[j]);
}