Fix max length inconsistencies + typo

This commit is contained in:
Arkshine 2015-10-05 19:06:38 +02:00
parent 138b9e1510
commit c29eabec50
18 changed files with 54 additions and 58 deletions

View File

@ -24,7 +24,7 @@ CDirectory::CDirectory(const char *path)
#if defined PLATFORM_WINDOWS #if defined PLATFORM_WINDOWS
char newpath[PLATFORM_MAX_PATH]; char newpath[PLATFORM_MAX_PATH];
ke::SafeSprintf(newpath, sizeof(newpath) - 1, "%s\\*.*", path); ke::SafeSprintf(newpath, sizeof(newpath), "%s\\*.*", path);
m_dir = FindFirstFile(newpath, &m_fd); m_dir = FindFirstFile(newpath, &m_fd);
@ -40,7 +40,7 @@ CDirectory::CDirectory(const char *path)
if (IsValid()) if (IsValid())
{ {
m_ep = readdir(m_dir); // TODO: we need to read past "." and ".."! m_ep = readdir(m_dir); // TODO: we need to read past "." and ".."!
ke::SafeSprintf(m_origpath, sizeof(m_origpath) - 1, "%s", path); ke::SafeSprintf(m_origpath, sizeof(m_origpath), "%s", path);
} }
else else
{ {
@ -121,7 +121,7 @@ bool CDirectory::IsEntryFile()
char temppath[PLATFORM_MAX_PATH]; char temppath[PLATFORM_MAX_PATH];
ke::SafeSprintf(temppath, sizeof(temppath), "%s/%s", m_origpath, GetEntryName()); ke::SafeSprintf(temppath, sizeof(temppath), "%s/%s", m_origpath, GetEntryName());
return ke::file::IsDirectory(temppath); return ke::file::IsFile(temppath);
#endif #endif
} }

View File

@ -240,7 +240,7 @@ static cell AMX_NATIVE_CALL set_cvar_float(AMX *amx, cell *params)
if (info) if (info)
{ {
ke::SafeSprintf(CVarTempBuffer, sizeof(CVarTempBuffer) - 1, "%f", amx_ctof(params[2])); ke::SafeSprintf(CVarTempBuffer, sizeof(CVarTempBuffer), "%f", amx_ctof(params[2]));
CVAR_DIRECTSET(info->var, &CVarTempBuffer[0]); CVAR_DIRECTSET(info->var, &CVarTempBuffer[0]);
} }
@ -258,7 +258,7 @@ static cell AMX_NATIVE_CALL set_cvar_num(AMX *amx, cell *params)
if (info) if (info)
{ {
ke::SafeSprintf(CVarTempBuffer, sizeof(CVarTempBuffer) - 1, "%d", value); ke::SafeSprintf(CVarTempBuffer, sizeof(CVarTempBuffer), "%d", value);
CVAR_DIRECTSET(info->var, &CVarTempBuffer[0]); CVAR_DIRECTSET(info->var, &CVarTempBuffer[0]);
} }
@ -444,7 +444,7 @@ static cell AMX_NATIVE_CALL set_pcvar_float(AMX *amx, cell *params)
return 0; return 0;
} }
ke::SafeSprintf(CVarTempBuffer, sizeof(CVarTempBuffer) - 1, "%f", amx_ctof(params[2])); ke::SafeSprintf(CVarTempBuffer, sizeof(CVarTempBuffer), "%f", amx_ctof(params[2]));
CVAR_DIRECTSET(ptr, &CVarTempBuffer[0]); CVAR_DIRECTSET(ptr, &CVarTempBuffer[0]);
return 1; return 1;
@ -460,7 +460,7 @@ static cell AMX_NATIVE_CALL set_pcvar_num(AMX *amx, cell *params)
return 0; return 0;
} }
ke::SafeSprintf(CVarTempBuffer, sizeof(CVarTempBuffer) - 1, "%d", params[2]); ke::SafeSprintf(CVarTempBuffer, sizeof(CVarTempBuffer), "%d", params[2]);
CVAR_DIRECTSET(ptr, &CVarTempBuffer[0]); CVAR_DIRECTSET(ptr, &CVarTempBuffer[0]);
return 1; return 1;

