[Scummvm-cvs-logs] SF.net SVN: scummvm: [26972] scummvm/trunk/common
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Sun May 27 14:43:08 CEST 2007
Revision: 26972
http://scummvm.svn.sourceforge.net/scummvm/?rev=26972&view=rev
Author: fingolfin
Date: 2007-05-27 05:43:06 -0700 (Sun, 27 May 2007)
Log Message:
-----------
Paranoia changes (shouldn't have any real effect, though...)
Modified Paths:
--------------
scummvm/trunk/common/md5.cpp
scummvm/trunk/common/md5.h
Modified: scummvm/trunk/common/md5.cpp
===================================================================
--- scummvm/trunk/common/md5.cpp 2007-05-27 11:54:01 UTC (rev 26971)
+++ scummvm/trunk/common/md5.cpp 2007-05-27 12:43:06 UTC (rev 26972)
@@ -301,37 +301,37 @@
return true;
}
-bool md5_file_string(const FilesystemNode &file, char md5str[32+1], uint32 length) {
+bool md5_file_string(const FilesystemNode &file, char *md5str, uint32 length) {
uint8 digest[16];
if (!md5_file(file, digest, length))
return false;
for (int i = 0; i < 16; i++) {
- sprintf(md5str + i*2, "%02x", (int)digest[i]);
+ snprintf(md5str + i*2, 3, "%02x", (int)digest[i]);
}
return true;
}
-bool md5_file_string(const char *name, char md5str[32+1], uint32 length) {
+bool md5_file_string(const char *name, char *md5str, uint32 length) {
uint8 digest[16];
if (!md5_file(name, digest, length))
return false;
for (int i = 0; i < 16; i++) {
- sprintf(md5str + i*2, "%02x", (int)digest[i]);
+ snprintf(md5str + i*2, 3, "%02x", (int)digest[i]);
}
return true;
}
-bool md5_file_string(ReadStream &stream, char md5str[32+1], uint32 length) {
+bool md5_file_string(ReadStream &stream, char *md5str, uint32 length) {
uint8 digest[16];
if (!md5_file(stream, digest, length))
return false;
for (int i = 0; i < 16; i++) {
- sprintf(md5str + i*2, "%02x", (int)digest[i]);
+ snprintf(md5str + i*2, 3, "%02x", (int)digest[i]);
}
return true;
Modified: scummvm/trunk/common/md5.h
===================================================================
--- scummvm/trunk/common/md5.h 2007-05-27 11:54:01 UTC (rev 26971)
+++ scummvm/trunk/common/md5.h 2007-05-27 12:43:06 UTC (rev 26972)
@@ -35,9 +35,10 @@
// The following two methods work similar to the above two, but
// instead of computing the binary MD5 digest, they produce
// a human readable lowercase hexstring representing the digest.
-bool md5_file_string(const char *name, char md5str[32+1], uint32 length = 0);
-bool md5_file_string(const FilesystemNode &file, char md5str[32+1], uint32 length = 0);
-bool md5_file_string(ReadStream &stream, char md5str[32+1], uint32 length = 0);
+// The md5str parameter must point to a buffer of 32+1 chars.
+bool md5_file_string(const char *name, char *md5str, uint32 length = 0);
+bool md5_file_string(const FilesystemNode &file, char *md5str, uint32 length = 0);
+bool md5_file_string(ReadStream &stream, char *md5str, uint32 length = 0);
} // End of namespace Common
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