Fix a potential infinite loop in the landscape.txt interpreter

Günther Brammer 2010-04-25 14:27:06 +02:00
parent e852c15944
commit 3342509880
3 changed files with 7 additions and 7 deletions

View File

@ -518,7 +518,7 @@ bool C4MCOverlay::CheckMask(int32_t iX, int32_t iY)
for (int32_t i=10; i<=Turbulence; i*=10)
{
int32_t Seed2; Seed2=Seed;
for (int32_t l=0; l<=Lambda; ++l)
for (int32_t l=0; l<Lambda+1; ++l)
{
for (FIXED d=itofix(2); d<6; d+=FIXED10(15))
{

View File

@ -320,9 +320,9 @@ bool SCopyNamedSegment(const char *szString, const char *szName, char *sTarget,
return true;
}
int SCharCount(char cTarget, const char *szInStr, const char *cpUntil)
unsigned int SCharCount(char cTarget, const char *szInStr, const char *cpUntil)
{
int iResult=0;
unsigned int iResult=0;
// Scan string
while (*szInStr)
{
@ -337,9 +337,9 @@ int SCharCount(char cTarget, const char *szInStr, const char *cpUntil)
return iResult;
}
int SCharCountEx(const char *szString, const char *szCharList)
unsigned int SCharCountEx(const char *szString, const char *szCharList)
{
int iResult = 0;
unsigned int iResult = 0;
while ( *szCharList )
{
iResult += SCharCount( *szCharList, szString );

View File

@ -105,8 +105,8 @@ void SDelete(char *szString, int iLen, int iPosition=0);
int SCharPos(char cTarget, const char *szInStr, int iIndex=0);
int SCharLastPos(char cTarget, const char *szInStr);
int SCharCount(char cTarget, const char *szInStr, const char *cpUntil=NULL);
int SCharCountEx(const char *szString, const char *szCharList);
unsigned int SCharCount(char cTarget, const char *szInStr, const char *cpUntil=NULL);
unsigned int SCharCountEx(const char *szString, const char *szCharList);
void SReplaceChar(char *str, char fc, char tc);