summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bplist.c28
-rw-r--r--src/xplist.c2
2 files changed, 15 insertions, 15 deletions
diff --git a/src/bplist.c b/src/bplist.c
index 12963c4..455c34b 100644
--- a/src/bplist.c
+++ b/src/bplist.c
@@ -143,28 +143,28 @@ union plist_uint_ptr
143#ifdef __BIG_ENDIAN__ 143#ifdef __BIG_ENDIAN__
144#define beNtoh(x,n) (x >> ((8-n) << 3)) 144#define beNtoh(x,n) (x >> ((8-n) << 3))
145#else 145#else
146#define beNtoh(x,n) be64toh(x << ((8-n) << 3)) 146#define beNtoh(x,n) be64toh((x) << ((8-(n)) << 3))
147#endif 147#endif
148 148
149#define UINT_TO_HOST(x, n) \ 149#define UINT_TO_HOST(x, n) \
150 ({ \ 150 ({ \
151 union plist_uint_ptr __up; \ 151 union plist_uint_ptr __up; \
152 __up.src = (n > 8) ? x + (n - 8) : x; \ 152 __up.src = ((n) > 8) ? (x) + ((n) - 8) : (x); \
153 (n >= 8 ? be64toh( get_unaligned(__up.u64ptr) ) : \ 153 ((n) >= 8 ? be64toh( get_unaligned(__up.u64ptr) ) : \
154 (n == 4 ? be32toh( get_unaligned(__up.u32ptr) ) : \ 154 ((n) == 4 ? be32toh( get_unaligned(__up.u32ptr) ) : \
155 (n == 2 ? be16toh( get_unaligned(__up.u16ptr) ) : \ 155 ((n) == 2 ? be16toh( get_unaligned(__up.u16ptr) ) : \
156 (n == 1 ? *__up.u8ptr : \ 156 ((n) == 1 ? *__up.u8ptr : \
157 beNtoh( get_unaligned(__up.u64ptr), n) \ 157 beNtoh( get_unaligned(__up.u64ptr), n) \
158 )))); \ 158 )))); \
159 }) 159 })
160 160
161#define get_needed_bytes(x) \ 161#define get_needed_bytes(x) \
162 ( ((uint64_t)x) < (1ULL << 8) ? 1 : \ 162 ( ((uint64_t)(x)) < (1ULL << 8) ? 1 : \
163 ( ((uint64_t)x) < (1ULL << 16) ? 2 : \ 163 ( ((uint64_t)(x)) < (1ULL << 16) ? 2 : \
164 ( ((uint64_t)x) < (1ULL << 24) ? 3 : \ 164 ( ((uint64_t)(x)) < (1ULL << 24) ? 3 : \
165 ( ((uint64_t)x) < (1ULL << 32) ? 4 : 8)))) 165 ( ((uint64_t)(x)) < (1ULL << 32) ? 4 : 8))))
166 166
167#define get_real_bytes(x) (x == (float) x ? sizeof(float) : sizeof(double)) 167#define get_real_bytes(x) ((x) == (float) (x) ? sizeof(float) : sizeof(double))
168 168
169#if (defined(__LITTLE_ENDIAN__) \ 169#if (defined(__LITTLE_ENDIAN__) \
170 && !defined(__FLOAT_WORD_ORDER__)) \ 170 && !defined(__FLOAT_WORD_ORDER__)) \
@@ -182,7 +182,7 @@ union plist_uint_ptr
182#endif 182#endif
183 183
184#if __has_builtin(__builtin_umulll_overflow) || __GNUC__ >= 5 184#if __has_builtin(__builtin_umulll_overflow) || __GNUC__ >= 5
185#define uint64_mul_overflow(a, b, r) __builtin_umulll_overflow(a, b, (unsigned long long*)r) 185#define uint64_mul_overflow(a, b, r) __builtin_umulll_overflow(a, b, (unsigned long long*)(r))
186#else 186#else
187static int uint64_mul_overflow(uint64_t a, uint64_t b, uint64_t *res) 187static int uint64_mul_overflow(uint64_t a, uint64_t b, uint64_t *res)
188{ 188{
@@ -191,7 +191,7 @@ static int uint64_mul_overflow(uint64_t a, uint64_t b, uint64_t *res)
191} 191}
192#endif 192#endif
193 193
194#define NODE_IS_ROOT(x) (((node_t*)x)->isRoot) 194#define NODE_IS_ROOT(x) (((node_t*)(x))->isRoot)
195 195
196struct bplist_data { 196struct bplist_data {
197 const char* data; 197 const char* data;
@@ -943,7 +943,7 @@ static void serialize_plist(node_t* node, void* data)
943 } 943 }
944} 944}
945 945
946#define Log2(x) (x == 8 ? 3 : (x == 4 ? 2 : (x == 2 ? 1 : 0))) 946#define Log2(x) ((x) == 8 ? 3 : ((x) == 4 ? 2 : ((x) == 2 ? 1 : 0)))
947 947
948static void write_int(bytearray_t * bplist, uint64_t val) 948static void write_int(bytearray_t * bplist, uint64_t val)
949{ 949{
diff --git a/src/xplist.c b/src/xplist.c
index dc70864..3a92142 100644
--- a/src/xplist.c
+++ b/src/xplist.c
@@ -71,7 +71,7 @@
71 71
72#define MAC_EPOCH 978307200 72#define MAC_EPOCH 978307200
73 73
74#define MAX_DATA_BYTES_PER_LINE(__i) (((76 - (__i << 3)) >> 2) * 3) 74#define MAX_DATA_BYTES_PER_LINE(__i) (((76 - ((__i) << 3)) >> 2) * 3)
75 75
76static const char XML_PLIST_PROLOG[] = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\ 76static const char XML_PLIST_PROLOG[] = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\
77<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n\ 77<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n\