View File

@ -673,7 +673,7 @@ reswitch:
if (!def) if (!def)
{ {
static char buf[255]; static char buf[255];
ke::SafeSprintf(buf, sizeof(buf) - 1, "ML_NOTFOUND: %s", key); ke::SafeSprintf(buf, sizeof(buf), "ML_NOTFOUND: %s", key);
def = buf; def = buf;
} }
size_t written = atcprintf(buf_p, llen, def, amx, params, &arg); size_t written = atcprintf(buf_p, llen, def, amx, params, &arg);

View File

@ -97,7 +97,7 @@ size_t AddLibrariesFromString(const char *name, LibType type, LibSource src, voi
char *ptr, *p, s; char *ptr, *p, s;
size_t count = 0; size_t count = 0;
ke::SafeSprintf(buffer, sizeof(buffer)-1, "%s", name); ke::SafeSprintf(buffer, sizeof(buffer), "%s", name);
ptr = buffer; ptr = buffer;
p = buffer; p = buffer;

View File

@ -226,7 +226,7 @@ void LoadExtraPluginsToPCALM(const char *initialdir)
while (!files.empty()) while (!files.empty())
{ {
ke::AString *pString = files.front(); ke::AString *pString = files.front();
ke::SafeSprintf(path, sizeof(path)-1, "%s/%s", ke::SafeSprintf(path, sizeof(path), "%s/%s",
initialdir, initialdir,
pString->chars()); pString->chars());
g_plugins.CALMFromFile(path); g_plugins.CALMFromFile(path);
@ -243,7 +243,7 @@ void LoadExtraPluginsFromDir(const char *initialdir)
while (!files.empty()) while (!files.empty())
{ {
ke::AString *pString = files.front(); ke::AString *pString = files.front();
ke::SafeSprintf(path, sizeof(path)-1, "%s/%s", ke::SafeSprintf(path, sizeof(path), "%s/%s",
initialdir, initialdir,
pString->chars()); pString->chars());
g_plugins.loadPluginsFromFile(path); g_plugins.loadPluginsFromFile(path);

View File

@ -670,7 +670,7 @@ char* build_pathname(const char *fmt, ...)
{ {
static char string[256]; static char string[256];
int b; int b;
int a = b = ke::SafeSprintf(string, 255, "%s%c", g_mod_name.chars(), PATH_SEP_CHAR); int a = b = ke::SafeSprintf(string, sizeof(string), "%s%c", g_mod_name.chars(), PATH_SEP_CHAR);
va_list argptr; va_list argptr;
va_start(argptr, fmt); va_start(argptr, fmt);

View File

@ -289,7 +289,7 @@ bool Menu::Display(int player, page_t page)
return false; return false;
static char buffer[2048]; static char buffer[2048];
int len = ke::SafeSprintf(buffer, sizeof(buffer)-1, "%s", str); int len = ke::SafeSprintf(buffer, sizeof(buffer), "%s", str);
CPlayer *pPlayer = GET_PLAYER_POINTER_I(player); CPlayer *pPlayer = GET_PLAYER_POINTER_I(player);
@ -342,14 +342,14 @@ const char *Menu::GetTextString(int player, page_t page, int &keys)
if (items_per_page && (pages != 1)) if (items_per_page && (pages != 1))
{ {
if (m_AutoColors) if (m_AutoColors)
ke::SafeSprintf(buffer, sizeof(buffer)-1, "\\y%s %d/%d\n\\w\n", m_Title.chars(), page + 1, pages); ke::SafeSprintf(buffer, sizeof(buffer), "\\y%s %d/%d\n\\w\n", m_Title.chars(), page + 1, pages);
else else
ke::SafeSprintf(buffer, sizeof(buffer)-1, "%s %d/%d\n\n", m_Title.chars(), page + 1, pages); ke::SafeSprintf(buffer, sizeof(buffer), "%s %d/%d\n\n", m_Title.chars(), page + 1, pages);
} else { } else {
if (m_AutoColors) if (m_AutoColors)
ke::SafeSprintf(buffer, sizeof(buffer)-1, "\\y%s\n\\w\n", m_Title.chars()); ke::SafeSprintf(buffer, sizeof(buffer), "\\y%s\n\\w\n", m_Title.chars());
else else
ke::SafeSprintf(buffer, sizeof(buffer)-1, "%s\n\n", m_Title.chars()); ke::SafeSprintf(buffer, sizeof(buffer), "%s\n\n", m_Title.chars());
} }
m_Text = m_Text + buffer; m_Text = m_Text + buffer;
@ -446,22 +446,22 @@ const char *Menu::GetTextString(int player, page_t page, int &keys)
if (pItem->isBlank) if (pItem->isBlank)
{ {
ke::SafeSprintf(buffer, sizeof(buffer)-1, "%s\n", pItem->name.chars()); ke::SafeSprintf(buffer, sizeof(buffer), "%s\n", pItem->name.chars());
} }
else if (enabled) else if (enabled)
{ {
if (m_AutoColors) if (m_AutoColors)
{ {
ke::SafeSprintf(buffer, sizeof(buffer)-1, "%s%d.\\w %s\n", m_ItemColor.chars(),option_display, pItem->name.chars()); ke::SafeSprintf(buffer, sizeof(buffer), "%s%d.\\w %s\n", m_ItemColor.chars(),option_display, pItem->name.chars());
} else { } else {
ke::SafeSprintf(buffer, sizeof(buffer)-1, "%d. %s\n", option_display, pItem->name.chars()); ke::SafeSprintf(buffer, sizeof(buffer), "%d. %s\n", option_display, pItem->name.chars());
} }
} else { } else {
if (m_AutoColors) if (m_AutoColors)
{ {
ke::SafeSprintf(buffer, sizeof(buffer)-1, "\\d%d. %s\n\\w", option_display, pItem->name.chars()); ke::SafeSprintf(buffer, sizeof(buffer), "\\d%d. %s\n\\w", option_display, pItem->name.chars());
} else { } else {
ke::SafeSprintf(buffer, sizeof(buffer)-1, "#. %s\n", pItem->name.chars()); ke::SafeSprintf(buffer, sizeof(buffer), "#. %s\n", pItem->name.chars());
} }
} }
slots++; slots++;
@ -504,14 +504,14 @@ const char *Menu::GetTextString(int player, page_t page, int &keys)
if (m_AutoColors) if (m_AutoColors)
{ {
ke::SafeSprintf(buffer, ke::SafeSprintf(buffer,
sizeof(buffer)-1, sizeof(buffer),
"%s%d. \\w%s\n", "%s%d. \\w%s\n",
m_ItemColor.chars(), m_ItemColor.chars(),
option == 10 ? 0 : option, option == 10 ? 0 : option,
m_OptNames[abs(MENU_BACK)].chars()); m_OptNames[abs(MENU_BACK)].chars());
} else { } else {
ke::SafeSprintf(buffer, ke::SafeSprintf(buffer,
sizeof(buffer)-1, sizeof(buffer),
"%d. %s\n", "%d. %s\n",
option == 10 ? 0 : option, option == 10 ? 0 : option,
m_OptNames[abs(MENU_BACK)].chars()); m_OptNames[abs(MENU_BACK)].chars());
@ -521,12 +521,12 @@ const char *Menu::GetTextString(int player, page_t page, int &keys)
if (m_AutoColors) if (m_AutoColors)
{ {
ke::SafeSprintf(buffer, ke::SafeSprintf(buffer,
sizeof(buffer)-1, sizeof(buffer),
"\\d%d. %s\n\\w", "\\d%d. %s\n\\w",
option == 10 ? 0 : option, option == 10 ? 0 : option,
m_OptNames[abs(MENU_BACK)].chars()); m_OptNames[abs(MENU_BACK)].chars());
} else { } else {
ke::SafeSprintf(buffer, sizeof(buffer)-1, "#. %s\n", m_OptNames[abs(MENU_BACK)].chars()); ke::SafeSprintf(buffer, sizeof(buffer), "#. %s\n", m_OptNames[abs(MENU_BACK)].chars());
} }
} }
m_Text = m_Text + buffer; m_Text = m_Text + buffer;
@ -537,14 +537,14 @@ const char *Menu::GetTextString(int player, page_t page, int &keys)
if (m_AutoColors) if (m_AutoColors)
{ {
ke::SafeSprintf(buffer, ke::SafeSprintf(buffer,
sizeof(buffer)-1, sizeof(buffer),
"%s%d. \\w%s\n", "%s%d. \\w%s\n",
m_ItemColor.chars(), m_ItemColor.chars(),
option == 10 ? 0 : option, option == 10 ? 0 : option,
m_OptNames[abs(MENU_MORE)].chars()); m_OptNames[abs(MENU_MORE)].chars());
} else { } else {
ke::SafeSprintf(buffer, ke::SafeSprintf(buffer,
sizeof(buffer)-1, sizeof(buffer),
"%d. %s\n", "%d. %s\n",
option == 10 ? 0 : option, option == 10 ? 0 : option,
m_OptNames[abs(MENU_MORE)].chars()); m_OptNames[abs(MENU_MORE)].chars());
@ -554,12 +554,12 @@ const char *Menu::GetTextString(int player, page_t page, int &keys)
if (m_AutoColors) if (m_AutoColors)
{ {
ke::SafeSprintf(buffer, ke::SafeSprintf(buffer,
sizeof(buffer)-1, sizeof(buffer),
"\\d%d. %s\n\\w", "\\d%d. %s\n\\w",
option == 10 ? 0 : option, option == 10 ? 0 : option,
m_OptNames[abs(MENU_MORE)].chars()); m_OptNames[abs(MENU_MORE)].chars());
} else { } else {
ke::SafeSprintf(buffer, sizeof(buffer)-1, "#. %s\n", m_OptNames[abs(MENU_MORE)].chars()); ke::SafeSprintf(buffer, sizeof(buffer), "#. %s\n", m_OptNames[abs(MENU_MORE)].chars());
} }
} }
m_Text = m_Text + buffer; m_Text = m_Text + buffer;
@ -579,14 +579,14 @@ const char *Menu::GetTextString(int player, page_t page, int &keys)
if (m_AutoColors) if (m_AutoColors)
{ {
ke::SafeSprintf(buffer, ke::SafeSprintf(buffer,
sizeof(buffer)-1, sizeof(buffer),
"%s%d. \\w%s\n", "%s%d. \\w%s\n",
m_ItemColor.chars(), m_ItemColor.chars(),
option == 10 ? 0 : option, option == 10 ? 0 : option,
m_OptNames[abs(MENU_EXIT)].chars()); m_OptNames[abs(MENU_EXIT)].chars());
} else { } else {
ke::SafeSprintf(buffer, ke::SafeSprintf(buffer,
sizeof(buffer)-1, sizeof(buffer),
"%d. %s\n", "%d. %s\n",
option == 10 ? 0 : option, option == 10 ? 0 : option,
m_OptNames[abs(MENU_EXIT)].chars()); m_OptNames[abs(MENU_EXIT)].chars());

View File

@ -335,9 +335,7 @@ void UTIL_FakeClientCommand(edict_t *pEdict, const char *cmd, const char *arg1,
g_fakecmd.argv[1] = arg1; g_fakecmd.argv[1] = arg1;
g_fakecmd.argv[2] = arg2; g_fakecmd.argv[2] = arg2;
// build argument line // build argument line
ke::SafeSprintf(g_fakecmd.args, 255, "%s %s", arg1, arg2); ke::SafeSprintf(g_fakecmd.args, sizeof(g_fakecmd.args), "%s %s", arg1, arg2);
// if ke::SafeSprintf reached 255 chars limit, this will make sure there will be no access violation
g_fakecmd.args[255] = 0;
} }
else if (arg1) else if (arg1)
{ // only one argument passed { // only one argument passed
@ -345,9 +343,7 @@ void UTIL_FakeClientCommand(edict_t *pEdict, const char *cmd, const char *arg1,
// store argument // store argument
g_fakecmd.argv[1] = arg1; g_fakecmd.argv[1] = arg1;
// build argument line // build argument line
ke::SafeSprintf(g_fakecmd.args, 255, "%s", arg1); ke::SafeSprintf(g_fakecmd.args, sizeof(g_fakecmd.args), "%s", arg1);
// if ke::SafeSprintf reached 255 chars limit, this will make sure there will be no access violation
g_fakecmd.args[255] = 0;
} }
else else
g_fakecmd.argc = 1; // no argmuents -> only one command g_fakecmd.argc = 1; // no argmuents -> only one command

View File

@ -179,7 +179,7 @@ void UpdateListBox(HWND hDlg) {
//if ((*b).getPosition() < 1) // umm... naaah! //if ((*b).getPosition() < 1) // umm... naaah!
//continue; //continue;
ke::SafeSprintf(tempbuffer, sizeof(tempbuffer)-1, "%s", (*b).getName()); ke::SafeSprintf(tempbuffer, sizeof(tempbuffer), "%s", (*b).getName());
SendMessage( // returns LRESULT in lResult SendMessage( // returns LRESULT in lResult
listbox, // handle to destination control listbox, // handle to destination control
@ -326,7 +326,7 @@ void SaveChanges(HWND hDlg) {
UpdateListBox(hDlg); UpdateListBox(hDlg);
char buffer[256]; char buffer[256];
ke::SafeSprintf(buffer, sizeof(buffer)-1, "New rank of %s: %d", name, newPosition); ke::SafeSprintf(buffer, sizeof(buffer), "New rank of %s: %d", name, newPosition);
MessageBox(hDlg, buffer, "Update succeeded", MB_OK); MessageBox(hDlg, buffer, "Update succeeded", MB_OK);
// In the listbox, we need to reselect the item we just updated. Use the new name. // In the listbox, we need to reselect the item we just updated. Use the new name.

View File

@ -945,7 +945,7 @@ static cell AMX_NATIVE_CALL traceresult(AMX *amx, cell *params)
// (jghg) // (jghg)
static cell AMX_NATIVE_CALL get_string(AMX *amx, cell *params) // (string, returnstring[], length) static cell AMX_NATIVE_CALL get_string(AMX *amx, cell *params) // (string, returnstring[], length)
{ {
ke::SafeSprintf(g_buffer, sizeof(g_buffer)-1, "%s", STRING(params[1])); ke::SafeSprintf(g_buffer, sizeof(g_buffer), "%s", STRING(params[1]));
return MF_SetAmxString(amx, params[2], g_buffer, params[3]); return MF_SetAmxString(amx, params[2], g_buffer, params[3]);
} }

View File

@ -299,23 +299,23 @@ static cell AMX_NATIVE_CALL amx_pev(AMX *amx,cell *params)
return num; return num;
} else if (ValType & Ret_Int) { } else if (ValType & Ret_Int) {
char temp[32]; char temp[32];
ke::SafeSprintf(temp, sizeof(temp)-1, "%d", rets.i); ke::SafeSprintf(temp, sizeof(temp), "%d", rets.i);
return MF_SetAmxString(amx, params[3], temp, size); return MF_SetAmxString(amx, params[3], temp, size);
} else if (ValType == Ret_Float) { } else if (ValType == Ret_Float) {
char temp[32]; char temp[32];
ke::SafeSprintf(temp, sizeof(temp)-1, "%f", rets.f); ke::SafeSprintf(temp, sizeof(temp), "%f", rets.f);
return MF_SetAmxString(amx, params[3], temp, size); return MF_SetAmxString(amx, params[3], temp, size);
} else if (ValType == Ret_Vec) { } else if (ValType == Ret_Vec) {
char temp[32]; char temp[32];
ke::SafeSprintf(temp, sizeof(temp)-1, "%f %f %f", vr.x, vr.y, vr.z); ke::SafeSprintf(temp, sizeof(temp), "%f %f %f", vr.x, vr.y, vr.z);
return MF_SetAmxString(amx, params[3], temp, size); return MF_SetAmxString(amx, params[3], temp, size);
} else if (ValType == Ret_Bytes2) { } else if (ValType == Ret_Bytes2) {
char temp[32]; char temp[32];
ke::SafeSprintf(temp, sizeof(temp)-1, "%d %d", rets.ba[0], rets.ba[1]); ke::SafeSprintf(temp, sizeof(temp), "%d %d", rets.ba[0], rets.ba[1]);
return MF_SetAmxString(amx, params[3], temp, size); return MF_SetAmxString(amx, params[3], temp, size);
} else if (ValType == Ret_Bytes4) { } else if (ValType == Ret_Bytes4) {
char temp[32]; char temp[32];
ke::SafeSprintf(temp, sizeof(temp)-1, "%d %d %d %d", rets.ba[0], rets.ba[1], rets.ba[2], rets.ba[3]); ke::SafeSprintf(temp, sizeof(temp), "%d %d %d %d", rets.ba[0], rets.ba[1], rets.ba[2], rets.ba[3]);
return MF_SetAmxString(amx, params[3], temp, size); return MF_SetAmxString(amx, params[3], temp, size);
} }

View File

@ -192,7 +192,7 @@ bool loadDatabase()
// MF_BuildPathname not used because backslash // MF_BuildPathname not used because backslash
// makes CreateFileMapping failing under windows. // makes CreateFileMapping failing under windows.
ke::SafeSprintf(file, sizeof(file) - 1, "%s/%s/GeoLite2-%s.mmdb", modName, dataDir, databases[i]); ke::SafeSprintf(file, sizeof(file), "%s/%s/GeoLite2-%s.mmdb", modName, dataDir, databases[i]);
status = MMDB_open(file, MMDB_MODE_MMAP, &HandleDB); status = MMDB_open(file, MMDB_MODE_MMAP, &HandleDB);

View File

@ -109,7 +109,7 @@ static void read_mirror(char *input)
*data='\0'; *data='\0';
// mark down the source // mark down the source
ke::SafeSprintf(source, sizeof(source)-1, "%s", input); ke::SafeSprintf(source, sizeof(source), "%s", input);
*data=old; *data=old;
@ -129,13 +129,13 @@ static void read_mirror(char *input)
old=*data; old=*data;
*data='\0'; *data='\0';
ke::SafeSprintf(dest, sizeof(dest)-1, "%s", data2); ke::SafeSprintf(dest, sizeof(dest), "%s", data2);
*data=old; *data=old;
if (strcmp(dest, CurrentModName)==0) if (strcmp(dest, CurrentModName)==0)
{ {
ke::SafeSprintf(CurrentModName, sizeof(CurrentModName)-1, "%s", source); ke::SafeSprintf(CurrentModName, sizeof(CurrentModName), "%s", source);
} }
} }
@ -314,7 +314,7 @@ int ReadConfig(void)
FILE *fp=fopen(FileName,"r"); FILE *fp=fopen(FileName,"r");
ke::SafeSprintf(CurrentModName, sizeof(CurrentModName)-1, "%s", MF_GetModname()); ke::SafeSprintf(CurrentModName, sizeof(CurrentModName), "%s", MF_GetModname());
if (!fp) if (!fp)
{ {

View File

@ -22,12 +22,12 @@
#define CHECK_FUNCTION(x) \ #define CHECK_FUNCTION(x) \
if (x < 0 || x >= HAM_LAST_ENTRY_DONT_USE_ME_LOL) { \ if (x < 0 || x >= HAM_LAST_ENTRY_DONT_USE_ME_LOL) { \
char msg[1024]; \ char msg[1024]; \
ke::SafeSprintf(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), "Function out of bounds. Got: %d Max: %d", x, HAM_LAST_ENTRY_DONT_USE_ME_LOL - 1); \
FailPlugin(amx, x, HAM_INVALID_FUNC, msg); \ FailPlugin(amx, x, HAM_INVALID_FUNC, msg); \
return 0; \ return 0; \
} else if (hooklist[x].isset == 0) { \ } else if (hooklist[x].isset == 0) { \
char msg[1024]; \ char msg[1024]; \
ke::SafeSprintf(msg, sizeof(msg)-1, "Function %s is not configured in hamdata.ini.", hooklist[x].name); \ ke::SafeSprintf(msg, sizeof(msg), "Function %s is not configured in hamdata.ini.", hooklist[x].name); \
FailPlugin(amx, x, HAM_FUNC_NOT_CONFIGURED, msg); \ FailPlugin(amx, x, HAM_FUNC_NOT_CONFIGURED, msg); \
return 0; \ return 0; \
} }

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) // 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. // but it's the best we can do, and better than nothing.
// (only used for display) // (only used for display)
ke::SafeSprintf(classname, sizeof(classname) - 1, "%s", STRING(Entity->v.classname)); ke::SafeSprintf(classname, sizeof(classname), "%s", STRING(Entity->v.classname));
// If we got here, the function is not hooked // 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); Hook *hook = new Hook(vtable, hooklist[func].vtid, hooklist[func].targetfunc, hooklist[func].isvoid, hooklist[func].needsretbuf, hooklist[func].paramcount, classname);

View File

@ -26,7 +26,7 @@ void ParticleManager::ReadFile(void)
char FileName[256]; char FileName[256];
ke::SafeSprintf(FileName, sizeof(FileName)-1, "%s/ns.ps", MF_GetModname()); ke::SafeSprintf(FileName, sizeof(FileName), "%s/ns.ps", MF_GetModname());
FILE *fp=fopen(FileName,"r"); FILE *fp=fopen(FileName,"r");
if (!fp) if (!fp)

View File

@ -27,7 +27,7 @@ void TitleManager::LoadTitles(void)
char FileName[128]; char FileName[128];
ke::SafeSprintf(FileName, sizeof(FileName)-1, "%s/titles.txt", MF_GetModname()); ke::SafeSprintf(FileName, sizeof(FileName), "%s/titles.txt", MF_GetModname());
FILE *fp=fopen(FileName,"r"); FILE *fp=fopen(FileName,"r");

View File

@ -48,7 +48,7 @@ cell PSKeyValueI(const char *name, AMX *amx, cell *params)
char StrData[1024]; char StrData[1024];
ke::SafeSprintf(StrData, sizeof(StrData)-1, "%d", params[2]); ke::SafeSprintf(StrData, sizeof(StrData), "%d", params[2]);
kvd.szClassName=const_cast<char *>(STRING(reinterpret_cast<edict_t *>(params[1])->v.classname)); kvd.szClassName=const_cast<char *>(STRING(reinterpret_cast<edict_t *>(params[1])->v.classname));
kvd.szKeyName=name; kvd.szKeyName=name;
@ -71,7 +71,7 @@ cell PSKeyValueF(const char *name, AMX *amx, cell *params)
char StrData[1024]; char StrData[1024];
ke::SafeSprintf(StrData, sizeof(StrData)-1, "%f", amx_ctof2(params[2])); ke::SafeSprintf(StrData, sizeof(StrData), "%f", amx_ctof2(params[2]));
kvd.szClassName=const_cast<char *>(STRING(reinterpret_cast<edict_t *>(params[1])->v.classname)); kvd.szClassName=const_cast<char *>(STRING(reinterpret_cast<edict_t *>(params[1])->v.classname));
kvd.szKeyName=name; kvd.szKeyName=name;