[Scummvm-git-logs] scummvm master -> 14d3afb297aa1b01b58894cbb69221913e229a31

lephilousophe noreply at scummvm.org
Sun Feb 12 10:17:40 UTC 2023


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:
ef4ac3b728 AGS: Fix FileStream::EOS when used on a file opened for writing
14d3afb297 AGS: Don't check EOS when writing


Commit: ef4ac3b728fd80b88bab8da695231a95c13c8908
    https://github.com/scummvm/scummvm/commit/ef4ac3b728fd80b88bab8da695231a95c13c8908
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2023-02-12T11:17:36+01:00

Commit Message:
AGS: Fix FileStream::EOS when used on a file opened for writing

EOS should always return false in this case.

Changed paths:
    engines/ags/shared/util/file_stream.cpp


diff --git a/engines/ags/shared/util/file_stream.cpp b/engines/ags/shared/util/file_stream.cpp
index 7e38e21869f..95af0d96581 100644
--- a/engines/ags/shared/util/file_stream.cpp
+++ b/engines/ags/shared/util/file_stream.cpp
@@ -64,7 +64,7 @@ bool FileStream::IsValid() const {
 
 bool FileStream::EOS() const {
 	Common::ReadStream *rs = dynamic_cast<Common::ReadStream *>(_file);
-	return !rs || rs->eos();
+	return rs && rs->eos();
 }
 
 soff_t FileStream::GetLength() const {


Commit: 14d3afb297aa1b01b58894cbb69221913e229a31
    https://github.com/scummvm/scummvm/commit/14d3afb297aa1b01b58894cbb69221913e229a31
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2023-02-12T11:17:36+01:00

Commit Message:
AGS: Don't check EOS when writing

As the cursor is always at the end of the stream, BufferedStream::EOS()
always return true.
We check for errors when writing so no check is needed here.

Changed paths:
    engines/ags/shared/util/data_stream.cpp


diff --git a/engines/ags/shared/util/data_stream.cpp b/engines/ags/shared/util/data_stream.cpp
index cbc417c4002..b22bb453201 100644
--- a/engines/ags/shared/util/data_stream.cpp
+++ b/engines/ags/shared/util/data_stream.cpp
@@ -93,7 +93,7 @@ size_t DataStream::ReadAndConvertArrayOfInt64(int64_t *buffer, size_t count) {
 
 size_t DataStream::WriteAndConvertArrayOfInt16(const int16_t *buffer, size_t count) {
 	size_t elem;
-	for (elem = 0; elem < count && !EOS(); ++elem, ++buffer) {
+	for (elem = 0; elem < count; ++elem, ++buffer) {
 		int16_t val = *buffer;
 		ConvertInt16(val);
 		if (Write(&val, sizeof(int16_t)) < sizeof(int16_t)) {
@@ -105,7 +105,7 @@ size_t DataStream::WriteAndConvertArrayOfInt16(const int16_t *buffer, size_t cou
 
 size_t DataStream::WriteAndConvertArrayOfInt32(const int32_t *buffer, size_t count) {
 	size_t elem;
-	for (elem = 0; elem < count && !EOS(); ++elem, ++buffer) {
+	for (elem = 0; elem < count; ++elem, ++buffer) {
 		int32_t val = *buffer;
 		ConvertInt32(val);
 		if (Write(&val, sizeof(int32_t)) < sizeof(int32_t)) {
@@ -117,7 +117,7 @@ size_t DataStream::WriteAndConvertArrayOfInt32(const int32_t *buffer, size_t cou
 
 size_t DataStream::WriteAndConvertArrayOfInt64(const int64_t *buffer, size_t count) {
 	size_t elem;
-	for (elem = 0; elem < count && !EOS(); ++elem, ++buffer) {
+	for (elem = 0; elem < count; ++elem, ++buffer) {
 		int64_t val = *buffer;
 		ConvertInt64(val);
 		if (Write(&val, sizeof(int64_t)) < sizeof(int64_t)) {




More information about the Scummvm-git-logs mailing list