diff --git a/ChangeLog b/ChangeLog index 697d71ca..a9cb591b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,11 @@ VERSION 0.6.4cvs ================ +2005-02-05 Vincent Richard + + * utility/md5.cpp: fixed forward use of swapUint32Array() with + gcc 3.3 (Apple). + 2005-02-01 Vincent Richard * text.cpp: fixed possible segfault when encoding is Base64 (typo). diff --git a/src/utility/md5.cpp b/src/utility/md5.cpp index f630d86d..0bfc9f3e 100644 --- a/src/utility/md5.cpp +++ b/src/utility/md5.cpp @@ -100,6 +100,27 @@ static void copyUint8Array(vmime_uint8* dest, const vmime_uint8* src, unsigned l } +static inline vmime_uint32 swapUint32(const vmime_uint32 D) +{ + return ((D << 24) | ((D << 8) & 0x00FF0000) | ((D >> 8) & 0x0000FF00) | (D >> 24)); +} + + +static inline void swapUint32Array(vmime_uint32* buf, unsigned long words) +{ + for ( ; words >= 4 ; words -= 4, buf += 4) + { + buf[0] = swapUint32(buf[0]); + buf[1] = swapUint32(buf[1]); + buf[2] = swapUint32(buf[2]); + buf[3] = swapUint32(buf[3]); + } + + for ( ; words ; --words, ++buf) + buf[0] = swapUint32(buf[0]); +} + + void md5::update(const string& in) { update(reinterpret_cast (in.c_str()), in.length()); @@ -176,27 +197,6 @@ void md5::finalize() } -static inline vmime_uint32 swapUint32(const vmime_uint32 D) -{ - return ((D << 24) | ((D << 8) & 0x00FF0000) | ((D >> 8) & 0x0000FF00) | (D >> 24)); -} - - -static inline void swapUint32Array(vmime_uint32* buf, unsigned long words) -{ - for ( ; words >= 4 ; words -= 4, buf += 4) - { - buf[0] = swapUint32(buf[0]); - buf[1] = swapUint32(buf[1]); - buf[2] = swapUint32(buf[2]); - buf[3] = swapUint32(buf[3]); - } - - for ( ; words ; --words, ++buf) - buf[0] = swapUint32(buf[0]); -} - - void md5::transformHelper() { #if VMIME_BYTE_ORDER_BIG_ENDIAN