[Scummvm-git-logs] scummvm master -> f12ff97873381b864b856eb356fb7b2d6919b25b
bluegr
noreply at scummvm.org
Mon May 30 05:33:38 UTC 2022
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:
aa0db1a597 SCUMM: Handle getObjOrActorName() NULL strings in the debugger
f12ff97873 AGS: Fix Plugins::pluginError() nullptr given to printf
Commit: aa0db1a5975c9111d1a609c5d3ceb265282895da
https://github.com/scummvm/scummvm/commit/aa0db1a5975c9111d1a609c5d3ceb265282895da
Author: Donovan Watteau (contrib at dwatteau.fr)
Date: 2022-05-30T08:33:33+03:00
Commit Message:
SCUMM: Handle getObjOrActorName() NULL strings in the debugger
getObjOrActorName() may return a nullptr, but giving a null pointer to
printf()-like functions is undefined, and OpenBSD complains about it.
Hardcode "(null)" in that case; that's the default value on Windows,
macOS and Linux.
Changed paths:
engines/scumm/debugger.cpp
diff --git a/engines/scumm/debugger.cpp b/engines/scumm/debugger.cpp
index 727d1817b49..9e62652d2ca 100644
--- a/engines/scumm/debugger.cpp
+++ b/engines/scumm/debugger.cpp
@@ -576,8 +576,10 @@ bool ScummDebugger::Cmd_Actor(int argc, const char **argv) {
debugPrintf("Actor[%d].costume = %d\n", actnum, a->_costume);
}
} else if (!strcmp(argv[2], "name")) {
- debugPrintf("Name of actor %d: %s\n", actnum,
- _vm->getObjOrActorName(_vm->actorToObj(actnum)));
+ const byte *name = _vm->getObjOrActorName(_vm->actorToObj(actnum));
+ if (!name)
+ name = (const byte *)"(null)";
+ debugPrintf("Name of actor %d: %s\n", actnum, name);
} else if (!strcmp(argv[2], "condmask")) {
if (argc > 3) {
a->_heCondMask = value;
@@ -600,6 +602,8 @@ bool ScummDebugger::Cmd_PrintActor(int argc, const char **argv) {
for (i = 1; i < _vm->_numActors; i++) {
a = _vm->_actors[i];
const byte *name = _vm->getObjOrActorName(_vm->actorToObj(a->_number));
+ if (!name)
+ name = (const byte *)"(null)";
if (a->_visible)
debugPrintf("|%2d|%-12.12s|%4d|%4d|%3d|%3d|%4d|%3d|%3d|%3d|%3d|%3d|%3d|%3d|$%08x|\n",
a->_number, name, a->getRealPos().x, a->getRealPos().y, a->_width, a->_bottom - a->_top,
@@ -625,6 +629,8 @@ bool ScummDebugger::Cmd_PrintObjects(int argc, const char **argv) {
continue;
int classData = (_vm->_game.version != 0 ? _vm->_classData[o->obj_nr] : 0);
const byte *name = _vm->getObjOrActorName(o->obj_nr);
+ if (!name)
+ name = (const byte *)"(null)";
debugPrintf("|%4d|%-12.12s|%4d|%4d|%5d|%6d|%5d|%2d|$%08x|\n",
o->obj_nr, name, o->x_pos, o->y_pos, o->width, o->height, o->state,
o->fl_object_index, classData);
@@ -678,7 +684,10 @@ bool ScummDebugger::Cmd_Object(int argc, const char **argv) {
debugPrintf("State of object %d: %d\n", obj, _vm->getState(obj));
}
} else if (!strcmp(argv[2], "name")) {
- debugPrintf("Name of object %d: %s\n", obj, _vm->getObjOrActorName(obj));
+ const byte *name = _vm->getObjOrActorName(obj);
+ if (!name)
+ name = (const byte *)"(null)";
+ debugPrintf("Name of object %d: %s\n", obj, name);
} else {
debugPrintf("Unknown object command '%s'\nUse <pickup | state | name> as command\n", argv[2]);
}
Commit: f12ff97873381b864b856eb356fb7b2d6919b25b
https://github.com/scummvm/scummvm/commit/f12ff97873381b864b856eb356fb7b2d6919b25b
Author: Donovan Watteau (contrib at dwatteau.fr)
Date: 2022-05-30T08:33:33+03:00
Commit Message:
AGS: Fix Plugins::pluginError() nullptr given to printf
Giving a null pointer to a printf-like function is undefined, and
OpenBSD complains about it.
Changed paths:
engines/ags/engine/util/library_scummvm.h
diff --git a/engines/ags/engine/util/library_scummvm.h b/engines/ags/engine/util/library_scummvm.h
index 490c5f38262..e74632496bf 100644
--- a/engines/ags/engine/util/library_scummvm.h
+++ b/engines/ags/engine/util/library_scummvm.h
@@ -51,7 +51,9 @@ public:
Unload();
_library = Plugins::pluginOpen(libraryName.GetCStr());
- AGS::Shared::Debug::Printf("pluginOpen returned: %s", Plugins::pluginError());
+ const char *error = Plugins::pluginError();
+ if (error)
+ AGS::Shared::Debug::Printf("pluginOpen returned: %s", error);
return (_library != nullptr);
}
More information about the Scummvm-git-logs
mailing list