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:
parent
e7d405d0ee
commit
4eeeaf140c
1 changed files with 2 additions and 2 deletions
|
@ -108,7 +108,7 @@ string ParseFile :: getToken(string inputLine, int 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
|
||||
|
||||
inputLine = inputLine.substr(pos1 , MAXLINE);
|
||||
|
@ -117,7 +117,7 @@ string ParseFile :: getToken(string inputLine, int tokenNo)
|
|||
tokencounter ++;
|
||||
}
|
||||
|
||||
if (pos1== -1 || pos == -1)
|
||||
if (pos1== string::npos || pos == string::npos)
|
||||
return "";
|
||||
else
|
||||
return inputLine.substr(pos , pos1-pos); // return the desired token
|
||||
|
|
Loading…
Reference in a new issue