SecBSD's official ports repository
This commit is contained in:
commit
2c0afcbbf3
64331 changed files with 5339189 additions and 0 deletions
87
misc/hfsplus/patches/patch-libhfsp_src_swab_h
Normal file
87
misc/hfsplus/patches/patch-libhfsp_src_swab_h
Normal file
|
@ -0,0 +1,87 @@
|
|||
--- libhfsp/src/swab.h.orig Tue Mar 5 20:50:29 2002
|
||||
+++ libhfsp/src/swab.h Fri May 1 20:00:11 2015
|
||||
@@ -25,7 +25,9 @@
|
||||
*/
|
||||
|
||||
#include <endian.h>
|
||||
+#ifndef __OpenBSD__
|
||||
#include <byteswap.h>
|
||||
+#endif
|
||||
|
||||
/* basic fuction:
|
||||
value = swab_inc(ptr);
|
||||
@@ -34,30 +36,58 @@
|
||||
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||
|
||||
-#define bswabU16(val) bswap_16(val)
|
||||
+#define bswabU16(val) swap16(val)
|
||||
|
||||
-#define bswabU16_inc(ptr) bswap_16(*((UInt16*) (ptr))++)
|
||||
-#define bswabU32_inc(ptr) bswap_32(*((UInt32*) (ptr))++)
|
||||
-#define bswabU64_inc(ptr) bswap_64(*((UInt64*) (ptr))++)
|
||||
+#define bswabU16_inc(ptr) \
|
||||
+ swap16(*(UInt16 *)(ptr)), (ptr) = (((char *)(ptr)) + 2)
|
||||
+#define bswabU32_inc(ptr) \
|
||||
+ swap32(*(UInt32 *)(ptr)), (ptr) = (((char *)(ptr)) + 4)
|
||||
+#define bswabU64_inc(ptr) \
|
||||
+ swap64(*(UInt64 *)(ptr)), (ptr) = (((char *)(ptr)) + 8)
|
||||
|
||||
-#define bstoreU16_inc(ptr, val) (*((UInt16*) (ptr))++) = bswap_16(val)
|
||||
-#define bstoreU32_inc(ptr, val) (*((UInt32*) (ptr))++) = bswap_32(val)
|
||||
-#define bstoreU64_inc(ptr, val) (*((UInt64*) (ptr))++) = bswap_64(val)
|
||||
+#define bstoreU16_inc(ptr, val) do { \
|
||||
+ *(UInt16 *)(ptr) = swap16((val)); \
|
||||
+ (ptr) = (((char *)(ptr)) + 2); \
|
||||
+} while(0)
|
||||
+#define bstoreU32_inc(ptr, val) do { \
|
||||
+ *(UInt32 *)(ptr) = swap32((val)); \
|
||||
+ (ptr) = (((char *)(ptr)) + 4); \
|
||||
+} while(0)
|
||||
+#define bstoreU64_inc(ptr, val) do { \
|
||||
+ *(UInt64 *)(ptr) = swap64((val)); \
|
||||
+ (ptr) = (((char *)(ptr)) + 8); \
|
||||
+} while(0)
|
||||
|
||||
#else // BYTE_ORDER == BIG_ENDIAN
|
||||
|
||||
#define bswabU16(val) val
|
||||
|
||||
-#define bswabU16_inc(ptr) (*((UInt16*) (ptr))++)
|
||||
-#define bswabU32_inc(ptr) (*((UInt32*) (ptr))++)
|
||||
-#define bswabU64_inc(ptr) (*((UInt64*) (ptr))++)
|
||||
+#define bswabU16_inc(ptr) \
|
||||
+ *(UInt16 *)(ptr), (ptr) = (((char *)(ptr)) + 2)
|
||||
+#define bswabU32_inc(ptr) \
|
||||
+ *(UInt32 *)(ptr), (ptr) = (((char *)(ptr)) + 4)
|
||||
+#define bswabU64_inc(ptr) \
|
||||
+ *(UInt64 *)(ptr), (ptr) = (((char *)(ptr)) + 8)
|
||||
|
||||
-#define bstoreU16_inc(ptr, val) (*((UInt16*) (ptr))++) = val
|
||||
-#define bstoreU32_inc(ptr, val) (*((UInt32*) (ptr))++) = val
|
||||
-#define bstoreU64_inc(ptr, val) (*((UInt64*) (ptr))++) = val
|
||||
+#define bstoreU16_inc(ptr, val) do { \
|
||||
+ *(UInt16 *)(ptr) = (val); \
|
||||
+ (ptr) = (((char *)(ptr)) + 2); \
|
||||
+} while(0)
|
||||
+#define bstoreU32_inc(ptr, val) do { \
|
||||
+ *(UInt32 *)(ptr) = (val); \
|
||||
+ (ptr) = (((char *)(ptr)) + 4); \
|
||||
+} while(0)
|
||||
+#define bstoreU64_inc(ptr, val) do { \
|
||||
+ *(UInt64 *)(ptr) = (val); \
|
||||
+ (ptr) = (((char *)(ptr)) + 8); \
|
||||
+} while(0)
|
||||
|
||||
#endif
|
||||
|
||||
-/* for the sake of compleetness and readability */
|
||||
-#define bswabU8_inc(ptr) (*((UInt8*) (ptr))++)
|
||||
-#define bstoreU8_inc(ptr,val) (*((UInt8*) (ptr))++) = val
|
||||
+/* for the sake of completeness and readability */
|
||||
+#define bswabU8_inc(ptr) \
|
||||
+ *(UInt8 *)(ptr), (ptr) = (((char *)(ptr)) + 1)
|
||||
+#define bstoreU8_inc(ptr, val) do { \
|
||||
+ *(UInt8 *)(ptr) = (val); \
|
||||
+ (ptr) = (((char *)(ptr)) + 1); \
|
||||
+} while(0)
|
Loading…
Add table
Add a link
Reference in a new issue