find returns npos when not found, not -1. I blame Java for making me think like that.

This commit is contained in:
Jez Higgins 2010-01-15 10:22:02 +00:00
parent 4a19fdc2e4
commit 4d2ecb80c0
2 changed files with 2 additions and 2 deletions

View file

@ -85,7 +85,7 @@ bool TestRunner::run(int ac, const char **av)
string executable = av[0]; string executable = av[0];
size_t slash = executable.find_last_of("/\\"); size_t slash = executable.find_last_of("/\\");
if(slash != -1) if(slash != string::npos)
executable.erase(0, slash+1); executable.erase(0, slash+1);
executable += "-"; executable += "-";

View file

@ -44,7 +44,7 @@ void printException(std::ostream& stream,
*w = '?'; *w = '?';
std::string what = msg; std::string what = msg;
size_t cut = msg.find_first_of("<>'"); size_t cut = msg.find_first_of("<>'");
if(cut != -1) if(cut != std::string::npos)
{ {
msg.erase(cut); msg.erase(cut);
msg += "..."; msg += "...";