Merge pull request #296 from Arkshine/feature/update-to-latest-amtl

Update to latest AMTL
This commit is contained in:
Vincent Herbet 2015-10-05 19:49:10 +02:00
commit fd0f6cc429
109 changed files with 311 additions and 546 deletions

View File

@ -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')]

View File

@ -12,7 +12,6 @@
#include <FileSystem.h> // IFileSystem, FileSystemSeek_t, FileHandle_t (HLSDK)
#include <stdio.h> // FILE*
#include <am-cxx.h> // 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<size_t>(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<size_t>(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<FileSystemSeek_t>(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;

View File

@ -12,9 +12,9 @@
#include <IGameConfigs.h>
#include "CLibrarySys.h"
#include <am-vector.h>
#include <am-string.h>
#include <am-refcounting.h>
#include <amtl/am-vector.h>
#include <amtl/am-string.h>
#include <amtl/am-refcounting.h>
#include <sm_stringhashmap.h>
#include <sm_namehashset.h>

View File

@ -9,6 +9,9 @@
#include "CLibrarySys.h"
#include <amxmodx.h>
#include <amtl/os/am-fsutil.h>
#include <amtl/os/am-path.h>
#include <amtl/os/am-system-errors.h>
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<ke::SharedLib> 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<ke::SharedLib> 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)

View File

@ -12,7 +12,8 @@
#include "amx.h" // cell
#include <interface.h> // Interface (HLSDK)
#include <am-utility.h> // AutoPtr
#include <amtl/am-utility.h> // AutoPtr
#include <amtl/os/am-shared-library.h>
#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<ke::SharedLib> lib);
public:
@ -134,7 +128,7 @@ class CLibrary
private:
LibraryHandle m_lib;
ke::Ref<ke::SharedLib> lib_;
};
class LibrarySystem

View File

@ -13,8 +13,8 @@
#include "sh_list.h"
#include "amx.h"
#include "amxxfile.h"
#include <am-string.h>
#include <am-vector.h>
#include <amtl/am-string.h>
#include <amtl/am-vector.h>
// *****************************************************
// class CPluginMngr

View File

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

View File

