summaryrefslogtreecommitdiff
path: root/src/lib/ecore_con
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 /src/lib/ecore_con
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
Diffstat (limited to 'src/lib/ecore_con')
-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
5 files changed, 20 insertions, 24 deletions
diff --git a/src/lib/ecore_con/ecore_con.c b/src/lib/ecore_con/ecore_con.c
index d8dbd37..5a305d0 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 e5d07d5..fd7c547 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 351d077..953ae7d 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 46fe75b..9a79c07 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 487fb7a..29b66f3 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) ||