freebsd-ports/security/mhash/files/patch-include-mutils-mutils.h
Peter Pentchev d9983ccbfa Update to mhash-0.9.9, fixing several style issues, lots of memory
leaks, and two serious (even if not easily triggered) bugs.
2008-01-16 15:46:05 +00:00

97 lines
2.9 KiB
C

diff -urN -x .svn ../../branches/mhash-dist/include/mutils/mutils.h ./include/mutils/mutils.h
--- ../../branches/mhash-dist/include/mutils/mutils.h 2008-01-16 02:34:17.000000000 +0200
+++ ./include/mutils/mutils.h 2008-01-16 02:42:32.000000000 +0200
@@ -103,22 +103,22 @@
#endif
#if defined(false)
-#define MUTILS_FALSE (mutils_boolean) false
+#define MUTILS_FALSE ((mutils_boolean) false)
#else
#if defined(FALSE)
-#define MUTILS_FALSE (mutils_boolean) FALSE
+#define MUTILS_FALSE ((mutils_boolean) FALSE)
#else
-#define MUTILS_FALSE (mutils_boolean) 0
+#define MUTILS_FALSE ((mutils_boolean) 0)
#endif /* FALSE */
#endif /* false */
#if defined(true)
-#define MUTILS_TRUE (mutils_boolean) true
+#define MUTILS_TRUE ((mutils_boolean) true)
#else
#if defined(TRUE)
-#define MUTILS_TRUE (mutils_boolean) TRUE
+#define MUTILS_TRUE ((mutils_boolean) TRUE)
#else
-#define MUTILS_TRUE (mutils_boolean) -1
+#define MUTILS_TRUE ((mutils_boolean) -1)
#endif /* TRUE */
#endif /* true */
@@ -167,16 +167,16 @@
#define mutils_swapendian32(a) \
((mutils_word32) \
- (((a & (mutils_word32) 0x000000ffU) << 24) | \
- ((a & (mutils_word32) 0x0000ff00U) << 8) | \
- ((a & (mutils_word32) 0x00ff0000U) >> 8) | \
- ((a & (mutils_word32) 0xff000000U) >> 24)) \
+ ((((a) & (mutils_word32) 0x000000ffU) << 24) | \
+ (((a) & (mutils_word32) 0x0000ff00U) << 8) | \
+ (((a) & (mutils_word32) 0x00ff0000U) >> 8) | \
+ (((a) & (mutils_word32) 0xff000000U) >> 24)) \
)
#define mutils_swapendian16(a) \
((mutils_word16) \
- (((a & (mutils_word16) 0x00ffU) << 8) | \
- ((a & (mutils_word16) 0xff00U) >> 8)) \
+ ((((a) & (mutils_word16) 0x00ffU) << 8) | \
+ (((a) & (mutils_word16) 0xff00U) >> 8)) \
)
@@ -193,30 +193,30 @@
#define mutils_lend32(n) mutils_swapendian32(n)
#define mutils_lend16(n) mutils_swapendian16(n)
-#define mutils_bend64(n) n
-#define mutils_bend32(n) n
-#define mutils_bend16(n) n
+#define mutils_bend64(n) (n)
+#define mutils_bend32(n) (n)
+#define mutils_bend16(n) (n)
#define mutils_lend2sys64(n) mutils_swapendian64(n)
#define mutils_lend2sys32(n) mutils_swapendian32(n)
#define mutils_lend2sys16(n) mutils_swapendian16(n)
-#define mutils_bend2sys32(n) n
-#define mutils_bend2sys16(n) n
+#define mutils_bend2sys32(n) (n)
+#define mutils_bend2sys16(n) (n)
#else
-#define mutils_lend64(n) n
-#define mutils_lend32(n) n
-#define mutils_lend16(n) n
+#define mutils_lend64(n) (n)
+#define mutils_lend32(n) (n)
+#define mutils_lend16(n) (n)
#define mutils_bend64(n) mutils_swapendian64(n)
#define mutils_bend32(n) mutils_swapendian32(n)
#define mutils_bend16(n) mutils_swapendian16(n)
-#define mutils_lend2sys64(n) n
-#define mutils_lend2sys32(n) n
-#define mutils_lend2sys16(n) n
+#define mutils_lend2sys64(n) (n)
+#define mutils_lend2sys32(n) (n)
+#define mutils_lend2sys16(n) (n)
#define mutils_bend2sys64(n) mutils_swapendian64(n)
#define mutils_bend2sys32(n) mutils_swapendian32(n)