[Scummvm-git-logs] scummvm master -> 2327dfc669d3b5329ceec98228ad1c24de4bb559

fracturehill noreply at scummvm.org
Thu Nov 23 21:03:16 UTC 2023


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:
2327dfc669 NANCY: Optimize decompression


Commit: 2327dfc669d3b5329ceec98228ad1c24de4bb559
    https://github.com/scummvm/scummvm/commit/2327dfc669d3b5329ceec98228ad1c24de4bb559
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2023-11-23T23:01:53+02:00

Commit Message:
NANCY: Optimize decompression

Removed the two if statements called on every byte read
when decompressing.

Changed paths:
    engines/nancy/decompress.cpp


diff --git a/engines/nancy/decompress.cpp b/engines/nancy/decompress.cpp
index 1291fbd5eb0..1468da88c62 100644
--- a/engines/nancy/decompress.cpp
+++ b/engines/nancy/decompress.cpp
@@ -36,16 +36,8 @@ void Decompressor::init(Common::ReadStream &input, Common::WriteStream &output)
 }
 
 bool Decompressor::readByte(byte &b) {
-	b = _input->readByte();
-
-	if (_input->eos())
-		return false;
-
-	if (_input->err())
-		error("Read error encountered during decompression");
-
-	b -= _val++;
-	return true;
+	b = _input->readByte() - _val++;
+	return !_input->eos();
 }
 
 bool Decompressor::writeByte(byte b) {
@@ -91,7 +83,7 @@ bool Decompressor::decompress(Common::ReadStream &input, Common::MemoryWriteStre
 		}
 	}
 
-	if (output.err() || output.pos() != output.size()) {
+	if (input.err() || output.err() || output.pos() != output.size()) {
 		// Workaround for nancy3 file "SLN RollPanOpn.avf", which outputs 2 bytes less than it should
 		if (output.size() - output.pos() <= 2) {
 			return true;




More information about the Scummvm-git-logs mailing list