summaryrefslogtreecommitdiff
path: root/src/script/api
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2014-04-23 21:12:09 +0000
committerrubidium <rubidium@openttd.org>2014-04-23 21:12:09 +0000
commit5b82822c12e014771dceaf9d909e1c0f3653c5a9 (patch)
tree1cf02e076eb61eb94d9064c7cb02bbe85ecb9a6c /src/script/api
parentef4c2ce0317ae583e837722b6a41ea44cd83da71 (diff)
downloadopenttd-5b82822c12e014771dceaf9d909e1c0f3653c5a9.tar.xz
(svn r26486) -Codechange: replace a number of snprintfs with seprintf
Diffstat (limited to 'src/script/api')
-rw-r--r--src/script/api/script_admin.cpp2
-rw-r--r--src/script/api/script_controller.cpp12
2 files changed, 7 insertions, 7 deletions
diff --git a/src/script/api/script_admin.cpp b/src/script/api/script_admin.cpp
index 9027b29a2..a84f999dd 100644
--- a/src/script/api/script_admin.cpp
+++ b/src/script/api/script_admin.cpp
@@ -30,7 +30,7 @@
sq_getinteger(vm, index, &res);
char buf[10];
- snprintf(buf, sizeof(buf), "%d", (int32)res);
+ seprintf(buf, lastof(buf), "%d", (int32)res);
data = buf;
return true;
}
diff --git a/src/script/api/script_controller.cpp b/src/script/api/script_controller.cpp
index 7f8df248d..4c3a5cd6e 100644
--- a/src/script/api/script_controller.cpp
+++ b/src/script/api/script_controller.cpp
@@ -53,7 +53,7 @@
ScriptObject::GetActiveInstance()->Pause();
char log_message[1024];
- snprintf(log_message, sizeof(log_message), "Break: %s", message);
+ seprintf(log_message, lastof(log_message), "Break: %s", message);
ScriptLog::Log(ScriptLog::LOG_SQ_ERROR, log_message);
/* Inform script developer that his script has been paused and
@@ -115,13 +115,13 @@ ScriptController::~ScriptController()
/* Internally we store libraries as 'library.version' */
char library_name[1024];
- snprintf(library_name, sizeof(library_name), "%s.%d", library, version);
+ seprintf(library_name, lastof(library_name), "%s.%d", library, version);
strtolower(library_name);
ScriptInfo *lib = ScriptObject::GetActiveInstance()->FindLibrary(library, version);
if (lib == NULL) {
char error[1024];
- snprintf(error, sizeof(error), "couldn't find library '%s' with version %d", library, version);
+ seprintf(error, lastof(error), "couldn't find library '%s' with version %d", library, version);
throw sq_throwerror(vm, OTTD2SQ(error));
}
@@ -138,7 +138,7 @@ ScriptController::~ScriptController()
int next_number = ++controller->loaded_library_count;
/* Create a new fake internal name */
- snprintf(fake_class, sizeof(fake_class), "_internalNA%d", next_number);
+ seprintf(fake_class, lastof(fake_class), "_internalNA%d", next_number);
/* Load the library in a 'fake' namespace, so we can link it to the name the user requested */
sq_pushroottable(vm);
@@ -147,7 +147,7 @@ ScriptController::~ScriptController()
/* Load the library */
if (!engine->LoadScript(vm, lib->GetMainScript(), false)) {
char error[1024];
- snprintf(error, sizeof(error), "there was a compile error when importing '%s' version %d", library, version);
+ seprintf(error, lastof(error), "there was a compile error when importing '%s' version %d", library, version);
throw sq_throwerror(vm, OTTD2SQ(error));
}
/* Create the fake class */
@@ -166,7 +166,7 @@ ScriptController::~ScriptController()
sq_pushstring(vm, OTTD2SQ(lib->GetInstanceName()), -1);
if (SQ_FAILED(sq_get(vm, -2))) {
char error[1024];
- snprintf(error, sizeof(error), "unable to find class '%s' in the library '%s' version %d", lib->GetInstanceName(), library, version);
+ seprintf(error, lastof(error), "unable to find class '%s' in the library '%s' version %d", lib->GetInstanceName(), library, version);
throw sq_throwerror(vm, OTTD2SQ(error));
}
HSQOBJECT obj;