Convert dStrcmp to String::compare for more cases

This commit is contained in:
Lukas Aldershaab 2020-10-04 00:00:01 +02:00
parent c999baf7ed
commit 197a62f6ea
22 changed files with 45 additions and 45 deletions

View file

@ -2558,7 +2558,7 @@ Torque::Path AssetImporter::importImageAsset(AssetImportObject* assetItem)
//If it's not a re-import, check that the file isn't being in-place imported. If it isn't, store off the original
//file path for reimporting support later
if (!isReimport && dStrcmp(qualifiedFromFile, qualifiedToFile))
if (!isReimport && String::compare(qualifiedFromFile, qualifiedToFile))
{
newAsset->setDataField(StringTable->insert("originalFilePath"), nullptr, qualifiedFromFile);
}
@ -2578,7 +2578,7 @@ Torque::Path AssetImporter::importImageAsset(AssetImportObject* assetItem)
if (!isReimport)
{
bool isInPlace = !dStrcmp(qualifiedFromFile, qualifiedToFile);
bool isInPlace = !String::compare(qualifiedFromFile, qualifiedToFile);
if (!isInPlace && !dPathCopy(qualifiedFromFile, qualifiedToFile, !isReimport))
{
@ -2877,7 +2877,7 @@ Torque::Path AssetImporter::importShapeAsset(AssetImportObject* assetItem)
//If it's not a re-import, check that the file isn't being in-place imported. If it isn't, store off the original
//file path for reimporting support later
if (!isReimport && dStrcmp(qualifiedFromFile, qualifiedToFile))
if (!isReimport && String::compare(qualifiedFromFile, qualifiedToFile))
{
newAsset->setDataField(StringTable->insert("originalFilePath"), nullptr, qualifiedFromFile);
}
@ -2930,7 +2930,7 @@ Torque::Path AssetImporter::importShapeAsset(AssetImportObject* assetItem)
bool makeNewConstructor = true;
if (!isReimport)
{
bool isInPlace = !dStrcmp(qualifiedFromFile, qualifiedToFile);
bool isInPlace = !String::compare(qualifiedFromFile, qualifiedToFile);
if (!isInPlace && !dPathCopy(qualifiedFromFile, qualifiedToFile, !isReimport))
{
@ -3109,7 +3109,7 @@ Torque::Path AssetImporter::importSoundAsset(AssetImportObject* assetItem)
//If it's not a re-import, check that the file isn't being in-place imported. If it isn't, store off the original
//file path for reimporting support later
if (!isReimport && dStrcmp(qualifiedFromFile, qualifiedToFile))
if (!isReimport && String::compare(qualifiedFromFile, qualifiedToFile))
{
newAsset->setDataField(StringTable->insert("originalFilePath"), nullptr, qualifiedFromFile);
}
@ -3126,7 +3126,7 @@ Torque::Path AssetImporter::importSoundAsset(AssetImportObject* assetItem)
if (!isReimport)
{
bool isInPlace = !dStrcmp(qualifiedFromFile, qualifiedToFile);
bool isInPlace = !String::compare(qualifiedFromFile, qualifiedToFile);
if (!isInPlace && !dPathCopy(qualifiedFromFile, qualifiedToFile, !isReimport))
{
@ -3165,7 +3165,7 @@ Torque::Path AssetImporter::importShapeAnimationAsset(AssetImportObject* assetIt
//If it's not a re-import, check that the file isn't being in-place imported. If it isn't, store off the original
//file path for reimporting support later
if (!isReimport && dStrcmp(qualifiedFromFile, qualifiedToFile))
if (!isReimport && String::compare(qualifiedFromFile, qualifiedToFile))
{
newAsset->setDataField(StringTable->insert("originalFilePath"), nullptr, qualifiedFromFile);
}
@ -3182,7 +3182,7 @@ Torque::Path AssetImporter::importShapeAnimationAsset(AssetImportObject* assetIt
if (!isReimport)
{
bool isInPlace = !dStrcmp(qualifiedFromFile, qualifiedToFile);
bool isInPlace = !String::compare(qualifiedFromFile, qualifiedToFile);
if (!isInPlace && !dPathCopy(qualifiedFromFile, qualifiedToFile, !isReimport))
{

View file

@ -259,11 +259,11 @@ bool ReflectionProbe::_setReflectionMode(void *object, const char *index, const
{
ReflectionProbe* probe = reinterpret_cast<ReflectionProbe*>(object);
if (!dStrcmp(data,"Static Cubemap"))
if (!String::compare(data,"Static Cubemap"))
{
probe->mReflectionModeType = StaticCubemap;
}
else if (!dStrcmp(data, "Baked Cubemap"))
else if (!String::compare(data, "Baked Cubemap"))
{
//Clear our cubemap if we changed it to be baked, just for cleanliness
probe->mReflectionModeType = BakedCubemap;

View file

@ -162,7 +162,7 @@ namespace VPersistence
}
const char *docVersion = rootElement->Attribute( "Version" );
if ( !docVersion || dStrcmp( VSFVersionString, docVersion ) != 0 )
if ( !docVersion || String::compare( VSFVersionString, docVersion ) != 0 )
{
Con::errorf( "VPersistence::readFile() - Invalid file version." );
return false;

View file

@ -1041,7 +1041,7 @@ DefineEngineMethod( VController, sortGroups, void, (),, "( void ) - Sort Groups
}
// Swap?
if ( dStrcmp( groupA->getLabel(), groupB->getLabel() ) > 0 )
if ( String::compare( groupA->getLabel(), groupB->getLabel() ) > 0 )
{
// Get Outer Siblings.
ITreeNode *prevNode = groupA->mSiblingPrevNode;
@ -1100,7 +1100,7 @@ DefineEngineMethod( VController, sortTracks, void, (),, "( void ) - Sort Tracks
}
// Swap?
if ( dStrcmp( trackA->getLabel(), trackB->getLabel() ) > 0 )
if ( String::compare( trackA->getLabel(), trackB->getLabel() ) > 0 )
{
// Get Outer Siblings.
ITreeNode *prevNode = trackA->mSiblingPrevNode;

View file

@ -538,7 +538,7 @@ VectorF VPath::getMountVelocity( const U32 &pIndex )
void VPath::readFields( void )
{
const char *nodeData = "";
for ( S32 nodeIndex = 0; dStrcmp( nodeData = getDataField( StringTable->insert( avar( "Node%d", nodeIndex ) ), NULL ), "" ) != 0; nodeIndex++ )
for ( S32 nodeIndex = 0; String::compare( nodeData = getDataField( StringTable->insert( avar( "Node%d", nodeIndex ) ), NULL ), "" ) != 0; nodeIndex++ )
{
// Create Node.
VPathNode *node = createNode();

View file

@ -156,7 +156,7 @@ bool afxConstraintDef::parseSpec(const char* spec, bool runs_on_server,
// move words to words2 while extracting #center and #history
for (S32 i = 0; i < n_words; i++)
{
if (dStrcmp(words[i], "#center") == 0)
if (String::compare(words[i], "#center") == 0)
mPos_at_box_center = true;
else if (dStrncmp(words[i], "#history(", 9) == 0)
hist_spec = words[i];

View file

@ -1188,7 +1188,7 @@ DefineEngineFunction( isValidIP, bool, ( const char* str),,
"@endtsexample\n"
"@ingroup Strings" )
{
if(dStrcmp(str, "localhost") == 0)
if(String::compare(str, "localhost") == 0)
{
return true;
}

View file

@ -2247,7 +2247,7 @@ DefineEngineMethod( PersistenceManager, isDirty, bool, ( const char * objName ),
"Returns true if the SimObject is on the dirty list.")
{
SimObject *dirtyObject = NULL;
if (dStrcmp ( objName,"")!=0)
if (String::compare ( objName,"")!=0)
{
if (!Sim::findObject(objName, dirtyObject))
{
@ -2328,7 +2328,7 @@ DefineEngineMethod( PersistenceManager, saveDirtyObject, bool, (const char * obj
"Save a dirty SimObject to it's file.")
{
SimObject *dirtyObject = NULL;
if (dStrcmp ( objName, "")!=0)
if (String::compare ( objName, "")!=0)
{
if (!Sim::findObject(objName, dirtyObject))
{
@ -2353,7 +2353,7 @@ DefineEngineMethod( PersistenceManager, removeObjectFromFile, void, (const char
the one it was created in.")
{
SimObject *dirtyObject = NULL;
if (dStrcmp ( objName , "")!=0)
if (String::compare ( objName , "")!=0)
{
if (!Sim::findObject(objName, dirtyObject))
{

View file

@ -1060,7 +1060,7 @@ void GFXD3D11Shader::_getShaderConstants( ID3D11ShaderReflection *refTable,
#ifdef TORQUE_DEBUG
AssertFatal(constantBufferDesc.Type == D3D_CT_CBUFFER, "Only scalar cbuffers supported for now.");
if (dStrcmp(constantBufferDesc.Name, "$Globals") != 0 && dStrcmp(constantBufferDesc.Name, "$Params") != 0)
if (String::compare(constantBufferDesc.Name, "$Globals") != 0 && String::compare(constantBufferDesc.Name, "$Params") != 0)
AssertFatal(false, "Only $Global and $Params cbuffer supported for now.");
#endif
#ifdef D3D11_DEBUG_SPEW

View file

@ -1120,7 +1120,7 @@ DefineEngineFunction(saveCompositeTexture, void, (const char* pathR, const char*
{
U32 inputKey[4] = {0,0,0,0};
if (dStrcmp(inputKeyString, "") != 0)
if (String::compare(inputKeyString, "") != 0)
{
dSscanf(inputKeyString, "%i %i %i %i", &inputKey[0], &inputKey[1], &inputKey[2], &inputKey[3]);
}

View file

@ -500,7 +500,7 @@ void GuiGameListMenuCtrl::addRow(const char* label, const char* optionsList, boo
const char* option = StringUnit::getUnit(optionsList, i, DELIM);
options.push_back(StringTable->insert(option, true));
if (dStrcmp(option, defaultValue) == 0)
if (String::compare(option, defaultValue) == 0)
defaultOption = options.size() - 1;
}
row->mOptions = options;
@ -1073,7 +1073,7 @@ bool GuiGameListMenuCtrl::selectOption(S32 rowIndex, const char* theOption)
for (Vector<StringTableEntry>::iterator anOption = row->mOptions.begin(); anOption < row->mOptions.end(); ++anOption)
{
if (dStrcmp(*anOption, theOption) == 0)
if (String::compare(*anOption, theOption) == 0)
{
S32 newIndex = anOption - row->mOptions.begin();
row->mSelectedOption = newIndex;

View file

@ -108,7 +108,7 @@ void GuiPopupMenuTextListCtrl::onRenderCell(Point2I offset, Point2I cell, bool s
}
else
{
if (dStrcmp(mList[cell.y].text + 3, "-\t")) // Was: dStrcmp(mList[cell.y].text + 2, "-\t")) but has been changed to take into account the submenu flag
if (String::compare(mList[cell.y].text + 3, "-\t")) // Was: String::compare(mList[cell.y].text + 2, "-\t")) but has been changed to take into account the submenu flag
{
Parent::onRenderCell(offset, cell, selected, mouseOver);
}

View file

@ -1974,11 +1974,11 @@ void GuiConvexEditorCtrl::setSelectedFaceMaterial(const char* materialName)
bool found = false;
U32 oldmatID = mConvexSEL->mSurfaceUVs[mFaceSEL].matID;
if (dStrcmp(materialName, mConvexSEL->getMaterialName().c_str()))
if (String::compare(materialName, mConvexSEL->getMaterialName().c_str()))
{
for (U32 i = 0; i < mConvexSEL->mSurfaceTextures.size(); i++)
{
if (!dStrcmp(mConvexSEL->mSurfaceTextures[i].materialName, materialName))
if (!String::compare(mConvexSEL->mSurfaceTextures[i].materialName, materialName))
{
//found a match
mConvexSEL->mSurfaceUVs[mFaceSEL].matID = i + 1;
@ -2958,7 +2958,7 @@ DefineEngineMethod(GuiConvexEditorCtrl, setSelectedFaceMaterial, void, (const ch
"@return true if successful, false if failed (objB is not valid)")
{
//return Point2F(0, 0);
if (!dStrcmp(materialName, ""))
if (!String::compare(materialName, ""))
return;
object->setSelectedFaceMaterial(materialName);

View file

@ -2415,7 +2415,7 @@ DefineEngineMethod( TerrainEditor, attachTerrain, void, (const char * terrain),
VectorPtr<TerrainBlock*> terrains;
// attach to first found terrainBlock
if (dStrcmp (terrain,"")==0)
if (String::compare (terrain,"")==0)
{
for(SimSetIterator itr(scene); *itr; ++itr)
{

View file

@ -83,7 +83,7 @@ S32 QSORT_CALLBACK moduleDependencySort(const void* a, const void* b)
bool foundDependant = false;
for (ModuleDefinition::typeModuleDependencyVector::const_iterator dependencyItr = moduleDependencies.begin(); dependencyItr != moduleDependencies.end(); ++dependencyItr)
{
if (dStrcmp(dependencyItr->mModuleId, pDefinition2->getModuleId())
if (String::compare(dependencyItr->mModuleId, pDefinition2->getModuleId())
&& (dependencyItr->mVersionId == pDefinition2->getVersionId()))
foundDependant = true;
}

View file

@ -198,7 +198,7 @@ bool FileDialog::Execute()
//The first of each pair is the name, which we'll skip because NFD doesn't support named filters atm
String filter = StringUnit::getUnit(mData.mFilters, i, "|");
if (!dStrcmp(filter.c_str(), "*.*"))
if (!String::compare(filter.c_str(), "*.*"))
continue;
U32 subFilterCount = StringUnit::getUnitCount(filter, ";");

View file

@ -101,7 +101,7 @@ static bool deleteDirectoryRecusrive(const char* pPath)
StringTableEntry basePath = *basePathItr;
// Skip if the base path.
if (basePathItr == directories.begin() && dStrcmp(pPath, basePath) == 0)
if (basePathItr == directories.begin() && String::compare(pPath, basePath) == 0)
continue;
// Delete any directories recursively.
@ -624,4 +624,4 @@ DefineEngineFunction( getUserHomeDirectory, const char *, (), , "getUserHomeDire
DefineEngineFunction(setMainDotCsDir, void, (const char* path), , "setMainDotCsDir()")
{
Platform::setMainDotCsDir(StringTable->insert(path));
}
}

View file

@ -1874,7 +1874,7 @@ DefineEngineMethod(SceneObject, attachToParent, bool, (const char*_sceneObject),
}
else
{
if ((!dStrcmp("0", _sceneObject))|| (!dStrcmp("", _sceneObject)))
if ((!String::compare("0", _sceneObject))|| (!String::compare("", _sceneObject)))
return object->attachToParent(NULL);
else
{

View file

@ -309,7 +309,7 @@ void VertPixelConnectorGLSL::print( Stream &stream, bool isVerterShader )
U8 output[256];
Var *var = mElementList[i];
if(!dStrcmp((const char*)var->name, "gl_Position"))
if(!String::compare((const char*)var->name, "gl_Position"))
continue;
if(var->arraySize <= 1)
@ -339,7 +339,7 @@ void VertPixelConnectorGLSL::printOnMain( Stream &stream, bool isVerterShader )
U8 output[256];
Var *var = mElementList[i];
if(!dStrcmp((const char*)var->name, "gl_Position"))
if(!String::compare((const char*)var->name, "gl_Position"))
continue;
dSprintf((char*)output, sizeof(output), " %s IN_%s = _%s_;\r\n", var->type, var->name, var->connectName);
@ -415,7 +415,7 @@ void VertPixelConnectorGLSL::printStructDefines( Stream &stream, bool in )
U8 output[256];
Var *var = mElementList[i];
if(!dStrcmp((const char*)var->name, "gl_Position"))
if(!String::compare((const char*)var->name, "gl_Position"))
continue;
if(!in)

View file

@ -195,14 +195,14 @@ Var * ShaderFeatureGLSL::getVertTexCoord( const String &name )
for( U32 i=0; i<LangElement::elementList.size(); i++ )
{
if( !dStrcmp( (char*)LangElement::elementList[i]->name, name.c_str() ) )
if( !String::compare( (char*)LangElement::elementList[i]->name, name.c_str() ) )
{
inTex = dynamic_cast<Var*>( LangElement::elementList[i] );
if ( inTex )
{
// NOTE: This used to do this check...
//
// dStrcmp( (char*)inTex->structName, "IN" )
// String::compare( (char*)inTex->structName, "IN" )
//
// ... to ensure that the var was from the input
// vertex structure, but this kept some features
@ -389,7 +389,7 @@ Var* ShaderFeatureGLSL::getOutTexCoord( const char *name,
}
}
AssertFatal( dStrcmp( type, (const char*)texCoord->type ) == 0,
AssertFatal( String::compare( type, (const char*)texCoord->type ) == 0,
"ShaderFeatureGLSL::getOutTexCoord - Type mismatch!" );
return texCoord;
@ -409,7 +409,7 @@ Var* ShaderFeatureGLSL::getInTexCoord( const char *name,
texCoord->setType( type );
}
AssertFatal( dStrcmp( type, (const char*)texCoord->type ) == 0,
AssertFatal( String::compare( type, (const char*)texCoord->type ) == 0,
"ShaderFeatureGLSL::getInTexCoord - Type mismatch!" );
return texCoord;
@ -429,7 +429,7 @@ Var* ShaderFeatureGLSL::getInColor( const char *name,
inColor->setType( type );
}
AssertFatal( dStrcmp( type, (const char*)inColor->type ) == 0,
AssertFatal( String::compare( type, (const char*)inColor->type ) == 0,
"ShaderFeatureGLSL::getInColor - Type mismatch!" );
return inColor;

View file

@ -129,7 +129,7 @@ void AssimpAppMaterial::initMaterial(const Torque::Path& path, Material* mat) co
aiString opacityMode;
if (AI_SUCCESS == mAIMat->Get("$mat.gltf.alphaMode", 0, 0, opacityMode))
{
if (dStrcmp("MASK", opacityMode.C_Str()) == 0)
if (String::compare("MASK", opacityMode.C_Str()) == 0)
{
translucent = true;
blendOp = Material::None;
@ -141,7 +141,7 @@ void AssimpAppMaterial::initMaterial(const Torque::Path& path, Material* mat) co
mat->mAlphaTest = true;
}
}
else if (dStrcmp("BLEND", opacityMode.C_Str()) == 0)
else if (String::compare("BLEND", opacityMode.C_Str()) == 0)
{
translucent = true;
blendOp = Material::LerpAlpha;

View file

@ -530,7 +530,7 @@ bool ColladaShapeLoader::canLoadCachedDTS(const Torque::Path& path)
//assume the dts is good since it was zipped on purpose
Torque::FS::FileSystemRef ref = Torque::FS::GetFileSystem(cachedPath);
if (ref && !dStrcmp("Zip", ref->getTypeStr()))
if (ref && !String::compare("Zip", ref->getTypeStr()))
{
bool forceLoadDAE = Con::getBoolVariable("$collada::forceLoadDAE", false);
@ -722,7 +722,7 @@ TSShape* loadColladaShape(const Torque::Path &path)
if (dtsStream.open(cachedPath.getFullPath(), Torque::FS::File::Write))
{
Torque::FS::FileSystemRef ref = Torque::FS::GetFileSystem(daePath);
if (ref && !dStrcmp("Zip", ref->getTypeStr()))
if (ref && !String::compare("Zip", ref->getTypeStr()))
Con::errorf("No cached dts file found in archive for %s. Forcing cache to disk.", daePath.getFullFileName().c_str());
Con::printf("Writing cached COLLADA shape to %s", cachedPath.getFullPath().c_str());