Browse code

Include clamav-config.h first

git-svn: trunk@1929

Nigel Horne authored on 2006/04/26 02:49:56
Showing 2 changed files
... ...
@@ -1,3 +1,8 @@
1
+Tue Apr 25 18:48:23 BST 2006 (njh)
2
+----------------------------------
3
+  * libclamav/pst.c:	Apply patch from TK to use le??_to_host and to include
4
+  				clamav-config.h first
5
+
1 6
 Mon Apr 24 22:19:34 BST 2006 (njh)
2 7
 ----------------------------------
3 8
   * libclamav/pst.[ch]:	Added first PST support - code yet to be cleaned or
... ...
@@ -33,7 +33,11 @@
33 33
  *	cli_mbox decode it
34 34
  * TODO: Remove the vcard handling
35 35
  */
36
-static	char	const	rcsid[] = "$Id: pst.c,v 1.7 2006/04/25 15:28:26 nigelhorne Exp $";
36
+static	char	const	rcsid[] = "$Id: pst.c,v 1.8 2006/04/25 17:49:56 nigelhorne Exp $";
37
+
38
+#if HAVE_CONFIG_H
39
+#include "clamav-config.h"	/* must come first */
40
+#endif
37 41
 
38 42
 #include <unistd.h>
39 43
 #include <stdio.h>
... ...
@@ -44,10 +48,6 @@ static	char	const	rcsid[] = "$Id: pst.c,v 1.7 2006/04/25 15:28:26 nigelhorne Exp
44 44
 #include <limits.h>
45 45
 #include <time.h>
46 46
 
47
-#if HAVE_CONFIG_H
48
-#include "clamav-config.h"
49
-#endif
50
-
51 47
 #include "clamav.h"
52 48
 #include "others.h"
53 49
 
... ...
@@ -56,31 +56,20 @@ static	char	const	rcsid[] = "$Id: pst.c,v 1.7 2006/04/25 15:28:26 nigelhorne Exp
56 56
 #define	DWORD	unsigned int
57 57
 
58 58
 #define DEBUG_VERSION 1
59
-#if BYTE_ORDER == BIG_ENDIAN
60
-#  define LE64_CPU(x) \
61
-  x = ((((x) & 0xff00000000000000) >> 56) | \
62
-       (((x) & 0x00ff000000000000) >> 40) | \
63
-       (((x) & 0x0000ff0000000000) >> 24) | \
64
-       (((x) & 0x000000ff00000000) >> 8 ) | \
65
-       (((x) & 0x00000000ff000000) << 8 ) | \
66
-       (((x) & 0x0000000000ff0000) << 24) | \
67
-       (((x) & 0x000000000000ff00) << 40) | \
68
-       (((x) & 0x00000000000000ff) << 56));
69
-#  define LE32_CPU(x) \
70
-  x = ((((x) & 0xff000000) >> 24) | \
71
-       (((x) & 0x00ff0000) >> 8 ) | \
72
-       (((x) & 0x0000ff00) << 8 ) | \
73
-       (((x) & 0x000000ff) << 24));
74
-#  define LE16_CPU(x) \
75
-  x = ((((x) & 0xff00) >> 8) | \
76
-       (((x) & 0x00ff) << 8));
77
-#elif BYTE_ORDER == LITTLE_ENDIAN
78
-#  define LE64_CPU(x) {}
79
-#  define LE32_CPU(x) {}
80
-#  define LE16_CPU(x) {}
59
+
60
+#if WORDS_BIGENDIAN == 0
61
+/*
62
+ * don't use le??_to_host because they generate a huge number of statement with
63
+ * no effect warnings
64
+ */
65
+#define	LE64_CPU(x)
66
+#define	LE32_CPU(x)
67
+#define	LE16_CPU(x)
81 68
 #else
82
-#  error "Byte order not supported by this library"
83
-#endif /* BYTE_ORDER */
69
+#define	LE64_CPU(x)	le64_to_host(x)
70
+#define	LE32_CPU(x)	le32_to_host(x)
71
+#define	LE16_CPU(x)	le16_to_host(x)
72
+#endif
84 73
 
85 74
 typedef struct {
86 75
 	unsigned int dwLowDateTime;