- Fixed some warnings flagged by GCC 4.1.1, which brings up an interesting
observation. The following code works with VC++ 2005. It aborts with GCC:
FString str = "This is a string.";
Printf ("%s\n", str);
SVN r408 (trunk)
This commit is contained in:
parent
6f3a28e355
commit
41de448add
12 changed files with 77 additions and 48 deletions
|
|
@ -749,7 +749,7 @@ public:
|
|||
bool UpdateWaterLevel (fixed_t oldz);
|
||||
|
||||
FState *FindState (FName label) const;
|
||||
FState *FindState (int numnames, int first, ...) const;
|
||||
FState *FindState (int numnames, ...) const;
|
||||
FState *FindState (int numnames, va_list arglist) const;
|
||||
bool HasSpecialDeathStates () const;
|
||||
|
||||
|
|
|
|||
|
|
@ -380,4 +380,4 @@ PSymbol *PSymbolTable::AddSymbol (PSymbol *sym)
|
|||
// Good. The symbol is not in the table yet.
|
||||
Symbols.Insert (MAX(min, max), sym);
|
||||
return sym;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -509,8 +509,7 @@ bool AActor::HasSpecialDeathStates () const
|
|||
//
|
||||
//===========================================================================
|
||||
|
||||
FState *AActor::FindState (int numnames, int first, ...) const // The 'first' parameter is only here to
|
||||
// disambiguate from the single parameter version
|
||||
FState *AActor::FindState (int numnames, ...) const
|
||||
{
|
||||
va_list arglist;
|
||||
va_start (arglist, numnames);
|
||||
|
|
|
|||
|
|
@ -574,6 +574,12 @@ bool M_ReadIDAT (FileReader *file, BYTE *buffer, int width, int height, int pitc
|
|||
initpass = true;
|
||||
pass = interlace ? 0 : 7;
|
||||
|
||||
// Silence GCC warnings. Due to initpass being true, these will be set
|
||||
// before they're used, but it doesn't know that.
|
||||
curr = prev = 0;
|
||||
passwidth = passpitch = bytesPerRowIn = 0;
|
||||
passbuff = 0;
|
||||
|
||||
while (err != Z_STREAM_END && pass < 8 - interlace)
|
||||
{
|
||||
if (initpass)
|
||||
|
|
|
|||
|
|
@ -4753,7 +4753,7 @@ void AActor::Crash()
|
|||
|
||||
if (DamageType != NAME_None)
|
||||
{
|
||||
crashstate = GetClass()->ActorInfo->FindStateExact(2, NAME_Crash, DamageType);
|
||||
crashstate = GetClass()->ActorInfo->FindStateExact(2, NAME_Crash, int(DamageType));
|
||||
}
|
||||
if (crashstate == NULL)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -376,6 +376,27 @@ static void ParseOuter ()
|
|||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// SetSplashDefaults
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
static void SetSplashDefaults (FSplashDef *splashdef)
|
||||
{
|
||||
splashdef->SmallSplashSound =
|
||||
splashdef->NormalSplashSound = 0;
|
||||
splashdef->SmallSplash =
|
||||
splashdef->SplashBase =
|
||||
splashdef->SplashChunk = NULL;
|
||||
splashdef->ChunkXVelShift =
|
||||
splashdef->ChunkYVelShift =
|
||||
splashdef->ChunkZVelShift = 8;
|
||||
splashdef->ChunkBaseZVel = FRACUNIT;
|
||||
splashdef->SmallSplashClip = 12*FRACUNIT;
|
||||
splashdef->NoAlert = false;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// ParseSplash
|
||||
|
|
@ -395,6 +416,7 @@ void ParseSplash ()
|
|||
if (splashnum < 0)
|
||||
{
|
||||
FSplashDef def;
|
||||
SetSplashDefaults (&def);
|
||||
def.Name = name;
|
||||
splashnum = (int)Splashes.Push (def);
|
||||
isnew = true;
|
||||
|
|
@ -402,19 +424,16 @@ void ParseSplash ()
|
|||
splashdef = &Splashes[splashnum];
|
||||
|
||||
SC_MustGetString ();
|
||||
if (!SC_Compare ("modify") || (SC_MustGetString(), isnew))
|
||||
if (!SC_Compare ("modify"))
|
||||
{ // Set defaults
|
||||
splashdef->SmallSplashSound =
|
||||
splashdef->NormalSplashSound = 0;
|
||||
splashdef->SmallSplash =
|
||||
splashdef->SplashBase =
|
||||
splashdef->SplashChunk = NULL;
|
||||
splashdef->ChunkXVelShift =
|
||||
splashdef->ChunkYVelShift =
|
||||
splashdef->ChunkZVelShift = 8;
|
||||
splashdef->ChunkBaseZVel = FRACUNIT;
|
||||
splashdef->SmallSplashClip = 12*FRACUNIT;
|
||||
splashdef->NoAlert = false;
|
||||
if (!isnew)
|
||||
{ // New ones already have their defaults set before they're pushed.
|
||||
SetSplashDefaults (splashdef);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SC_MustGetString();
|
||||
}
|
||||
if (!SC_Compare ("{"))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1197,7 +1197,7 @@ void RP_AddLine (seg_t *line)
|
|||
}
|
||||
else
|
||||
{ // The seg is only part of the wall.
|
||||
if (line->linedef->sidenum[0] != line->sidedef - sides)
|
||||
if (line->linedef->sidenum[0] != DWORD(line->sidedef - sides))
|
||||
{
|
||||
swap (v1, v2);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -440,8 +440,9 @@ void SC_MustGetToken (int token)
|
|||
SC_MustGetAnyToken ();
|
||||
if (sc_TokenType != token)
|
||||
{
|
||||
SC_ScriptError ("Expected %s but got %s instead.",
|
||||
SC_TokenName(token), SC_TokenName(sc_TokenType, sc_String));
|
||||
FString tok1 = SC_TokenName(token);
|
||||
FString tok2 = SC_TokenName(sc_TokenType, sc_String);
|
||||
SC_ScriptError ("Expected %s but got %s instead.", tok1.GetChars(), tok2.GetChars());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1649,7 +1649,7 @@ do_stop:
|
|||
stype = PClass::FindClass (scopename);
|
||||
if (stype == NULL)
|
||||
{
|
||||
SC_ScriptError ("%s is an unknown class.", scopename);
|
||||
SC_ScriptError ("%s is an unknown class.", scopename.GetChars());
|
||||
}
|
||||
if (!stype->IsDescendantOf (RUNTIME_CLASS(AActor)))
|
||||
{
|
||||
|
|
@ -4327,7 +4327,8 @@ void ParseClass()
|
|||
}
|
||||
else
|
||||
{
|
||||
SC_ScriptError ("Expected 'action' or 'const' but got %s", SC_TokenName(sc_TokenType, sc_String));
|
||||
FString tokname = SC_TokenName(sc_TokenType, sc_String);
|
||||
SC_ScriptError ("Expected 'action' or 'const' but got %s", tokname.GetChars());
|
||||
}
|
||||
SC_MustGetAnyToken();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -404,7 +404,7 @@ static void DoJump(AActor * self, FState * CallingState, int offset)
|
|||
if (classname != NAME_None) Printf("%s::", ((FName)(ENamedName)classname).GetChars());
|
||||
for (int i=0;i<JumpParameters[offset+1];i++)
|
||||
{
|
||||
Printf("%s%s", dot, ((FName)(ENamedName)JumpParameters[offset+2+i]));
|
||||
Printf("%s%s", dot, ((FName)(ENamedName)JumpParameters[offset+2+i]).GetChars());
|
||||
}
|
||||
Printf("not found in %s\n", self->GetClass()->TypeName.GetChars());
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -885,7 +885,8 @@ static ExpData *ParseExpressionA (const PClass *cls)
|
|||
}
|
||||
else
|
||||
{
|
||||
SC_ScriptError ("Unexpected token %s", SC_TokenName(sc_TokenType, sc_String));
|
||||
FString tokname = SC_TokenName(sc_TokenType, sc_String);
|
||||
SC_ScriptError ("Unexpected token %s", tokname.GetChars());
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
|
@ -946,6 +947,8 @@ static ExpVal EvalExpression (ExpData *data, AActor *self, const PClass *cls)
|
|||
{
|
||||
ExpVal val;
|
||||
|
||||
val.Type = VAL_Int; // Placate GCC
|
||||
|
||||
switch (data->Type)
|
||||
{
|
||||
case EX_NOP:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue