Fix subscript[0] in utilstrencodings.cpp

This commit is contained in:
Jeremy Rubin 2017-02-19 13:46:19 -05:00
parent bc2e7fd984
commit e19db7b5ad

View file

@ -228,7 +228,7 @@ std::vector<unsigned char> DecodeBase64(const char* p, bool* pfInvalid)
std::string DecodeBase64(const std::string& str)
{
std::vector<unsigned char> vchRet = DecodeBase64(str.c_str());
return (vchRet.size() == 0) ? std::string() : std::string((const char*)&vchRet[0], vchRet.size());
return (vchRet.size() == 0) ? std::string() : std::string((const char*)vchRet.data(), vchRet.size());
}
std::string EncodeBase32(const unsigned char* pch, size_t len)
@ -415,7 +415,7 @@ std::vector<unsigned char> DecodeBase32(const char* p, bool* pfInvalid)
std::string DecodeBase32(const std::string& str)
{
std::vector<unsigned char> vchRet = DecodeBase32(str.c_str());
return (vchRet.size() == 0) ? std::string() : std::string((const char*)&vchRet[0], vchRet.size());
return (vchRet.size() == 0) ? std::string() : std::string((const char*) vchRet.data(), vchRet.size());
}
static bool ParsePrechecks(const std::string& str)