summaryrefslogtreecommitdiff
path: root/archivers/par2/patches/patch-ac
blob: a89c78d163f9dac3d913067740e2b7d4c62e1ed6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
$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__