diff options
author | Jeff Garzik <jeff@garzik.org> | 2012-04-15 16:47:24 -0400 |
---|---|---|
committer | Luke Dashjr <luke-jr+git@utopios.org> | 2012-04-17 14:50:26 -0400 |
commit | ef2f3ddaf764f886fbb4d6004844fe88b8029cf2 (patch) | |
tree | c88e3f921d90c4a1453039a7e28714b55809d67e /src | |
parent | 1175d8f6a1782da777f406a8400b7281a7af09e7 (diff) | |
download | bitcoin-ef2f3ddaf764f886fbb4d6004844fe88b8029cf2.tar.xz |
The string class returns string::npos, when find() fails.
Noticed when sign-comparison warnings were enabled.
Diffstat (limited to 'src')
-rw-r--r-- | src/irc.cpp | 8 | ||||
-rw-r--r-- | src/net.cpp | 4 | ||||
-rw-r--r-- | src/rpc.cpp | 2 |
3 files changed, 7 insertions, 7 deletions
diff --git a/src/irc.cpp b/src/irc.cpp index 5dfab06bac..5ac2306f16 100644 --- a/src/irc.cpp +++ b/src/irc.cpp @@ -156,13 +156,13 @@ int RecvUntil(SOCKET hSocket, const char* psz1, const char* psz2=NULL, const cha if (!RecvLineIRC(hSocket, strLine)) return 0; printf("IRC %s\n", strLine.c_str()); - if (psz1 && strLine.find(psz1) != -1) + if (psz1 && strLine.find(psz1) != string::npos) return 1; - if (psz2 && strLine.find(psz2) != -1) + if (psz2 && strLine.find(psz2) != string::npos) return 2; - if (psz3 && strLine.find(psz3) != -1) + if (psz3 && strLine.find(psz3) != string::npos) return 3; - if (psz4 && strLine.find(psz4) != -1) + if (psz4 && strLine.find(psz4) != string::npos) return 4; } } diff --git a/src/net.cpp b/src/net.cpp index 763e160edd..38fd3b5a14 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -316,14 +316,14 @@ bool GetMyExternalIP2(const CAddress& 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])) diff --git a/src/rpc.cpp b/src/rpc.cpp index bbfea33d76..8a02d95c1b 100644 --- a/src/rpc.cpp +++ b/src/rpc.cpp @@ -147,7 +147,7 @@ Value help(const Array& params, bool fHelp) // Help text is returned in an exception string strHelp = string(e.what()); if (strCommand == "") - if (strHelp.find('\n') != -1) + if (strHelp.find('\n') != string::npos) strHelp = strHelp.substr(0, strHelp.find('\n')); strRet += strHelp + "\n"; } |