[Scummvm-git-logs] scummvm master -> c613f2d47940ed840083a21cee6ba3e12c243776
orgads
noreply at scummvm.org
Wed May 14 20:08:13 UTC 2025
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
c613f2d479 GRIM: Suppress compiler warning on release build
Commit: c613f2d47940ed840083a21cee6ba3e12c243776
https://github.com/scummvm/scummvm/commit/c613f2d47940ed840083a21cee6ba3e12c243776
Author: Orgad Shaneh (orgads at gmail.com)
Date: 2025-05-14T23:08:10+03:00
Commit Message:
GRIM: Suppress compiler warning on release build
In function 'void Grim::addnchar(const char*, int32)',
inlined from 'void Grim::addstr(const char*)' at engines/grim/lua/lstrlib.cpp:25:10,
inlined from 'void Grim::str_rep()' at engines/grim/lua/lstrlib.cpp:75:9:
engines/grim/lua/lstrlib.cpp:20:16: warning: 'char* strncpy(char*, const char*, size_t)' output truncated before terminating nul copying as many bytes from a string as its length [-Wstringop-truncation]
20 | strncpy(b, s, n);
| ~~~~~~~^~~~~~~~~
In function 'void Grim::addstr(const char*)',
inlined from 'void Grim::str_rep()' at engines/grim/lua/lstrlib.cpp:75:9:
engines/grim/lua/lstrlib.cpp:25:27: note: length computed here
25 | addnchar(s, strlen(s));
| ~~~~~~^~~
Changed paths:
engines/grim/lua/lstrlib.cpp
diff --git a/engines/grim/lua/lstrlib.cpp b/engines/grim/lua/lstrlib.cpp
index 76a30f76805..dec30476adc 100644
--- a/engines/grim/lua/lstrlib.cpp
+++ b/engines/grim/lua/lstrlib.cpp
@@ -15,11 +15,18 @@
namespace Grim {
+#if defined(__GNUC__) && !defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wstringop-truncation"
+#endif
static void addnchar(const char *s, int32 n) {
char *b = luaL_openspace(n);
strncpy(b, s, n);
luaL_addsize(n);
}
+#if defined(__GNUC__) && !defined(__clang__)
+#pragma GCC diagnostic pop
+#endif
static void addstr(const char *s) {
addnchar(s, strlen(s));
More information about the Scummvm-git-logs
mailing list