X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dbus%2Fdbus-marshal-basic.h;h=034fdaba6eccd9def79ae7a200a55731fff53366;hb=4d29dedeebef13332bbc30b1e50321e0fc616b0e;hp=bcc15ee9c59f179dd5682426c95dbc8b92c717a6;hpb=3801b6de7878074a8e77445bad2a2d093889a3af;p=platform%2Fupstream%2Fdbus.git diff --git a/dbus/dbus-marshal-basic.h b/dbus/dbus-marshal-basic.h index bcc15ee..034fdab 100644 --- a/dbus/dbus-marshal-basic.h +++ b/dbus/dbus-marshal-basic.h @@ -18,14 +18,17 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef DBUS_MARSHAL_BASIC_H #define DBUS_MARSHAL_BASIC_H -#include +#ifdef HAVE_BYTESWAP_H +#include +#endif + #include #include #include @@ -37,6 +40,11 @@ #define DBUS_COMPILER_BYTE_ORDER DBUS_LITTLE_ENDIAN #endif +#ifdef HAVE_BYTESWAP_H +#define DBUS_UINT16_SWAP_LE_BE_CONSTANT(val) bswap_16(val) +#define DBUS_UINT32_SWAP_LE_BE_CONSTANT(val) bswap_32(val) +#else /* HAVE_BYTESWAP_H */ + #define DBUS_UINT16_SWAP_LE_BE_CONSTANT(val) ((dbus_uint16_t) ( \ (dbus_uint16_t) ((dbus_uint16_t) (val) >> 8) | \ (dbus_uint16_t) ((dbus_uint16_t) (val) << 8))) @@ -47,8 +55,14 @@ (((dbus_uint32_t) (val) & (dbus_uint32_t) 0x00ff0000U) >> 8) | \ (((dbus_uint32_t) (val) & (dbus_uint32_t) 0xff000000U) >> 24))) +#endif /* HAVE_BYTESWAP_H */ + #ifdef DBUS_HAVE_INT64 +#ifdef HAVE_BYTESWAP_H +#define DBUS_UINT64_SWAP_LE_BE_CONSTANT(val) bswap_64(val) +#else /* HAVE_BYTESWAP_H */ + #define DBUS_UINT64_SWAP_LE_BE_CONSTANT(val) ((dbus_uint64_t) ( \ (((dbus_uint64_t) (val) & \ (dbus_uint64_t) DBUS_UINT64_CONSTANT (0x00000000000000ff)) << 56) | \ @@ -68,6 +82,8 @@ (dbus_uint64_t) DBUS_UINT64_CONSTANT (0xff00000000000000)) >> 56))) #endif /* DBUS_HAVE_INT64 */ +#endif /* HAVE_BYTESWAP_H */ + #define DBUS_UINT16_SWAP_LE_BE(val) (DBUS_UINT16_SWAP_LE_BE_CONSTANT (val)) #define DBUS_INT16_SWAP_LE_BE(val) ((dbus_int16_t)DBUS_UINT16_SWAP_LE_BE_CONSTANT (val)) @@ -130,40 +146,6 @@ # define DBUS_UINT64_FROM_BE(val) (DBUS_UINT64_TO_BE (val)) #endif /* DBUS_HAVE_INT64 */ -#ifndef DBUS_HAVE_INT64 -/** - * An 8-byte struct you could use to access int64 without having - * int64 support - */ -typedef struct -{ - dbus_uint32_t first32; /**< first 32 bits in the 8 bytes (beware endian issues) */ - dbus_uint32_t second32; /**< second 32 bits in the 8 bytes (beware endian issues) */ -} DBus8ByteStruct; -#endif /* DBUS_HAVE_INT64 */ - -/** - * A simple 8-byte value union that lets you access 8 bytes as if they - * were various types; useful when dealing with basic types via - * void pointers and varargs. - */ -typedef union -{ - dbus_int16_t i16; /**< as int16 */ - dbus_uint16_t u16; /**< as int16 */ - dbus_int32_t i32; /**< as int32 */ - dbus_uint32_t u32; /**< as int32 */ -#ifdef DBUS_HAVE_INT64 - dbus_int64_t i64; /**< as int64 */ - dbus_uint64_t u64; /**< as int64 */ -#else - DBus8ByteStruct u64; /**< as 8-byte-struct */ -#endif - double dbl; /**< as double */ - unsigned char byt; /**< as byte */ - char *str; /**< as char* */ -} DBusBasicValue; - #ifdef DBUS_DISABLE_ASSERT #define _dbus_unpack_uint16(byte_order, data) \ (((byte_order) == DBUS_LITTLE_ENDIAN) ? \ @@ -238,9 +220,7 @@ dbus_uint32_t _dbus_marshal_read_uint32 (const DBusString *str, int pos, int byte_order, int *new_pos); -dbus_bool_t _dbus_type_is_valid (int typecode); int _dbus_type_get_alignment (int typecode); -dbus_bool_t _dbus_type_is_fixed (int typecode); int _dbus_type_get_alignment (int typecode); const char* _dbus_type_to_string (int typecode);