From e188bf087ab046424936133fbf11936aff72b20b Mon Sep 17 00:00:00 2001 From: David Anderson Date: Sat, 23 Jul 2005 16:57:21 +0000 Subject: [PATCH] CVector fix - corrupt memory on size change Version bumps --- dlls/csx/source/moduleconfig.h | 2 +- dlls/csx_sql/CVector.h | 14 ++-- dlls/dod2/dodfun/moduleconfig.h | 2 +- dlls/dod2/dodx/moduleconfig.h | 2 +- dlls/fakemeta/CVector.h | 14 ++-- dlls/geoip/moduleconfig.h | 2 +- dlls/ns/ns/moduleconfig.h | 2 +- dlls/nvault/amxxapi.cpp | 113 +++++++++++++++++++++++++++++++- dlls/nvault/hash.h | 9 ++- dlls/nvault/journal.h | 7 ++ dlls/nvault/nvault.h | 7 ++ dlls/nvault/nvault.inc | 21 ++++-- dlls/nvault/sdk/CVector.h | 14 ++-- dlls/nvault/sdk/amxxmodule.cpp | 17 +++-- dlls/nvault/sdk/amxxmodule.h | 17 ++++- dlls/pgsql/CVector.h | 14 ++-- dlls/regex/CVector.h | 14 ++-- dlls/sockets/moduleconfig.h | 2 +- dlls/sqlite/CVector.h | 14 ++-- dlls/sqlite/moduleconfig.h | 2 +- dlls/tfc/tfcx/moduleconfig.h | 2 +- dlls/ts/tsx/moduleconfig.h | 2 +- 22 files changed, 240 insertions(+), 53 deletions(-) diff --git a/dlls/csx/source/moduleconfig.h b/dlls/csx/source/moduleconfig.h index 60f88768..48f5315c 100755 --- a/dlls/csx/source/moduleconfig.h +++ b/dlls/csx/source/moduleconfig.h @@ -5,7 +5,7 @@ // Module info #define MODULE_NAME "CSX" -#define MODULE_VERSION "1.01" +#define MODULE_VERSION "1.10RC1" #define MODULE_AUTHOR "AMX Mod X Dev Team" #define MODULE_URL "http://www.amxmodx.org/" #define MODULE_LOGTAG "CSX" diff --git a/dlls/csx_sql/CVector.h b/dlls/csx_sql/CVector.h index 05538f53..d6b87eb5 100755 --- a/dlls/csx_sql/CVector.h +++ b/dlls/csx_sql/CVector.h @@ -48,7 +48,8 @@ template class CVector return false; if (m_Data) { - memcpy(newData, m_Data, m_Size * sizeof(T)); + for (size_t i=0; i class CVector return false; if (m_Data) { - memcpy(newData, m_Data, (m_Size < size) ? (m_Size * sizeof(T)) : (size * sizeof(T))); + size_t end = (m_Size < size) ? (m_Size) : size; + for (size_t i=0; i(const CVector & other) { // copy data - m_Data = new T [other.m_Size]; - m_Size = other.m_Size; + m_Data = new T [other.m_CurrentUsedSize]; + m_Size = other.m_CurrentUsedSize; m_CurrentUsedSize = other.m_CurrentUsedSize; - memcpy(m_Data, other.m_Data, m_CurrentUsedSize * sizeof(T)); + for (size_t i=0; i() diff --git a/dlls/dod2/dodfun/moduleconfig.h b/dlls/dod2/dodfun/moduleconfig.h index 7b7086f7..15d2ea6b 100755 --- a/dlls/dod2/dodfun/moduleconfig.h +++ b/dlls/dod2/dodfun/moduleconfig.h @@ -5,7 +5,7 @@ // Module info #define MODULE_NAME "DoD Fun" -#define MODULE_VERSION "1.02" +#define MODULE_VERSION "1.10RC1" #define MODULE_AUTHOR "AMX Mod X Dev Team" #define MODULE_URL "http://www.amxmodx.org" #define MODULE_LOGTAG "DODFUN" diff --git a/dlls/dod2/dodx/moduleconfig.h b/dlls/dod2/dodx/moduleconfig.h index 7e8635c6..38e2c010 100755 --- a/dlls/dod2/dodx/moduleconfig.h +++ b/dlls/dod2/dodx/moduleconfig.h @@ -5,7 +5,7 @@ // Module info #define MODULE_NAME "DoDX" -#define MODULE_VERSION "1.01" +#define MODULE_VERSION "1.10RC1" #define MODULE_AUTHOR "AMX Mod X Dev Team" #define MODULE_URL "http://www.amxmodx.org" #define MODULE_LOGTAG "DODX" diff --git a/dlls/fakemeta/CVector.h b/dlls/fakemeta/CVector.h index 05538f53..d6b87eb5 100755 --- a/dlls/fakemeta/CVector.h +++ b/dlls/fakemeta/CVector.h @@ -48,7 +48,8 @@ template class CVector return false; if (m_Data) { - memcpy(newData, m_Data, m_Size * sizeof(T)); + for (size_t i=0; i class CVector return false; if (m_Data) { - memcpy(newData, m_Data, (m_Size < size) ? (m_Size * sizeof(T)) : (size * sizeof(T))); + size_t end = (m_Size < size) ? (m_Size) : size; + for (size_t i=0; i(const CVector & other) { // copy data - m_Data = new T [other.m_Size]; - m_Size = other.m_Size; + m_Data = new T [other.m_CurrentUsedSize]; + m_Size = other.m_CurrentUsedSize; m_CurrentUsedSize = other.m_CurrentUsedSize; - memcpy(m_Data, other.m_Data, m_CurrentUsedSize * sizeof(T)); + for (size_t i=0; i() diff --git a/dlls/geoip/moduleconfig.h b/dlls/geoip/moduleconfig.h index 0741783a..e31c7977 100755 --- a/dlls/geoip/moduleconfig.h +++ b/dlls/geoip/moduleconfig.h @@ -5,7 +5,7 @@ // Module info #define MODULE_NAME "GeoIP" -#define MODULE_VERSION "1.01" +#define MODULE_VERSION "1.10RC1" #define MODULE_AUTHOR "AMX Mod X Dev Team" #define MODULE_URL "http://www.amxmodx.org/" #define MODULE_LOGTAG "GEOIP" diff --git a/dlls/ns/ns/moduleconfig.h b/dlls/ns/ns/moduleconfig.h index 1b444182..6de2f70c 100755 --- a/dlls/ns/ns/moduleconfig.h +++ b/dlls/ns/ns/moduleconfig.h @@ -4,7 +4,7 @@ // Module info #define MODULE_NAME "NS" -#define MODULE_VERSION "1.10-RC1" +#define MODULE_VERSION "1.10RC1" #define MODULE_AUTHOR "Steve Dudenhoeffer" #define MODULE_URL "http://www.amxmodx.org/" #define MODULE_LOGTAG "NS" diff --git a/dlls/nvault/amxxapi.cpp b/dlls/nvault/amxxapi.cpp index 3a8ec0b2..0dbca6be 100755 --- a/dlls/nvault/amxxapi.cpp +++ b/dlls/nvault/amxxapi.cpp @@ -1,5 +1,12 @@ +#include #include "amxxapi.h" +#ifdef __linux__ +#include +#else +#include +#endif + CVector Vaults; static cell nvault_open(AMX *amx, cell *params) @@ -31,13 +38,115 @@ static cell nvault_open(AMX *amx, cell *params) static cell nvault_get(AMX *amx, cell *params) { unsigned int id = params[1]; - if (id > Vaults.size() || !Vaults.at(i)) + if (id > Vaults.size() || !Vaults.at(id)) + { + MF_LogError(amx, AMX_ERR_NATIVE, "Invalid vault id: %d\n", id); + return 0; + } + unsigned int numParams = (*params)/sizeof(cell); + int len; + char *key = MF_GetAmxString(amx, params[2], 0, &len); + const char *val = Vaults.at(id)->Find(key)->val.c_str(); + switch (numParams) + { + case 2: + { + return atoi(val); + break; + } + case 3: + { + cell *fAddr = MF_GetAmxAddr(amx, params[3]); + *fAddr = amx_ftoc((REAL)atof(val)); + return 1; + break; + } + case 4: + { + len = *(MF_GetAmxAddr(amx, params[4])); + return MF_SetAmxString(amx, params[3], val, len); + break; + } + } + + return 0; +} + +static cell nvault_timeget(AMX *amx, cell *params) +{ + unsigned int id = params[1]; + if (id > Vaults.size() || !Vaults.at(id)) + { + MF_LogError(amx, AMX_ERR_NATIVE, "Invalid vault id: %d\n", id); + return 0; + } + unsigned int numParams = (*params)/sizeof(cell); + int len; + HashTable::htNode *node; + char *key = MF_GetAmxString(amx, params[2], 0, &len); + node = Vaults.at(id)->Find(key); + const char *val = node->val.c_str(); + cell *t_addr = MF_GetAmxAddr(amx, params[3]); + *t_addr = (cell)(node->stamp); + switch (numParams) + { + case 3: + { + return atoi(val); + break; + } + case 4: + { + cell *fAddr = MF_GetAmxAddr(amx, params[4]); + *fAddr = amx_ftoc((REAL)atof(val)); + return 1; + break; + } + case 5: + { + len = *(MF_GetAmxAddr(amx, params[5])); + return MF_SetAmxString(amx, params[4], val, len); + break; + } + } + + return 0; +} + +static cell nvault_set(AMX *amx, cell *params) +{ + unsigned int id = params[1]; + if (id > Vaults.size() || !Vaults.at(id)) { MF_LogError(amx, AMX_ERR_NATIVE, "Invalid vault id: %d\n", id); return 0; } + int len; + char *key = MF_GetAmxString(amx, params[2], 0, &len); + char *val = MF_FormatAmxString(amx, params, 3, &len); + Vaults.at(id)->Store(key, val); + + return 1; +} + +static cell nvault_pset(AMX *amx, cell *params) +{ + unsigned int id = params[1]; + if (id > Vaults.size() || !Vaults.at(id)) + { + MF_LogError(amx, AMX_ERR_NATIVE, "Invalid vault id: %d\n", id); + return 0; + } + + int len; + char *key = MF_GetAmxString(amx, params[2], 0, &len); + char *val = MF_FormatAmxString(amx, params, 3, &len); + + Vaults.at(id)->Store(key, val, false); + + return 1; } void OnAmxxAttach() @@ -46,6 +155,6 @@ void OnAmxxAttach() #ifdef __linux__ mkdir(MF_BuildPathname("%s/nvault", LOCALINFO("amxx_datadir")), 0700); #else - mkdir(MF_BuildPathname("%s/nvault", LOCALINFO("amxx_datadir")); + mkdir(MF_BuildPathname("%s/nvault", LOCALINFO("amxx_datadir"))); #endif } diff --git a/dlls/nvault/hash.h b/dlls/nvault/hash.h index 16f5f14e..b377ce73 100755 --- a/dlls/nvault/hash.h +++ b/dlls/nvault/hash.h @@ -5,6 +5,13 @@ #include "sdk/amxxmodule.h" #include "sdk/CString.h" +/** + * (C)2005 David "BAILOPAN" Anderson + * Licensed under the GNU General Public License, version 2 + * + * Small hash table implementation + */ + #if defined WIN32 || defined _WIN32 typedef unsigned __int8 uint8_t; typedef __int8 int8_t; @@ -13,7 +20,7 @@ #endif /** - * Hash Table implementation (by David "BAILOPAN" Anderson) + * Hash Table implementation * This is not designed to be flexible for size/type, it's hardcoded. * The table size is 2^11, which should be good enough for fast small lookups. * A hash is computed by two chopped up 8bit versions of CRC32, which is then combined to diff --git a/dlls/nvault/journal.h b/dlls/nvault/journal.h index ffa70037..1de713eb 100755 --- a/dlls/nvault/journal.h +++ b/dlls/nvault/journal.h @@ -3,6 +3,13 @@ #include "nvault.h" +/** + * (C)2005 David "BAILOPAN" Anderson + * Licensed under the GNU General Public License, version 2 + * + * Adds Journaling capabilities for an nVault + */ + #define JOURNAL_MAGIC 0x6E564A4C class Journal diff --git a/dlls/nvault/nvault.h b/dlls/nvault/nvault.h index 316dfac2..fa3697ea 100755 --- a/dlls/nvault/nvault.h +++ b/dlls/nvault/nvault.h @@ -4,6 +4,13 @@ #include "sdk/CString.h" #include "hash.h" +/** + * (C)2005 David "BAILOPAN" Anderson + * Licensed under the GNU General Public License, version 2 + * + * Vault implementation using a Hash Table + */ + /** * Vault file format: * Headers diff --git a/dlls/nvault/nvault.inc b/dlls/nvault/nvault.inc index fd8d97fa..bb2760d8 100755 --- a/dlls/nvault/nvault.inc +++ b/dlls/nvault/nvault.inc @@ -20,12 +20,23 @@ native vault_open(const name[]); * One extra param - Float byref * Two extra params - gets as a string */ -native nvault_get(id, const name[], ...); +native nvault_get(id, const key[], ...); + +/* Reads from a vault, includes time + * Parameter format same as nvault_get() + */ +native nvault_timeget(id, const key[], &time, ...); + +/* Sets a key/value pair + * valFmt is formatted according to format() + */ +native nvault_set(id, const key[], const valFmt[], {Float,_}:...); + +/* Sets a permanent key/value pair + * A permanent key isn't timestamped, so it can be invulnerable to pruning. + */ +native nvault_pset(id, const key[], const valFmt[], {Float,_}:...); -/* Reads a data from given key. - * If len is set to zero then get_vaultdata -* returns value as an number. */ -native get_vaultdata(const key[], data[] = "", len = 0); /* Sets a data under given key. */ native set_vaultdata(const key[], const data[] = "" ); diff --git a/dlls/nvault/sdk/CVector.h b/dlls/nvault/sdk/CVector.h index 05538f53..d6b87eb5 100755 --- a/dlls/nvault/sdk/CVector.h +++ b/dlls/nvault/sdk/CVector.h @@ -48,7 +48,8 @@ template class CVector return false; if (m_Data) { - memcpy(newData, m_Data, m_Size * sizeof(T)); + for (size_t i=0; i class CVector return false; if (m_Data) { - memcpy(newData, m_Data, (m_Size < size) ? (m_Size * sizeof(T)) : (size * sizeof(T))); + size_t end = (m_Size < size) ? (m_Size) : size; + for (size_t i=0; i(const CVector & other) { // copy data - m_Data = new T [other.m_Size]; - m_Size = other.m_Size; + m_Data = new T [other.m_CurrentUsedSize]; + m_Size = other.m_CurrentUsedSize; m_CurrentUsedSize = other.m_CurrentUsedSize; - memcpy(m_Data, other.m_Data, m_CurrentUsedSize * sizeof(T)); + for (size_t i=0; i() diff --git a/dlls/nvault/sdk/amxxmodule.cpp b/dlls/nvault/sdk/amxxmodule.cpp index 5bd6e75a..aa649e2b 100755 --- a/dlls/nvault/sdk/amxxmodule.cpp +++ b/dlls/nvault/sdk/amxxmodule.cpp @@ -2421,9 +2421,6 @@ C_DLLEXPORT void __stdcall GiveFnptrsToDll( enginefuncs_t* pengfuncsFromEngine, /************* AMXX Stuff *************/ -// *** Types *** -typedef void* (*PFN_REQ_FNPTR)(const char * /*name*/); - // *** Globals *** // Module info static amxx_module_info_s g_ModuleInfo = @@ -2432,15 +2429,17 @@ static amxx_module_info_s g_ModuleInfo = MODULE_AUTHOR, MODULE_VERSION, #ifdef MODULE_RELOAD_ON_MAPCHANGE - 1 + 1, #else // MODULE_RELOAD_ON_MAPCHANGE - 0 + 0, #endif // MODULE_RELOAD_ON_MAPCHANGE + MODULE_LOGTAG }; // Storage for the requested functions PFN_ADD_NATIVES g_fn_AddNatives; PFN_BUILD_PATHNAME g_fn_BuildPathname; +PFN_BUILD_PATHNAME_R g_fn_BuildPathnameR; PFN_GET_AMXADDR g_fn_GetAmxAddr; PFN_PRINT_SRVCONSOLE g_fn_PrintSrvConsole; PFN_GET_MODNAME g_fn_GetModname; @@ -2501,6 +2500,8 @@ PFN_AMX_FINDNATIVE g_fn_AmxFindNative; PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; PFN_FORMAT g_fn_Format; +PFN_REGISTERFUNCTION g_fn_RegisterFunction; +PFN_REQ_FNPTR g_fn_RequestFunction; // *** Exports *** C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) @@ -2538,15 +2539,19 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) if (!reqFnptrFunc) return AMXX_PARAM; + g_fn_RequestFunction = reqFnptrFunc; + // Req all known functions // Misc REQFUNC("BuildPathname", g_fn_BuildPathname, PFN_BUILD_PATHNAME); + REQFUNC("BuildPathnameR", g_fn_BuildPathnameR, PFN_BUILD_PATHNAME_R); REQFUNC("PrintSrvConsole", g_fn_PrintSrvConsole, PFN_PRINT_SRVCONSOLE); REQFUNC("GetModname", g_fn_GetModname, PFN_GET_MODNAME); REQFUNC("Log", g_fn_Log, PFN_LOG); REQFUNC("LogError", g_fn_LogErrorFunc, PFN_LOG_ERROR); REQFUNC("MergeDefinitionFile", g_fn_MergeDefinition_File, PFN_MERGEDEFINITION_FILE); REQFUNC("Format", g_fn_Format, PFN_FORMAT); + REQFUNC("RegisterFunction", g_fn_RegisterFunction, PFN_REGISTERFUNCTION); // Amx scripts REQFUNC("GetAmxScript", g_fn_GetAmxScript, PFN_GET_AMXSCRIPT); @@ -2670,6 +2675,7 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...) void ValidateMacros_DontCallThis_Smiley() { MF_BuildPathname("str", "str", 0); + MF_BuildPathnameR(NULL, 0, "%d", 0); MF_FormatAmxString(NULL, 0, 0, NULL); MF_GetAmxAddr(NULL, 0); MF_PrintSrvConsole("str", "str", 0); @@ -2723,6 +2729,7 @@ void ValidateMacros_DontCallThis_Smiley() MF_GetPlayerFrags(0); MF_GetPlayerEdict(0); MF_Format("", 4, "str"); + MF_RegisterFunction(NULL, ""); } #endif diff --git a/dlls/nvault/sdk/amxxmodule.h b/dlls/nvault/sdk/amxxmodule.h index e0b0e8fa..74cc5f72 100755 --- a/dlls/nvault/sdk/amxxmodule.h +++ b/dlls/nvault/sdk/amxxmodule.h @@ -32,7 +32,7 @@ // ***** AMXX stuff ***** // module interface version is 1 -#define AMXX_INTERFACE_VERSION 1 +#define AMXX_INTERFACE_VERSION 2 // amxx module info struct amxx_module_info_s @@ -41,6 +41,7 @@ struct amxx_module_info_s const char *author; const char *version; int reload; // reload on mapchange when nonzero + const char *logtag; // added in version 2 }; @@ -1883,6 +1884,9 @@ void FN_AMXX_DETACH(void); void FN_AMXX_PLUGINSLOADED(void); #endif // FN_AMXX_PLUGINSLOADED +// *** Types *** +typedef void* (*PFN_REQ_FNPTR)(const char * /*name*/); + // ***** Module funcs stuff ***** enum ForwardExecType { @@ -1906,6 +1910,7 @@ enum ForwardParam typedef int (*PFN_ADD_NATIVES) (const AMX_NATIVE_INFO * /*list*/); typedef char * (*PFN_BUILD_PATHNAME) (const char * /*format*/, ...); +typedef char * (*PFN_BUILD_PATHNAME_R) (char * /*buffer*/, size_t /* maxlen */, const char * /* format */, ...); typedef cell * (*PFN_GET_AMXADDR) (AMX * /*amx*/, cell /*offset*/); typedef void (*PFN_PRINT_SRVCONSOLE) (char * /*format*/, ...); typedef const char * (*PFN_GET_MODNAME) (void); @@ -1974,9 +1979,11 @@ typedef int (*PFN_REGISTER_SPFORWARD_BYNAME) (AMX * /*amx*/, const char * /*f typedef void (*PFN_UNREGISTER_SPFORWARD) (int /*id*/); typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/); typedef const char * (*PFN_FORMAT) (const char * /*fmt*/, ... /*params*/); +typedef void (*PFN_REGISTERFUNCTION) (void * /*pfn*/, const char * /*desc*/); extern PFN_ADD_NATIVES g_fn_AddNatives; extern PFN_BUILD_PATHNAME g_fn_BuildPathname; +extern PFN_BUILD_PATHNAME_R g_fn_BuildPathnameR; extern PFN_GET_AMXADDR g_fn_GetAmxAddr; extern PFN_PRINT_SRVCONSOLE g_fn_PrintSrvConsole; extern PFN_GET_MODNAME g_fn_GetModname; @@ -2034,12 +2041,15 @@ extern PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; extern PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; extern PFN_FORMAT g_fn_Format; extern PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam; +extern PFN_REGISTERFUNCTION g_fn_RegisterFunction; +extern PFN_REQ_FNPTR g_fn_RequestFunction; #ifdef MAY_NEVER_BE_DEFINED // Function prototypes for intellisense and similar systems // They understand #if 0 so we use #ifdef MAY_NEVER_BE_DEFINED int MF_AddNatives (const AMX_NATIVE_INFO *list) { } char * MF_BuildPathname (const char * format, ...) { } +char * MF_BuildPathnameR (char *buffer, size_t maxlen, const char *fmt, ...) { } cell * MF_GetAmxAddr (AMX * amx, cell offset) { } void MF_PrintSrvConsole (char * format, ...) { } const char * MF_GetModname (void) { } @@ -2089,10 +2099,13 @@ void MF_UnregisterSPForward (int id) { } int MF_GetPlayerFlags (int id) { } edict_t* MF_GetPlayerEdict (int id) { } const char * MF_Format (const char *fmt, ...) { } +void MF_RegisterFunction (void *pfn, const char *description) { } +void * MF_RequestFunction (const char *description) { } #endif // MAY_NEVER_BE_DEFINED #define MF_AddNatives g_fn_AddNatives #define MF_BuildPathname g_fn_BuildPathname +#define MF_BuildPathnameR g_fn_BuildPathnameR #define MF_FormatAmxString g_fn_FormatAmxString #define MF_GetAmxAddr g_fn_GetAmxAddr #define MF_PrintSrvConsole g_fn_PrintSrvConsole @@ -2150,6 +2163,8 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...); #define MF_GetPlayerFlags g_fn_GetPlayerFlags #define MF_GetPlayerEdict g_fn_GetPlayerEdict #define MF_Format g_fn_Format +#define MF_RegisterFunction g_fn_RegisterFunction +#define MF_RequestFunction g_fn_RequestFunction; /*** Memory ***/ void *operator new(size_t reportedSize); diff --git a/dlls/pgsql/CVector.h b/dlls/pgsql/CVector.h index 05538f53..d6b87eb5 100755 --- a/dlls/pgsql/CVector.h +++ b/dlls/pgsql/CVector.h @@ -48,7 +48,8 @@ template class CVector return false; if (m_Data) { - memcpy(newData, m_Data, m_Size * sizeof(T)); + for (size_t i=0; i class CVector return false; if (m_Data) { - memcpy(newData, m_Data, (m_Size < size) ? (m_Size * sizeof(T)) : (size * sizeof(T))); + size_t end = (m_Size < size) ? (m_Size) : size; + for (size_t i=0; i(const CVector & other) { // copy data - m_Data = new T [other.m_Size]; - m_Size = other.m_Size; + m_Data = new T [other.m_CurrentUsedSize]; + m_Size = other.m_CurrentUsedSize; m_CurrentUsedSize = other.m_CurrentUsedSize; - memcpy(m_Data, other.m_Data, m_CurrentUsedSize * sizeof(T)); + for (size_t i=0; i() diff --git a/dlls/regex/CVector.h b/dlls/regex/CVector.h index 05538f53..d6b87eb5 100755 --- a/dlls/regex/CVector.h +++ b/dlls/regex/CVector.h @@ -48,7 +48,8 @@ template class CVector return false; if (m_Data) { - memcpy(newData, m_Data, m_Size * sizeof(T)); + for (size_t i=0; i class CVector return false; if (m_Data) { - memcpy(newData, m_Data, (m_Size < size) ? (m_Size * sizeof(T)) : (size * sizeof(T))); + size_t end = (m_Size < size) ? (m_Size) : size; + for (size_t i=0; i(const CVector & other) { // copy data - m_Data = new T [other.m_Size]; - m_Size = other.m_Size; + m_Data = new T [other.m_CurrentUsedSize]; + m_Size = other.m_CurrentUsedSize; m_CurrentUsedSize = other.m_CurrentUsedSize; - memcpy(m_Data, other.m_Data, m_CurrentUsedSize * sizeof(T)); + for (size_t i=0; i() diff --git a/dlls/sockets/moduleconfig.h b/dlls/sockets/moduleconfig.h index c0678d92..028eb971 100755 --- a/dlls/sockets/moduleconfig.h +++ b/dlls/sockets/moduleconfig.h @@ -5,7 +5,7 @@ // Module info #define MODULE_NAME "Sockets" -#define MODULE_VERSION "1.01" +#define MODULE_VERSION "1.10RC1" #define MODULE_AUTHOR "HLSW Dev Team" #define MODULE_URL "http://www.hlsw.net/" #define MODULE_LOGTAG "SOCKET" diff --git a/dlls/sqlite/CVector.h b/dlls/sqlite/CVector.h index 05538f53..d6b87eb5 100755 --- a/dlls/sqlite/CVector.h +++ b/dlls/sqlite/CVector.h @@ -48,7 +48,8 @@ template class CVector return false; if (m_Data) { - memcpy(newData, m_Data, m_Size * sizeof(T)); + for (size_t i=0; i class CVector return false; if (m_Data) { - memcpy(newData, m_Data, (m_Size < size) ? (m_Size * sizeof(T)) : (size * sizeof(T))); + size_t end = (m_Size < size) ? (m_Size) : size; + for (size_t i=0; i(const CVector & other) { // copy data - m_Data = new T [other.m_Size]; - m_Size = other.m_Size; + m_Data = new T [other.m_CurrentUsedSize]; + m_Size = other.m_CurrentUsedSize; m_CurrentUsedSize = other.m_CurrentUsedSize; - memcpy(m_Data, other.m_Data, m_CurrentUsedSize * sizeof(T)); + for (size_t i=0; i() diff --git a/dlls/sqlite/moduleconfig.h b/dlls/sqlite/moduleconfig.h index 6e7af554..0954094f 100755 --- a/dlls/sqlite/moduleconfig.h +++ b/dlls/sqlite/moduleconfig.h @@ -5,7 +5,7 @@ // Module info #define MODULE_NAME "Sqlite" -#define MODULE_VERSION "1.00" +#define MODULE_VERSION "1.10RC1" #define MODULE_AUTHOR "AMX Mod X Dev Team" #define MODULE_URL "http://www.amxmodx.org/" #define MODULE_LOGTAG "SQLITE" diff --git a/dlls/tfc/tfcx/moduleconfig.h b/dlls/tfc/tfcx/moduleconfig.h index a1e5e0a1..f726e0bd 100755 --- a/dlls/tfc/tfcx/moduleconfig.h +++ b/dlls/tfc/tfcx/moduleconfig.h @@ -5,7 +5,7 @@ // Module info #define MODULE_NAME "TfcX" -#define MODULE_VERSION "1.01" +#define MODULE_VERSION "1.10RC1" #define MODULE_AUTHOR "AMX Mod X Dev Team" #define MODULE_URL "http://www.amxmodx.org" #define MODULE_LOGTAG "TFCX" diff --git a/dlls/ts/tsx/moduleconfig.h b/dlls/ts/tsx/moduleconfig.h index f3b7c6db..6c9e85e0 100755 --- a/dlls/ts/tsx/moduleconfig.h +++ b/dlls/ts/tsx/moduleconfig.h @@ -5,7 +5,7 @@ // Module info #define MODULE_NAME "TSX" -#define MODULE_VERSION "1.01" +#define MODULE_VERSION "1.10RC1" #define MODULE_AUTHOR "AMX Mod X Dev Team" #define MODULE_URL "http://www.amxmodx.org" #define MODULE_LOGTAG "TSX"