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
This commit is contained in:
parent
36286a23fe
commit
f7c560c311
|
@ -1117,6 +1117,7 @@ EINA_CONFIG([HAVE_DEBUG_THREADS], [test "x${want_debug_threads}" = "xyes"])
|
|||
EINA_CONFIG([HAVE_POSIX_SPINLOCK], [test "x${efl_have_posix_threads_spinlock}" = "xyes"])
|
||||
EINA_CONFIG([HAVE_OSX_SPINLOCK], [test "x${efl_have_osx_spinlock}" = "xyes"])
|
||||
EINA_CONFIG([HAVE_OSX_SEMAPHORE], [test "x${have_darwin}" = "xyes"])
|
||||
EINA_CONFIG([HAVE_WORDS_BIGENDIAN], [test "x${ac_cv_c_bigendian}" = "xyes"])
|
||||
|
||||
### Modules
|
||||
|
||||
|
|
|
@ -9,15 +9,9 @@
|
|||
#ifdef HAVE_NETINET_TCP_H
|
||||
# include <netinet/tcp.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
# include <netinet/in.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
# include <sys/socket.h>
|
||||
#endif
|
||||
#ifdef HAVE_ARPA_INET_H
|
||||
# include <arpa/inet.h>
|
||||
#endif
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <gnutls/gnutls.h>
|
||||
|
@ -108,7 +102,7 @@ tcp_connect(void)
|
|||
|
||||
memset(&sa, '\0', sizeof (sa));
|
||||
sa.sin_family = AF_INET;
|
||||
sa.sin_port = htons(atoi(PORT));
|
||||
sa.sin_port = eina_htons(atoi(PORT));
|
||||
inet_pton(AF_INET, SERVER, &sa.sin_addr);
|
||||
|
||||
/* connects to server
|
||||
|
|
|
@ -43,13 +43,13 @@ _print_ip_addr_info(const Eo *o)
|
|||
{
|
||||
struct sockaddr_in *a = (struct sockaddr_in *)sa;
|
||||
inet_ntop(sa->sa_family, &a->sin_addr, buf, sizeof(buf));
|
||||
port = ntohs(a->sin_port);
|
||||
port = eina_ntohs(a->sin_port);
|
||||
}
|
||||
else
|
||||
{
|
||||
struct sockaddr_in6 *a = (struct sockaddr_in6 *)sa;
|
||||
inet_ntop(sa->sa_family, &a->sin6_addr, buf, sizeof(buf));
|
||||
port = ntohs(a->sin6_port);
|
||||
port = eina_ntohs(a->sin6_port);
|
||||
}
|
||||
|
||||
printf("INFO: - sockaddr=%p (%d, '%s', %u)\n",
|
||||
|
|
|
@ -11,10 +11,6 @@
|
|||
#include "shmfile.h"
|
||||
#include "timeout.h"
|
||||
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
# include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
@ -142,7 +138,7 @@ read_raw_data()
|
|||
if (image->colors != 3)
|
||||
goto clean_image;
|
||||
#define SWAP(a, b) { a ^= b; a = (b ^=a); }
|
||||
if ((image->bits == 16) && (htons(0x55aa) != 0x55aa))
|
||||
if ((image->bits == 16) && (eina_htons(0x55aa) != 0x55aa))
|
||||
for (count = 0; count < image->data_size; count +=2)
|
||||
SWAP(image->data[count], image->data[count + 1]);
|
||||
#undef SWAP
|
||||
|
|
|
@ -45,14 +45,11 @@
|
|||
Ok, hope this helps with understanding XCF. -- cK.
|
||||
|
||||
*/
|
||||
#include <Eina.h>
|
||||
#include "common.h"
|
||||
#include "shmfile.h"
|
||||
#include "timeout.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
# include <winsock2.h> /* for ntohl() */
|
||||
#endif
|
||||
|
||||
#define FREE(X) { free(X); X = NULL; }
|
||||
|
||||
#define TILE_WIDTH 64
|
||||
|
@ -479,7 +476,7 @@ xcf_read_int32(void *fp,
|
|||
xcf_read_int8(fp, (DATA8*) data, count * 4);
|
||||
while (count--)
|
||||
{
|
||||
*data = (DATA32)ntohl(*data);
|
||||
*data = (DATA32)eina_ntohl(*data);
|
||||
data++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,5 +4,5 @@ generic_src = files([
|
|||
'pixelfuncs.c'
|
||||
])
|
||||
|
||||
generic_deps = [dependency('zlib')]
|
||||
generic_deps = [eina, dependency('zlib')]
|
||||
generic_support = ['xcf.gz']
|
|
@ -288,13 +288,13 @@ efl_net_ip_port_parse_split(const char *host, const char *port, struct sockaddr_
|
|||
if (storage->ss_family == AF_INET6)
|
||||
{
|
||||
struct sockaddr_in6 *a = (struct sockaddr_in6 *)storage;
|
||||
a->sin6_port = htons(p);
|
||||
a->sin6_port = eina_htons(p);
|
||||
x = inet_pton(AF_INET6, host, &a->sin6_addr);
|
||||
}
|
||||
else
|
||||
{
|
||||
struct sockaddr_in *a = (struct sockaddr_in *)storage;
|
||||
a->sin_port = htons(p);
|
||||
a->sin_port = eina_htons(p);
|
||||
x = inet_pton(AF_INET, host, &a->sin_addr);
|
||||
}
|
||||
|
||||
|
@ -313,13 +313,13 @@ efl_net_ip_port_fmt(char *buf, size_t buflen, const struct sockaddr *addr)
|
|||
{
|
||||
const struct sockaddr_in *a = (const struct sockaddr_in *)addr;
|
||||
mem = &a->sin_addr;
|
||||
port = ntohs(a->sin_port);
|
||||
port = eina_ntohs(a->sin_port);
|
||||
}
|
||||
else if (addr->sa_family == AF_INET6)
|
||||
{
|
||||
const struct sockaddr_in6 *a = (const struct sockaddr_in6 *)addr;
|
||||
mem = &a->sin6_addr;
|
||||
port = ntohs(a->sin6_port);
|
||||
port = eina_ntohs(a->sin6_port);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -11,10 +11,6 @@
|
|||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ARPA_INET_H
|
||||
# include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
#include <Eina.h>
|
||||
|
||||
#include "Ecore.h"
|
||||
|
@ -318,11 +314,11 @@ _ecore_con_eet_data(Ecore_Con_Reply *n, void *data, unsigned int size)
|
|||
unsigned int *tmp = data;
|
||||
size -= 4 * sizeof (unsigned int);
|
||||
|
||||
if (ntohl(tmp[0]) == ECORE_CON_EET_RAW_MAGIC)
|
||||
if (eina_ntohl(tmp[0]) == ECORE_CON_EET_RAW_MAGIC)
|
||||
{
|
||||
unsigned int protocol_length = ntohl(tmp[1]);
|
||||
unsigned int section_length = ntohl(tmp[2]);
|
||||
unsigned int data_length = ntohl(tmp[3]);
|
||||
unsigned int protocol_length = eina_ntohl(tmp[1]);
|
||||
unsigned int section_length = eina_ntohl(tmp[2]);
|
||||
unsigned int data_length = eina_ntohl(tmp[3]);
|
||||
|
||||
if (protocol_length > 1 && section_length > 1 && protocol_length + section_length <= size && data_length < 10 * 1024 * 1024)
|
||||
{
|
||||
|
@ -559,10 +555,10 @@ _ecore_con_eet_base_raw_send(Eo *obj EINA_UNUSED, Ecore_Con_Eet_Base_Data *pd, E
|
|||
if (protocol_length == 1) return;
|
||||
section_length = strlen(section) + 1;
|
||||
|
||||
protocol[0] = htonl(ECORE_CON_EET_RAW_MAGIC);
|
||||
protocol[1] = htonl(protocol_length);
|
||||
protocol[2] = htonl(section_length);
|
||||
protocol[3] = htonl(length);
|
||||
protocol[0] = eina_htonl(ECORE_CON_EET_RAW_MAGIC);
|
||||
protocol[1] = eina_htonl(protocol_length);
|
||||
protocol[2] = eina_htonl(section_length);
|
||||
protocol[3] = eina_htonl(length);
|
||||
|
||||
size = sizeof (protocol) + protocol_length + section_length;
|
||||
tmp = alloca(size);
|
||||
|
|
|
@ -143,7 +143,7 @@ _efl_net_dialer_udp_resolved_bind(Eo *o, Efl_Net_Dialer_Udp_Data *pd EINA_UNUSED
|
|||
if (family == AF_INET)
|
||||
{
|
||||
const struct sockaddr_in *a = (const struct sockaddr_in *)addr->ai_addr;
|
||||
uint32_t ipv4 = ntohl(a->sin_addr.s_addr);
|
||||
uint32_t ipv4 = eina_ntohl(a->sin_addr.s_addr);
|
||||
if (ipv4 == INADDR_BROADCAST)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
|
|
|
@ -104,7 +104,7 @@ _efl_net_ip_address_family_get(const Eo *o EINA_UNUSED, Efl_Net_Ip_Address_Data
|
|||
EOLIAN static void
|
||||
_efl_net_ip_address_port_set(Eo *o EINA_UNUSED, Efl_Net_Ip_Address_Data *pd, uint16_t port)
|
||||
{
|
||||
uint16_t *pport, nport = htons(port);
|
||||
uint16_t *pport, nport = eina_htons(port);
|
||||
|
||||
EINA_SAFETY_ON_TRUE_RETURN(pd->addr.sa_family == 0);
|
||||
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
|
|||
if (*pport == nport) return;
|
||||
if (*pport)
|
||||
{
|
||||
ERR("port already set to %hu, new %hu", ntohs(*pport), port);
|
||||
ERR("port already set to %hu, new %hu", eina_ntohs(*pport), port);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -133,7 +133,7 @@ _efl_net_ip_address_port_get(const Eo *o EINA_UNUSED, Efl_Net_Ip_Address_Data *p
|
|||
else
|
||||
pport = &pd->ipv4.sin_port;
|
||||
|
||||
return ntohs(*pport);
|
||||
return eina_ntohs(*pport);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
|
@ -213,7 +213,7 @@ _efl_net_ip_address_sockaddr_get(const Eo *o EINA_UNUSED, Efl_Net_Ip_Address_Dat
|
|||
return &pd->addr;
|
||||
}
|
||||
|
||||
#define IPV4_ADDR_GET(pd) ntohl(pd->ipv4.sin_addr.s_addr)
|
||||
#define IPV4_ADDR_GET(pd) eina_ntohl(pd->ipv4.sin_addr.s_addr)
|
||||
|
||||
EOLIAN static Eina_Bool
|
||||
_efl_net_ip_address_ipv4_class_a_check(const Eo *o EINA_UNUSED, Efl_Net_Ip_Address_Data *pd)
|
||||
|
|
|
@ -124,9 +124,9 @@ _efl_net_socket_udp_bind(Eo *o, Efl_Net_Socket_Udp_Data *pd)
|
|||
}
|
||||
|
||||
if (family == AF_INET)
|
||||
bsa4.sin_port = htons(ul);
|
||||
bsa4.sin_port = eina_htons(ul);
|
||||
else
|
||||
bsa6.sin6_port = htons(ul);
|
||||
bsa6.sin6_port = eina_htons(ul);
|
||||
|
||||
if (family == AF_INET)
|
||||
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_
|
|||
if (addr.ss_family == AF_INET)
|
||||
{
|
||||
const struct sockaddr_in *a = (const struct sockaddr_in *)pd->addr_remote;
|
||||
uint32_t ipv4 = ntohl(a->sin_addr.s_addr);
|
||||
uint32_t ipv4 = eina_ntohl(a->sin_addr.s_addr);
|
||||
if ((ipv4 != INADDR_BROADCAST) && (ipv4 != INADDR_ANY) && (!IN_MULTICAST(ipv4)))
|
||||
{
|
||||
if ((addrlen != pd->addr_remote_len) ||
|
||||
|
|
|
@ -886,7 +886,7 @@ ecore_ipc_server_clients_get(Ecore_Ipc_Server *svr)
|
|||
unsigned char *dd; \
|
||||
dd = (unsigned char *)&v; \
|
||||
v = d; \
|
||||
v = htonl(v); \
|
||||
v = eina_htonl(v); \
|
||||
*(dat + s + 0) = dd[0]; \
|
||||
*(dat + s + 1) = dd[1]; \
|
||||
*(dat + s + 2) = dd[2]; \
|
||||
|
@ -899,7 +899,7 @@ ecore_ipc_server_clients_get(Ecore_Ipc_Server *svr)
|
|||
unsigned char *dd; \
|
||||
dd = (unsigned char *)&v; \
|
||||
v = d; \
|
||||
v = htons(v); \
|
||||
v = eina_htons(v); \
|
||||
*(dat + s + 0) = dd[0]; \
|
||||
*(dat + s + 1) = dd[1]; \
|
||||
s += 2; \
|
||||
|
@ -945,7 +945,7 @@ ecore_ipc_server_send(Ecore_Ipc_Server *svr, int major, int minor, int ref, int
|
|||
*head |= md << (4 * 4);
|
||||
SVENC(size);
|
||||
*head |= md << (4 * 5);
|
||||
*head = htonl(*head);
|
||||
*head = eina_htonl(*head);
|
||||
svr->prev.o = msg;
|
||||
|
||||
if (svr->dialer.input)
|
||||
|
@ -1101,7 +1101,7 @@ ecore_ipc_server_flush(Ecore_Ipc_Server *svr)
|
|||
unsigned char *dd; \
|
||||
dd = (unsigned char *)&v; \
|
||||
v = d; \
|
||||
v = htonl(v); \
|
||||
v = eina_htonl(v); \
|
||||
*(dat + s + 0) = dd[0]; \
|
||||
*(dat + s + 1) = dd[1]; \
|
||||
*(dat + s + 2) = dd[2]; \
|
||||
|
@ -1114,7 +1114,7 @@ ecore_ipc_server_flush(Ecore_Ipc_Server *svr)
|
|||
unsigned char *dd; \
|
||||
dd = (unsigned char *)&v; \
|
||||
v = d; \
|
||||
v = htons(v); \
|
||||
v = eina_htons(v); \
|
||||
*(dat + s + 0) = dd[0]; \
|
||||
*(dat + s + 1) = dd[1]; \
|
||||
s += 2; \
|
||||
|
@ -1168,7 +1168,7 @@ ecore_ipc_client_send(Ecore_Ipc_Client *cl, int major, int minor, int ref, int r
|
|||
*head |= md << (4 * 4);
|
||||
CLENC(size);
|
||||
*head |= md << (4 * 5);
|
||||
*head = htonl(*head);
|
||||
*head = eina_htonl(*head);
|
||||
cl->prev.o = msg;
|
||||
|
||||
if (cl->socket.input)
|
||||
|
@ -1503,7 +1503,7 @@ ecore_ipc_ssl_available_get(void)
|
|||
dv[1] = *(cl->buf + offset + s + 1); \
|
||||
dv[2] = *(cl->buf + offset + s + 2); \
|
||||
dv[3] = *(cl->buf + offset + s + 3); \
|
||||
d = (int)ntohl(v); \
|
||||
d = (int)eina_ntohl(v); \
|
||||
s += 4; \
|
||||
} \
|
||||
else if (md >= DLT_ADD16) \
|
||||
|
@ -1513,7 +1513,7 @@ ecore_ipc_ssl_available_get(void)
|
|||
dv = (unsigned char *)&v; \
|
||||
dv[0] = *(cl->buf + offset + s + 0); \
|
||||
dv[1] = *(cl->buf + offset + s + 1); \
|
||||
d = (int)ntohs(v); \
|
||||
d = (int)eina_ntohs(v); \
|
||||
s += 2; \
|
||||
} \
|
||||
else if (md >= DLT_ADD8) \
|
||||
|
@ -1572,7 +1572,7 @@ ecore_ipc_client_data_process(Ecore_Ipc_Client *cl, void *data, int size, Eina_B
|
|||
dd[1] = *(cl->buf + offset + 1);
|
||||
dd[2] = *(cl->buf + offset + 2);
|
||||
dd[3] = *(cl->buf + offset + 3);
|
||||
head = ntohl(head);
|
||||
head = eina_ntohl(head);
|
||||
dd = (unsigned char *)&d;
|
||||
s = 4;
|
||||
CLSZ(0);
|
||||
|
@ -1695,7 +1695,7 @@ ecore_ipc_client_data_process(Ecore_Ipc_Client *cl, void *data, int size, Eina_B
|
|||
dv[1] = *(svr->buf + offset + s + 1); \
|
||||
dv[2] = *(svr->buf + offset + s + 2); \
|
||||
dv[3] = *(svr->buf + offset + s + 3); \
|
||||
d = (int)ntohl(v); \
|
||||
d = (int)eina_ntohl(v); \
|
||||
s += 4; \
|
||||
} \
|
||||
else if (md >= DLT_ADD16) \
|
||||
|
@ -1705,7 +1705,7 @@ ecore_ipc_client_data_process(Ecore_Ipc_Client *cl, void *data, int size, Eina_B
|
|||
dv = (unsigned char *)&v; \
|
||||
dv[0] = *(svr->buf + offset + s + 0); \
|
||||
dv[1] = *(svr->buf + offset + s + 1); \
|
||||
d = (int)ntohs(v); \
|
||||
d = (int)eina_ntohs(v); \
|
||||
s += 2; \
|
||||
} \
|
||||
else if (md >= DLT_ADD8) \
|
||||
|
@ -1763,7 +1763,7 @@ ecore_ipc_server_data_process(Ecore_Ipc_Server *svr, void *data, int size, Eina_
|
|||
dd[1] = *(svr->buf + offset + 1);
|
||||
dd[2] = *(svr->buf + offset + 2);
|
||||
dd[3] = *(svr->buf + offset + 3);
|
||||
head = ntohl(head);
|
||||
head = eina_ntohl(head);
|
||||
dd = (unsigned char *)&d;
|
||||
s = 4;
|
||||
SVSZ(0);
|
||||
|
|
|
@ -8,10 +8,6 @@
|
|||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
# include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SIGNATURE
|
||||
# include <sys/mman.h>
|
||||
# ifdef HAVE_GNUTLS
|
||||
|
@ -601,9 +597,9 @@ eet_identity_sign(FILE *fp,
|
|||
|
||||
# endif /* ifdef HAVE_GNUTLS */
|
||||
/* Append the signature at the end of the file. */
|
||||
head[0] = (int)htonl ((unsigned int)EET_MAGIC_SIGN);
|
||||
head[1] = (int)htonl ((unsigned int)sign_len);
|
||||
head[2] = (int)htonl ((unsigned int)cert_len);
|
||||
head[0] = (int)eina_htonl ((unsigned int)EET_MAGIC_SIGN);
|
||||
head[1] = (int)eina_htonl ((unsigned int)sign_len);
|
||||
head[2] = (int)eina_htonl ((unsigned int)cert_len);
|
||||
|
||||
if (fwrite(head, sizeof(head), 1, fp) != 1)
|
||||
{
|
||||
|
@ -675,9 +671,9 @@ eet_identity_check(const void *data_base,
|
|||
memcpy(&sign_len, header+1, sizeof(int));
|
||||
memcpy(&cert_len, header+2, sizeof(int));
|
||||
|
||||
magic = ntohl(magic);
|
||||
sign_len = ntohl(sign_len);
|
||||
cert_len = ntohl(cert_len);
|
||||
magic = eina_ntohl(magic);
|
||||
sign_len = eina_ntohl(sign_len);
|
||||
cert_len = eina_ntohl(cert_len);
|
||||
|
||||
/* Verify the header */
|
||||
if (magic != EET_MAGIC_SIGN)
|
||||
|
|
|
@ -5,14 +5,6 @@
|
|||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
# include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
# include <winsock2.h>
|
||||
#endif /* ifdef _WIN32 */
|
||||
|
||||
#include <Eina.h>
|
||||
|
||||
#include "Eet.h"
|
||||
|
@ -71,9 +63,9 @@ eet_connection_received(Eet_Connection *conn,
|
|||
|
||||
msg = data;
|
||||
/* Check the magic */
|
||||
if (ntohl(msg[0]) != MAGIC_EET_DATA_PACKET) break;
|
||||
if (eina_ntohl(msg[0]) != MAGIC_EET_DATA_PACKET) break;
|
||||
|
||||
packet_size = ntohl(msg[1]);
|
||||
packet_size = eina_ntohl(msg[1]);
|
||||
/* Message should always be under MAX_MSG_SIZE */
|
||||
if (packet_size > MAX_MSG_SIZE) break;
|
||||
|
||||
|
@ -143,8 +135,8 @@ _eet_connection_raw_send(Eet_Connection *conn,
|
|||
/* Message should always be under MAX_MSG_SIZE */
|
||||
if (data_size > MAX_MSG_SIZE) return EINA_FALSE;
|
||||
message = malloc(data_size + (sizeof(int) * 2));
|
||||
message[0] = htonl(MAGIC_EET_DATA_PACKET);
|
||||
message[1] = htonl(data_size);
|
||||
message[0] = eina_htonl(MAGIC_EET_DATA_PACKET);
|
||||
message[1] = eina_htonl(data_size);
|
||||
memcpy(message + 2, data, data_size);
|
||||
conn->eet_write_cb(message,
|
||||
data_size + (sizeof(int) * 2),
|
||||
|
|
|
@ -8,14 +8,6 @@
|
|||
#include <ctype.h>
|
||||
#include <limits.h>
|
||||
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
# include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
# include <winsock2.h>
|
||||
#endif /* ifdef _WIN32 */
|
||||
|
||||
#include <Eina.h>
|
||||
|
||||
#include "Eet.h"
|
||||
|
@ -2877,7 +2869,7 @@ _eet_data_dump_encode(int parent_type,
|
|||
{
|
||||
unsigned long int v;
|
||||
|
||||
v = htonl(0x12345678);
|
||||
v = eina_htonl(0x12345678);
|
||||
if (v == 0x12345678)
|
||||
_eet_data_words_bigendian = 1;
|
||||
else
|
||||
|
@ -3483,7 +3475,7 @@ _eet_data_descriptor_decode(Eet_Free_Context *context,
|
|||
{
|
||||
unsigned long int v;
|
||||
|
||||
v = htonl(0x12345678);
|
||||
v = eina_htonl(0x12345678);
|
||||
if (v == 0x12345678)
|
||||
_eet_data_words_bigendian = 1;
|
||||
else
|
||||
|
@ -5088,7 +5080,7 @@ _eet_data_descriptor_encode(Eet_Dictionary *ed,
|
|||
{
|
||||
unsigned long int v;
|
||||
|
||||
v = htonl(0x12345678);
|
||||
v = eina_htonl(0x12345678);
|
||||
if (v == 0x12345678)
|
||||
_eet_data_words_bigendian = 1;
|
||||
else
|
||||
|
|
|
@ -6,16 +6,6 @@
|
|||
# include <sys/types.h>
|
||||
#endif /* ifdef __OpenBSD__ */
|
||||
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
# include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
# include <winsock2.h>
|
||||
# define HAVE_BOOLEAN
|
||||
# define XMD_H /* This prevents libjpeg to redefine INT32 */
|
||||
#endif /* ifdef _WIN32 */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <setjmp.h>
|
||||
|
@ -254,7 +244,7 @@ _eet_image_endian_check(void)
|
|||
{
|
||||
unsigned long int v;
|
||||
|
||||
v = htonl(0x12345678);
|
||||
v = eina_htonl(0x12345678);
|
||||
if (v == 0x12345678)
|
||||
_eet_image_words_bigendian = 1;
|
||||
else
|
||||
|
@ -811,8 +801,8 @@ eet_data_image_etc1_compressed_convert(int *size,
|
|||
|
||||
image_stride = w;
|
||||
image_height = h;
|
||||
nl_width = htonl(image_stride);
|
||||
nl_height = htonl(image_height);
|
||||
nl_width = eina_htonl(image_stride);
|
||||
nl_height = eina_htonl(image_height);
|
||||
compress = !!compress;
|
||||
|
||||
// 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,
|
|||
const char *m = data;
|
||||
|
||||
// We only use Emile for decoding the actual data, seems simpler this way.
|
||||
if (w) *w = ntohl(*((unsigned int*) &(m[OFFSET_WIDTH])));
|
||||
if (h) *h = ntohl(*((unsigned int*) &(m[OFFSET_HEIGHT])));
|
||||
if (w) *w = eina_ntohl(*((unsigned int*) &(m[OFFSET_WIDTH])));
|
||||
if (h) *h = eina_ntohl(*((unsigned int*) &(m[OFFSET_HEIGHT])));
|
||||
if (comp) *comp = m[OFFSET_OPTIONS] & 0x1;
|
||||
switch (m[OFFSET_ALGORITHM] & 0xFF)
|
||||
{
|
||||
|
|
|
@ -2,10 +2,6 @@
|
|||
# include <config.h>
|
||||
#endif /* ifdef HAVE_CONFIG_H */
|
||||
|
||||
#ifdef _WIN32
|
||||
# include <winsock2.h>
|
||||
#endif /* ifdef _WIN32 */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -16,14 +12,6 @@
|
|||
#include <fnmatch.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
# include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
# include <Evil.h>
|
||||
#endif /* ifdef _WIN32 */
|
||||
|
||||
#include <Eina.h>
|
||||
#include <Emile.h>
|
||||
|
||||
|
@ -384,9 +372,9 @@ eet_flush2(Eet_File *ef)
|
|||
num_dictionary_entries;
|
||||
|
||||
/* go thru and write the header */
|
||||
head[0] = (int)htonl((unsigned int)EET_MAGIC_FILE2);
|
||||
head[1] = (int)htonl((unsigned int)num_directory_entries);
|
||||
head[2] = (int)htonl((unsigned int)num_dictionary_entries);
|
||||
head[0] = (int)eina_htonl((unsigned int)EET_MAGIC_FILE2);
|
||||
head[1] = (int)eina_htonl((unsigned int)num_directory_entries);
|
||||
head[2] = (int)eina_htonl((unsigned int)num_dictionary_entries);
|
||||
|
||||
fseek(fp, 0, SEEK_SET);
|
||||
if (fwrite(head, sizeof (head), 1, fp) != 1)
|
||||
|
@ -414,12 +402,12 @@ eet_flush2(Eet_File *ef)
|
|||
|
||||
efn->offset = data_offset;
|
||||
|
||||
ibuf[0] = (int)htonl((unsigned int)data_offset);
|
||||
ibuf[1] = (int)htonl((unsigned int)efn->size);
|
||||
ibuf[2] = (int)htonl((unsigned int)efn->data_size);
|
||||
ibuf[3] = (int)htonl((unsigned int)strings_offset);
|
||||
ibuf[4] = (int)htonl((unsigned int)efn->name_size);
|
||||
ibuf[5] = (int)htonl((unsigned int)flag);
|
||||
ibuf[0] = (int)eina_htonl((unsigned int)data_offset);
|
||||
ibuf[1] = (int)eina_htonl((unsigned int)efn->size);
|
||||
ibuf[2] = (int)eina_htonl((unsigned int)efn->data_size);
|
||||
ibuf[3] = (int)eina_htonl((unsigned int)strings_offset);
|
||||
ibuf[4] = (int)eina_htonl((unsigned int)efn->name_size);
|
||||
ibuf[5] = (int)eina_htonl((unsigned int)flag);
|
||||
|
||||
strings_offset += efn->name_size;
|
||||
data_offset += efn->size;
|
||||
|
@ -449,11 +437,11 @@ eet_flush2(Eet_File *ef)
|
|||
if (ef->ed->hash[ef->ed->all_hash[j]] == j)
|
||||
prev = -1;
|
||||
|
||||
sbuf[0] = (int)htonl((unsigned int)ef->ed->all_hash[j]);
|
||||
sbuf[1] = (int)htonl((unsigned int)offset);
|
||||
sbuf[2] = (int)htonl((unsigned int)ef->ed->all[j].len);
|
||||
sbuf[3] = (int)htonl((unsigned int)prev);
|
||||
sbuf[4] = (int)htonl((unsigned int)ef->ed->all[j].next);
|
||||
sbuf[0] = (int)eina_htonl((unsigned int)ef->ed->all_hash[j]);
|
||||
sbuf[1] = (int)eina_htonl((unsigned int)offset);
|
||||
sbuf[2] = (int)eina_htonl((unsigned int)ef->ed->all[j].len);
|
||||
sbuf[3] = (int)eina_htonl((unsigned int)prev);
|
||||
sbuf[4] = (int)eina_htonl((unsigned int)ef->ed->all[j].next);
|
||||
|
||||
offset += ef->ed->all[j].len;
|
||||
|
||||
|
@ -755,14 +743,14 @@ eet_internal_read2(Eet_File *ef)
|
|||
unsigned int i;
|
||||
|
||||
idx += sizeof(int);
|
||||
if (eet_test_close((int)ntohl(*data) != EET_MAGIC_FILE2, ef))
|
||||
if (eet_test_close((int)eina_ntohl(*data) != EET_MAGIC_FILE2, ef))
|
||||
return NULL;
|
||||
|
||||
data++;
|
||||
|
||||
#define GET_INT(Value, Pointer, Index) \
|
||||
{ \
|
||||
Value = ntohl(*Pointer); \
|
||||
Value = eina_ntohl(*Pointer); \
|
||||
Pointer++; \
|
||||
Index += sizeof(int); \
|
||||
}
|
||||
|
@ -1003,9 +991,9 @@ eet_internal_read2(Eet_File *ef)
|
|||
/* check the signature has the magic number and sig + cert len
|
||||
* + magic is sane */
|
||||
memcpy(head, buffer, 3 * sizeof(int));
|
||||
head[0] = ntohl(head[0]);
|
||||
head[1] = ntohl(head[1]);
|
||||
head[2] = ntohl(head[2]);
|
||||
head[0] = eina_ntohl(head[0]);
|
||||
head[1] = eina_ntohl(head[1]);
|
||||
head[2] = eina_ntohl(head[2]);
|
||||
if ((head[0] == EET_MAGIC_SIGN) && (head[1] > 0) && (head[2] > 0))
|
||||
{
|
||||
/* there appears to be an actual valid identity at the end
|
||||
|
@ -1061,14 +1049,14 @@ eet_internal_read1(Eet_File *ef)
|
|||
/* build header table if read mode */
|
||||
/* geat header */
|
||||
idx += sizeof(int);
|
||||
if (eet_test_close((int)ntohl(*((int *)ef->data)) != EET_MAGIC_FILE, ef))
|
||||
if (eet_test_close((int)eina_ntohl(*((int *)ef->data)) != EET_MAGIC_FILE, ef))
|
||||
return NULL;
|
||||
|
||||
#define EXTRACT_INT(Value, Pointer, Index) \
|
||||
{ \
|
||||
int tmp; \
|
||||
memcpy(&tmp, Pointer + Index, sizeof(int)); \
|
||||
Value = ntohl(tmp); \
|
||||
Value = eina_ntohl(tmp); \
|
||||
Index += sizeof(int); \
|
||||
}
|
||||
|
||||
|
@ -1248,7 +1236,7 @@ eet_internal_read(Eet_File *ef)
|
|||
if (eet_test_close(ef->data_size < (int)sizeof(int) * 3, ef))
|
||||
return NULL;
|
||||
|
||||
switch (ntohl(*data))
|
||||
switch (eina_ntohl(*data))
|
||||
{
|
||||
#if EET_OLD_EET_FILE_FORMAT
|
||||
case EET_MAGIC_FILE:
|
||||
|
|
|
@ -9,18 +9,6 @@
|
|||
#include <sys/mman.h>
|
||||
#include <fnmatch.h>
|
||||
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
# include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ARPA_INET_H
|
||||
# include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
# include <winsock2.h>
|
||||
#endif
|
||||
|
||||
#include <Ecore.h>
|
||||
#include <Ecore_File.h>
|
||||
|
||||
|
@ -1018,7 +1006,7 @@ efreet_mime_shared_mimeinfo_magic_parse(char *data, int size)
|
|||
|
||||
tshort = 0;
|
||||
memcpy(&tshort, ptr, sizeof(short));
|
||||
entry->value_len = ntohs(tshort);
|
||||
entry->value_len = eina_ntohs(tshort);
|
||||
ptr += 2;
|
||||
|
||||
entry->value = NEW(char, entry->value_len);
|
||||
|
@ -1059,20 +1047,20 @@ efreet_mime_shared_mimeinfo_magic_parse(char *data, int size)
|
|||
if (entry->word_size == 2)
|
||||
{
|
||||
((short*)entry->value)[j] =
|
||||
ntohs(((short*)entry->value)[j]);
|
||||
eina_ntohs(((short*)entry->value)[j]);
|
||||
|
||||
if (entry->mask)
|
||||
((short*)entry->mask)[j] =
|
||||
ntohs(((short*)entry->mask)[j]);
|
||||
eina_ntohs(((short*)entry->mask)[j]);
|
||||
}
|
||||
else if (entry->word_size == 4)
|
||||
{
|
||||
((int*)entry->value)[j] =
|
||||
ntohl(((int*)entry->value)[j]);
|
||||
eina_ntohl(((int*)entry->value)[j]);
|
||||
|
||||
if (entry->mask)
|
||||
((int*)entry->mask)[j] =
|
||||
ntohl(((int*)entry->mask)[j]);
|
||||
eina_ntohl(((int*)entry->mask)[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -122,6 +122,15 @@
|
|||
#endif
|
||||
@EINA_CONFIGURE_HAVE_OSX_SEMAPHORE@
|
||||
|
||||
#ifndef EINA_HAVE_WORDS_BIGENDIAN
|
||||
# undef EINA_HAVE_WORDS_BIGENDIAN
|
||||
#endif
|
||||
@EINA_CONFIGURE_HAVE_WORDS_BIGENDIAN@
|
||||
|
||||
#if ((defined __APPLE_CC__) && (defined __BIG_ENDIAN__)) || (defined EINA_HAVE_WORDS_BIGENDIAN)
|
||||
# define EINA_HAVE_BIGENDIAN
|
||||
#endif
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
#endif /* EINA_CONFIG_H_ */
|
||||
|
|
|
@ -123,6 +123,18 @@ static inline unsigned int eina_swap32(unsigned int x);
|
|||
*/
|
||||
static inline unsigned long long eina_swap64(unsigned long long x);
|
||||
|
||||
static inline unsigned short eina_htons(unsigned short host);
|
||||
|
||||
static inline unsigned int eina_htonl(unsigned int host);
|
||||
|
||||
static inline unsigned long long eina_htonll(unsigned long long host);
|
||||
|
||||
static inline unsigned short eina_ntohs(unsigned short net);
|
||||
|
||||
static inline unsigned int eina_ntohl(unsigned int net);
|
||||
|
||||
static inline unsigned long long eina_ntohll(unsigned long long net);
|
||||
|
||||
#ifndef MIN
|
||||
# define MIN(x, y) (((x) > (y)) ? (y) : (x))
|
||||
#endif
|
||||
|
|
|
@ -477,7 +477,7 @@ eina_debug_remote_connect(int port)
|
|||
//Prepare the sockaddr_in structure
|
||||
server.sin_family = AF_INET;
|
||||
if (inet_pton(AF_INET, "127.0.0.1", &server.sin_addr.s_addr) != 1) goto err;
|
||||
server.sin_port = htons(port);
|
||||
server.sin_port = eina_htons(port);
|
||||
|
||||
if (connect(fd, (struct sockaddr *)&server, sizeof(server)) < 0)
|
||||
{
|
||||
|
|
|
@ -88,7 +88,64 @@ eina_swap64(unsigned long long x)
|
|||
#endif
|
||||
}
|
||||
|
||||
static inline unsigned short
|
||||
eina_htons(unsigned short host)
|
||||
{
|
||||
#ifdef EINA_HAVE_BIGENDIAN
|
||||
return host;
|
||||
#else
|
||||
return eina_swap16(host);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline unsigned int
|
||||
eina_htonl(unsigned int host)
|
||||
{
|
||||
#ifdef EINA_HAVE_BIGENDIAN
|
||||
return host;
|
||||
#else
|
||||
return eina_swap32(host);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline unsigned long long
|
||||
eina_htonll(unsigned long long host)
|
||||
{
|
||||
#ifdef EINA_HAVE_BIGENDIAN
|
||||
return host;
|
||||
#else
|
||||
return eina_swap64(host);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline unsigned short
|
||||
eina_ntohs(unsigned short net)
|
||||
{
|
||||
#ifdef EINA_HAVE_BIGENDIAN
|
||||
return net;
|
||||
#else
|
||||
return eina_swap16(net);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline unsigned int
|
||||
eina_ntohl(unsigned int net)
|
||||
{
|
||||
#ifdef EINA_HAVE_BIGENDIAN
|
||||
return net;
|
||||
#else
|
||||
return eina_swap32(net);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline unsigned long long
|
||||
eina_ntohll(unsigned long long net)
|
||||
{
|
||||
#ifdef EINA_HAVE_BIGENDIAN
|
||||
return net;
|
||||
#else
|
||||
return eina_swap64(net);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -349,7 +349,10 @@ if sys_osx == true
|
|||
if cc.has_header_symbol('mach/task.h', 'semaphore_create')
|
||||
eina_config.set('EINA_HAVE_OSX_SEMAPHORE', 1)
|
||||
endif
|
||||
endif
|
||||
|
||||
if host_machine.endian() == 'big'
|
||||
eina_config.set('EINA_HAVE_WORDS_BIGENDIAN', '1')
|
||||
endif
|
||||
|
||||
eina_config_file = configure_file(
|
||||
|
|
|
@ -2,10 +2,6 @@
|
|||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
# include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
#include <gnutls/abstract.h>
|
||||
#include <gnutls/x509.h>
|
||||
#include <gcrypt.h>
|
||||
|
@ -220,7 +216,7 @@ emile_binbuf_cipher(Emile_Cipher_Algorithm algo,
|
|||
eina_binbuf_append_length(result, (unsigned char*) &salt, sizeof (salt));
|
||||
memset(&salt, 0, sizeof (salt));
|
||||
|
||||
tmp = htonl(eina_binbuf_length_get(data));
|
||||
tmp = eina_htonl(eina_binbuf_length_get(data));
|
||||
eina_binbuf_append_length(result, (unsigned char*) &tmp, sizeof (tmp));
|
||||
eina_binbuf_append_buffer(result, data);
|
||||
|
||||
|
@ -350,7 +346,7 @@ emile_binbuf_decipher(Emile_Cipher_Algorithm algo,
|
|||
|
||||
/* Get the decrypted data size */
|
||||
tmp = *(unsigned int*)(eina_binbuf_string_get(result));
|
||||
tmp = ntohl(tmp);
|
||||
tmp = eina_ntohl(tmp);
|
||||
if (tmp > tmp_len || tmp <= 0)
|
||||
goto on_error;
|
||||
|
||||
|
|
|
@ -2,10 +2,6 @@
|
|||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
# include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
#include <openssl/sha.h>
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/hmac.h>
|
||||
|
@ -149,7 +145,7 @@ emile_binbuf_cipher(Emile_Cipher_Algorithm algo,
|
|||
eina_binbuf_append_length(result, (unsigned char*) &salt, sizeof (salt));
|
||||
memset(&salt, 0, sizeof (salt));
|
||||
|
||||
tmp = htonl(eina_binbuf_length_get(data));
|
||||
tmp = eina_htonl(eina_binbuf_length_get(data));
|
||||
buffer = malloc(crypted_length - sizeof (int));
|
||||
if (!buffer) goto on_error;
|
||||
*buffer = tmp;
|
||||
|
@ -279,7 +275,7 @@ emile_binbuf_decipher(Emile_Cipher_Algorithm algo,
|
|||
|
||||
/* Get the decrypted data size */
|
||||
tmp = *(unsigned int*)(eina_binbuf_string_get(result));
|
||||
tmp = ntohl(tmp);
|
||||
tmp = eina_ntohl(tmp);
|
||||
if (tmp > tmp_len || tmp <= 0)
|
||||
goto on_error;
|
||||
|
||||
|
|
|
@ -2,17 +2,6 @@
|
|||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <winsock2.h>
|
||||
#include <Evil.h>
|
||||
#define HAVE_BOOLEAN /* This prevents libjpeg to redefine boolean */
|
||||
#define XMD_H /* This prevents libjpeg to redefine INT32 */
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_LIBLZ4
|
||||
#include <lz4.h>
|
||||
#else
|
||||
|
@ -337,8 +326,8 @@ _emile_tgv_head(Emile_Image *image,
|
|||
image->compress = m[OFFSET_OPTIONS] & 0x1;
|
||||
image->blockless = (m[OFFSET_OPTIONS] & 0x2) != 0;
|
||||
|
||||
image->size.width = ntohl(*((unsigned int *)&(m[OFFSET_WIDTH])));
|
||||
image->size.height = ntohl(*((unsigned int *)&(m[OFFSET_HEIGHT])));
|
||||
image->size.width = eina_ntohl(*((unsigned int *)&(m[OFFSET_WIDTH])));
|
||||
image->size.height = eina_ntohl(*((unsigned int *)&(m[OFFSET_HEIGHT])));
|
||||
|
||||
if (image->blockless)
|
||||
{
|
||||
|
|
|
@ -1,14 +1,6 @@
|
|||
#include "evas_common_private.h"
|
||||
#include "evas_private.h"
|
||||
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
# include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
# include <winsock2.h>
|
||||
#endif /* ifdef _WIN32 */
|
||||
|
||||
#ifdef ENABLE_LIBLZ4
|
||||
# include <lz4.h>
|
||||
# include <lz4hc.h>
|
||||
|
@ -70,8 +62,8 @@ _save_direct_tgv(RGBA_Image *im, const char *file, int compress)
|
|||
image_width = im->cache_entry.w + im->cache_entry.borders.l + im->cache_entry.borders.r;
|
||||
image_height = im->cache_entry.h + im->cache_entry.borders.t + im->cache_entry.borders.b;
|
||||
data = im->image.data8;
|
||||
width = htonl(image_width);
|
||||
height = htonl(image_height);
|
||||
width = eina_htonl(image_width);
|
||||
height = eina_htonl(image_height);
|
||||
compress = !!compress;
|
||||
|
||||
if ((image_width & 0x3) || (image_height & 0x3))
|
||||
|
@ -219,8 +211,8 @@ evas_image_save_file_tgv(RGBA_Image *im,
|
|||
|
||||
image_stride = im->cache_entry.w;
|
||||
image_height = im->cache_entry.h;
|
||||
nl_width = htonl(image_stride);
|
||||
nl_height = htonl(image_height);
|
||||
nl_width = eina_htonl(image_stride);
|
||||
nl_height = eina_htonl(image_height);
|
||||
compress = !!compress;
|
||||
|
||||
// Disable dithering, as it will deteriorate the quality of flat surfaces
|
||||
|
|
|
@ -256,7 +256,7 @@ _ipv4_check(Eo *o, const struct sockaddr_in *addr)
|
|||
ck_assert_ptr_ne(o, NULL);
|
||||
|
||||
ck_assert_int_eq(efl_net_ip_address_family_get(o), AF_INET);
|
||||
ck_assert_int_eq(efl_net_ip_address_port_get(o), ntohs(addr->sin_port));
|
||||
ck_assert_int_eq(efl_net_ip_address_port_get(o), eina_ntohs(addr->sin_port));
|
||||
|
||||
rs = efl_net_ip_address_get(o);
|
||||
ck_assert_int_eq(eina_slice_compare(rs, slice), 0);
|
||||
|
@ -266,7 +266,7 @@ _ipv4_check(Eo *o, const struct sockaddr_in *addr)
|
|||
if (addr->sin_port)
|
||||
{
|
||||
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),
|
||||
":%hu", htons(addr->sin_port));
|
||||
":%hu", eina_htons(addr->sin_port));
|
||||
}
|
||||
ck_assert_ptr_ne(efl_net_ip_address_string_get(o), NULL);
|
||||
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)
|
|||
Eina_Slice slice = { .mem = &addr.sin_addr, .len = sizeof(addr.sin_addr) };
|
||||
Eo *o;
|
||||
|
||||
addr.sin_port = htons(12345);
|
||||
addr.sin_addr.s_addr = htonl(0xabcdefafU);
|
||||
addr.sin_port = eina_htons(12345);
|
||||
addr.sin_addr.s_addr = eina_htonl(0xabcdefafU);
|
||||
o = efl_add_ref(EFL_NET_IP_ADDRESS_CLASS, NULL,
|
||||
efl_net_ip_address_family_set(efl_added, AF_INET),
|
||||
efl_net_ip_address_port_set(efl_added, ntohs(addr.sin_port)),
|
||||
efl_net_ip_address_port_set(efl_added, eina_ntohs(addr.sin_port)),
|
||||
efl_net_ip_address_set(efl_added, slice));
|
||||
_ipv4_check(o, &addr);
|
||||
efl_unref(o);
|
||||
|
||||
addr.sin_port = htons(8081);
|
||||
addr.sin_addr.s_addr = htonl(0);
|
||||
addr.sin_port = eina_htons(8081);
|
||||
addr.sin_addr.s_addr = eina_htonl(0);
|
||||
o = efl_add_ref(EFL_NET_IP_ADDRESS_CLASS, NULL,
|
||||
efl_net_ip_address_family_set(efl_added, AF_INET),
|
||||
efl_net_ip_address_port_set(efl_added, ntohs(addr.sin_port)),
|
||||
efl_net_ip_address_port_set(efl_added, eina_ntohs(addr.sin_port)),
|
||||
efl_net_ip_address_set(efl_added, slice));
|
||||
_ipv4_check(o, &addr);
|
||||
efl_unref(o);
|
||||
|
||||
addr.sin_port = htons(0);
|
||||
addr.sin_addr.s_addr = htonl(0x12345678);
|
||||
addr.sin_port = eina_htons(0);
|
||||
addr.sin_addr.s_addr = eina_htonl(0x12345678);
|
||||
o = efl_add_ref(EFL_NET_IP_ADDRESS_CLASS, NULL,
|
||||
efl_net_ip_address_family_set(efl_added, AF_INET),
|
||||
efl_net_ip_address_set(efl_added, slice));
|
||||
|
@ -356,16 +356,16 @@ EFL_START_TEST(ecore_test_efl_net_ip_address_ipv4_manual_fail)
|
|||
efl_unref(o);
|
||||
TRAP_ERRORS_FINISH(1);
|
||||
|
||||
addr.sin_port = htons(12345);
|
||||
addr.sin_addr.s_addr = htonl(0xabcdefafU);
|
||||
addr.sin_port = eina_htons(12345);
|
||||
addr.sin_addr.s_addr = eina_htonl(0xabcdefafU);
|
||||
o = efl_add_ref(EFL_NET_IP_ADDRESS_CLASS, NULL,
|
||||
efl_net_ip_address_family_set(efl_added, AF_INET),
|
||||
efl_net_ip_address_port_set(efl_added, ntohs(addr.sin_port)),
|
||||
efl_net_ip_address_port_set(efl_added, eina_ntohs(addr.sin_port)),
|
||||
efl_net_ip_address_set(efl_added, slice));
|
||||
_ipv4_check(o, &addr);
|
||||
|
||||
TRAP_ERRORS_BEGIN(ecore_con, ERR, "port already set to %hu, new %hu");
|
||||
efl_net_ip_address_port_set(o, ntohs(addr.sin_port));
|
||||
efl_net_ip_address_port_set(o, eina_ntohs(addr.sin_port));
|
||||
TRAP_ERRORS_FINISH(0);
|
||||
|
||||
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)
|
|||
TRAP_ERRORS_FINISH(0);
|
||||
|
||||
TRAP_ERRORS_BEGIN(ecore_con, ERR, "address already set to %s, new %s");
|
||||
addr.sin_addr.s_addr = htonl(0x12345678);
|
||||
addr.sin_addr.s_addr = eina_htonl(0x12345678);
|
||||
slice.len = sizeof(addr.sin_addr.s_addr);
|
||||
efl_net_ip_address_set(o, slice);
|
||||
TRAP_ERRORS_FINISH(1);
|
||||
|
@ -400,26 +400,26 @@ EFL_START_TEST(ecore_test_efl_net_ip_address_ipv4_create_ok)
|
|||
Eina_Slice slice = { .mem = &addr.sin_addr, .len = sizeof(addr.sin_addr) };
|
||||
Eo *o;
|
||||
|
||||
addr.sin_port = htons(12345);
|
||||
addr.sin_addr.s_addr = htonl(0xabcdefafU);
|
||||
addr.sin_port = eina_htons(12345);
|
||||
addr.sin_addr.s_addr = eina_htonl(0xabcdefafU);
|
||||
o = efl_net_ip_address_create(EFL_NET_IP_ADDRESS_CLASS,
|
||||
ntohs(addr.sin_port),
|
||||
eina_ntohs(addr.sin_port),
|
||||
slice);
|
||||
_ipv4_check(o, &addr);
|
||||
efl_unref(o);
|
||||
|
||||
addr.sin_port = htons(8081);
|
||||
addr.sin_addr.s_addr = htonl(0);
|
||||
addr.sin_port = eina_htons(8081);
|
||||
addr.sin_addr.s_addr = eina_htonl(0);
|
||||
o = efl_net_ip_address_create(EFL_NET_IP_ADDRESS_CLASS,
|
||||
ntohs(addr.sin_port),
|
||||
eina_ntohs(addr.sin_port),
|
||||
slice);
|
||||
_ipv4_check(o, &addr);
|
||||
efl_unref(o);
|
||||
|
||||
addr.sin_port = htons(0);
|
||||
addr.sin_addr.s_addr = htonl(0x12345678);
|
||||
addr.sin_port = eina_htons(0);
|
||||
addr.sin_addr.s_addr = eina_htonl(0x12345678);
|
||||
o = efl_net_ip_address_create(EFL_NET_IP_ADDRESS_CLASS,
|
||||
ntohs(addr.sin_port),
|
||||
eina_ntohs(addr.sin_port),
|
||||
slice);
|
||||
_ipv4_check(o, &addr);
|
||||
efl_unref(o);
|
||||
|
@ -450,15 +450,15 @@ EFL_START_TEST(ecore_test_efl_net_ip_address_ipv4_create_sockaddr_ok)
|
|||
};
|
||||
Eo *o;
|
||||
|
||||
addr.sin_port = htons(12345);
|
||||
addr.sin_addr.s_addr = htonl(0xabcdefafU);
|
||||
addr.sin_port = eina_htons(12345);
|
||||
addr.sin_addr.s_addr = eina_htonl(0xabcdefafU);
|
||||
o = efl_net_ip_address_create_sockaddr(EFL_NET_IP_ADDRESS_CLASS, &addr);
|
||||
ck_assert_ptr_ne(&addr, efl_net_ip_address_sockaddr_get(o));
|
||||
_ipv4_check(o, &addr);
|
||||
efl_unref(o);
|
||||
|
||||
addr.sin_port = htons(0);
|
||||
addr.sin_addr.s_addr = htonl(0);
|
||||
addr.sin_port = eina_htons(0);
|
||||
addr.sin_addr.s_addr = eina_htonl(0);
|
||||
o = efl_net_ip_address_create_sockaddr(EFL_NET_IP_ADDRESS_CLASS, &addr);
|
||||
ck_assert_ptr_ne(&addr, efl_net_ip_address_sockaddr_get(o));
|
||||
_ipv4_check(o, &addr);
|
||||
|
@ -641,7 +641,7 @@ EFL_START_TEST(ecore_test_efl_net_ip_address_ipv4_checks)
|
|||
struct sockaddr_in a = {
|
||||
.sin_family = AF_INET,
|
||||
.sin_port = 0,
|
||||
.sin_addr.s_addr = htonl(itr->addr),
|
||||
.sin_addr.s_addr = eina_htonl(itr->addr),
|
||||
};
|
||||
Eo *o = efl_net_ip_address_create_sockaddr(EFL_NET_IP_ADDRESS_CLASS, &a);
|
||||
ck_assert_ptr_ne(o, NULL);
|
||||
|
@ -677,7 +677,7 @@ _ipv6_check(Eo *o, const struct sockaddr_in6 *addr)
|
|||
ck_assert_ptr_ne(o, NULL);
|
||||
|
||||
ck_assert_int_eq(efl_net_ip_address_family_get(o), AF_INET6);
|
||||
ck_assert_int_eq(efl_net_ip_address_port_get(o), ntohs(addr->sin6_port));
|
||||
ck_assert_int_eq(efl_net_ip_address_port_get(o), eina_ntohs(addr->sin6_port));
|
||||
|
||||
rs = efl_net_ip_address_get(o);
|
||||
ck_assert_int_eq(eina_slice_compare(rs, slice), 0);
|
||||
|
@ -689,7 +689,7 @@ _ipv6_check(Eo *o, const struct sockaddr_in6 *addr)
|
|||
if (addr->sin6_port)
|
||||
{
|
||||
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),
|
||||
":%hu", htons(addr->sin6_port));
|
||||
":%hu", eina_htons(addr->sin6_port));
|
||||
}
|
||||
|
||||
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)
|
|||
Eina_Slice slice = { .mem = &addr.sin6_addr, .len = sizeof(addr.sin6_addr) };
|
||||
Eo *o;
|
||||
|
||||
addr.sin6_port = htons(12345);
|
||||
addr.sin6_port = eina_htons(12345);
|
||||
_ipv6_set(&addr, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||
o = efl_add_ref(EFL_NET_IP_ADDRESS_CLASS, NULL,
|
||||
efl_net_ip_address_family_set(efl_added, AF_INET6),
|
||||
efl_net_ip_address_port_set(efl_added, ntohs(addr.sin6_port)),
|
||||
efl_net_ip_address_port_set(efl_added, eina_ntohs(addr.sin6_port)),
|
||||
efl_net_ip_address_set(efl_added, slice));
|
||||
_ipv6_check(o, &addr);
|
||||
efl_unref(o);
|
||||
|
||||
addr.sin6_port = htons(8081);
|
||||
addr.sin6_port = eina_htons(8081);
|
||||
_ipv6_set(&addr, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
o = efl_add_ref(EFL_NET_IP_ADDRESS_CLASS, NULL,
|
||||
efl_net_ip_address_family_set(efl_added, AF_INET6),
|
||||
efl_net_ip_address_port_set(efl_added, ntohs(addr.sin6_port)),
|
||||
efl_net_ip_address_port_set(efl_added, eina_ntohs(addr.sin6_port)),
|
||||
efl_net_ip_address_set(efl_added, slice));
|
||||
_ipv6_check(o, &addr);
|
||||
efl_unref(o);
|
||||
|
@ -752,16 +752,16 @@ EFL_START_TEST(ecore_test_efl_net_ip_address_ipv6_manual_fail)
|
|||
efl_unref(o);
|
||||
TRAP_ERRORS_FINISH(1);
|
||||
|
||||
addr.sin6_port = htons(12345);
|
||||
addr.sin6_port = eina_htons(12345);
|
||||
_ipv6_set(&addr, 0, 0, 0, 0, 0, 0, 0, 1);
|
||||
o = efl_add_ref(EFL_NET_IP_ADDRESS_CLASS, NULL,
|
||||
efl_net_ip_address_family_set(efl_added, AF_INET6),
|
||||
efl_net_ip_address_port_set(efl_added, ntohs(addr.sin6_port)),
|
||||
efl_net_ip_address_port_set(efl_added, eina_ntohs(addr.sin6_port)),
|
||||
efl_net_ip_address_set(efl_added, slice));
|
||||
_ipv6_check(o, &addr);
|
||||
|
||||
TRAP_ERRORS_BEGIN(ecore_con, ERR, "port already set to %hu, new %hu");
|
||||
efl_net_ip_address_port_set(o, ntohs(addr.sin6_port));
|
||||
efl_net_ip_address_port_set(o, eina_ntohs(addr.sin6_port));
|
||||
TRAP_ERRORS_FINISH(0);
|
||||
|
||||
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)
|
|||
Eina_Slice slice = { .mem = &addr.sin6_addr, .len = sizeof(addr.sin6_addr) };
|
||||
Eo *o;
|
||||
|
||||
addr.sin6_port = htons(12365);
|
||||
addr.sin6_port = eina_htons(12365);
|
||||
_ipv6_set(&addr, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||
o = efl_net_ip_address_create(EFL_NET_IP_ADDRESS_CLASS,
|
||||
ntohs(addr.sin6_port),
|
||||
eina_ntohs(addr.sin6_port),
|
||||
slice);
|
||||
_ipv6_check(o, &addr);
|
||||
efl_unref(o);
|
||||
|
||||
addr.sin6_port = htons(8081);
|
||||
addr.sin6_port = eina_htons(8081);
|
||||
_ipv6_set(&addr, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
o = efl_net_ip_address_create(EFL_NET_IP_ADDRESS_CLASS,
|
||||
ntohs(addr.sin6_port),
|
||||
eina_ntohs(addr.sin6_port),
|
||||
slice);
|
||||
_ipv6_check(o, &addr);
|
||||
efl_unref(o);
|
||||
|
||||
addr.sin6_port = htons(0);
|
||||
addr.sin6_port = eina_htons(0);
|
||||
_ipv6_set(&addr, 0, 0, 0, 0, 0, 0, 0, 1);
|
||||
o = efl_net_ip_address_create(EFL_NET_IP_ADDRESS_CLASS,
|
||||
ntohs(addr.sin6_port),
|
||||
eina_ntohs(addr.sin6_port),
|
||||
slice);
|
||||
_ipv6_check(o, &addr);
|
||||
efl_unref(o);
|
||||
|
@ -831,14 +831,14 @@ EFL_START_TEST(ecore_test_efl_net_ip_address_ipv6_create_sockaddr_ok)
|
|||
};
|
||||
Eo *o;
|
||||
|
||||
addr.sin6_port = htons(12345);
|
||||
addr.sin6_port = eina_htons(12345);
|
||||
_ipv6_set(&addr, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||
o = efl_net_ip_address_create_sockaddr(EFL_NET_IP_ADDRESS_CLASS, &addr);
|
||||
ck_assert_ptr_ne(&addr, efl_net_ip_address_sockaddr_get(o));
|
||||
_ipv6_check(o, &addr);
|
||||
efl_unref(o);
|
||||
|
||||
addr.sin6_port = htons(0);
|
||||
addr.sin6_port = eina_htons(0);
|
||||
_ipv6_set(&addr, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
o = efl_net_ip_address_create_sockaddr(EFL_NET_IP_ADDRESS_CLASS, &addr);
|
||||
ck_assert_ptr_ne(&addr, efl_net_ip_address_sockaddr_get(o));
|
||||
|
|
Loading…
Reference in New Issue