Skip to content

Commit

Permalink
Merge pull request #1 from AbrahamJewowich/cbitcoinaddress
Browse files Browse the repository at this point in the history
Cbitcoinaddress
  • Loading branch information
sipa committed Jul 18, 2011
2 parents cb61b8d + 03f8b54 commit ca40e58
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/base58.h
Expand Up @@ -173,14 +173,16 @@ class CBase58Data

~CBase58Data()
{
memset(&vchData[0], 0, vchData.size());
if (!vchData.empty())
memset(&vchData[0], 0, vchData.size());
}

void SetData(int nVersionIn, const void* pdata, size_t nSize)
{
nVersion = nVersionIn;
vchData.resize(nSize);
memcpy(&vchData[0], pdata, nSize);
if (!vchData.empty())
memcpy(&vchData[0], pdata, nSize);
}

void SetData(int nVersionIn, const unsigned char *pbegin, const unsigned char *pend)
Expand All @@ -201,7 +203,8 @@ class CBase58Data
}
nVersion = vchTemp[0];
vchData.resize(vchTemp.size() - 1);
memcpy(&vchData[0], &vchTemp[1], vchData.size());
if (!vchData.empty())
memcpy(&vchData[0], &vchTemp[1], vchData.size());
memset(&vchTemp[0], 0, vchTemp.size());
return true;
}
Expand All @@ -221,7 +224,7 @@ class CBase58Data
int CompareTo(const CBase58Data& b58) const
{
if (nVersion < b58.nVersion) return -1;
if (nVersion < b58.nVersion) return 1;
if (nVersion > b58.nVersion) return 1;
if (vchData < b58.vchData) return -1;
if (vchData > b58.vchData) return 1;
return 0;
Expand Down

0 comments on commit ca40e58

Please sign in to comment.