aboutsummaryrefslogtreecommitdiff
path: root/src/base58.cpp
diff options
context:
space:
mode:
authorJeremy Rubin <jeremy.l.rubin@gmail.com>2017-02-19 13:41:13 -0500
committerJeremy Rubin <jeremy.l.rubin@gmail.com>2017-07-08 13:33:01 -0700
commit361d95265a78c9bcdfbb70c4c0e5b43ff2d8adc3 (patch)
tree3e546a9992ce8c2b1a1a21a4c8e016787bc74ae7 /src/base58.cpp
parent6896dbf16996402cc9820e345605716a3dc60482 (diff)
Fix subscript[0] in base58.cpp
Diffstat (limited to 'src/base58.cpp')
-rw-r--r--src/base58.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/base58.cpp b/src/base58.cpp
index efa1beb1e4..17022a6bc1 100644
--- a/src/base58.cpp
+++ b/src/base58.cpp
@@ -110,7 +110,7 @@ std::string EncodeBase58(const unsigned char* pbegin, const unsigned char* pend)
std::string EncodeBase58(const std::vector<unsigned char>& vch)
{
- return EncodeBase58(&vch[0], &vch[0] + vch.size());
+ return EncodeBase58(vch.data(), vch.data() + vch.size());
}
bool DecodeBase58(const std::string& str, std::vector<unsigned char>& vchRet)
@@ -160,7 +160,7 @@ void CBase58Data::SetData(const std::vector<unsigned char>& vchVersionIn, const
vchVersion = vchVersionIn;
vchData.resize(nSize);
if (!vchData.empty())
- memcpy(&vchData[0], pdata, nSize);
+ memcpy(vchData.data(), pdata, nSize);
}
void CBase58Data::SetData(const std::vector<unsigned char>& vchVersionIn, const unsigned char* pbegin, const unsigned char* pend)
@@ -180,8 +180,8 @@ bool CBase58Data::SetString(const char* psz, unsigned int nVersionBytes)
vchVersion.assign(vchTemp.begin(), vchTemp.begin() + nVersionBytes);
vchData.resize(vchTemp.size() - nVersionBytes);
if (!vchData.empty())
- memcpy(&vchData[0], &vchTemp[nVersionBytes], vchData.size());
- memory_cleanse(&vchTemp[0], vchTemp.size());
+ memcpy(vchData.data(), vchTemp.data() + nVersionBytes, vchData.size());
+ memory_cleanse(vchTemp.data(), vchTemp.size());
return true;
}
@@ -262,7 +262,7 @@ CTxDestination CBitcoinAddress::Get() const
if (!IsValid())
return CNoDestination();
uint160 id;
- memcpy(&id, &vchData[0], 20);
+ memcpy(&id, vchData.data(), 20);
if (vchVersion == Params().Base58Prefix(CChainParams::PUBKEY_ADDRESS))
return CKeyID(id);
else if (vchVersion == Params().Base58Prefix(CChainParams::SCRIPT_ADDRESS))
@@ -276,7 +276,7 @@ bool CBitcoinAddress::GetKeyID(CKeyID& keyID) const
if (!IsValid() || vchVersion != Params().Base58Prefix(CChainParams::PUBKEY_ADDRESS))
return false;
uint160 id;
- memcpy(&id, &vchData[0], 20);
+ memcpy(&id, vchData.data(), 20);
keyID = CKeyID(id);
return true;
}