diff options
author | Matthew Hoops | 2011-07-03 13:39:45 -0400 |
---|---|---|
committer | Matthew Hoops | 2011-07-03 13:49:28 -0400 |
commit | c2be473ce2dc15898f1197d619b569e3662ab3af (patch) | |
tree | 5f4a4dfd38ecf0d4bdd422aa24aa5ae4f510cf4c /engines/agi/preagi_winnie.cpp | |
parent | 628cc40e8fc84d52c551551c72606bdce1bc58ce (diff) | |
download | scummvm-rg350-c2be473ce2dc15898f1197d619b569e3662ab3af.tar.gz scummvm-rg350-c2be473ce2dc15898f1197d619b569e3662ab3af.tar.bz2 scummvm-rg350-c2be473ce2dc15898f1197d619b569e3662ab3af.zip |
AGI: Fix some memset calls
Spotted by both salty-horse and LordHoto using clang
Diffstat (limited to 'engines/agi/preagi_winnie.cpp')
-rw-r--r-- | engines/agi/preagi_winnie.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/engines/agi/preagi_winnie.cpp b/engines/agi/preagi_winnie.cpp index 1df31ff72a..5f8ebd766f 100644 --- a/engines/agi/preagi_winnie.cpp +++ b/engines/agi/preagi_winnie.cpp @@ -96,17 +96,20 @@ uint32 Winnie::readRoom(int iRoom, uint8 *buffer, WTP_ROOM_HDR &roomHdr) { sprintf(szFile, IDS_WTP_ROOM_C64, iRoom); else if (_vm->getPlatform() == Common::kPlatformApple2GS) sprintf(szFile, IDS_WTP_ROOM_APPLE, iRoom); + Common::File file; if (!file.open(szFile)) { warning ("Could not open file \'%s\'", szFile); return 0; } + uint32 filelen = file.size(); - if (_vm->getPlatform() == Common::kPlatformC64) { //Skip the loading address + if (_vm->getPlatform() == Common::kPlatformC64) { // Skip the loading address filelen -= 2; file.seek(2, SEEK_CUR); } - memset(buffer, 0, sizeof(buffer)); + + memset(buffer, 0, 4096); file.read(buffer, filelen); file.close(); @@ -117,6 +120,7 @@ uint32 Winnie::readRoom(int iRoom, uint8 *buffer, WTP_ROOM_HDR &roomHdr) { uint32 Winnie::readObj(int iObj, uint8 *buffer) { char szFile[256] = {0}; + if (_vm->getPlatform() == Common::kPlatformPC) sprintf(szFile, IDS_WTP_OBJ_DOS, iObj); else if (_vm->getPlatform() == Common::kPlatformAmiga) @@ -125,17 +129,20 @@ uint32 Winnie::readObj(int iObj, uint8 *buffer) { sprintf(szFile, IDS_WTP_OBJ_C64, iObj); else if (_vm->getPlatform() == Common::kPlatformApple2GS) sprintf(szFile, IDS_WTP_OBJ_APPLE, iObj); + Common::File file; if (!file.open(szFile)) { warning ("Could not open file \'%s\'", szFile); return 0; } + uint32 filelen = file.size(); - if (_vm->getPlatform() == Common::kPlatformC64) { //Skip the loading address + if (_vm->getPlatform() == Common::kPlatformC64) { // Skip the loading address filelen -= 2; file.seek(2, SEEK_CUR); } - memset(buffer, 0, sizeof(buffer)); + + memset(buffer, 0, 2048); file.read(buffer, filelen); file.close(); return filelen; |