2
0
mirror of https://github.com/rehlds/rehlds.git synced 2025-01-06 03:55:32 +03:00

Merge pull request #87 from s1lentq/master

Cut of nicknames '+' if next there is something digit or alphanumeric character.
This commit is contained in:
theAsmodai 2015-10-27 18:24:40 +03:00
commit 14890276de
22 changed files with 82 additions and 73 deletions

View File

@ -34,8 +34,8 @@ char gpszVersionString[32];
char gpszProductString[32]; char gpszProductString[32];
char* strcpy_safe(char* dst, char* src) { char* strcpy_safe(char* dst, char* src) {
int len = strlen(src); int len = Q_strlen(src);
memmove(dst, src, len + 1); Q_memmove(dst, src, len + 1);
return dst; return dst;
} }

View File

@ -135,7 +135,6 @@ extern int loadsize;
#define Q_strnicmp _strnicmp #define Q_strnicmp _strnicmp
#define Q_strstr A_strstr #define Q_strstr A_strstr
#define Q_strchr strchr #define Q_strchr strchr
#define Q_strrchr strrchr
#define Q_strlwr A_strtolower #define Q_strlwr A_strtolower
#define Q_sprintf sprintf #define Q_sprintf sprintf
#define Q_snprintf _snprintf #define Q_snprintf _snprintf

View File

