Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
Please login to access the resource
SUSE:SLE-12-SP1:GA
libplist.4095
A0014-Drop-src-common.h-and-use-byte-order-macr...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File A0014-Drop-src-common.h-and-use-byte-order-macros-from-config.h-directly.patch of Package libplist.4095
From adf9ec81ff7e5b8257c7d635657fcb2ffadc7e6a Mon Sep 17 00:00:00 2001 From: Nikias Bassen <nikias@gmx.li> Date: Fri, 3 Oct 2014 15:49:36 +0200 Subject: [PATCH] Drop src/common.h and use byte order macros from config.h directly --- src/Makefile.am | 3 +-- src/bplist.c | 25 ++++++++++++++----------- src/common.h | 20 -------------------- 3 files changed, 15 insertions(+), 33 deletions(-) delete mode 100644 src/common.h diff --git a/src/bplist.c b/src/bplist.c index bb3465b..6a9d972 100644 --- a/src/bplist.c +++ b/src/bplist.c @@ -19,6 +19,9 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif #include <stdlib.h> #include <stdio.h> @@ -73,7 +76,7 @@ enum static void float_byte_convert(uint8_t * address, size_t size) { -#if (PLIST_BYTE_ORDER == PLIST_LITTLE_ENDIAN \ +#if (defined(__LITTLE_ENDIAN__) \ && !defined(__FLOAT_WORD_ORDER__)) \ || (defined(__FLOAT_WORD_ORDER__) \ && __FLOAT_WORD_ORDER__ == __ORDER_LITTLE_ENDIAN__) @@ -110,7 +113,7 @@ union plist_uint_ptr static void byte_convert(uint8_t * address, size_t size) { -#if PLIST_BYTE_ORDER == PLIST_LITTLE_ENDIAN +#ifdef __LITTLE_ENDIAN__ uint8_t i = 0, j = 0; uint8_t tmp = 0; @@ -138,7 +141,7 @@ static uint32_t uint24_from_be(union plist_uint_ptr buf) } #ifndef be16toh -#if PLIST_BYTE_ORDER == PLIST_BIG_ENDIAN +#ifdef __BIG_ENDIAN__ #define be16toh(x) (x) #else #define be16toh(x) ((((x) & 0xFF00) >> 8) | (((x) & 0x00FF) << 8)) @@ -146,7 +149,7 @@ static uint32_t uint24_from_be(union plist_uint_ptr buf) #endif #ifndef be32toh -#if PLIST_BYTE_ORDER == PLIST_BIG_ENDIAN +#ifdef __BIG_ENDIAN__ #define be32toh(x) (x) #else #define be32toh(x) ((((x) & 0xFF000000) >> 24) \ @@ -157,7 +160,7 @@ static uint32_t uint24_from_be(union plist_uint_ptr buf) #endif #ifndef be64toh -#if PLIST_BYTE_ORDER == PLIST_BIG_ENDIAN +#ifdef __BIG_ENDIAN__ #define be64toh(x) (x) #else #define be64toh(x) ((((x) & 0xFF00000000000000ull) >> 56) \ @@ -827,7 +830,7 @@ static void write_int(bytearray_t * bplist, uint64_t val) if (size == 3) size++; -#if PLIST_BYTE_ORDER == PLIST_BIG_ENDIAN +#ifdef __BIG_ENDIAN__ val = val << ((sizeof(uint64_t) - size) * 8); #endif @@ -950,7 +953,7 @@ static void write_array(bytearray_t * bplist, node_t* node, hashtable_t* ref_tab for (i = 0, cur = node_first_child(node); cur && i < size; cur = node_next_sibling(cur), i++) { idx = *(uint64_t *) (hash_table_lookup(ref_table, cur)); -#if PLIST_BYTE_ORDER == PLIST_BIG_ENDIAN +#ifdef __BIG_ENDIAN__ idx = idx << ((sizeof(uint64_t) - dict_param_size) * 8); #endif memcpy(buff + i * dict_param_size, &idx, dict_param_size); @@ -987,14 +990,14 @@ static void write_dict(bytearray_t * bplist, node_t* node, hashtable_t* ref_tabl for (i = 0, cur = node_first_child(node); cur && i < size; cur = node_next_sibling(node_next_sibling(cur)), i++) { idx1 = *(uint64_t *) (hash_table_lookup(ref_table, cur)); -#if PLIST_BYTE_ORDER == PLIST_BIG_ENDIAN +#ifdef __BIG_ENDIAN__ idx1 = idx1 << ((sizeof(uint64_t) - dict_param_size) * 8); #endif memcpy(buff + i * dict_param_size, &idx1, dict_param_size); byte_convert(buff + i * dict_param_size, dict_param_size); idx2 = *(uint64_t *) (hash_table_lookup(ref_table, cur->next)); -#if PLIST_BYTE_ORDER == PLIST_BIG_ENDIAN +#ifdef __BIG_ENDIAN__ idx2 = idx2 << ((sizeof(uint64_t) - dict_param_size) * 8); #endif memcpy(buff + (i + size) * dict_param_size, &idx2, dict_param_size); @@ -1015,7 +1018,7 @@ static void write_uid(bytearray_t * bplist, uint64_t val) if (size == 3) size++; -#if PLIST_BYTE_ORDER == PLIST_BIG_ENDIAN +#ifdef __BIG_ENDIAN__ val = val << ((sizeof(uint64_t) - size) * 8); #endif @@ -1222,7 +1225,7 @@ PLIST_API void plist_to_bin(plist_t plist, char **plist_bin, uint32_t * length) { uint8_t *offsetbuff = (uint8_t *) malloc(offset_size); -#if PLIST_BYTE_ORDER == PLIST_BIG_ENDIAN +#ifdef __BIG_ENDIAN__ offsets[i] = offsets[i] << ((sizeof(uint64_t) - offset_size) * 8); #endif diff --git a/src/common.h b/src/common.h deleted file mode 100644 index 657e049..0000000 --- a/src/common.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef COMMON_H -#define COMMON_H - -#define PLIST_LITTLE_ENDIAN 0 -#define PLIST_BIG_ENDIAN 1 - -#if defined(__GNUC__) && (__GNUC__ >= 4) && !defined(__CYGWIN__) && !defined(WIN32) -# define _PLIST_INTERNAL __attribute__((visibility("hidden"))) -#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550) -# define _PLIST_INTERNAL __hidden -#else /* not gcc >= 4 and not Sun Studio >= 8 */ -# define _PLIST_INTERNAL -#endif /* GNUC >= 4 */ - -#endif
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor