mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-10 22:24:33 +00:00
Use fixed buffer size var when allocating return buffer from console.
Conflicts: Engine/source/T3D/missionArea.cpp Engine/source/gui/editor/guiDebugger.cpp
This commit is contained in:
parent
d0a64026b0
commit
f3fc84738b
42 changed files with 300 additions and 204 deletions
|
|
@ -821,12 +821,13 @@ ConsoleMethod( GuiDecalEditorCtrl, getDecalTransform, const char*, 3, 3, "getDec
|
|||
if( decalInstance == NULL )
|
||||
return "";
|
||||
|
||||
char* returnBuffer = Con::getReturnBuffer(256);
|
||||
static const U32 bufSize = 256;
|
||||
char* returnBuffer = Con::getReturnBuffer(bufSize);
|
||||
returnBuffer[0] = 0;
|
||||
|
||||
if ( decalInstance )
|
||||
{
|
||||
dSprintf(returnBuffer, 256, "%f %f %f %f %f %f %f",
|
||||
dSprintf(returnBuffer, bufSize, "%f %f %f %f %f %f %f",
|
||||
decalInstance->mPosition.x, decalInstance->mPosition.y, decalInstance->mPosition.z,
|
||||
decalInstance->mTangent.x, decalInstance->mTangent.y, decalInstance->mTangent.z,
|
||||
decalInstance->mSize);
|
||||
|
|
|
|||
|
|
@ -2111,8 +2111,9 @@ const char* TerrainEditor::getBrushPos()
|
|||
AssertFatal(mMouseBrush!=NULL, "TerrainEditor::getBrushPos: no mouse brush!");
|
||||
|
||||
Point2I pos = mMouseBrush->getPosition();
|
||||
char * ret = Con::getReturnBuffer(32);
|
||||
dSprintf(ret, 32, "%d %d", pos.x, pos.y);
|
||||
static const U32 bufSize = 32;
|
||||
char * ret = Con::getReturnBuffer(bufSize);
|
||||
dSprintf(ret, bufSize, "%d %d", pos.x, pos.y);
|
||||
return(ret);
|
||||
}
|
||||
|
||||
|
|
@ -2521,8 +2522,9 @@ ConsoleMethod( TerrainEditor, getBrushSize, const char*, 2, 2, "()")
|
|||
{
|
||||
Point2I size = object->getBrushSize();
|
||||
|
||||
char * ret = Con::getReturnBuffer(32);
|
||||
dSprintf(ret, 32, "%d %d", size.x, size.y);
|
||||
static const U32 bufSize = 32;
|
||||
char * ret = Con::getReturnBuffer(bufSize);
|
||||
dSprintf(ret, bufSize, "%d %d", size.x, size.y);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2882,8 +2882,9 @@ const Point3F& WorldEditor::getSelectionCentroid()
|
|||
const char* WorldEditor::getSelectionCentroidText()
|
||||
{
|
||||
const Point3F & centroid = getSelectionCentroid();
|
||||
char * ret = Con::getReturnBuffer(100);
|
||||
dSprintf(ret, 100, "%g %g %g", centroid.x, centroid.y, centroid.z);
|
||||
static const U32 bufSize = 100;
|
||||
char * ret = Con::getReturnBuffer(bufSize);
|
||||
dSprintf(ret, bufSize, "%g %g %g", centroid.x, centroid.y, centroid.z);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -3263,8 +3264,9 @@ ConsoleMethod( WorldEditor, getSelectionCentroid, const char *, 2, 2, "")
|
|||
ConsoleMethod( WorldEditor, getSelectionExtent, const char *, 2, 2, "")
|
||||
{
|
||||
Point3F bounds = object->getSelectionExtent();
|
||||
char * ret = Con::getReturnBuffer(100);
|
||||
dSprintf(ret, 100, "%g %g %g", bounds.x, bounds.y, bounds.z);
|
||||
static const U32 bufSize = 100;
|
||||
char * ret = Con::getReturnBuffer(bufSize);
|
||||
dSprintf(ret, bufSize, "%g %g %g", bounds.x, bounds.y, bounds.z);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -642,10 +642,11 @@ ConsoleMethod( WorldEditorSelection, containsGlobalBounds, bool, 2, 2, "() - Tru
|
|||
|
||||
ConsoleMethod( WorldEditorSelection, getCentroid, const char*, 2, 2, "() - Return the median of all object positions in the selection." )
|
||||
{
|
||||
char* buffer = Con::getReturnBuffer( 256 );
|
||||
static const U32 bufSize = 256;
|
||||
char* buffer = Con::getReturnBuffer( bufSize );
|
||||
const Point3F& centroid = object->getCentroid();
|
||||
|
||||
dSprintf( buffer, 256, "%g %g %g", centroid.x, centroid.y, centroid.z );
|
||||
dSprintf( buffer, bufSize, "%g %g %g", centroid.x, centroid.y, centroid.z );
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
|
@ -653,10 +654,11 @@ ConsoleMethod( WorldEditorSelection, getCentroid, const char*, 2, 2, "() - Retur
|
|||
|
||||
ConsoleMethod( WorldEditorSelection, getBoxCentroid, const char*, 2, 2, "() - Return the center of the bounding box around the selection." )
|
||||
{
|
||||
char* buffer = Con::getReturnBuffer( 256 );
|
||||
static const U32 bufSize = 256;
|
||||
char* buffer = Con::getReturnBuffer( bufSize );
|
||||
const Point3F& boxCentroid = object->getBoxCentroid();
|
||||
|
||||
dSprintf( buffer, 256, "%g %g %g", boxCentroid.x, boxCentroid.y, boxCentroid.z );
|
||||
dSprintf( buffer, bufSize, "%g %g %g", boxCentroid.x, boxCentroid.y, boxCentroid.z );
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue