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

phcoder noreply at scummvm.org
Tue Nov 29 17:37:09 UTC 2022


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

Summary:
3ed46d3484 COMMON: In openFileOrDataFork ensure to seek to the beginning
b8f3bc2732 COMMON: In getDataFork use SafeSeekableSubReadStream
e75f8784b0 HADESCH: Use readStream in memSubstream


Commit: 3ed46d3484519264403bcd80cd80f33c9d2db475
    https://github.com/scummvm/scummvm/commit/3ed46d3484519264403bcd80cd80f33c9d2db475
Author: Vladimir Serbinenko (phcoder at gmail.com)
Date: 2022-11-29T18:35:12+01:00

Commit Message:
COMMON: In openFileOrDataFork ensure to seek to the beginning

Changed paths:
    common/macresman.cpp


diff --git a/common/macresman.cpp b/common/macresman.cpp
index e0f468b2844..30a315c8803 100644
--- a/common/macresman.cpp
+++ b/common/macresman.cpp
@@ -274,8 +274,10 @@ SeekableReadStream * MacResManager::openFileOrDataFork(const Path &fileName, Arc
 	}
 	// All formats other than Macbinary and AppleSingle (not supported) use
 	// basename-named file as data fork holder.
-	if (stream)
+	if (stream) {
+		stream->seek(0);
 		return stream;
+	}
 
 	// Check .bin for MacBinary next
 	stream = archive.createReadStreamForMember(fileName.append(".bin"));


Commit: b8f3bc2732ea3899fd5f08a19f7707303fe6cc5d
    https://github.com/scummvm/scummvm/commit/b8f3bc2732ea3899fd5f08a19f7707303fe6cc5d
Author: Vladimir Serbinenko (phcoder at gmail.com)
Date: 2022-11-29T18:35:20+01:00

Commit Message:
COMMON: In getDataFork use SafeSeekableSubReadStream

It can be opened several times so re-seeking makes sense

Changed paths:
    common/macresman.cpp


diff --git a/common/macresman.cpp b/common/macresman.cpp
index 30a315c8803..59975f379b2 100644
--- a/common/macresman.cpp
+++ b/common/macresman.cpp
@@ -692,7 +692,7 @@ SeekableReadStream *MacResManager::getDataFork() {
 	if (_mode == kResForkMacBinary) {
 		_stream->seek(MBI_DFLEN);
 		uint32 dataSize = _stream->readUint32BE();
-		return new SeekableSubReadStream(_stream, MBI_INFOHDR, MBI_INFOHDR + dataSize);
+		return new SafeSeekableSubReadStream(_stream, MBI_INFOHDR, MBI_INFOHDR + dataSize);
 	}
 
 	File *file = new File();


Commit: e75f8784b0c7c911c06cf57d74a763471bec3e6e
    https://github.com/scummvm/scummvm/commit/e75f8784b0c7c911c06cf57d74a763471bec3e6e
Author: Vladimir Serbinenko (phcoder at gmail.com)
Date: 2022-11-29T18:36:23+01:00

Commit Message:
HADESCH: Use readStream in memSubstream

Changed paths:
    engines/hadesch/pod_file.cpp


diff --git a/engines/hadesch/pod_file.cpp b/engines/hadesch/pod_file.cpp
index 461f106d44c..c9f19302646 100644
--- a/engines/hadesch/pod_file.cpp
+++ b/engines/hadesch/pod_file.cpp
@@ -91,12 +91,10 @@ bool PodFile::openStore(const Common::String &name) {
 // It's tempting to use substream but substream is not thread safe
 Common::SeekableReadStream *memSubstream(Common::SharedPtr<Common::SeekableReadStream> file,
 					 uint32 offset, uint32 size) {
-	byte *contents = (byte *) malloc(size);
-	if (!contents)
-		return nullptr;
+	if (size == 0)
+		return new Common::MemoryReadStream(new byte[1], 0, DisposeAfterUse::YES);
 	file->seek(offset);
-	file->read(contents, size);
-	return new Common::MemoryReadStream(contents, size, DisposeAfterUse::YES);
+	return file->readStream(size);
 }
 
 Common::SeekableReadStream *PodFile::getFileStream(const Common::String &name) const {




More information about the Scummvm-git-logs mailing list