diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-01-16 16:15:27 +0100 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-01-23 16:05:01 +0100 |
commit | 7d9d134bf95cb6a2ce9623c7e6a3535432a61af2 (patch) | |
tree | eeca53e065947846648d9373f240d593c0c0ecfc /src/netbase.cpp | |
parent | b77dfdc9e36e308aa806d63aa3b5628971789d5a (diff) |
Remove redundant .c_str()s
After the tinyformat switch sprintf() family functions support passing
actual std::string objects.
Remove unnecessary c_str calls (236 of them) in logging and formatting.
Diffstat (limited to 'src/netbase.cpp')
-rw-r--r-- | src/netbase.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/netbase.cpp b/src/netbase.cpp index 37e1df9138..5ec760be38 100644 --- a/src/netbase.cpp +++ b/src/netbase.cpp @@ -171,7 +171,7 @@ bool LookupNumeric(const char *pszName, CService& addr, int portDefault) bool static Socks4(const CService &addrDest, SOCKET& hSocket) { - LogPrintf("SOCKS4 connecting %s\n", addrDest.ToString().c_str()); + LogPrintf("SOCKS4 connecting %s\n", addrDest.ToString()); if (!addrDest.IsIPv4()) { closesocket(hSocket); @@ -209,13 +209,13 @@ bool static Socks4(const CService &addrDest, SOCKET& hSocket) LogPrintf("ERROR: Proxy returned error %d\n", pchRet[1]); return false; } - LogPrintf("SOCKS4 connected %s\n", addrDest.ToString().c_str()); + LogPrintf("SOCKS4 connected %s\n", addrDest.ToString()); return true; } bool static Socks5(string strDest, int port, SOCKET& hSocket) { - LogPrintf("SOCKS5 connecting %s\n", strDest.c_str()); + LogPrintf("SOCKS5 connecting %s\n", strDest); if (strDest.size() > 255) { closesocket(hSocket); @@ -311,7 +311,7 @@ bool static Socks5(string strDest, int port, SOCKET& hSocket) closesocket(hSocket); return error("Error reading from proxy"); } - LogPrintf("SOCKS5 connected %s\n", strDest.c_str()); + LogPrintf("SOCKS5 connected %s\n", strDest); return true; } @@ -326,7 +326,7 @@ bool static ConnectSocketDirectly(const CService &addrConnect, SOCKET& hSocketRe #endif socklen_t len = sizeof(sockaddr); if (!addrConnect.GetSockAddr((struct sockaddr*)&sockaddr, &len)) { - LogPrintf("Cannot connect to %s: unsupported network\n", addrConnect.ToString().c_str()); + LogPrintf("Cannot connect to %s: unsupported network\n", addrConnect.ToString()); return false; } @@ -365,13 +365,13 @@ bool static ConnectSocketDirectly(const CService &addrConnect, SOCKET& hSocketRe int nRet = select(hSocket + 1, NULL, &fdset, NULL, &timeout); if (nRet == 0) { - LogPrint("net", "connection to %s timeout\n", addrConnect.ToString().c_str()); + LogPrint("net", "connection to %s timeout\n", addrConnect.ToString()); closesocket(hSocket); return false; } if (nRet == SOCKET_ERROR) { - LogPrintf("select() for %s failed: %i\n", addrConnect.ToString().c_str(), WSAGetLastError()); + LogPrintf("select() for %s failed: %i\n", addrConnect.ToString(), WSAGetLastError()); closesocket(hSocket); return false; } @@ -382,13 +382,13 @@ bool static ConnectSocketDirectly(const CService &addrConnect, SOCKET& hSocketRe if (getsockopt(hSocket, SOL_SOCKET, SO_ERROR, &nRet, &nRetSize) == SOCKET_ERROR) #endif { - LogPrintf("getsockopt() for %s failed: %i\n", addrConnect.ToString().c_str(), WSAGetLastError()); + LogPrintf("getsockopt() for %s failed: %i\n", addrConnect.ToString(), WSAGetLastError()); closesocket(hSocket); return false; } if (nRet != 0) { - LogPrintf("connect() to %s failed after select(): %s\n", addrConnect.ToString().c_str(), strerror(nRet)); + LogPrintf("connect() to %s failed after select(): %s\n", addrConnect.ToString(), strerror(nRet)); closesocket(hSocket); return false; } @@ -399,7 +399,7 @@ bool static ConnectSocketDirectly(const CService &addrConnect, SOCKET& hSocketRe else #endif { - LogPrintf("connect() to %s failed: %i\n", addrConnect.ToString().c_str(), WSAGetLastError()); + LogPrintf("connect() to %s failed: %i\n", addrConnect.ToString(), WSAGetLastError()); closesocket(hSocket); return false; } @@ -895,7 +895,7 @@ uint64_t CNetAddr::GetHash() const void CNetAddr::print() const { - LogPrintf("CNetAddr(%s)\n", ToString().c_str()); + LogPrintf("CNetAddr(%s)\n", ToString()); } // private extensions to enum Network, only returned by GetExtNetwork, @@ -1136,7 +1136,7 @@ std::string CService::ToString() const void CService::print() const { - LogPrintf("CService(%s)\n", ToString().c_str()); + LogPrintf("CService(%s)\n", ToString()); } void CService::SetPort(unsigned short portIn) |