[Scummvm-git-logs] scummvm branch-2-7 -> b186a146ed88020a9b7d621aaa82564545c7a7f2
lephilousophe
noreply at scummvm.org
Sun Feb 12 10:18:46 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:
b186a146ed AGS: Don't check EOS when writing
Commit: b186a146ed88020a9b7d621aaa82564545c7a7f2
https://github.com/scummvm/scummvm/commit/b186a146ed88020a9b7d621aaa82564545c7a7f2
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2023-02-12T11:18:24+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