summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-09-28 13:50:11 +0000
committerrubidium <rubidium@openttd.org>2008-09-28 13:50:11 +0000
commite635df8d5347c99603af5ccb6ef3dced8f78a93b (patch)
treeac9f9beb01979a9afd4b4a144489e33ac8083baa
parenta370f32c154e0c3e724f222a6053e60e5cd1019c (diff)
downloadopenttd-e635df8d5347c99603af5ccb6ef3dced8f78a93b.tar.xz
(svn r14410) -Codechange: one can't inject a negative number of parameters, so enforce this by using a uint.
-rw-r--r--src/strings.cpp3
-rw-r--r--src/strings_func.h2
2 files changed, 3 insertions, 2 deletions
diff --git a/src/strings.cpp b/src/strings.cpp
index 6e9665ad9..5d0fa5675 100644
--- a/src/strings.cpp
+++ b/src/strings.cpp
@@ -191,8 +191,9 @@ void SetDParamStr(uint n, const char *str)
SetDParam(n, (uint64)(size_t)str);
}
-void InjectDParam(int amount)
+void InjectDParam(uint amount)
{
+ assert((uint)amount < lengthof(_decode_parameters));
memmove(_decode_parameters + amount, _decode_parameters, sizeof(_decode_parameters) - amount * sizeof(uint64));
}
diff --git a/src/strings_func.h b/src/strings_func.h
index f83af7874..2c53bac8c 100644
--- a/src/strings_func.h
+++ b/src/strings_func.h
@@ -11,7 +11,7 @@ char *InlineString(char *buf, StringID string);
char *GetString(char *buffr, StringID string, const char *last);
const char *GetStringPtr(StringID string);
-void InjectDParam(int amount);
+void InjectDParam(uint amount);
static inline void SetDParamX(uint64 *s, uint n, uint64 v)
{