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

@ -16,6 +16,7 @@
#include "ham_const.h"
#include "hooklist.h"
#include "offsets.h"
#include <amtl/am-string.h>
extern hook_t hooklist[];
@ -108,7 +109,7 @@ static void read_mirror(char *input)
*data='\0';
// mark down the source
UTIL_Format(source, sizeof(source)-1, "%s", input);
ke::SafeSprintf(source, sizeof(source)-1, "%s", input);
*data=old;
@ -128,13 +129,13 @@ static void read_mirror(char *input)
old=*data;
*data='\0';
UTIL_Format(dest, sizeof(dest)-1, "%s", data2);
ke::SafeSprintf(dest, sizeof(dest)-1, "%s", data2);
*data=old;
if (strcmp(dest, CurrentModName)==0)
{
UTIL_Format(CurrentModName, sizeof(CurrentModName)-1, "%s", source);
ke::SafeSprintf(CurrentModName, sizeof(CurrentModName)-1, "%s", source);
}
}
@ -313,7 +314,7 @@ int ReadConfig(void)
FILE *fp=fopen(FileName,"r");
UTIL_Format(CurrentModName, sizeof(CurrentModName)-1, "%s", MF_GetModname());
ke::SafeSprintf(CurrentModName, sizeof(CurrentModName)-1, "%s", MF_GetModname());
if (!fp)
{

View File

@ -17,16 +17,17 @@
#include "amxxmodule.h"
#include "offsets.h"
#include "NEW_Util.h"
#include <amtl/am-string.h>
#define CHECK_FUNCTION(x) \
if (x < 0 || x >= HAM_LAST_ENTRY_DONT_USE_ME_LOL) { \
char msg[1024]; \
UTIL_Format(msg, sizeof(msg)-1, "Function out of bounds. Got: %d Max: %d", x, HAM_LAST_ENTRY_DONT_USE_ME_LOL - 1); \
ke::SafeSprintf(msg, sizeof(msg)-1, "Function out of bounds. Got: %d Max: %d", x, HAM_LAST_ENTRY_DONT_USE_ME_LOL - 1); \
FailPlugin(amx, x, HAM_INVALID_FUNC, msg); \
return 0; \
} else if (hooklist[x].isset == 0) { \
char msg[1024]; \
UTIL_Format(msg, sizeof(msg)-1, "Function %s is not configured in hamdata.ini.", hooklist[x].name); \
ke::SafeSprintf(msg, sizeof(msg)-1, "Function %s is not configured in hamdata.ini.", hooklist[x].name); \
FailPlugin(amx, x, HAM_FUNC_NOT_CONFIGURED, msg); \
return 0; \
}

View File

@ -17,6 +17,7 @@
#include "forward.h"
#include "Trampolines.h"
#include <amtl/am-vector.h>
#include <amtl/am-string.h>
#define ALIGN(ar) ((intptr_t)ar & ~(sysconf(_SC_PAGESIZE)-1))
@ -62,7 +63,7 @@ public:
size_t len=strlen(name);
ent=new char[len+1];
UTIL_Format(ent, len + 1, "%s", name);
ke::SafeSprintf(ent, len + 1, "%s", name);
};
~Hook()

View File

@ -707,7 +707,7 @@ static cell AMX_NATIVE_CALL RegisterHamFromEntity(AMX *amx, cell *params)
// It may very well be wrong (such as lots of TS weapons have the same classname)
// but it's the best we can do, and better than nothing.
// (only used for display)
UTIL_Format(classname, sizeof(classname) - 1, "%s", STRING(Entity->v.classname));
ke::SafeSprintf(classname, sizeof(classname) - 1, "%s", STRING(Entity->v.classname));
// If we got here, the function is not hooked
Hook *hook = new Hook(vtable, hooklist[func].vtid, hooklist[func].targetfunc, hooklist[func].isvoid, hooklist[func].needsretbuf, hooklist[func].paramcount, classname);