$NetBSD: patch-ac,v 1.1 2010/02/21 15:07:40 wiz Exp $ http://bugs.gentoo.org/show_bug.cgi?id=137092 http://bugs.gentoo.org/attachment.cgi?id=91276&action=view --- md5.h.orig 2003-08-01 23:41:04.000000000 +0000 +++ md5.h @@ -20,6 +20,13 @@ #ifndef __MD5_H__ #define __MD5_H__ +#ifdef WIN32 +#pragma pack(push, 1) +#define PACKED +#else +#define PACKED __attribute__ ((packed)) +#endif + // This file defines the MD5Hash and MD5Context objects which are used // to compute and manipulate the MD5 Hash values for a block of data. @@ -35,12 +42,11 @@ // MD5 Hash value -class MD5Hash -{ -public: - // Constructor does not initialise the value - MD5Hash(void) {}; +struct MD5Hash; +ostream& operator<<(ostream &s, const MD5Hash &hash); +struct MD5Hash +{ // Comparison operators bool operator==(const MD5Hash &other) const; bool operator!=(const MD5Hash &other) const; @@ -54,13 +60,8 @@ public: friend ostream& operator<<(ostream &s, const MD5Hash &hash); string print(void) const; - // Copy and assignment - MD5Hash(const MD5Hash &other); - MD5Hash& operator=(const MD5Hash &other); - -public: u8 hash[16]; // 16 byte MD5 Hash value -}; +} PACKED; // Intermediate computation state @@ -144,16 +145,9 @@ inline bool MD5Hash::operator<=(const MD return !other.operator<(*this); } -inline MD5Hash::MD5Hash(const MD5Hash &other) -{ - memcpy(&hash, &other.hash, sizeof(hash)); -} - -inline MD5Hash& MD5Hash::operator=(const MD5Hash &other) -{ - memcpy(&hash, &other.hash, sizeof(hash)); - - return *this; -} +#ifdef WIN32 +#pragma pack(pop) +#endif +#undef PACKED #endif // __MD5_H__