(svn r26486) -Codechange: replace a number of snprintfs with seprintf

This commit is contained in:
rubidium
2014-04-23 21:12:09 +00:00
parent ef4c2ce031
commit 5b82822c12
26 changed files with 61 additions and 59 deletions

View File

@@ -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;
}

View File

@@ -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;