StdCompiler: Removed "compatibility" hack to have RCT_Escaped fallback to RCT_All.

RCT_Escaped is meant to be used when embedding a string into a custom encoding of a structure. That's why it has a terminator symbol and escapes anything that could be interpreted as a seperator. Falling back to RCT_All completely destroys this safeness, as it just blindly copies everything. In case this kind of functionality is really needed, introduce RCT_EscapedAll or something similar.
Peter Wortmann 2010-12-19 01:43:40 +00:00
parent b25b624799
commit 0c8bac0140
2 changed files with 3 additions and 4 deletions

View File

@ -138,7 +138,8 @@ void C4Team::CompileFunc(StdCompiler *pComp)
if (pComp->isCompiler()) { delete [] piPlayers; piPlayers = new int32_t [iPlayerCapacity = iPlayerCount]; ZeroMem(piPlayers, sizeof(*piPlayers) * iPlayerCount); }
pComp->Value(mkNamingAdapt(mkArrayAdapt(piPlayers, iPlayerCount, -1), "Players"));
pComp->Value(mkNamingAdapt(dwClr, "Color", 0u));
pComp->Value(mkNamingAdapt(sIconSpec, "IconSpec", StdCopyStrBuf()));
pComp->Value(mkNamingAdapt(mkParAdapt(sIconSpec, StdCompiler::RCT_All),
"IconSpec", StdCopyStrBuf()));
pComp->Value(mkNamingAdapt(iMaxPlayer, "MaxPlayer", 0));
}
@ -561,7 +562,7 @@ void C4TeamList::CompileFunc(StdCompiler *pComp)
pComp->Value(mkNamingAdapt(fTeamColors, "TeamColors", false));
pComp->Value(mkNamingAdapt(iMaxScriptPlayers, "MaxScriptPlayers", 0));
pComp->Value(mkNamingAdapt(sScriptPlayerNames, "ScriptPlayerNames", StdStrBuf()));
pComp->Value(mkNamingAdapt(mkParAdapt(sScriptPlayerNames, StdCompiler::RCT_All), "ScriptPlayerNames", StdStrBuf()));
int32_t iOldTeamCount = iTeamCount;
pComp->Value(mkNamingCountAdapt(iTeamCount, "Team"));

View File

@ -622,8 +622,6 @@ void StdCompilerINIRead::String(char *szString, size_t iMaxLength, RawCompileTyp
}
void StdCompilerINIRead::String(char **pszString, RawCompileType eType)
{
// For Backwards compatibility: Escaped strings default to normal strings if no escaped string is given
if (eType == RCT_Escaped && pPos && *pPos!='"') eType = RCT_All;
// Get length
size_t iLength = GetStringLength(eType);
// Read data