summaryrefslogtreecommitdiff
path: root/src/lib/eet/eet_lib.c
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/eet/eet_lib.c
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/eet/eet_lib.c')
-rw-r--r--src/lib/eet/eet_lib.c56
1 files changed, 22 insertions, 34 deletions
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: