aboutsummaryrefslogtreecommitdiffstats
path: root/src/utility/md5.cpp
diff options
context:
space:
mode:
authorVincent Richard <[email protected]>2005-01-01 11:32:23 +0000
committerVincent Richard <[email protected]>2005-01-01 11:32:23 +0000
commitfc1c6b08d191b3ee9964bf53ea95767bc54377ee (patch)
tree0e6a61589b60909b065523e5e8e1e0039f2fc93d /src/utility/md5.cpp
parentFixed config file for Doxygen. (diff)
downloadvmime-fc1c6b08d191b3ee9964bf53ea95767bc54377ee.tar.gz
vmime-fc1c6b08d191b3ee9964bf53ea95767bc54377ee.zip
Converted all C-style casts to C++-style casts + added unit test for utility::md5.
Diffstat (limited to 'src/utility/md5.cpp')
-rw-r--r--src/utility/md5.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/utility/md5.cpp b/src/utility/md5.cpp
index 53bf17ae..5ad8e973 100644
--- a/src/utility/md5.cpp
+++ b/src/utility/md5.cpp
@@ -70,7 +70,7 @@ md5::md5(const string& in)
: m_finalized(false)
{
init();
- update((vmime_uint8*) in.c_str(), in.length());
+ update(reinterpret_cast <const vmime_uint8*>(in.c_str()), in.length());
}
@@ -102,7 +102,7 @@ static void copyUint8Array(vmime_uint8* dest, const vmime_uint8* src, unsigned l
void md5::update(const string& in)
{
- update((vmime_uint8*) in.c_str(), in.length());
+ update(reinterpret_cast <const vmime_uint8*>(in.c_str()), in.length());
}
@@ -159,8 +159,8 @@ void md5::finalize()
memset(p, 0, padding);
- ((vmime_uint32*) m_block)[14] = (m_byteCount << 3);
- ((vmime_uint32*) m_block)[15] = (m_byteCount >> 29);
+ reinterpret_cast <vmime_uint32*>(m_block)[14] = (m_byteCount << 3);
+ reinterpret_cast <vmime_uint32*>(m_block)[15] = (m_byteCount >> 29);
#if VMIME_BYTE_ORDER_BIG_ENDIAN
swapUint32Array((vmime_uint32*) m_block, (64 - 8) / 4);
@@ -208,7 +208,7 @@ void md5::transformHelper()
void md5::transform()
{
- const vmime_uint32* const in = (vmime_uint32*) m_block;
+ const vmime_uint32* const in = reinterpret_cast <vmime_uint32*>(m_block);
vmime_uint32 a = m_hash[0];
vmime_uint32 b = m_hash[1];
@@ -306,7 +306,7 @@ const string md5::hex()
static const unsigned char hex[] = "0123456789abcdef";
std::ostringstream oss;
- const vmime_uint8* const digest = (vmime_uint8*) m_hash;
+ const vmime_uint8* const digest = reinterpret_cast <vmime_uint8*>(m_hash);
for (int i = 0 ; i < 16 ; ++i)
{
@@ -323,7 +323,7 @@ const vmime_uint8* md5::hash()
if (!m_finalized)
finalize();
- return ((vmime_uint8*) m_hash);
+ return (reinterpret_cast <const vmime_uint8*>(m_hash));
}