@ -3,12 +3,12 @@
class CStringPoolMap : public CStaticMap<const char*, char*, 8, 2048> { class CStringPoolMap : public CStaticMap<const char*, char*, 8, 2048> {
protected: protected:
virtual uint32 hash(const char* const &val) { virtual uint32 hash(const char* const &val) {
unsigned int len = strlen(val); unsigned int len = Q_strlen(val);
return crc32c((const uint8*)val, len); return crc32c((const uint8*)val, len);
} }
virtual bool equals(const char* const &val1, const char* const &val2) { virtual bool equals(const char* const &val1, const char* const &val2) {
return !strcmp(val1, val2); return !Q_strcmp(val1, val2);
} }
public: public:
@ -37,7 +37,7 @@ void Ed_StrPool_Reset() {
char* Ed_StrPool_Alloc(const char* origStr) { char* Ed_StrPool_Alloc(const char* origStr) {
char str[2048]; char str[2048];
unsigned int len = strlen(origStr) + 1; unsigned int len = Q_strlen(origStr) + 1;
if (len >= ARRAYSIZE(str)) { if (len >= ARRAYSIZE(str)) {
Sys_Error(__FUNCTION__ ": Too long string allocated: %s", origStr); Sys_Error(__FUNCTION__ ": Too long string allocated: %s", origStr);
@ -60,7 +60,7 @@ char* Ed_StrPool_Alloc(const char* origStr) {
} }
*new_p = 0; *new_p = 0;
len = strlen(str) + 1; len = Q_strlen(str) + 1;
auto node = g_EdStringPool.get(str); auto node = g_EdStringPool.get(str);
if (node) { if (node) {

View File

@ -196,14 +196,14 @@ void CheckLiblistForFallbackDir(const char *pGameDir, bool bLanguage, const char
szLine[511] = 0; szLine[511] = 0;
if (!Q_strnicmp(szLine, "fallback_dir", Q_strlen("fallback_dir"))) if (!Q_strnicmp(szLine, "fallback_dir", Q_strlen("fallback_dir")))
{ {
start = strchr(szLine, '"'); start = Q_strchr(szLine, '"');
if (!start) if (!start)
{ {
FS_Close(hFile); FS_Close(hFile);
return; return;
} }
end = strchr(start + 1, '"'); end = Q_strchr(start + 1, '"');
if (!end) if (!end)
{ {
FS_Close(hFile); FS_Close(hFile);
@ -336,7 +336,7 @@ int FileSystem_SetGameDirectory(const char *pDefaultDir, const char *pGameDir)
CRehldsPlatformHolder::get()->SteamAPI_SetBreakpadAppID(GetGameAppID()); CRehldsPlatformHolder::get()->SteamAPI_SetBreakpadAppID(GetGameAppID());
bool bEnableHDPack = BEnabledHDAddon(); bool bEnableHDPack = BEnabledHDAddon();
bool bLanguage = (strlen(language) != 0 && Q_stricmp(language, "english")) ? true : false; bool bLanguage = (Q_strlen(language) != 0 && Q_stricmp(language, "english")) ? true : false;
if (!pGameDir) if (!pGameDir)
pGameDir = pDefaultDir; pGameDir = pDefaultDir;
@ -478,7 +478,7 @@ int FileSystem_AddFallbackGameDir(const char *pGameDir)
language[ARRAYSIZE(language) - 1] = 0; language[ARRAYSIZE(language) - 1] = 0;
#endif #endif
if (strlen(language) != 0 && Q_stricmp(language, "english")) if (Q_strlen(language) != 0 && Q_stricmp(language, "english"))
{ {
char temp[MAX_PATH]; char temp[MAX_PATH];
Q_sprintf(temp, "%s/%s_%s", GetBaseDirectory(), pGameDir, language); Q_sprintf(temp, "%s/%s_%s", GetBaseDirectory(), pGameDir, language);

View File

@ -342,13 +342,13 @@ void FS_Rename(const char *originalName, const char *newName)
if (FS_GetLocalPath(originalName, localPath, ARRAYSIZE(localPath))) if (FS_GetLocalPath(originalName, localPath, ARRAYSIZE(localPath)))
{ {
Q_strcpy(newPath, localPath); Q_strcpy(newPath, localPath);
cut = strstr(newPath, originalName); cut = Q_strstr(newPath, originalName);
if (cut) if (cut)
{ {
*cut = 0; *cut = 0;
#ifdef REHLDS_CHECKS #ifdef REHLDS_CHECKS
Q_strncat(newPath, newName, ARRAYSIZE(newPath) - strlen(newPath)); Q_strncat(newPath, newName, ARRAYSIZE(newPath) - Q_strlen(newPath));
newPath[ARRAYSIZE(newPath) - 1] = 0; newPath[ARRAYSIZE(newPath) - 1] = 0;
#else #else
Q_strcat(newPath, newName); Q_strcat(newPath, newName);

View File

@ -692,7 +692,7 @@ qboolean Host_FilterTime(float time)
command_line_ticrate = COM_CheckParm("-sys_ticrate"); command_line_ticrate = COM_CheckParm("-sys_ticrate");
if (command_line_ticrate > 0) if (command_line_ticrate > 0)
fps = atof(com_argv[command_line_ticrate + 1]); fps = Q_atof(com_argv[command_line_ticrate + 1]);
else else
fps = sys_ticrate.value; fps = sys_ticrate.value;

View File

@ -256,13 +256,13 @@ void Host_Motd_f(void)
buf[length] = 0; buf[length] = 0;
char* now = buf; char* now = buf;
Con_Printf("motd:"); Con_Printf("motd:");
next = strchr(now, '\n'); next = Q_strchr(now, '\n');
while (next != NULL) while (next != NULL)
{ {
*next = 0; *next = 0;
Con_Printf("%s\n", now); Con_Printf("%s\n", now);
now = next + 1; now = next + 1;
next = strchr(now, '\n'); next = Q_strchr(now, '\n');
} }
Con_Printf("%s\n", now); Con_Printf("%s\n", now);
@ -283,7 +283,7 @@ void Host_Motd_Write_f(void)
if (!g_psv.active || cmd_source != src_command || g_pcls.state) if (!g_psv.active || cmd_source != src_command || g_pcls.state)
return; return;
if (!IsSafeFileToDownload(motdfile.string) || !strstr(motdfile.string, ".txt")) if (!IsSafeFileToDownload(motdfile.string) || !Q_strstr(motdfile.string, ".txt"))
{ {
Con_Printf("Invalid motdfile name (%s)\n", motdfile.string); Con_Printf("Invalid motdfile name (%s)\n", motdfile.string);
return; return;
@ -840,7 +840,7 @@ void Host_Map(qboolean bIsDemo, char *mapstring, char *mapName, qboolean loadGam
{ {
Q_strcpy(g_pcls.spawnparms, ""); Q_strcpy(g_pcls.spawnparms, "");
for (i = 0; i < Cmd_Argc(); i++) for (i = 0; i < Cmd_Argc(); i++)
Q_strncat(g_pcls.spawnparms, Cmd_Argv(i), sizeof(g_pcls.spawnparms) - strlen(g_pcls.spawnparms) - 1); Q_strncat(g_pcls.spawnparms, Cmd_Argv(i), sizeof(g_pcls.spawnparms) - Q_strlen(g_pcls.spawnparms) - 1);
} }
} }
if (sv_gpNewUserMsgs) if (sv_gpNewUserMsgs)
@ -2317,7 +2317,7 @@ void Host_ClearSaveDirectory(void)
const char *pfn; const char *pfn;
Q_snprintf(szName, sizeof(szName), "%s", Host_SaveGameDirectory()); Q_snprintf(szName, sizeof(szName), "%s", Host_SaveGameDirectory());
Q_strncat(szName, "*.HL?", sizeof(szName) - strlen(szName) - 1); Q_strncat(szName, "*.HL?", sizeof(szName) - Q_strlen(szName) - 1);
COM_FixSlashes(szName); COM_FixSlashes(szName);
if (Sys_FindFirstPathID(szName, "GAMECONFIG") != NULL) if (Sys_FindFirstPathID(szName, "GAMECONFIG") != NULL)
@ -2326,7 +2326,7 @@ void Host_ClearSaveDirectory(void)
Q_snprintf(szName, sizeof(szName), "%s", Host_SaveGameDirectory()); Q_snprintf(szName, sizeof(szName), "%s", Host_SaveGameDirectory());
COM_FixSlashes(szName); COM_FixSlashes(szName);
FS_CreateDirHierarchy(szName, "GAMECONFIG"); FS_CreateDirHierarchy(szName, "GAMECONFIG");
Q_strncat(szName, "*.HL?", sizeof(szName) - strlen(szName) - 1); Q_strncat(szName, "*.HL?", sizeof(szName) - Q_strlen(szName) - 1);
for (pfn = Sys_FindFirstPathID(szName, "GAMECONFIG"); pfn; pfn = Sys_FindNext(NULL)) for (pfn = Sys_FindFirstPathID(szName, "GAMECONFIG"); pfn; pfn = Sys_FindNext(NULL))
{ {

View File

@ -493,7 +493,7 @@ void Mod_LoadTextures(lump_t *l)
loadmodel->textures[i] = tx; loadmodel->textures[i] = tx;
Q_memcpy(tx->name, mt->name, sizeof(tx->name)); Q_memcpy(tx->name, mt->name, sizeof(tx->name));
if (strchr(tx->name, '~')) if (Q_strchr(tx->name, '~'))
tx->name[2] = ' '; tx->name[2] = ' ';
tx->width = mt->width; tx->width = mt->width;

View File

@ -615,7 +615,7 @@ void Netchan_CheckForCompletion(netchan_t *chan, int stream, int intotalbuffers)
if (chan->sock == NS_MULTICAST) if (chan->sock == NS_MULTICAST)
{ {
char szCommand[32]; char szCommand[32];
_snprintf(szCommand, sizeof(szCommand), "listen %s\n", NET_AdrToString(chan->remote_address)); Q_snprintf(szCommand, sizeof(szCommand), "listen %s\n", NET_AdrToString(chan->remote_address));
Cbuf_AddText(szCommand); Cbuf_AddText(szCommand);
return; return;
} }
@ -1616,7 +1616,7 @@ qboolean Netchan_CopyFileFragments(netchan_t *chan)
Q_strncpy(filedir, filename, sizeof(filedir)); Q_strncpy(filedir, filename, sizeof(filedir));
#endif // REHLDS_CHECKS #endif // REHLDS_CHECKS
COM_FixSlashes(filedir); COM_FixSlashes(filedir);
pszFileName = strrchr(filedir, '\\'); pszFileName = Q_strrchr(filedir, '\\');
if (pszFileName) if (pszFileName)
{ {
*pszFileName = 0; *pszFileName = 0;

View File

@ -472,7 +472,7 @@ qboolean NET_StringToSockaddr(const char *s, struct sockaddr *sadr)
if (*colon == ':') if (*colon == ':')
{ {
*colon = 0; *colon = 0;
val = atoi(colon + 1); val = Q_atoi(colon + 1);
((sockaddr_in *)sadr)->sin_port = htons(val); ((sockaddr_in *)sadr)->sin_port = htons(val);
} }
colon++; colon++;
@ -2047,11 +2047,11 @@ void NET_Init(void)
int port = COM_CheckParm("-port"); int port = COM_CheckParm("-port");
if (port) if (port)
Cvar_SetValue("hostport", atof(com_argv[port + 1])); Cvar_SetValue("hostport", Q_atof(com_argv[port + 1]));
int clockwindow_ = COM_CheckParm("-clockwindow"); int clockwindow_ = COM_CheckParm("-clockwindow");
if (clockwindow_) if (clockwindow_)
Cvar_SetValue("clockwindow", atof(com_argv[clockwindow_ + 1])); Cvar_SetValue("clockwindow", Q_atof(com_argv[clockwindow_ + 1]));
net_message.data = (byte *)&net_message_buffer; net_message.data = (byte *)&net_message_buffer;
net_message.maxsize = sizeof(net_message_buffer); net_message.maxsize = sizeof(net_message_buffer);

View File

@ -1538,7 +1538,7 @@ int EXT_FUNC PF_precache_generic_I(char *s)
int EXT_FUNC PF_IsMapValid_I(char *mapname) int EXT_FUNC PF_IsMapValid_I(char *mapname)
{ {
char cBuf[260]; char cBuf[260];
if (!mapname || strlen(mapname) == 0) if (!mapname || Q_strlen(mapname) == 0)
return 0; return 0;
@ -2777,7 +2777,7 @@ NOXREF void QueryClientCvarValueCmd2(void)
Con_Printf("%s <player name> <cvar> <requestID>", Cmd_Argv(0)); Con_Printf("%s <player name> <cvar> <requestID>", Cmd_Argv(0));
return; return;
} }
requestID = atoi(Cmd_Argv(3)); requestID = Q_atoi(Cmd_Argv(3));
for (i = 0; i < g_psvs.maxclients; i++) for (i = 0; i < g_psvs.maxclients; i++)
{ {
cl = &g_psvs.clients[i]; cl = &g_psvs.clients[i];

View File

@ -2082,8 +2082,8 @@ int SV_CheckUserInfo(netadr_t *adr, char *userinfo, qboolean bIsReconnecting, in
} }
} }
i = strlen(userinfo); i = Q_strlen(userinfo);
if (i <= 4 || strstr(userinfo, "\\\\") || userinfo[i - 1] == '\\') if (i <= 4 || Q_strstr(userinfo, "\\\\") || userinfo[i - 1] == '\\')
{ {
SV_RejectConnection(adr, "Unknown HLTV client type.\n"); SV_RejectConnection(adr, "Unknown HLTV client type.\n");
@ -2098,7 +2098,12 @@ int SV_CheckUserInfo(netadr_t *adr, char *userinfo, qboolean bIsReconnecting, in
for (pChar = newname; *pChar; pChar++) for (pChar = newname; *pChar; pChar++)
{ {
if (*pChar == '%' || *pChar == '&') if (*pChar == '%'
|| *pChar == '&'
#ifdef REHLDS_FIXES
|| (*pChar == '+' && (isdigit(pChar[1]) || isalpha(pChar[1])))
#endif // REHLDS_FIXES
)
*pChar = ' '; *pChar = ' ';
} }
@ -3326,7 +3331,7 @@ void SV_Rcon(netadr_t *net_from_)
{ {
if (invalid == 2) if (invalid == 2)
Con_Printf("Bad rcon_password.\n"); Con_Printf("Bad rcon_password.\n");
else if (strlen(rcon_password.string) == 0) else if (Q_strlen(rcon_password.string) == 0)
Con_Printf("Bad rcon_password.\nNo password set for this server.\n"); Con_Printf("Bad rcon_password.\nNo password set for this server.\n");
else else
Con_Printf("Bad rcon_password.\n"); Con_Printf("Bad rcon_password.\n");
@ -3508,7 +3513,7 @@ qboolean SV_FilterPacket(void)
else else
{ {
if (i < numipfilters - 1) if (i < numipfilters - 1)
memmove(curFilter, &curFilter[1], sizeof(ipfilter_t) * (numipfilters - i - 1)); Q_memmove(curFilter, &curFilter[1], sizeof(ipfilter_t) * (numipfilters - i - 1));
--numipfilters; --numipfilters;
} }
@ -3520,7 +3525,7 @@ qboolean SV_FilterPacket(void)
void SV_SendBan(void) void SV_SendBan(void)
{ {
char szMessage[64]; char szMessage[64];
_snprintf(szMessage, sizeof(szMessage), "You have been banned from this server.\n"); Q_snprintf(szMessage, sizeof(szMessage), "You have been banned from this server.\n");
SZ_Clear(&net_message); SZ_Clear(&net_message);
@ -4588,7 +4593,7 @@ void SV_UpdateToReliableMessages(void)
#ifdef REHLDS_FIXES #ifdef REHLDS_FIXES
// skip update in this frame if would overflow // skip update in this frame if would overflow
if (client->sendinfo && client->sendinfo_time <= realtime && ( 1 + 1 + 4 + ( int )strlen( client->userinfo ) + 1 + 16 + g_psv.reliable_datagram.cursize <= g_psv.reliable_datagram.maxsize ) ) if (client->sendinfo && client->sendinfo_time <= realtime && ( 1 + 1 + 4 + ( int )Q_strlen( client->userinfo ) + 1 + 16 + g_psv.reliable_datagram.cursize <= g_psv.reliable_datagram.maxsize ) )
#else // REHLDS_FIXES #else // REHLDS_FIXES
if (client->sendinfo && client->sendinfo_time <= realtime) if (client->sendinfo && client->sendinfo_time <= realtime)
#endif // REHLDS_FIXES #endif // REHLDS_FIXES
@ -4794,7 +4799,12 @@ void SV_ExtractFromUserinfo(client_t *cl)
for (char *p = rawname; *p; p++) for (char *p = rawname; *p; p++)
{ {
if (*p == '%' || *p == '&') if (*p == '%'
|| *p == '&'
#ifdef REHLDS_FIXES
|| (*p == '+' && (isdigit(p[1]) || isalpha(p[1])))
#endif // REHLDS_FIXES
)
*p = ' '; *p = ' ';
} }
@ -6090,14 +6100,14 @@ void Host_Kick_f(void)
unsigned int dataLen = 0; unsigned int dataLen = 0;
for (int i = 1; i < argsStartNum; i++) for (int i = 1; i < argsStartNum; i++)
{ {
dataLen += strlen(Cmd_Argv(i)) + 1; dataLen += Q_strlen(Cmd_Argv(i)) + 1;
} }
if (isSteam) if (isSteam)
dataLen -= 4; dataLen -= 4;
p = Cmd_Args(); p = Cmd_Args();
if (dataLen <= strlen(p)) if (dataLen <= Q_strlen(p))
{ {
const char *message = dataLen + p; const char *message = dataLen + p;
if (message) if (message)
@ -6163,7 +6173,7 @@ void SV_RemoveId_f(void)
{ {
if (!Q_strnicmp(idstring, "STEAM_", 6) || !Q_strnicmp(idstring, "VALVE_", 6)) if (!Q_strnicmp(idstring, "STEAM_", 6) || !Q_strnicmp(idstring, "VALVE_", 6))
{ {
_snprintf(idstring, 0x3Fu, "%s:%s:%s", Cmd_Argv(1), Cmd_Argv(3), Cmd_Argv(5)); Q_snprintf(idstring, 0x3Fu, "%s:%s:%s", Cmd_Argv(1), Cmd_Argv(3), Cmd_Argv(5));
idstring[63] = 0; idstring[63] = 0;
} }
@ -6188,7 +6198,7 @@ void SV_RemoveId_f(void)
void SV_WriteId_f(void) void SV_WriteId_f(void)
{ {
char name[MAX_PATH]; char name[MAX_PATH];
_snprintf(name, MAX_PATH, "%s", bannedcfgfile.string); Q_snprintf(name, MAX_PATH, "%s", bannedcfgfile.string);
Con_Printf("Writing %s.\n", name); Con_Printf("Writing %s.\n", name);
FILE *f = FS_Open(name, "wt"); FILE *f = FS_Open(name, "wt");
@ -6383,7 +6393,7 @@ void SV_KickPlayer(int nPlayerSlot, int nReason)
&rgchT[1], &rgchT[1],
"\n********************************************\nYou have been automatically disconnected\nfrom this secure server because an illegal\ncheat was detected on your computer.\nRepeat violators may be permanently banned\nfrom all secure servers.\n\nFor help cleaning your system of cheats, visit:\nhttp://www.counter-strike.net/cheat.html\n********************************************\n\n" "\n********************************************\nYou have been automatically disconnected\nfrom this secure server because an illegal\ncheat was detected on your computer.\nRepeat violators may be permanently banned\nfrom all secure servers.\n\nFor help cleaning your system of cheats, visit:\nhttp://www.counter-strike.net/cheat.html\n********************************************\n\n"
); );
Netchan_Transmit(&g_psvs.clients[nPlayerSlot].netchan, strlen(rgchT) + 1, (byte *)rgchT); Netchan_Transmit(&g_psvs.clients[nPlayerSlot].netchan, Q_strlen(rgchT) + 1, (byte *)rgchT);
Q_sprintf(rgchT, "%s was automatically disconnected\nfrom this secure server.\n", client->name); Q_sprintf(rgchT, "%s was automatically disconnected\nfrom this secure server.\n", client->name);
for (int i = 0; i < g_psvs.maxclients; i++) for (int i = 0; i < g_psvs.maxclients; i++)

View File

@ -279,7 +279,7 @@ void CSteam3Server::Activate()
usSteamPort = 26900; usSteamPort = 26900;
argSteamPort = COM_CheckParm("-sport"); argSteamPort = COM_CheckParm("-sport");
if (argSteamPort > 0) if (argSteamPort > 0)
usSteamPort = atoi(com_argv[argSteamPort + 1]); usSteamPort = Q_atoi(com_argv[argSteamPort + 1]);
eSMode = eServerModeAuthenticationAndSecure; eSMode = eServerModeAuthenticationAndSecure;
if (net_local_adr.type == NA_IP) if (net_local_adr.type == NA_IP)
unIP = ntohl(*(u_long *)&net_local_adr.ip[0]); unIP = ntohl(*(u_long *)&net_local_adr.ip[0]);

View File

@ -817,27 +817,27 @@ void DLL_SetModKey(modinfo_t *pinfo, char *pkey, char *pvalue)
else if (!Q_stricmp(pkey, "version")) else if (!Q_stricmp(pkey, "version"))
{ {
pinfo->bIsMod = 1; pinfo->bIsMod = 1;
pinfo->version = atoi(pvalue); pinfo->version = Q_atoi(pvalue);
} }
else if (!Q_stricmp(pkey, "size")) else if (!Q_stricmp(pkey, "size"))
{ {
pinfo->bIsMod = 1; pinfo->bIsMod = 1;
pinfo->size = atoi(pvalue); pinfo->size = Q_atoi(pvalue);
} }
else if (!Q_stricmp(pkey, "svonly")) else if (!Q_stricmp(pkey, "svonly"))
{ {
pinfo->bIsMod = 1; pinfo->bIsMod = 1;
pinfo->svonly = atoi(pvalue) != 0; pinfo->svonly = Q_atoi(pvalue) != 0;
} }
else if (!Q_stricmp(pkey, "cldll")) else if (!Q_stricmp(pkey, "cldll"))
{ {
pinfo->bIsMod = 1; pinfo->bIsMod = 1;
pinfo->cldll = atoi(pvalue) != 0; pinfo->cldll = Q_atoi(pvalue) != 0;
} }
else if (!Q_stricmp(pkey, "secure")) else if (!Q_stricmp(pkey, "secure"))
{ {
pinfo->bIsMod = 1; pinfo->bIsMod = 1;
pinfo->secure = atoi(pvalue) != 0; pinfo->secure = Q_atoi(pvalue) != 0;
} }
else if (!Q_stricmp(pkey, "hlversion")) else if (!Q_stricmp(pkey, "hlversion"))
{ {
@ -846,14 +846,14 @@ void DLL_SetModKey(modinfo_t *pinfo, char *pkey, char *pvalue)
} }
else if (!Q_stricmp(pkey, "edicts")) else if (!Q_stricmp(pkey, "edicts"))
{ {
pinfo->num_edicts = atoi(pvalue); pinfo->num_edicts = Q_atoi(pvalue);
if (pinfo->num_edicts < 900) if (pinfo->num_edicts < 900)
pinfo->num_edicts = 900; pinfo->num_edicts = 900;
} }
else if (!Q_stricmp(pkey, "crcclientdll")) else if (!Q_stricmp(pkey, "crcclientdll"))
{ {
pinfo->bIsMod = 1; pinfo->bIsMod = 1;
pinfo->clientDllCRC = atoi(pvalue) != 0; pinfo->clientDllCRC = Q_atoi(pvalue) != 0;
} }
else if (!Q_stricmp(pkey, "type")) else if (!Q_stricmp(pkey, "type"))
{ {

View File

@ -350,7 +350,7 @@ void Sys_InitMemory(void)
i = COM_CheckParm("-heapsize"); i = COM_CheckParm("-heapsize");
if (i && i < Cmd_Argc() - 1) if (i && i < Cmd_Argc() - 1)
host_parms.memsize = atoi(Cmd_Argv(i + 1)) * 1024; host_parms.memsize = Q_atoi(Cmd_Argv(i + 1)) * 1024;
#ifdef _WIN32 #ifdef _WIN32
MEMORYSTATUS lpBuffer; MEMORYSTATUS lpBuffer;
@ -706,7 +706,7 @@ bool CDedicatedServerAPI::Init_noVirt(char *basedir, char *cmdline, CreateInterf
#else #else
Q_strcpy(this->m_OrigCmd, cmdline); Q_strcpy(this->m_OrigCmd, cmdline);
#endif #endif
if (!strstr(cmdline, "-nobreakpad")) if (!Q_strstr(cmdline, "-nobreakpad"))
{ {
CRehldsPlatformHolder::get()->SteamAPI_UseBreakpadCrashHandler(va("%d", build_number()), "Aug 8 2013", "11:17:26", 0, 0, 0); CRehldsPlatformHolder::get()->SteamAPI_UseBreakpadCrashHandler(va("%d", build_number()), "Aug 8 2013", "11:17:26", 0, 0, 0);
} }

View File

@ -80,7 +80,7 @@ int lump_sorter(const void *lump1, const void *lump2)
{ {
const texlumpinfo_t *plump1 = (const texlumpinfo_t *)lump1; const texlumpinfo_t *plump1 = (const texlumpinfo_t *)lump1;
const texlumpinfo_t *plump2 = (const texlumpinfo_t *)lump2; const texlumpinfo_t *plump2 = (const texlumpinfo_t *)lump2;
return strcmp(plump1->lump.name, plump2->lump.name); return Q_strcmp(plump1->lump.name, plump2->lump.name);
} }
/* <c6153> ../engine/textures.c:72 */ /* <c6153> ../engine/textures.c:72 */
@ -106,7 +106,7 @@ qboolean TEX_InitFromWad(char *path)
Q_strncpy(szTmpPath, path, 1022); Q_strncpy(szTmpPath, path, 1022);
szTmpPath[1022] = 0; szTmpPath[1022] = 0;
if (!strchr(szTmpPath, ';')) if (!Q_strchr(szTmpPath, ';'))
Q_strcat(szTmpPath, ";"); Q_strcat(szTmpPath, ";");
for (pszWadFile = strtok(szTmpPath, ";"); pszWadFile; pszWadFile = strtok(NULL, ";")) for (pszWadFile = strtok(szTmpPath, ";"); pszWadFile; pszWadFile = strtok(NULL, ";"))
{ {

View File

@ -190,7 +190,7 @@ NOXREF int ParseFloats(const char *pText, float *pFloat, int count)
if (pTemp) if (pTemp)
{ {
pFloat[index] = (float)atof(pTemp); pFloat[index] = (float)Q_atof(pTemp);
count--; count--;
index++; index++;
} }

View File

@ -1136,7 +1136,7 @@ NOXREF void Cache_Print_Models_And_Totals(void)
//pack names into the array. //pack names into the array.
for (cd = cache_head.next; cd != &cache_head; cd = cd->next) for (cd = cache_head.next; cd != &cache_head; cd = cd->next)
{ {
if (strstr(cd->name,".mdl")) if (Q_strstr(cd->name,".mdl"))
sortarray[i++] = cd; sortarray[i++] = cd;
} }
@ -1177,7 +1177,7 @@ NOXREF void Cache_Print_Sounds_And_Totals(void)
//pack names into the array. //pack names into the array.
for (cd = cache_head.next; cd != &cache_head; cd = cd->next) for (cd = cache_head.next; cd != &cache_head; cd = cd->next)
{ {
if (strstr(cd->name,".wav")) if (Q_strstr(cd->name,".wav"))
sortarray[i++] = cd; sortarray[i++] = cd;
} }

View File

@ -842,7 +842,7 @@
</ClCompile> </ClCompile>
<Link> <Link>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>psapi.lib;ws2_32.lib;$(ProjectDir)../lib/steam_api.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>psapi.lib;ws2_32.lib;$(ProjectDir)../lib/steam_api.lib;$(ProjectDir)../lib/libacof32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<MinimumRequiredVersion> <MinimumRequiredVersion>
</MinimumRequiredVersion> </MinimumRequiredVersion>
<ModuleDefinitionFile> <ModuleDefinitionFile>
@ -1070,7 +1070,7 @@
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>psapi.lib;ws2_32.lib;$(ProjectDir)../lib/steam_api.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>psapi.lib;ws2_32.lib;$(ProjectDir)../lib/steam_api.lib;$(ProjectDir)../lib/libacof32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<MinimumRequiredVersion> <MinimumRequiredVersion>
</MinimumRequiredVersion> </MinimumRequiredVersion>
<ModuleDefinitionFile> <ModuleDefinitionFile>

View File

@ -28,7 +28,7 @@ CRehldsFlightRecorder::CRehldsFlightRecorder() {
//initialize meta region header //initialize meta region header
char* metaPos = (char*)m_MetaRegion; char* metaPos = (char*)m_MetaRegion;
const char* metaSignature = "REHLDS_FLIGHTREC_META"; const char* metaSignature = "REHLDS_FLIGHTREC_META";
metaPos += sprintf(metaPos, "%s%s%s:", metaSignature, metaSignature, metaSignature); metaPos += Q_sprintf(metaPos, "%s%s%s:", metaSignature, metaSignature, metaSignature);
m_pMetaHeader = (meta_header*)metaPos; m_pMetaHeader = (meta_header*)metaPos;
metaPos += sizeof(meta_header); metaPos += sizeof(meta_header);
@ -42,7 +42,7 @@ CRehldsFlightRecorder::CRehldsFlightRecorder() {
//initialize data region header //initialize data region header
char* dataPos = (char*)m_DataRegion; char* dataPos = (char*)m_DataRegion;
const char* dataSignature = "REHLDS_FLIGHTREC_DATA"; const char* dataSignature = "REHLDS_FLIGHTREC_DATA";
dataPos += sprintf(dataPos, "%s%s%s:", dataSignature, dataSignature, dataSignature); dataPos += Q_sprintf(dataPos, "%s%s%s:", dataSignature, dataSignature, dataSignature);
m_pDataHeader = (data_header*)dataPos; m_pDataHeader = (data_header*)dataPos;
dataPos += sizeof(data_header); dataPos += sizeof(data_header);
@ -84,7 +84,7 @@ void CRehldsFlightRecorder::MoveToStart() {
m_pDataHeader->prevItrLastPos = m_pRecorderState->wpos; m_pDataHeader->prevItrLastPos = m_pRecorderState->wpos;
m_pRecorderState->wpos = 0; m_pRecorderState->wpos = 0;
} else { } else {
memcpy(m_DataRegionPtr, m_DataRegionPtr + m_pRecorderState->lastMsgBeginPos, m_pRecorderState->wpos - m_pRecorderState->lastMsgBeginPos); Q_memcpy(m_DataRegionPtr, m_DataRegionPtr + m_pRecorderState->lastMsgBeginPos, m_pRecorderState->wpos - m_pRecorderState->lastMsgBeginPos);
m_pRecorderState->wpos -= m_pRecorderState->lastMsgBeginPos; m_pRecorderState->wpos -= m_pRecorderState->lastMsgBeginPos;
m_pDataHeader->prevItrLastPos = m_pRecorderState->lastMsgBeginPos; m_pDataHeader->prevItrLastPos = m_pRecorderState->lastMsgBeginPos;
m_pRecorderState->lastMsgBeginPos = 0; m_pRecorderState->lastMsgBeginPos = 0;
@ -157,12 +157,12 @@ void CRehldsFlightRecorder::WriteBuffer(const void* data, unsigned int len) {
MoveToStart(); MoveToStart();
} }
memcpy(m_DataRegionPtr + m_pRecorderState->wpos, data, len); Q_memcpy(m_DataRegionPtr + m_pRecorderState->wpos, data, len);
m_pRecorderState->wpos += len; m_pRecorderState->wpos += len;
} }
void CRehldsFlightRecorder::WriteString(const char* s) { void CRehldsFlightRecorder::WriteString(const char* s) {
WriteBuffer(s, strlen(s) + 1); WriteBuffer(s, Q_strlen(s) + 1);
} }
void CRehldsFlightRecorder::WriteInt8(int8 v) { void CRehldsFlightRecorder::WriteInt8(int8 v) {

View File

@ -21,7 +21,7 @@
AbstractHookChainRegistry::AbstractHookChainRegistry() AbstractHookChainRegistry::AbstractHookChainRegistry()
{ {
memset(m_Hooks, 0, sizeof(m_Hooks)); Q_memset(m_Hooks, 0, sizeof(m_Hooks));
m_NumHooks = 0; m_NumHooks = 0;
} }
@ -39,7 +39,7 @@ void AbstractHookChainRegistry::removeHook(void* hookFunc) {
for (int i = 0; i < m_NumHooks; i++) { for (int i = 0; i < m_NumHooks; i++) {
if (hookFunc == m_Hooks[i]) { if (hookFunc == m_Hooks[i]) {
if(--m_NumHooks != i) if(--m_NumHooks != i)
memmove(&m_Hooks[i], &m_Hooks[i + 1], (m_NumHooks - i) * sizeof(m_Hooks[0])); Q_memmove(&m_Hooks[i], &m_Hooks[i + 1], (m_NumHooks - i) * sizeof(m_Hooks[0]));
return; return;
} }

View File

@ -1,16 +1,16 @@
#include "precompiled.h" #include "precompiled.h"
cvar_t sv_rehlds_movecmdrate_max_avg = { "sv_rehlds_movecmdrate_max_avg", "750", 0, 750.0f, NULL }; cvar_t sv_rehlds_movecmdrate_max_avg = { "sv_rehlds_movecmdrate_max_avg", "750", 0, 750.0f, NULL };
cvar_t sv_rehlds_movecmdrate_max_burst = { "sv_rehlds_movecmdrate_max_burst", "1125", 0, 1125.0f, NULL }; cvar_t sv_rehlds_movecmdrate_max_burst = { "sv_rehlds_movecmdrate_max_burst", "1500", 0, 1500.0f, NULL };
cvar_t sv_rehlds_stringcmdrate_max_avg = {"sv_rehlds_stringcmdrate_max_avg", "64", 0, 32.0f, NULL}; cvar_t sv_rehlds_stringcmdrate_max_avg = {"sv_rehlds_stringcmdrate_max_avg", "64", 0, 64.0f, NULL};
cvar_t sv_rehlds_stringcmdrate_max_burst = {"sv_rehlds_stringcmdrate_max_burst", "96", 0, 80.0f, NULL}; cvar_t sv_rehlds_stringcmdrate_max_burst = {"sv_rehlds_stringcmdrate_max_burst", "128", 0, 128.0f, NULL};
CMoveCommandRateLimiter g_MoveCommandRateLimiter; CMoveCommandRateLimiter g_MoveCommandRateLimiter;
CStringCommandsRateLimiter g_StringCommandsRateLimiter; CStringCommandsRateLimiter g_StringCommandsRateLimiter;
CMoveCommandRateLimiter::CMoveCommandRateLimiter() { CMoveCommandRateLimiter::CMoveCommandRateLimiter() {
memset(m_AverageMoveCmdRate, 0, sizeof(m_AverageMoveCmdRate)); Q_memset(m_AverageMoveCmdRate, 0, sizeof(m_AverageMoveCmdRate));
memset(m_CurrentMoveCmds, 0, sizeof(m_CurrentMoveCmds)); Q_memset(m_CurrentMoveCmds, 0, sizeof(m_CurrentMoveCmds));
m_LastCheckTime = 0.0; m_LastCheckTime = 0.0;
} }
@ -74,8 +74,8 @@ void CMoveCommandRateLimiter::CheckAverageRate(unsigned int clientId) {
} }
CStringCommandsRateLimiter::CStringCommandsRateLimiter() { CStringCommandsRateLimiter::CStringCommandsRateLimiter() {
memset(m_AverageStringCmdRate, 0, sizeof(m_AverageStringCmdRate)); Q_memset(m_AverageStringCmdRate, 0, sizeof(m_AverageStringCmdRate));
memset(m_CurrentStringCmds, 0, sizeof(m_CurrentStringCmds)); Q_memset(m_CurrentStringCmds, 0, sizeof(m_CurrentStringCmds));
m_LastCheckTime = 0.0; m_LastCheckTime = 0.0;
} }