From d0ffcd6772aa5e1b329f849395873052d1194b13 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sun, 7 Sep 2008 22:37:27 +0000 Subject: Changed md5_file(FSNode) to use FSNode::openForReading svn-id: r34437 --- common/md5.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'common/md5.cpp') diff --git a/common/md5.cpp b/common/md5.cpp index 7bbb941194..4eeb3d9a39 100644 --- a/common/md5.cpp +++ b/common/md5.cpp @@ -257,8 +257,16 @@ bool md5_file(const FilesystemNode &file, uint8 digest[16], uint32 length) { warning("md5_file: using a directory FilesystemNode"); return false; } + + ReadStream *stream = file.openForReading(); + if (!stream) { + warning("md5_file: failed to open '%s'", file.getPath().c_str()); + return false; + } - return md5_file(file.getPath().c_str(), digest, length); + bool result = md5_file(*stream, digest, length); + delete stream; + return result; } bool md5_file(const char *name, uint8 digest[16], uint32 length) { -- cgit v1.2.3