summaryrefslogtreecommitdiff
path: root/src/lib/eina
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/eina
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/eina')
-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
5 files changed, 83 insertions, 2 deletions
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(