summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Torri <vincent.torri@gmail.com>2019-02-01 11:04:17 +0000
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2019-02-01 14:25:35 +0000
commitf7c560c311d0ba0da94346e17c8b20f40a0ed152 (patch)
treeaf5f63aceb78ff1b153f3727f8adab6ee4e1d653
parent36286a23fe97e3667c1106116d1edbc301c7a9ba (diff)
replace hton and ntoh family functions with ones defined in eina
Summary: This fixes especially the execution of edje_cc on Windows Test Plan: execution of edje_cc Reviewers: cedric, raster Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D7834
-rw-r--r--configure.ac1
-rw-r--r--src/examples/ecore/ecore_fd_handler_gnutls_example.c8
-rw-r--r--src/examples/ecore/efl_net_ip_address_example.c4
-rw-r--r--src/generic/evas/raw/main.c6
-rw-r--r--src/generic/evas/xcf/main.c7
-rw-r--r--src/generic/evas/xcf/meson.build4
-rw-r--r--src/lib/ecore_con/ecore_con.c8
-rw-r--r--src/lib/ecore_con/ecore_con_eet.c20
-rw-r--r--src/lib/ecore_con/efl_net_dialer_udp.c2
-rw-r--r--src/lib/ecore_con/efl_net_ip_address.c8
-rw-r--r--src/lib/ecore_con/efl_net_socket_udp.c6
-rw-r--r--src/lib/ecore_ipc/ecore_ipc.c24
-rw-r--r--src/lib/eet/eet_cipher.c16
-rw-r--r--src/lib/eet/eet_connection.c16
-rw-r--r--src/lib/eet/eet_data.c14
-rw-r--r--src/lib/eet/eet_image.c20
-rw-r--r--src/lib/eet/eet_lib.c56
-rw-r--r--src/lib/efreet/efreet_mime.c22
-rw-r--r--src/lib/eina/eina_config.h.in9
-rw-r--r--src/lib/eina/eina_cpu.h14
-rw-r--r--src/lib/eina/eina_debug.c2
-rw-r--r--src/lib/eina/eina_inline_cpu.x57
-rw-r--r--src/lib/eina/meson.build3
-rw-r--r--src/lib/emile/emile_cipher_gnutls.c8
-rw-r--r--src/lib/emile/emile_cipher_openssl.c8
-rw-r--r--src/lib/emile/emile_image.c15
-rw-r--r--src/modules/evas/image_savers/tgv/evas_image_save_tgv.c16
-rw-r--r--src/tests/ecore_con/ecore_con_test_efl_net_ip_address.c94
28 files changed, 226 insertions, 242 deletions
diff --git a/configure.ac b/configure.ac
index d7d26b666c..ab6c3dd7c1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1117,6 +1117,7 @@ EINA_CONFIG([HAVE_DEBUG_THREADS], [test "x${want_debug_threads}" = "xyes"])
1117EINA_CONFIG([HAVE_POSIX_SPINLOCK], [test "x${efl_have_posix_threads_spinlock}" = "xyes"]) 1117EINA_CONFIG([HAVE_POSIX_SPINLOCK], [test "x${efl_have_posix_threads_spinlock}" = "xyes"])
1118EINA_CONFIG([HAVE_OSX_SPINLOCK], [test "x${efl_have_osx_spinlock}" = "xyes"]) 1118EINA_CONFIG([HAVE_OSX_SPINLOCK], [test "x${efl_have_osx_spinlock}" = "xyes"])
1119EINA_CONFIG([HAVE_OSX_SEMAPHORE], [test "x${have_darwin}" = "xyes"]) 1119EINA_CONFIG([HAVE_OSX_SEMAPHORE], [test "x${have_darwin}" = "xyes"])
1120EINA_CONFIG([HAVE_WORDS_BIGENDIAN], [test "x${ac_cv_c_bigendian}" = "xyes"])
1120 1121
1121### Modules 1122### Modules
1122 1123
diff --git a/src/examples/ecore/ecore_fd_handler_gnutls_example.c b/src/examples/ecore/ecore_fd_handler_gnutls_example.c
index 6cd5ba1eb1..6547809556 100644
--- a/src/examples/ecore/ecore_fd_handler_gnutls_example.c
+++ b/src/examples/ecore/ecore_fd_handler_gnutls_example.c
@@ -9,15 +9,9 @@
9#ifdef HAVE_NETINET_TCP_H 9#ifdef HAVE_NETINET_TCP_H
10# include <netinet/tcp.h> 10# include <netinet/tcp.h>
11#endif 11#endif
12#ifdef HAVE_NETINET_IN_H
13# include <netinet/in.h>
14#endif
15#ifdef HAVE_SYS_SOCKET_H 12#ifdef HAVE_SYS_SOCKET_H
16# include <sys/socket.h> 13# include <sys/socket.h>
17#endif 14#endif
18#ifdef HAVE_ARPA_INET_H
19# include <arpa/inet.h>
20#endif
21#include <errno.h> 15#include <errno.h>
22#include <unistd.h> 16#include <unistd.h>
23#include <gnutls/gnutls.h> 17#include <gnutls/gnutls.h>
@@ -108,7 +102,7 @@ tcp_connect(void)
108 102
109 memset(&sa, '\0', sizeof (sa)); 103 memset(&sa, '\0', sizeof (sa));
110 sa.sin_family = AF_INET; 104 sa.sin_family = AF_INET;
111 sa.sin_port = htons(atoi(PORT)); 105 sa.sin_port = eina_htons(atoi(PORT));
112 inet_pton(AF_INET, SERVER, &sa.sin_addr); 106 inet_pton(AF_INET, SERVER, &sa.sin_addr);
113 107
114 /* connects to server 108 /* connects to server
diff --git a/src/examples/ecore/efl_net_ip_address_example.c b/src/examples/ecore/efl_net_ip_address_example.c
index ee1595b6c3..16fc876117 100644
--- a/src/examples/ecore/efl_net_ip_address_example.c
+++ b/src/examples/ecore/efl_net_ip_address_example.c
@@ -43,13 +43,13 @@ _print_ip_addr_info(const Eo *o)
43 { 43 {
44 struct sockaddr_in *a = (struct sockaddr_in *)sa; 44 struct sockaddr_in *a = (struct sockaddr_in *)sa;
45 inet_ntop(sa->sa_family, &a->sin_addr, buf, sizeof(buf)); 45 inet_ntop(sa->sa_family, &a->sin_addr, buf, sizeof(buf));
46 port = ntohs(a->sin_port); 46 port = eina_ntohs(a->sin_port);
47 } 47 }
48 else 48 else
49 { 49 {
50 struct sockaddr_in6 *a = (struct sockaddr_in6 *)sa; 50 struct sockaddr_in6 *a = (struct sockaddr_in6 *)sa;
51 inet_ntop(sa->sa_family, &a->sin6_addr, buf, sizeof(buf)); 51 inet_ntop(sa->sa_family, &a->sin6_addr, buf, sizeof(buf));
52 port = ntohs(a->sin6_port); 52 port = eina_ntohs(a->sin6_port);
53 } 53 }
54 54
55 printf("INFO: - sockaddr=%p (%d, '%s', %u)\n", 55 printf("INFO: - sockaddr=%p (%d, '%s', %u)\n",
diff --git a/src/generic/evas/raw/main.c b/src/generic/evas/raw/main.c
index 275815b3cb..70a1625b75 100644
--- a/src/generic/evas/raw/main.c
+++ b/src/generic/evas/raw/main.c
@@ -11,10 +11,6 @@
11#include "shmfile.h" 11#include "shmfile.h"
12#include "timeout.h" 12#include "timeout.h"
13 13
14#ifdef HAVE_NETINET_IN_H
15# include <netinet/in.h>
16#endif
17
18#ifdef HAVE_UNISTD_H 14#ifdef HAVE_UNISTD_H
19# include <unistd.h> 15# include <unistd.h>
20#endif 16#endif
@@ -142,7 +138,7 @@ read_raw_data()
142 if (image->colors != 3) 138 if (image->colors != 3)
143 goto clean_image; 139 goto clean_image;
144#define SWAP(a, b) { a ^= b; a = (b ^=a); } 140#define SWAP(a, b) { a ^= b; a = (b ^=a); }
145 if ((image->bits == 16) && (htons(0x55aa) != 0x55aa)) 141 if ((image->bits == 16) && (eina_htons(0x55aa) != 0x55aa))
146 for (count = 0; count < image->data_size; count +=2) 142 for (count = 0; count < image->data_size; count +=2)
147 SWAP(image->data[count], image->data[count + 1]); 143 SWAP(image->data[count], image->data[count + 1]);
148#undef SWAP 144#undef SWAP
diff --git a/src/generic/evas/xcf/main.c b/src/generic/evas/xcf/main.c
index c5ef6a82d6..65e5e1b5b3 100644
--- a/src/generic/evas/xcf/main.c
+++ b/src/generic/evas/xcf/main.c
@@ -45,14 +45,11 @@
45 Ok, hope this helps with understanding XCF. -- cK. 45 Ok, hope this helps with understanding XCF. -- cK.
46 46
47*/ 47*/
48#include <Eina.h>
48#include "common.h" 49#include "common.h"
49#include "shmfile.h" 50#include "shmfile.h"
50#include "timeout.h" 51#include "timeout.h"
51 52
52#ifdef _WIN32
53# include <winsock2.h> /* for ntohl() */
54#endif
55
56#define FREE(X) { free(X); X = NULL; } 53#define FREE(X) { free(X); X = NULL; }
57 54
58#define TILE_WIDTH 64 55#define TILE_WIDTH 64
@@ -479,7 +476,7 @@ xcf_read_int32(void *fp,
479 xcf_read_int8(fp, (DATA8*) data, count * 4); 476 xcf_read_int8(fp, (DATA8*) data, count * 4);
480 while (count--) 477 while (count--)
481 { 478 {
482 *data = (DATA32)ntohl(*data); 479 *data = (DATA32)eina_ntohl(*data);
483 data++; 480 data++;
484 } 481 }
485 } 482 }
diff --git a/src/generic/evas/xcf/meson.build b/src/generic/evas/xcf/meson.build
index 0f5fb208c5..169469b679 100644
--- a/src/generic/evas/xcf/meson.build
+++ b/src/generic/evas/xcf/meson.build
@@ -4,5 +4,5 @@ generic_src = files([
4 'pixelfuncs.c' 4 'pixelfuncs.c'
5]) 5])
6 6
7generic_deps = [dependency('zlib')] 7generic_deps = [eina, dependency('zlib')]
8generic_support = ['xcf.gz'] \ No newline at end of file 8generic_support = ['xcf.gz']
diff --git a/src/lib/ecore_con/ecore_con.c b/src/lib/ecore_con/ecore_con.c
index d8dbd37a58..5a305d0ab4 100644
--- a/src/lib/ecore_con/ecore_con.c
+++ b/src/lib/ecore_con/ecore_con.c
@@ -288,13 +288,13 @@ efl_net_ip_port_parse_split(const char *host, const char *port, struct sockaddr_
288 if (storage->ss_family == AF_INET6) 288 if (storage->ss_family == AF_INET6)
289 { 289 {
290 struct sockaddr_in6 *a = (struct sockaddr_in6 *)storage; 290 struct sockaddr_in6 *a = (struct sockaddr_in6 *)storage;
291 a->sin6_port = htons(p); 291 a->sin6_port = eina_htons(p);
292 x = inet_pton(AF_INET6, host, &a->sin6_addr); 292 x = inet_pton(AF_INET6, host, &a->sin6_addr);
293 } 293 }
294 else 294 else
295 { 295 {
296 struct sockaddr_in *a = (struct sockaddr_in *)storage; 296 struct sockaddr_in *a = (struct sockaddr_in *)storage;
297 a->sin_port = htons(p); 297 a->sin_port = eina_htons(p);
298 x = inet_pton(AF_INET, host, &a->sin_addr); 298 x = inet_pton(AF_INET, host, &a->sin_addr);
299 } 299 }
300 300
@@ -313,13 +313,13 @@ efl_net_ip_port_fmt(char *buf, size_t buflen, const struct sockaddr *addr)
313 { 313 {
314 const struct sockaddr_in *a = (const struct sockaddr_in *)addr; 314 const struct sockaddr_in *a = (const struct sockaddr_in *)addr;
315 mem = &a->sin_addr; 315 mem = &a->sin_addr;
316 port = ntohs(a->sin_port); 316 port = eina_ntohs(a->sin_port);
317 } 317 }
318 else if (addr->sa_family == AF_INET6) 318 else if (addr->sa_family == AF_INET6)
319 { 319 {
320 const struct sockaddr_in6 *a = (const struct sockaddr_in6 *)addr; 320 const struct sockaddr_in6 *a = (const struct sockaddr_in6 *)addr;
321 mem = &a->sin6_addr; 321 mem = &a->sin6_addr;
322 port = ntohs(a->sin6_port); 322 port = eina_ntohs(a->sin6_port);
323 } 323 }
324 else 324 else
325 { 325 {
diff --git a/src/lib/ecore_con/ecore_con_eet.c b/src/lib/ecore_con/ecore_con_eet.c
index e5d07d5d9d..fd7c547caa 100644
--- a/src/lib/ecore_con/ecore_con_eet.c
+++ b/src/lib/ecore_con/ecore_con_eet.c
@@ -11,10 +11,6 @@
11# endif 11# endif
12#endif 12#endif
13 13
14#ifdef HAVE_ARPA_INET_H
15# include <arpa/inet.h>
16#endif
17
18#include <Eina.h> 14#include <Eina.h>
19 15
20#include "Ecore.h" 16#include "Ecore.h"
@@ -318,11 +314,11 @@ _ecore_con_eet_data(Ecore_Con_Reply *n, void *data, unsigned int size)
318 unsigned int *tmp = data; 314 unsigned int *tmp = data;
319 size -= 4 * sizeof (unsigned int); 315 size -= 4 * sizeof (unsigned int);
320 316
321 if (ntohl(tmp[0]) == ECORE_CON_EET_RAW_MAGIC) 317 if (eina_ntohl(tmp[0]) == ECORE_CON_EET_RAW_MAGIC)
322 { 318 {
323 unsigned int protocol_length = ntohl(tmp[1]); 319 unsigned int protocol_length = eina_ntohl(tmp[1]);
324 unsigned int section_length = ntohl(tmp[2]); 320 unsigned int section_length = eina_ntohl(tmp[2]);
325 unsigned int data_length = ntohl(tmp[3]); 321 unsigned int data_length = eina_ntohl(tmp[3]);
326 322
327 if (protocol_length > 1 && section_length > 1 && protocol_length + section_length <= size && data_length < 10 * 1024 * 1024) 323 if (protocol_length > 1 && section_length > 1 && protocol_length + section_length <= size && data_length < 10 * 1024 * 1024)
328 { 324 {
@@ -559,10 +555,10 @@ _ecore_con_eet_base_raw_send(Eo *obj EINA_UNUSED, Ecore_Con_Eet_Base_Data *pd, E
559 if (protocol_length == 1) return; 555 if (protocol_length == 1) return;
560 section_length = strlen(section) + 1; 556 section_length = strlen(section) + 1;
561 557
562 protocol[0] = htonl(ECORE_CON_EET_RAW_MAGIC); 558 protocol[0] = eina_htonl(ECORE_CON_EET_RAW_MAGIC);
563 protocol[1] = htonl(protocol_length); 559 protocol[1] = eina_htonl(protocol_length);
564 protocol[2] = htonl(section_length); 560 protocol[2] = eina_htonl(section_length);
565 protocol[3] = htonl(length); 561 protocol[3] = eina_htonl(length);
566 562
567 size = sizeof (protocol) + protocol_length + section_length; 563 size = sizeof (protocol) + protocol_length + section_length;
568 tmp = alloca(size); 564 tmp = alloca(size);
diff --git a/src/lib/ecore_con/efl_net_dialer_udp.c b/src/lib/ecore_con/efl_net_dialer_udp.c
index 351d077909..953ae7dd2f 100644
--- a/src/lib/ecore_con/efl_net_dialer_udp.c
+++ b/src/lib/ecore_con/efl_net_dialer_udp.c
@@ -143,7 +143,7 @@ _efl_net_dialer_udp_resolved_bind(Eo *o, Efl_Net_Dialer_Udp_Data *pd EINA_UNUSED
143 if (family == AF_INET) 143 if (family == AF_INET)
144 { 144 {
145 const struct sockaddr_in *a = (const struct sockaddr_in *)addr->ai_addr; 145 const struct sockaddr_in *a = (const struct sockaddr_in *)addr->ai_addr;
146 uint32_t ipv4 = ntohl(a->sin_addr.s_addr); 146 uint32_t ipv4 = eina_ntohl(a->sin_addr.s_addr);
147 if (ipv4 == INADDR_BROADCAST) 147 if (ipv4 == INADDR_BROADCAST)
148 { 148 {
149#ifdef _WIN32 149#ifdef _WIN32
diff --git a/src/lib/ecore_con/efl_net_ip_address.c b/src/lib/ecore_con/efl_net_ip_address.c
index 46fe75bd08..9a79c07b3e 100644
--- a/src/lib/ecore_con/efl_net_ip_address.c
+++ b/src/lib/ecore_con/efl_net_ip_address.c
@@ -104,7 +104,7 @@ _efl_net_ip_address_family_get(const Eo *o EINA_UNUSED, Efl_Net_Ip_Address_Data
104EOLIAN static void 104EOLIAN static void
105_efl_net_ip_address_port_set(Eo *o EINA_UNUSED, Efl_Net_Ip_Address_Data *pd, uint16_t port) 105_efl_net_ip_address_port_set(Eo *o EINA_UNUSED, Efl_Net_Ip_Address_Data *pd, uint16_t port)
106{ 106{
107 uint16_t *pport, nport = htons(port); 107 uint16_t *pport, nport = eina_htons(port);
108 108
109 EINA_SAFETY_ON_TRUE_RETURN(pd->addr.sa_family == 0); 109 EINA_SAFETY_ON_TRUE_RETURN(pd->addr.sa_family == 0);
110 if (pd->addr.sa_family == AF_INET6) 110 if (pd->addr.sa_family == AF_INET6)
@@ -115,7 +115,7 @@ _efl_net_ip_address_port_set(Eo *o EINA_UNUSED, Efl_Net_Ip_Address_Data *pd, uin
115 if (*pport == nport) return; 115 if (*pport == nport) return;
116 if (*pport) 116 if (*pport)
117 { 117 {
118 ERR("port already set to %hu, new %hu", ntohs(*pport), port); 118 ERR("port already set to %hu, new %hu", eina_ntohs(*pport), port);
119 return; 119 return;
120 } 120 }
121 121
@@ -133,7 +133,7 @@ _efl_net_ip_address_port_get(const Eo *o EINA_UNUSED, Efl_Net_Ip_Address_Data *p
133 else 133 else
134 pport = &pd->ipv4.sin_port; 134 pport = &pd->ipv4.sin_port;
135 135
136 return ntohs(*pport); 136 return eina_ntohs(*pport);
137} 137}
138 138
139EOLIAN static void 139EOLIAN static void
@@ -213,7 +213,7 @@ _efl_net_ip_address_sockaddr_get(const Eo *o EINA_UNUSED, Efl_Net_Ip_Address_Dat
213 return &pd->addr; 213 return &pd->addr;
214} 214}
215 215
216#define IPV4_ADDR_GET(pd) ntohl(pd->ipv4.sin_addr.s_addr) 216#define IPV4_ADDR_GET(pd) eina_ntohl(pd->ipv4.sin_addr.s_addr)
217 217
218EOLIAN static Eina_Bool 218EOLIAN static Eina_Bool
219_efl_net_ip_address_ipv4_class_a_check(const Eo *o EINA_UNUSED, Efl_Net_Ip_Address_Data *pd) 219_efl_net_ip_address_ipv4_class_a_check(const Eo *o EINA_UNUSED, Efl_Net_Ip_Address_Data *pd)
diff --git a/src/lib/ecore_con/efl_net_socket_udp.c b/src/lib/ecore_con/efl_net_socket_udp.c
index 487fb7a4e9..29b66f3ed6 100644
--- a/src/lib/ecore_con/efl_net_socket_udp.c
+++ b/src/lib/ecore_con/efl_net_socket_udp.c
@@ -124,9 +124,9 @@ _efl_net_socket_udp_bind(Eo *o, Efl_Net_Socket_Udp_Data *pd)
124 } 124 }
125 125
126 if (family == AF_INET) 126 if (family == AF_INET)
127 bsa4.sin_port = htons(ul); 127 bsa4.sin_port = eina_htons(ul);
128 else 128 else
129 bsa6.sin6_port = htons(ul); 129 bsa6.sin6_port = eina_htons(ul);
130 130
131 if (family == AF_INET) 131 if (family == AF_INET)
132 r = bind(fd, (struct sockaddr *)&bsa4, sizeof(bsa4)); 132 r = bind(fd, (struct sockaddr *)&bsa4, sizeof(bsa4));
@@ -539,7 +539,7 @@ _efl_net_socket_udp_efl_io_reader_read(Eo *o, Efl_Net_Socket_Udp_Data *pd, Eina_
539 if (addr.ss_family == AF_INET) 539 if (addr.ss_family == AF_INET)
540 { 540 {
541 const struct sockaddr_in *a = (const struct sockaddr_in *)pd->addr_remote; 541 const struct sockaddr_in *a = (const struct sockaddr_in *)pd->addr_remote;
542 uint32_t ipv4 = ntohl(a->sin_addr.s_addr); 542 uint32_t ipv4 = eina_ntohl(a->sin_addr.s_addr);
543 if ((ipv4 != INADDR_BROADCAST) && (ipv4 != INADDR_ANY) && (!IN_MULTICAST(ipv4))) 543 if ((ipv4 != INADDR_BROADCAST) && (ipv4 != INADDR_ANY) && (!IN_MULTICAST(ipv4)))
544 { 544 {
545 if ((addrlen != pd->addr_remote_len) || 545 if ((addrlen != pd->addr_remote_len) ||
diff --git a/src/lib/ecore_ipc/ecore_ipc.c b/src/lib/ecore_ipc/ecore_ipc.c
index babf033a17..094e95aed1 100644
--- a/src/lib/ecore_ipc/ecore_ipc.c
+++ b/src/lib/ecore_ipc/ecore_ipc.c
@@ -886,7 +886,7 @@ ecore_ipc_server_clients_get(Ecore_Ipc_Server *svr)
886 unsigned char *dd; \ 886 unsigned char *dd; \
887 dd = (unsigned char *)&v; \ 887 dd = (unsigned char *)&v; \
888 v = d; \ 888 v = d; \
889 v = htonl(v); \ 889 v = eina_htonl(v); \
890 *(dat + s + 0) = dd[0]; \ 890 *(dat + s + 0) = dd[0]; \
891 *(dat + s + 1) = dd[1]; \ 891 *(dat + s + 1) = dd[1]; \
892 *(dat + s + 2) = dd[2]; \ 892 *(dat + s + 2) = dd[2]; \
@@ -899,7 +899,7 @@ ecore_ipc_server_clients_get(Ecore_Ipc_Server *svr)
899 unsigned char *dd; \ 899 unsigned char *dd; \
900 dd = (unsigned char *)&v; \ 900 dd = (unsigned char *)&v; \
901 v = d; \ 901 v = d; \
902 v = htons(v); \ 902 v = eina_htons(v); \
903 *(dat + s + 0) = dd[0]; \ 903 *(dat + s + 0) = dd[0]; \
904 *(dat + s + 1) = dd[1]; \ 904 *(dat + s + 1) = dd[1]; \
905 s += 2; \ 905 s += 2; \
@@ -945,7 +945,7 @@ ecore_ipc_server_send(Ecore_Ipc_Server *svr, int major, int minor, int ref, int
945 *head |= md << (4 * 4); 945 *head |= md << (4 * 4);
946 SVENC(size); 946 SVENC(size);
947 *head |= md << (4 * 5); 947 *head |= md << (4 * 5);
948 *head = htonl(*head); 948 *head = eina_htonl(*head);
949 svr->prev.o = msg; 949 svr->prev.o = msg;
950 950
951 if (svr->dialer.input) 951 if (svr->dialer.input)
@@ -1101,7 +1101,7 @@ ecore_ipc_server_flush(Ecore_Ipc_Server *svr)
1101 unsigned char *dd; \ 1101 unsigned char *dd; \
1102 dd = (unsigned char *)&v; \ 1102 dd = (unsigned char *)&v; \
1103 v = d; \ 1103 v = d; \
1104 v = htonl(v); \ 1104 v = eina_htonl(v); \
1105 *(dat + s + 0) = dd[0]; \ 1105 *(dat + s + 0) = dd[0]; \
1106 *(dat + s + 1) = dd[1]; \ 1106 *(dat + s + 1) = dd[1]; \
1107 *(dat + s + 2) = dd[2]; \ 1107 *(dat + s + 2) = dd[2]; \
@@ -1114,7 +1114,7 @@ ecore_ipc_server_flush(Ecore_Ipc_Server *svr)
1114 unsigned char *dd; \ 1114 unsigned char *dd; \
1115 dd = (unsigned char *)&v; \ 1115 dd = (unsigned char *)&v; \
1116 v = d; \ 1116 v = d; \
1117 v = htons(v); \ 1117 v = eina_htons(v); \
1118 *(dat + s + 0) = dd[0]; \ 1118 *(dat + s + 0) = dd[0]; \
1119 *(dat + s + 1) = dd[1]; \ 1119 *(dat + s + 1) = dd[1]; \
1120 s += 2; \ 1120 s += 2; \
@@ -1168,7 +1168,7 @@ ecore_ipc_client_send(Ecore_Ipc_Client *cl, int major, int minor, int ref, int r
1168 *head |= md << (4 * 4); 1168 *head |= md << (4 * 4);
1169 CLENC(size); 1169 CLENC(size);
1170 *head |= md << (4 * 5); 1170 *head |= md << (4 * 5);
1171 *head = htonl(*head); 1171 *head = eina_htonl(*head);
1172 cl->prev.o = msg; 1172 cl->prev.o = msg;
1173 1173
1174 if (cl->socket.input) 1174 if (cl->socket.input)
@@ -1503,7 +1503,7 @@ ecore_ipc_ssl_available_get(void)
1503 dv[1] = *(cl->buf + offset + s + 1); \ 1503 dv[1] = *(cl->buf + offset + s + 1); \
1504 dv[2] = *(cl->buf + offset + s + 2); \ 1504 dv[2] = *(cl->buf + offset + s + 2); \
1505 dv[3] = *(cl->buf + offset + s + 3); \ 1505 dv[3] = *(cl->buf + offset + s + 3); \
1506 d = (int)ntohl(v); \ 1506 d = (int)eina_ntohl(v); \
1507 s += 4; \ 1507 s += 4; \
1508 } \ 1508 } \
1509 else if (md >= DLT_ADD16) \ 1509 else if (md >= DLT_ADD16) \
@@ -1513,7 +1513,7 @@ ecore_ipc_ssl_available_get(void)
1513 dv = (unsigned char *)&v; \ 1513 dv = (unsigned char *)&v; \
1514 dv[0] = *(cl->buf + offset + s + 0); \ 1514 dv[0] = *(cl->buf + offset + s + 0); \
1515 dv[1] = *(cl->buf + offset + s + 1); \ 1515 dv[1] = *(cl->buf + offset + s + 1); \
1516 d = (int)ntohs(v); \ 1516 d = (int)eina_ntohs(v); \
1517 s += 2; \ 1517 s += 2; \
1518 } \ 1518 } \
1519 else if (md >= DLT_ADD8) \ 1519 else if (md >= DLT_ADD8) \
@@ -1572,7 +1572,7 @@ ecore_ipc_client_data_process(Ecore_Ipc_Client *cl, void *data, int size, Eina_B
1572 dd[1] = *(cl->buf + offset + 1); 1572 dd[1] = *(cl->buf + offset + 1);
1573 dd[2] = *(cl->buf + offset + 2); 1573 dd[2] = *(cl->buf + offset + 2);
1574 dd[3] = *(cl->buf + offset + 3); 1574 dd[3] = *(cl->buf + offset + 3);
1575 head = ntohl(head); 1575 head = eina_ntohl(head);
1576 dd = (unsigned char *)&d; 1576 dd = (unsigned char *)&d;
1577 s = 4; 1577 s = 4;
1578 CLSZ(0); 1578 CLSZ(0);
@@ -1695,7 +1695,7 @@ ecore_ipc_client_data_process(Ecore_Ipc_Client *cl, void *data, int size, Eina_B
1695 dv[1] = *(svr->buf + offset + s + 1); \ 1695 dv[1] = *(svr->buf + offset + s + 1); \
1696 dv[2] = *(svr->buf + offset + s + 2); \ 1696 dv[2] = *(svr->buf + offset + s + 2); \
1697 dv[3] = *(svr->buf + offset + s + 3); \ 1697 dv[3] = *(svr->buf + offset + s + 3); \
1698 d = (int)ntohl(v); \ 1698 d = (int)eina_ntohl(v); \
1699 s += 4; \ 1699 s += 4; \
1700 } \ 1700 } \
1701 else if (md >= DLT_ADD16) \ 1701 else if (md >= DLT_ADD16) \
@@ -1705,7 +1705,7 @@ ecore_ipc_client_data_process(Ecore_Ipc_Client *cl, void *data, int size, Eina_B
1705 dv = (unsigned char *)&v; \ 1705 dv = (unsigned char *)&v; \
1706 dv[0] = *(svr->buf + offset + s + 0); \ 1706 dv[0] = *(svr->buf + offset + s + 0); \
1707 dv[1] = *(svr->buf + offset + s + 1); \ 1707 dv[1] = *(svr->buf + offset + s + 1); \
1708 d = (int)ntohs(v); \ 1708 d = (int)eina_ntohs(v); \
1709 s += 2; \ 1709 s += 2; \
1710 } \ 1710 } \
1711 else if (md >= DLT_ADD8) \ 1711 else if (md >= DLT_ADD8) \
@@ -1763,7 +1763,7 @@ ecore_ipc_server_data_process(Ecore_Ipc_Server *svr, void *data, int size, Eina_
1763 dd[1] = *(svr->buf + offset + 1); 1763 dd[1] = *(svr->buf + offset + 1);
1764 dd[2] = *(svr->buf + offset + 2); 1764 dd[2] = *(svr->buf + offset + 2);
1765 dd[3] = *(svr->buf + offset + 3); 1765 dd[3] = *(svr->buf + offset + 3);
1766 head = ntohl(head); 1766 head = eina_ntohl(head);
1767 dd = (unsigned char *)&d; 1767 dd = (unsigned char *)&d;
1768 s = 4; 1768 s = 4;
1769 SVSZ(0); 1769 SVSZ(0);
diff --git a/src/lib/eet/eet_cipher.c b/src/lib/eet/eet_cipher.c
index ea4880edcb..3bdab4c2f1 100644
--- a/src/lib/eet/eet_cipher.c
+++ b/src/lib/eet/eet_cipher.c
@@ -8,10 +8,6 @@
8#include <sys/stat.h> 8#include <sys/stat.h>
9#include <unistd.h> 9#include <unistd.h>
10 10
11#ifdef HAVE_NETINET_IN_H
12# include <netinet/in.h>
13#endif
14
15#ifdef HAVE_SIGNATURE 11#ifdef HAVE_SIGNATURE
16# include <sys/mman.h> 12# include <sys/mman.h>
17# ifdef HAVE_GNUTLS 13# ifdef HAVE_GNUTLS
@@ -601,9 +597,9 @@ eet_identity_sign(FILE *fp,
601 597
602# endif /* ifdef HAVE_GNUTLS */ 598# endif /* ifdef HAVE_GNUTLS */
603 /* Append the signature at the end of the file. */ 599 /* Append the signature at the end of the file. */
604 head[0] = (int)htonl ((unsigned int)EET_MAGIC_SIGN); 600 head[0] = (int)eina_htonl ((unsigned int)EET_MAGIC_SIGN);
605 head[1] = (int)htonl ((unsigned int)sign_len); 601 head[1] = (int)eina_htonl ((unsigned int)sign_len);
606 head[2] = (int)htonl ((unsigned int)cert_len); 602 head[2] = (int)eina_htonl ((unsigned int)cert_len);
607 603
608 if (fwrite(head, sizeof(head), 1, fp) != 1) 604 if (fwrite(head, sizeof(head), 1, fp) != 1)
609 { 605 {
@@ -675,9 +671,9 @@ eet_identity_check(const void *data_base,
675 memcpy(&sign_len, header+1, sizeof(int)); 671 memcpy(&sign_len, header+1, sizeof(int));
676 memcpy(&cert_len, header+2, sizeof(int)); 672 memcpy(&cert_len, header+2, sizeof(int));
677 673
678 magic = ntohl(magic); 674 magic = eina_ntohl(magic);
679 sign_len = ntohl(sign_len); 675 sign_len = eina_ntohl(sign_len);
680 cert_len = ntohl(cert_len); 676 cert_len = eina_ntohl(cert_len);
681 677
682 /* Verify the header */ 678 /* Verify the header */
683 if (magic != EET_MAGIC_SIGN) 679 if (magic != EET_MAGIC_SIGN)
diff --git a/src/lib/eet/eet_connection.c b/src/lib/eet/eet_connection.c
index 735e112271..c46f614960 100644
--- a/src/lib/eet/eet_connection.c
+++ b/src/lib/eet/eet_connection.c
@@ -5,14 +5,6 @@
5#include <string.h> 5#include <string.h>
6#include <stdlib.h> 6#include <stdlib.h>
7 7
8#ifdef HAVE_NETINET_IN_H
9# include <netinet/in.h>
10#endif
11
12#ifdef _WIN32
13# include <winsock2.h>
14#endif /* ifdef _WIN32 */
15
16#include <Eina.h> 8#include <Eina.h>
17 9
18#include "Eet.h" 10#include "Eet.h"
@@ -71,9 +63,9 @@ eet_connection_received(Eet_Connection *conn,
71 63
72 msg = data; 64 msg = data;
73 /* Check the magic */ 65 /* Check the magic */
74 if (ntohl(msg[0]) != MAGIC_EET_DATA_PACKET) break; 66 if (eina_ntohl(msg[0]) != MAGIC_EET_DATA_PACKET) break;
75 67
76 packet_size = ntohl(msg[1]); 68 packet_size = eina_ntohl(msg[1]);
77 /* Message should always be under MAX_MSG_SIZE */ 69 /* Message should always be under MAX_MSG_SIZE */
78 if (packet_size > MAX_MSG_SIZE) break; 70 if (packet_size > MAX_MSG_SIZE) break;
79 71
@@ -143,8 +135,8 @@ _eet_connection_raw_send(Eet_Connection *conn,
143 /* Message should always be under MAX_MSG_SIZE */ 135 /* Message should always be under MAX_MSG_SIZE */
144 if (data_size > MAX_MSG_SIZE) return EINA_FALSE; 136 if (data_size > MAX_MSG_SIZE) return EINA_FALSE;
145 message = malloc(data_size + (sizeof(int) * 2)); 137 message = malloc(data_size + (sizeof(int) * 2));
146 message[0] = htonl(MAGIC_EET_DATA_PACKET); 138 message[0] = eina_htonl(MAGIC_EET_DATA_PACKET);
147 message[1] = htonl(data_size); 139 message[1] = eina_htonl(data_size);
148 memcpy(message + 2, data, data_size); 140 memcpy(message + 2, data, data_size);
149 conn->eet_write_cb(message, 141 conn->eet_write_cb(message,
150 data_size + (sizeof(int) * 2), 142 data_size + (sizeof(int) * 2),
diff --git a/src/lib/eet/eet_data.c b/src/lib/eet/eet_data.c
index e00b8ac241..2cda26def6 100644
--- a/src/lib/eet/eet_data.c
+++ b/src/lib/eet/eet_data.c
@@ -8,14 +8,6 @@
8#include <ctype.h> 8#include <ctype.h>
9#include <limits.h> 9#include <limits.h>
10 10
11#ifdef HAVE_NETINET_IN_H
12# include <netinet/in.h>
13#endif
14
15#ifdef _WIN32
16# include <winsock2.h>
17#endif /* ifdef _WIN32 */
18
19#include <Eina.h> 11#include <Eina.h>
20 12
21#include "Eet.h" 13#include "Eet.h"
@@ -2877,7 +2869,7 @@ _eet_data_dump_encode(int parent_type,
2877 { 2869 {
2878 unsigned long int v; 2870 unsigned long int v;
2879 2871
2880 v = htonl(0x12345678); 2872 v = eina_htonl(0x12345678);
2881 if (v == 0x12345678) 2873 if (v == 0x12345678)
2882 _eet_data_words_bigendian = 1; 2874 _eet_data_words_bigendian = 1;
2883 else 2875 else
@@ -3483,7 +3475,7 @@ _eet_data_descriptor_decode(Eet_Free_Context *context,
3483 { 3475 {
3484 unsigned long int v; 3476 unsigned long int v;
3485 3477
3486 v = htonl(0x12345678); 3478 v = eina_htonl(0x12345678);
3487 if (v == 0x12345678) 3479 if (v == 0x12345678)
3488 _eet_data_words_bigendian = 1; 3480 _eet_data_words_bigendian = 1;
3489 else 3481 else
@@ -5088,7 +5080,7 @@ _eet_data_descriptor_encode(Eet_Dictionary *ed,
5088 { 5080 {
5089 unsigned long int v; 5081 unsigned long int v;
5090 5082
5091 v = htonl(0x12345678); 5083 v = eina_htonl(0x12345678);
5092 if (v == 0x12345678) 5084 if (v == 0x12345678)
5093 _eet_data_words_bigendian = 1; 5085 _eet_data_words_bigendian = 1;
5094 else 5086 else
diff --git a/src/lib/eet/eet_image.c b/src/lib/eet/eet_image.c
index 33dbcf7af9..3cfb5fca19 100644
--- a/src/lib/eet/eet_image.c
+++ b/src/lib/eet/eet_image.c
@@ -6,16 +6,6 @@
6# include <sys/types.h> 6# include <sys/types.h>
7#endif /* ifdef __OpenBSD__ */ 7#endif /* ifdef __OpenBSD__ */
8 8
9#ifdef HAVE_NETINET_IN_H
10# include <netinet/in.h>
11#endif
12
13#ifdef _WIN32
14# include <winsock2.h>
15# define HAVE_BOOLEAN
16# define XMD_H /* This prevents libjpeg to redefine INT32 */
17#endif /* ifdef _WIN32 */
18
19#include <stdio.h> 9#include <stdio.h>
20#include <string.h> 10#include <string.h>
21#include <setjmp.h> 11#include <setjmp.h>
@@ -254,7 +244,7 @@ _eet_image_endian_check(void)
254 { 244 {
255 unsigned long int v; 245 unsigned long int v;
256 246
257 v = htonl(0x12345678); 247 v = eina_htonl(0x12345678);
258 if (v == 0x12345678) 248 if (v == 0x12345678)
259 _eet_image_words_bigendian = 1; 249 _eet_image_words_bigendian = 1;
260 else 250 else
@@ -811,8 +801,8 @@ eet_data_image_etc1_compressed_convert(int *size,
811 801
812 image_stride = w; 802 image_stride = w;
813 image_height = h; 803 image_height = h;
814 nl_width = htonl(image_stride); 804 nl_width = eina_htonl(image_stride);
815 nl_height = htonl(image_height); 805 nl_height = eina_htonl(image_height);
816 compress = !!compress; 806 compress = !!compress;
817 807
818 // Disable dithering, as it will deteriorate the quality of flat surfaces 808 // Disable dithering, as it will deteriorate the quality of flat surfaces
@@ -1792,8 +1782,8 @@ eet_data_image_header_advance_decode_cipher(const void *data,
1792 const char *m = data; 1782 const char *m = data;
1793 1783
1794 // We only use Emile for decoding the actual data, seems simpler this way. 1784 // We only use Emile for decoding the actual data, seems simpler this way.
1795 if (w) *w = ntohl(*((unsigned int*) &(m[OFFSET_WIDTH]))); 1785 if (w) *w = eina_ntohl(*((unsigned int*) &(m[OFFSET_WIDTH])));
1796 if (h) *h = ntohl(*((unsigned int*) &(m[OFFSET_HEIGHT]))); 1786 if (h) *h = eina_ntohl(*((unsigned int*) &(m[OFFSET_HEIGHT])));
1797 if (comp) *comp = m[OFFSET_OPTIONS] & 0x1; 1787 if (comp) *comp = m[OFFSET_OPTIONS] & 0x1;
1798 switch (m[OFFSET_ALGORITHM] & 0xFF) 1788 switch (m[OFFSET_ALGORITHM] & 0xFF)
1799 { 1789 {
diff --git a/src/lib/eet/eet_lib.c b/src/lib/eet/eet_lib.c
index e53d1ed89a..0e05b2acaf 100644
--- a/src/lib/eet/eet_lib.c
+++ b/src/lib/eet/eet_lib.c
@@ -2,10 +2,6 @@
2# include <config.h> 2# include <config.h>
3#endif /* ifdef HAVE_CONFIG_H */ 3#endif /* ifdef HAVE_CONFIG_H */
4 4
5#ifdef _WIN32
6# include <winsock2.h>
7#endif /* ifdef _WIN32 */
8
9#include <stdio.h> 5#include <stdio.h>
10#include <errno.h> 6#include <errno.h>
11#include <sys/types.h> 7#include <sys/types.h>
@@ -16,14 +12,6 @@
16#include <fnmatch.h> 12#include <fnmatch.h>
17#include <fcntl.h> 13#include <fcntl.h>
18 14
19#ifdef HAVE_NETINET_IN_H
20# include <netinet/in.h>
21#endif
22
23#ifdef _WIN32
24# include <Evil.h>
25#endif /* ifdef _WIN32 */
26
27#include <Eina.h> 15#include <Eina.h>
28#include <Emile.h> 16#include <Emile.h>
29 17
@@ -384,9 +372,9 @@ eet_flush2(Eet_File *ef)
384 num_dictionary_entries; 372 num_dictionary_entries;
385 373
386 /* go thru and write the header */ 374 /* go thru and write the header */
387 head[0] = (int)htonl((unsigned int)EET_MAGIC_FILE2); 375 head[0] = (int)eina_htonl((unsigned int)EET_MAGIC_FILE2);
388 head[1] = (int)htonl((unsigned int)num_directory_entries); 376 head[1] = (int)eina_htonl((unsigned int)num_directory_entries);
389 head[2] = (int)htonl((unsigned int)num_dictionary_entries); 377 head[2] = (int)eina_htonl((unsigned int)num_dictionary_entries);
390 378
391 fseek(fp, 0, SEEK_SET); 379 fseek(fp, 0, SEEK_SET);
392 if (fwrite(head, sizeof (head), 1, fp) != 1) 380 if (fwrite(head, sizeof (head), 1, fp) != 1)
@@ -414,12 +402,12 @@ eet_flush2(Eet_File *ef)
414 402
415 efn->offset = data_offset; 403 efn->offset = data_offset;
416 404
417 ibuf[0] = (int)htonl((unsigned int)data_offset); 405 ibuf[0] = (int)eina_htonl((unsigned int)data_offset);
418 ibuf[1] = (int)htonl((unsigned int)efn->size); 406 ibuf[1] = (int)eina_htonl((unsigned int)efn->size);
419 ibuf[2] = (int)htonl((unsigned int)efn->data_size); 407 ibuf[2] = (int)eina_htonl((unsigned int)efn->data_size);
420 ibuf[3] = (int)htonl((unsigned int)strings_offset); 408 ibuf[3] = (int)eina_htonl((unsigned int)strings_offset);
421 ibuf[4] = (int)htonl((unsigned int)efn->name_size); 409 ibuf[4] = (int)eina_htonl((unsigned int)efn->name_size);
422 ibuf[5] = (int)htonl((unsigned int)flag); 410 ibuf[5] = (int)eina_htonl((unsigned int)flag);
423 411
424 strings_offset += efn->name_size; 412 strings_offset += efn->name_size;
425 data_offset += efn->size; 413 data_offset += efn->size;
@@ -449,11 +437,11 @@ eet_flush2(Eet_File *ef)
449 if (ef->ed->hash[ef->ed->all_hash[j]] == j) 437 if (ef->ed->hash[ef->ed->all_hash[j]] == j)
450 prev = -1; 438 prev = -1;
451 439
452 sbuf[0] = (int)htonl((unsigned int)ef->ed->all_hash[j]); 440 sbuf[0] = (int)eina_htonl((unsigned int)ef->ed->all_hash[j]);
453 sbuf[1] = (int)htonl((unsigned int)offset); 441 sbuf[1] = (int)eina_htonl((unsigned int)offset);
454 sbuf[2] = (int)htonl((unsigned int)ef->ed->all[j].len); 442 sbuf[2] = (int)eina_htonl((unsigned int)ef->ed->all[j].len);
455 sbuf[3] = (int)htonl((unsigned int)prev); 443 sbuf[3] = (int)eina_htonl((unsigned int)prev);
456 sbuf[4] = (int)htonl((unsigned int)ef->ed->all[j].next); 444 sbuf[4] = (int)eina_htonl((unsigned int)ef->ed->all[j].next);
457 445
458 offset += ef->ed->all[j].len; 446 offset += ef->ed->all[j].len;
459 447
@@ -755,14 +743,14 @@ eet_internal_read2(Eet_File *ef)
755 unsigned int i; 743 unsigned int i;
756 744
757 idx += sizeof(int); 745 idx += sizeof(int);
758 if (eet_test_close((int)ntohl(*data) != EET_MAGIC_FILE2, ef)) 746 if (eet_test_close((int)eina_ntohl(*data) != EET_MAGIC_FILE2, ef))
759 return NULL; 747 return NULL;
760 748
761 data++; 749 data++;
762 750
763#define GET_INT(Value, Pointer, Index) \ 751#define GET_INT(Value, Pointer, Index) \
764 { \ 752 { \
765 Value = ntohl(*Pointer); \ 753 Value = eina_ntohl(*Pointer); \
766 Pointer++; \ 754 Pointer++; \
767 Index += sizeof(int); \ 755 Index += sizeof(int); \
768 } 756 }
@@ -1003,9 +991,9 @@ eet_internal_read2(Eet_File *ef)
1003 /* check the signature has the magic number and sig + cert len 991 /* check the signature has the magic number and sig + cert len
1004 * + magic is sane */ 992 * + magic is sane */
1005 memcpy(head, buffer, 3 * sizeof(int)); 993 memcpy(head, buffer, 3 * sizeof(int));
1006 head[0] = ntohl(head[0]); 994 head[0] = eina_ntohl(head[0]);
1007 head[1] = ntohl(head[1]); 995 head[1] = eina_ntohl(head[1]);
1008 head[2] = ntohl(head[2]); 996 head[2] = eina_ntohl(head[2]);
1009 if ((head[0] == EET_MAGIC_SIGN) && (head[1] > 0) && (head[2] > 0)) 997 if ((head[0] == EET_MAGIC_SIGN) && (head[1] > 0) && (head[2] > 0))
1010 { 998 {
1011 /* there appears to be an actual valid identity at the end 999 /* there appears to be an actual valid identity at the end
@@ -1061,14 +1049,14 @@ eet_internal_read1(Eet_File *ef)
1061 /* build header table if read mode */ 1049 /* build header table if read mode */
1062 /* geat header */ 1050 /* geat header */
1063 idx += sizeof(int); 1051 idx += sizeof(int);
1064 if (eet_test_close((int)ntohl(*((int *)ef->data)) != EET_MAGIC_FILE, ef)) 1052 if (eet_test_close((int)eina_ntohl(*((int *)ef->data)) != EET_MAGIC_FILE, ef))
1065 return NULL; 1053 return NULL;
1066 1054
1067#define EXTRACT_INT(Value, Pointer, Index) \ 1055#define EXTRACT_INT(Value, Pointer, Index) \
1068 { \ 1056 { \
1069 int tmp; \ 1057 int tmp; \
1070 memcpy(&tmp, Pointer + Index, sizeof(int)); \ 1058 memcpy(&tmp, Pointer + Index, sizeof(int)); \
1071 Value = ntohl(tmp); \ 1059 Value = eina_ntohl(tmp); \
1072 Index += sizeof(int); \ 1060 Index += sizeof(int); \
1073 } 1061 }
1074 1062
@@ -1248,7 +1236,7 @@ eet_internal_read(Eet_File *ef)
1248 if (eet_test_close(ef->data_size < (int)sizeof(int) * 3, ef)) 1236 if (eet_test_close(ef->data_size < (int)sizeof(int) * 3, ef))
1249 return NULL; 1237 return NULL;
1250 1238
1251 switch (ntohl(*data)) 1239 switch (eina_ntohl(*data))
1252 { 1240 {
1253#if EET_OLD_EET_FILE_FORMAT 1241#if EET_OLD_EET_FILE_FORMAT
1254 case EET_MAGIC_FILE: 1242 case EET_MAGIC_FILE:
diff --git a/src/lib/efreet/efreet_mime.c b/src/lib/efreet/efreet_mime.c
index 68767dcec0..e4e1ba896f 100644
--- a/src/lib/efreet/efreet_mime.c
+++ b/src/lib/efreet/efreet_mime.c
@@ -9,18 +9,6 @@
9#include <sys/mman.h> 9#include <sys/mman.h>
10#include <fnmatch.h> 10#include <fnmatch.h>
11 11
12#ifdef HAVE_NETINET_IN_H
13# include <netinet/in.h>
14#endif
15
16#ifdef HAVE_ARPA_INET_H
17# include <arpa/inet.h>
18#endif
19
20#ifdef _WIN32
21# include <winsock2.h>
22#endif
23
24#include <Ecore.h> 12#include <Ecore.h>
25#include <Ecore_File.h> 13#include <Ecore_File.h>
26 14
@@ -1018,7 +1006,7 @@ efreet_mime_shared_mimeinfo_magic_parse(char *data, int size)
1018 1006
1019 tshort = 0; 1007 tshort = 0;
1020 memcpy(&tshort, ptr, sizeof(short)); 1008 memcpy(&tshort, ptr, sizeof(short));
1021 entry->value_len = ntohs(tshort); 1009 entry->value_len = eina_ntohs(tshort);
1022 ptr += 2; 1010 ptr += 2;
1023 1011
1024 entry->value = NEW(char, entry->value_len); 1012 entry->value = NEW(char, entry->value_len);
@@ -1059,20 +1047,20 @@ efreet_mime_shared_mimeinfo_magic_parse(char *data, int size)
1059 if (entry->word_size == 2) 1047 if (entry->word_size == 2)
1060 { 1048 {
1061 ((short*)entry->value)[j] = 1049 ((short*)entry->value)[j] =
1062 ntohs(((short*)entry->value)[j]); 1050 eina_ntohs(((short*)entry->value)[j]);
1063 1051
1064 if (entry->mask) 1052 if (entry->mask)
1065 ((short*)entry->mask)[j] = 1053 ((short*)entry->mask)[j] =
1066 ntohs(((short*)entry->mask)[j]); 1054 eina_ntohs(((short*)entry->mask)[j]);
1067 } 1055 }
1068 else if (entry->word_size == 4) 1056 else if (entry->word_size == 4)
1069 { 1057 {
1070 ((int*)entry->value)[j] = 1058 ((int*)entry->value)[j] =
1071 ntohl(((int*)entry->value)[j]); 1059 eina_ntohl(((int*)entry->value)[j]);
1072 1060
1073 if (entry->mask) 1061 if (entry->mask)
1074 ((int*)entry->mask)[j] = 1062 ((int*)entry->mask)[j] =
1075 ntohl(((int*)entry->mask)[j]); 1063 eina_ntohl(((int*)entry->mask)[j]);
1076 } 1064 }
1077 } 1065 }
1078 } 1066 }
diff --git a/src/lib/eina/eina_config.h.in b/src/lib/eina/eina_config.h.in
index dca465d704..c040cc5341 100644
--- a/src/lib/eina/eina_config.h.in
+++ b/src/lib/eina/eina_config.h.in
@@ -122,6 +122,15 @@
122#endif 122#endif
123@EINA_CONFIGURE_HAVE_OSX_SEMAPHORE@ 123@EINA_CONFIGURE_HAVE_OSX_SEMAPHORE@
124 124
125#ifndef EINA_HAVE_WORDS_BIGENDIAN
126# undef EINA_HAVE_WORDS_BIGENDIAN
127#endif
128@EINA_CONFIGURE_HAVE_WORDS_BIGENDIAN@
129
130#if ((defined __APPLE_CC__) && (defined __BIG_ENDIAN__)) || (defined EINA_HAVE_WORDS_BIGENDIAN)
131# define EINA_HAVE_BIGENDIAN
132#endif
133
125#include <limits.h> 134#include <limits.h>
126 135
127#endif /* EINA_CONFIG_H_ */ 136#endif /* EINA_CONFIG_H_ */
diff --git a/src/lib/eina/eina_cpu.h b/src/lib/eina/eina_cpu.h
index 6426017be6..35172a7a3b 100644
--- a/src/lib/eina/eina_cpu.h
+++ b/src/lib/eina/eina_cpu.h
@@ -116,13 +116,25 @@ static inline unsigned int eina_swap32(unsigned int x);
116 * @brief Reverses the byte order of a 64-bit (destination) register. 116 * @brief Reverses the byte order of a 64-bit (destination) register.
117 * 117 *
118 * @param[in] x The binary word to swap 118 * @param[in] x The binary word to swap
119 * @return A byte order swapped 64-bit integer. 119 * @return A byte order swapped 64-bit integer.
120 * 120 *
121 * On big endian systems, the number is converted to little endian byte order. 121 * On big endian systems, the number is converted to little endian byte order.
122 * On little endian systems, the number is converted to big endian byte order. 122 * On little endian systems, the number is converted to big endian byte order.
123 */ 123 */
124static inline unsigned long long eina_swap64(unsigned long long x); 124static inline unsigned long long eina_swap64(unsigned long long x);
125 125
126static inline unsigned short eina_htons(unsigned short host);
127
128static inline unsigned int eina_htonl(unsigned int host);
129
130static inline unsigned long long eina_htonll(unsigned long long host);
131
132static inline unsigned short eina_ntohs(unsigned short net);
133
134static inline unsigned int eina_ntohl(unsigned int net);
135
136static inline unsigned long long eina_ntohll(unsigned long long net);
137
126#ifndef MIN 138#ifndef MIN
127# define MIN(x, y) (((x) > (y)) ? (y) : (x)) 139# define MIN(x, y) (((x) > (y)) ? (y) : (x))
128#endif 140#endif
diff --git a/src/lib/eina/eina_debug.c b/src/lib/eina/eina_debug.c
index 7ec64e7b69..c29e2f3db9 100644
--- a/src/lib/eina/eina_debug.c
+++ b/src/lib/eina/eina_debug.c
@@ -477,7 +477,7 @@ eina_debug_remote_connect(int port)
477 //Prepare the sockaddr_in structure 477 //Prepare the sockaddr_in structure
478 server.sin_family = AF_INET; 478 server.sin_family = AF_INET;
479 if (inet_pton(AF_INET, "127.0.0.1", &server.sin_addr.s_addr) != 1) goto err; 479 if (inet_pton(AF_INET, "127.0.0.1", &server.sin_addr.s_addr) != 1) goto err;
480 server.sin_port = htons(port); 480 server.sin_port = eina_htons(port);
481 481
482 if (connect(fd, (struct sockaddr *)&server, sizeof(server)) < 0) 482 if (connect(fd, (struct sockaddr *)&server, sizeof(server)) < 0)
483 { 483 {
diff --git a/src/lib/eina/eina_inline_cpu.x b/src/lib/eina/eina_inline_cpu.x
index 17d5cd01be..d26bdcce7c 100644
--- a/src/lib/eina/eina_inline_cpu.x
+++ b/src/lib/eina/eina_inline_cpu.x
@@ -88,7 +88,64 @@ eina_swap64(unsigned long long x)
88#endif 88#endif
89} 89}
90 90
91static inline unsigned short
92eina_htons(unsigned short host)
93{
94#ifdef EINA_HAVE_BIGENDIAN
95 return host;
96#else
97 return eina_swap16(host);
98#endif
99}
91 100
101static inline unsigned int
102eina_htonl(unsigned int host)
103{
104#ifdef EINA_HAVE_BIGENDIAN
105 return host;
106#else
107 return eina_swap32(host);
108#endif
109}
92 110
111static inline unsigned long long
112eina_htonll(unsigned long long host)
113{
114#ifdef EINA_HAVE_BIGENDIAN
115 return host;
116#else
117 return eina_swap64(host);
93#endif 118#endif
119}
94 120
121static inline unsigned short
122eina_ntohs(unsigned short net)
123{
124#ifdef EINA_HAVE_BIGENDIAN
125 return net;
126#else
127 return eina_swap16(net);
128#endif
129}
130
131static inline unsigned int
132eina_ntohl(unsigned int net)
133{
134#ifdef EINA_HAVE_BIGENDIAN
135 return net;
136#else
137 return eina_swap32(net);
138#endif
139}
140
141static inline unsigned long long
142eina_ntohll(unsigned long long net)
143{
144#ifdef EINA_HAVE_BIGENDIAN
145 return net;
146#else
147 return eina_swap64(net);
148#endif
149}
150
151#endif
diff --git a/src/lib/eina/meson.build b/src/lib/eina/meson.build
index 245c9cd8fa..2599845c08 100644
--- a/src/lib/eina/meson.build
+++ b/src/lib/eina/meson.build
@@ -349,7 +349,10 @@ if sys_osx == true
349 if cc.has_header_symbol('mach/task.h', 'semaphore_create') 349 if cc.has_header_symbol('mach/task.h', 'semaphore_create')
350 eina_config.set('EINA_HAVE_OSX_SEMAPHORE', 1) 350 eina_config.set('EINA_HAVE_OSX_SEMAPHORE', 1)
351 endif 351 endif
352endif
352 353
354if host_machine.endian() == 'big'
355 eina_config.set('EINA_HAVE_WORDS_BIGENDIAN', '1')
353endif 356endif
354 357
355eina_config_file = configure_file( 358eina_config_file = configure_file(
diff --git a/src/lib/emile/emile_cipher_gnutls.c b/src/lib/emile/emile_cipher_gnutls.c
index 966859bdfd..92f41a57d2 100644
--- a/src/lib/emile/emile_cipher_gnutls.c
+++ b/src/lib/emile/emile_cipher_gnutls.c
@@ -2,10 +2,6 @@
2# include <config.h> 2# include <config.h>
3#endif 3#endif
4 4
5#ifdef HAVE_NETINET_IN_H
6# include <netinet/in.h>
7#endif
8
9#include <gnutls/abstract.h> 5#include <gnutls/abstract.h>
10#include <gnutls/x509.h> 6#include <gnutls/x509.h>
11#include <gcrypt.h> 7#include <gcrypt.h>
@@ -220,7 +216,7 @@ emile_binbuf_cipher(Emile_Cipher_Algorithm algo,
220 eina_binbuf_append_length(result, (unsigned char*) &salt, sizeof (salt)); 216 eina_binbuf_append_length(result, (unsigned char*) &salt, sizeof (salt));
221 memset(&salt, 0, sizeof (salt)); 217 memset(&salt, 0, sizeof (salt));
222 218
223 tmp = htonl(eina_binbuf_length_get(data)); 219 tmp = eina_htonl(eina_binbuf_length_get(data));
224 eina_binbuf_append_length(result, (unsigned char*) &tmp, sizeof (tmp)); 220 eina_binbuf_append_length(result, (unsigned char*) &tmp, sizeof (tmp));
225 eina_binbuf_append_buffer(result, data); 221 eina_binbuf_append_buffer(result, data);
226 222
@@ -350,7 +346,7 @@ emile_binbuf_decipher(Emile_Cipher_Algorithm algo,
350 346
351 /* Get the decrypted data size */ 347 /* Get the decrypted data size */
352 tmp = *(unsigned int*)(eina_binbuf_string_get(result)); 348 tmp = *(unsigned int*)(eina_binbuf_string_get(result));
353 tmp = ntohl(tmp); 349 tmp = eina_ntohl(tmp);
354 if (tmp > tmp_len || tmp <= 0) 350 if (tmp > tmp_len || tmp <= 0)
355 goto on_error; 351 goto on_error;
356 352
diff --git a/src/lib/emile/emile_cipher_openssl.c b/src/lib/emile/emile_cipher_openssl.c
index b5ca128a23..84b024465e 100644
--- a/src/lib/emile/emile_cipher_openssl.c
+++ b/src/lib/emile/emile_cipher_openssl.c
@@ -2,10 +2,6 @@
2# include <config.h> 2# include <config.h>
3#endif 3#endif
4 4
5#ifdef HAVE_NETINET_IN_H
6# include <netinet/in.h>
7#endif
8
9#include <openssl/sha.h> 5#include <openssl/sha.h>
10#include <openssl/evp.h> 6#include <openssl/evp.h>
11#include <openssl/hmac.h> 7#include <openssl/hmac.h>
@@ -149,7 +145,7 @@ emile_binbuf_cipher(Emile_Cipher_Algorithm algo,
149 eina_binbuf_append_length(result, (unsigned char*) &salt, sizeof (salt)); 145 eina_binbuf_append_length(result, (unsigned char*) &salt, sizeof (salt));
150 memset(&salt, 0, sizeof (salt)); 146 memset(&salt, 0, sizeof (salt));
151 147
152 tmp = htonl(eina_binbuf_length_get(data)); 148 tmp = eina_htonl(eina_binbuf_length_get(data));
153 buffer = malloc(crypted_length - sizeof (int)); 149 buffer = malloc(crypted_length - sizeof (int));
154 if (!buffer) goto on_error; 150 if (!buffer) goto on_error;
155 *buffer = tmp; 151 *buffer = tmp;
@@ -279,7 +275,7 @@ emile_binbuf_decipher(Emile_Cipher_Algorithm algo,
279 275
280 /* Get the decrypted data size */ 276 /* Get the decrypted data size */
281 tmp = *(unsigned int*)(eina_binbuf_string_get(result)); 277 tmp = *(unsigned int*)(eina_binbuf_string_get(result));
282 tmp = ntohl(tmp); 278 tmp = eina_ntohl(tmp);
283 if (tmp > tmp_len || tmp <= 0) 279 if (tmp > tmp_len || tmp <= 0)
284 goto on_error; 280 goto on_error;
285 281
diff --git a/src/lib/emile/emile_image.c b/src/lib/emile/emile_image.c
index 3432ccf9c5..4f6e11905e 100644
--- a/src/lib/emile/emile_image.c
+++ b/src/lib/emile/emile_image.c
@@ -2,17 +2,6 @@
2#include <config.h> 2#include <config.h>
3#endif 3#endif
4 4
5#ifdef HAVE_NETINET_IN_H
6#include <netinet/in.h>
7#endif
8
9#ifdef _WIN32
10#include <winsock2.h>
11#include <Evil.h>
12#define HAVE_BOOLEAN /* This prevents libjpeg to redefine boolean */
13#define XMD_H /* This prevents libjpeg to redefine INT32 */
14#endif
15
16#ifdef ENABLE_LIBLZ4 5#ifdef ENABLE_LIBLZ4
17#include <lz4.h> 6#include <lz4.h>
18#else 7#else
@@ -337,8 +326,8 @@ _emile_tgv_head(Emile_Image *image,
337 image->compress = m[OFFSET_OPTIONS] & 0x1; 326 image->compress = m[OFFSET_OPTIONS] & 0x1;
338 image->blockless = (m[OFFSET_OPTIONS] & 0x2) != 0; 327 image->blockless = (m[OFFSET_OPTIONS] & 0x2) != 0;
339 328
340 image->size.width = ntohl(*((unsigned int *)&(m[OFFSET_WIDTH]))); 329 image->size.width = eina_ntohl(*((unsigned int *)&(m[OFFSET_WIDTH])));
341 image->size.height = ntohl(*((unsigned int *)&(m[OFFSET_HEIGHT]))); 330 image->size.height = eina_ntohl(*((unsigned int *)&(m[OFFSET_HEIGHT])));
342 331
343 if (image->blockless) 332 if (image->blockless)
344 { 333 {
diff --git a/src/modules/evas/image_savers/tgv/evas_image_save_tgv.c b/src/modules/evas/image_savers/tgv/evas_image_save_tgv.c
index 9fee4de364..fe4d97ba21 100644
--- a/src/modules/evas/image_savers/tgv/evas_image_save_tgv.c
+++ b/src/modules/evas/image_savers/tgv/evas_image_save_tgv.c
@@ -1,14 +1,6 @@
1#include "evas_common_private.h" 1#include "evas_common_private.h"
2#include "evas_private.h" 2#include "evas_private.h"
3 3
4#ifdef HAVE_NETINET_IN_H
5# include <netinet/in.h>
6#endif
7
8#ifdef _WIN32
9# include <winsock2.h>
10#endif /* ifdef _WIN32 */
11
12#ifdef ENABLE_LIBLZ4 4#ifdef ENABLE_LIBLZ4
13# include <lz4.h> 5# include <lz4.h>
14# include <lz4hc.h> 6# include <lz4hc.h>
@@ -70,8 +62,8 @@ _save_direct_tgv(RGBA_Image *im, const char *file, int compress)
70 image_width = im->cache_entry.w + im->cache_entry.borders.l + im->cache_entry.borders.r; 62 image_width = im->cache_entry.w + im->cache_entry.borders.l + im->cache_entry.borders.r;
71 image_height = im->cache_entry.h + im->cache_entry.borders.t + im->cache_entry.borders.b; 63 image_height = im->cache_entry.h + im->cache_entry.borders.t + im->cache_entry.borders.b;
72 data = im->image.data8; 64 data = im->image.data8;
73 width = htonl(image_width); 65 width = eina_htonl(image_width);
74 height = htonl(image_height); 66 height = eina_htonl(image_height);
75 compress = !!compress; 67 compress = !!compress;
76 68
77 if ((image_width & 0x3) || (image_height & 0x3)) 69 if ((image_width & 0x3) || (image_height & 0x3))
@@ -219,8 +211,8 @@ evas_image_save_file_tgv(RGBA_Image *im,
219 211
220 image_stride = im->cache_entry.w; 212 image_stride = im->cache_entry.w;
221 image_height = im->cache_entry.h; 213 image_height = im->cache_entry.h;
222 nl_width = htonl(image_stride); 214 nl_width = eina_htonl(image_stride);
223 nl_height = htonl(image_height); 215 nl_height = eina_htonl(image_height);
224 compress = !!compress; 216 compress = !!compress;
225 217
226 // Disable dithering, as it will deteriorate the quality of flat surfaces 218 // Disable dithering, as it will deteriorate the quality of flat surfaces
diff --git a/src/tests/ecore_con/ecore_con_test_efl_net_ip_address.c b/src/tests/ecore_con/ecore_con_test_efl_net_ip_address.c
index 5551508288..1a150ffd5c 100644
--- a/src/tests/ecore_con/ecore_con_test_efl_net_ip_address.c
+++ b/src/tests/ecore_con/ecore_con_test_efl_net_ip_address.c
@@ -5,7 +5,7 @@
5#include <stdio.h> 5#include <stdio.h>
6 6
7#ifdef HAVE_SYS_SOCKET_H 7#ifdef HAVE_SYS_SOCKET_H
8#include <sys/socket.h> 8# include <sys/socket.h>
9#endif 9#endif
10 10
11#include <Ecore.h> 11#include <Ecore.h>
@@ -256,7 +256,7 @@ _ipv4_check(Eo *o, const struct sockaddr_in *addr)
256 ck_assert_ptr_ne(o, NULL); 256 ck_assert_ptr_ne(o, NULL);
257 257
258 ck_assert_int_eq(efl_net_ip_address_family_get(o), AF_INET); 258 ck_assert_int_eq(efl_net_ip_address_family_get(o), AF_INET);
259 ck_assert_int_eq(efl_net_ip_address_port_get(o), ntohs(addr->sin_port)); 259 ck_assert_int_eq(efl_net_ip_address_port_get(o), eina_ntohs(addr->sin_port));
260 260
261 rs = efl_net_ip_address_get(o); 261 rs = efl_net_ip_address_get(o);
262 ck_assert_int_eq(eina_slice_compare(rs, slice), 0); 262 ck_assert_int_eq(eina_slice_compare(rs, slice), 0);
@@ -266,7 +266,7 @@ _ipv4_check(Eo *o, const struct sockaddr_in *addr)
266 if (addr->sin_port) 266 if (addr->sin_port)
267 { 267 {
268 snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), 268 snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),
269 ":%hu", htons(addr->sin_port)); 269 ":%hu", eina_htons(addr->sin_port));
270 } 270 }
271 ck_assert_ptr_ne(efl_net_ip_address_string_get(o), NULL); 271 ck_assert_ptr_ne(efl_net_ip_address_string_get(o), NULL);
272 ck_assert_str_eq(efl_net_ip_address_string_get(o), buf); 272 ck_assert_str_eq(efl_net_ip_address_string_get(o), buf);
@@ -280,26 +280,26 @@ EFL_START_TEST(ecore_test_efl_net_ip_address_ipv4_manual_ok)
280 Eina_Slice slice = { .mem = &addr.sin_addr, .len = sizeof(addr.sin_addr) }; 280 Eina_Slice slice = { .mem = &addr.sin_addr, .len = sizeof(addr.sin_addr) };
281 Eo *o; 281 Eo *o;
282 282
283 addr.sin_port = htons(12345); 283 addr.sin_port = eina_htons(12345);
284 addr.sin_addr.s_addr = htonl(0xabcdefafU); 284 addr.sin_addr.s_addr = eina_htonl(0xabcdefafU);
285 o = efl_add_ref(EFL_NET_IP_ADDRESS_CLASS, NULL, 285 o = efl_add_ref(EFL_NET_IP_ADDRESS_CLASS, NULL,
286 efl_net_ip_address_family_set(efl_added, AF_INET), 286 efl_net_ip_address_family_set(efl_added, AF_INET),
287 efl_net_ip_address_port_set(efl_added, ntohs(addr.sin_port)), 287 efl_net_ip_address_port_set(efl_added, eina_ntohs(addr.sin_port)),
288 efl_net_ip_address_set(efl_added, slice)); 288 efl_net_ip_address_set(efl_added, slice));
289 _ipv4_check(o, &addr); 289 _ipv4_check(o, &addr);
290 efl_unref(o); 290 efl_unref(o);
291 291
292 addr.sin_port = htons(8081); 292 addr.sin_port = eina_htons(8081);
293 addr.sin_addr.s_addr = htonl(0); 293 addr.sin_addr.s_addr = eina_htonl(0);
294 o = efl_add_ref(EFL_NET_IP_ADDRESS_CLASS, NULL, 294 o = efl_add_ref(EFL_NET_IP_ADDRESS_CLASS, NULL,
295 efl_net_ip_address_family_set(efl_added, AF_INET), 295 efl_net_ip_address_family_set(efl_added, AF_INET),
296 efl_net_ip_address_port_set(efl_added, ntohs(addr.sin_port)), 296 efl_net_ip_address_port_set(efl_added, eina_ntohs(addr.sin_port)),
297 efl_net_ip_address_set(efl_added, slice)); 297 efl_net_ip_address_set(efl_added, slice));
298 _ipv4_check(o, &addr); 298 _ipv4_check(o, &addr);
299 efl_unref(o); 299 efl_unref(o);
300 300
301 addr.sin_port = htons(0); 301 addr.sin_port = eina_htons(0);
302 addr.sin_addr.s_addr = htonl(0x12345678); 302 addr.sin_addr.s_addr = eina_htonl(0x12345678);
303 o = efl_add_ref(EFL_NET_IP_ADDRESS_CLASS, NULL, 303 o = efl_add_ref(EFL_NET_IP_ADDRESS_CLASS, NULL,
304 efl_net_ip_address_family_set(efl_added, AF_INET), 304 efl_net_ip_address_family_set(efl_added, AF_INET),
305 efl_net_ip_address_set(efl_added, slice)); 305 efl_net_ip_address_set(efl_added, slice));
@@ -356,16 +356,16 @@ EFL_START_TEST(ecore_test_efl_net_ip_address_ipv4_manual_fail)
356 efl_unref(o); 356 efl_unref(o);
357 TRAP_ERRORS_FINISH(1); 357 TRAP_ERRORS_FINISH(1);
358 358
359 addr.sin_port = htons(12345); 359 addr.sin_port = eina_htons(12345);
360 addr.sin_addr.s_addr = htonl(0xabcdefafU); 360 addr.sin_addr.s_addr = eina_htonl(0xabcdefafU);
361 o = efl_add_ref(EFL_NET_IP_ADDRESS_CLASS, NULL, 361 o = efl_add_ref(EFL_NET_IP_ADDRESS_CLASS, NULL,
362 efl_net_ip_address_family_set(efl_added, AF_INET), 362 efl_net_ip_address_family_set(efl_added, AF_INET),
363 efl_net_ip_address_port_set(efl_added, ntohs(addr.sin_port)), 363 efl_net_ip_address_port_set(efl_added, eina_ntohs(addr.sin_port)),
364 efl_net_ip_address_set(efl_added, slice)); 364 efl_net_ip_address_set(efl_added, slice));
365 _ipv4_check(o, &addr); 365 _ipv4_check(o, &addr);
366 366
367 TRAP_ERRORS_BEGIN(ecore_con, ERR, "port already set to %hu, new %hu"); 367 TRAP_ERRORS_BEGIN(ecore_con, ERR, "port already set to %hu, new %hu");
368 efl_net_ip_address_port_set(o, ntohs(addr.sin_port)); 368 efl_net_ip_address_port_set(o, eina_ntohs(addr.sin_port));
369 TRAP_ERRORS_FINISH(0); 369 TRAP_ERRORS_FINISH(0);
370 370
371 TRAP_ERRORS_BEGIN(ecore_con, ERR, "port already set to %hu, new %hu"); 371 TRAP_ERRORS_BEGIN(ecore_con, ERR, "port already set to %hu, new %hu");
@@ -383,7 +383,7 @@ EFL_START_TEST(ecore_test_efl_net_ip_address_ipv4_manual_fail)
383 TRAP_ERRORS_FINISH(0); 383 TRAP_ERRORS_FINISH(0);
384 384
385 TRAP_ERRORS_BEGIN(ecore_con, ERR, "address already set to %s, new %s"); 385 TRAP_ERRORS_BEGIN(ecore_con, ERR, "address already set to %s, new %s");
386 addr.sin_addr.s_addr = htonl(0x12345678); 386 addr.sin_addr.s_addr = eina_htonl(0x12345678);
387 slice.len = sizeof(addr.sin_addr.s_addr); 387 slice.len = sizeof(addr.sin_addr.s_addr);
388 efl_net_ip_address_set(o, slice); 388 efl_net_ip_address_set(o, slice);
389 TRAP_ERRORS_FINISH(1); 389 TRAP_ERRORS_FINISH(1);
@@ -400,26 +400,26 @@ EFL_START_TEST(ecore_test_efl_net_ip_address_ipv4_create_ok)
400 Eina_Slice slice = { .mem = &addr.sin_addr, .len = sizeof(addr.sin_addr) }; 400 Eina_Slice slice = { .mem = &addr.sin_addr, .len = sizeof(addr.sin_addr) };
401 Eo *o; 401 Eo *o;
402 402
403 addr.sin_port = htons(12345); 403 addr.sin_port = eina_htons(12345);
404 addr.sin_addr.s_addr = htonl(0xabcdefafU); 404 addr.sin_addr.s_addr = eina_htonl(0xabcdefafU);
405 o = efl_net_ip_address_create(EFL_NET_IP_ADDRESS_CLASS, 405 o = efl_net_ip_address_create(EFL_NET_IP_ADDRESS_CLASS,
406 ntohs(addr.sin_port), 406 eina_ntohs(addr.sin_port),
407 slice); 407 slice);
408 _ipv4_check(o, &addr); 408 _ipv4_check(o, &addr);
409 efl_unref(o); 409 efl_unref(o);
410 410
411 addr.sin_port = htons(8081); 411 addr.sin_port = eina_htons(8081);
412 addr.sin_addr.s_addr = htonl(0); 412 addr.sin_addr.s_addr = eina_htonl(0);
413 o = efl_net_ip_address_create(EFL_NET_IP_ADDRESS_CLASS, 413 o = efl_net_ip_address_create(EFL_NET_IP_ADDRESS_CLASS,
414 ntohs(addr.sin_port), 414 eina_ntohs(addr.sin_port),
415 slice); 415 slice);
416 _ipv4_check(o, &addr); 416 _ipv4_check(o, &addr);
417 efl_unref(o); 417 efl_unref(o);
418 418
419 addr.sin_port = htons(0); 419 addr.sin_port = eina_htons(0);
420 addr.sin_addr.s_addr = htonl(0x12345678); 420 addr.sin_addr.s_addr = eina_htonl(0x12345678);
421 o = efl_net_ip_address_create(EFL_NET_IP_ADDRESS_CLASS, 421 o = efl_net_ip_address_create(EFL_NET_IP_ADDRESS_CLASS,
422 ntohs(addr.sin_port), 422 eina_ntohs(addr.sin_port),
423 slice); 423 slice);
424 _ipv4_check(o, &addr); 424 _ipv4_check(o, &addr);
425 efl_unref(o); 425 efl_unref(o);
@@ -450,15 +450,15 @@ EFL_START_TEST(ecore_test_efl_net_ip_address_ipv4_create_sockaddr_ok)
450 }; 450 };
451 Eo *o; 451 Eo *o;
452 452
453 addr.sin_port = htons(12345); 453 addr.sin_port = eina_htons(12345);
454 addr.sin_addr.s_addr = htonl(0xabcdefafU); 454 addr.sin_addr.s_addr = eina_htonl(0xabcdefafU);
455 o = efl_net_ip_address_create_sockaddr(EFL_NET_IP_ADDRESS_CLASS, &addr); 455 o = efl_net_ip_address_create_sockaddr(EFL_NET_IP_ADDRESS_CLASS, &addr);
456 ck_assert_ptr_ne(&addr, efl_net_ip_address_sockaddr_get(o)); 456 ck_assert_ptr_ne(&addr, efl_net_ip_address_sockaddr_get(o));
457 _ipv4_check(o, &addr); 457 _ipv4_check(o, &addr);
458 efl_unref(o); 458 efl_unref(o);
459 459
460 addr.sin_port = htons(0); 460 addr.sin_port = eina_htons(0);
461 addr.sin_addr.s_addr = htonl(0); 461 addr.sin_addr.s_addr = eina_htonl(0);
462 o = efl_net_ip_address_create_sockaddr(EFL_NET_IP_ADDRESS_CLASS, &addr); 462 o = efl_net_ip_address_create_sockaddr(EFL_NET_IP_ADDRESS_CLASS, &addr);
463 ck_assert_ptr_ne(&addr, efl_net_ip_address_sockaddr_get(o)); 463 ck_assert_ptr_ne(&addr, efl_net_ip_address_sockaddr_get(o));
464 _ipv4_check(o, &addr); 464 _ipv4_check(o, &addr);
@@ -641,7 +641,7 @@ EFL_START_TEST(ecore_test_efl_net_ip_address_ipv4_checks)
641 struct sockaddr_in a = { 641 struct sockaddr_in a = {
642 .sin_family = AF_INET, 642 .sin_family = AF_INET,
643 .sin_port = 0, 643 .sin_port = 0,
644 .sin_addr.s_addr = htonl(itr->addr), 644 .sin_addr.s_addr = eina_htonl(itr->addr),
645 }; 645 };
646 Eo *o = efl_net_ip_address_create_sockaddr(EFL_NET_IP_ADDRESS_CLASS, &a); 646 Eo *o = efl_net_ip_address_create_sockaddr(EFL_NET_IP_ADDRESS_CLASS, &a);
647 ck_assert_ptr_ne(o, NULL); 647 ck_assert_ptr_ne(o, NULL);
@@ -677,7 +677,7 @@ _ipv6_check(Eo *o, const struct sockaddr_in6 *addr)
677 ck_assert_ptr_ne(o, NULL); 677 ck_assert_ptr_ne(o, NULL);
678 678
679 ck_assert_int_eq(efl_net_ip_address_family_get(o), AF_INET6); 679 ck_assert_int_eq(efl_net_ip_address_family_get(o), AF_INET6);
680 ck_assert_int_eq(efl_net_ip_address_port_get(o), ntohs(addr->sin6_port)); 680 ck_assert_int_eq(efl_net_ip_address_port_get(o), eina_ntohs(addr->sin6_port));
681 681
682 rs = efl_net_ip_address_get(o); 682 rs = efl_net_ip_address_get(o);
683 ck_assert_int_eq(eina_slice_compare(rs, slice), 0); 683 ck_assert_int_eq(eina_slice_compare(rs, slice), 0);
@@ -689,7 +689,7 @@ _ipv6_check(Eo *o, const struct sockaddr_in6 *addr)
689 if (addr->sin6_port) 689 if (addr->sin6_port)
690 { 690 {
691 snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), 691 snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),
692 ":%hu", htons(addr->sin6_port)); 692 ":%hu", eina_htons(addr->sin6_port));
693 } 693 }
694 694
695 ck_assert_ptr_ne(efl_net_ip_address_string_get(o), NULL); 695 ck_assert_ptr_ne(efl_net_ip_address_string_get(o), NULL);
@@ -711,20 +711,20 @@ EFL_START_TEST(ecore_test_efl_net_ip_address_ipv6_manual_ok)
711 Eina_Slice slice = { .mem = &addr.sin6_addr, .len = sizeof(addr.sin6_addr) }; 711 Eina_Slice slice = { .mem = &addr.sin6_addr, .len = sizeof(addr.sin6_addr) };
712 Eo *o; 712 Eo *o;
713 713
714 addr.sin6_port = htons(12345); 714 addr.sin6_port = eina_htons(12345);
715 _ipv6_set(&addr, 1, 2, 3, 4, 5, 6, 7, 8); 715 _ipv6_set(&addr, 1, 2, 3, 4, 5, 6, 7, 8);
716 o = efl_add_ref(EFL_NET_IP_ADDRESS_CLASS, NULL, 716 o = efl_add_ref(EFL_NET_IP_ADDRESS_CLASS, NULL,
717 efl_net_ip_address_family_set(efl_added, AF_INET6), 717 efl_net_ip_address_family_set(efl_added, AF_INET6),
718 efl_net_ip_address_port_set(efl_added, ntohs(addr.sin6_port)), 718 efl_net_ip_address_port_set(efl_added, eina_ntohs(addr.sin6_port)),
719 efl_net_ip_address_set(efl_added, slice)); 719 efl_net_ip_address_set(efl_added, slice));
720 _ipv6_check(o, &addr); 720 _ipv6_check(o, &addr);
721 efl_unref(o); 721 efl_unref(o);
722 722
723 addr.sin6_port = htons(8081); 723 addr.sin6_port = eina_htons(8081);
724 _ipv6_set(&addr, 0, 0, 0, 0, 0, 0, 0, 0); 724 _ipv6_set(&addr, 0, 0, 0, 0, 0, 0, 0, 0);
725 o = efl_add_ref(EFL_NET_IP_ADDRESS_CLASS, NULL, 725 o = efl_add_ref(EFL_NET_IP_ADDRESS_CLASS, NULL,
726 efl_net_ip_address_family_set(efl_added, AF_INET6), 726 efl_net_ip_address_family_set(efl_added, AF_INET6),
727 efl_net_ip_address_port_set(efl_added, ntohs(addr.sin6_port)), 727 efl_net_ip_address_port_set(efl_added, eina_ntohs(addr.sin6_port)),
728 efl_net_ip_address_set(efl_added, slice)); 728 efl_net_ip_address_set(efl_added, slice));
729 _ipv6_check(o, &addr); 729 _ipv6_check(o, &addr);
730 efl_unref(o); 730 efl_unref(o);
@@ -752,16 +752,16 @@ EFL_START_TEST(ecore_test_efl_net_ip_address_ipv6_manual_fail)
752 efl_unref(o); 752 efl_unref(o);
753 TRAP_ERRORS_FINISH(1); 753 TRAP_ERRORS_FINISH(1);
754 754
755 addr.sin6_port = htons(12345); 755 addr.sin6_port = eina_htons(12345);
756 _ipv6_set(&addr, 0, 0, 0, 0, 0, 0, 0, 1); 756 _ipv6_set(&addr, 0, 0, 0, 0, 0, 0, 0, 1);
757 o = efl_add_ref(EFL_NET_IP_ADDRESS_CLASS, NULL, 757 o = efl_add_ref(EFL_NET_IP_ADDRESS_CLASS, NULL,
758 efl_net_ip_address_family_set(efl_added, AF_INET6), 758 efl_net_ip_address_family_set(efl_added, AF_INET6),
759 efl_net_ip_address_port_set(efl_added, ntohs(addr.sin6_port)), 759 efl_net_ip_address_port_set(efl_added, eina_ntohs(addr.sin6_port)),
760 efl_net_ip_address_set(efl_added, slice)); 760 efl_net_ip_address_set(efl_added, slice));
761 _ipv6_check(o, &addr); 761 _ipv6_check(o, &addr);
762 762
763 TRAP_ERRORS_BEGIN(ecore_con, ERR, "port already set to %hu, new %hu"); 763 TRAP_ERRORS_BEGIN(ecore_con, ERR, "port already set to %hu, new %hu");
764 efl_net_ip_address_port_set(o, ntohs(addr.sin6_port)); 764 efl_net_ip_address_port_set(o, eina_ntohs(addr.sin6_port));
765 TRAP_ERRORS_FINISH(0); 765 TRAP_ERRORS_FINISH(0);
766 766
767 TRAP_ERRORS_BEGIN(ecore_con, ERR, "port already set to %hu, new %hu"); 767 TRAP_ERRORS_BEGIN(ecore_con, ERR, "port already set to %hu, new %hu");
@@ -797,26 +797,26 @@ EFL_START_TEST(ecore_test_efl_net_ip_address_ipv6_create_ok)
797 Eina_Slice slice = { .mem = &addr.sin6_addr, .len = sizeof(addr.sin6_addr) }; 797 Eina_Slice slice = { .mem = &addr.sin6_addr, .len = sizeof(addr.sin6_addr) };
798 Eo *o; 798 Eo *o;
799 799
800 addr.sin6_port = htons(12365); 800 addr.sin6_port = eina_htons(12365);
801 _ipv6_set(&addr, 1, 2, 3, 4, 5, 6, 7, 8); 801 _ipv6_set(&addr, 1, 2, 3, 4, 5, 6, 7, 8);
802 o = efl_net_ip_address_create(EFL_NET_IP_ADDRESS_CLASS, 802 o = efl_net_ip_address_create(EFL_NET_IP_ADDRESS_CLASS,
803 ntohs(addr.sin6_port), 803 eina_ntohs(addr.sin6_port),
804 slice); 804 slice);
805 _ipv6_check(o, &addr); 805 _ipv6_check(o, &addr);
806 efl_unref(o); 806 efl_unref(o);
807 807
808 addr.sin6_port = htons(8081); 808 addr.sin6_port = eina_htons(8081);
809 _ipv6_set(&addr, 0, 0, 0, 0, 0, 0, 0, 0); 809 _ipv6_set(&addr, 0, 0, 0, 0, 0, 0, 0, 0);
810 o = efl_net_ip_address_create(EFL_NET_IP_ADDRESS_CLASS, 810 o = efl_net_ip_address_create(EFL_NET_IP_ADDRESS_CLASS,
811 ntohs(addr.sin6_port), 811 eina_ntohs(addr.sin6_port),
812 slice); 812 slice);
813 _ipv6_check(o, &addr); 813 _ipv6_check(o, &addr);
814 efl_unref(o); 814 efl_unref(o);
815 815
816 addr.sin6_port = htons(0); 816 addr.sin6_port = eina_htons(0);
817 _ipv6_set(&addr, 0, 0, 0, 0, 0, 0, 0, 1); 817 _ipv6_set(&addr, 0, 0, 0, 0, 0, 0, 0, 1);
818 o = efl_net_ip_address_create(EFL_NET_IP_ADDRESS_CLASS, 818 o = efl_net_ip_address_create(EFL_NET_IP_ADDRESS_CLASS,
819 ntohs(addr.sin6_port), 819 eina_ntohs(addr.sin6_port),
820 slice); 820 slice);
821 _ipv6_check(o, &addr); 821 _ipv6_check(o, &addr);
822 efl_unref(o); 822 efl_unref(o);
@@ -831,14 +831,14 @@ EFL_START_TEST(ecore_test_efl_net_ip_address_ipv6_create_sockaddr_ok)
831 }; 831 };
832 Eo *o; 832 Eo *o;
833 833
834 addr.sin6_port = htons(12345); 834 addr.sin6_port = eina_htons(12345);
835 _ipv6_set(&addr, 1, 2, 3, 4, 5, 6, 7, 8); 835 _ipv6_set(&addr, 1, 2, 3, 4, 5, 6, 7, 8);
836 o = efl_net_ip_address_create_sockaddr(EFL_NET_IP_ADDRESS_CLASS, &addr); 836 o = efl_net_ip_address_create_sockaddr(EFL_NET_IP_ADDRESS_CLASS, &addr);
837 ck_assert_ptr_ne(&addr, efl_net_ip_address_sockaddr_get(o)); 837 ck_assert_ptr_ne(&addr, efl_net_ip_address_sockaddr_get(o));
838 _ipv6_check(o, &addr); 838 _ipv6_check(o, &addr);
839 efl_unref(o); 839 efl_unref(o);
840 840
841 addr.sin6_port = htons(0); 841 addr.sin6_port = eina_htons(0);
842 _ipv6_set(&addr, 0, 0, 0, 0, 0, 0, 0, 0); 842 _ipv6_set(&addr, 0, 0, 0, 0, 0, 0, 0, 0);
843 o = efl_net_ip_address_create_sockaddr(EFL_NET_IP_ADDRESS_CLASS, &addr); 843 o = efl_net_ip_address_create_sockaddr(EFL_NET_IP_ADDRESS_CLASS, &addr);
844 ck_assert_ptr_ne(&addr, efl_net_ip_address_sockaddr_get(o)); 844 ck_assert_ptr_ne(&addr, efl_net_ip_address_sockaddr_get(o));