mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 03:33:48 +00:00
Merge branch 'development' of https://github.com/GarageGames/Torque3D into memberMess
# Conflicts: # Engine/source/console/consoleFunctions.cpp
This commit is contained in:
commit
28e509af1a
158 changed files with 2954 additions and 709 deletions
|
|
@ -2340,8 +2340,9 @@ static int Sc_ScanString(int ret)
|
|||
if (!collapseEscape(CMDtext + 1))
|
||||
return -1;
|
||||
|
||||
char* buffer = (char*)consoleAlloc(dStrlen(CMDtext));
|
||||
dStrcpy(buffer, CMDtext + 1);
|
||||
dsize_t bufferLen = dStrlen(CMDtext);
|
||||
char* buffer = (char*)consoleAlloc(bufferLen);
|
||||
dStrcpy(buffer, CMDtext + 1, bufferLen);
|
||||
|
||||
CMDlval.str = MakeToken< char* >(buffer, lineIndex);
|
||||
return ret;
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ inline int isatty(int) { return 0; }
|
|||
buf[n++] = (char) c; \
|
||||
result = n; \
|
||||
}
|
||||
|
||||
|
||||
// General helper stuff.
|
||||
static int lineIndex;
|
||||
|
||||
|
|
@ -411,10 +411,11 @@ static int Sc_ScanString(int ret)
|
|||
CMDtext[CMDleng - 1] = 0;
|
||||
if(!collapseEscape(CMDtext+1))
|
||||
return -1;
|
||||
|
||||
char* buffer = ( char* ) consoleAlloc( dStrlen( CMDtext ) );
|
||||
dStrcpy( buffer, CMDtext + 1 );
|
||||
|
||||
|
||||
dsize_t bufferLen = dStrlen( CMDtext );
|
||||
char* buffer = ( char* ) consoleAlloc( bufferLen );
|
||||
dStrcpy( buffer, CMDtext + 1, bufferLen );
|
||||
|
||||
CMDlval.str = MakeToken< char* >( buffer, lineIndex );
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -833,7 +833,7 @@ void SimXMLDocument::setObjectAttributes(const char* objectID)
|
|||
continue;
|
||||
|
||||
FrameTemp<char> valCopy( dStrlen( val ) + 1 );
|
||||
dStrcpy( (char *)valCopy, val );
|
||||
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 );
|
||||
// dStrcpy( (char *)valCopy, val, valCopy.size() );
|
||||
|
||||
// if (!pObject->writeField(itr->pFieldname, valCopy))
|
||||
// continue;
|
||||
|
|
|
|||
|
|
@ -238,10 +238,11 @@ StrConstNode *StrConstNode::alloc(S32 lineNumber, char *str, bool tag, bool doc)
|
|||
StrConstNode *ret = (StrConstNode *)consoleAlloc(sizeof(StrConstNode));
|
||||
constructInPlace(ret);
|
||||
ret->dbgLineNumber = lineNumber;
|
||||
ret->str = (char *)consoleAlloc(dStrlen(str) + 1);
|
||||
dsize_t retStrLen = dStrlen(str) + 1;
|
||||
ret->str = (char *)consoleAlloc(retStrLen);
|
||||
ret->tag = tag;
|
||||
ret->doc = doc;
|
||||
dStrcpy(ret->str, str);
|
||||
dStrcpy(ret->str, str, retStrLen);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,19 +95,17 @@ static void getFieldComponent(SimObject* object, StringTableEntry field, const c
|
|||
|
||||
// Translate xyzw and rgba into the indexed component
|
||||
// of the variable or field.
|
||||
//
|
||||
// Review: Should we use strncpy to prevent a buffer overflow?
|
||||
if (subField == xyzw[0] || subField == rgba[0])
|
||||
dStrcpy(val, StringUnit::getUnit(prevVal, 0, " \t\n"));
|
||||
dStrcpy(val, StringUnit::getUnit(prevVal, 0, " \t\n"), 128);
|
||||
|
||||
else if (subField == xyzw[1] || subField == rgba[1])
|
||||
dStrcpy(val, StringUnit::getUnit(prevVal, 1, " \t\n"));
|
||||
dStrcpy(val, StringUnit::getUnit(prevVal, 1, " \t\n"), 128);
|
||||
|
||||
else if (subField == xyzw[2] || subField == rgba[2])
|
||||
dStrcpy(val, StringUnit::getUnit(prevVal, 2, " \t\n"));
|
||||
dStrcpy(val, StringUnit::getUnit(prevVal, 2, " \t\n"), 128);
|
||||
|
||||
else if (subField == xyzw[3] || subField == rgba[3])
|
||||
dStrcpy(val, StringUnit::getUnit(prevVal, 3, " \t\n"));
|
||||
dStrcpy(val, StringUnit::getUnit(prevVal, 3, " \t\n"), 128);
|
||||
|
||||
else
|
||||
val[0] = 0;
|
||||
|
|
@ -157,19 +155,17 @@ static void setFieldComponent(SimObject* object, StringTableEntry field, const c
|
|||
|
||||
// Insert the value into the specified
|
||||
// component of the string.
|
||||
//
|
||||
// Review: Should we use strncpy to prevent a buffer overflow?
|
||||
if (subField == xyzw[0] || subField == rgba[0])
|
||||
dStrcpy(val, StringUnit::setUnit(prevVal, 0, strValue, " \t\n"));
|
||||
dStrcpy(val, StringUnit::setUnit(prevVal, 0, strValue, " \t\n"), 128);
|
||||
|
||||
else if (subField == xyzw[1] || subField == rgba[1])
|
||||
dStrcpy(val, StringUnit::setUnit(prevVal, 1, strValue, " \t\n"));
|
||||
dStrcpy(val, StringUnit::setUnit(prevVal, 1, strValue, " \t\n"), 128);
|
||||
|
||||
else if (subField == xyzw[2] || subField == rgba[2])
|
||||
dStrcpy(val, StringUnit::setUnit(prevVal, 2, strValue, " \t\n"));
|
||||
dStrcpy(val, StringUnit::setUnit(prevVal, 2, strValue, " \t\n"), 128);
|
||||
|
||||
else if (subField == xyzw[3] || subField == rgba[3])
|
||||
dStrcpy(val, StringUnit::setUnit(prevVal, 3, strValue, " \t\n"));
|
||||
dStrcpy(val, StringUnit::setUnit(prevVal, 3, strValue, " \t\n"), 128);
|
||||
|
||||
if (val[0] != 0)
|
||||
{
|
||||
|
|
@ -420,13 +416,13 @@ exitLabel:
|
|||
if (gEvalState.traceOn)
|
||||
{
|
||||
sTraceBuffer[0] = 0;
|
||||
dStrcat(sTraceBuffer, "Leaving ");
|
||||
dStrcat(sTraceBuffer, "Leaving ", 1024);
|
||||
|
||||
if (packageName)
|
||||
{
|
||||
dStrcat(sTraceBuffer, "[");
|
||||
dStrcat(sTraceBuffer, packageName);
|
||||
dStrcat(sTraceBuffer, "]");
|
||||
dStrcat(sTraceBuffer, "[", 1024);
|
||||
dStrcat(sTraceBuffer, packageName, 1024);
|
||||
dStrcat(sTraceBuffer, "]", 1024);
|
||||
}
|
||||
if (thisNamespace && thisNamespace->mName)
|
||||
{
|
||||
|
|
@ -471,13 +467,13 @@ void CodeInterpreter::parseArgs(U32 &ip)
|
|||
if (gEvalState.traceOn)
|
||||
{
|
||||
sTraceBuffer[0] = 0;
|
||||
dStrcat(sTraceBuffer, "Entering ");
|
||||
dStrcat(sTraceBuffer, "Entering ", 1024);
|
||||
|
||||
if (mExec.packageName)
|
||||
{
|
||||
dStrcat(sTraceBuffer, "[");
|
||||
dStrcat(sTraceBuffer, mExec.packageName);
|
||||
dStrcat(sTraceBuffer, "]");
|
||||
dStrcat(sTraceBuffer, "[", 1024);
|
||||
dStrcat(sTraceBuffer, mExec.packageName, 1024);
|
||||
dStrcat(sTraceBuffer, "]", 1024);
|
||||
}
|
||||
if (mExec.thisNamespace && mExec.thisNamespace->mName)
|
||||
{
|
||||
|
|
@ -491,11 +487,11 @@ void CodeInterpreter::parseArgs(U32 &ip)
|
|||
}
|
||||
for (S32 i = 0; i < wantedArgc; i++)
|
||||
{
|
||||
dStrcat(sTraceBuffer, mExec.argv[i + 1]);
|
||||
dStrcat(sTraceBuffer, mExec.argv[i + 1], 1024);
|
||||
if (i != wantedArgc - 1)
|
||||
dStrcat(sTraceBuffer, ", ");
|
||||
dStrcat(sTraceBuffer, ", ", 1024);
|
||||
}
|
||||
dStrcat(sTraceBuffer, ")");
|
||||
dStrcat(sTraceBuffer, ")", 1024);
|
||||
Con::printf("%s", sTraceBuffer);
|
||||
}
|
||||
|
||||
|
|
@ -1729,7 +1725,7 @@ OPCodeReturn CodeInterpreter::op_setcurfield(U32 &ip)
|
|||
{
|
||||
// Save the previous field for parsing vector fields.
|
||||
mPrevField = mCurField;
|
||||
dStrcpy(prevFieldArray, curFieldArray);
|
||||
dStrcpy(prevFieldArray, curFieldArray, 256);
|
||||
mCurField = CodeToSTE(mCodeBlock->code, ip);
|
||||
curFieldArray[0] = 0;
|
||||
ip += 2;
|
||||
|
|
@ -1738,7 +1734,7 @@ OPCodeReturn CodeInterpreter::op_setcurfield(U32 &ip)
|
|||
|
||||
OPCodeReturn CodeInterpreter::op_setcurfield_array(U32 &ip)
|
||||
{
|
||||
dStrcpy(curFieldArray, STR.getStringValue());
|
||||
dStrcpy(curFieldArray, STR.getStringValue(), 256);
|
||||
return OPCodeReturn::success;
|
||||
}
|
||||
|
||||
|
|
@ -1771,7 +1767,7 @@ OPCodeReturn CodeInterpreter::op_setcurfield_this(U32 &ip)
|
|||
mCurObject = mThisObject;
|
||||
|
||||
mPrevField = mCurField;
|
||||
dStrcpy(prevFieldArray, curFieldArray);
|
||||
dStrcpy(prevFieldArray, curFieldArray, 256);
|
||||
mCurField = CodeToSTE(mCodeBlock->code, ip);
|
||||
curFieldArray[0] = 0;
|
||||
ip += 2;
|
||||
|
|
|
|||
|
|
@ -70,9 +70,9 @@ namespace Con
|
|||
ret[0] = 0;
|
||||
for (walk = ns; walk; walk = walk->mParent)
|
||||
{
|
||||
dStrcat(ret, walk->mName);
|
||||
dStrcat(ret, walk->mName, size);
|
||||
if (walk->mParent)
|
||||
dStrcat(ret, " -> ");
|
||||
dStrcat(ret, " -> ", size);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ U32 CompilerStringTable::add(const char *str, bool caseSens, bool tag)
|
|||
newStr->string = (char *)consoleAlloc(len);
|
||||
newStr->len = len;
|
||||
newStr->tag = tag;
|
||||
dStrcpy(newStr->string, str);
|
||||
dStrcpy(newStr->string, str, len);
|
||||
|
||||
// Put into the hash table.
|
||||
hashTable[str] = newStr;
|
||||
|
|
@ -195,7 +195,7 @@ char *CompilerStringTable::build()
|
|||
char *ret = new char[totalLen];
|
||||
dMemset(ret, 0, totalLen);
|
||||
for (Entry *walk = list; walk; walk = walk->next)
|
||||
dStrcpy(ret + walk->start, walk->string);
|
||||
dStrcpy(ret + walk->start, walk->string, totalLen - walk->start);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -440,7 +440,7 @@ U32 tabComplete(char* inputBuffer, U32 cursorPos, U32 maxResultLength, bool forw
|
|||
{
|
||||
// If not...
|
||||
// Save it for checking next time.
|
||||
dStrcpy(tabBuffer, inputBuffer);
|
||||
dStrcpy(tabBuffer, inputBuffer, MaxCompletionBufferSize);
|
||||
// Scan backward from the cursor position to find the base to complete from.
|
||||
S32 p = cursorPos;
|
||||
while ((p > 0) && (inputBuffer[p - 1] != ' ') && (inputBuffer[p - 1] != '.') && (inputBuffer[p - 1] != '('))
|
||||
|
|
@ -527,7 +527,7 @@ U32 tabComplete(char* inputBuffer, U32 cursorPos, U32 maxResultLength, bool forw
|
|||
}
|
||||
|
||||
// Save the modified input buffer for checking next time.
|
||||
dStrcpy(tabBuffer, inputBuffer);
|
||||
dStrcpy(tabBuffer, inputBuffer, MaxCompletionBufferSize);
|
||||
|
||||
// Return the new (maybe) cursor position.
|
||||
return cursorPos;
|
||||
|
|
@ -646,8 +646,9 @@ static void _printf(ConsoleLogEntry::Level level, ConsoleLogEntry::Type type, co
|
|||
entry.mLevel = level;
|
||||
entry.mType = type;
|
||||
#ifndef TORQUE_SHIPPING // this is equivalent to a memory leak, turn it off in ship build
|
||||
entry.mString = (const char *)consoleLogChunker.alloc(dStrlen(pos) + 1);
|
||||
dStrcpy(const_cast<char*>(entry.mString), pos);
|
||||
dsize_t logStringLen = dStrlen(pos) + 1;
|
||||
entry.mString = (const char *)consoleLogChunker.alloc(logStringLen);
|
||||
dStrcpy(const_cast<char*>(entry.mString), pos, logStringLen);
|
||||
|
||||
// This prevents infinite recursion if the console itself needs to
|
||||
// re-allocate memory to accommodate the new console log entry, and
|
||||
|
|
@ -1271,7 +1272,7 @@ bool executeFile(const char* fileName, bool noCalls, bool journalScript)
|
|||
scriptFile = NULL;
|
||||
|
||||
dsoModifiedTime = dsoFile->getModifiedTime();
|
||||
dStrcpy(nameBuffer, scriptFileName);
|
||||
dStrcpy(nameBuffer, scriptFileName, 512);
|
||||
}
|
||||
|
||||
// If we're supposed to be compiling this file, check to see if there's a DSO
|
||||
|
|
@ -2097,12 +2098,12 @@ bool expandPath(char* pDstPath, U32 size, const char* pSrcPath, const char* pWor
|
|||
if (ensureTrailingSlash)
|
||||
{
|
||||
// Yes, so ensure it.
|
||||
Con::ensureTrailingSlash(pDstPath, pSrcPath);
|
||||
Con::ensureTrailingSlash(pDstPath, pSrcPath, size);
|
||||
}
|
||||
else
|
||||
{
|
||||
// No, so just use the source path.
|
||||
dStrcpy(pDstPath, pSrcPath);
|
||||
dStrcpy(pDstPath, pSrcPath, size);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
@ -2118,7 +2119,7 @@ bool expandPath(char* pDstPath, U32 size, const char* pSrcPath, const char* pWor
|
|||
if (ensureTrailingSlash)
|
||||
{
|
||||
// Yes, so ensure it.
|
||||
Con::ensureTrailingSlash(pathBuffer, pathBuffer);
|
||||
Con::ensureTrailingSlash(pathBuffer, pathBuffer, size);
|
||||
}
|
||||
|
||||
// Strip repeat slashes.
|
||||
|
|
@ -2143,12 +2144,12 @@ bool expandPath(char* pDstPath, U32 size, const char* pSrcPath, const char* pWor
|
|||
if (ensureTrailingSlash)
|
||||
{
|
||||
// Yes, so ensure it.
|
||||
Con::ensureTrailingSlash(pDstPath, pSrcPath);
|
||||
Con::ensureTrailingSlash(pDstPath, pSrcPath, size);
|
||||
}
|
||||
else
|
||||
{
|
||||
// No, so just use the source path.
|
||||
dStrcpy(pDstPath, pSrcPath);
|
||||
dStrcpy(pDstPath, pSrcPath, size);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
@ -2183,7 +2184,7 @@ bool expandPath(char* pDstPath, U32 size, const char* pSrcPath, const char* pWor
|
|||
if (ensureTrailingSlash)
|
||||
{
|
||||
// Yes, so ensure it.
|
||||
Con::ensureTrailingSlash(pathBuffer, pathBuffer);
|
||||
Con::ensureTrailingSlash(pathBuffer, pathBuffer, size);
|
||||
}
|
||||
|
||||
// Strip repeat slashes.
|
||||
|
|
@ -2208,7 +2209,7 @@ bool expandPath(char* pDstPath, U32 size, const char* pSrcPath, const char* pWor
|
|||
if (ensureTrailingSlash)
|
||||
{
|
||||
// Yes, so ensure it.
|
||||
Con::ensureTrailingSlash(pathBuffer, pathBuffer);
|
||||
Con::ensureTrailingSlash(pathBuffer, pathBuffer, size);
|
||||
}
|
||||
|
||||
// Strip repeat slashes.
|
||||
|
|
@ -2300,10 +2301,10 @@ void collapsePath(char* pDstPath, U32 size, const char* pSrcPath, const char* pW
|
|||
}
|
||||
|
||||
|
||||
void ensureTrailingSlash(char* pDstPath, const char* pSrcPath)
|
||||
void ensureTrailingSlash(char* pDstPath, const char* pSrcPath, S32 dstSize)
|
||||
{
|
||||
// Copy to target.
|
||||
dStrcpy(pDstPath, pSrcPath);
|
||||
dStrcpy(pDstPath, pSrcPath, dstSize);
|
||||
|
||||
// Find trailing character index.
|
||||
S32 trailIndex = dStrlen(pDstPath);
|
||||
|
|
@ -2353,7 +2354,7 @@ StringTableEntry getDSOPath(const char *scriptPath)
|
|||
else
|
||||
{
|
||||
StringTableEntry strippedPath = Platform::stripBasePath(scriptPath);
|
||||
dStrcpy(relPath, strippedPath);
|
||||
dStrcpy(relPath, strippedPath, 1024);
|
||||
|
||||
char *slash = dStrrchr(relPath, '/');
|
||||
if (slash)
|
||||
|
|
@ -2616,7 +2617,7 @@ const char *ConsoleValue::getStringValue()
|
|||
else if(newLen > bufferLen)
|
||||
sval = (char *) dRealloc(sval, newLen);
|
||||
|
||||
dStrcpy(sval, internalValue);
|
||||
dStrcpy(sval, internalValue, newLen);
|
||||
bufferLen = newLen;
|
||||
|
||||
return sval;
|
||||
|
|
|
|||
|
|
@ -491,7 +491,7 @@ namespace Con
|
|||
bool expandPath(char* pDstPath, U32 size, const char* pSrcPath, const char* pWorkingDirectoryHint = NULL, const bool ensureTrailingSlash = false);
|
||||
void collapsePath(char* pDstPath, U32 size, const char* pSrcPath, const char* pWorkingDirectoryHint = NULL);
|
||||
bool isBasePath(const char* SrcPath, const char* pBasePath);
|
||||
void ensureTrailingSlash(char* pDstPath, const char* pSrcPath);
|
||||
void ensureTrailingSlash(char* pDstPath, const char* pSrcPath, S32 dstSize);
|
||||
bool stripRepeatSlashes(char* pDstPath, const char* pSrcPath, S32 dstSize);
|
||||
StringTableEntry getDSOPath(const char *scriptPath);
|
||||
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ void printClassHeader(const char* usage, const char * className, const char * su
|
|||
// Copy Usage Document
|
||||
S32 usageLen = dStrlen( usage );
|
||||
FrameTemp<char> usageStr( usageLen );
|
||||
dStrcpy( usageStr, usage );
|
||||
dStrcpy( usageStr, usage, usageLen );
|
||||
|
||||
// Print Header
|
||||
Con::printf( "/*!" );
|
||||
|
|
@ -117,7 +117,7 @@ void printClassHeader(const char* usage, const char * className, const char * su
|
|||
}
|
||||
|
||||
// Copy line and update usagePtr
|
||||
dStrcpy( lineStr, usagePtr );
|
||||
dStrcpy( lineStr, usagePtr, 2048 );
|
||||
usagePtr = (newLine != NULL ) ? newLine : usagePtr;
|
||||
lineLen = dStrlen( lineStr );
|
||||
|
||||
|
|
|
|||
|
|
@ -561,12 +561,13 @@ DefineConsoleFunction( stripChars, const char*, ( const char* str, const char* c
|
|||
"@endtsexample\n"
|
||||
"@ingroup Strings" )
|
||||
{
|
||||
char* ret = Con::getReturnBuffer( dStrlen( str ) + 1 );
|
||||
dStrcpy( ret, str );
|
||||
S32 len = dStrlen(str) + 1;
|
||||
char* ret = Con::getReturnBuffer( len );
|
||||
dStrcpy( ret, str, len );
|
||||
U32 pos = dStrcspn( ret, chars );
|
||||
while ( pos < dStrlen( ret ) )
|
||||
{
|
||||
dStrcpy( ret + pos, ret + pos + 1 );
|
||||
dStrcpy( ret + pos, ret + pos + 1, len - pos );
|
||||
pos = dStrcspn( ret, chars );
|
||||
}
|
||||
return( ret );
|
||||
|
|
@ -584,8 +585,9 @@ DefineConsoleFunction( strlwr, const char*, ( const char* str ),,
|
|||
"@see strupr\n"
|
||||
"@ingroup Strings" )
|
||||
{
|
||||
char *ret = Con::getReturnBuffer(dStrlen(str) + 1);
|
||||
dStrcpy(ret, str);
|
||||
dsize_t retLen = dStrlen(str) + 1;
|
||||
char *ret = Con::getReturnBuffer(retLen);
|
||||
dStrcpy(ret, str, retLen);
|
||||
return dStrlwr(ret);
|
||||
}
|
||||
|
||||
|
|
@ -601,8 +603,9 @@ DefineConsoleFunction( strupr, const char*, ( const char* str ),,
|
|||
"@see strlwr\n"
|
||||
"@ingroup Strings" )
|
||||
{
|
||||
char *ret = Con::getReturnBuffer(dStrlen(str) + 1);
|
||||
dStrcpy(ret, str);
|
||||
dsize_t retLen = dStrlen(str) + 1;
|
||||
char *ret = Con::getReturnBuffer(retLen);
|
||||
dStrcpy(ret, str, retLen);
|
||||
return dStrupr(ret);
|
||||
}
|
||||
|
||||
|
|
@ -663,7 +666,8 @@ DefineConsoleFunction( strreplace, const char*, ( const char* source, const char
|
|||
count++;
|
||||
}
|
||||
}
|
||||
char *ret = Con::getReturnBuffer(dStrlen(source) + 1 + (toLen - fromLen) * count);
|
||||
S32 retLen = dStrlen(source) + 1 + (toLen - fromLen) * count;
|
||||
char *ret = Con::getReturnBuffer(retLen);
|
||||
U32 scanp = 0;
|
||||
U32 dstp = 0;
|
||||
for(;;)
|
||||
|
|
@ -671,13 +675,13 @@ DefineConsoleFunction( strreplace, const char*, ( const char* source, const char
|
|||
const char *subScan = dStrstr(source + scanp, from);
|
||||
if(!subScan)
|
||||
{
|
||||
dStrcpy(ret + dstp, source + scanp);
|
||||
dStrcpy(ret + dstp, source + scanp, retLen - dstp);
|
||||
return ret;
|
||||
}
|
||||
U32 len = subScan - (source + scanp);
|
||||
dStrncpy(ret + dstp, source + scanp, len);
|
||||
dStrncpy(ret + dstp, source + scanp, getMin(len, retLen - dstp));
|
||||
dstp += len;
|
||||
dStrcpy(ret + dstp, to);
|
||||
dStrcpy(ret + dstp, to, retLen - dstp);
|
||||
dstp += toLen;
|
||||
scanp += len + fromLen;
|
||||
}
|
||||
|
|
@ -901,8 +905,8 @@ DefineConsoleFunction( startsWith, bool, ( const char* str, const char* prefix,
|
|||
char* targetBuf = new char[ targetLen + 1 ];
|
||||
|
||||
// copy src and target into buffers
|
||||
dStrcpy( srcBuf, str );
|
||||
dStrcpy( targetBuf, prefix );
|
||||
dStrcpy( srcBuf, str, srcLen + 1 );
|
||||
dStrcpy( targetBuf, prefix, targetLen + 1 );
|
||||
|
||||
// reassign src/target pointers to lowercase versions
|
||||
str = dStrlwr( srcBuf );
|
||||
|
|
@ -952,8 +956,8 @@ DefineConsoleFunction( endsWith, bool, ( const char* str, const char* suffix, bo
|
|||
char* targetBuf = new char[ targetLen + 1 ];
|
||||
|
||||
// copy src and target into buffers
|
||||
dStrcpy( srcBuf, str );
|
||||
dStrcpy( targetBuf, suffix );
|
||||
dStrcpy( srcBuf, str, srcLen + 1 );
|
||||
dStrcpy( targetBuf, suffix, targetLen + 1 );
|
||||
|
||||
// reassign src/target pointers to lowercase versions
|
||||
str = dStrlwr( srcBuf );
|
||||
|
|
@ -1824,8 +1828,9 @@ DefineEngineFunction( detag, const char*, ( const char* str ),,
|
|||
if( word == NULL )
|
||||
return "";
|
||||
|
||||
char* ret = Con::getReturnBuffer( dStrlen( word + 1 ) + 1 );
|
||||
dStrcpy( ret, word + 1 );
|
||||
dsize_t retLen = dStrlen(word + 1) + 1;
|
||||
char* ret = Con::getReturnBuffer(retLen);
|
||||
dStrcpy( ret, word + 1, retLen );
|
||||
return ret;
|
||||
}
|
||||
else
|
||||
|
|
@ -1889,7 +1894,7 @@ ConsoleFunction( echo, void, 2, 0, "( string message... ) "
|
|||
char *ret = Con::getReturnBuffer(len + 1);
|
||||
ret[0] = 0;
|
||||
for(i = 1; i < argc; i++)
|
||||
dStrcat(ret, argv[i]);
|
||||
dStrcat(ret, argv[i], len + 1);
|
||||
|
||||
Con::printf("%s", ret);
|
||||
ret[0] = 0;
|
||||
|
|
@ -1913,7 +1918,7 @@ ConsoleFunction( warn, void, 2, 0, "( string message... ) "
|
|||
char *ret = Con::getReturnBuffer(len + 1);
|
||||
ret[0] = 0;
|
||||
for(i = 1; i < argc; i++)
|
||||
dStrcat(ret, argv[i]);
|
||||
dStrcat(ret, argv[i], len + 1);
|
||||
|
||||
Con::warnf(ConsoleLogEntry::General, "%s", ret);
|
||||
ret[0] = 0;
|
||||
|
|
@ -1937,7 +1942,7 @@ ConsoleFunction( error, void, 2, 0, "( string message... ) "
|
|||
char *ret = Con::getReturnBuffer(len + 1);
|
||||
ret[0] = 0;
|
||||
for(i = 1; i < argc; i++)
|
||||
dStrcat(ret, argv[i]);
|
||||
dStrcat(ret, argv[i], len + 1);
|
||||
|
||||
Con::errorf(ConsoleLogEntry::General, "%s", ret);
|
||||
ret[0] = 0;
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ StringValue & StringValue::operator=(const char *string)
|
|||
{
|
||||
S32 len = dStrlen(string);
|
||||
if (len < size)
|
||||
dStrcpy(val, string);
|
||||
dStrcpy(val, string, size);
|
||||
else
|
||||
{
|
||||
size = len;
|
||||
|
|
@ -569,7 +569,7 @@ void ConsoleValue::setStringValue(const char * value)
|
|||
type = TypeInternalString;
|
||||
|
||||
bufferLen = newLen;
|
||||
dStrcpy(sval, value);
|
||||
dStrcpy(sval, value, newLen);
|
||||
}
|
||||
else
|
||||
Con::setData(type, dataPtr, 0, 1, &value, enumTable);
|
||||
|
|
@ -702,7 +702,7 @@ Dictionary::Entry* Dictionary::addVariable(const char *name,
|
|||
if (name[0] != '$')
|
||||
{
|
||||
scratchBuffer[0] = '$';
|
||||
dStrcpy(scratchBuffer + 1, name);
|
||||
dStrcpy(scratchBuffer + 1, name, 1023);
|
||||
name = scratchBuffer;
|
||||
}
|
||||
|
||||
|
|
@ -900,21 +900,21 @@ DefineEngineFunction(backtrace, void, (), ,
|
|||
buf[0] = 0;
|
||||
for (U32 i = 0; i < gEvalState.getStackDepth(); i++)
|
||||
{
|
||||
dStrcat(buf, "->");
|
||||
dStrcat(buf, "->", totalSize);
|
||||
|
||||
if (gEvalState.stack[i]->scopeNamespace && gEvalState.stack[i]->scopeNamespace->mEntryList->mPackage)
|
||||
{
|
||||
dStrcat(buf, "[");
|
||||
dStrcat(buf, gEvalState.stack[i]->scopeNamespace->mEntryList->mPackage);
|
||||
dStrcat(buf, "]");
|
||||
dStrcat(buf, "[", totalSize);
|
||||
dStrcat(buf, gEvalState.stack[i]->scopeNamespace->mEntryList->mPackage, totalSize);
|
||||
dStrcat(buf, "]", totalSize);
|
||||
}
|
||||
if (gEvalState.stack[i]->scopeNamespace && gEvalState.stack[i]->scopeNamespace->mName)
|
||||
{
|
||||
dStrcat(buf, gEvalState.stack[i]->scopeNamespace->mName);
|
||||
dStrcat(buf, "::");
|
||||
dStrcat(buf, gEvalState.stack[i]->scopeNamespace->mName, totalSize);
|
||||
dStrcat(buf, "::", totalSize);
|
||||
}
|
||||
if (gEvalState.stack[i]->scopeName)
|
||||
dStrcat(buf, gEvalState.stack[i]->scopeName);
|
||||
dStrcat(buf, gEvalState.stack[i]->scopeName, totalSize);
|
||||
}
|
||||
|
||||
Con::printf("BackTrace: %s", buf);
|
||||
|
|
@ -1360,9 +1360,9 @@ void Namespace::addScriptCallback(const char *funcName, const char *usage, Conso
|
|||
static U32 uid = 0;
|
||||
char buffer[1024];
|
||||
char lilBuffer[32];
|
||||
dStrcpy(buffer, funcName);
|
||||
dStrcpy(buffer, funcName, 1024);
|
||||
dSprintf(lilBuffer, 32, "_%d_cb", uid++);
|
||||
dStrcat(buffer, lilBuffer);
|
||||
dStrcat(buffer, lilBuffer, 1024);
|
||||
|
||||
Entry *ent = createLocalEntry(StringTable->insert(buffer));
|
||||
trashCache();
|
||||
|
|
@ -1381,9 +1381,9 @@ void Namespace::markGroup(const char* name, const char* usage)
|
|||
static U32 uid = 0;
|
||||
char buffer[1024];
|
||||
char lilBuffer[32];
|
||||
dStrcpy(buffer, name);
|
||||
dStrcpy(buffer, name, 1024);
|
||||
dSprintf(lilBuffer, 32, "_%d", uid++);
|
||||
dStrcat(buffer, lilBuffer);
|
||||
dStrcat(buffer, lilBuffer, 1024);
|
||||
|
||||
Entry *ent = createLocalEntry(StringTable->insert(buffer));
|
||||
trashCache();
|
||||
|
|
|
|||
|
|
@ -356,7 +356,7 @@ void ConsoleObject::addGroup(const char* in_pGroupname, const char* in_pGroupDoc
|
|||
char* pFieldNameBuf = suppressSpaces(in_pGroupname);
|
||||
|
||||
// Append group type to fieldname.
|
||||
dStrcat(pFieldNameBuf, "_begingroup");
|
||||
dStrcat(pFieldNameBuf, "_begingroup", 1024);
|
||||
|
||||
// Create Field.
|
||||
AbstractClassRep::Field f;
|
||||
|
|
@ -385,7 +385,7 @@ void ConsoleObject::endGroup(const char* in_pGroupname)
|
|||
char* pFieldNameBuf = suppressSpaces(in_pGroupname);
|
||||
|
||||
// Append group type to fieldname.
|
||||
dStrcat(pFieldNameBuf, "_endgroup");
|
||||
dStrcat(pFieldNameBuf, "_endgroup", 1024);
|
||||
|
||||
// Create Field.
|
||||
AbstractClassRep::Field f;
|
||||
|
|
@ -407,7 +407,7 @@ void ConsoleObject::endGroup(const char* in_pGroupname)
|
|||
void ConsoleObject::addArray( const char *arrayName, S32 count )
|
||||
{
|
||||
char *nameBuff = suppressSpaces(arrayName);
|
||||
dStrcat(nameBuff, "_beginarray");
|
||||
dStrcat(nameBuff, "_beginarray", 1024);
|
||||
|
||||
// Create Field.
|
||||
AbstractClassRep::Field f;
|
||||
|
|
@ -430,7 +430,7 @@ void ConsoleObject::addArray( const char *arrayName, S32 count )
|
|||
void ConsoleObject::endArray( const char *arrayName )
|
||||
{
|
||||
char *nameBuff = suppressSpaces(arrayName);
|
||||
dStrcat(nameBuff, "_endarray");
|
||||
dStrcat(nameBuff, "_endarray", 1024);
|
||||
|
||||
// Create Field.
|
||||
AbstractClassRep::Field f;
|
||||
|
|
@ -773,11 +773,11 @@ static const char* returnClassList( Vector< AbstractClassRep* >& classes, U32 bu
|
|||
dQsort( classes.address(), classes.size(), sizeof( AbstractClassRep* ), ACRCompare );
|
||||
|
||||
char* ret = Con::getReturnBuffer( bufSize );
|
||||
dStrcpy( ret, classes[ 0 ]->getClassName() );
|
||||
dStrcpy( ret, classes[ 0 ]->getClassName(), bufSize );
|
||||
for( U32 i = 1; i < classes.size(); i ++ )
|
||||
{
|
||||
dStrcat( ret, "\t" );
|
||||
dStrcat( ret, classes[ i ]->getClassName() );
|
||||
dStrcat( ret, "\t", bufSize );
|
||||
dStrcat( ret, classes[ i ]->getClassName(), bufSize );
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
@ -888,7 +888,7 @@ DefineEngineFunction( enumerateConsoleClassesByCategory, const char*, ( String c
|
|||
&& ( repCategory[ categoryLength ] == ' ' || repCategory[ categoryLength ] == '\0' ) )
|
||||
{
|
||||
classes.push_back( rep );
|
||||
bufSize += dStrlen( rep->getClassName() + 1 );
|
||||
bufSize += dStrlen( rep->getClassName() ) + 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -319,8 +319,8 @@ DefineConsoleFunction( consoleExportXML, const char*, (), ,"Exports console defi
|
|||
Con::XMLExport xmlExport;
|
||||
String xml;
|
||||
xmlExport.exportXML(xml);
|
||||
char* ret = Con::getReturnBuffer(xml.length() + 1);
|
||||
dStrcpy(ret, xml.c_str());
|
||||
char* ret = Con::getReturnBuffer(xml.size());
|
||||
dStrcpy(ret, xml.c_str(), xml.size());
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -273,9 +273,9 @@ DefineConsoleMethod(FieldBrushObject, queryFields, const char*, (const char* sim
|
|||
for ( U32 groupIndex = 0; groupIndex < groupCount; ++groupIndex )
|
||||
{
|
||||
// Copy string element.
|
||||
dStrcpy( tempBuf, StringUnit::getUnit( groupList, groupIndex, " \t\n" ) );
|
||||
dStrcpy( tempBuf, StringUnit::getUnit( groupList, groupIndex, " \t\n" ), 256 );
|
||||
// Append internal name.
|
||||
dStrcat( tempBuf, "_begingroup" );
|
||||
dStrcat( tempBuf, "_begingroup", 256 );
|
||||
// Store Group.
|
||||
groups.push_back( StringTable->insert( tempBuf ) );
|
||||
}
|
||||
|
|
@ -416,7 +416,7 @@ void FieldBrushObject::copyFields( SimObject* pSimObject, const char* fieldList
|
|||
for ( U32 fieldIndex = 0; fieldIndex < fieldCount; ++fieldIndex )
|
||||
{
|
||||
// Copy string element.
|
||||
dStrcpy( tempBuf, StringUnit::getUnit( fieldList, fieldIndex, " \t\n" ) );
|
||||
dStrcpy( tempBuf, StringUnit::getUnit( fieldList, fieldIndex, " \t\n" ), bufferSizes );
|
||||
|
||||
// Store field.
|
||||
fields.push_back( StringTable->insert( tempBuf ) );
|
||||
|
|
|
|||
|
|
@ -495,7 +495,7 @@ DefineEngineFunction(getDirectoryList, String, ( const char* path, S32 depth ),
|
|||
// Copy the directory names to the buffer.
|
||||
for (S32 i = 0; i < directories.size(); i++)
|
||||
{
|
||||
dStrcpy(p, directories[i]);
|
||||
dStrcpy(p, directories[i], length - (p - buffer));
|
||||
p += dStrlen(directories[i]);
|
||||
// Tab separated.
|
||||
p[0] = '\t';
|
||||
|
|
@ -537,7 +537,7 @@ DefineEngineFunction( fileModifiedTime, String, ( const char* fileName ),,
|
|||
String fileStr = Platform::localTimeToString( lt );
|
||||
|
||||
char *buffer = Con::getReturnBuffer( fileStr.size() );
|
||||
dStrcpy( buffer, fileStr );
|
||||
dStrcpy( buffer, fileStr, fileStr.size() );
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
|
@ -560,7 +560,7 @@ DefineEngineFunction( fileCreatedTime, String, ( const char* fileName ),,
|
|||
String fileStr = Platform::localTimeToString( lt );
|
||||
|
||||
char *buffer = Con::getReturnBuffer( fileStr.size() );
|
||||
dStrcpy( buffer, fileStr );
|
||||
dStrcpy( buffer, fileStr, fileStr.size() );
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
|
@ -609,7 +609,7 @@ DefineEngineFunction(fileBase, String, ( const char* fileName ),,
|
|||
S32 pathLen = dStrlen( fileName );
|
||||
FrameTemp<char> szPathCopy( pathLen + 1);
|
||||
|
||||
dStrcpy( szPathCopy, fileName );
|
||||
dStrcpy( szPathCopy, fileName, pathLen + 1 );
|
||||
forwardslash( szPathCopy );
|
||||
|
||||
const char *path = dStrrchr(szPathCopy, '/');
|
||||
|
|
@ -617,8 +617,9 @@ DefineEngineFunction(fileBase, String, ( const char* fileName ),,
|
|||
path = szPathCopy;
|
||||
else
|
||||
path++;
|
||||
char *ret = Con::getReturnBuffer(dStrlen(path) + 1);
|
||||
dStrcpy(ret, path);
|
||||
dsize_t retLen = dStrlen(path) + 1;
|
||||
char *ret = Con::getReturnBuffer(retLen);
|
||||
dStrcpy(ret, path, retLen);
|
||||
char *ext = dStrrchr(ret, '.');
|
||||
if(ext)
|
||||
*ext = 0;
|
||||
|
|
@ -635,7 +636,7 @@ DefineEngineFunction(fileName, String, ( const char* fileName ),,
|
|||
S32 pathLen = dStrlen( fileName );
|
||||
FrameTemp<char> szPathCopy( pathLen + 1);
|
||||
|
||||
dStrcpy( szPathCopy, fileName );
|
||||
dStrcpy( szPathCopy, fileName, pathLen + 1 );
|
||||
forwardslash( szPathCopy );
|
||||
|
||||
const char *name = dStrrchr(szPathCopy, '/');
|
||||
|
|
@ -643,8 +644,9 @@ DefineEngineFunction(fileName, String, ( const char* fileName ),,
|
|||
name = szPathCopy;
|
||||
else
|
||||
name++;
|
||||
char *ret = Con::getReturnBuffer(dStrlen(name));
|
||||
dStrcpy(ret, name);
|
||||
dsize_t retLen = dStrlen(name) + 1;
|
||||
char *ret = Con::getReturnBuffer(retLen);
|
||||
dStrcpy(ret, name, retLen);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -658,7 +660,7 @@ DefineEngineFunction(filePath, String, ( const char* fileName ),,
|
|||
S32 pathLen = dStrlen( fileName );
|
||||
FrameTemp<char> szPathCopy( pathLen + 1);
|
||||
|
||||
dStrcpy( szPathCopy, fileName );
|
||||
dStrcpy( szPathCopy, fileName, pathLen + 1 );
|
||||
forwardslash( szPathCopy );
|
||||
|
||||
const char *path = dStrrchr(szPathCopy, '/');
|
||||
|
|
|
|||
|
|
@ -950,7 +950,7 @@ void PersistenceManager::updateToken( const U32 lineNumber, const U32 linePositi
|
|||
char* postString = ( char* ) dMalloc( postStringLen + 1 );
|
||||
if( needQuotes )
|
||||
postString[ 0 ] = '"';
|
||||
dStrcpy( &postString[ needQuotes ? 1 : 0 ], postStringSrc );
|
||||
dStrcpy( &postString[ needQuotes ? 1 : 0 ], postStringSrc, postStringLen + (needQuotes ? 0 : 1) );
|
||||
postString[ postStringLen ] = 0;
|
||||
|
||||
// Calculate the length of our new line
|
||||
|
|
@ -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);
|
||||
dStrcat(newLine, preString, newLineLen + 1);
|
||||
if ( newValue )
|
||||
dStrcat(newLine, newValue);
|
||||
dStrcat(newLine, postString);
|
||||
dStrcat(newLine, newValue, newLineLen + 1);
|
||||
dStrcat(newLine, postString, newLineLen + 1);
|
||||
|
||||
// Clear our existing line
|
||||
if (mLineBuffer[lineNumber])
|
||||
|
|
@ -1243,7 +1243,7 @@ PersistenceManager::ParsedObject* PersistenceManager::writeNewObject(SimObject*
|
|||
char* indent = getObjectIndent(parentObject);
|
||||
|
||||
if (parentObject)
|
||||
dStrcat(indent, " \0");
|
||||
dStrcat(indent, " \0", 2048);
|
||||
|
||||
// Write out the beginning of the object declaration
|
||||
const char* dclToken = "new";
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@ bool expandToolScriptFilename(char *filename, U32 size, const char *src)
|
|||
// Relative to script directory
|
||||
if(cbFullPath)
|
||||
{
|
||||
dStrcpy(varBuf, cbFullPath);
|
||||
dStrcpy(varBuf, cbFullPath, 1024);
|
||||
slash = dStrrchr(varBuf, '/');
|
||||
if(slash) *slash = 0;
|
||||
|
||||
|
|
@ -219,7 +219,7 @@ bool expandOldScriptFilename(char *filename, U32 size, const char *src)
|
|||
const StringTableEntry cbName = CodeBlock::getCurrentCodeBlockName();
|
||||
if (!cbName)
|
||||
{
|
||||
dStrcpy(filename, src);
|
||||
dStrcpy(filename, src, size);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -244,7 +244,7 @@ bool expandOldScriptFilename(char *filename, U32 size, const char *src)
|
|||
*filename = 0;
|
||||
return false;
|
||||
}
|
||||
dStrcpy(filename, src);
|
||||
dStrcpy(filename, src, size);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -264,7 +264,7 @@ bool expandOldScriptFilename(char *filename, U32 size, const char *src)
|
|||
}
|
||||
|
||||
dStrncpy(filename, cbName, length);
|
||||
dStrcpy(filename+length, src+1);
|
||||
dStrcpy(filename+length, src+1, size - length);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -325,7 +325,7 @@ bool collapseScriptFilename(char *filename, U32 size, const char *src)
|
|||
*filename = 0;
|
||||
if(*test[i].replace)
|
||||
dSprintf(filename, size, "%s/", test[i].replace);
|
||||
dStrcat(filename, rel);
|
||||
dStrcat(filename, rel, size);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -216,7 +216,7 @@ DefineConsoleFunction( getUniqueName, const char*, (const char * baseName), ,
|
|||
return NULL;
|
||||
|
||||
char *buffer = Con::getReturnBuffer( outName.size() );
|
||||
dStrcpy( buffer, outName );
|
||||
dStrcpy( buffer, outName, outName.size() );
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
|
@ -241,7 +241,7 @@ DefineConsoleFunction( getUniqueInternalName, const char*, (const char * baseNam
|
|||
return NULL;
|
||||
|
||||
char *buffer = Con::getReturnBuffer( outName.size() );
|
||||
dStrcpy( buffer, outName );
|
||||
dStrcpy( buffer, outName, outName.size() );
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -198,10 +198,10 @@ void SimDataBlock::performSubstitutions(SimDataBlock* dblock, const SimObject* o
|
|||
}
|
||||
|
||||
char obj_str[32];
|
||||
dStrcpy(obj_str, Con::getIntArg(obj->getId()));
|
||||
dStrcpy(obj_str, Con::getIntArg(obj->getId()), 32);
|
||||
|
||||
char index_str[32];
|
||||
dStrcpy(index_str, Con::getIntArg(index));
|
||||
dStrcpy(index_str, Con::getIntArg(index), 32);
|
||||
|
||||
for (S32 i = 0; i < substitutions.size(); i++)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -281,7 +281,7 @@ void SimFieldDictionary::writeFields(SimObject *obj, Stream &stream, U32 tabStop
|
|||
dSprintf(expandedBuffer, nBufferSize, "%s%s%s = \"", typeName, *typeName ? " " : "", (*itr)->slotName);
|
||||
if ((*itr)->value)
|
||||
expandEscape((char*)expandedBuffer + dStrlen(expandedBuffer), (*itr)->value);
|
||||
dStrcat(expandedBuffer, "\";\r\n");
|
||||
dStrcat(expandedBuffer, "\";\r\n", nBufferSize);
|
||||
|
||||
stream.write(dStrlen(expandedBuffer), expandedBuffer);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -320,7 +320,7 @@ void SimObject::writeFields(Stream &stream, U32 tabStop)
|
|||
|
||||
U32 nBufferSize = dStrlen( val ) + 1;
|
||||
FrameTemp<char> valCopy( nBufferSize );
|
||||
dStrcpy( (char *)valCopy, val );
|
||||
dStrcpy( (char *)valCopy, val, nBufferSize );
|
||||
|
||||
if (!writeField(f->pFieldname, valCopy))
|
||||
continue;
|
||||
|
|
@ -347,7 +347,7 @@ void SimObject::writeFields(Stream &stream, U32 tabStop)
|
|||
}
|
||||
|
||||
expandEscape((char*)expandedBuffer + dStrlen(expandedBuffer), val);
|
||||
dStrcat(expandedBuffer, "\";\r\n");
|
||||
dStrcat(expandedBuffer, "\";\r\n", expandedBufferSize);
|
||||
|
||||
stream.writeTabs(tabStop);
|
||||
stream.write(dStrlen(expandedBuffer),expandedBuffer);
|
||||
|
|
@ -402,12 +402,12 @@ bool SimObject::save(const char *pcFileName, bool bOnlySelected, const char *pre
|
|||
char docRoot[256];
|
||||
char modRoot[256];
|
||||
|
||||
dStrcpy(docRoot, pcFileName);
|
||||
dStrcpy(docRoot, pcFileName, 256);
|
||||
char *p = dStrrchr(docRoot, '/');
|
||||
if (p) *++p = '\0';
|
||||
else docRoot[0] = '\0';
|
||||
|
||||
dStrcpy(modRoot, pcFileName);
|
||||
dStrcpy(modRoot, pcFileName, 256);
|
||||
p = dStrchr(modRoot, '/');
|
||||
if (p) *++p = '\0';
|
||||
else modRoot[0] = '\0';
|
||||
|
|
@ -1028,8 +1028,8 @@ void SimObject::setDataField(StringTableEntry slotName, const char *array, const
|
|||
else
|
||||
{
|
||||
char buf[256];
|
||||
dStrcpy(buf, slotName);
|
||||
dStrcat(buf, array);
|
||||
dStrcpy(buf, slotName, 256);
|
||||
dStrcat(buf, array, 256);
|
||||
StringTableEntry permanentSlotName = StringTable->insert(buf);
|
||||
mFieldDictionary->setFieldValue(permanentSlotName, value);
|
||||
onDynamicModified( permanentSlotName, value );
|
||||
|
|
@ -1069,8 +1069,8 @@ const char *SimObject::getDataField(StringTableEntry slotName, const char *array
|
|||
else
|
||||
{
|
||||
static char buf[256];
|
||||
dStrcpy(buf, slotName);
|
||||
dStrcat(buf, array);
|
||||
dStrcpy(buf, slotName, 256);
|
||||
dStrcat(buf, array, 256);
|
||||
if (const char* val = mFieldDictionary->getFieldValue(StringTable->insert(buf)))
|
||||
return val;
|
||||
}
|
||||
|
|
@ -1310,8 +1310,8 @@ U32 SimObject::getDataFieldType( StringTableEntry slotName, const char* array )
|
|||
else
|
||||
{
|
||||
static char buf[256];
|
||||
dStrcpy( buf, slotName );
|
||||
dStrcat( buf, array );
|
||||
dStrcpy( buf, slotName, 256 );
|
||||
dStrcat( buf, array, 256 );
|
||||
|
||||
return mFieldDictionary->getFieldType( StringTable->insert( buf ) );
|
||||
}
|
||||
|
|
@ -1333,8 +1333,8 @@ void SimObject::setDataFieldType(const U32 fieldTypeId, StringTableEntry slotNam
|
|||
else
|
||||
{
|
||||
static char buf[256];
|
||||
dStrcpy( buf, slotName );
|
||||
dStrcat( buf, array );
|
||||
dStrcpy( buf, slotName, 256 );
|
||||
dStrcat( buf, array, 256 );
|
||||
|
||||
mFieldDictionary->setFieldType( StringTable->insert( buf ), fieldTypeId );
|
||||
onDynamicModified( slotName, mFieldDictionary->getFieldValue(slotName) );
|
||||
|
|
@ -1354,8 +1354,8 @@ void SimObject::setDataFieldType(const char *typeName, StringTableEntry slotName
|
|||
else
|
||||
{
|
||||
static char buf[256];
|
||||
dStrcpy( buf, slotName );
|
||||
dStrcat( buf, array );
|
||||
dStrcpy( buf, slotName, 256 );
|
||||
dStrcat( buf, array, 256 );
|
||||
StringTableEntry permanentSlotName = StringTable->insert(buf);
|
||||
|
||||
mFieldDictionary->setFieldType( permanentSlotName, typeName );
|
||||
|
|
|
|||
|
|
@ -134,10 +134,11 @@ SimObject *SimObjectMemento::restore() const
|
|||
return NULL;
|
||||
U32 numCharsToLeftParen = pLeftParen - mState;
|
||||
|
||||
tempBuffer = ( char* ) dMalloc( dStrlen( mState ) + uniqueNameLen + 1 );
|
||||
dsize_t tempBufferLen = dStrlen(mState) + uniqueNameLen + 1;
|
||||
tempBuffer = ( char* ) dMalloc( tempBufferLen );
|
||||
dMemcpy( tempBuffer, mState, numCharsToLeftParen );
|
||||
dMemcpy( &tempBuffer[ numCharsToLeftParen ], uniqueName, uniqueNameLen );
|
||||
dStrcpy( &tempBuffer[ numCharsToLeftParen + uniqueNameLen ], &mState[ numCharsToLeftParen ] );
|
||||
dStrcpy( &tempBuffer[ numCharsToLeftParen + uniqueNameLen ], &mState[ numCharsToLeftParen ], tempBufferLen - numCharsToLeftParen - uniqueNameLen );
|
||||
}
|
||||
|
||||
Con::evaluate( tempBuffer );
|
||||
|
|
|
|||
|
|
@ -176,7 +176,7 @@ struct StringStack
|
|||
mLen = dStrlen(s);
|
||||
|
||||
validateBufferSize(mStart + mLen + 2);
|
||||
dStrcpy(mBuffer + mStart, s);
|
||||
dStrcpy(mBuffer + mStart, s, mBufferSize - mStart);
|
||||
}
|
||||
|
||||
/// Get the top of the stack, as a StringTableEntry.
|
||||
|
|
|
|||
|
|
@ -470,19 +470,19 @@ void TelnetDebugger::sendBreak()
|
|||
if ( ns ) {
|
||||
|
||||
if ( ns->mParent && ns->mParent->mPackage && ns->mParent->mPackage[0] ) {
|
||||
dStrcat( scope, ns->mParent->mPackage );
|
||||
dStrcat( scope, "::" );
|
||||
dStrcat( scope, ns->mParent->mPackage, MaxCommandSize );
|
||||
dStrcat( scope, "::", MaxCommandSize );
|
||||
}
|
||||
if ( ns->mName && ns->mName[0] ) {
|
||||
dStrcat( scope, ns->mName );
|
||||
dStrcat( scope, "::" );
|
||||
dStrcat( scope, ns->mName, MaxCommandSize );
|
||||
dStrcat( scope, "::", MaxCommandSize );
|
||||
}
|
||||
}
|
||||
|
||||
const char *function = gEvalState.stack[i]->scopeName;
|
||||
if ((!function) || (!function[0]))
|
||||
function = "<none>";
|
||||
dStrcat( scope, function );
|
||||
dStrcat( scope, function, MaxCommandSize );
|
||||
|
||||
U32 line=0, inst;
|
||||
U32 ip = gEvalState.stack[i]->ip;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue