Skip to content

Commit 79b76ef

Browse files
author
G_Moris
committed
Fixed part 2
1 parent 1f10a85 commit 79b76ef

File tree

2 files changed

+9
-16
lines changed

2 files changed

+9
-16
lines changed

Client/core/CCommands.cpp

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,9 @@ bool CCommands::Execute(const char* szCommandLine)
8484
bool CCommands::Execute(const char* szCommand, const char* szParametersIn, bool bHandleRemotely, bool bIsScriptedBind)
8585
{
8686
// Copy szParametersIn so the contents can be changed
87-
const char* szParameters = NULL;
87+
char* szParameters = nullptr;
8888
if (szParametersIn)
89-
{
90-
size_t sizeParameters = strlen(szParametersIn) + 1;
91-
szParameters = static_cast<char*>(alloca(sizeParameters));
92-
memcpy(const_cast<char*>(szParameters), szParametersIn, sizeParameters);
93-
}
89+
std::strcpy(szParameters, szParametersIn);
9490

9591
// HACK: if its a 'chatboxsay' command, use the next parameter
9692
// Is the command "say" and the arguments start with /? (command comes from the chatbox)
@@ -108,15 +104,12 @@ bool CCommands::Execute(const char* szCommand, const char* szParametersIn, bool
108104

109105
// Split it into command and arguments
110106
szCommand = strtok(szBuffer, " ");
111-
szParameters = strtok(NULL, "\0");
112-
if (szCommand == NULL)
113-
{
107+
szParameters = strtok(nullptr, "\0");
108+
if (!szCommand)
114109
return false;
115-
}
116-
if (szParameters == NULL)
117-
{
118-
szParameters = "";
119-
}
110+
111+
if (!szParameters)
112+
std::strcpy(szParameters, "");
120113
}
121114
}
122115
else

Shared/sdk/SharedUtil.Logging.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@ void SharedUtil::CycleFile(const SString& strPathFilename, uint uiCycleThreshKB,
167167
// Rename older files .1 .2 etc
168168
uint uiNew = uiNumBackups - 1 - i;
169169
uint uiOld = uiNumBackups - i;
170-
SString strFilenameNewer = strPathFilename + (uiNew ? SString(".%d", uiNew).c_str() : "");
171-
SString strFilenameOlder = strPathFilename + (uiOld ? SString(".%d", uiOld).c_str() : "");
170+
SString strFilenameNewer = strPathFilename + (uiNew ? SString(".%d", uiNew) : SStringX(""));
171+
SString strFilenameOlder = strPathFilename + (uiOld ? SString(".%d", uiOld) : SStringX(""));
172172

173173
FileDelete(strFilenameOlder);
174174
FileRename(strFilenameNewer, strFilenameOlder);

0 commit comments

Comments
 (0)