From 4d3a07b4943fa173b8db93d54d89baa24b35e0c5 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sun, 7 Nov 2010 17:16:59 +0000 Subject: COMMON: Rename and tweak MD5 functions * names now comply to our naming conventions * the function computeStreamMD5AsString which computes the MD5 as a hex string now returns it as a Common::String * add doxygen comments svn-id: r54121 --- engines/agi/agi.cpp | 5 ++--- engines/agi/sound_2gs.cpp | 14 ++++++-------- 2 files changed, 8 insertions(+), 11 deletions(-) (limited to 'engines/agi') diff --git a/engines/agi/agi.cpp b/engines/agi/agi.cpp index 4dcf5fee5e..cfe921a91e 100644 --- a/engines/agi/agi.cpp +++ b/engines/agi/agi.cpp @@ -459,9 +459,8 @@ int AgiEngine::agiLoadResource(int r, int n) { if (i == errOK && getGameID() == GID_GOLDRUSH && r == rPICTURE && n == 147 && _game.dirPic[n].len == 1982) { uint8 *pic = _game.pictures[n].rdata; Common::MemoryReadStream picStream(pic, _game.dirPic[n].len); - char md5str[32+1]; - Common::md5_file_string(picStream, md5str, _game.dirPic[n].len); - if (scumm_stricmp(md5str, "1c685eb048656cedcee4eb6eca2cecea") == 0) { + Common::String md5str = Common::computeStreamMD5AsString(picStream, _game.dirPic[n].len); + if (md5str == "1c685eb048656cedcee4eb6eca2cecea") { pic[0x042] = 0x4B; // 0x49 -> 0x4B pic[0x043] = 0x66; // 0x26 -> 0x66 pic[0x204] = 0x68; // 0x28 -> 0x68 diff --git a/engines/agi/sound_2gs.cpp b/engines/agi/sound_2gs.cpp index cc1cd0f6d5..2748344b36 100644 --- a/engines/agi/sound_2gs.cpp +++ b/engines/agi/sound_2gs.cpp @@ -855,11 +855,10 @@ bool SoundGen2GS::loadInstrumentHeaders(const Common::FSNode &exePath, const IIg // Check instrument set's md5sum data->seek(exeInfo.instSetStart); - char md5str[32+1]; - Common::md5_file_string(*data, md5str, exeInfo.instSet.byteCount); - if (scumm_stricmp(md5str, exeInfo.instSet.md5)) { + Common::String md5str = Common::computeStreamMD5AsString(*data, exeInfo.instSet.byteCount); + if (md5str != exeInfo.instSet.md5) { warning("Unknown Apple IIGS instrument set (md5: %s) in %s, trying to use it nonetheless", - md5str, exePath.getPath().c_str()); + md5str.c_str(), exePath.getPath().c_str()); } // Read in the instrument set one instrument at a time @@ -898,12 +897,11 @@ bool SoundGen2GS::loadWaveFile(const Common::FSNode &wavePath, const IIgsExeInfo // Check that we got the whole wave file if (uint8Wave && uint8Wave->size() == SIERRASTANDARD_SIZE) { // Check wave file's md5sum - char md5str[32+1]; - Common::md5_file_string(*uint8Wave, md5str, SIERRASTANDARD_SIZE); - if (scumm_stricmp(md5str, exeInfo.instSet.waveFileMd5)) { + Common::String md5str = Common::computeStreamMD5AsString(*uint8Wave, SIERRASTANDARD_SIZE); + if (md5str != exeInfo.instSet.waveFileMd5) { warning("Unknown Apple IIGS wave file (md5: %s, game: %s).\n" \ "Please report the information on the previous line to the ScummVM team.\n" \ - "Using the wave file as it is - music may sound weird", md5str, exeInfo.exePrefix); + "Using the wave file as it is - music may sound weird", md5str.c_str(), exeInfo.exePrefix); } uint8Wave->seek(0); // Seek wave to its start -- cgit v1.2.3