1
0
Fork 0

UIUC cleanup for -Wsign-compare compilation warnings.

The string find_first_not_of() and find_first_of() functions return string::npos
if not found, rather than -1.
This commit is contained in:
Edward d'Auvergne 2015-12-10 09:02:00 +01:00
parent e7d405d0ee
commit 4eeeaf140c

View file

@ -108,7 +108,7 @@ string ParseFile :: getToken(string inputLine, int tokenNo)
while (tokencounter < tokenNo) while (tokencounter < tokenNo)
{ {
if ((pos1 == inputLine.npos) || (pos1 == -1) || (pos == -1) ) if ( (pos1 == inputLine.npos) || (pos1 == string::npos) || (pos == string::npos) )
return ""; //return an empty string if tokenNo exceeds the No of tokens in the line return ""; //return an empty string if tokenNo exceeds the No of tokens in the line
inputLine = inputLine.substr(pos1 , MAXLINE); inputLine = inputLine.substr(pos1 , MAXLINE);
@ -117,7 +117,7 @@ string ParseFile :: getToken(string inputLine, int tokenNo)
tokencounter ++; tokencounter ++;
} }
if (pos1== -1 || pos == -1) if (pos1== string::npos || pos == string::npos)
return ""; return "";
else else
return inputLine.substr(pos , pos1-pos); // return the desired token return inputLine.substr(pos , pos1-pos); // return the desired token