The string class returns string::npos, when find() fails.

Noticed when sign-comparison warnings were enabled.
This commit is contained in:
Jeff Garzik
2012-04-15 16:47:24 -04:00
committed by Jeff Garzik
parent 5a701eb7ea
commit ab9dc75a18
3 changed files with 7 additions and 7 deletions

View File

@@ -162,14 +162,14 @@ bool GetMyExternalIP2(const CService& addrConnect, const char* pszGet, const cha
}
if (pszKeyword == NULL)
break;
if (strLine.find(pszKeyword) != -1)
if (strLine.find(pszKeyword) != string::npos)
{
strLine = strLine.substr(strLine.find(pszKeyword) + strlen(pszKeyword));
break;
}
}
closesocket(hSocket);
if (strLine.find("<") != -1)
if (strLine.find("<") != string::npos)
strLine = strLine.substr(0, strLine.find("<"));
strLine = strLine.substr(strspn(strLine.c_str(), " \t\n\r"));
while (strLine.size() > 0 && isspace(strLine[strLine.size()-1]))