[Scummvm-git-logs] scummvm master -> 9ab4c231290bbf38fd72698838eed2db9170c5dc

bluegr bluegr at gmail.com
Mon Aug 16 17:48:39 UTC 2021


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
9ab4c23129 STARTREK: Avoid adding \0 to strings


Commit: 9ab4c231290bbf38fd72698838eed2db9170c5dc
    https://github.com/scummvm/scummvm/commit/9ab4c231290bbf38fd72698838eed2db9170c5dc
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2021-08-16T20:48:31+03:00

Commit Message:
STARTREK: Avoid adding \0 to strings

These characters aren't needed at all in strings, so we can safely
ignore them

Changed paths:
    engines/startrek/resource.cpp


diff --git a/engines/startrek/resource.cpp b/engines/startrek/resource.cpp
index 4a1a4d3043..398ba76457 100644
--- a/engines/startrek/resource.cpp
+++ b/engines/startrek/resource.cpp
@@ -112,8 +112,11 @@ ResourceIndex Resource::getIndexEntry(Common::SeekableReadStream *indexFile) {
 	currentFile += '.';
 
 	// Read extension
-	for (byte i = 0; i < 3; i++)
-		currentFile += indexFile->readByte();
+	for (byte i = 0; i < 3; i++) {
+		byte b = indexFile->readByte();
+		if (b)
+			currentFile += b;
+	}
 
 	index.fileName = currentFile;
 
@@ -275,7 +278,8 @@ Common::String Resource::getLoadedText(int textIndex) {
 	while (!txtFile->eos()) {
 		do {
 			cur = txtFile->readByte();
-			str += cur;
+			if (cur)
+				str += cur;
 		} while (cur != '\0');
 
 		if (curIndex == textIndex) {




More information about the Scummvm-git-logs mailing list