From 68d83f41400468b4c15b2201e8138b60756d1f30 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 12 Jan 2013 15:32:05 +0000 Subject: quiet compiler warning with string formatting in CParser::Term --- source/gameengine/Expressions/InputParser.cpp | 10 ++++++---- source/gameengine/Expressions/InputParser.h | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/source/gameengine/Expressions/InputParser.cpp b/source/gameengine/Expressions/InputParser.cpp index 0a5af4a18ea..5a2075d52df 100644 --- a/source/gameengine/Expressions/InputParser.cpp +++ b/source/gameengine/Expressions/InputParser.cpp @@ -354,7 +354,7 @@ int CParser::MakeInt() } #endif -STR_String CParser::Symbol2Str(int s) +const char *CParser::Symbol2Str(int s) { // returns a string representation of of symbol s, // for use in Term when generating an error @@ -370,18 +370,20 @@ STR_String CParser::Symbol2Str(int s) case whocodedsym: return "WHOMADE"; case eolsym: return "end of line"; case idsym: return "identifier"; - default: return "unknown"; // should not happen } + return "unknown"; // should not happen } void CParser::Term(int s) { // generates an error if the next symbol isn't the specified symbol s // otherwise, skip the symbol - if (s == sym) NextSym(); + if (s == sym) { + NextSym(); + } else { STR_String msg; - msg.Format("Warning: " + Symbol2Str(s) + " expected\ncontinuing without it"); + msg.Format("Warning: %s expected\ncontinuing without it", Symbol2Str(s)); // AfxMessageBox(msg,MB_ICONERROR); diff --git a/source/gameengine/Expressions/InputParser.h b/source/gameengine/Expressions/InputParser.h index 6dfeff55105..50bb1ae2f6e 100644 --- a/source/gameengine/Expressions/InputParser.h +++ b/source/gameengine/Expressions/InputParser.h @@ -102,7 +102,7 @@ private: #if 0 /* not used yet */ int MakeInt(); #endif - STR_String Symbol2Str(int s); + const char *Symbol2Str(int s); void Term(int s); int Priority(int optor); CExpression *Ex(int i); -- cgit v1.2.3