[Scummvm-git-logs] scummvm master -> f8b98e3f04d3141dc07511951560e4c3d24c3bc3

sev- sev at scummvm.org
Sun Aug 8 16:12:35 UTC 2021


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

Summary:
4a5085b0f8 COMMON: Do not try to create "." directory in DumpFile
f8b98e3f04 DIRECTOR: Convert script line endings on dumping


Commit: 4a5085b0f882901e1034e73252beea1b03d56e2a
    https://github.com/scummvm/scummvm/commit/4a5085b0f882901e1034e73252beea1b03d56e2a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-08-08T17:44:14+02:00

Commit Message:
COMMON: Do not try to create "." directory in DumpFile

Changed paths:
    common/file.cpp


diff --git a/common/file.cpp b/common/file.cpp
index eec0283910..b9012d570f 100644
--- a/common/file.cpp
+++ b/common/file.cpp
@@ -160,13 +160,13 @@ bool DumpFile::open(const String &filename, bool createPath) {
 			if (filename[i] == '/' || filename[i] == '\\') {
 				Common::String subpath = filename;
 				subpath.erase(i);
-				if (subpath.empty()) continue;
+				if (subpath.empty() || subpath == ".") continue;
 				AbstractFSNode *node = g_system->getFilesystemFactory()->makeFileNodePath(subpath);
 				if (node->exists()) {
 					delete node;
 					continue;
 				}
-				if (!node->createDirectory()) warning("DumpFile: unable to create directories from path prefix");
+				if (!node->createDirectory()) warning("DumpFile: unable to create directories from path prefix (%s)", subpath.c_str());
 				delete node;
 			}
 		}


Commit: f8b98e3f04d3141dc07511951560e4c3d24c3bc3
    https://github.com/scummvm/scummvm/commit/f8b98e3f04d3141dc07511951560e4c3d24c3bc3
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-08-08T18:12:13+02:00

Commit Message:
DIRECTOR: Convert script line endings on dumping

Changed paths:
    engines/director/cast.cpp


diff --git a/engines/director/cast.cpp b/engines/director/cast.cpp
index 6d3b08372a..7788754ec9 100644
--- a/engines/director/cast.cpp
+++ b/engines/director/cast.cpp
@@ -1095,10 +1095,21 @@ void Cast::dumpScript(const char *script, ScriptType type, uint16 id) {
 		return;
 	}
 
-	out.write(script, strlen(script));
+	uint len = strlen(script);
+	char *scriptCopy = (char *)malloc(len + 1);
+	Common::strlcpy(scriptCopy, script, len + 1);
+
+	for (uint i = 0; i < len; i++)
+		if (scriptCopy[i] == '\r' && scriptCopy[i + 1] != '\n') // It is safe to check [i + 1], as '\0' != '\n'
+			scriptCopy[i] = '\n';
+
+	out.write(scriptCopy, len);
 
 	out.flush();
 	out.close();
+
+	free(scriptCopy);
+
 }
 
 void Cast::loadCastInfo(Common::SeekableReadStreamEndian &stream, uint16 id) {




More information about the Scummvm-git-logs mailing list