@@ -110,7 +110,7 @@ std::string EncodeBase58(const unsigned char* pbegin, const unsigned char* pend)
110
110
111
111
std::string EncodeBase58 (const std::vector<unsigned char >& vch)
112
112
{
113
- return EncodeBase58 (& vch[ 0 ], & vch[ 0 ] + vch.size ());
113
+ return EncodeBase58 (vch. data (), vch. data () + vch.size ());
114
114
}
115
115
116
116
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
160
160
vchVersion = vchVersionIn;
161
161
vchData.resize (nSize);
162
162
if (!vchData.empty ())
163
- memcpy (& vchData[ 0 ] , pdata, nSize);
163
+ memcpy (vchData. data () , pdata, nSize);
164
164
}
165
165
166
166
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)
180
180
vchVersion.assign (vchTemp.begin (), vchTemp.begin () + nVersionBytes);
181
181
vchData.resize (vchTemp.size () - nVersionBytes);
182
182
if (!vchData.empty ())
183
- memcpy (& vchData[ 0 ], & vchTemp[ nVersionBytes] , vchData.size ());
184
- memory_cleanse (& vchTemp[ 0 ] , vchTemp.size ());
183
+ memcpy (vchData. data (), vchTemp. data () + nVersionBytes, vchData.size ());
184
+ memory_cleanse (vchTemp. data () , vchTemp.size ());
185
185
return true ;
186
186
}
187
187
@@ -262,7 +262,7 @@ CTxDestination CBitcoinAddress::Get() const
262
262
if (!IsValid ())
263
263
return CNoDestination ();
264
264
uint160 id;
265
- memcpy (&id, & vchData[ 0 ] , 20 );
265
+ memcpy (&id, vchData. data () , 20 );
266
266
if (vchVersion == Params ().Base58Prefix (CChainParams::PUBKEY_ADDRESS))
267
267
return CKeyID (id);
268
268
else if (vchVersion == Params ().Base58Prefix (CChainParams::SCRIPT_ADDRESS))
@@ -276,7 +276,7 @@ bool CBitcoinAddress::GetKeyID(CKeyID& keyID) const
276
276
if (!IsValid () || vchVersion != Params ().Base58Prefix (CChainParams::PUBKEY_ADDRESS))
277
277
return false ;
278
278
uint160 id;
279
- memcpy (&id, & vchData[ 0 ] , 20 );
279
+ memcpy (&id, vchData. data () , 20 );
280
280
keyID = CKeyID (id);
281
281
return true ;
282
282
}
0 commit comments