Core/HashDigest: Cleanup code

Former-commit-id: 869c880df6822e7cccf4b847bbba9a5390100a5d
This commit is contained in:
Lynix 2015-09-13 12:06:38 +02:00
parent 91ec7c7dce
commit 44e99bce3d
1 changed files with 5 additions and 4 deletions

View File

@ -82,11 +82,12 @@ NzString NzHashDigest::ToHex() const
return NzString();
unsigned int length = m_digestLength*2;
char* hexOutput = new char[length+1];
for (unsigned int i = 0; i < m_digestLength; ++i)
std::sprintf(hexOutput + i*2, "%02x", m_digest[i]);
return NzString(new NzString::SharedString(1, length, length, hexOutput));
NzString hexOutput(length);
for (unsigned int i = 0; i < m_digestLength; ++i)
std::sprintf(&hexOutput[i*2], "%02x", m_digest[i]);
return hexOutput;
}
nzUInt8 NzHashDigest::operator[](unsigned int pos) const