forked from enlightenment/efl
parent
737ca22148
commit
0c13e147a5
|
@ -13,6 +13,7 @@
|
|||
/********************************************************************************/
|
||||
/* Author: Jorge Luis Zapata */
|
||||
/* Author: Brian Mattern (rephorm) */
|
||||
/* Author: Sebastian Dransfeld */
|
||||
/* Version: 0.3.0 */
|
||||
/********************************************************************************/
|
||||
/* Todo */
|
||||
|
@ -83,6 +84,8 @@ static int init_count = 0;
|
|||
static Ecore_List2 *servers = NULL;
|
||||
static Ecore_Event_Handler *handler[3];
|
||||
|
||||
int words_bigendian = -1;
|
||||
|
||||
/* public functions */
|
||||
EAPI int
|
||||
ecore_dbus_init(void)
|
||||
|
@ -91,6 +94,15 @@ ecore_dbus_init(void)
|
|||
|
||||
if (++init_count != 1) return init_count;
|
||||
|
||||
if (words_bigendian == -1)
|
||||
{
|
||||
unsigned long int v;
|
||||
|
||||
v = htonl(0x12345678);
|
||||
if (v == 0x12345678) words_bigendian = 1;
|
||||
else words_bigendian = 0;
|
||||
}
|
||||
|
||||
ecore_con_init();
|
||||
|
||||
ECORE_DBUS_EVENT_SERVER_ADD = ecore_event_type_new();
|
||||
|
|
|
@ -462,8 +462,10 @@ _ecore_dbus_message_header(Ecore_DBus_Message *msg, int type, int flags,
|
|||
if (!msg) return;
|
||||
|
||||
/* endianness (1) */
|
||||
/* XXX we need to detect for endianess and send 'B' for Bigendian machines */
|
||||
msg->buffer[0] = msg->byte_order = 'l';
|
||||
if (words_bigendian)
|
||||
msg->buffer[0] = msg->byte_order = 'B';
|
||||
else
|
||||
msg->buffer[0] = msg->byte_order = 'l';
|
||||
/* type (1) */
|
||||
msg->buffer[1] = msg->type = (char)type;
|
||||
/* flags (1) 0x1 = no reply expected, 0x2 auto activation */
|
||||
|
|
|
@ -7,6 +7,30 @@
|
|||
#include "Ecore_Con.h"
|
||||
#include "Ecore_Data.h"
|
||||
|
||||
extern int words_bigendian;
|
||||
|
||||
#define SWAP64(x) (x) = \
|
||||
((((unsigned long long)(x) & 0x00000000000000ffULL ) << 56) |\
|
||||
(((unsigned long long)(x) & 0x000000000000ff00ULL ) << 40) |\
|
||||
(((unsigned long long)(x) & 0x0000000000ff0000ULL ) << 24) |\
|
||||
(((unsigned long long)(x) & 0x00000000ff000000ULL ) << 8) |\
|
||||
(((unsigned long long)(x) & 0x000000ff00000000ULL ) >> 8) |\
|
||||
(((unsigned long long)(x) & 0x0000ff0000000000ULL ) >> 24) |\
|
||||
(((unsigned long long)(x) & 0x00ff000000000000ULL ) >> 40) |\
|
||||
(((unsigned long long)(x) & 0xff00000000000000ULL ) >> 56))
|
||||
#define SWAP32(x) (x) = \
|
||||
((((unsigned int)(x) & 0x000000ff ) << 24) |\
|
||||
(((unsigned int)(x) & 0x0000ff00 ) << 8) |\
|
||||
(((unsigned int)(x) & 0x00ff0000 ) >> 8) |\
|
||||
(((unsigned int)(x) & 0xff000000 ) >> 24))
|
||||
#define SWAP16(x) (x) = \
|
||||
((((unsigned short)(x) & 0x00ff ) << 8) |\
|
||||
(((unsigned short)(x) & 0xff00 ) >> 8))
|
||||
|
||||
#define CONV16(order, x) { if (words_bigendian && (order) != 'B') SWAP16(x); }
|
||||
#define CONV32(order, x) { if (words_bigendian && (order) != 'B') SWAP32(x); }
|
||||
#define CONV64(order, x) { if (words_bigendian && (order) != 'B') SWAP64(x); }
|
||||
|
||||
typedef unsigned char *(*Ecore_DBus_Auth_Transaction)(void *);
|
||||
|
||||
typedef struct _Ecore_DBus_Auth Ecore_DBus_Auth;
|
||||
|
|
|
@ -83,6 +83,7 @@ _ecore_dbus_message_append_uint32(Ecore_DBus_Message *msg, unsigned int i)
|
|||
{
|
||||
unsigned char *c;
|
||||
|
||||
CONV32(msg->byte_order, i)
|
||||
c = (unsigned char *)&i;
|
||||
_ecore_dbus_message_length_append(msg, 4);
|
||||
msg->buffer[msg->length++] = c[0];
|
||||
|
@ -109,6 +110,7 @@ _ecore_dbus_message_read_uint32(Ecore_DBus_Message *msg)
|
|||
|
||||
_ecore_dbus_message_length_append(msg, 4);
|
||||
i = *(unsigned int *)(msg->buffer + msg->length);
|
||||
CONV32(msg->byte_order, i)
|
||||
msg->length += 4;
|
||||
return i;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue