Missed a couple +1s here and there

This commit is contained in:
Glenn Smith 2018-03-07 00:44:28 -05:00
parent a94e0c6d81
commit 751ccae12d
7 changed files with 17 additions and 18 deletions

View file

@ -908,7 +908,7 @@ ConsoleFunction(echoThru, const char*, 2, 0, "(string passthru, string text...)"
char *ret = Con::getReturnBuffer(len + 1);
ret[0] = 0;
for(i = 2; i < argc; i++)
dStrcat(ret, argv[i], len);
dStrcat(ret, argv[i], len + 1);
Con::printf("%s -- [%s]", ret, argv[1].getStringValue());
ret[0] = 0;
@ -928,7 +928,7 @@ ConsoleFunction(warnThru, const char*, 2, 0, "(string passthru, string text...)"
char *ret = Con::getReturnBuffer(len + 1);
ret[0] = 0;
for(i = 2; i < argc; i++)
dStrcat(ret, argv[i], len);
dStrcat(ret, argv[i], len + 1);
Con::warnf("%s -- [%s]", ret, argv[1].getStringValue());
ret[0] = 0;
@ -948,7 +948,7 @@ ConsoleFunction(errorThru, const char*, 2, 0, "(string passthru, string text...)
char *ret = Con::getReturnBuffer(len + 1);
ret[0] = 0;
for(i = 2; i < argc; i++)
dStrcat(ret, argv[i], len);
dStrcat(ret, argv[i], len + 1);
Con::errorf("%s -- [%s]", ret, argv[1].getStringValue());
ret[0] = 0;

View file

@ -287,7 +287,7 @@ DefineEngineFunction(filterString, const char *, (const char* baseString, const
replaceStr = gBadWordFilter->getDefaultReplaceStr();
char *ret = Con::getReturnBuffer(dStrlen(baseString) + 1);
dStrcpy(ret, baseString, dStrlen(baseString));
dStrcpy(ret, baseString, dStrlen(baseString) + 1);
gBadWordFilter->filterString(ret, replaceStr);
return ret;
}

View file

@ -833,7 +833,7 @@ void SimXMLDocument::setObjectAttributes(const char* objectID)
continue;
FrameTemp<char> valCopy( dStrlen( val ) + 1 );
dStrcpy( (char *)valCopy, val, dStrlen(val) + 1 );
dStrcpy( (char *)valCopy, val, valCopy.size() );
if (!pObject->writeField(itr->pFieldname, valCopy))
continue;
@ -873,7 +873,7 @@ void SimXMLDocument::setObjectAttributes(const char* objectID)
// continue;
// FrameTemp<char> valCopy( dStrlen( val ) + 1 );
// dStrcpy( (char *)valCopy, val, dStrlen(val) + 1 );
// dStrcpy( (char *)valCopy, val, valCopy.size() );
// if (!pObject->writeField(itr->pFieldname, valCopy))
// continue;

View file

@ -2176,8 +2176,8 @@ bool expandPath(char* pDstPath, U32 size, const char* pSrcPath, const char* pWor
}
// Format the output path.
dStrcat(pathBuffer, "/", sizeof(pathBuffer) - 1 - strlen(pathBuffer));
dStrcat(pathBuffer, pSrc, sizeof(pathBuffer) - 1 - strlen(pathBuffer));
dStrncat(pathBuffer, "/", sizeof(pathBuffer) - 1 - strlen(pathBuffer));
dStrncat(pathBuffer, pSrc, sizeof(pathBuffer) - 1 - strlen(pathBuffer));
// Are we ensuring the trailing slash?
if (ensureTrailingSlash)

View file

@ -967,10 +967,10 @@ void PersistenceManager::updateToken( const U32 lineNumber, const U32 linePositi
// Build the new line with the
// preString + newValue + postString
dStrcat(newLine, preString, newLineLen);
dStrcat(newLine, preString, newLineLen + 1);
if ( newValue )
dStrcat(newLine, newValue, newLineLen);
dStrcat(newLine, postString, newLineLen);
dStrcat(newLine, newValue, newLineLen + 1);
dStrcat(newLine, postString, newLineLen + 1);
// Clear our existing line
if (mLineBuffer[lineNumber])

View file

@ -2625,8 +2625,8 @@ DefineConsoleMethod( GuiEditCtrl, getSelectionGlobalBounds, const char*, (), , "
RectI bounds = object->getSelectionGlobalBounds();
String str = String::ToString( "%i %i %i %i", bounds.point.x, bounds.point.y, bounds.extent.x, bounds.extent.y );
char* buffer = Con::getReturnBuffer( str.length() );
dStrcpy( buffer, str.c_str(), str.length() );
char* buffer = Con::getReturnBuffer( str.size() );
dStrcpy( buffer, str.c_str(), str.size() );
return buffer;
}

View file

@ -158,8 +158,7 @@ bool dPathCopy(const char *fromName, const char *toName, bool nooverwrite)
Platform::clearExcludedDirectories();
S32 tempBufSize = to.size * 3 + MAX_PATH * 3;
TempAlloc< char > tempBuf( tempBufSize );
TempAlloc< char > tempBuf( to.size * 3 + MAX_PATH * 3 );
// Create all the directories.
for (S32 i = 0; i < directoryInfo.size(); i++)
@ -169,7 +168,7 @@ bool dPathCopy(const char *fromName, const char *toName, bool nooverwrite)
char* toDir = tempBuf;
Platform::makeFullPathName(fromDir + dStrlen(fromName) + (dStricmp(fromDir, fromName) ? 1 : 0), tempBuf, tempBuf.size, toName);
if(*(toDir + dStrlen(toDir) - 1) != '/')
dStrcat(toDir, "/", tempBufSize);
dStrcat(toDir, "/", tempBuf.size);
forwardslash(toDir);
if (!Platform::createPath(toDir))
@ -192,8 +191,8 @@ bool dPathCopy(const char *fromName, const char *toName, bool nooverwrite)
char* toFile = tempBuf;
Platform::makeFullPathName(fileInfo[i].pFullPath + dStrlen(fromName) + (dStricmp(fileInfo[i].pFullPath, fromName) ? 1 : 0), tempBuf, tempBuf.size, toName);
dStrcat(toFile, "/", tempBufSize);
dStrcat(toFile, fileInfo[i].pFileName, tempBufSize);
dStrcat(toFile, "/", tempBuf.size);
dStrcat(toFile, fileInfo[i].pFileName, tempBuf.size);
backslash(fromFile);
backslash(toFile);