@ -33,7 +33,7 @@
#define _INCLUDE_SOURCEMOD_TEXTPARSERS_H_
#include <ITextParsers.h>
#include <am-vector.h>
#include <amtl/am-vector.h>
/**
* @param void * IN: Stream pointer

View File

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

View File

@ -11,8 +11,8 @@
#define CVARS_H
#include "amxmodx.h"
#include <am-vector.h>
#include <am-inlinelist.h>
#include <amtl/am-vector.h>
#include <amtl/am-inlinelist.h>
#include <sm_namehashset.h>
class CDetour;

View File

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

View File

@ -36,8 +36,8 @@
#include "CPlugin.h"
#include "CLibrarySys.h"
#include <auto-string.h>
#include <am-string.h>
#include <am-vector.h>
#include <amtl/am-string.h>
#include <amtl/am-vector.h>
#include "CMisc.h"
#include "CVault.h"
#include "CModule.h"
@ -139,8 +139,6 @@ template <typename D, typename S> 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);

View File

@ -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+");

View File

@ -12,7 +12,7 @@
#if defined BINLOG_ENABLED
#include <am-string.h>
#include <amtl/am-string.h>
#define BINLOG_MAGIC 0x414D424C
#define BINLOG_VERSION 0x0300

View File

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

View File

@ -9,7 +9,7 @@
#include "amxmodx.h"
#include "datastructs.h"
#include <am-utility.h>
#include <amtl/am-utility.h>
NativeHandle<CellArray> ArrayHandles;

View File

@ -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<long>(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);
}
}

View File

@ -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><Console><Console>");
ke::SafeSprintf(buffer, sizeof(buffer), "Console<0><Console><Console>");
}
AddString(&buf_p, llen, buffer, width, prec);

View File

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

View File

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

View File

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

View File

@ -60,7 +60,7 @@
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\;..\..\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)</AdditionalIncludeDirectories>
<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)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>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)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
@ -110,7 +110,7 @@
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>..\;..\..\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)</AdditionalIncludeDirectories>
<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)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>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)</PreprocessorDefinitions>
<IgnoreStandardIncludePath>false</IgnoreStandardIncludePath>
<StringPooling>true</StringPooling>

View File

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

View File

@ -10,7 +10,7 @@
#ifndef _NATIVES_NATIVES_HANDLES_H_
#define _NATIVES_NATIVES_HANDLES_H_
#include <am-vector.h>
#include <amtl/am-vector.h>
// Note: All handles start at 1. 0 and below are invalid handles.
// This way, a plugin that doesn't initialize a vector or

View File

@ -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<<option++);
if (m_AutoColors)
{
UTIL_Format(buffer,
sizeof(buffer)-1,
ke::SafeSprintf(buffer,
sizeof(buffer),
"%s%d. \\w%s\n",
m_ItemColor.chars(),
option == 10 ? 0 : option,
m_OptNames[abs(MENU_BACK)].chars());
} else {
UTIL_Format(buffer,
sizeof(buffer)-1,
ke::SafeSprintf(buffer,
sizeof(buffer),
"%d. %s\n",
option == 10 ? 0 : option,
m_OptNames[abs(MENU_BACK)].chars());
@ -520,13 +520,13 @@ const char *Menu::GetTextString(int player, page_t page, int &keys)
option++;
if (m_AutoColors)
{
UTIL_Format(buffer,
sizeof(buffer)-1,
ke::SafeSprintf(buffer,
sizeof(buffer),
"\\d%d. %s\n\\w",
option == 10 ? 0 : option,
m_OptNames[abs(MENU_BACK)].chars());
} else {
UTIL_Format(buffer, sizeof(buffer)-1, "#. %s\n", m_OptNames[abs(MENU_BACK)].chars());
ke::SafeSprintf(buffer, sizeof(buffer), "#. %s\n", m_OptNames[abs(MENU_BACK)].chars());
}
}
m_Text = m_Text + buffer;
@ -536,15 +536,15 @@ const char *Menu::GetTextString(int player, page_t page, int &keys)
keys |= (1<<option++);
if (m_AutoColors)
{
UTIL_Format(buffer,
sizeof(buffer)-1,
ke::SafeSprintf(buffer,
sizeof(buffer),
"%s%d. \\w%s\n",
m_ItemColor.chars(),
option == 10 ? 0 : option,
m_OptNames[abs(MENU_MORE)].chars());
} else {
UTIL_Format(buffer,
sizeof(buffer)-1,
ke::SafeSprintf(buffer,
sizeof(buffer),
"%d. %s\n",
option == 10 ? 0 : option,
m_OptNames[abs(MENU_MORE)].chars());
@ -553,13 +553,13 @@ const char *Menu::GetTextString(int player, page_t page, int &keys)
option++;
if (m_AutoColors)
{
UTIL_Format(buffer,
sizeof(buffer)-1,
ke::SafeSprintf(buffer,
sizeof(buffer),
"\\d%d. %s\n\\w",
option == 10 ? 0 : option,
m_OptNames[abs(MENU_MORE)].chars());
} else {
UTIL_Format(buffer, sizeof(buffer)-1, "#. %s\n", m_OptNames[abs(MENU_MORE)].chars());
ke::SafeSprintf(buffer, sizeof(buffer), "#. %s\n", m_OptNames[abs(MENU_MORE)].chars());
}
}
m_Text = m_Text + buffer;
@ -578,15 +578,15 @@ const char *Menu::GetTextString(int player, page_t page, int &keys)
keys |= (1<<option++);
if (m_AutoColors)
{
UTIL_Format(buffer,
sizeof(buffer)-1,
ke::SafeSprintf(buffer,
sizeof(buffer),
"%s%d. \\w%s\n",
m_ItemColor.chars(),
option == 10 ? 0 : option,
m_OptNames[abs(MENU_EXIT)].chars());
} else {
UTIL_Format(buffer,
sizeof(buffer)-1,
ke::SafeSprintf(buffer,
sizeof(buffer),
"%d. %s\n",
option == 10 ? 0 : option,
m_OptNames[abs(MENU_EXIT)].chars());

View File

@ -96,7 +96,7 @@ public:
}
private:
Entry(const Entry &other) KE_DELETE;
Entry(const Entry &other) = delete;
ArrayInfo *ensureArray(size_t bytes) {
ArrayInfo *array = raw();

View File

@ -10,22 +10,6 @@
#include <time.h>
#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)
{

View File

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

View File

@ -17,7 +17,7 @@
#include <amxxmodule.h>
#include "CstrikeUtils.h"
#include "CstrikeHacks.h"
#include <am-vector.h>
#include <amtl/am-vector.h>
extern ke::Vector<int> ModelsUpdateQueue;

View File

@ -64,7 +64,7 @@
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\;..\..\..\..\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)</AdditionalIncludeDirectories>
<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)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;HAVE_STDINT_H;_CRT_SECURE_NO_DEPRECATE;CSTRIKE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
@ -110,7 +110,7 @@
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<AdditionalIncludeDirectories>..\;..\..\..\..\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)</AdditionalIncludeDirectories>
<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)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;HAVE_STDINT_H;_CRT_SECURE_NO_DEPRECATE;CSTRIKE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>

View File

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

View File

@ -11,24 +11,7 @@
#include "WinCSX.h"
#include <stdio.h>
#include "commctrl.h"
size_t UTIL_Format(char *buffer, size_t maxlength, const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
size_t len = vsnprintf(buffer, maxlength, fmt, ap);
va_end(ap);
if (len >= maxlength)
{
buffer[maxlength - 1] = '\0';
return (maxlength - 1);
}
else
{
return len;
}
}
#include <amtl/am-string.h>
int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
@ -196,7 +179,7 @@ void UpdateListBox(HWND hDlg) {
//if ((*b).getPosition() < 1) // umm... naaah!
//continue;
UTIL_Format(tempbuffer, sizeof(tempbuffer)-1, "%s", (*b).getName());
ke::SafeSprintf(tempbuffer, sizeof(tempbuffer), "%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.

View File

@ -52,8 +52,8 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\;..\..\..\..\..\public;..\..\..\..\..\public\sdk; ..\..\..\..\..\public\amtl\include;..\..\third_party;..\..\third_party\hashing;..\resources;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\;..\..\..\..\..\public;..\..\..\..\..\public\sdk;..\..\..\..\..\public\amtl;..\..\third_party;..\..\third_party\hashing;..\resources;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;HAVE_STDINT_H;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
@ -73,8 +73,8 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>..\;..\..\..\..\..\public;..\..\..\..\..\public\sdk; ..\..\..\..\..\public\amtl\include;..\..\third_party;..\..\third_party\hashing;..\resources;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\;..\..\..\..\..\public;..\..\..\..\..\public\sdk;..\..\..\..\..\public\amtl;..\..\third_party;..\..\third_party\hashing;..\resources;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;HAVE_STDINT_H;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>

View File

@ -65,7 +65,7 @@
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<AdditionalIncludeDirectories>..\;..\..\..\..\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)</AdditionalIncludeDirectories>
<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)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;csx_EXPORTS;JIT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
@ -107,7 +107,7 @@
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\;..\..\..\..\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)</AdditionalIncludeDirectories>
<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)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;csx_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>

View File

@ -64,7 +64,7 @@
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<AdditionalIncludeDirectories>..\;..\..\..\..\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)</AdditionalIncludeDirectories>
<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)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>dodfun_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
@ -106,7 +106,7 @@
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\;..\..\..\..\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)</AdditionalIncludeDirectories>
<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)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;dodfun_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>

View File

@ -64,7 +64,7 @@
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<AdditionalIncludeDirectories>..\;..\..\..\..\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)</AdditionalIncludeDirectories>
<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)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>dodx_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
@ -106,7 +106,7 @@
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\;..\..\..\..\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)</AdditionalIncludeDirectories>
<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)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;dodx_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>

View File

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

View File

@ -23,9 +23,9 @@
#include "entity.h"
#include "gpglobals.h"
#include "entity_state.h"
#include <am-vector.h>
#include <am-string.h>
#include "CDetour/detours.h"
#include <amtl/am-vector.h>
#include <amtl/am-string.h>
#include <CDetour/detours.h>
extern DLL_FUNCTIONS *g_pFunctionTable;
extern DLL_FUNCTIONS *g_pFunctionTable_Post;

View File

@ -54,7 +54,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\;..\..\..\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)</AdditionalIncludeDirectories>
<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)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;ENGINE_EXPORTS;HAVE_STDINT_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@ -78,7 +78,7 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>..\;..\..\..\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)</AdditionalIncludeDirectories>
<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)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;ENGINE_EXPORTS;HAVE_STDINT_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<StructMemberAlignment>4Bytes</StructMemberAlignment>

View File

@ -23,8 +23,8 @@
#include "forward.h"
#include "fm_tr.h"
#include "glb.h"
#include <am-string.h>
#include <am-vector.h>
#include <amtl/am-string.h>
#include <amtl/am-vector.h>
#include <IGameConfigs.h>
#include <HLTypeConversion.h>

View File

@ -14,7 +14,7 @@
#ifndef _INCLUDE_TR_H
#define _INCLUDE_TR_H
#include <am-string.h>
#include <amtl/am-string.h>
extern TraceResult *gfm_tr;

View File

@ -14,7 +14,7 @@
#ifndef _INCLUDE_FORWARD_H
#define _INCLUDE_FORWARD_H
#include <am-vector.h>
#include <amtl/am-vector.h>
#define ENGFUNC_NUM FM_LAST_DONT_USE_ME // 131

View File

@ -54,7 +54,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\;..\..\..\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)</AdditionalIncludeDirectories>
<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)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;FAKEMETA_EXPORTS;HAVE_STDINT_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@ -77,7 +77,7 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>..\;..\..\..\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)</AdditionalIncludeDirectories>
<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)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;FAKEMETA_EXPORTS;HAVE_STDINT_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<RuntimeTypeInfo>false</RuntimeTypeInfo>

View File

@ -12,7 +12,7 @@
//
#include "fakemeta_amxx.h"
#include <am-algorithm.h>
#include <amtl/am-algorithm.h>
enum class BaseFieldType
{

View File

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

View File

@ -65,7 +65,7 @@
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<AdditionalIncludeDirectories>..\;..\..\..\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)</AdditionalIncludeDirectories>
<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)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;FUN_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
@ -107,7 +107,7 @@
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\;..\..\..\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)</AdditionalIncludeDirectories>
<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)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;FUN_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>

View File

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

View File

@ -15,8 +15,8 @@
#include "geoip_natives.h"
#include "geoip_util.h"
#include <am-string.h>
#include <am-vector.h>
#include <amtl/am-string.h>
#include <amtl/am-vector.h>
// 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);

View File

@ -14,8 +14,8 @@
#ifndef _INCLUDE_GEOIPNATIVES_H
#define _INCLUDE_GEOIPNATIVES_H
#include <am-string.h>
#include <am-vector.h>
#include <amtl/am-string.h>
#include <amtl/am-vector.h>
extern MMDB_s HandleDB;
extern ke::Vector<ke::AString> LangList;

View File

@ -54,7 +54,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\;..\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)</AdditionalIncludeDirectories>
<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)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;GEOIP_EXPORTS;HAVE_STDINT_H;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@ -78,7 +78,7 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>..\;..\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)</AdditionalIncludeDirectories>
<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)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;GEOIP_EXPORTS;HAVE_STDINT_H;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<RuntimeTypeInfo>false</RuntimeTypeInfo>

View File

@ -13,8 +13,8 @@
#include "amxxmodule.h"
#include <am-vector.h>
#include <am-string.h>
#include <amtl/am-vector.h>
#include <amtl/am-string.h>
#include <sh_stack.h>
#include "DataHandler.h"

View File

@ -15,8 +15,8 @@
#define RETURNHANDLER_H
#include "ham_utils.h"
#include <am-vector.h>
#include <am-string.h>
#include <amtl/am-vector.h>
#include <amtl/am-string.h>
#include <sh_stack.h>
enum

View File

@ -41,7 +41,7 @@
#include <stdlib.h> // memalign
#include <stdio.h>
#include <am-utility.h>
#include <amtl/am-utility.h>
namespace Trampolines
{

View File

@ -15,7 +15,7 @@
#include <extdll.h>
#include "NEW_Util.h"
#include <am-vector.h>
#include <amtl/am-vector.h>
#include "forward.h"
#include "hook.h"
#include "ham_const.h"

View File

@ -18,8 +18,8 @@
#include "hooklist.h"
#include "forward.h"
#include "hook.h"
#include <am-vector.h>
#include <am-string.h>
#include <amtl/am-vector.h>
#include <amtl/am-string.h>
extern ke::Vector<Hook *> hooks[HAM_LAST_ENTRY_DONT_USE_ME_LOL];

View File

@ -16,6 +16,7 @@
#include "ham_const.h"
#include "hooklist.h"
#include "offsets.h"
#include <amtl/am-string.h>
extern hook_t hooklist[];
@ -108,7 +109,7 @@ static void read_mirror(char *input)
*data='\0';
// mark down the source
UTIL_Format(source, sizeof(source)-1, "%s", input);
ke::SafeSprintf(source, sizeof(source), "%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)
{

View File

@ -16,7 +16,7 @@
#ifndef FORWARD_H
#define FORWARD_H
#include <am-refcounting.h>
#include <amtl/am-refcounting.h>
enum fwdstate
{

View File

@ -17,16 +17,17 @@
#include "amxxmodule.h"
#include "offsets.h"
#include "NEW_Util.h"
#include <amtl/am-string.h>
#define CHECK_FUNCTION(x) \
if (x < 0 || x >= HAM_LAST_ENTRY_DONT_USE_ME_LOL) { \
char msg[1024]; \
UTIL_Format(msg, sizeof(msg)-1, "Function out of bounds. Got: %d Max: %d", x, HAM_LAST_ENTRY_DONT_USE_ME_LOL - 1); \
ke::SafeSprintf(msg, sizeof(msg), "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; \
}

View File

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

View File

@ -19,8 +19,8 @@
#include <extdll.h>
#include "amxxmodule.h"
#include <am-vector.h>
#include <am-string.h>
#include <amtl/am-vector.h>
#include <amtl/am-string.h>
#include <sh_stack.h>
#include "hook.h"

View File

@ -28,7 +28,7 @@
#include "hooklist.h"
#include "ham_utils.h"
#include "hook_specialbot.h"
#include <am-vector.h>
#include <amtl/am-vector.h>
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);

View File

@ -15,7 +15,7 @@
#define HOOK_SPECIALBOT_H
#include "ham_utils.h"
#include <am-vector.h>
#include <amtl/am-vector.h>
#include "forward.h"
class CRegisterHamParams

View File

@ -54,7 +54,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\;..\..\..\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)</AdditionalIncludeDirectories>
<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)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;HAMSANDWICH_EXPORTS; HAVE_STDINT_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@ -81,7 +81,7 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>..\;..\..\..\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)</AdditionalIncludeDirectories>
<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)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;HAMSANDWICH_EXPORTS; HAVE_STDINT_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<RuntimeTypeInfo>false</RuntimeTypeInfo>

View File

@ -13,7 +13,7 @@
#include "amxxmodule.h"
#include <stdarg.h>
#include <am-vector.h>
#include <amtl/am-vector.h>
#include "ham_const.h"
#include "hooklist.h"
#include "offsets.h"

View File

@ -13,7 +13,7 @@
#include <string.h>
#include <sh_stack.h>
#include <am-vector.h>
#include <amtl/am-vector.h>
#include "mysql2_header.h"
struct QHandle

View File

@ -54,7 +54,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\;..\..\..\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)</AdditionalIncludeDirectories>
<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)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>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)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@ -78,7 +78,7 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>..\;..\..\..\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)</AdditionalIncludeDirectories>
<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)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>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)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<RuntimeTypeInfo>false</RuntimeTypeInfo>

View File

@ -14,6 +14,7 @@
#include "amxxmodule.h"
#include "MysqlDriver.h"
#include "MysqlDatabase.h"
#include <amtl/am-string.h>
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;
}

View File

@ -15,6 +15,7 @@
#include "MysqlQuery.h"
#include "MysqlDatabase.h"
#include "MysqlResultSet.h"
#include <amtl/am-string.h>
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

View File

@ -8,7 +8,7 @@
// https://alliedmods.net/amxmodx-license
#include "BaseWorker.h"
#include <am-linkedlist.h>
#include <amtl/am-linkedlist.h>
BaseWorker::BaseWorker() :
m_perFrame(SM_DEFAULT_THREADS_PER_FRAME),

View File

@ -10,7 +10,7 @@
#ifndef _INCLUDE_SOURCEMOD_BASEWORKER_H
#define _INCLUDE_SOURCEMOD_BASEWORKER_H
#include <am-linkedlist.h>
#include <amtl/am-linkedlist.h>
#include "ThreadSupport.h"
#define SM_DEFAULT_THREADS_PER_FRAME 1

View File

@ -16,7 +16,7 @@
#include "IThreader.h"
#include "ISQLDriver.h"
#include <am-string.h>
#include <amtl/am-string.h>
#include <sh_stack.h>
struct QueuedResultInfo

View File

@ -23,8 +23,8 @@
#ifndef ALLOCSTRING_H
#define ALLOCSTRING_H
#include <am-string.h>
#include <am-linkedlist.h>
#include <amtl/am-string.h>
#include <amtl/am-linkedlist.h>
class StringManager
{

View File

@ -17,7 +17,7 @@
#ifndef GAMEMANAGER_H
#define GAMEMANAGER_H
#include <am-string.h>
#include <amtl/am-string.h>
class GameManager
{

View File

@ -14,8 +14,8 @@
#ifndef _HASH_H_
#define _HASH_H_
#include <am-vector.h>
#include <am-string.h>
#include <amtl/am-vector.h>
#include <amtl/am-string.h>
// Just a very simple hash map, no iteration or anything of the like (not needed)

View File

@ -14,7 +14,7 @@
#ifndef LOCATIONMANAGER_H
#define LOCATIONMANAGER_H
#include <am-vector.h>
#include <amtl/am-vector.h>
#include "GameManager.h"
#include "TitleManager.h"

View File

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

View File

@ -14,8 +14,8 @@
#ifndef PARTICLEMANAGER_H
#define PARTICLEMANAGER_H
#include <am-vector.h>
#include <am-string.h>
#include <amtl/am-vector.h>
#include <amtl/am-string.h>
typedef struct psystem_s
{

View File

@ -14,7 +14,7 @@
#ifndef SPAWNMANAGER_H
#define SPAWNMANAGER_H
#include <am-vector.h>
#include <amtl/am-vector.h>
typedef struct spawndata_s
{

View File

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

View File

@ -18,7 +18,7 @@
#include <stdlib.h>
#include <string.h>
#include <am-string.h>
#include <amtl/am-string.h>
#include "Hash.h"

View File

@ -23,6 +23,7 @@
#include "ParticleManager.h"
#include "AllocString.h"
#include <amtl/am-string.h>
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);

View File

@ -65,7 +65,7 @@
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<AdditionalIncludeDirectories>..\;..\..\..\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)</AdditionalIncludeDirectories>
<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)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>HAVE_STDINT_H;WIN32;NDEBUG;_WINDOWS;_USRDLL;ns_amxx_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
@ -105,7 +105,7 @@
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\;..\..\..\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)</AdditionalIncludeDirectories>
<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)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>HAVE_STDINT_H;WIN32;_DEBUG;_WINDOWS;_USRDLL;ns_amxx_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>

View File

@ -17,8 +17,8 @@
#include "utilfunctions.h"
#include "NEW_Util.h"
#include "ParticleManager.h"
#include <am-vector.h>
#include <am-string.h>
#include <amtl/am-vector.h>
#include <amtl/am-string.h>
#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<char *>(STRING(reinterpret_cast<edict_t *>(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<char *>(STRING(reinterpret_cast<edict_t *>(params[1])->v.classname));
kvd.szKeyName=name;

View File

@ -15,9 +15,9 @@
#define _INCLUDE_JOURNAL_H
#include "Binary.h"
#include <am-linkedlist.h>
#include <amtl/am-linkedlist.h>
#include <sm_stringhashmap.h>
#include <am-string.h>
#include <amtl/am-string.h>
enum JOp
{

View File

@ -15,7 +15,7 @@
#include "amxxmodule.h"
#include "NVault.h"
#include "Binary.h"
#include <am-string.h>
#include <amtl/am-string.h>
/**
* :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;
}

View File

@ -14,7 +14,7 @@
#ifndef _INCLUDE_NVAULT_H
#define _INCLUDE_NVAULT_H
#include <am-linkedlist.h>
#include <amtl/am-linkedlist.h>
#include <sm_stringhashmap.h>
#include "IVault.h"
#include "Journal.h"

View File

@ -15,8 +15,8 @@
#define _INCLUDE_AMXXAPI_H
#include "amxxmodule.h"
#include <am-vector.h>
#include <am-string.h>
#include <amtl/am-vector.h>
#include <amtl/am-string.h>
#include <sm_queue.h>
extern AMX_NATIVE_INFO nVault_natives[];

View File

@ -54,7 +54,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\;..\..\..\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)</AdditionalIncludeDirectories>
<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)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;NVAULT_EXPORTS;HAVE_STDINT_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<ExceptionHandling>Sync</ExceptionHandling>
@ -79,7 +79,7 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>..\;..\..\..\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)</AdditionalIncludeDirectories>
<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)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;NVAULT_EXPORTS;HAVE_STDINT_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<StructMemberAlignment>4Bytes</StructMemberAlignment>

View File

@ -14,8 +14,8 @@
#ifndef _INCLUDE_CREGEX_H
#define _INCLUDE_CREGEX_H
#include <am-vector.h>
#include <am-string.h>
#include <amtl/am-vector.h>
#include <amtl/am-string.h>
/**
* Maximum number of sub-patterns, here 50 (this should be a multiple of 3).

View File

@ -14,8 +14,8 @@
#include <string.h>
#include "pcre.h"
#include "amxxmodule.h"
#include <am-vector.h>
#include <am-utility.h>
#include <amtl/am-vector.h>
#include <amtl/am-utility.h>
#include "CRegEx.h"
#include "utils.h"

View File

@ -54,7 +54,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\;..\..\..\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)</AdditionalIncludeDirectories>
<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)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;REGEX_EXPORTS;HAVE_STDINT_H;PCRE_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@ -78,7 +78,7 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>..\;..\..\..\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)</AdditionalIncludeDirectories>
<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)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;REGEX_EXPORTS;HAVE_STDINT_H;PCRE_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<RuntimeTypeInfo>false</RuntimeTypeInfo>

View File

@ -54,7 +54,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\;..\..\..\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)</AdditionalIncludeDirectories>
<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)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;SOCKETS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@ -78,7 +78,7 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>..\;..\..\..\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)</AdditionalIncludeDirectories>
<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)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;SOCKETS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<RuntimeTypeInfo>false</RuntimeTypeInfo>

View File

@ -13,7 +13,7 @@
#include <string.h>
#include <sh_stack.h>
#include <am-vector.h>
#include <amtl/am-vector.h>
#include "sqlite_header.h"
struct QHandle

View File

@ -55,7 +55,7 @@
<ClCompile>
<AdditionalOptions>/D "NO_TCL" %(AdditionalOptions)</AdditionalOptions>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\;..\..\..\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)</AdditionalIncludeDirectories>
<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)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;sqlite_EXPORTS;SM_DEFAULT_THREADER;HAVE_STDINT_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@ -85,7 +85,7 @@
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>..\;..\..\..\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)</AdditionalIncludeDirectories>
<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)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;sqlite_EXPORTS;SM_DEFAULT_THREADER;HAVE_STDINT_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>

View File

@ -15,6 +15,7 @@
#include "SqliteHeaders.h"
#include "SqliteDriver.h"
#include "SqliteDatabase.h"
#include <amtl/am-string.h>
#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;

View File

@ -15,6 +15,7 @@
#include "SqliteQuery.h"
#include "SqliteDatabase.h"
#include "SqliteResultSet.h"
#include <amtl/am-string.h>
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;

View File

@ -14,7 +14,7 @@
#include "amxxmodule.h"
#include "sqlite_header.h"
#include "threading.h"
#include <am-string.h>
#include <amtl/am-string.h>
MainThreader g_Threader;
ThreadWorker *g_pWorker = NULL;

View File

@ -16,8 +16,8 @@
#include "IThreader.h"
#include "ISQLDriver.h"
#include <am-string.h>
#include <am-vector.h>
#include <amtl/am-string.h>
#include <amtl/am-vector.h>
#include <sh_stack.h>
struct QueuedResultInfo

View File

@ -63,7 +63,7 @@
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\;..\..\..\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)</AdditionalIncludeDirectories>
<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)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;tfcx_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
@ -108,7 +108,7 @@
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<AdditionalIncludeDirectories>..\;..\..\..\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)</AdditionalIncludeDirectories>
<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)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;tfcx_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>

Some files were not shown because too many files have changed in this diff Show More