diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -442,7 +442,7 @@ if (!gArgs.GetArgs("-rpcwallet").empty()) { std::string walletName = gArgs.GetArg("-rpcwallet", ""); char *encodedURI = - evhttp_uriencode(walletName.c_str(), walletName.size(), false); + evhttp_uriencode(walletName.data(), walletName.size(), false); if (encodedURI) { endpoint = "/wallet/" + std::string(encodedURI); free(encodedURI); diff --git a/src/crypto/hkdf_sha256_32.cpp b/src/crypto/hkdf_sha256_32.cpp --- a/src/crypto/hkdf_sha256_32.cpp +++ b/src/crypto/hkdf_sha256_32.cpp @@ -9,7 +9,7 @@ CHKDF_HMAC_SHA256_L32::CHKDF_HMAC_SHA256_L32(const uint8_t *ikm, size_t ikmlen, const std::string &salt) { - CHMAC_SHA256((const uint8_t *)salt.c_str(), salt.size()) + CHMAC_SHA256((const uint8_t *)salt.data(), salt.size()) .Write(ikm, ikmlen) .Finalize(m_prk); } diff --git a/src/fs.cpp b/src/fs.cpp --- a/src/fs.cpp +++ b/src/fs.cpp @@ -125,11 +125,11 @@ #else // Convert from Multi Byte to utf-16 std::string mb_string(e.what()); - int size = MultiByteToWideChar(CP_ACP, 0, mb_string.c_str(), + int size = MultiByteToWideChar(CP_ACP, 0, mb_string.data(), mb_string.size(), nullptr, 0); std::wstring utf16_string(size, L'\0'); - MultiByteToWideChar(CP_ACP, 0, mb_string.c_str(), mb_string.size(), + MultiByteToWideChar(CP_ACP, 0, mb_string.data(), mb_string.size(), &*utf16_string.begin(), size); // Convert from utf-16 to utf-8 return std::wstring_convert, wchar_t>() diff --git a/src/httprpc.cpp b/src/httprpc.cpp --- a/src/httprpc.cpp +++ b/src/httprpc.cpp @@ -123,9 +123,9 @@ static const unsigned int KEY_SIZE = 32; uint8_t out[KEY_SIZE]; - CHMAC_SHA256(reinterpret_cast(strSalt.c_str()), + CHMAC_SHA256(reinterpret_cast(strSalt.data()), strSalt.size()) - .Write(reinterpret_cast(strPass.c_str()), + .Write(reinterpret_cast(strPass.data()), strPass.size()) .Finalize(out); std::vector hexvec(out, out + KEY_SIZE); diff --git a/src/util/strencodings.cpp b/src/util/strencodings.cpp --- a/src/util/strencodings.cpp +++ b/src/util/strencodings.cpp @@ -149,7 +149,7 @@ } std::string EncodeBase64(const std::string &str) { - return EncodeBase64((const uint8_t *)str.c_str(), str.size()); + return EncodeBase64((const uint8_t *)str.data(), str.size()); } std::vector DecodeBase64(const char *p, bool *pf_invalid) { @@ -221,7 +221,7 @@ } std::string EncodeBase32(const std::string &str) { - return EncodeBase32((const uint8_t *)str.c_str(), str.size()); + return EncodeBase32((const uint8_t *)str.data(), str.size()); } std::vector DecodeBase32(const char *p, bool *pf_invalid) { diff --git a/src/wallet/crypter.cpp b/src/wallet/crypter.cpp --- a/src/wallet/crypter.cpp +++ b/src/wallet/crypter.cpp @@ -24,7 +24,7 @@ uint8_t buf[CSHA512::OUTPUT_SIZE]; CSHA512 di; - di.Write((const uint8_t *)strKeyData.c_str(), strKeyData.size()); + di.Write((const uint8_t *)strKeyData.data(), strKeyData.size()); di.Write(chSalt.data(), chSalt.size()); di.Finalize(buf);