From bf95593580a2d0adf20abeae1ddb2c16822d561a Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Fri, 25 Nov 2022 22:14:18 +0100 Subject: [PATCH] MADS: Simplify name reading in mps_installer.cpp --- engines/mads/mps_installer.cpp | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/engines/mads/mps_installer.cpp b/engines/mads/mps_installer.cpp index d2ccc9a6bc5..44639ebed26 100644 --- a/engines/mads/mps_installer.cpp +++ b/engines/mads/mps_installer.cpp @@ -50,21 +50,12 @@ MpsInstaller* MpsInstaller::open(const Common::Path& baseName) { filecnt = (indexSize - 12) / kEntryLength; for (uint i = 0; i < filecnt; i++) { - char nameField[kNameFieldLength]; - int nameLen = kNameFieldLength; - indexFile.read(nameField, kNameFieldLength); - for (uint j = 0; j < kNameFieldLength; j++) { - if (!nameField[j]) { - nameLen = j; - break; - } - } + Common::String name = indexFile.readString('\0', kNameFieldLength); uint16 compression = indexFile.readUint16LE(); uint16 volumeNumber = indexFile.readUint16LE(); uint32 offsetInVolume = indexFile.readUint32LE(); uint32 compressedSize = indexFile.readUint32LE(); uint32 uncompressedSize = indexFile.readUint32LE(); - Common::String name(nameField, nameLen); FileDescriptor desc(name, compression, volumeNumber, offsetInVolume, compressedSize, uncompressedSize); _files[desc._fileName] = desc; }