From 672bd97cea1c9b3cde4b687de18c0a907a3f3587 Mon Sep 17 00:00:00 2001 From: Cedric Bail Date: Wed, 2 Oct 2013 18:32:18 +0900 Subject: [PATCH] ecore_ipc: use the new eina_swap*(). --- src/lib/ecore_ipc/Ecore_Ipc.h | 18 +++++++++--------- src/lib/ecore_ipc/ecore_ipc.c | 24 +++++------------------- 2 files changed, 14 insertions(+), 28 deletions(-) diff --git a/src/lib/ecore_ipc/Ecore_Ipc.h b/src/lib/ecore_ipc/Ecore_Ipc.h index f77870f84d..4679b4a87b 100644 --- a/src/lib/ecore_ipc/Ecore_Ipc.h +++ b/src/lib/ecore_ipc/Ecore_Ipc.h @@ -41,17 +41,17 @@ extern "C" { typedef struct _Ecore_Ipc_Server Ecore_Ipc_Server; /**< An IPC connection handle */ typedef struct _Ecore_Ipc_Client Ecore_Ipc_Client; /**< An IPC connection handle */ -EAPI unsigned short _ecore_ipc_swap_16(unsigned short v); -EAPI unsigned int _ecore_ipc_swap_32(unsigned int v); -EAPI unsigned long long _ecore_ipc_swap_64(unsigned long long v); +EAPI unsigned short _ecore_ipc_swap_16(unsigned short v) EINA_DEPRECATED; +EAPI unsigned int _ecore_ipc_swap_32(unsigned int v) EINA_DEPRECATED; +EAPI unsigned long long _ecore_ipc_swap_64(unsigned long long v) EINA_DEPRECATED; #ifdef WORDS_BIGENDIAN -#define ECORE_IPC_SWAP2NET64(x) _ecore_ipc_swap_64(x) -#define ECORE_IPC_SWAP2CPU64(x) _ecore_ipc_swap_64(x) -#define ECORE_IPC_SWAP2NET32(x) _ecore_ipc_swap_32(x) -#define ECORE_IPC_SWAP2CPU32(x) _ecore_ipc_swap_32(x) -#define ECORE_IPC_SWAP2NET16(x) _ecore_ipc_swap_16(x) -#define ECORE_IPC_SWAP2CPU16(x) _ecore_ipc_swap_16(x) +#define ECORE_IPC_SWAP2NET64(x) eina_swap64(x) +#define ECORE_IPC_SWAP2CPU64(x) eina_swap64(x) +#define ECORE_IPC_SWAP2NET32(x) eina_swap32(x) +#define ECORE_IPC_SWAP2CPU32(x) eina_swap32(x) +#define ECORE_IPC_SWAP2NET16(x) eina_swap16(x) +#define ECORE_IPC_SWAP2CPU16(x) eina_swap16(x) #define ECORE_IPC_SWAP2NET8(x) (x) #define ECORE_IPC_SWAP2CPU8(x) (x) #else diff --git a/src/lib/ecore_ipc/ecore_ipc.c b/src/lib/ecore_ipc/ecore_ipc.c index 03be3cf38c..8b71783f5c 100644 --- a/src/lib/ecore_ipc/ecore_ipc.c +++ b/src/lib/ecore_ipc/ecore_ipc.c @@ -39,39 +39,25 @@ int _ecore_ipc_log_dom = -1; +/****** This swap function are around just for backward compatibility do not remove *******/ EAPI unsigned short _ecore_ipc_swap_16(unsigned short v) { - unsigned char *s, t; - - s = (unsigned char *)(&v); - t = s[0]; s[0] = s[1]; s[1] = t; - return v; + return eina_swap16(v); } EAPI unsigned int _ecore_ipc_swap_32(unsigned int v) { - unsigned char *s, t; - - s = (unsigned char *)(&v); - t = s[0]; s[0] = s[3]; s[3] = t; - t = s[1]; s[1] = s[2]; s[2] = t; - return v; + return eina_swap32(v); } EAPI unsigned long long _ecore_ipc_swap_64(unsigned long long v) { - unsigned char *s, t; - - s = (unsigned char *)(&v); - t = s[0]; s[0] = s[7]; s[7] = t; - t = s[1]; s[1] = s[6]; s[6] = t; - t = s[2]; s[2] = s[5]; s[5] = t; - t = s[3]; s[3] = s[4]; s[4] = t; - return v; + return eina_swap64(v); } +/***********************/ static int _ecore_ipc_dlt_int(int out, int prev, int *mode); static int _ecore_ipc_ddlt_int(int in, int prev, int mode);