1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-26 09:35:28 +00:00

Book parser: Fix comparison between signed and unsigned integer expressions

This commit is contained in:
MiroslavR 2014-09-22 16:28:17 +02:00
parent 51cd2678ae
commit 4b1df64fba
2 changed files with 8 additions and 12 deletions

View File

@ -21,7 +21,7 @@ namespace MWGui
{
/* BookTextParser */
BookTextParser::BookTextParser(const std::string & text)
: mIndex(-1), mText(text), mIgnoreNewlineTags(true), mIgnoreLineEndings(true)
: mIndex(0), mText(text), mIgnoreNewlineTags(true), mIgnoreLineEndings(true)
{
MWScript::InterpreterContext interpreterContext(NULL, MWWorld::Ptr()); // empty arguments, because there is no locals or actor
mText = Interpreter::fixDefinesBook(mText, interpreterContext);
@ -47,16 +47,8 @@ namespace MWGui
BookTextParser::Events BookTextParser::next()
{
while (1)
while (mIndex < mText.size())
{
++mIndex;
if (mIndex >= mText.size())
{
flushBuffer();
return Event_EOF;
}
char ch = mText[mIndex];
if (ch == '<')
{
@ -93,6 +85,7 @@ namespace MWGui
mIgnoreNewlineTags = false;
}
++mIndex;
return type;
}
}
@ -106,8 +99,11 @@ namespace MWGui
}
}
++mIndex;
}
flushBuffer();
return Event_EOF;
}
void BookTextParser::flushBuffer()

View File

@ -49,7 +49,7 @@ namespace MWGui
void parseTag(std::string tag);
private:
int mIndex;
size_t mIndex;
std::string mText;
std::string mReadyText;