Remove UTIL_Format() and UTIL_VarArgs()

This commit is contained in:
Arkshine
2015-10-01 11:06:04 +02:00
parent f22dc769f4
commit 138b9e1510
39 changed files with 112 additions and 173 deletions

View File

@ -19,6 +19,7 @@
#include "CstrikeHLTypeConversion.h"
#include <CDetour/detours.h>
#include <amtl/am-vector.h>
#include <amtl/am-string.h>
bool NoKifesMode = false;
@ -898,7 +899,7 @@ static cell AMX_NATIVE_CALL cs_set_user_model(AMX *amx, cell *params)
GET_OFFSET("CBasePlayer", m_modelIndexPlayer);
char model[260];
UTIL_Format(model, sizeof(model), "models/player/%s/%s.mdl", newModel, newModel);
ke::SafeSprintf(model, sizeof(model), "models/player/%s/%s.mdl", newModel, newModel);
for (size_t i = 0; i < HL_MODEL_MAX; ++i)
{

View File

@ -6,7 +6,7 @@ binary = AMXX.Program(builder, 'WinCSX')
binary.compiler.includes += [
os.path.join(builder.currentSourcePath, 'resources'),
]
binary.compiler.defines += ['_MBCS']
binary.compiler.defines += ['_MBCS', 'HAVE_STDINT_H']
binary.compiler.linkflags += [
'comctl32.lib',
]

View File

@ -11,24 +11,7 @@
#include "WinCSX.h"
#include <stdio.h>
#include "commctrl.h"
size_t UTIL_Format(char *buffer, size_t maxlength, const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
size_t len = vsnprintf(buffer, maxlength, fmt, ap);
va_end(ap);
if (len >= maxlength)
{
buffer[maxlength - 1] = '\0';
return (maxlength - 1);
}
else
{
return len;
}
}
#include <amtl/am-string.h>
int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
@ -196,7 +179,7 @@ void UpdateListBox(HWND hDlg) {
//if ((*b).getPosition() < 1) // umm... naaah!
//continue;
UTIL_Format(tempbuffer, sizeof(tempbuffer)-1, "%s", (*b).getName());
ke::SafeSprintf(tempbuffer, sizeof(tempbuffer)-1, "%s", (*b).getName());
SendMessage( // returns LRESULT in lResult
listbox, // handle to destination control
@ -343,7 +326,7 @@ void SaveChanges(HWND hDlg) {
UpdateListBox(hDlg);
char buffer[256];
UTIL_Format(buffer, sizeof(buffer)-1, "New rank of %s: %d", name, newPosition);
ke::SafeSprintf(buffer, sizeof(buffer)-1, "New rank of %s: %d", name, newPosition);
MessageBox(hDlg, buffer, "Update succeeded", MB_OK);
// In the listbox, we need to reselect the item we just updated. Use the new name.