[Scummvm-git-logs] scummvm master -> af3368dd317303f32ddb7d25f66a8578b5c1928e
bluegr
noreply at scummvm.org
Fri Jan 24 20:57:34 UTC 2025
This automated email contains information about 4 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
a3c8c88f3b CONFIGURE: Warn if the stack frames are too large
5201b0ae39 BAGEL: Don't allocate the save state on the stack
ee07927e3c TONY: Don't bundle the screenshot buffer in the object
af3368dd31 TWP: Don't allocate a 1MB buffer on stack
Commit: a3c8c88f3baf1dc75bb1aab3a2dae4b480a344b3
https://github.com/scummvm/scummvm/commit/a3c8c88f3baf1dc75bb1aab3a2dae4b480a344b3
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2025-01-24T22:57:30+02:00
Commit Message:
CONFIGURE: Warn if the stack frames are too large
Changed paths:
configure
diff --git a/configure b/configure
index 6b3760a1bc3..e19fc34a8c7 100755
--- a/configure
+++ b/configure
@@ -2639,6 +2639,10 @@ EOF
set_flag_if_supported -Wglobal-constructors
+# 307200 is a 640x480 CLUT8 buffer.
+# It's an arbitrary not too large but not too small either value.
+set_flag_if_supported -Wframe-larger-than=307200
+
# If the compiler supports the -Wundefined-var-template flag, silence that warning.
# We get this warning a lot with regard to the Singleton class as we explicitly
# instantiate each specialisation. An alternate way to deal with it would be to
Commit: 5201b0ae3962715b3be40a3a980470868a5d3047
https://github.com/scummvm/scummvm/commit/5201b0ae3962715b3be40a3a980470868a5d3047
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2025-01-24T22:57:30+02:00
Commit Message:
BAGEL: Don't allocate the save state on the stack
It's big and can be allocated on heap.
Changed paths:
engines/bagel/baglib/save_game_file.cpp
diff --git a/engines/bagel/baglib/save_game_file.cpp b/engines/bagel/baglib/save_game_file.cpp
index 0f46503001b..3fbc1b30f86 100644
--- a/engines/bagel/baglib/save_game_file.cpp
+++ b/engines/bagel/baglib/save_game_file.cpp
@@ -152,12 +152,12 @@ ErrorCode CBagSaveGameFile::writeSavedGame() {
assert(isValidObject(this));
// Populate the save data
- StBagelSave saveData;
- g_engine->_masterWin->fillSaveBuffer(&saveData);
+ StBagelSave *saveData = new StBagelSave();
+ g_engine->_masterWin->fillSaveBuffer(saveData);
- Common::String str = "./" + Common::String(saveData._szScript);
+ Common::String str = "./" + Common::String(saveData->_szScript);
str.replace('/', '\\');
- Common::strcpy_s(saveData._szScript, str.c_str());
+ Common::strcpy_s(saveData->_szScript, str.c_str());
// Set up header fields
StSavegameHeader header;
@@ -171,11 +171,13 @@ ErrorCode CBagSaveGameFile::writeSavedGame() {
header.synchronize(s);
stream.writeUint32LE(StBagelSave::size());
- saveData.synchronize(s);
+ saveData->synchronize(s);
// Add the record
addRecord(stream.getData(), stream.size(), true, 0);
+ delete saveData;
+
return _errCode;
}
@@ -198,19 +200,21 @@ ErrorCode CBagSaveGameFile::readSavedGame(int32 slotNum) {
StSavegameHeader header;
header.synchronize(s);
s.skip(4); // Skip save data structure size
- StBagelSave saveData;
- saveData.synchronize(s);
+ StBagelSave *saveData = new StBagelSave();
+ saveData->synchronize(s);
bofFree(pBuf);
- CBofString str(saveData._szScript);
+ CBofString str(saveData->_szScript);
fixPathName(str);
const char *path = str.getBuffer();
assert(!strncmp(path, "./", 2));
- Common::strcpy_s(saveData._szScript, path + 2);
+ Common::strcpy_s(saveData->_szScript, path + 2);
// Restore the game
- g_engine->_masterWin->doRestore(&saveData);
+ g_engine->_masterWin->doRestore(saveData);
+
+ delete saveData;
}
} else {
_errCode = ERR_FREAD;
Commit: ee07927e3c0c20f9d32b5c17d2de606570fd59ec
https://github.com/scummvm/scummvm/commit/ee07927e3c0c20f9d32b5c17d2de606570fd59ec
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2025-01-24T22:57:30+02:00
Commit Message:
TONY: Don't bundle the screenshot buffer in the object
It's a big buffer and this object is allocated on the stack.
Use the lifecycle of the object to allocate and free the buffer instead.
Changed paths:
engines/tony/window.h
diff --git a/engines/tony/window.h b/engines/tony/window.h
index dd0b0bf7fc6..2a2d28b267a 100644
--- a/engines/tony/window.h
+++ b/engines/tony/window.h
@@ -36,9 +36,15 @@ namespace Tony {
class RMSnapshot {
private:
+ static const int BUFFER_SIZE = RM_SX *RM_SY * 3;
// Buffer used to convert to RGB
- byte _rgb[RM_SX *RM_SY * 3];
+ byte *_rgb;
public:
+ RMSnapshot() : _rgb(new byte[BUFFER_SIZE]) {}
+ ~RMSnapshot() {
+ delete[] _rgb;
+ }
+
/**
* Take a screenshot
*/
Commit: af3368dd317303f32ddb7d25f66a8578b5c1928e
https://github.com/scummvm/scummvm/commit/af3368dd317303f32ddb7d25f66a8578b5c1928e
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2025-01-24T22:57:30+02:00
Commit Message:
TWP: Don't allocate a 1MB buffer on stack
100KB should be enough for a debug message
Changed paths:
engines/twp/vm.cpp
diff --git a/engines/twp/vm.cpp b/engines/twp/vm.cpp
index 9157f6a9766..2f1f88088d9 100644
--- a/engines/twp/vm.cpp
+++ b/engines/twp/vm.cpp
@@ -61,10 +61,10 @@ static SQInteger aux_printerror(HSQUIRRELVM v) {
}
static void printfunc(HSQUIRRELVM, const SQChar *s, ...) {
- char buf[1024 * 1024];
+ char buf[100 * 1024];
va_list vl;
va_start(vl, s);
- vsnprintf(buf, 1024 * 1024, s, vl);
+ vsnprintf(buf, 100 * 1024, s, vl);
va_end(vl);
debug("TWP: %s", buf);
More information about the Scummvm-git-logs
mailing list