Improvements to console refactor code

- Prevent stack corruption in a few places
- Use correct type in printfs
- Reduce type conversions in EngineApi & dAto*
- Fix compilation on GCC
- Tidy up code
This commit is contained in:
jamesu 2012-10-11 21:29:39 +01:00 committed by James Urquhart
parent e99eadd61f
commit 08d4f6ebc0
58 changed files with 733 additions and 690 deletions

View file

@ -2540,7 +2540,7 @@ ConsoleMethod( GuiEditCtrl, setCurrentAddSet, void, 3, 3, "(GuiControl ctrl)")
if (!Sim::findObject(argv[2], addSet))
{
Con::printf("%s(): Invalid control: %s", argv[0], argv[2]);
Con::printf("%s(): Invalid control: %s", (const char*)argv[0], (const char*)argv[2]);
return;
}
object->setCurrentAddSet(addSet);
@ -2700,7 +2700,7 @@ ConsoleMethod( GuiEditCtrl, readGuides, void, 3, 4, "( GuiControl ctrl [, int ax
GuiControl* ctrl;
if( !Sim::findObject( argv[ 2 ], ctrl ) )
{
Con::errorf( "GuiEditCtrl::readGuides - no control '%s'", argv[ 2 ] );
Con::errorf( "GuiEditCtrl::readGuides - no control '%s'", (const char*)argv[ 2 ] );
return;
}
@ -2711,7 +2711,7 @@ ConsoleMethod( GuiEditCtrl, readGuides, void, 3, 4, "( GuiControl ctrl [, int ax
S32 axis = dAtoi( argv[ 3 ] );
if( axis < 0 || axis > 1 )
{
Con::errorf( "GuiEditCtrl::readGuides - invalid axis '%s'", argv[ 3 ] );
Con::errorf( "GuiEditCtrl::readGuides - invalid axis '%s'", (const char*)argv[ 3 ] );
return;
}
@ -2733,7 +2733,7 @@ ConsoleMethod( GuiEditCtrl, writeGuides, void, 3, 4, "( GuiControl ctrl [, int a
GuiControl* ctrl;
if( !Sim::findObject( argv[ 2 ], ctrl ) )
{
Con::errorf( "GuiEditCtrl::writeGuides - no control '%i'", argv[ 2 ] );
Con::errorf( "GuiEditCtrl::writeGuides - no control '%i'", (const char*)argv[ 2 ] );
return;
}
@ -2744,7 +2744,7 @@ ConsoleMethod( GuiEditCtrl, writeGuides, void, 3, 4, "( GuiControl ctrl [, int a
S32 axis = dAtoi( argv[ 3 ] );
if( axis < 0 || axis > 1 )
{
Con::errorf( "GuiEditCtrl::writeGuides - invalid axis '%s'", argv[ 3 ] );
Con::errorf( "GuiEditCtrl::writeGuides - invalid axis '%s'", (const char*)argv[ 3 ] );
return;
}

View file

@ -777,7 +777,7 @@ ConsoleMethod( GuiInspector, inspect, void, 3, 3, "Inspect(Object)")
if(!target)
{
if(dAtoi(argv[2]) > 0)
Con::warnf("%s::inspect(): invalid object: %s", argv[0], argv[2]);
Con::warnf("%s::inspect(): invalid object: %s", (const char*)argv[0], (const char*)argv[2]);
object->clearInspectObjects();
return;
@ -793,7 +793,7 @@ ConsoleMethod( GuiInspector, addInspect, void, 3, 4, "( id object, (bool autoSyn
SimObject* obj;
if( !Sim::findObject( argv[ 2 ], obj ) )
{
Con::errorf( "%s::addInspect(): invalid object: %s", argv[ 0 ], argv[ 2 ] );
Con::errorf( "%s::addInspect(): invalid object: %s", (const char*)argv[ 0 ], (const char*)argv[ 2 ] );
return;
}
@ -810,7 +810,7 @@ ConsoleMethod( GuiInspector, removeInspect, void, 3, 3, "( id object ) - Remove
SimObject* obj;
if( !Sim::findObject( argv[ 2 ], obj ) )
{
Con::errorf( "%s::removeInspect(): invalid object: %s", argv[ 0 ], argv[ 2 ] );
Con::errorf( "%s::removeInspect(): invalid object: %s", (const char*)argv[ 0 ], (const char*)argv[ 2 ] );
return;
}

View file

@ -571,7 +571,7 @@ void GuiInspectorTypeFileName::updateValue()
ConsoleMethod( GuiInspectorTypeFileName, apply, void, 3,3, "apply(newValue);" )
{
String path( argv[2] );
String path( (const char*)argv[2] );
if ( path.isNotEmpty() )
path = Platform::makeRelativePathName( path, Platform::getMainDotCsDir() );

View file

@ -63,5 +63,5 @@ void GuiVariableInspector::loadVars( String searchStr )
ConsoleMethod( GuiVariableInspector, loadVars, void, 3, 3, "loadVars( searchString )" )
{
object->loadVars( (const char*)argv[2] );
object->loadVars( argv[2] );
}