Skip to content

Commit 02fdae5

Browse files
author
Bart Roossien
committed
Adding improvements based on feedback
1 parent 84f15c6 commit 02fdae5

File tree

34 files changed

+86
-86
lines changed

34 files changed

+86
-86
lines changed

Core/GameEngine/Source/Common/System/AsciiString.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ void AsciiString::ensureUniqueBufferOfSize(int numCharsNeeded, Bool preserveData
140140
m_data->peek()[usableNumChars] = 0;
141141
}
142142
if (strToCat)
143-
strlcat(m_data->peek(), strToCat, usableNumChars + 1);
143+
strcat(m_data->peek(), strToCat);
144144
return;
145145
}
146146

@@ -169,7 +169,7 @@ void AsciiString::ensureUniqueBufferOfSize(int numCharsNeeded, Bool preserveData
169169
newData->peek()[usableNumChars] = 0;
170170
}
171171
if (strToCat)
172-
strlcat(newData->peek(), strToCat, usableNumChars + 1);
172+
strcat(newData->peek(), strToCat);
173173

174174
releaseBuffer();
175175
m_data = newData;

Core/GameEngine/Source/Common/System/Debug.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -210,14 +210,14 @@ static const char *getCurrentTickString(void)
210210
Empty the buffer passed in, then optionally prepend the current TickCount
211211
value in string form, depending on the setting of theDebugFlags.
212212
*/
213-
static void prepBuffer(char *buffer, int size)
213+
static void prepBuffer(char *buffer)
214214
{
215215
buffer[0] = 0;
216216
#ifdef ALLOW_DEBUG_UTILS
217217
if (theDebugFlags & DEBUG_FLAG_PREPEND_TIME)
218218
{
219219
strcpy(buffer, getCurrentTickString());
220-
strlcat(buffer, " ", size);
220+
strcat(buffer, " ");
221221
}
222222
#endif
223223
}
@@ -436,7 +436,7 @@ void DebugLog(const char *format, ...)
436436
if (theDebugFlags == 0)
437437
MessageBoxWrapper("DebugLog - Debug not inited properly", "", MB_OK|MB_TASKMODAL);
438438

439-
prepBuffer(theBuffer, ARRAY_SIZE(theBuffer));
439+
prepBuffer(theBuffer);
440440

441441
va_list args;
442442
va_start(args, format);
@@ -508,8 +508,8 @@ void DebugCrash(const char *format, ...)
508508
// make it big to avoid weird overflow bugs in debug mode
509509
char theCrashBuffer[ LARGE_BUFFER ];
510510

511-
prepBuffer(theCrashBuffer, LARGE_BUFFER);
512-
strlcat(theCrashBuffer, "ASSERTION FAILURE: ", LARGE_BUFFER);
511+
prepBuffer(theCrashBuffer);
512+
strlcat(theCrashBuffer, "ASSERTION FAILURE: ", ARRAY_SIZE(theCrashBuffer));
513513

514514
va_list arg;
515515
va_start(arg, format);
@@ -538,7 +538,7 @@ void DebugCrash(const char *format, ...)
538538
#endif
539539
}
540540

541-
strlcat(theCrashBuffer, "\n\nAbort->exception; Retry->debugger; Ignore->continue", LARGE_BUFFER);
541+
strlcat(theCrashBuffer, "\n\nAbort->exception; Retry->debugger; Ignore->continue", ARRAY_SIZE(theCrashBuffer));
542542

543543
const int result = doCrashBox(theCrashBuffer, useLogging);
544544

@@ -737,9 +737,9 @@ void ReleaseCrash(const char *reason)
737737
}
738738

739739
strcpy(prevbuf, TheGlobalData->getPath_UserData().str());
740-
strlcat(prevbuf, RELEASECRASH_FILE_NAME_PREV, _MAX_PATH);
740+
strlcat(prevbuf, RELEASECRASH_FILE_NAME_PREV, ARRAY_SIZE(prevbuf));
741741
strcpy(curbuf, TheGlobalData->getPath_UserData().str());
742-
strlcat(curbuf, RELEASECRASH_FILE_NAME, _MAX_PATH);
742+
strlcat(curbuf, RELEASECRASH_FILE_NAME, ARRAY_SIZE(curbuf));
743743

744744
remove(prevbuf);
745745
rename(curbuf, prevbuf);
@@ -826,9 +826,9 @@ void ReleaseCrashLocalized(const AsciiString& p, const AsciiString& m)
826826
char curbuf[ _MAX_PATH ];
827827

828828
strcpy(prevbuf, TheGlobalData->getPath_UserData().str());
829-
strlcat(prevbuf, RELEASECRASH_FILE_NAME_PREV, _MAX_PATH);
829+
strlcat(prevbuf, RELEASECRASH_FILE_NAME_PREV, ARRAY_SIZE(prevbuf));
830830
strcpy(curbuf, TheGlobalData->getPath_UserData().str());
831-
strlcat(curbuf, RELEASECRASH_FILE_NAME, _MAX_PATH);
831+
strlcat(curbuf, RELEASECRASH_FILE_NAME, ARRAY_SIZE(curbuf));
832832

833833
remove(prevbuf);
834834
rename(curbuf, prevbuf);

Core/GameEngine/Source/Common/System/GameMemory.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2976,7 +2976,7 @@ void MemoryPoolFactory::memoryPoolUsageReport( const char* filename, FILE *appen
29762976
{
29772977
char tmp[256];
29782978
strcpy(tmp,filename);
2979-
strlcat(tmp,".csv", ARRAY_SIZE(tmp));
2979+
strlcat(tmp, ".csv", ARRAY_SIZE(tmp));
29802980
perfStatsFile = fopen(tmp, "w");
29812981
}
29822982
else

Core/GameEngine/Source/Common/System/GameMemoryInit.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ void userMemoryManagerInitPools()
123123
}
124124
--pEnd;
125125
}
126-
strlcat(buf, "\\Data\\INI\\MemoryPools.ini", _MAX_PATH);
126+
strlcat(buf, "\\Data\\INI\\MemoryPools.ini", ARRAY_SIZE(buf));
127127

128128
FILE* fp = fopen(buf, "r");
129129
if (fp)

Core/Libraries/Source/WWVegas/WW3D2/hcanim.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,8 @@ int HCompressedAnimClass::Load_W3D(ChunkLoadClass & cload)
257257
cload.Close_Chunk();
258258

259259
strcpy(Name,aheader.HierarchyName);
260-
strlcat(Name,".", ARRAY_SIZE(Name));
261-
strlcat(Name,aheader.Name, ARRAY_SIZE(Name));
260+
strlcat(Name, ".", ARRAY_SIZE(Name));
261+
strlcat(Name, aheader.Name, ARRAY_SIZE(Name));
262262

263263
// TSS chasing crash bug 05/26/99
264264
WWASSERT(HierarchyName != NULL);

Core/Libraries/Source/WWVegas/WW3D2/hmdldef.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ bool HModelDefClass::read_connection(ChunkLoadClass & cload,HmdlNodeDefStruct *
236236
}
237237

238238
strcpy(node->RenderObjName,ModelName);
239-
strlcat(node->RenderObjName,".", ARRAY_SIZE(node->RenderObjName));
239+
strlcat(node->RenderObjName, ".", ARRAY_SIZE(node->RenderObjName));
240240
strlcat(node->RenderObjName, con.RenderObjName, ARRAY_SIZE(node->RenderObjName));
241241

242242
if (pre30) {

Core/Libraries/Source/WWVegas/WWDownload/FTP.CPP

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
#include <time.h>
3737
#include <direct.h>
3838
#include <errno.h>
39-
#include <stringex.h>
39+
#include <WWCommon.h>
4040
//#include "wlib/wstring.h"
4141

4242
#include "DownloadDebug.h"
@@ -679,7 +679,7 @@ HRESULT Cftp::FindFile( LPCSTR szRemoteFileName, int * piSize )
679679
_splitpath( szRemoteFileName, NULL, m_szRemoteFilePath+strlen(m_szRemoteFilePath),
680680
m_szRemoteFileName, ext );
681681

682-
strlcat(m_szRemoteFileName, ext, sizeof(m_szRemoteFileName));
682+
strlcat(m_szRemoteFileName, ext, ARRAY_SIZE(m_szRemoteFileName));
683683

684684
for( i = 0; i < (int)strlen( m_szRemoteFilePath ); i++ )
685685
{

Core/Libraries/Source/WWVegas/WWLib/Except.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ char const * Last_Error_Text(void)
225225
static void Add_Txt (char const *txt)
226226
{
227227
if (strlen(ExceptionText) + strlen(txt) < ARRAY_SIZE(ExceptionText) - 1) {
228-
strlcat(ExceptionText, txt, ARRAY_SIZE(ExceptionText));
228+
strcat(ExceptionText, txt);
229229
}
230230
#if (0)
231231
/*

Core/Libraries/Source/debug/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ target_include_directories(core_debug INTERFACE
3333
)
3434

3535
target_link_libraries(core_debug PRIVATE
36-
core_wwcommon
3736
core_config
37+
core_wwcommon
3838
corei_always
3939
)

Core/Libraries/Source/debug/debug_debug.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#include <stdlib.h>
3131
#include <Utility/stdio_adapter.h>
3232
#include <string.h>
33-
#include <stringex.h>
33+
#include <WWCommon.h>
3434
#include <new> // needed for placement new prototype
3535

3636
// a little dummy variable that makes the linker actually include
@@ -347,7 +347,7 @@ bool Debug::AssertDone(void)
347347
"time being (stops logging this assertion as well).";
348348
char *help=(char *)DebugAllocMemory(ioBuffer[curType].used+strlen(addInfo)+1);
349349
strcpy(help,ioBuffer[curType].buffer+82);
350-
strlcat(help, addInfo, sizeof(help));
350+
strlcat(help, addInfo, ARRAY_SIZE(help));
351351

352352
// First hit? Then do a stack trace
353353
if (curFrameEntry->hits==1)
@@ -611,7 +611,7 @@ bool Debug::CrashDone(bool die)
611611
#endif
612612
char *help=(char *)DebugAllocMemory(ioBuffer[curType].used+strlen(addInfo)+1);
613613
strcpy(help,ioBuffer[curType].buffer+82);
614-
strlcat(help,addInfo, sizeof(help));
614+
strlcat(help, addInfo, ARRAY_SIZE(help));
615615

616616
// First hit? Then do a stack trace
617617
if (curFrameEntry->hits==1)

0 commit comments

Comments
 (0)