Remove implicit conversion operator from RString to const char*

This is required for the RString to std::string migration.

Mostly automated from https://github.com/aeubanks/rewriter/blob/main/c_str.cc, with some manual intervention required for fixing up `a + b.c_str()` to `(a + b).c_str()`.

Added some overloads for some common global functions like sm_crash to reduce the number of changes required here.
This commit is contained in:
Arthur Eubanks
2025-04-26 17:30:36 -07:00
committed by teejusb
parent 6a981ac5f7
commit ecfcb11a00
110 changed files with 458 additions and 426 deletions
+9 -9
View File
@@ -241,12 +241,12 @@ bool msAnimation::LoadMilkshapeAsciiBones( RString sAniName, RString sPath )
{
iLineNum++;
if (!strncmp (sLine, "//", 2))
if (!strncmp (sLine.c_str(), "//", 2))
continue;
// bones
int nNumBones = 0;
if( sscanf (sLine, "Bones: %d", &nNumBones) != 1 )
if( sscanf (sLine.c_str(), "Bones: %d", &nNumBones) != 1 )
continue;
char szName[MS_MAX_NAME];
@@ -260,7 +260,7 @@ bool msAnimation::LoadMilkshapeAsciiBones( RString sAniName, RString sPath )
// name
if( f.GetLine( sLine ) <= 0 )
THROW;
if (sscanf(sLine, "\"%31[^\"]\"", szName) != 1)
if (sscanf(sLine.c_str(), "\"%31[^\"]\"", szName) != 1)
THROW;
Bone.sName = szName;
@@ -268,7 +268,7 @@ bool msAnimation::LoadMilkshapeAsciiBones( RString sAniName, RString sPath )
if( f.GetLine( sLine ) <= 0 )
THROW;
strcpy(szName, "");
sscanf(sLine, "\"%31[^\"]\"", szName);
sscanf(sLine.c_str(), "\"%31[^\"]\"", szName);
Bone.sParentName = szName;
@@ -278,7 +278,7 @@ bool msAnimation::LoadMilkshapeAsciiBones( RString sAniName, RString sPath )
THROW;
int nFlags;
if (sscanf (sLine, "%d %f %f %f %f %f %f",
if (sscanf (sLine.c_str(), "%d %f %f %f %f %f %f",
&nFlags,
&Position[0], &Position[1], &Position[2],
&Rotation[0], &Rotation[1], &Rotation[2]) != 7)
@@ -295,7 +295,7 @@ bool msAnimation::LoadMilkshapeAsciiBones( RString sAniName, RString sPath )
if( f.GetLine( sLine ) <= 0 )
THROW;
int nNumPositionKeys = 0;
if (sscanf (sLine, "%d", &nNumPositionKeys) != 1)
if (sscanf (sLine.c_str(), "%d", &nNumPositionKeys) != 1)
THROW;
Bone.PositionKeys.resize( nNumPositionKeys );
@@ -306,7 +306,7 @@ bool msAnimation::LoadMilkshapeAsciiBones( RString sAniName, RString sPath )
THROW;
float fTime;
if (sscanf (sLine, "%f %f %f %f", &fTime, &Position[0], &Position[1], &Position[2]) != 4)
if (sscanf (sLine.c_str(), "%f %f %f %f", &fTime, &Position[0], &Position[1], &Position[2]) != 4)
THROW;
msPositionKey key = {};
@@ -319,7 +319,7 @@ bool msAnimation::LoadMilkshapeAsciiBones( RString sAniName, RString sPath )
if( f.GetLine( sLine ) <= 0 )
THROW;
int nNumRotationKeys = 0;
if (sscanf (sLine, "%d", &nNumRotationKeys) != 1)
if (sscanf (sLine.c_str(), "%d", &nNumRotationKeys) != 1)
THROW;
Bone.RotationKeys.resize( nNumRotationKeys );
@@ -330,7 +330,7 @@ bool msAnimation::LoadMilkshapeAsciiBones( RString sAniName, RString sPath )
THROW;
float fTime;
if (sscanf (sLine, "%f %f %f %f", &fTime, &Rotation[0], &Rotation[1], &Rotation[2]) != 4)
if (sscanf (sLine.c_str(), "%f %f %f %f", &fTime, &Rotation[0], &Rotation[1], &Rotation[2]) != 4)
THROW;
Rotation = RadianToDegree(Rotation);