diff --git a/AMBuildScript b/AMBuildScript index 6254e98b..841f86ae 100644 --- a/AMBuildScript +++ b/AMBuildScript @@ -270,7 +270,8 @@ class AMXXConfig(object): cfg.includes += [os.path.join(builder.sourcePath, 'public')] cfg.includes += [os.path.join(builder.sourcePath, 'public', 'sdk')] - cfg.includes += [os.path.join(builder.sourcePath, 'public', 'amtl', 'include')] + cfg.includes += [os.path.join(builder.sourcePath, 'public', 'amtl')] + cfg.includes += [os.path.join(builder.sourcePath, 'public', 'amtl', 'amtl')] cfg.includes += [os.path.join(builder.sourcePath, 'public', 'memtools')] cfg.includes += [os.path.join(builder.sourcePath, 'third_party')] cfg.includes += [os.path.join(builder.sourcePath, 'third_party', 'hashing')] diff --git a/amxmodx/CFileSystem.h b/amxmodx/CFileSystem.h index a9d79f40..40bd76bb 100644 --- a/amxmodx/CFileSystem.h +++ b/amxmodx/CFileSystem.h @@ -12,7 +12,6 @@ #include // IFileSystem, FileSystemSeek_t, FileHandle_t (HLSDK) #include // FILE* -#include // KE_OVERRIDE extern IFileSystem* g_FileSystem; @@ -38,7 +37,7 @@ class FileObject virtual bool EndOfFile() = 0; virtual void Close() = 0; - virtual ValveFile *AsValveFile() + virtual ValveFile *AsValveFile() { return nullptr; } @@ -55,7 +54,7 @@ class ValveFile : public FileObject ValveFile(FileHandle_t handle) : handle_(handle) {} - ~ValveFile() + ~ValveFile() { Close(); } @@ -65,10 +64,10 @@ class ValveFile : public FileObject return g_FileSystem->FileExists(file); } - static ValveFile* Open(const char* filename, const char* mode, const char* pathID) + static ValveFile* Open(const char* filename, const char* mode, const char* pathID) { FileHandle_t handle = g_FileSystem->OpenFromCacheForRead(filename, mode, pathID); - + if (!handle) { return nullptr; @@ -77,7 +76,7 @@ class ValveFile : public FileObject return new ValveFile(handle); } - static bool Delete(const char* filename, const char* pathID) + static bool Delete(const char* filename, const char* pathID) { if (!Exists(filename)) { @@ -94,49 +93,49 @@ class ValveFile : public FileObject return true; } - size_t Read(void* pOut, size_t size) KE_OVERRIDE + size_t Read(void* pOut, size_t size) override { return static_cast(g_FileSystem->Read(pOut, size, handle_)); } - - char* ReadLine(char* pOut, size_t size) KE_OVERRIDE + + char* ReadLine(char* pOut, size_t size) override { return g_FileSystem->ReadLine(pOut, size, handle_); } - size_t Write(const void* pData, size_t size) KE_OVERRIDE + size_t Write(const void* pData, size_t size) override { return static_cast(g_FileSystem->Write(pData, size, handle_)); } - - bool Seek(int pos, int seek_type) KE_OVERRIDE + + bool Seek(int pos, int seek_type) override { g_FileSystem->Seek(handle_, pos, static_cast(seek_type)); return !HasError(); } - - int Tell() KE_OVERRIDE + + int Tell() override { return g_FileSystem->Tell(handle_); } - - bool HasError() KE_OVERRIDE + + bool HasError() override { return !handle_ || !g_FileSystem->IsOk(handle_); } - - int Flush() KE_OVERRIDE + + int Flush() override { g_FileSystem->Flush(handle_); return 0; } - - bool EndOfFile() KE_OVERRIDE + + bool EndOfFile() override { return g_FileSystem->EndOfFile(handle_); } - - void Close() KE_OVERRIDE + + void Close() override { if (handle_) { @@ -144,8 +143,8 @@ class ValveFile : public FileObject handle_ = nullptr;; } } - - virtual ValveFile* AsValveFile() + + virtual ValveFile* AsValveFile() { return this; } @@ -167,12 +166,12 @@ class SystemFile : public FileObject SystemFile(FILE* fp) : fp_(fp) {} - ~SystemFile() + ~SystemFile() { Close(); } - static SystemFile* Open(const char* path, const char* mode) + static SystemFile* Open(const char* path, const char* mode) { FILE* fp = fopen(path, mode); @@ -184,52 +183,52 @@ class SystemFile : public FileObject return new SystemFile(fp); } - static bool Delete(const char* path) + static bool Delete(const char* path) { return unlink(path) == 0; } - size_t Read(void* pOut, size_t size) KE_OVERRIDE + size_t Read(void* pOut, size_t size) override { return fread(pOut, 1, size, fp_); } - - char* ReadLine(char* pOut, size_t size) KE_OVERRIDE + + char* ReadLine(char* pOut, size_t size) override { return fgets(pOut, size, fp_); } - - size_t Write(const void* pData, size_t size) KE_OVERRIDE + + size_t Write(const void* pData, size_t size) override { return fwrite(pData, 1, size, fp_); } - - bool Seek(int pos, int seek_type) KE_OVERRIDE + + bool Seek(int pos, int seek_type) override { return fseek(fp_, pos, seek_type) == 0; } - - int Tell() KE_OVERRIDE + + int Tell() override { return ftell(fp_); } - - bool HasError() KE_OVERRIDE + + bool HasError() override { return ferror(fp_) != 0; } - - int Flush() KE_OVERRIDE + + int Flush() override { return fflush(fp_); } - - bool EndOfFile() KE_OVERRIDE + + bool EndOfFile() override { return feof(fp_) != 0; } - - void Close() KE_OVERRIDE + + void Close() override { if (fp_) { @@ -237,7 +236,7 @@ class SystemFile : public FileObject fp_ = nullptr; } } - + virtual SystemFile* AsSystemFile() { return this; diff --git a/amxmodx/CGameConfigs.h b/amxmodx/CGameConfigs.h index 75ec0b2e..72f31358 100644 --- a/amxmodx/CGameConfigs.h +++ b/amxmodx/CGameConfigs.h @@ -12,9 +12,9 @@ #include #include "CLibrarySys.h" -#include -#include -#include +#include +#include +#include #include #include diff --git a/amxmodx/CLibrarySys.cpp b/amxmodx/CLibrarySys.cpp index fca84a3d..5330a944 100644 --- a/amxmodx/CLibrarySys.cpp +++ b/amxmodx/CLibrarySys.cpp @@ -9,6 +9,9 @@ #include "CLibrarySys.h" #include +#include +#include +#include LibrarySystem g_LibSys; @@ -21,7 +24,7 @@ CDirectory::CDirectory(const char *path) #if defined PLATFORM_WINDOWS char newpath[PLATFORM_MAX_PATH]; - UTIL_Format(newpath, sizeof(newpath) - 1, "%s\\*.*", path); + ke::SafeSprintf(newpath, sizeof(newpath), "%s\\*.*", path); m_dir = FindFirstFile(newpath, &m_fd); @@ -37,7 +40,7 @@ CDirectory::CDirectory(const char *path) if (IsValid()) { m_ep = readdir(m_dir); // TODO: we need to read past "." and ".."! - UTIL_Format(m_origpath, sizeof(m_origpath) - 1, "%s", path); + ke::SafeSprintf(m_origpath, sizeof(m_origpath), "%s", path); } else { @@ -100,9 +103,9 @@ bool CDirectory::IsEntryDirectory() #elif defined PLATFORM_POSIX char temppath[PLATFORM_MAX_PATH]; - UTIL_Format(temppath, sizeof(temppath) - 1, "%s/%s", m_origpath, GetEntryName()); + ke::SafeSprintf(temppath, sizeof(temppath), "%s/%s", m_origpath, GetEntryName()); - return g_LibSys.IsPathDirectory(temppath); + return ke::file::IsDirectory(temppath); #endif } @@ -116,9 +119,9 @@ bool CDirectory::IsEntryFile() #elif defined PLATFORM_POSIX char temppath[PLATFORM_MAX_PATH]; - UTIL_Format(temppath, sizeof(temppath) - 1, "%s/%s", m_origpath, GetEntryName()); + ke::SafeSprintf(temppath, sizeof(temppath), "%s/%s", m_origpath, GetEntryName()); - return g_LibSys.IsPathFile(temppath); + return ke::file::IsFile(temppath); #endif } @@ -158,26 +161,8 @@ bool CDirectory::IsValid() /* Library Code */ /****************/ -CLibrary::~CLibrary() -{ - if (m_lib) - { -#if defined PLATFORM_WINDOWS - - FreeLibrary(m_lib); - -#elif defined PLATFORM_POSIX - - dlclose(m_lib); -#endif - m_lib = nullptr; - } -} - -CLibrary::CLibrary(LibraryHandle me) -{ - m_lib = me; -} +CLibrary::CLibrary(ke::Ref lib) : lib_(lib) +{} void CLibrary::CloseLibrary() { @@ -186,14 +171,7 @@ void CLibrary::CloseLibrary() void *CLibrary::GetSymbolAddress(const char* symname) { -#if defined PLATFORM_WINDOWS - - return GetProcAddress(m_lib, symname); - -#elif defined PLATFORM_POSIX - - return dlsym(m_lib, symname); -#endif + return lib_->lookup(symname); } @@ -203,83 +181,17 @@ void *CLibrary::GetSymbolAddress(const char* symname) bool LibrarySystem::PathExists(const char *path) { -#if defined PLATFORM_WINDOWS - - DWORD attr = GetFileAttributesA(path); - - return (attr != INVALID_FILE_ATTRIBUTES); - -#elif defined PLATFORM_POSIX - - struct stat s; - - return (stat(path, &s) == 0); -#endif + return ke::file::PathExists(path); } bool LibrarySystem::IsPathFile(const char* path) { -#if defined PLATFORM_WINDOWS - - DWORD attr = GetFileAttributes(path); - - if (attr == INVALID_FILE_ATTRIBUTES) - { - return false; - } - - if (attr & (FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_DEVICE)) - { - return false; - } - - return true; - -#elif defined PLATFORM_POSIX - - struct stat s; - - if (stat(path, &s) != 0) - { - return false; - } - - return S_ISREG(s.st_mode) ? true : false; -#endif + return ke::file::IsFile(path); } bool LibrarySystem::IsPathDirectory(const char* path) { -#if defined PLATFORM_WINDOWS - - DWORD attr = GetFileAttributes(path); - - if (attr == INVALID_FILE_ATTRIBUTES) - { - return false; - } - - if (attr & FILE_ATTRIBUTE_DIRECTORY) - { - return true; - } - -#elif defined PLATFORM_POSIX - - struct stat s; - - if (stat(path, &s) != 0) - { - return false; - } - - if (S_ISDIR(s.st_mode)) - { - return true; - } -#endif - - return false; + return ke::file::IsDirectory(path); } CDirectory *LibrarySystem::OpenDirectory(const char* path) @@ -297,22 +209,10 @@ CDirectory *LibrarySystem::OpenDirectory(const char* path) CLibrary* LibrarySystem::OpenLibrary(const char* path, char* error, size_t maxlength) { -#if defined PLATFORM_WINDOWS - - LibraryHandle lib = LoadLibrary(path); - -#elif defined PLATFORM_POSIX - - LibraryHandle lib = dlopen(path, RTLD_NOW); -#endif + ke::Ref lib = ke::SharedLib::Open(path, error, maxlength); if (!lib) { - if (error && maxlength) - { - GetLoaderError(error, maxlength); - } - return nullptr; } @@ -335,48 +235,13 @@ void LibrarySystem::GetPlatformErrorEx(int code, char* error, size_t maxlength) { if (error && maxlength) { -#if defined PLATFORM_WINDOWS - - if (FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, - nullptr, - (DWORD)code, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - (LPSTR)error, - maxlength, - nullptr) == 0) - { - UTIL_Format(error, maxlength, "error code %08x", code); - } - -#elif defined PLATFORM_LINUX - - const char *ae = strerror_r(code, error, maxlength); - - if (ae != error) - { - UTIL_Format(error, maxlength, "%s", ae); - } - -#elif defined PLATFORM_POSIX - - strerror_r(code, error, maxlength); -#endif + ke::FormatSystemErrorCode(code, error, maxlength); } } void LibrarySystem::GetLoaderError(char* buffer, size_t maxlength) { -#if defined PLATFORM_WINDOWS - - GetPlatformError(buffer, maxlength); - -#elif defined PLATFORM_POSIX - - if (buffer && maxlength) - { - strncopy(buffer, dlerror(), maxlength); - } -#endif + ke::FormatSystemError(buffer, maxlength); } void LibrarySystem::CloseDirectory(CDirectory *dir) @@ -388,23 +253,9 @@ size_t LibrarySystem::PathFormat(char* buffer, size_t len, const char* fmt, ...) { va_list ap; va_start(ap, fmt); - size_t mylen = vsnprintf(buffer, len, fmt, ap); + size_t mylen = ke::path::FormatVa(buffer, len, fmt, ap); va_end(ap); - if (mylen >= len) - { - mylen = len - 1; - buffer[mylen] = '\0'; - } - - for (size_t i = 0; i < mylen; i++) - { - if (buffer[i] == PLATFORM_SEP_ALTCHAR) - { - buffer[i] = PLATFORM_SEP_CHAR; - } - } - return mylen; } @@ -414,23 +265,9 @@ char* LibrarySystem::PathFormat(const char* fmt, ...) va_list ap; va_start(ap, fmt); - size_t mylen = vsnprintf(buffer, sizeof(buffer), fmt, ap); + ke::path::FormatVa(buffer, sizeof(buffer), fmt, ap); va_end(ap); - if (mylen >= sizeof(buffer)) - { - mylen = sizeof(buffer) - 1; - buffer[mylen] = '\0'; - } - - for (size_t i = 0; i < mylen; i++) - { - if (buffer[i] == PLATFORM_SEP_ALTCHAR) - { - buffer[i] = PLATFORM_SEP_CHAR; - } - } - return buffer; } @@ -466,14 +303,7 @@ const char* LibrarySystem::GetFileExtension(const char* filename) bool LibrarySystem::CreateFolder(const char* path) { -#if defined PLATFORM_WINDOWS - - return (mkdir(path) != -1); - -#elif defined PLATFORM_POSIX - - return (mkdir(path, 0775) != -1); -#endif + return ke::file::CreateDirectory(path, 0775); } size_t LibrarySystem::GetFileFromPath(char* buffer, size_t maxlength, const char* path) @@ -488,12 +318,12 @@ size_t LibrarySystem::GetFileFromPath(char* buffer, size_t maxlength, const char #endif ) { - return UTIL_Format(buffer, maxlength, "%s", &path[i + 1]); + return ke::SafeSprintf(buffer, maxlength, "%s", &path[i + 1]); } } /* We scanned and found no path separator */ - return UTIL_Format(buffer, maxlength, "%s", path); + return ke::SafeSprintf(buffer, maxlength, "%s", path); } bool LibrarySystem::FileTime(const char* path, FileTimeType type, time_t* pTime) diff --git a/amxmodx/CLibrarySys.h b/amxmodx/CLibrarySys.h index 935cac6c..ae919f9b 100644 --- a/amxmodx/CLibrarySys.h +++ b/amxmodx/CLibrarySys.h @@ -12,7 +12,8 @@ #include "amx.h" // cell #include // Interface (HLSDK) -#include // AutoPtr +#include // AutoPtr +#include #define PLATFORM_WINDOWNS_NAME "windows" #define PLATFORM_LINUX_NAME "linux" @@ -66,15 +67,9 @@ #define PLATFORM_MAX_PATH 260 #if defined PLATFORM_WINDOWS - - typedef HMODULE LibraryHandle; typedef HANDLE DirHandle; - #elif defined PLATFORM_POSIX - - typedef void* LibraryHandle; typedef DIR* DirHandle; - #endif enum FileTimeType @@ -124,8 +119,7 @@ class CLibrary { public: - CLibrary(LibraryHandle me); - ~CLibrary(); + CLibrary(ke::Ref lib); public: @@ -134,7 +128,7 @@ class CLibrary private: - LibraryHandle m_lib; + ke::Ref lib_; }; class LibrarySystem diff --git a/amxmodx/CPlugin.h b/amxmodx/CPlugin.h index 9336acb3..60fb899f 100755 --- a/amxmodx/CPlugin.h +++ b/amxmodx/CPlugin.h @@ -13,8 +13,8 @@ #include "sh_list.h" #include "amx.h" #include "amxxfile.h" -#include -#include +#include +#include // ***************************************************** // class CPluginMngr diff --git a/amxmodx/CTextParsers.cpp b/amxmodx/CTextParsers.cpp index 3d508899..8d384834 100644 --- a/amxmodx/CTextParsers.cpp +++ b/amxmodx/CTextParsers.cpp @@ -137,7 +137,7 @@ SMCError TextParsers::ParseSMCFile(const char *file, states->col = 0; } /*libsys->GetPlatformError(error, sizeof(error));*/ - UTIL_Format(buffer, maxsize, "File could not be opened: %s", error); + ke::SafeSprintf(buffer, maxsize, "File could not be opened: %s", error); return SMCError_StreamOpen; } @@ -146,7 +146,7 @@ SMCError TextParsers::ParseSMCFile(const char *file, fclose(fp); errstr = GetSMCErrorString(result); - UTIL_Format(buffer, maxsize, "%s", errstr != NULL ? errstr : "Unknown error"); + ke::SafeSprintf(buffer, maxsize, "%s", errstr != NULL ? errstr : "Unknown error"); return result; } @@ -197,7 +197,7 @@ SMCError TextParsers::ParseSMCStream(const char *stream, result = ParseStream_SMC(&rs, RawStreamReader, smc_listener, states); const char *errstr = GetSMCErrorString(result); - UTIL_Format(buffer, maxsize, "%s", errstr != NULL ? errstr : "Unknown error"); + ke::SafeSprintf(buffer, maxsize, "%s", errstr != NULL ? errstr : "Unknown error"); return result; } diff --git a/amxmodx/CTextParsers.h b/amxmodx/CTextParsers.h index c05929c1..e3e9985f 100644 --- a/amxmodx/CTextParsers.h +++ b/amxmodx/CTextParsers.h @@ -33,7 +33,7 @@ #define _INCLUDE_SOURCEMOD_TEXTPARSERS_H_ #include -#include +#include /** * @param void * IN: Stream pointer diff --git a/amxmodx/CoreConfig.cpp b/amxmodx/CoreConfig.cpp index 564e6b83..8c9fe9a1 100644 --- a/amxmodx/CoreConfig.cpp +++ b/amxmodx/CoreConfig.cpp @@ -53,8 +53,8 @@ void CoreConfig::ExecuteMainConfig() char path[PLATFORM_MAX_PATH]; char command[PLATFORM_MAX_PATH + sizeof(CommandFormat)]; - UTIL_Format(path, sizeof(path), "%s/%s/%s", g_mod_name.chars(), get_localinfo("amx_configdir", "addons/amxmodx/configs"), MainConfigFile); - UTIL_Format(command, sizeof(command), CommandFormat, path); + ke::SafeSprintf(path, sizeof(path), "%s/%s/%s", g_mod_name.chars(), get_localinfo("amx_configdir", "addons/amxmodx/configs"), MainConfigFile); + ke::SafeSprintf(command, sizeof(command), CommandFormat, path); SERVER_COMMAND(command); } @@ -140,11 +140,11 @@ bool CoreConfig::ExecuteAutoConfig(CPluginMngr::CPlugin *plugin, AutoConfig *con if (config->folder.length()) { - UTIL_Format(file, sizeof(file), "%s/%s%s/%s/%s.cfg", g_mod_name.chars(), configsDir, AutoConfigDir, config->folder.chars(), config->autocfg.chars()); + ke::SafeSprintf(file, sizeof(file), "%s/%s%s/%s/%s.cfg", g_mod_name.chars(), configsDir, AutoConfigDir, config->folder.chars(), config->autocfg.chars()); } else { - UTIL_Format(file, sizeof(file), "%s/%s%s/%s.cfg", g_mod_name.chars(), configsDir, AutoConfigDir, config->autocfg.chars()); + ke::SafeSprintf(file, sizeof(file), "%s/%s%s/%s.cfg", g_mod_name.chars(), configsDir, AutoConfigDir, config->autocfg.chars()); } bool file_exists = g_LibSys.IsPathFile(file); @@ -244,7 +244,7 @@ bool CoreConfig::ExecuteAutoConfig(CPluginMngr::CPlugin *plugin, AutoConfig *con if (file_exists) { char command[PLATFORM_MAX_PATH + sizeof(CommandFormat)]; - UTIL_Format(command, sizeof(command), CommandFormat, file); + ke::SafeSprintf(command, sizeof(command), CommandFormat, file); SERVER_COMMAND(command); } @@ -266,21 +266,21 @@ void CoreConfig::ExecuteMapConfig() if ((mapPrefix = strtok(mapName, "_"))) { - UTIL_Format(cfgPath, sizeof(cfgPath), "%s/%s%s/prefix_%s.cfg", g_mod_name.chars(), configsDir, MapConfigDir, mapPrefix); + ke::SafeSprintf(cfgPath, sizeof(cfgPath), "%s/%s%s/prefix_%s.cfg", g_mod_name.chars(), configsDir, MapConfigDir, mapPrefix); if (g_LibSys.IsPathFile(cfgPath)) { - UTIL_Format(command, sizeof(command), CommandFormat, cfgPath); + ke::SafeSprintf(command, sizeof(command), CommandFormat, cfgPath); SERVER_COMMAND(command); } } strncopy(mapName, STRING(gpGlobals->mapname), sizeof(mapName)); - UTIL_Format(cfgPath, sizeof(cfgPath), "%s/%s%s/%s.cfg", g_mod_name.chars(), configsDir, MapConfigDir, mapName); + ke::SafeSprintf(cfgPath, sizeof(cfgPath), "%s/%s%s/%s.cfg", g_mod_name.chars(), configsDir, MapConfigDir, mapName); if (g_LibSys.IsPathFile(cfgPath)) { - UTIL_Format(command, sizeof(command), CommandFormat, cfgPath); + ke::SafeSprintf(command, sizeof(command), CommandFormat, cfgPath); SERVER_COMMAND(command); } diff --git a/amxmodx/CvarManager.h b/amxmodx/CvarManager.h index a82ef3bf..043caa7f 100644 --- a/amxmodx/CvarManager.h +++ b/amxmodx/CvarManager.h @@ -11,8 +11,8 @@ #define CVARS_H #include "amxmodx.h" -#include -#include +#include +#include #include class CDetour; diff --git a/amxmodx/amxmodx.cpp b/amxmodx/amxmodx.cpp index 5f5213ec..64fec1ef 100755 --- a/amxmodx/amxmodx.cpp +++ b/amxmodx/amxmodx.cpp @@ -4506,7 +4506,7 @@ static cell AMX_NATIVE_CALL AutoExecConfig(AMX *amx, cell *params) } static char newName[PLATFORM_MAX_PATH]; - UTIL_Format(newName, sizeof(newName), "plugin-%s", pluginName); + ke::SafeSprintf(newName, sizeof(newName), "plugin-%s", pluginName); name = newName; } diff --git a/amxmodx/amxmodx.h b/amxmodx/amxmodx.h index e9176dca..c07d2367 100755 --- a/amxmodx/amxmodx.h +++ b/amxmodx/amxmodx.h @@ -36,8 +36,8 @@ #include "CPlugin.h" #include "CLibrarySys.h" #include -#include -#include +#include +#include #include "CMisc.h" #include "CVault.h" #include "CModule.h" @@ -139,8 +139,6 @@ template unsigned int strncopy(D *dest, const S *src, s unsigned int UTIL_GetUTF8CharBytes(const char *stream); unsigned int UTIL_ReplaceAll(char *subject, size_t maxlength, const char *search, const char *replace, bool caseSensitive); char *UTIL_ReplaceEx(char *subject, size_t maxLen, const char *search, size_t searchLen, const char *replace, size_t replaceLen, bool caseSensitive); -char *UTIL_VarArgs(const char *fmt, ...); -size_t UTIL_Format(char *buffer, size_t maxlength, const char *fmt, ...); void UTIL_TrimLeft(char *buffer); void UTIL_TrimRight(char *buffer); diff --git a/amxmodx/amxxlog.cpp b/amxmodx/amxxlog.cpp index fa576a8f..1611ef56 100755 --- a/amxmodx/amxxlog.cpp +++ b/amxmodx/amxxlog.cpp @@ -81,7 +81,7 @@ void CLog::CreateNewFile() while (true) { - UTIL_Format(name, sizeof(name), "%s/L%02d%02d%03d.log", g_log_dir.chars(), curTime->tm_mon + 1, curTime->tm_mday, i); + ke::SafeSprintf(name, sizeof(name), "%s/L%02d%02d%03d.log", g_log_dir.chars(), curTime->tm_mon + 1, curTime->tm_mday, i); build_pathname_r(file, sizeof(file)-1, "%s", name); FILE *pTmpFile = fopen(file, "r"); // open for reading to check whether the file exists @@ -243,7 +243,7 @@ void CLog::LogError(const char *fmt, ...) va_end(arglst); FILE *pF = NULL; - UTIL_Format(name, sizeof(name), "%s/error_%04d%02d%02d.log", g_log_dir.chars(), curTime->tm_year + 1900, curTime->tm_mon + 1, curTime->tm_mday); + ke::SafeSprintf(name, sizeof(name), "%s/error_%04d%02d%02d.log", g_log_dir.chars(), curTime->tm_year + 1900, curTime->tm_mon + 1, curTime->tm_mday); build_pathname_r(file, sizeof(file)-1, "%s", name); pF = fopen(file, "a+"); diff --git a/amxmodx/binlog.h b/amxmodx/binlog.h index b4275a31..6c8e6298 100644 --- a/amxmodx/binlog.h +++ b/amxmodx/binlog.h @@ -12,7 +12,7 @@ #if defined BINLOG_ENABLED -#include +#include #define BINLOG_MAGIC 0x414D424C #define BINLOG_VERSION 0x0300 diff --git a/amxmodx/cvars.cpp b/amxmodx/cvars.cpp index 9c497065..8e272095 100644 --- a/amxmodx/cvars.cpp +++ b/amxmodx/cvars.cpp @@ -240,7 +240,7 @@ static cell AMX_NATIVE_CALL set_cvar_float(AMX *amx, cell *params) if (info) { - UTIL_Format(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]); } @@ -258,7 +258,7 @@ static cell AMX_NATIVE_CALL set_cvar_num(AMX *amx, cell *params) if (info) { - UTIL_Format(CVarTempBuffer, sizeof(CVarTempBuffer) - 1, "%d", value); + ke::SafeSprintf(CVarTempBuffer, sizeof(CVarTempBuffer), "%d", value); CVAR_DIRECTSET(info->var, &CVarTempBuffer[0]); } @@ -444,7 +444,7 @@ static cell AMX_NATIVE_CALL set_pcvar_float(AMX *amx, cell *params) return 0; } - UTIL_Format(CVarTempBuffer, sizeof(CVarTempBuffer) - 1, "%f", amx_ctof(params[2])); + ke::SafeSprintf(CVarTempBuffer, sizeof(CVarTempBuffer), "%f", amx_ctof(params[2])); CVAR_DIRECTSET(ptr, &CVarTempBuffer[0]); return 1; @@ -460,7 +460,7 @@ static cell AMX_NATIVE_CALL set_pcvar_num(AMX *amx, cell *params) return 0; } - UTIL_Format(CVarTempBuffer, sizeof(CVarTempBuffer) - 1, "%d", params[2]); + ke::SafeSprintf(CVarTempBuffer, sizeof(CVarTempBuffer), "%d", params[2]); CVAR_DIRECTSET(ptr, &CVarTempBuffer[0]); return 1; diff --git a/amxmodx/datastructs.cpp b/amxmodx/datastructs.cpp index bb752fe3..cfa2f782 100644 --- a/amxmodx/datastructs.cpp +++ b/amxmodx/datastructs.cpp @@ -9,7 +9,7 @@ #include "amxmodx.h" #include "datastructs.h" -#include +#include NativeHandle ArrayHandles; diff --git a/amxmodx/debugger.cpp b/amxmodx/debugger.cpp index f05eecad..a5406f0c 100755 --- a/amxmodx/debugger.cpp +++ b/amxmodx/debugger.cpp @@ -367,7 +367,7 @@ int Debugger::FormatError(char *buffer, size_t maxLength) //cell *p_cip = NULL; //int amx_err = AMX_ERR_NONE; - size += UTIL_Format(buffer, maxLength, "Run time error %d: %s ", error, gen_err); + size += ke::SafeSprintf(buffer, maxLength, "Run time error %d: %s ", error, gen_err); buffer += size; maxLength -= size; @@ -390,7 +390,7 @@ int Debugger::FormatError(char *buffer, size_t maxLength) else amx_err = AMX_ERR_NOTFOUND;*/ //if (!amx_err) - size += UTIL_Format(buffer, maxLength, "(native \"%s\")", native_name); + size += ke::SafeSprintf(buffer, maxLength, "(native \"%s\")", native_name); } return size; @@ -623,12 +623,12 @@ void Debugger::FmtGenericMsg(AMX *amx, int error, char buffer[], size_t maxLengt if (error == AMX_ERR_EXIT) { - UTIL_Format(buffer, maxLength, "Run time error %d (plugin \"%s\") - %s", error, filename, GenericError(AMX_ERR_EXIT)); + ke::SafeSprintf(buffer, maxLength, "Run time error %d (plugin \"%s\") - %s", error, filename, GenericError(AMX_ERR_EXIT)); } else if (error == AMX_ERR_NATIVE) { amx_GetNative(amx, reinterpret_cast(amx->usertags[UT_NATIVE]), native); - UTIL_Format(buffer, maxLength, "Run time error %d (plugin \"%s\") (native \"%s\") - debug not enabled!", error, filename, native); + ke::SafeSprintf(buffer, maxLength, "Run time error %d (plugin \"%s\") (native \"%s\") - debug not enabled!", error, filename, native); } else { - UTIL_Format(buffer, maxLength, "Run time error %d (plugin \"%s\") - debug not enabled!", error, filename); + ke::SafeSprintf(buffer, maxLength, "Run time error %d (plugin \"%s\") - debug not enabled!", error, filename); } } diff --git a/amxmodx/format.cpp b/amxmodx/format.cpp index 9f3e9ed0..b4a46d10 100644 --- a/amxmodx/format.cpp +++ b/amxmodx/format.cpp @@ -673,7 +673,7 @@ reswitch: if (!def) { static char buf[255]; - UTIL_Format(buf, sizeof(buf) - 1, "ML_NOTFOUND: %s", key); + ke::SafeSprintf(buf, sizeof(buf), "ML_NOTFOUND: %s", key); def = buf; } size_t written = atcprintf(buf_p, llen, def, amx, params, &arg); @@ -708,11 +708,11 @@ reswitch: } int userid = GETPLAYERUSERID(player->pEdict); - UTIL_Format(buffer, sizeof(buffer), "%s<%d><%s><%s>", player->name.chars(), userid, auth, player->team.chars()); + ke::SafeSprintf(buffer, sizeof(buffer), "%s<%d><%s><%s>", player->name.chars(), userid, auth, player->team.chars()); } else { - UTIL_Format(buffer, sizeof(buffer), "Console<0>"); + ke::SafeSprintf(buffer, sizeof(buffer), "Console<0>"); } AddString(&buf_p, llen, buffer, width, prec); diff --git a/amxmodx/libraries.cpp b/amxmodx/libraries.cpp index 9af77a00..b9035e5a 100644 --- a/amxmodx/libraries.cpp +++ b/amxmodx/libraries.cpp @@ -97,7 +97,7 @@ size_t AddLibrariesFromString(const char *name, LibType type, LibSource src, voi char *ptr, *p, s; size_t count = 0; - UTIL_Format(buffer, sizeof(buffer)-1, "%s", name); + ke::SafeSprintf(buffer, sizeof(buffer), "%s", name); ptr = buffer; p = buffer; diff --git a/amxmodx/meta_api.cpp b/amxmodx/meta_api.cpp index 137c40a2..ec19f877 100755 --- a/amxmodx/meta_api.cpp +++ b/amxmodx/meta_api.cpp @@ -226,7 +226,7 @@ void LoadExtraPluginsToPCALM(const char *initialdir) while (!files.empty()) { ke::AString *pString = files.front(); - UTIL_Format(path, sizeof(path)-1, "%s/%s", + ke::SafeSprintf(path, sizeof(path), "%s/%s", initialdir, pString->chars()); g_plugins.CALMFromFile(path); @@ -243,7 +243,7 @@ void LoadExtraPluginsFromDir(const char *initialdir) while (!files.empty()) { ke::AString *pString = files.front(); - UTIL_Format(path, sizeof(path)-1, "%s/%s", + ke::SafeSprintf(path, sizeof(path), "%s/%s", initialdir, pString->chars()); g_plugins.loadPluginsFromFile(path); @@ -332,7 +332,7 @@ const char* get_localinfo_r(const char *name, const char *def, char buffer[], si SET_LOCALINFO((char*)name, (char*)(b = def)); } - UTIL_Format(buffer, maxlength, "%s", b); + ke::SafeSprintf(buffer, maxlength, "%s", b); return buffer; } @@ -425,7 +425,7 @@ int C_Spawn(edict_t *pent) LoadExtraPluginsToPCALM(configs_dir); char temporaryMap[64], *tmap_ptr; - UTIL_Format(temporaryMap, sizeof(temporaryMap), "%s", STRING(gpGlobals->mapname)); + ke::SafeSprintf(temporaryMap, sizeof(temporaryMap), "%s", STRING(gpGlobals->mapname)); prefixed_map_pluginsfile[0] = '\0'; if ((tmap_ptr = strchr(temporaryMap, '_')) != NULL) @@ -433,7 +433,7 @@ int C_Spawn(edict_t *pent) // this map has a prefix *tmap_ptr = '\0'; - UTIL_Format(prefixed_map_pluginsfile, + ke::SafeSprintf(prefixed_map_pluginsfile, sizeof(prefixed_map_pluginsfile), "%s/maps/plugins-%s.ini", configs_dir, @@ -441,7 +441,7 @@ int C_Spawn(edict_t *pent) g_plugins.CALMFromFile(prefixed_map_pluginsfile); } - UTIL_Format(map_pluginsfile_path, + ke::SafeSprintf(map_pluginsfile_path, sizeof(map_pluginsfile_path), "%s/maps/plugins-%s.ini", configs_dir, diff --git a/amxmodx/modules.cpp b/amxmodx/modules.cpp index fd47eac2..62a15566 100755 --- a/amxmodx/modules.cpp +++ b/amxmodx/modules.cpp @@ -670,7 +670,7 @@ char* build_pathname(const char *fmt, ...) { static char string[256]; int b; - int a = b = UTIL_Format(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_start(argptr, fmt); @@ -694,7 +694,7 @@ char* build_pathname(const char *fmt, ...) char *build_pathname_r(char *buffer, size_t maxlen, const char *fmt, ...) { - UTIL_Format(buffer, maxlen, "%s%c", g_mod_name.chars(), PATH_SEP_CHAR); + ke::SafeSprintf(buffer, maxlen, "%s%c", g_mod_name.chars(), PATH_SEP_CHAR); size_t len = strlen(buffer); char *ptr = buffer + len; @@ -817,16 +817,16 @@ bool ConvertModuleName(const char *pathString, char *path) *ptr = '\0'; } - size_t length = UTIL_Format(path, PLATFORM_MAX_PATH, "%s%c%s_amxx", orig_path, PATH_SEP_CHAR, tmpname); + size_t length = ke::SafeSprintf(path, PLATFORM_MAX_PATH, "%s%c%s_amxx", orig_path, PATH_SEP_CHAR, tmpname); #if defined PLATFORM_LINUX # if defined AMD64 || PAWN_CELL_SIZE == 64 length += strncopy(path + length, "_amd64", PLATFORM_MAX_PATH - length); # else - length += UTIL_Format(path + length, PLATFORM_MAX_PATH - length, "_i%c86", iDigit); + length += ke::SafeSprintf(path + length, PLATFORM_MAX_PATH - length, "_i%c86", iDigit); # endif #endif - UTIL_Format(path + length, PLATFORM_MAX_PATH - length, ".%s", PLATFORM_LIB_EXT); + ke::SafeSprintf(path + length, PLATFORM_MAX_PATH - length, ".%s", PLATFORM_LIB_EXT); return true; } diff --git a/amxmodx/msvc12/amxmodx_mm.vcxproj b/amxmodx/msvc12/amxmodx_mm.vcxproj index 7c5d56be..c02bfdef 100644 --- a/amxmodx/msvc12/amxmodx_mm.vcxproj +++ b/amxmodx/msvc12/amxmodx_mm.vcxproj @@ -60,7 +60,7 @@ Disabled - ..\;..\..\public;..\..\public\memtools;..\..\third_party;..\..\third_party\zlib;..\..\third_party\hashing;..\..\public\sdk;..\..\public\amtl\include;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) + ..\;..\..\public;..\..\public\memtools;..\..\third_party;..\..\third_party\zlib;..\..\third_party\hashing;..\..\public\sdk;..\..\public\amtl;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_DEBUG;_WINDOWS;_USRDLL;amxmodx_EXPORTS;PAWN_CELL_SIZE=32;ASM32;JIT;_CRT_SECURE_NO_DEPRECATE;HAVE_STDINT_H;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug @@ -110,7 +110,7 @@ true Speed true - ..\;..\..\public;..\..\public\memtools;..\..\third_party;..\..\third_party\zlib;..\..\third_party\hashing;..\..\third_party;..\..\third_party\hashing;..\..\public\sdk;..\..\public\amtl\include;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) + ..\;..\..\public;..\..\public\memtools;..\..\third_party;..\..\third_party\zlib;..\..\third_party\hashing;..\..\third_party;..\..\third_party\hashing;..\..\public\sdk;..\..\public\amtl;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;NDEBUG;_WINDOWS;_USRDLL;amxmodx_EXPORTS;JIT;ASM32;PAWN_CELL_SIZE=32;HAVE_STDINT_H;%(PreprocessorDefinitions) false true diff --git a/amxmodx/msvc12/ipch/WINCSX-7d4a1d4a/WINCSX-e0702fa2.ipch b/amxmodx/msvc12/ipch/WINCSX-7d4a1d4a/WINCSX-e0702fa2.ipch new file mode 100644 index 00000000..6d0b20bb Binary files /dev/null and b/amxmodx/msvc12/ipch/WINCSX-7d4a1d4a/WINCSX-e0702fa2.ipch differ diff --git a/amxmodx/natives.cpp b/amxmodx/natives.cpp index 87018695..1604dde7 100755 --- a/amxmodx/natives.cpp +++ b/amxmodx/natives.cpp @@ -180,7 +180,7 @@ static cell AMX_NATIVE_CALL log_error(AMX *amx, cell *params) int len; char *err = format_amxstring(amx, params, 2, len); - UTIL_Format(g_errorStr, sizeof(g_errorStr), "%s", err); + ke::SafeSprintf(g_errorStr, sizeof(g_errorStr), "%s", err); g_CurError = params[1]; return 1; diff --git a/amxmodx/natives_handles.h b/amxmodx/natives_handles.h index bd586c00..068b394e 100644 --- a/amxmodx/natives_handles.h +++ b/amxmodx/natives_handles.h @@ -10,7 +10,7 @@ #ifndef _NATIVES_NATIVES_HANDLES_H_ #define _NATIVES_NATIVES_HANDLES_H_ -#include +#include // Note: All handles start at 1. 0 and below are invalid handles. // This way, a plugin that doesn't initialize a vector or diff --git a/amxmodx/newmenus.cpp b/amxmodx/newmenus.cpp index e8e1e52f..899b0d43 100755 --- a/amxmodx/newmenus.cpp +++ b/amxmodx/newmenus.cpp @@ -289,7 +289,7 @@ bool Menu::Display(int player, page_t page) return false; static char buffer[2048]; - int len = UTIL_Format(buffer, sizeof(buffer)-1, "%s", str); + int len = ke::SafeSprintf(buffer, sizeof(buffer), "%s", str); 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 (m_AutoColors) - UTIL_Format(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 - UTIL_Format(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 { if (m_AutoColors) - UTIL_Format(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 - UTIL_Format(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; @@ -446,22 +446,22 @@ const char *Menu::GetTextString(int player, page_t page, int &keys) if (pItem->isBlank) { - UTIL_Format(buffer, sizeof(buffer)-1, "%s\n", pItem->name.chars()); + ke::SafeSprintf(buffer, sizeof(buffer), "%s\n", pItem->name.chars()); } else if (enabled) { if (m_AutoColors) { - UTIL_Format(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 { - UTIL_Format(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 { if (m_AutoColors) { - UTIL_Format(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 { - UTIL_Format(buffer, sizeof(buffer)-1, "#. %s\n", pItem->name.chars()); + ke::SafeSprintf(buffer, sizeof(buffer), "#. %s\n", pItem->name.chars()); } } slots++; @@ -503,15 +503,15 @@ const char *Menu::GetTextString(int player, page_t page, int &keys) keys |= (1< #include "amxmodx.h" -#if ( defined(__linux__) || defined(__APPLE__) ) && !defined _vsnprintf - #define _vsnprintf vsnprintf -#endif - -char *UTIL_VarArgs(const char *fmt, ...) -{ - va_list ap; - static char string[4096]; - - va_start(ap, fmt); - ke::SafeVsprintf(string, sizeof(string), fmt, ap); - va_end(ap); - - return string; -} - int UTIL_ReadFlags(const char* c) { int flags = 0; @@ -351,9 +335,7 @@ void UTIL_FakeClientCommand(edict_t *pEdict, const char *cmd, const char *arg1, g_fakecmd.argv[1] = arg1; g_fakecmd.argv[2] = arg2; // build argument line - UTIL_Format(g_fakecmd.args, 255, "%s %s", arg1, arg2); - // if UTIL_Format reached 255 chars limit, this will make sure there will be no access violation - g_fakecmd.args[255] = 0; + ke::SafeSprintf(g_fakecmd.args, sizeof(g_fakecmd.args), "%s %s", arg1, arg2); } else if (arg1) { // only one argument passed @@ -361,9 +343,7 @@ void UTIL_FakeClientCommand(edict_t *pEdict, const char *cmd, const char *arg1, // store argument g_fakecmd.argv[1] = arg1; // build argument line - UTIL_Format(g_fakecmd.args, 255, "%s", arg1); - // if UTIL_Format reached 255 chars limit, this will make sure there will be no access violation - g_fakecmd.args[255] = 0; + ke::SafeSprintf(g_fakecmd.args, sizeof(g_fakecmd.args), "%s", arg1); } else g_fakecmd.argc = 1; // no argmuents -> only one command @@ -694,16 +674,6 @@ char *UTIL_ReplaceEx(char *subject, size_t maxLen, const char *search, size_t se return NULL; } -size_t UTIL_Format(char *buffer, size_t maxlength, const char *fmt, ...) -{ - va_list ap; - va_start(ap, fmt); - size_t len = ke::SafeVsprintf(buffer, maxlength, fmt, ap); - va_end(ap); - - return len; -} - // From Metamod:Source void UTIL_TrimLeft(char *buffer) { diff --git a/modules/cstrike/cstrike/CstrikeNatives.cpp b/modules/cstrike/cstrike/CstrikeNatives.cpp index a5f72413..ed8aee2d 100644 --- a/modules/cstrike/cstrike/CstrikeNatives.cpp +++ b/modules/cstrike/cstrike/CstrikeNatives.cpp @@ -18,7 +18,8 @@ #include "CstrikeUserMessages.h" #include "CstrikeHLTypeConversion.h" #include -#include +#include +#include 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) { diff --git a/modules/cstrike/cstrike/CstrikePlayer.h b/modules/cstrike/cstrike/CstrikePlayer.h index fa78644e..8fdd34bf 100644 --- a/modules/cstrike/cstrike/CstrikePlayer.h +++ b/modules/cstrike/cstrike/CstrikePlayer.h @@ -17,7 +17,7 @@ #include #include "CstrikeUtils.h" #include "CstrikeHacks.h" -#include +#include extern ke::Vector ModelsUpdateQueue; diff --git a/modules/cstrike/cstrike/msvc12/cstrike.vcxproj b/modules/cstrike/cstrike/msvc12/cstrike.vcxproj index fd2f3fb9..88bb6b77 100644 --- a/modules/cstrike/cstrike/msvc12/cstrike.vcxproj +++ b/modules/cstrike/cstrike/msvc12/cstrike.vcxproj @@ -64,7 +64,7 @@ Disabled - ..\;..\..\..\..\public;..\..\..\..\public\sdk; ..\..\..\..\public\amtl\include;..\..\third_party;..\..\third_party\hashing;..\..\..\..\public\memtools;..\sdk;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) + ..\;..\..\..\..\public;..\..\..\..\public\sdk;..\..\..\..\public\amtl;..\..\third_party;..\..\third_party\hashing;..\..\..\..\public\memtools;..\sdk;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_WINDOWS;_USRDLL;HAVE_STDINT_H;_CRT_SECURE_NO_DEPRECATE;CSTRIKE_EXPORTS;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug @@ -110,7 +110,7 @@ MaxSpeed OnlyExplicitInline - ..\;..\..\..\..\public;..\..\..\..\public\sdk; ..\..\..\..\public\amtl\include;..\..\third_party;..\..\third_party\hashing;..\..\..\..\public\memtools;..\sdk;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) + ..\;..\..\..\..\public;..\..\..\..\public\sdk;..\..\..\..\public\amtl;..\..\third_party;..\..\third_party\hashing;..\..\..\..\public\memtools;..\sdk;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_WINDOWS;_USRDLL;HAVE_STDINT_H;_CRT_SECURE_NO_DEPRECATE;CSTRIKE_EXPORTS;%(PreprocessorDefinitions) true MultiThreaded diff --git a/modules/cstrike/csx/WinCSX/AMBuilder b/modules/cstrike/csx/WinCSX/AMBuilder index 3fdaa468..b2629056 100644 --- a/modules/cstrike/csx/WinCSX/AMBuilder +++ b/modules/cstrike/csx/WinCSX/AMBuilder @@ -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', ] diff --git a/modules/cstrike/csx/WinCSX/WinCSX.cpp b/modules/cstrike/csx/WinCSX/WinCSX.cpp index 16bc22b1..6ff54ff2 100644 --- a/modules/cstrike/csx/WinCSX/WinCSX.cpp +++ b/modules/cstrike/csx/WinCSX/WinCSX.cpp @@ -11,24 +11,7 @@ #include "WinCSX.h" #include #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 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), "%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), "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. diff --git a/modules/cstrike/csx/WinCSX/msvc12/WinCSX.vcxproj b/modules/cstrike/csx/WinCSX/msvc12/WinCSX.vcxproj index 22ea59f4..475d66cd 100644 --- a/modules/cstrike/csx/WinCSX/msvc12/WinCSX.vcxproj +++ b/modules/cstrike/csx/WinCSX/msvc12/WinCSX.vcxproj @@ -52,8 +52,8 @@ Disabled - ..\;..\..\..\..\..\public;..\..\..\..\..\public\sdk; ..\..\..\..\..\public\amtl\include;..\..\third_party;..\..\third_party\hashing;..\resources;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\;..\..\..\..\..\public;..\..\..\..\..\public\sdk;..\..\..\..\..\public\amtl;..\..\third_party;..\..\third_party\hashing;..\resources;%(AdditionalIncludeDirectories) + WIN32;HAVE_STDINT_H;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebug @@ -73,8 +73,8 @@ - ..\;..\..\..\..\..\public;..\..\..\..\..\public\sdk; ..\..\..\..\..\public\amtl\include;..\..\third_party;..\..\third_party\hashing;..\resources;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\;..\..\..\..\..\public;..\..\..\..\..\public\sdk;..\..\..\..\..\public\amtl;..\..\third_party;..\..\third_party\hashing;..\resources;%(AdditionalIncludeDirectories) + WIN32;HAVE_STDINT_H;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) MultiThreaded Use Level3 diff --git a/modules/cstrike/csx/msvc12/csx.vcxproj b/modules/cstrike/csx/msvc12/csx.vcxproj index cacad209..1201408d 100644 --- a/modules/cstrike/csx/msvc12/csx.vcxproj +++ b/modules/cstrike/csx/msvc12/csx.vcxproj @@ -65,7 +65,7 @@ MaxSpeed OnlyExplicitInline - ..\;..\..\..\..\public;..\..\..\..\public\sdk; ..\..\..\..\public\amtl\include;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) + ..\;..\..\..\..\public;..\..\..\..\public\sdk;..\..\..\..\public\amtl;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_WINDOWS;_USRDLL;csx_EXPORTS;JIT;%(PreprocessorDefinitions) true MultiThreaded @@ -107,7 +107,7 @@ Disabled - ..\;..\..\..\..\public;..\..\..\..\public\sdk; ..\..\..\..\public\amtl\include;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) + ..\;..\..\..\..\public;..\..\..\..\public\sdk;..\..\..\..\public\amtl;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_WINDOWS;_USRDLL;csx_EXPORTS;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug diff --git a/modules/dod/dodfun/msvc12/dodfun.vcxproj b/modules/dod/dodfun/msvc12/dodfun.vcxproj index 4a6491cd..185e9234 100644 --- a/modules/dod/dodfun/msvc12/dodfun.vcxproj +++ b/modules/dod/dodfun/msvc12/dodfun.vcxproj @@ -64,7 +64,7 @@ MaxSpeed OnlyExplicitInline - ..\;..\..\..\..\public;..\..\..\..\public\sdk; ..\..\..\..\public\amtl\include;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) + ..\;..\..\..\..\public;..\..\..\..\public\sdk;..\..\..\..\public\amtl;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) dodfun_EXPORTS;%(PreprocessorDefinitions) true MultiThreaded @@ -106,7 +106,7 @@ Disabled - ..\;..\..\..\..\public;..\..\..\..\public\sdk; ..\..\..\..\public\amtl\include;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) + ..\;..\..\..\..\public;..\..\..\..\public\sdk;..\..\..\..\public\amtl;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_WINDOWS;_USRDLL;dodfun_EXPORTS;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug diff --git a/modules/dod/dodx/msvc12/dodx.vcxproj b/modules/dod/dodx/msvc12/dodx.vcxproj index de19087c..2994fcfb 100644 --- a/modules/dod/dodx/msvc12/dodx.vcxproj +++ b/modules/dod/dodx/msvc12/dodx.vcxproj @@ -64,7 +64,7 @@ MaxSpeed OnlyExplicitInline - ..\;..\..\..\..\public;..\..\..\..\public\sdk; ..\..\..\..\public\amtl\include;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) + ..\;..\..\..\..\public;..\..\..\..\public\sdk;..\..\..\..\public\amtl;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) dodx_EXPORTS;%(PreprocessorDefinitions) true MultiThreaded @@ -106,7 +106,7 @@ Disabled - ..\;..\..\..\..\public;..\..\..\..\public\sdk; ..\..\..\..\public\amtl\include;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) + ..\;..\..\..\..\public;..\..\..\..\public\sdk;..\..\..\..\public\amtl;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_WINDOWS;_USRDLL;dodx_EXPORTS;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug diff --git a/modules/engine/engine.cpp b/modules/engine/engine.cpp index 81f4c11d..f0d1c7eb 100644 --- a/modules/engine/engine.cpp +++ b/modules/engine/engine.cpp @@ -945,7 +945,7 @@ static cell AMX_NATIVE_CALL traceresult(AMX *amx, cell *params) // (jghg) static cell AMX_NATIVE_CALL get_string(AMX *amx, cell *params) // (string, returnstring[], length) { - UTIL_Format(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]); } diff --git a/modules/engine/engine.h b/modules/engine/engine.h index 1b5337d5..e46fe7c0 100644 --- a/modules/engine/engine.h +++ b/modules/engine/engine.h @@ -23,9 +23,9 @@ #include "entity.h" #include "gpglobals.h" #include "entity_state.h" -#include -#include -#include "CDetour/detours.h" +#include +#include +#include extern DLL_FUNCTIONS *g_pFunctionTable; extern DLL_FUNCTIONS *g_pFunctionTable_Post; diff --git a/modules/engine/msvc12/engine.vcxproj b/modules/engine/msvc12/engine.vcxproj index 84e647d0..b26cf7bf 100644 --- a/modules/engine/msvc12/engine.vcxproj +++ b/modules/engine/msvc12/engine.vcxproj @@ -54,7 +54,7 @@ Disabled - ..\;..\..\..\public;..\..\..\public\memtools;..\..\..\public\sdk;..\..\..\public\amtl\include;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) + ..\;..\..\..\public;..\..\..\public\memtools;..\..\..\public\sdk;..\..\..\public\amtl;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_WINDOWS;_USRDLL;ENGINE_EXPORTS;HAVE_STDINT_H;%(PreprocessorDefinitions) true EnableFastChecks @@ -78,7 +78,7 @@ - ..\;..\..\..\public;..\..\..\public\sdk; ..\..\..\public\amtl\include;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) + ..\;..\..\..\public;..\..\..\public\memtools;..\..\..\public\sdk;..\..\..\public\amtl;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_WINDOWS;_USRDLL;ENGINE_EXPORTS;HAVE_STDINT_H;%(PreprocessorDefinitions) MultiThreaded 4Bytes diff --git a/modules/fakemeta/fakemeta_amxx.h b/modules/fakemeta/fakemeta_amxx.h index ea0757c7..f559c463 100644 --- a/modules/fakemeta/fakemeta_amxx.h +++ b/modules/fakemeta/fakemeta_amxx.h @@ -23,8 +23,8 @@ #include "forward.h" #include "fm_tr.h" #include "glb.h" -#include -#include +#include +#include #include #include diff --git a/modules/fakemeta/fm_tr.h b/modules/fakemeta/fm_tr.h index e14eb40d..11ee26ba 100644 --- a/modules/fakemeta/fm_tr.h +++ b/modules/fakemeta/fm_tr.h @@ -14,7 +14,7 @@ #ifndef _INCLUDE_TR_H #define _INCLUDE_TR_H -#include +#include extern TraceResult *gfm_tr; diff --git a/modules/fakemeta/forward.h b/modules/fakemeta/forward.h index 26e3b1db..132e9232 100644 --- a/modules/fakemeta/forward.h +++ b/modules/fakemeta/forward.h @@ -14,7 +14,7 @@ #ifndef _INCLUDE_FORWARD_H #define _INCLUDE_FORWARD_H -#include +#include #define ENGFUNC_NUM FM_LAST_DONT_USE_ME // 131 diff --git a/modules/fakemeta/msvc12/fakemeta.vcxproj b/modules/fakemeta/msvc12/fakemeta.vcxproj index 1e611b80..1fbcb363 100644 --- a/modules/fakemeta/msvc12/fakemeta.vcxproj +++ b/modules/fakemeta/msvc12/fakemeta.vcxproj @@ -54,7 +54,7 @@ Disabled - ..\;..\..\..\public;..\..\..\public\sdk;..\..\..\public\amtl\include;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) + ..\;..\..\..\public;..\..\..\public\sdk;..\..\..\public\amtl;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_WINDOWS;_USRDLL;FAKEMETA_EXPORTS;HAVE_STDINT_H;%(PreprocessorDefinitions) true EnableFastChecks @@ -77,7 +77,7 @@ - ..\;..\..\..\public;..\..\..\public\sdk;..\..\..\public\amtl\include;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) + ..\;..\..\..\public;..\..\..\public\sdk;..\..\..\public\amtl;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_WINDOWS;_USRDLL;FAKEMETA_EXPORTS;HAVE_STDINT_H;%(PreprocessorDefinitions) MultiThreaded false diff --git a/modules/fakemeta/pdata_gc.cpp b/modules/fakemeta/pdata_gc.cpp index e61ef5d4..1df45d48 100644 --- a/modules/fakemeta/pdata_gc.cpp +++ b/modules/fakemeta/pdata_gc.cpp @@ -12,7 +12,7 @@ // #include "fakemeta_amxx.h" -#include +#include enum class BaseFieldType { diff --git a/modules/fakemeta/pev.cpp b/modules/fakemeta/pev.cpp index 16f66f68..97579aa4 100644 --- a/modules/fakemeta/pev.cpp +++ b/modules/fakemeta/pev.cpp @@ -299,23 +299,23 @@ static cell AMX_NATIVE_CALL amx_pev(AMX *amx,cell *params) return num; } else if (ValType & Ret_Int) { char temp[32]; - UTIL_Format(temp, sizeof(temp)-1, "%d", rets.i); + ke::SafeSprintf(temp, sizeof(temp), "%d", rets.i); return MF_SetAmxString(amx, params[3], temp, size); } else if (ValType == Ret_Float) { char temp[32]; - UTIL_Format(temp, sizeof(temp)-1, "%f", rets.f); + ke::SafeSprintf(temp, sizeof(temp), "%f", rets.f); return MF_SetAmxString(amx, params[3], temp, size); } else if (ValType == Ret_Vec) { char temp[32]; - UTIL_Format(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); } else if (ValType == Ret_Bytes2) { char temp[32]; - UTIL_Format(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); } else if (ValType == Ret_Bytes4) { char temp[32]; - UTIL_Format(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); } diff --git a/modules/fun/msvc12/fun.vcxproj b/modules/fun/msvc12/fun.vcxproj index 3d4d8fbd..1199eced 100644 --- a/modules/fun/msvc12/fun.vcxproj +++ b/modules/fun/msvc12/fun.vcxproj @@ -65,7 +65,7 @@ MaxSpeed OnlyExplicitInline - ..\;..\..\..\public;..\..\..\public\sdk; ..\..\..\public\amtl\include;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) + ..\;..\..\..\public;..\..\..\public\sdk;..\..\..\public\amtl;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_WINDOWS;_USRDLL;FUN_EXPORTS;%(PreprocessorDefinitions) true MultiThreaded @@ -107,7 +107,7 @@ Disabled - ..\;..\..\..\public;..\..\..\public\sdk; ..\..\..\public\amtl\include;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) + ..\;..\..\..\public;..\..\..\public\sdk;..\..\..\public\amtl;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_WINDOWS;_USRDLL;FUN_EXPORTS;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug diff --git a/modules/geoip/geoip_main.cpp b/modules/geoip/geoip_main.cpp index 7d778db3..3e9370de 100644 --- a/modules/geoip/geoip_main.cpp +++ b/modules/geoip/geoip_main.cpp @@ -192,7 +192,7 @@ bool loadDatabase() // MF_BuildPathname not used because backslash // makes CreateFileMapping failing under windows. - UTIL_Format(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); diff --git a/modules/geoip/geoip_natives.cpp b/modules/geoip/geoip_natives.cpp index 65528f8b..94a3b68f 100644 --- a/modules/geoip/geoip_natives.cpp +++ b/modules/geoip/geoip_natives.cpp @@ -15,8 +15,8 @@ #include "geoip_natives.h" #include "geoip_util.h" -#include -#include +#include +#include // native geoip_code2(const ip[], ccode[3]); // Deprecated. @@ -157,7 +157,7 @@ static cell AMX_NATIVE_CALL amx_geoip_region_code(AMX *amx, cell *params) if (countryCode) { finalLength = length + 1; // + 1 for dash. - UTIL_Format(code, finalLength + 1, "%s-", countryCode); // + EOS. + ke::SafeSprintf(code, finalLength + 1, "%s-", countryCode); // + EOS. const char *pathRegion[] = { "subdivisions", "0", "iso_code", NULL }; // First result. const char *regionCode = lookupString(ip, pathRegion, &length); diff --git a/modules/geoip/geoip_natives.h b/modules/geoip/geoip_natives.h index 06f6d216..0b1ac6de 100644 --- a/modules/geoip/geoip_natives.h +++ b/modules/geoip/geoip_natives.h @@ -14,8 +14,8 @@ #ifndef _INCLUDE_GEOIPNATIVES_H #define _INCLUDE_GEOIPNATIVES_H -#include -#include +#include +#include extern MMDB_s HandleDB; extern ke::Vector LangList; diff --git a/modules/geoip/msvc12/geoip.vcxproj b/modules/geoip/msvc12/geoip.vcxproj index cf2d7be6..c9ac7869 100644 --- a/modules/geoip/msvc12/geoip.vcxproj +++ b/modules/geoip/msvc12/geoip.vcxproj @@ -54,7 +54,7 @@ Disabled - ..\;..\sdk;..\..\..\public;..\..\..\public\amtl\include;..\..\..\third_party\libmaxminddb;..\..\third_party\hashing;..\..\..\public\sdk;..\GeoIP2;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) + ..\;..\sdk;..\..\..\public;..\..\..\public\amtl;..\..\..\third_party\libmaxminddb;..\..\third_party\hashing;..\..\..\public\sdk;..\GeoIP2;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_WINDOWS;_USRDLL;GEOIP_EXPORTS;HAVE_STDINT_H;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) true EnableFastChecks @@ -78,7 +78,7 @@ - ..\;..\sdk;..\..\..\public;..\..\..\public\amtl\include;..\..\..\third_party\libmaxminddb;..\..\third_party\hashing;..\..\..\public\sdk;..\GeoIP2;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) + ..\;..\sdk;..\..\..\public;..\..\..\public\amtl;..\..\..\third_party\libmaxminddb;..\..\third_party\hashing;..\..\..\public\sdk;..\GeoIP2;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_WINDOWS;_USRDLL;GEOIP_EXPORTS;HAVE_STDINT_H;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) MultiThreaded false diff --git a/modules/hamsandwich/DataHandler.cpp b/modules/hamsandwich/DataHandler.cpp index f99135c3..b212c7a8 100644 --- a/modules/hamsandwich/DataHandler.cpp +++ b/modules/hamsandwich/DataHandler.cpp @@ -13,8 +13,8 @@ #include "amxxmodule.h" -#include -#include +#include +#include #include #include "DataHandler.h" diff --git a/modules/hamsandwich/DataHandler.h b/modules/hamsandwich/DataHandler.h index 3677ac1a..f49ca085 100644 --- a/modules/hamsandwich/DataHandler.h +++ b/modules/hamsandwich/DataHandler.h @@ -15,8 +15,8 @@ #define RETURNHANDLER_H #include "ham_utils.h" -#include -#include +#include +#include #include enum diff --git a/modules/hamsandwich/Trampolines.h b/modules/hamsandwich/Trampolines.h index bda725d0..954e513e 100644 --- a/modules/hamsandwich/Trampolines.h +++ b/modules/hamsandwich/Trampolines.h @@ -41,7 +41,7 @@ #include // memalign #include -#include +#include namespace Trampolines { diff --git a/modules/hamsandwich/amxx_api.cpp b/modules/hamsandwich/amxx_api.cpp index 9deb67e3..d48a05a7 100644 --- a/modules/hamsandwich/amxx_api.cpp +++ b/modules/hamsandwich/amxx_api.cpp @@ -15,7 +15,7 @@ #include #include "NEW_Util.h" -#include +#include #include "forward.h" #include "hook.h" #include "ham_const.h" diff --git a/modules/hamsandwich/call_funcs.cpp b/modules/hamsandwich/call_funcs.cpp index 23ad8e87..8b5494fc 100644 --- a/modules/hamsandwich/call_funcs.cpp +++ b/modules/hamsandwich/call_funcs.cpp @@ -18,8 +18,8 @@ #include "hooklist.h" #include "forward.h" #include "hook.h" -#include -#include +#include +#include extern ke::Vector hooks[HAM_LAST_ENTRY_DONT_USE_ME_LOL]; diff --git a/modules/hamsandwich/config_parser.cpp b/modules/hamsandwich/config_parser.cpp index 7de22365..42ef7e1a 100644 --- a/modules/hamsandwich/config_parser.cpp +++ b/modules/hamsandwich/config_parser.cpp @@ -16,6 +16,7 @@ #include "ham_const.h" #include "hooklist.h" #include "offsets.h" +#include 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), "%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), "%s", data2); *data=old; if (strcmp(dest, CurrentModName)==0) { - UTIL_Format(CurrentModName, sizeof(CurrentModName)-1, "%s", source); + ke::SafeSprintf(CurrentModName, sizeof(CurrentModName), "%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), "%s", MF_GetModname()); if (!fp) { diff --git a/modules/hamsandwich/forward.h b/modules/hamsandwich/forward.h index 6f95b14e..d896d573 100644 --- a/modules/hamsandwich/forward.h +++ b/modules/hamsandwich/forward.h @@ -16,7 +16,7 @@ #ifndef FORWARD_H #define FORWARD_H -#include +#include enum fwdstate { diff --git a/modules/hamsandwich/ham_utils.h b/modules/hamsandwich/ham_utils.h index b161bb53..1222ba9e 100644 --- a/modules/hamsandwich/ham_utils.h +++ b/modules/hamsandwich/ham_utils.h @@ -17,16 +17,17 @@ #include "amxxmodule.h" #include "offsets.h" #include "NEW_Util.h" +#include #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), "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), "Function %s is not configured in hamdata.ini.", hooklist[x].name); \ FailPlugin(amx, x, HAM_FUNC_NOT_CONFIGURED, msg); \ return 0; \ } diff --git a/modules/hamsandwich/hook.h b/modules/hamsandwich/hook.h index 1db43642..1d6993e3 100644 --- a/modules/hamsandwich/hook.h +++ b/modules/hamsandwich/hook.h @@ -16,7 +16,8 @@ #include "forward.h" #include "Trampolines.h" -#include +#include +#include #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() diff --git a/modules/hamsandwich/hook_callbacks.cpp b/modules/hamsandwich/hook_callbacks.cpp index fa396bd9..39d4c333 100644 --- a/modules/hamsandwich/hook_callbacks.cpp +++ b/modules/hamsandwich/hook_callbacks.cpp @@ -19,8 +19,8 @@ #include #include "amxxmodule.h" -#include -#include +#include +#include #include #include "hook.h" diff --git a/modules/hamsandwich/hook_native.cpp b/modules/hamsandwich/hook_native.cpp index 27416828..797fa997 100644 --- a/modules/hamsandwich/hook_native.cpp +++ b/modules/hamsandwich/hook_native.cpp @@ -28,7 +28,7 @@ #include "hooklist.h" #include "ham_utils.h" #include "hook_specialbot.h" -#include +#include OffsetManager Offsets; @@ -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), "%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); diff --git a/modules/hamsandwich/hook_specialbot.h b/modules/hamsandwich/hook_specialbot.h index d1b1d932..6f47c4a4 100644 --- a/modules/hamsandwich/hook_specialbot.h +++ b/modules/hamsandwich/hook_specialbot.h @@ -15,7 +15,7 @@ #define HOOK_SPECIALBOT_H #include "ham_utils.h" -#include +#include #include "forward.h" class CRegisterHamParams diff --git a/modules/hamsandwich/msvc12/hamsandwich.vcxproj b/modules/hamsandwich/msvc12/hamsandwich.vcxproj index 737da5d0..942246f9 100644 --- a/modules/hamsandwich/msvc12/hamsandwich.vcxproj +++ b/modules/hamsandwich/msvc12/hamsandwich.vcxproj @@ -54,7 +54,7 @@ Disabled - ..\;..\..\..\public;..\..\..\public\sdk; ..\..\..\public\amtl\include;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) + ..\;..\..\..\public;..\..\..\public\sdk;..\..\..\public\amtl;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_WINDOWS;_USRDLL;HAMSANDWICH_EXPORTS; HAVE_STDINT_H;%(PreprocessorDefinitions) true EnableFastChecks @@ -81,7 +81,7 @@ - ..\;..\..\..\public;..\..\..\public\sdk; ..\..\..\public\amtl\include;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) + ..\;..\..\..\public;..\..\..\public\sdk;..\..\..\public\amtl;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_WINDOWS;_USRDLL;HAMSANDWICH_EXPORTS; HAVE_STDINT_H;%(PreprocessorDefinitions) MultiThreaded false diff --git a/modules/hamsandwich/srvcmd.cpp b/modules/hamsandwich/srvcmd.cpp index 303ce169..72ded5b1 100644 --- a/modules/hamsandwich/srvcmd.cpp +++ b/modules/hamsandwich/srvcmd.cpp @@ -13,7 +13,7 @@ #include "amxxmodule.h" #include -#include +#include #include "ham_const.h" #include "hooklist.h" #include "offsets.h" diff --git a/modules/mysqlx/handles.cpp b/modules/mysqlx/handles.cpp index db251638..8663d7b6 100644 --- a/modules/mysqlx/handles.cpp +++ b/modules/mysqlx/handles.cpp @@ -13,7 +13,7 @@ #include #include -#include +#include #include "mysql2_header.h" struct QHandle diff --git a/modules/mysqlx/msvc12/mysqlx.vcxproj b/modules/mysqlx/msvc12/mysqlx.vcxproj index 5b704498..d851ffda 100644 --- a/modules/mysqlx/msvc12/mysqlx.vcxproj +++ b/modules/mysqlx/msvc12/mysqlx.vcxproj @@ -54,7 +54,7 @@ Disabled - ..\;..\..\..\public;..\..\..\public\sdk; ..\..\..\public\amtl\include;..\..\third_party;..\..\third_party\hashing;..\..\..\..\mysql-5.0\include;..\mysql;..\sdk;..\thread;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\public;$(MYSQL5)\include;%(AdditionalIncludeDirectories) + ..\;..\..\..\public;..\..\..\public\sdk;..\..\..\public\amtl;..\..\third_party;..\..\third_party\hashing;..\..\..\..\mysql-5.0\include;..\mysql;..\sdk;..\thread;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\public;$(MYSQL5)\include;%(AdditionalIncludeDirectories) WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_ITERATOR_DEBUG_LEVEL=0;_DEBUG;_WINDOWS;_USRDLL;MYSQL2_EXPORTS;SM_DEFAULT_THREADER;HAVE_STDINT_H;%(PreprocessorDefinitions) true EnableFastChecks @@ -78,7 +78,7 @@ - ..\;..\..\..\public;..\..\..\public\sdk; ..\..\..\public\amtl\include;..\..\third_party;..\..\third_party\hashing;..\..\..\..\mysql-5.0\include;..\mysql;..\sdk;..\thread;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\public;$(MYSQL5)\include;%(AdditionalIncludeDirectories) + ..\;..\..\..\public;..\..\..\public\sdk;..\..\..\public\amtl;..\..\third_party;..\..\third_party\hashing;..\..\..\..\mysql-5.0\include;..\mysql;..\sdk;..\thread;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\public;$(MYSQL5)\include;%(AdditionalIncludeDirectories) WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_ITERATOR_DEBUG_LEVEL=0;NDEBUG;_WINDOWS;_USRDLL;MYSQL2_EXPORTS;SM_DEFAULT_THREADER;HAVE_STDINT_H;%(PreprocessorDefinitions) MultiThreaded false diff --git a/modules/mysqlx/mysql/MysqlDriver.cpp b/modules/mysqlx/mysql/MysqlDriver.cpp index 8afa7125..01974835 100644 --- a/modules/mysqlx/mysql/MysqlDriver.cpp +++ b/modules/mysqlx/mysql/MysqlDriver.cpp @@ -14,6 +14,7 @@ #include "amxxmodule.h" #include "MysqlDriver.h" #include "MysqlDatabase.h" +#include using namespace SourceMod; @@ -47,7 +48,7 @@ IDatabase *MysqlDriver::_Connect(DatabaseInfo *info, int *errcode, char *error, *errcode = -1; if (error && maxlength) { - UTIL_Format(error, maxlength, "Initialization failed"); + ke::SafeSprintf(error, maxlength, "Initialization failed"); } return NULL; } @@ -89,7 +90,7 @@ IDatabase *MysqlDriver::_Connect(DatabaseInfo *info, int *errcode, char *error, } if (error && maxlength) { - UTIL_Format(error, maxlength, "%s", mysql_error(mysql)); + ke::SafeSprintf(error, maxlength, "%s", mysql_error(mysql)); } return NULL; } diff --git a/modules/mysqlx/mysql/MysqlQuery.cpp b/modules/mysqlx/mysql/MysqlQuery.cpp index f9216ffd..8255a3e5 100644 --- a/modules/mysqlx/mysql/MysqlQuery.cpp +++ b/modules/mysqlx/mysql/MysqlQuery.cpp @@ -15,6 +15,7 @@ #include "MysqlQuery.h" #include "MysqlDatabase.h" #include "MysqlResultSet.h" +#include using namespace SourceMod; @@ -90,7 +91,7 @@ bool MysqlQuery::ExecuteR(QueryInfo *info, char *error, size_t maxlength) info->rs = NULL; if (error && maxlength) { - UTIL_Format(error, maxlength, "%s", mysql_error(m_pDatabase->m_pMysql)); + ke::SafeSprintf(error, maxlength, "%s", mysql_error(m_pDatabase->m_pMysql)); } } else diff --git a/modules/mysqlx/thread/BaseWorker.cpp b/modules/mysqlx/thread/BaseWorker.cpp index e8e9e474..c0f19517 100644 --- a/modules/mysqlx/thread/BaseWorker.cpp +++ b/modules/mysqlx/thread/BaseWorker.cpp @@ -8,7 +8,7 @@ // https://alliedmods.net/amxmodx-license #include "BaseWorker.h" -#include +#include BaseWorker::BaseWorker() : m_perFrame(SM_DEFAULT_THREADS_PER_FRAME), diff --git a/modules/mysqlx/thread/BaseWorker.h b/modules/mysqlx/thread/BaseWorker.h index 1dcfbc2a..eec29466 100644 --- a/modules/mysqlx/thread/BaseWorker.h +++ b/modules/mysqlx/thread/BaseWorker.h @@ -10,7 +10,7 @@ #ifndef _INCLUDE_SOURCEMOD_BASEWORKER_H #define _INCLUDE_SOURCEMOD_BASEWORKER_H -#include +#include #include "ThreadSupport.h" #define SM_DEFAULT_THREADS_PER_FRAME 1 diff --git a/modules/mysqlx/threading.h b/modules/mysqlx/threading.h index ef99a30a..9bc93ab7 100644 --- a/modules/mysqlx/threading.h +++ b/modules/mysqlx/threading.h @@ -16,7 +16,7 @@ #include "IThreader.h" #include "ISQLDriver.h" -#include +#include #include struct QueuedResultInfo diff --git a/modules/ns/AllocString.h b/modules/ns/AllocString.h index db633fe8..30d2b916 100644 --- a/modules/ns/AllocString.h +++ b/modules/ns/AllocString.h @@ -23,8 +23,8 @@ #ifndef ALLOCSTRING_H #define ALLOCSTRING_H -#include -#include +#include +#include class StringManager { diff --git a/modules/ns/GameManager.h b/modules/ns/GameManager.h index 5e693419..eefa5b25 100644 --- a/modules/ns/GameManager.h +++ b/modules/ns/GameManager.h @@ -17,7 +17,7 @@ #ifndef GAMEMANAGER_H #define GAMEMANAGER_H -#include +#include class GameManager { diff --git a/modules/ns/Hash.h b/modules/ns/Hash.h index a09f11b0..7181d458 100644 --- a/modules/ns/Hash.h +++ b/modules/ns/Hash.h @@ -14,8 +14,8 @@ #ifndef _HASH_H_ #define _HASH_H_ -#include -#include +#include +#include // Just a very simple hash map, no iteration or anything of the like (not needed) diff --git a/modules/ns/LocationManager.h b/modules/ns/LocationManager.h index 0c2c056a..3bd7ef71 100644 --- a/modules/ns/LocationManager.h +++ b/modules/ns/LocationManager.h @@ -14,7 +14,7 @@ #ifndef LOCATIONMANAGER_H #define LOCATIONMANAGER_H -#include +#include #include "GameManager.h" #include "TitleManager.h" diff --git a/modules/ns/ParticleManager.cpp b/modules/ns/ParticleManager.cpp index c327e269..fa8885f3 100644 --- a/modules/ns/ParticleManager.cpp +++ b/modules/ns/ParticleManager.cpp @@ -26,7 +26,7 @@ void ParticleManager::ReadFile(void) char FileName[256]; - UTIL_Format(FileName, sizeof(FileName)-1, "%s/ns.ps", MF_GetModname()); + ke::SafeSprintf(FileName, sizeof(FileName), "%s/ns.ps", MF_GetModname()); FILE *fp=fopen(FileName,"r"); if (!fp) diff --git a/modules/ns/ParticleManager.h b/modules/ns/ParticleManager.h index 239548ee..4f11fb09 100644 --- a/modules/ns/ParticleManager.h +++ b/modules/ns/ParticleManager.h @@ -14,8 +14,8 @@ #ifndef PARTICLEMANAGER_H #define PARTICLEMANAGER_H -#include -#include +#include +#include typedef struct psystem_s { diff --git a/modules/ns/SpawnManager.h b/modules/ns/SpawnManager.h index 4796d5b6..021ec0ab 100644 --- a/modules/ns/SpawnManager.h +++ b/modules/ns/SpawnManager.h @@ -14,7 +14,7 @@ #ifndef SPAWNMANAGER_H #define SPAWNMANAGER_H -#include +#include typedef struct spawndata_s { diff --git a/modules/ns/TitleManager.cpp b/modules/ns/TitleManager.cpp index 28c65a00..33348dbb 100644 --- a/modules/ns/TitleManager.cpp +++ b/modules/ns/TitleManager.cpp @@ -27,7 +27,7 @@ void TitleManager::LoadTitles(void) char FileName[128]; - UTIL_Format(FileName, sizeof(FileName)-1, "%s/titles.txt", MF_GetModname()); + ke::SafeSprintf(FileName, sizeof(FileName), "%s/titles.txt", MF_GetModname()); FILE *fp=fopen(FileName,"r"); diff --git a/modules/ns/TitleManager.h b/modules/ns/TitleManager.h index 800259a4..b79aec8b 100644 --- a/modules/ns/TitleManager.h +++ b/modules/ns/TitleManager.h @@ -18,7 +18,7 @@ #include #include -#include +#include #include "Hash.h" diff --git a/modules/ns/amxxapi.cpp b/modules/ns/amxxapi.cpp index b19e24bc..043fc7ce 100644 --- a/modules/ns/amxxapi.cpp +++ b/modules/ns/amxxapi.cpp @@ -23,6 +23,7 @@ #include "ParticleManager.h" #include "AllocString.h" +#include extern int gmsgHudText2; extern BOOL iscombat; @@ -91,9 +92,9 @@ void OnAmxxAttach() char FileName[256]; DLHANDLE DLLBase; #ifdef __linux__ - UTIL_Format(FileName, sizeof(FileName), "%s/dlls/ns_i386.so", MF_GetModname()); + ke::SafeSprintf(FileName, sizeof(FileName), "%s/dlls/ns_i386.so", MF_GetModname()); #else - UTIL_Format(FileName, sizeof(FileName), "%s\\dlls\\ns.dll", MF_GetModname()); + ke::SafeSprintf(FileName, sizeof(FileName), "%s\\dlls\\ns.dll", MF_GetModname()); #endif DLLBase = DLOPEN(FileName); diff --git a/modules/ns/msvc12/ns.vcxproj b/modules/ns/msvc12/ns.vcxproj index 7f741586..b2f08e94 100644 --- a/modules/ns/msvc12/ns.vcxproj +++ b/modules/ns/msvc12/ns.vcxproj @@ -65,7 +65,7 @@ MaxSpeed OnlyExplicitInline - ..\;..\..\..\public;..\..\..\public\sdk; ..\..\..\public\amtl\include;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) + ..\;..\..\..\public;..\..\..\public\sdk;..\..\..\public\amtl;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) HAVE_STDINT_H;WIN32;NDEBUG;_WINDOWS;_USRDLL;ns_amxx_EXPORTS;%(PreprocessorDefinitions) true MultiThreaded @@ -105,7 +105,7 @@ Disabled - ..\;..\..\..\public;..\..\..\public\sdk; ..\..\..\public\amtl\include;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) + ..\;..\..\..\public;..\..\..\public\sdk;..\..\..\public\amtl;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) HAVE_STDINT_H;WIN32;_DEBUG;_WINDOWS;_USRDLL;ns_amxx_EXPORTS;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug diff --git a/modules/ns/natives/particles.cpp b/modules/ns/natives/particles.cpp index cdf8dccf..c0ebb787 100644 --- a/modules/ns/natives/particles.cpp +++ b/modules/ns/natives/particles.cpp @@ -17,8 +17,8 @@ #include "utilfunctions.h" #include "NEW_Util.h" #include "ParticleManager.h" -#include -#include +#include +#include #define KVI(__KEY) PSKeyValueI(__KEY,amx,params) #define KVF(__KEY) PSKeyValueF(__KEY,amx,params) @@ -48,7 +48,7 @@ cell PSKeyValueI(const char *name, AMX *amx, cell *params) char StrData[1024]; - UTIL_Format(StrData, sizeof(StrData)-1, "%d", params[2]); + ke::SafeSprintf(StrData, sizeof(StrData), "%d", params[2]); kvd.szClassName=const_cast(STRING(reinterpret_cast(params[1])->v.classname)); kvd.szKeyName=name; @@ -71,7 +71,7 @@ cell PSKeyValueF(const char *name, AMX *amx, cell *params) char StrData[1024]; - UTIL_Format(StrData, sizeof(StrData)-1, "%f", amx_ctof2(params[2])); + ke::SafeSprintf(StrData, sizeof(StrData), "%f", amx_ctof2(params[2])); kvd.szClassName=const_cast(STRING(reinterpret_cast(params[1])->v.classname)); kvd.szKeyName=name; diff --git a/modules/nvault/Journal.h b/modules/nvault/Journal.h index bf51c1a1..d6555acd 100644 --- a/modules/nvault/Journal.h +++ b/modules/nvault/Journal.h @@ -15,9 +15,9 @@ #define _INCLUDE_JOURNAL_H #include "Binary.h" -#include +#include #include -#include +#include enum JOp { diff --git a/modules/nvault/NVault.cpp b/modules/nvault/NVault.cpp index 6ad1d75d..4da289f6 100644 --- a/modules/nvault/NVault.cpp +++ b/modules/nvault/NVault.cpp @@ -15,7 +15,7 @@ #include "amxxmodule.h" #include "NVault.h" #include "Binary.h" -#include +#include /** * :TODO: This beast calls strcpy()/new() way too much by creating new strings on the stack. @@ -367,7 +367,7 @@ bool NVault::GetValue(const char *key, time_t &stamp, char buffer[], size_t len) } stamp = result.stamp; - UTIL_Format(buffer, len, "%s", result.value.chars()); + ke::SafeSprintf(buffer, len, "%s", result.value.chars()); return true; } diff --git a/modules/nvault/NVault.h b/modules/nvault/NVault.h index 09958670..06e1d405 100644 --- a/modules/nvault/NVault.h +++ b/modules/nvault/NVault.h @@ -14,7 +14,7 @@ #ifndef _INCLUDE_NVAULT_H #define _INCLUDE_NVAULT_H -#include +#include #include #include "IVault.h" #include "Journal.h" diff --git a/modules/nvault/amxxapi.h b/modules/nvault/amxxapi.h index f00f1319..3039350d 100644 --- a/modules/nvault/amxxapi.h +++ b/modules/nvault/amxxapi.h @@ -15,8 +15,8 @@ #define _INCLUDE_AMXXAPI_H #include "amxxmodule.h" -#include -#include +#include +#include #include extern AMX_NATIVE_INFO nVault_natives[]; diff --git a/modules/nvault/msvc12/nvault.vcxproj b/modules/nvault/msvc12/nvault.vcxproj index 3cde39d4..9b11484f 100644 --- a/modules/nvault/msvc12/nvault.vcxproj +++ b/modules/nvault/msvc12/nvault.vcxproj @@ -54,7 +54,7 @@ Disabled - ..\;..\..\..\public;..\..\..\public\sdk; ..\..\..\public\amtl\include;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) + ..\;..\..\..\public;..\..\..\public\sdk;..\..\..\public\amtl;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_WINDOWS;_USRDLL;NVAULT_EXPORTS;HAVE_STDINT_H;%(PreprocessorDefinitions) true Sync @@ -79,7 +79,7 @@ - ..\;..\..\..\public;..\..\..\public\sdk; ..\..\..\public\amtl\include;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) + ..\;..\..\..\public;..\..\..\public\sdk;..\..\..\public\amtl;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_WINDOWS;_USRDLL;NVAULT_EXPORTS;HAVE_STDINT_H;%(PreprocessorDefinitions) MultiThreaded 4Bytes diff --git a/modules/regex/CRegEx.h b/modules/regex/CRegEx.h index efd0d91f..593b6474 100644 --- a/modules/regex/CRegEx.h +++ b/modules/regex/CRegEx.h @@ -14,8 +14,8 @@ #ifndef _INCLUDE_CREGEX_H #define _INCLUDE_CREGEX_H -#include -#include +#include +#include /** * Maximum number of sub-patterns, here 50 (this should be a multiple of 3). diff --git a/modules/regex/module.cpp b/modules/regex/module.cpp index b62c4d4d..f1087cd1 100644 --- a/modules/regex/module.cpp +++ b/modules/regex/module.cpp @@ -14,8 +14,8 @@ #include #include "pcre.h" #include "amxxmodule.h" -#include -#include +#include +#include #include "CRegEx.h" #include "utils.h" diff --git a/modules/regex/msvc12/regex.vcxproj b/modules/regex/msvc12/regex.vcxproj index 86105fe2..c003b909 100644 --- a/modules/regex/msvc12/regex.vcxproj +++ b/modules/regex/msvc12/regex.vcxproj @@ -54,7 +54,7 @@ Disabled - ..\;..\..\..\public;..\..\..\public\sdk; ..\..\..\public\amtl\include;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) + ..\;..\..\..\public;..\..\..\public\sdk;..\..\..\public\amtl;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_WINDOWS;_USRDLL;REGEX_EXPORTS;HAVE_STDINT_H;PCRE_STATIC;%(PreprocessorDefinitions) true EnableFastChecks @@ -78,7 +78,7 @@ - ..\;..\..\..\public;..\..\..\public\sdk; ..\..\..\public\amtl\include;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) + ..\;..\..\..\public;..\..\..\public\sdk;..\..\..\public\amtl;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_WINDOWS;_USRDLL;REGEX_EXPORTS;HAVE_STDINT_H;PCRE_STATIC;%(PreprocessorDefinitions) MultiThreaded false diff --git a/modules/sockets/msvc12/sockets.vcxproj b/modules/sockets/msvc12/sockets.vcxproj index 5205ba13..0524e6d4 100644 --- a/modules/sockets/msvc12/sockets.vcxproj +++ b/modules/sockets/msvc12/sockets.vcxproj @@ -54,7 +54,7 @@ Disabled - ..\;..\..\..\public;..\..\..\public\sdk; ..\..\..\public\amtl\include;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) + ..\;..\..\..\public;..\..\..\public\sdk;..\..\..\public\amtl;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_WINDOWS;_USRDLL;SOCKETS_EXPORTS;%(PreprocessorDefinitions) true EnableFastChecks @@ -78,7 +78,7 @@ - ..\;..\..\..\public;..\..\..\public\sdk; ..\..\..\public\amtl\include;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) + ..\;..\..\..\public;..\..\..\public\sdk;..\..\..\public\amtl;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_WINDOWS;_USRDLL;SOCKETS_EXPORTS;%(PreprocessorDefinitions) MultiThreaded false diff --git a/modules/sqlite/handles.cpp b/modules/sqlite/handles.cpp index 0f02d379..b0dd5df2 100644 --- a/modules/sqlite/handles.cpp +++ b/modules/sqlite/handles.cpp @@ -13,7 +13,7 @@ #include #include -#include +#include #include "sqlite_header.h" struct QHandle diff --git a/modules/sqlite/msvc12/sqlite.vcxproj b/modules/sqlite/msvc12/sqlite.vcxproj index 2f62fbc7..0184e732 100644 --- a/modules/sqlite/msvc12/sqlite.vcxproj +++ b/modules/sqlite/msvc12/sqlite.vcxproj @@ -55,7 +55,7 @@ /D "NO_TCL" %(AdditionalOptions) Disabled - ..\;..\..\..\public;..\..\..\public\sdk; ..\..\..\public\amtl\include;..\..\third_party;..\..\third_party\hashing;..\..\..\third_party\sqlite;..\sqlitepp;..\thread;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\public;%(AdditionalIncludeDirectories) + ..\;..\..\..\public;..\..\..\public\sdk;..\..\..\public\amtl;..\..\third_party;..\..\third_party\hashing;..\..\..\third_party\sqlite;..\sqlitepp;..\thread;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\public;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_WINDOWS;_USRDLL;sqlite_EXPORTS;SM_DEFAULT_THREADER;HAVE_STDINT_H;%(PreprocessorDefinitions) true EnableFastChecks @@ -85,7 +85,7 @@ MaxSpeed OnlyExplicitInline true - ..\;..\..\..\public;..\..\..\public\sdk; ..\..\..\public\amtl\include;..\..\third_party;..\..\third_party\hashing;..\..\..\third_party\sqlite;..\sqlitepp;..\thread;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\public;%(AdditionalIncludeDirectories) + ..\;..\..\..\public;..\..\..\public\sdk;..\..\..\public\amtl;..\..\third_party;..\..\third_party\hashing;..\..\..\third_party\sqlite;..\sqlitepp;..\thread;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\public;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_WINDOWS;_USRDLL;sqlite_EXPORTS;SM_DEFAULT_THREADER;HAVE_STDINT_H;%(PreprocessorDefinitions) true MultiThreaded diff --git a/modules/sqlite/sqlitepp/SqliteDriver.cpp b/modules/sqlite/sqlitepp/SqliteDriver.cpp index f4d8e74f..530c98cb 100644 --- a/modules/sqlite/sqlitepp/SqliteDriver.cpp +++ b/modules/sqlite/sqlitepp/SqliteDriver.cpp @@ -15,6 +15,7 @@ #include "SqliteHeaders.h" #include "SqliteDriver.h" #include "SqliteDatabase.h" +#include #if defined WIN32 #define WINDOWS_LEAN_AND_MEAN @@ -62,7 +63,7 @@ IDatabase *SqliteDriver::Connect(DatabaseInfo *info, int *errcode, char *error, } if (error) { - UTIL_Format(error, maxlength, "%s", sqlite3_errmsg(pSql)); + ke::SafeSprintf(error, maxlength, "%s", sqlite3_errmsg(pSql)); } sqlite3_close(pSql); return NULL; diff --git a/modules/sqlite/sqlitepp/SqliteQuery.cpp b/modules/sqlite/sqlitepp/SqliteQuery.cpp index d04b7fff..2cf8e030 100644 --- a/modules/sqlite/sqlitepp/SqliteQuery.cpp +++ b/modules/sqlite/sqlitepp/SqliteQuery.cpp @@ -15,6 +15,7 @@ #include "SqliteQuery.h" #include "SqliteDatabase.h" #include "SqliteResultSet.h" +#include using namespace SourceMod; @@ -92,7 +93,7 @@ bool SqliteQuery::ExecuteR(QueryInfo *info, char *error, size_t maxlength) { if (error && maxlength && errmsg) { - UTIL_Format(error, maxlength, "%s", errmsg); + ke::SafeSprintf(error, maxlength, "%s", errmsg); } info->affected_rows = 0; info->errorcode = err; diff --git a/modules/sqlite/threading.cpp b/modules/sqlite/threading.cpp index 989cfdc5..e33f7467 100644 --- a/modules/sqlite/threading.cpp +++ b/modules/sqlite/threading.cpp @@ -14,7 +14,7 @@ #include "amxxmodule.h" #include "sqlite_header.h" #include "threading.h" -#include +#include MainThreader g_Threader; ThreadWorker *g_pWorker = NULL; diff --git a/modules/sqlite/threading.h b/modules/sqlite/threading.h index 7de0cbb2..45aff09e 100644 --- a/modules/sqlite/threading.h +++ b/modules/sqlite/threading.h @@ -16,8 +16,8 @@ #include "IThreader.h" #include "ISQLDriver.h" -#include -#include +#include +#include #include struct QueuedResultInfo diff --git a/modules/tfcx/msvc12/tfcx.vcxproj b/modules/tfcx/msvc12/tfcx.vcxproj index 7f10b3a9..9d9a2044 100644 --- a/modules/tfcx/msvc12/tfcx.vcxproj +++ b/modules/tfcx/msvc12/tfcx.vcxproj @@ -63,7 +63,7 @@ Disabled - ..\;..\..\..\public;..\..\..\public\sdk; ..\..\..\public\amtl\include;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) + ..\;..\..\..\public;..\..\..\public\sdk;..\..\..\public\amtl;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_WINDOWS;_USRDLL;tfcx_EXPORTS;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug @@ -108,7 +108,7 @@ MaxSpeed OnlyExplicitInline - ..\;..\..\..\public;..\..\..\public\sdk; ..\..\..\public\amtl\include;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) + ..\;..\..\..\public;..\..\..\public\sdk;..\..\..\public\amtl;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_WINDOWS;_USRDLL;tfcx_EXPORTS;%(PreprocessorDefinitions) true MultiThreaded diff --git a/modules/ts/tsfun/msvc12/tsfun.vcxproj b/modules/ts/tsfun/msvc12/tsfun.vcxproj index a3537ca2..05972e4d 100644 --- a/modules/ts/tsfun/msvc12/tsfun.vcxproj +++ b/modules/ts/tsfun/msvc12/tsfun.vcxproj @@ -64,7 +64,7 @@ Disabled - ..\;..\..\..\..\public;..\..\..\public\sdk; ..\..\..\public\amtl\include;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) + ..\;..\..\..\..\public;..\..\..\public\sdk;..\..\..\public\amtl;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_WINDOWS;_USRDLL;TSFUN_EXPORTS;%(PreprocessorDefinitions) true EnableFastChecks @@ -109,7 +109,7 @@ MaxSpeed OnlyExplicitInline - ..\;..\..\..\..\public;..\..\..\public\sdk; ..\..\..\public\amtl\include;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) + ..\;..\..\..\..\public;..\..\..\public\sdk;..\..\..\public\amtl;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_WINDOWS;_USRDLL;TSFUN_EXPORTS;%(PreprocessorDefinitions) true MultiThreaded diff --git a/modules/ts/tsx/msvc12/tsx.vcxproj b/modules/ts/tsx/msvc12/tsx.vcxproj index 0411cb69..edc864a4 100644 --- a/modules/ts/tsx/msvc12/tsx.vcxproj +++ b/modules/ts/tsx/msvc12/tsx.vcxproj @@ -63,7 +63,7 @@ Disabled - ..\;..\..\..\..\public;..\..\..\..\public\sdk; ..\..\..\..\public\amtl\include;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) + ..\;..\..\..\..\public;..\..\..\..\public\sdk;..\..\..\..\public\amtl;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_WINDOWS;_USRDLL;tsx_amxx_EXPORTS;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug @@ -108,7 +108,7 @@ MaxSpeed OnlyExplicitInline - ..\;..\..\..\..\public;..\..\..\..\public\sdk; ..\..\..\..\public\amtl\include;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) + ..\;..\..\..\..\public;..\..\..\..\public\sdk;..\..\..\..\public\amtl;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) tsx_amxx_EXPORTS;%(PreprocessorDefinitions) true MultiThreaded diff --git a/public/amtl b/public/amtl index e86b1b41..c35532ce 160000 --- a/public/amtl +++ b/public/amtl @@ -1 +1 @@ -Subproject commit e86b1b4159dcc6ff6e4675fd5ea07d1637d11963 +Subproject commit c35532ced5e7e4f882106857bfae8f3db0fbacf0 diff --git a/public/auto-string.h b/public/auto-string.h index da7aec5e..677667a9 100644 --- a/public/auto-string.h +++ b/public/auto-string.h @@ -22,7 +22,7 @@ #include #include #include -#include +#include namespace ke { diff --git a/public/memtools/MemoryUtils.h b/public/memtools/MemoryUtils.h index 2f22255f..d91fb8a5 100644 --- a/public/memtools/MemoryUtils.h +++ b/public/memtools/MemoryUtils.h @@ -32,7 +32,7 @@ #if defined(__linux__) || defined(__APPLE__) #include - #include + #include #include #endif diff --git a/public/sdk/amxxmodule.cpp b/public/sdk/amxxmodule.cpp index 7528f376..e79c7cff 100644 --- a/public/sdk/amxxmodule.cpp +++ b/public/sdk/amxxmodule.cpp @@ -3134,24 +3134,6 @@ unsigned short FixedUnsigned16( float value, float scale ) } #endif // USE_METAMOD -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; - } -} - template unsigned int strncopy(char *, const char *src, size_t count); template unsigned int strncopy(cell *, const char *src, size_t count); template unsigned int strncopy(cell *, const cell *src, size_t count); diff --git a/public/sdk/amxxmodule.h b/public/sdk/amxxmodule.h index adf081e9..279d4f68 100644 --- a/public/sdk/amxxmodule.h +++ b/public/sdk/amxxmodule.h @@ -2508,7 +2508,6 @@ void Mem_Deallocator(const char *sourceFile, const unsigned int sourceLine, cons #endif //MEMORY_TEST -size_t UTIL_Format(char *buffer, size_t maxlength, const char *fmt, ...); template unsigned int strncopy(D *dest, const S *src, size_t count); #endif // #ifndef __AMXXMODULE_H__ diff --git a/public/sm_namehashset.h b/public/sm_namehashset.h index 34759444..a4558e00 100644 --- a/public/sm_namehashset.h +++ b/public/sm_namehashset.h @@ -29,7 +29,7 @@ * Version: $Id$ */ -#include +#include #ifndef _include_sourcemod_namehashset_h_ #define _include_sourcemod_namehashset_h_ @@ -40,9 +40,9 @@ * @brief Stores a set of uniquely named objects. */ -#include -#include -#include +#include +#include +#include #include "sm_stringhashmap.h" //namespace SourceMod diff --git a/public/sm_stringhashmap.h b/public/sm_stringhashmap.h index 755eb568..ee5533ff 100644 --- a/public/sm_stringhashmap.h +++ b/public/sm_stringhashmap.h @@ -44,10 +44,10 @@ * NameHashSet instead. */ -#include -#include -#include -#include +#include +#include +#include +#include #include //namespace SourceMod