aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/eet/src/lib
diff options
context:
space:
mode:
authorDavid Walter Seikel2012-01-23 23:30:42 +1000
committerDavid Walter Seikel2012-01-23 23:30:42 +1000
commit825a3d837a33f226c879cd02ad15c3fba57e8b2c (patch)
tree75f57bd9c4253508d338dc79ba8e57a7abc42255 /libraries/eet/src/lib
parentAdd ability to disable the test harness, or the Lua compile test. (diff)
downloadSledjHamr-825a3d837a33f226c879cd02ad15c3fba57e8b2c.zip
SledjHamr-825a3d837a33f226c879cd02ad15c3fba57e8b2c.tar.gz
SledjHamr-825a3d837a33f226c879cd02ad15c3fba57e8b2c.tar.bz2
SledjHamr-825a3d837a33f226c879cd02ad15c3fba57e8b2c.tar.xz
Update the EFL to what I'm actually using, coz I'm using some stuff not yet released.
Diffstat (limited to 'libraries/eet/src/lib')
-rw-r--r--libraries/eet/src/lib/Eet.h17
-rw-r--r--libraries/eet/src/lib/Eet_private.h135
-rw-r--r--libraries/eet/src/lib/Makefile.am1
-rw-r--r--libraries/eet/src/lib/Makefile.in27
-rw-r--r--libraries/eet/src/lib/eet_alloc.c93
-rw-r--r--libraries/eet/src/lib/eet_cipher.c26
-rw-r--r--libraries/eet/src/lib/eet_connection.c129
-rw-r--r--libraries/eet/src/lib/eet_data.c238
-rw-r--r--libraries/eet/src/lib/eet_dictionary.c55
-rw-r--r--libraries/eet/src/lib/eet_image.c74
-rw-r--r--libraries/eet/src/lib/eet_lib.c297
-rw-r--r--libraries/eet/src/lib/eet_node.c58
-rw-r--r--libraries/eet/src/lib/eet_utils.c2
13 files changed, 630 insertions, 522 deletions
diff --git a/libraries/eet/src/lib/Eet.h b/libraries/eet/src/lib/Eet.h
index 8fda1e0..2df7fbf 100644
--- a/libraries/eet/src/lib/Eet.h
+++ b/libraries/eet/src/lib/Eet.h
@@ -188,7 +188,7 @@ extern "C" {
188 */ 188 */
189 189
190#define EET_VERSION_MAJOR 1 190#define EET_VERSION_MAJOR 1
191#define EET_VERSION_MINOR 4 191#define EET_VERSION_MINOR 6
192/** 192/**
193 * @typedef Eet_Version 193 * @typedef Eet_Version
194 * 194 *
@@ -755,7 +755,7 @@ eet_delete(Eet_File *ef,
755 755
756/** 756/**
757 * Alias a specific section to another one. Destination may exist or not, 757 * Alias a specific section to another one. Destination may exist or not,
758 * no check are done. 758 * no checks are done.
759 * @param ef A valid eet file handle opened for writing. 759 * @param ef A valid eet file handle opened for writing.
760 * @param name Name of the new entry. eg: "/base/file_i_want". 760 * @param name Name of the new entry. eg: "/base/file_i_want".
761 * @param destination Actual source of the aliased entry eg: "/base/the_real_stuff_i_want". 761 * @param destination Actual source of the aliased entry eg: "/base/the_real_stuff_i_want".
@@ -775,6 +775,19 @@ eet_alias(Eet_File *ef,
775 int compress); 775 int compress);
776 776
777/** 777/**
778 * Retrieve the filename of an Eet_File
779 * @param ef A valid eet file handle opened for writing.
780 * @return The stringshared file string opened with eet_open(), or NULL on error
781 *
782 * @note This function will return NULL for files opened with eet_memopen_read()
783 *
784 * @since 1.6
785 * @ingroup Eet_File_Group
786 */
787EAPI const char *
788eet_file_get(Eet_File *ef);
789
790/**
778 * Retrieve the destination name of an alias 791 * Retrieve the destination name of an alias
779 * @param ef A valid eet file handle opened for writing 792 * @param ef A valid eet file handle opened for writing
780 * @param name Name of the entry. eg: "/base/file_i_want" 793 * @param name Name of the entry. eg: "/base/file_i_want"
diff --git a/libraries/eet/src/lib/Eet_private.h b/libraries/eet/src/lib/Eet_private.h
index 83f4c18..c04daf0 100644
--- a/libraries/eet/src/lib/Eet_private.h
+++ b/libraries/eet/src/lib/Eet_private.h
@@ -66,6 +66,126 @@ struct _Eet_Node
66 Eet_Node_Data data; 66 Eet_Node_Data data;
67}; 67};
68 68
69typedef struct _Eet_File_Header Eet_File_Header;
70typedef struct _Eet_File_Node Eet_File_Node;
71typedef struct _Eet_File_Directory Eet_File_Directory;
72
73struct _Eet_File
74{
75 const char *path;
76 Eina_File *readfp;
77 Eet_File_Header *header;
78 Eet_Dictionary *ed;
79 Eet_Key *key;
80 const unsigned char *data;
81 const void *x509_der;
82 const void *signature;
83 void *sha1;
84
85 Eet_File_Mode mode;
86
87 int magic;
88 int references;
89
90 unsigned long int data_size;
91 int x509_length;
92 unsigned int signature_length;
93 int sha1_length;
94
95 Eina_Lock file_lock;
96
97 unsigned char writes_pending : 1;
98 unsigned char delete_me_now : 1;
99};
100
101struct _Eet_File_Header
102{
103 int magic;
104 Eet_File_Directory *directory;
105};
106
107struct _Eet_File_Directory
108{
109 int size;
110 Eet_File_Node **nodes;
111};
112
113struct _Eet_File_Node
114{
115 char *name;
116 void *data;
117 Eet_File_Node *next; /* FIXME: make buckets linked lists */
118
119 unsigned long int offset;
120 unsigned long int dictionary_offset;
121 unsigned long int name_offset;
122
123 unsigned int name_size;
124 unsigned int size;
125 unsigned int data_size;
126
127 unsigned char free_name : 1;
128 unsigned char compression : 1;
129 unsigned char ciphered : 1;
130 unsigned char alias : 1;
131};
132
133#if 0
134/* Version 2 */
135/* NB: all int's are stored in network byte order on disk */
136/* file format: */
137int magic; /* magic number ie 0x1ee7ff00 */
138int num_directory_entries; /* number of directory entries to follow */
139int bytes_directory_entries; /* bytes of directory entries to follow */
140struct
141{
142 int offset; /* bytes offset into file for data chunk */
143 int flags; /* flags - for now 0 = uncompressed and clear, 1 = compressed and clear, 2 = uncompressed and ciphered, 3 = compressed and ciphered */
144 int size; /* size of the data chunk */
145 int data_size; /* size of the (uncompressed) data chunk */
146 int name_size; /* length in bytes of the name field */
147 char name[name_size]; /* name string (variable length) and \0 terminated */
148} directory[num_directory_entries];
149/* and now startes the data stream... */
150#endif /* if 0 */
151
152#if 0
153/* Version 3 */
154/* NB: all int's are stored in network byte order on disk */
155/* file format: */
156int magic; /* magic number ie 0x1ee70f42 */
157int num_directory_entries; /* number of directory entries to follow */
158int num_dictionary_entries; /* number of dictionary entries to follow */
159struct
160{
161 int data_offset; /* bytes offset into file for data chunk */
162 int size; /* size of the data chunk */
163 int data_size; /* size of the (uncompressed) data chunk */
164 int name_offset; /* bytes offset into file for name string */
165 int name_size; /* length in bytes of the name field */
166 int flags; /* bit flags - for now:
167 bit 0 => compresion on/off
168 bit 1 => ciphered on/off
169 bit 2 => alias
170 */
171} directory[num_directory_entries];
172struct
173{
174 int hash;
175 int offset;
176 int size;
177 int prev;
178 int next;
179} dictionary[num_dictionary_entries];
180/* now start the string stream. */
181/* and right after them the data stream. */
182int magic_sign; /* Optional, only if the eet file is signed. */
183int signature_length; /* Signature length. */
184int x509_length; /* Public certificate that signed the file. */
185char signature[signature_length]; /* The signature. */
186char x509[x509_length]; /* The public certificate. */
187#endif /* if 0 */
188
69/* 189/*
70 * variable and macros used for the eina_log module 190 * variable and macros used for the eina_log module
71 */ 191 */
@@ -178,6 +298,21 @@ Eet_Node *
178void 298void
179 eet_node_free(Eet_Node *node); 299 eet_node_free(Eet_Node *node);
180 300
301
302#define GENERIC_ALLOC_FREE_HEADER(TYPE, Type) \
303 TYPE *Type##_malloc(unsigned int); \
304 TYPE *Type##_calloc(unsigned int); \
305 void Type##_mp_free(TYPE *e);
306
307GENERIC_ALLOC_FREE_HEADER(Eet_File_Directory, eet_file_directory);
308GENERIC_ALLOC_FREE_HEADER(Eet_File_Node, eet_file_node);
309GENERIC_ALLOC_FREE_HEADER(Eet_File_Header, eet_file_header);
310GENERIC_ALLOC_FREE_HEADER(Eet_Dictionary, eet_dictionary);
311GENERIC_ALLOC_FREE_HEADER(Eet_File, eet_file);
312
313Eina_Bool eet_mempool_init(void);
314void eet_mempool_shutdown(void);
315
181#ifndef PATH_MAX 316#ifndef PATH_MAX
182# define PATH_MAX 4096 317# define PATH_MAX 4096
183#endif /* ifndef PATH_MAX */ 318#endif /* ifndef PATH_MAX */
diff --git a/libraries/eet/src/lib/Makefile.am b/libraries/eet/src/lib/Makefile.am
index 4633749..ae60168 100644
--- a/libraries/eet/src/lib/Makefile.am
+++ b/libraries/eet/src/lib/Makefile.am
@@ -22,6 +22,7 @@ includesdir = $(includedir)/eet-@VMAJ@
22lib_LTLIBRARIES = libeet.la 22lib_LTLIBRARIES = libeet.la
23 23
24base_sources = \ 24base_sources = \
25eet_alloc.c \
25eet_lib.c \ 26eet_lib.c \
26eet_data.c \ 27eet_data.c \
27eet_image.c \ 28eet_image.c \
diff --git a/libraries/eet/src/lib/Makefile.in b/libraries/eet/src/lib/Makefile.in
index f80bcd8..2a3fec0 100644
--- a/libraries/eet/src/lib/Makefile.in
+++ b/libraries/eet/src/lib/Makefile.in
@@ -80,13 +80,14 @@ am__base_list = \
80am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)" 80am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"
81LTLIBRARIES = $(lib_LTLIBRARIES) 81LTLIBRARIES = $(lib_LTLIBRARIES)
82libeet_la_DEPENDENCIES = 82libeet_la_DEPENDENCIES =
83am__libeet_la_SOURCES_DIST = eet_lib.c eet_data.c eet_image.c \ 83am__libeet_la_SOURCES_DIST = eet_alloc.c eet_lib.c eet_data.c \
84 eet_cipher.c eet_dictionary.c eet_node.c eet_utils.c \ 84 eet_image.c eet_cipher.c eet_dictionary.c eet_node.c \
85 eet_connection.c 85 eet_utils.c eet_connection.c
86am__objects_1 = libeet_la-eet_lib.lo libeet_la-eet_data.lo \ 86am__objects_1 = libeet_la-eet_alloc.lo libeet_la-eet_lib.lo \
87 libeet_la-eet_image.lo libeet_la-eet_cipher.lo \ 87 libeet_la-eet_data.lo libeet_la-eet_image.lo \
88 libeet_la-eet_dictionary.lo libeet_la-eet_node.lo \ 88 libeet_la-eet_cipher.lo libeet_la-eet_dictionary.lo \
89 libeet_la-eet_utils.lo libeet_la-eet_connection.lo 89 libeet_la-eet_node.lo libeet_la-eet_utils.lo \
90 libeet_la-eet_connection.lo
90@EET_AMALGAMATION_FALSE@am_libeet_la_OBJECTS = $(am__objects_1) 91@EET_AMALGAMATION_FALSE@am_libeet_la_OBJECTS = $(am__objects_1)
91@EET_AMALGAMATION_TRUE@nodist_libeet_la_OBJECTS = \ 92@EET_AMALGAMATION_TRUE@nodist_libeet_la_OBJECTS = \
92@EET_AMALGAMATION_TRUE@ libeet_la-eet_amalgamation.lo 93@EET_AMALGAMATION_TRUE@ libeet_la-eet_amalgamation.lo
@@ -210,8 +211,6 @@ PACKAGE_URL = @PACKAGE_URL@
210PACKAGE_VERSION = @PACKAGE_VERSION@ 211PACKAGE_VERSION = @PACKAGE_VERSION@
211PATH_SEPARATOR = @PATH_SEPARATOR@ 212PATH_SEPARATOR = @PATH_SEPARATOR@
212PKG_CONFIG = @PKG_CONFIG@ 213PKG_CONFIG = @PKG_CONFIG@
213PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
214PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
215RANLIB = @RANLIB@ 214RANLIB = @RANLIB@
216SED = @SED@ 215SED = @SED@
217SET_MAKE = @SET_MAKE@ 216SET_MAKE = @SET_MAKE@
@@ -299,6 +298,7 @@ includes_HEADERS = Eet.h
299includesdir = $(includedir)/eet-@VMAJ@ 298includesdir = $(includedir)/eet-@VMAJ@
300lib_LTLIBRARIES = libeet.la 299lib_LTLIBRARIES = libeet.la
301base_sources = \ 300base_sources = \
301eet_alloc.c \
302eet_lib.c \ 302eet_lib.c \
303eet_data.c \ 303eet_data.c \
304eet_image.c \ 304eet_image.c \
@@ -388,6 +388,7 @@ mostlyclean-compile:
388distclean-compile: 388distclean-compile:
389 -rm -f *.tab.c 389 -rm -f *.tab.c
390 390
391@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libeet_la-eet_alloc.Plo@am__quote@
391@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libeet_la-eet_amalgamation.Plo@am__quote@ 392@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libeet_la-eet_amalgamation.Plo@am__quote@
392@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libeet_la-eet_cipher.Plo@am__quote@ 393@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libeet_la-eet_cipher.Plo@am__quote@
393@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libeet_la-eet_connection.Plo@am__quote@ 394@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libeet_la-eet_connection.Plo@am__quote@
@@ -422,6 +423,14 @@ distclean-compile:
422@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 423@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
423@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< 424@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
424 425
426libeet_la-eet_alloc.lo: eet_alloc.c
427@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libeet_la_CFLAGS) $(CFLAGS) -MT libeet_la-eet_alloc.lo -MD -MP -MF $(DEPDIR)/libeet_la-eet_alloc.Tpo -c -o libeet_la-eet_alloc.lo `test -f 'eet_alloc.c' || echo '$(srcdir)/'`eet_alloc.c
428@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libeet_la-eet_alloc.Tpo $(DEPDIR)/libeet_la-eet_alloc.Plo
429@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
430@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='eet_alloc.c' object='libeet_la-eet_alloc.lo' libtool=yes @AMDEPBACKSLASH@
431@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
432@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libeet_la_CFLAGS) $(CFLAGS) -c -o libeet_la-eet_alloc.lo `test -f 'eet_alloc.c' || echo '$(srcdir)/'`eet_alloc.c
433
425libeet_la-eet_lib.lo: eet_lib.c 434libeet_la-eet_lib.lo: eet_lib.c
426@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libeet_la_CFLAGS) $(CFLAGS) -MT libeet_la-eet_lib.lo -MD -MP -MF $(DEPDIR)/libeet_la-eet_lib.Tpo -c -o libeet_la-eet_lib.lo `test -f 'eet_lib.c' || echo '$(srcdir)/'`eet_lib.c 435@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libeet_la_CFLAGS) $(CFLAGS) -MT libeet_la-eet_lib.lo -MD -MP -MF $(DEPDIR)/libeet_la-eet_lib.Tpo -c -o libeet_la-eet_lib.lo `test -f 'eet_lib.c' || echo '$(srcdir)/'`eet_lib.c
427@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libeet_la-eet_lib.Tpo $(DEPDIR)/libeet_la-eet_lib.Plo 436@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libeet_la-eet_lib.Tpo $(DEPDIR)/libeet_la-eet_lib.Plo
diff --git a/libraries/eet/src/lib/eet_alloc.c b/libraries/eet/src/lib/eet_alloc.c
new file mode 100644
index 0000000..85351ad
--- /dev/null
+++ b/libraries/eet/src/lib/eet_alloc.c
@@ -0,0 +1,93 @@
1#ifdef HAVE_CONFIG_H
2# include "config.h"
3#endif
4
5#include <Eina.h>
6#include "Eet.h"
7#include "Eet_private.h"
8
9typedef struct _Eet_Mempool Eet_Mempool;
10struct _Eet_Mempool
11{
12 const char *name;
13 Eina_Mempool *mp;
14 size_t size;
15};
16
17#define GENERIC_ALLOC_FREE(TYPE, Type) \
18 Eet_Mempool Type##_mp = { #TYPE, NULL, sizeof (TYPE) }; \
19 \
20 TYPE * \
21 Type##_malloc(unsigned int num) \
22 { \
23 return eina_mempool_malloc(Type##_mp.mp, num * sizeof (TYPE)); \
24 } \
25 TYPE * \
26 Type##_calloc(unsigned int num) \
27 { \
28 return eina_mempool_calloc(Type##_mp.mp, num * sizeof (TYPE)); \
29 } \
30 void \
31 Type##_mp_free(TYPE *e) \
32 { \
33 eina_mempool_free(Type##_mp.mp, e); \
34 }
35
36GENERIC_ALLOC_FREE(Eet_File_Directory, eet_file_directory);
37GENERIC_ALLOC_FREE(Eet_File_Node, eet_file_node);
38GENERIC_ALLOC_FREE(Eet_File_Header, eet_file_header);
39GENERIC_ALLOC_FREE(Eet_Dictionary, eet_dictionary);
40GENERIC_ALLOC_FREE(Eet_File, eet_file);
41
42static Eet_Mempool *mempool_array[] = {
43 &eet_file_directory_mp,
44 &eet_file_node_mp,
45 &eet_file_header_mp,
46 &eet_dictionary_mp,
47 &eet_file_mp,
48};
49
50Eina_Bool
51eet_mempool_init(void)
52{
53 const char *choice;
54 unsigned int i;
55
56 choice = getenv("EINA_MEMPOOL");
57 if ((!choice) || (!choice[0]))
58 choice = "chained_mempool";
59
60 for (i = 0; i < sizeof (mempool_array) / sizeof (mempool_array[0]); ++i)
61 {
62 retry:
63 mempool_array[i]->mp = eina_mempool_add(choice, mempool_array[i]->name, NULL, mempool_array[i]->size, 64);
64 if (!mempool_array[i]->mp)
65 {
66 if (!strcmp(choice, "pass_through"))
67 {
68 ERR("Falling back to pass through ! Previously tried '%s' mempool.", choice);
69 choice = "pass_through";
70 goto retry;
71 }
72 else
73 {
74 ERR("Impossible to allocate mempool '%s' !", choice);
75 return EINA_FALSE;
76 }
77 }
78 }
79 return EINA_TRUE;
80}
81
82void
83eet_mempool_shutdown(void)
84{
85 unsigned int i;
86
87 for (i = 0; i < sizeof (mempool_array) / sizeof (mempool_array[0]); ++i)
88 {
89 eina_mempool_del(mempool_array[i]->mp);
90 mempool_array[i]->mp = NULL;
91 }
92}
93
diff --git a/libraries/eet/src/lib/eet_cipher.c b/libraries/eet/src/lib/eet_cipher.c
index 89ee65d..37a0899 100644
--- a/libraries/eet/src/lib/eet_cipher.c
+++ b/libraries/eet/src/lib/eet_cipher.c
@@ -275,7 +275,7 @@ on_error:
275 cb = NULL; 275 cb = NULL;
276#endif /* ifdef HAVE_SIGNATURE */ 276#endif /* ifdef HAVE_SIGNATURE */
277 return NULL; 277 return NULL;
278} /* eet_identity_open */ 278}
279 279
280EAPI void 280EAPI void
281eet_identity_close(Eet_Key *key) 281eet_identity_close(Eet_Key *key)
@@ -295,7 +295,7 @@ eet_identity_close(Eet_Key *key)
295#else 295#else
296 key = NULL; 296 key = NULL;
297#endif /* ifdef HAVE_SIGNATURE */ 297#endif /* ifdef HAVE_SIGNATURE */
298} /* eet_identity_close */ 298}
299 299
300EAPI void 300EAPI void
301eet_identity_print(Eet_Key *key, 301eet_identity_print(Eet_Key *key,
@@ -419,7 +419,7 @@ on_error:
419 out = NULL; 419 out = NULL;
420 ERR("You need to compile signature support in EET."); 420 ERR("You need to compile signature support in EET.");
421#endif /* ifdef HAVE_SIGNATURE */ 421#endif /* ifdef HAVE_SIGNATURE */
422} /* eet_identity_print */ 422}
423 423
424void 424void
425eet_identity_ref(Eet_Key *key) 425eet_identity_ref(Eet_Key *key)
@@ -428,7 +428,7 @@ eet_identity_ref(Eet_Key *key)
428 return; 428 return;
429 429
430 key->references++; 430 key->references++;
431} /* eet_identity_ref */ 431}
432 432
433void 433void
434eet_identity_unref(Eet_Key *key) 434eet_identity_unref(Eet_Key *key)
@@ -438,7 +438,7 @@ eet_identity_unref(Eet_Key *key)
438 438
439 key->references--; 439 key->references--;
440 eet_identity_close(key); 440 eet_identity_close(key);
441} /* eet_identity_unref */ 441}
442 442
443void * 443void *
444eet_identity_compute_sha1(const void *data_base, 444eet_identity_compute_sha1(const void *data_base,
@@ -479,7 +479,7 @@ eet_identity_compute_sha1(const void *data_base,
479#endif /* ifdef HAVE_SIGNATURE */ 479#endif /* ifdef HAVE_SIGNATURE */
480 480
481 return result; 481 return result;
482} /* eet_identity_compute_sha1 */ 482}
483 483
484Eet_Error 484Eet_Error
485eet_identity_sign(FILE *fp, 485eet_identity_sign(FILE *fp,
@@ -650,7 +650,7 @@ on_error:
650 key = NULL; 650 key = NULL;
651 return EET_ERROR_NOT_IMPLEMENTED; 651 return EET_ERROR_NOT_IMPLEMENTED;
652#endif /* ifdef HAVE_SIGNATURE */ 652#endif /* ifdef HAVE_SIGNATURE */
653} /* eet_identity_sign */ 653}
654 654
655const void * 655const void *
656eet_identity_check(const void *data_base, 656eet_identity_check(const void *data_base,
@@ -830,7 +830,7 @@ eet_identity_check(const void *data_base,
830 x509_length = NULL; 830 x509_length = NULL;
831 return NULL; 831 return NULL;
832#endif /* ifdef HAVE_SIGNATURE */ 832#endif /* ifdef HAVE_SIGNATURE */
833} /* eet_identity_check */ 833}
834 834
835EAPI void 835EAPI void
836eet_identity_certificate_print(const unsigned char *certificate, 836eet_identity_certificate_print(const unsigned char *certificate,
@@ -896,7 +896,7 @@ on_error:
896 out = NULL; 896 out = NULL;
897 ERR("You need to compile signature support in EET."); 897 ERR("You need to compile signature support in EET.");
898#endif /* ifdef HAVE_SIGNATURE */ 898#endif /* ifdef HAVE_SIGNATURE */
899} /* eet_identity_certificate_print */ 899}
900 900
901Eet_Error 901Eet_Error
902eet_cipher(const void *data, 902eet_cipher(const void *data,
@@ -1073,7 +1073,7 @@ on_error:
1073 (void)result_length; 1073 (void)result_length;
1074 return EET_ERROR_NOT_IMPLEMENTED; 1074 return EET_ERROR_NOT_IMPLEMENTED;
1075#endif /* ifdef HAVE_CIPHER */ 1075#endif /* ifdef HAVE_CIPHER */
1076} /* eet_cipher */ 1076}
1077 1077
1078Eet_Error 1078Eet_Error
1079eet_decipher(const void *data, 1079eet_decipher(const void *data,
@@ -1224,7 +1224,7 @@ on_error:
1224 (void)result_length; 1224 (void)result_length;
1225 return EET_ERROR_NOT_IMPLEMENTED; 1225 return EET_ERROR_NOT_IMPLEMENTED;
1226#endif /* ifdef HAVE_CIPHER */ 1226#endif /* ifdef HAVE_CIPHER */
1227} /* eet_decipher */ 1227}
1228 1228
1229#ifdef HAVE_CIPHER 1229#ifdef HAVE_CIPHER
1230# ifdef HAVE_GNUTLS 1230# ifdef HAVE_GNUTLS
@@ -1265,7 +1265,7 @@ eet_hmac_sha1(const void *key,
1265 gcry_md_close(mdh); 1265 gcry_md_close(mdh);
1266 1266
1267 return 0; 1267 return 0;
1268} /* eet_hmac_sha1 */ 1268}
1269 1269
1270# endif /* ifdef HAVE_GNUTLS */ 1270# endif /* ifdef HAVE_GNUTLS */
1271 1271
@@ -1337,6 +1337,6 @@ eet_pbkdf2_sha1(const char *key,
1337 HMAC_cleanup(&hctx); 1337 HMAC_cleanup(&hctx);
1338# endif /* ifdef HAVE_GNUTLS */ 1338# endif /* ifdef HAVE_GNUTLS */
1339 return 0; 1339 return 0;
1340} /* eet_pbkdf2_sha1 */ 1340}
1341 1341
1342#endif /* ifdef HAVE_CIPHER */ 1342#endif /* ifdef HAVE_CIPHER */
diff --git a/libraries/eet/src/lib/eet_connection.c b/libraries/eet/src/lib/eet_connection.c
index 6171b7e..7b6b934 100644
--- a/libraries/eet/src/lib/eet_connection.c
+++ b/libraries/eet/src/lib/eet_connection.c
@@ -35,6 +35,8 @@ void *alloca(size_t);
35#include "Eet.h" 35#include "Eet.h"
36#include "Eet_private.h" 36#include "Eet_private.h"
37 37
38/* max message size: 1Mb - raised from original 64Kb */
39#define MAX_MSG_SIZE (1024 * 1024)
38#define MAGIC_EET_DATA_PACKET 0x4270ACE1 40#define MAGIC_EET_DATA_PACKET 0x4270ACE1
39 41
40struct _Eet_Connection 42struct _Eet_Connection
@@ -56,74 +58,62 @@ eet_connection_new(Eet_Read_Cb *eet_read_cb,
56 const void *user_data) 58 const void *user_data)
57{ 59{
58 Eet_Connection *conn; 60 Eet_Connection *conn;
59 61
60 if (!eet_read_cb || !eet_write_cb) 62 if ((!eet_read_cb) || (!eet_write_cb)) return NULL;
61 return NULL; 63
62
63 conn = calloc(1, sizeof (Eet_Connection)); 64 conn = calloc(1, sizeof (Eet_Connection));
64 if (!conn) 65 if (!conn) return NULL;
65 return NULL;
66
67 conn->eet_read_cb = eet_read_cb; 66 conn->eet_read_cb = eet_read_cb;
68 conn->eet_write_cb = eet_write_cb; 67 conn->eet_write_cb = eet_write_cb;
69 conn->user_data = (void *)user_data; 68 conn->user_data = (void *)user_data;
70
71 return conn; 69 return conn;
72} /* eet_connection_new */ 70}
73 71
74EAPI int 72EAPI int
75eet_connection_received(Eet_Connection *conn, 73eet_connection_received(Eet_Connection *conn,
76 const void *data, 74 const void *data,
77 size_t size) 75 size_t size)
78{ 76{
79 if ((!conn) || (!data) || (!size)) 77 if ((!conn) || (!data) || (!size)) return size;
80 return size; 78 do
81 79 {
82 do {
83 size_t copy_size; 80 size_t copy_size;
84 81
85 if (conn->size == 0) 82 if (conn->size == 0)
86 { 83 {
87 const int *msg; 84 const int *msg;
88 size_t packet_size; 85 size_t packet_size;
89 86
90 if (size < sizeof (int) * 2) 87 if (size < (sizeof(int) * 2)) break;
91 break;
92 88
93 msg = data; 89 msg = data;
94 /* Check the magic */ 90 /* Check the magic */
95 if (ntohl(msg[0]) != MAGIC_EET_DATA_PACKET) 91 if (ntohl(msg[0]) != MAGIC_EET_DATA_PACKET) break;
96 break;
97 92
98 packet_size = ntohl(msg[1]); 93 packet_size = ntohl(msg[1]);
99 /* Message should always be under 64K */ 94 /* Message should always be under MAX_MSG_SIZE */
100 if (packet_size > 64 * 1024) 95 if (packet_size > MAX_MSG_SIZE) break;
101 break;
102 96
103 data = (void *)(msg + 2); 97 data = (void *)(msg + 2);
104 size -= sizeof (int) * 2; 98 size -= sizeof(int) * 2;
105 if ((size_t)packet_size <= size) 99 if ((size_t)packet_size <= size)
106 { 100 {
107 /* Not a partial receive, go the quick way. */ 101 /* Not a partial receive, go the quick way. */
108 if (!conn->eet_read_cb(data, packet_size, conn->user_data)) 102 if (!conn->eet_read_cb(data, packet_size, conn->user_data))
109 break; 103 break;
110 104
111 data = (void *)((char *)data + packet_size); 105 data = (void *)((char *)data + packet_size);
112 size -= packet_size; 106 size -= packet_size;
113 107 conn->received = 0;
114 conn->received = 0; 108 continue;
115 continue;
116 } 109 }
117
118 conn->size = packet_size; 110 conn->size = packet_size;
119 if (conn->allocated < conn->size) 111 if (conn->allocated < conn->size)
120 { 112 {
121 void *tmp; 113 void *tmp;
122 114
123 tmp = realloc(conn->buffer, conn->size); 115 tmp = realloc(conn->buffer, conn->size);
124 if (!tmp) 116 if (!tmp) break;
125 break;
126
127 conn->buffer = tmp; 117 conn->buffer = tmp;
128 conn->allocated = conn->size; 118 conn->allocated = conn->size;
129 } 119 }
@@ -132,33 +122,33 @@ eet_connection_received(Eet_Connection *conn,
132 /* Partial receive */ 122 /* Partial receive */
133 copy_size = 123 copy_size =
134 (conn->size - conn->received >= 124 (conn->size - conn->received >=
135 size) ? size : conn->size - conn->received; 125 size) ? size : conn->size - conn->received;
136 memcpy((char *)conn->buffer + conn->received, data, copy_size); 126 memcpy((char *)conn->buffer + conn->received, data, copy_size);
137 127
138 conn->received += copy_size; 128 conn->received += copy_size;
139 data = (void *)((char *)data + copy_size); 129 data = (void *)((char *)data + copy_size);
140 size -= copy_size; 130 size -= copy_size;
141 131
142 if (conn->received == conn->size) 132 if (conn->received == conn->size)
143 { 133 {
144 size_t data_size; 134 size_t data_size;
145 135
146 data_size = conn->size; 136 data_size = conn->size;
147 conn->size = 0; 137 conn->size = 0;
148 conn->received = 0; 138 conn->received = 0;
149
150 /* Completed a packet. */ 139 /* Completed a packet. */
151 if (!conn->eet_read_cb(conn->buffer, data_size, conn->user_data)) 140 if (!conn->eet_read_cb(conn->buffer, data_size, conn->user_data))
152 { 141 {
153 /* Something goes wrong. Stop now. */ 142 /* Something goes wrong. Stop now. */
154 size += data_size; 143 size += data_size;
155 break; 144 break;
156 } 145 }
157 } 146 }
158 } while (size > 0); 147 }
159 148 while (size > 0);
149
160 return size; 150 return size;
161} /* eet_connection_received */ 151}
162 152
163static Eina_Bool 153static Eina_Bool
164_eet_connection_raw_send(Eet_Connection *conn, 154_eet_connection_raw_send(Eet_Connection *conn,
@@ -167,21 +157,17 @@ _eet_connection_raw_send(Eet_Connection *conn,
167{ 157{
168 int *message; 158 int *message;
169 159
170 /* Message should never be above 64K */ 160 /* Message should always be under MAX_MSG_SIZE */
171 if (data_size > 64 * 1024) 161 if (data_size > MAX_MSG_SIZE) return EINA_FALSE;
172 return EINA_FALSE; 162 message = alloca(data_size + (sizeof(int) * 2));
173
174 message = alloca(data_size + sizeof (int) * 2);
175 message[0] = htonl(MAGIC_EET_DATA_PACKET); 163 message[0] = htonl(MAGIC_EET_DATA_PACKET);
176 message[1] = htonl(data_size); 164 message[1] = htonl(data_size);
177
178 memcpy(message + 2, data, data_size); 165 memcpy(message + 2, data, data_size);
179
180 conn->eet_write_cb(message, 166 conn->eet_write_cb(message,
181 data_size + sizeof (int) * 2, 167 data_size + (sizeof(int) * 2),
182 conn->user_data); 168 conn->user_data);
183 return EINA_TRUE; 169 return EINA_TRUE;
184} /* _eet_connection_raw_send */ 170}
185 171
186EAPI Eina_Bool 172EAPI Eina_Bool
187eet_connection_send(Eet_Connection *conn, 173eet_connection_send(Eet_Connection *conn,
@@ -197,15 +183,11 @@ eet_connection_send(Eet_Connection *conn,
197 data_in, 183 data_in,
198 cipher_key, 184 cipher_key,
199 &data_size); 185 &data_size);
200 if (!flat_data) 186 if (!flat_data) return EINA_FALSE;
201 return EINA_FALSE; 187 if (_eet_connection_raw_send(conn, flat_data, data_size)) ret = EINA_TRUE;
202
203 if (_eet_connection_raw_send(conn, flat_data, data_size))
204 ret = EINA_TRUE;
205
206 free(flat_data); 188 free(flat_data);
207 return ret; 189 return ret;
208} /* eet_connection_send */ 190}
209 191
210EAPI Eina_Bool 192EAPI Eina_Bool
211eet_connection_node_send(Eet_Connection *conn, 193eet_connection_node_send(Eet_Connection *conn,
@@ -217,15 +199,12 @@ eet_connection_node_send(Eet_Connection *conn,
217 Eina_Bool ret = EINA_FALSE; 199 Eina_Bool ret = EINA_FALSE;
218 200
219 data = eet_data_node_encode_cipher(node, cipher_key, &data_size); 201 data = eet_data_node_encode_cipher(node, cipher_key, &data_size);
220 if (!data) 202 if (!data) return EINA_FALSE;
221 return EINA_FALSE;
222
223 if (_eet_connection_raw_send(conn, data, data_size)) 203 if (_eet_connection_raw_send(conn, data, data_size))
224 ret = EINA_TRUE; 204 ret = EINA_TRUE;
225
226 free(data); 205 free(data);
227 return ret; 206 return ret;
228} /* eet_connection_node_send */ 207}
229 208
230EAPI void * 209EAPI void *
231eet_connection_close(Eet_Connection *conn, 210eet_connection_close(Eet_Connection *conn,
@@ -233,17 +212,11 @@ eet_connection_close(Eet_Connection *conn,
233{ 212{
234 void *user_data; 213 void *user_data;
235 214
236 if (!conn) 215 if (!conn) return NULL;
237 return NULL; 216 if (on_going) *on_going = conn->received == 0 ? EINA_FALSE : EINA_TRUE;
238
239 if (on_going)
240 *on_going = conn->received == 0 ? EINA_FALSE : EINA_TRUE;
241
242 user_data = conn->user_data; 217 user_data = conn->user_data;
243
244 free(conn->buffer); 218 free(conn->buffer);
245 free(conn); 219 free(conn);
246
247 return user_data; 220 return user_data;
248} /* eet_connection_close */ 221}
249 222
diff --git a/libraries/eet/src/lib/eet_data.c b/libraries/eet/src/lib/eet_data.c
index 23b0b97..56b9ee0 100644
--- a/libraries/eet/src/lib/eet_data.c
+++ b/libraries/eet/src/lib/eet_data.c
@@ -651,7 +651,7 @@ eet_data_get_char(const Eet_Dictionary *ed __UNUSED__,
651 *d = *s; 651 *d = *s;
652 CONV8(*d); 652 CONV8(*d);
653 return sizeof(char); 653 return sizeof(char);
654} /* eet_data_get_char */ 654}
655 655
656static void * 656static void *
657eet_data_put_char(Eet_Dictionary *ed __UNUSED__, 657eet_data_put_char(Eet_Dictionary *ed __UNUSED__,
@@ -669,7 +669,7 @@ eet_data_put_char(Eet_Dictionary *ed __UNUSED__,
669 CONV8(*d); 669 CONV8(*d);
670 *size_ret = sizeof(char); 670 *size_ret = sizeof(char);
671 return d; 671 return d;
672} /* eet_data_put_char */ 672}
673 673
674/* SHORT TYPE */ 674/* SHORT TYPE */
675static int 675static int
@@ -687,7 +687,7 @@ eet_data_get_short(const Eet_Dictionary *ed __UNUSED__,
687 d = (short *)dst; 687 d = (short *)dst;
688 CONV16(*d); 688 CONV16(*d);
689 return sizeof(short); 689 return sizeof(short);
690} /* eet_data_get_short */ 690}
691 691
692static void * 692static void *
693eet_data_put_short(Eet_Dictionary *ed __UNUSED__, 693eet_data_put_short(Eet_Dictionary *ed __UNUSED__,
@@ -705,7 +705,7 @@ eet_data_put_short(Eet_Dictionary *ed __UNUSED__,
705 CONV16(*d); 705 CONV16(*d);
706 *size_ret = sizeof(short); 706 *size_ret = sizeof(short);
707 return d; 707 return d;
708} /* eet_data_put_short */ 708}
709 709
710/* INT TYPE */ 710/* INT TYPE */
711static inline int 711static inline int
@@ -723,7 +723,7 @@ eet_data_get_int(const Eet_Dictionary *ed __UNUSED__,
723 d = (int *)dst; 723 d = (int *)dst;
724 CONV32(*d); 724 CONV32(*d);
725 return sizeof(int); 725 return sizeof(int);
726} /* eet_data_get_int */ 726}
727 727
728static void * 728static void *
729eet_data_put_int(Eet_Dictionary *ed __UNUSED__, 729eet_data_put_int(Eet_Dictionary *ed __UNUSED__,
@@ -741,7 +741,7 @@ eet_data_put_int(Eet_Dictionary *ed __UNUSED__,
741 CONV32(*d); 741 CONV32(*d);
742 *size_ret = sizeof(int); 742 *size_ret = sizeof(int);
743 return d; 743 return d;
744} /* eet_data_put_int */ 744}
745 745
746/* LONG LONG TYPE */ 746/* LONG LONG TYPE */
747static int 747static int
@@ -759,7 +759,7 @@ eet_data_get_long_long(const Eet_Dictionary *ed __UNUSED__,
759 d = (unsigned long long *)dst; 759 d = (unsigned long long *)dst;
760 CONV64(*d); 760 CONV64(*d);
761 return sizeof(unsigned long long); 761 return sizeof(unsigned long long);
762} /* eet_data_get_long_long */ 762}
763 763
764static void * 764static void *
765eet_data_put_long_long(Eet_Dictionary *ed __UNUSED__, 765eet_data_put_long_long(Eet_Dictionary *ed __UNUSED__,
@@ -777,7 +777,7 @@ eet_data_put_long_long(Eet_Dictionary *ed __UNUSED__,
777 CONV64(*d); 777 CONV64(*d);
778 *size_ret = sizeof(unsigned long long); 778 *size_ret = sizeof(unsigned long long);
779 return d; 779 return d;
780} /* eet_data_put_long_long */ 780}
781 781
782/* STRING TYPE */ 782/* STRING TYPE */
783static inline int 783static inline int
@@ -796,7 +796,7 @@ eet_data_get_string_hash(const Eet_Dictionary *ed,
796 } 796 }
797 797
798 return -1; 798 return -1;
799} /* eet_data_get_string_hash */ 799}
800 800
801static inline int 801static inline int
802eet_data_get_string(const Eet_Dictionary *ed, 802eet_data_get_string(const Eet_Dictionary *ed,
@@ -833,7 +833,7 @@ eet_data_get_string(const Eet_Dictionary *ed,
833 833
834 *d = s; 834 *d = s;
835 return strlen(s) + 1; 835 return strlen(s) + 1;
836} /* eet_data_get_string */ 836}
837 837
838static void * 838static void *
839eet_data_put_string(Eet_Dictionary *ed, 839eet_data_put_string(Eet_Dictionary *ed,
@@ -871,7 +871,7 @@ eet_data_put_string(Eet_Dictionary *ed,
871 memcpy(d, s, len + 1); 871 memcpy(d, s, len + 1);
872 *size_ret = len + 1; 872 *size_ret = len + 1;
873 return d; 873 return d;
874} /* eet_data_put_string */ 874}
875 875
876/* ALWAYS INLINED STRING TYPE */ 876/* ALWAYS INLINED STRING TYPE */
877static int 877static int
@@ -881,7 +881,7 @@ eet_data_get_istring(const Eet_Dictionary *ed __UNUSED__,
881 void *dst) 881 void *dst)
882{ 882{
883 return eet_data_get_string(NULL, src, src_end, dst); 883 return eet_data_get_string(NULL, src, src_end, dst);
884} /* eet_data_get_istring */ 884}
885 885
886static void * 886static void *
887eet_data_put_istring(Eet_Dictionary *ed __UNUSED__, 887eet_data_put_istring(Eet_Dictionary *ed __UNUSED__,
@@ -889,7 +889,7 @@ eet_data_put_istring(Eet_Dictionary *ed __UNUSED__,
889 int *size_ret) 889 int *size_ret)
890{ 890{
891 return eet_data_put_string(NULL, src, size_ret); 891 return eet_data_put_string(NULL, src, size_ret);
892} /* eet_data_put_istring */ 892}
893 893
894/* ALWAYS NULL TYPE */ 894/* ALWAYS NULL TYPE */
895static int 895static int
@@ -904,7 +904,7 @@ eet_data_get_null(const Eet_Dictionary *ed __UNUSED__,
904 904
905 *d = NULL; 905 *d = NULL;
906 return 1; 906 return 1;
907} /* eet_data_get_null */ 907}
908 908
909static void * 909static void *
910eet_data_put_null(Eet_Dictionary *ed __UNUSED__, 910eet_data_put_null(Eet_Dictionary *ed __UNUSED__,
@@ -913,7 +913,7 @@ eet_data_put_null(Eet_Dictionary *ed __UNUSED__,
913{ 913{
914 *size_ret = 0; 914 *size_ret = 0;
915 return NULL; 915 return NULL;
916} /* eet_data_put_null */ 916}
917 917
918/** 918/**
919 * Fast lookups of simple doubles/floats. 919 * Fast lookups of simple doubles/floats.
@@ -941,7 +941,7 @@ _eet_data_float_cache_get(const char *s,
941 } 941 }
942 942
943 return 0; 943 return 0;
944} /* _eet_data_float_cache_get */ 944}
945 945
946static inline int 946static inline int
947_eet_data_double_cache_get(const char *s, 947_eet_data_double_cache_get(const char *s,
@@ -963,7 +963,7 @@ _eet_data_double_cache_get(const char *s,
963 } 963 }
964 964
965 return 0; 965 return 0;
966} /* _eet_data_double_cache_get */ 966}
967 967
968/* FLOAT TYPE */ 968/* FLOAT TYPE */
969static int 969static int
@@ -1006,7 +1006,7 @@ eet_data_get_float(const Eet_Dictionary *ed,
1006 return -1; 1006 return -1;
1007 1007
1008 return 1; 1008 return 1;
1009} /* eet_data_get_float */ 1009}
1010 1010
1011static void * 1011static void *
1012eet_data_put_float(Eet_Dictionary *ed, 1012eet_data_put_float(Eet_Dictionary *ed,
@@ -1038,7 +1038,7 @@ eet_data_put_float(Eet_Dictionary *ed,
1038 return NULL; 1038 return NULL;
1039 1039
1040 return eet_data_put_int(ed, &idx, size_ret); 1040 return eet_data_put_int(ed, &idx, size_ret);
1041} /* eet_data_put_float */ 1041}
1042 1042
1043/* DOUBLE TYPE */ 1043/* DOUBLE TYPE */
1044static int 1044static int
@@ -1082,7 +1082,7 @@ eet_data_get_double(const Eet_Dictionary *ed,
1082 return -1; 1082 return -1;
1083 1083
1084 return 1; 1084 return 1;
1085} /* eet_data_get_double */ 1085}
1086 1086
1087static void * 1087static void *
1088eet_data_put_double(Eet_Dictionary *ed, 1088eet_data_put_double(Eet_Dictionary *ed,
@@ -1115,7 +1115,7 @@ eet_data_put_double(Eet_Dictionary *ed,
1115 return NULL; 1115 return NULL;
1116 1116
1117 return eet_data_put_int(ed, &idx, size_ret); 1117 return eet_data_put_int(ed, &idx, size_ret);
1118} /* eet_data_put_double */ 1118}
1119 1119
1120static int 1120static int
1121eet_data_get_f32p32(const Eet_Dictionary *ed, 1121eet_data_get_f32p32(const Eet_Dictionary *ed,
@@ -1151,7 +1151,7 @@ eet_data_get_f32p32(const Eet_Dictionary *ed,
1151 return -1; 1151 return -1;
1152 1152
1153 return 1; 1153 return 1;
1154} /* eet_data_get_f32p32 */ 1154}
1155 1155
1156static void * 1156static void *
1157eet_data_put_f32p32(Eet_Dictionary *ed, 1157eet_data_put_f32p32(Eet_Dictionary *ed,
@@ -1184,7 +1184,7 @@ eet_data_put_f32p32(Eet_Dictionary *ed,
1184 return NULL; 1184 return NULL;
1185 1185
1186 return eet_data_put_int(ed, &idx, size_ret); 1186 return eet_data_put_int(ed, &idx, size_ret);
1187} /* eet_data_put_f32p32 */ 1187}
1188 1188
1189static int 1189static int
1190eet_data_get_f16p16(const Eet_Dictionary *ed, 1190eet_data_get_f16p16(const Eet_Dictionary *ed,
@@ -1202,7 +1202,7 @@ eet_data_get_f16p16(const Eet_Dictionary *ed,
1202 1202
1203 *fp = eina_f32p32_to_f16p16(tmp); 1203 *fp = eina_f32p32_to_f16p16(tmp);
1204 return 1; 1204 return 1;
1205} /* eet_data_get_f16p16 */ 1205}
1206 1206
1207static void * 1207static void *
1208eet_data_put_f16p16(Eet_Dictionary *ed, 1208eet_data_put_f16p16(Eet_Dictionary *ed,
@@ -1213,7 +1213,7 @@ eet_data_put_f16p16(Eet_Dictionary *ed,
1213 1213
1214 tmp = eina_f16p16_to_f32p32((Eina_F16p16)(*(Eina_F16p16 *)src)); 1214 tmp = eina_f16p16_to_f32p32((Eina_F16p16)(*(Eina_F16p16 *)src));
1215 return eet_data_put_f32p32(ed, &tmp, size_ret); 1215 return eet_data_put_f32p32(ed, &tmp, size_ret);
1216} /* eet_data_put_f16p16 */ 1216}
1217 1217
1218static int 1218static int
1219eet_data_get_f8p24(const Eet_Dictionary *ed, 1219eet_data_get_f8p24(const Eet_Dictionary *ed,
@@ -1231,7 +1231,7 @@ eet_data_get_f8p24(const Eet_Dictionary *ed,
1231 1231
1232 *fp = eina_f32p32_to_f8p24(tmp); 1232 *fp = eina_f32p32_to_f8p24(tmp);
1233 return 1; 1233 return 1;
1234} /* eet_data_get_f8p24 */ 1234}
1235 1235
1236static void * 1236static void *
1237eet_data_put_f8p24(Eet_Dictionary *ed, 1237eet_data_put_f8p24(Eet_Dictionary *ed,
@@ -1242,7 +1242,7 @@ eet_data_put_f8p24(Eet_Dictionary *ed,
1242 1242
1243 tmp = eina_f8p24_to_f32p32((Eina_F8p24)(*(Eina_F8p24 *)src)); 1243 tmp = eina_f8p24_to_f32p32((Eina_F8p24)(*(Eina_F8p24 *)src));
1244 return eet_data_put_f32p32(ed, &tmp, size_ret); 1244 return eet_data_put_f32p32(ed, &tmp, size_ret);
1245} /* eet_data_put_f8p24 */ 1245}
1246 1246
1247static inline int 1247static inline int
1248eet_data_get_type(const Eet_Dictionary *ed, 1248eet_data_get_type(const Eet_Dictionary *ed,
@@ -1255,7 +1255,7 @@ eet_data_get_type(const Eet_Dictionary *ed,
1255 1255
1256 ret = eet_basic_codec[type - 1].get(ed, src, src_end, dest); 1256 ret = eet_basic_codec[type - 1].get(ed, src, src_end, dest);
1257 return ret; 1257 return ret;
1258} /* eet_data_get_type */ 1258}
1259 1259
1260static inline void * 1260static inline void *
1261eet_data_put_type(Eet_Dictionary *ed, 1261eet_data_put_type(Eet_Dictionary *ed,
@@ -1267,7 +1267,7 @@ eet_data_put_type(Eet_Dictionary *ed,
1267 1267
1268 ret = eet_basic_codec[type - 1].put(ed, src, size_ret); 1268 ret = eet_basic_codec[type - 1].put(ed, src, size_ret);
1269 return ret; 1269 return ret;
1270} /* eet_data_put_type */ 1270}
1271 1271
1272static inline Eina_Bool 1272static inline Eina_Bool
1273eet_data_type_match(int type1, 1273eet_data_type_match(int type1,
@@ -1301,10 +1301,10 @@ eet_data_type_match(int type1,
1301 1301
1302 default: 1302 default:
1303 break; 1303 break;
1304 } /* switch */ 1304 }
1305 1305
1306 return EINA_FALSE; 1306 return EINA_FALSE;
1307} /* eet_data_type_match */ 1307}
1308 1308
1309/* chunk format... 1309/* chunk format...
1310 * 1310 *
@@ -1359,7 +1359,7 @@ case EET_I_ ## Type: chnk->type = EET_T_ ## Type; break;
1359 1359
1360 default: 1360 default:
1361 return; 1361 return;
1362 } /* switch */ 1362 }
1363 } 1363 }
1364 else if (chnk->type > EET_T_LAST) 1364 else if (chnk->type > EET_T_LAST)
1365 { 1365 {
@@ -1409,7 +1409,7 @@ case EET_I_ ## Type: chnk->type = EET_T_ ## Type; break;
1409 } 1409 }
1410 1410
1411 return; 1411 return;
1412} /* eet_data_chunk_get */ 1412}
1413 1413
1414static inline Eet_Data_Chunk * 1414static inline Eet_Data_Chunk *
1415eet_data_chunk_new(void *data, 1415eet_data_chunk_new(void *data,
@@ -1441,7 +1441,7 @@ eet_data_chunk_new(void *data,
1441 chnk->type = type; 1441 chnk->type = type;
1442 chnk->group_type = group_type; 1442 chnk->group_type = group_type;
1443 return chnk; 1443 return chnk;
1444} /* eet_data_chunk_new */ 1444}
1445 1445
1446static inline void 1446static inline void
1447eet_data_chunk_free(Eet_Data_Chunk *chnk) 1447eet_data_chunk_free(Eet_Data_Chunk *chnk)
@@ -1450,7 +1450,7 @@ eet_data_chunk_free(Eet_Data_Chunk *chnk)
1450 free(chnk->name); 1450 free(chnk->name);
1451 1451
1452 free(chnk); 1452 free(chnk);
1453} /* eet_data_chunk_free */ 1453}
1454 1454
1455static inline Eet_Data_Stream * 1455static inline Eet_Data_Stream *
1456eet_data_stream_new(void) 1456eet_data_stream_new(void)
@@ -1462,7 +1462,7 @@ eet_data_stream_new(void)
1462 return NULL; 1462 return NULL;
1463 1463
1464 return ds; 1464 return ds;
1465} /* eet_data_stream_new */ 1465}
1466 1466
1467static inline void 1467static inline void
1468eet_data_stream_free(Eet_Data_Stream *ds) 1468eet_data_stream_free(Eet_Data_Stream *ds)
@@ -1471,13 +1471,13 @@ eet_data_stream_free(Eet_Data_Stream *ds)
1471 free(ds->data); 1471 free(ds->data);
1472 1472
1473 free(ds); 1473 free(ds);
1474} /* eet_data_stream_free */ 1474}
1475 1475
1476static inline void 1476static inline void
1477eet_data_stream_flush(Eet_Data_Stream *ds) 1477eet_data_stream_flush(Eet_Data_Stream *ds)
1478{ 1478{
1479 free(ds); 1479 free(ds);
1480} /* eet_data_stream_flush */ 1480}
1481 1481
1482static inline void 1482static inline void
1483eet_data_stream_write(Eet_Data_Stream *ds, 1483eet_data_stream_write(Eet_Data_Stream *ds,
@@ -1502,7 +1502,7 @@ eet_data_stream_write(Eet_Data_Stream *ds,
1502 p = ds->data; 1502 p = ds->data;
1503 memcpy(p + ds->pos, data, size); 1503 memcpy(p + ds->pos, data, size);
1504 ds->pos += size; 1504 ds->pos += size;
1505} /* eet_data_stream_write */ 1505}
1506 1506
1507static void 1507static void
1508eet_data_chunk_put(Eet_Dictionary *ed, 1508eet_data_chunk_put(Eet_Dictionary *ed,
@@ -1541,7 +1541,7 @@ case EET_T_ ## Type: type += EET_I_ ## Type; break;
1541 1541
1542 default: 1542 default:
1543 return; 1543 return;
1544 } /* switch */ 1544 }
1545 1545
1546 buf[3] = type; 1546 buf[3] = type;
1547 } 1547 }
@@ -1578,7 +1578,7 @@ case EET_T_ ## Type: type += EET_I_ ## Type; break;
1578 free(string); 1578 free(string);
1579on_error: 1579on_error:
1580 free(size); 1580 free(size);
1581} /* eet_data_chunk_put */ 1581}
1582 1582
1583/*---*/ 1583/*---*/
1584 1584
@@ -1611,7 +1611,7 @@ _eet_descriptor_hash_new(Eet_Data_Descriptor *edd)
1611 edd->elements.hash.buckets[hash].next = bucket; 1611 edd->elements.hash.buckets[hash].next = bucket;
1612 } 1612 }
1613 } 1613 }
1614} /* _eet_descriptor_hash_new */ 1614}
1615 1615
1616static void 1616static void
1617_eet_descriptor_hash_free(Eet_Data_Descriptor *edd) 1617_eet_descriptor_hash_free(Eet_Data_Descriptor *edd)
@@ -1632,7 +1632,7 @@ _eet_descriptor_hash_free(Eet_Data_Descriptor *edd)
1632 } 1632 }
1633 if (edd->elements.hash.buckets) 1633 if (edd->elements.hash.buckets)
1634 free(edd->elements.hash.buckets); 1634 free(edd->elements.hash.buckets);
1635} /* _eet_descriptor_hash_free */ 1635}
1636 1636
1637static Eet_Data_Element * 1637static Eet_Data_Element *
1638_eet_descriptor_hash_find(Eet_Data_Descriptor *edd, 1638_eet_descriptor_hash_find(Eet_Data_Descriptor *edd,
@@ -1677,31 +1677,31 @@ _eet_descriptor_hash_find(Eet_Data_Descriptor *edd,
1677 bucket = bucket->next; 1677 bucket = bucket->next;
1678 } 1678 }
1679 return NULL; 1679 return NULL;
1680} /* _eet_descriptor_hash_find */ 1680}
1681 1681
1682static void * 1682static void *
1683_eet_mem_alloc(size_t size) 1683_eet_mem_alloc(size_t size)
1684{ 1684{
1685 return calloc(1, size); 1685 return calloc(1, size);
1686} /* _eet_mem_alloc */ 1686}
1687 1687
1688static void 1688static void
1689_eet_mem_free(void *mem) 1689_eet_mem_free(void *mem)
1690{ 1690{
1691 free(mem); 1691 free(mem);
1692} /* _eet_mem_free */ 1692}
1693 1693
1694static char * 1694static char *
1695_eet_str_alloc(const char *str) 1695_eet_str_alloc(const char *str)
1696{ 1696{
1697 return strdup(str); 1697 return strdup(str);
1698} /* _eet_str_alloc */ 1698}
1699 1699
1700static void 1700static void
1701_eet_str_free(const char *str) 1701_eet_str_free(const char *str)
1702{ 1702{
1703 free((char *)str); 1703 free((char *)str);
1704} /* _eet_str_free */ 1704}
1705 1705
1706static Eina_Hash * 1706static Eina_Hash *
1707_eet_eina_hash_add_alloc(Eina_Hash *hash, 1707_eet_eina_hash_add_alloc(Eina_Hash *hash,
@@ -1716,7 +1716,7 @@ _eet_eina_hash_add_alloc(Eina_Hash *hash,
1716 1716
1717 eina_hash_add(hash, key, data); 1717 eina_hash_add(hash, key, data);
1718 return hash; 1718 return hash;
1719} /* _eet_eina_hash_add_alloc */ 1719}
1720 1720
1721static Eina_Hash * 1721static Eina_Hash *
1722_eet_eina_hash_direct_add_alloc(Eina_Hash *hash, 1722_eet_eina_hash_direct_add_alloc(Eina_Hash *hash,
@@ -1731,18 +1731,18 @@ _eet_eina_hash_direct_add_alloc(Eina_Hash *hash,
1731 1731
1732 eina_hash_direct_add(hash, key, data); 1732 eina_hash_direct_add(hash, key, data);
1733 return hash; 1733 return hash;
1734} /* _eet_eina_hash_direct_add_alloc */ 1734}
1735 1735
1736static char * 1736static char *
1737_eet_str_direct_alloc(const char *str) 1737_eet_str_direct_alloc(const char *str)
1738{ 1738{
1739 return (char *)str; 1739 return (char *)str;
1740} /* _eet_str_direct_alloc */ 1740}
1741 1741
1742static void 1742static void
1743_eet_str_direct_free(const char *str __UNUSED__) 1743_eet_str_direct_free(const char *str __UNUSED__)
1744{ 1744{
1745} /* _eet_str_direct_free */ 1745}
1746 1746
1747static void 1747static void
1748_eet_eina_hash_foreach(void *hash, 1748_eet_eina_hash_foreach(void *hash,
@@ -1751,14 +1751,14 @@ _eet_eina_hash_foreach(void *hash,
1751{ 1751{
1752 if (hash) 1752 if (hash)
1753 eina_hash_foreach(hash, cb, fdata); 1753 eina_hash_foreach(hash, cb, fdata);
1754} /* _eet_eina_hash_foreach */ 1754}
1755 1755
1756static void 1756static void
1757_eet_eina_hash_free(void *hash) 1757_eet_eina_hash_free(void *hash)
1758{ 1758{
1759 if (hash) 1759 if (hash)
1760 eina_hash_free(hash); 1760 eina_hash_free(hash);
1761} /* _eet_eina_hash_free */ 1761}
1762 1762
1763/*---*/ 1763/*---*/
1764EAPI Eina_Bool 1764EAPI Eina_Bool
@@ -1792,7 +1792,7 @@ eet_eina_stream_data_descriptor_class_set(Eet_Data_Descriptor_Class *eddc,
1792 eddc->func.array_free = _eet_mem_free; 1792 eddc->func.array_free = _eet_mem_free;
1793 1793
1794 return EINA_TRUE; 1794 return EINA_TRUE;
1795} /* eet_eina_stream_data_descriptor_class_set */ 1795}
1796 1796
1797EAPI Eina_Bool 1797EAPI Eina_Bool
1798eet_eina_file_data_descriptor_class_set(Eet_Data_Descriptor_Class *eddc, 1798eet_eina_file_data_descriptor_class_set(Eet_Data_Descriptor_Class *eddc,
@@ -1811,7 +1811,7 @@ eet_eina_file_data_descriptor_class_set(Eet_Data_Descriptor_Class *eddc,
1811 eddc->func.str_direct_free = _eet_str_direct_free; 1811 eddc->func.str_direct_free = _eet_str_direct_free;
1812 1812
1813 return EINA_TRUE; 1813 return EINA_TRUE;
1814} /* eet_eina_file_data_descriptor_class_set */ 1814}
1815 1815
1816static Eet_Data_Descriptor * 1816static Eet_Data_Descriptor *
1817_eet_data_descriptor_new(const Eet_Data_Descriptor_Class *eddc, 1817_eet_data_descriptor_new(const Eet_Data_Descriptor_Class *eddc,
@@ -1872,7 +1872,7 @@ _eet_data_descriptor_new(const Eet_Data_Descriptor_Class *eddc,
1872 } 1872 }
1873 1873
1874 return edd; 1874 return edd;
1875} /* _eet_data_descriptor_new */ 1875}
1876 1876
1877EAPI Eet_Data_Descriptor * 1877EAPI Eet_Data_Descriptor *
1878eet_data_descriptor_new(const char *name, 1878eet_data_descriptor_new(const char *name,
@@ -1905,31 +1905,31 @@ eet_data_descriptor_new(const char *name,
1905 eddc.func.hash_free = func_hash_free; 1905 eddc.func.hash_free = func_hash_free;
1906 1906
1907 return _eet_data_descriptor_new(&eddc, 0); 1907 return _eet_data_descriptor_new(&eddc, 0);
1908} /* eet_data_descriptor_new */ 1908}
1909 1909
1910EAPI Eet_Data_Descriptor * 1910EAPI Eet_Data_Descriptor *
1911eet_data_descriptor2_new(const Eet_Data_Descriptor_Class *eddc) 1911eet_data_descriptor2_new(const Eet_Data_Descriptor_Class *eddc)
1912{ 1912{
1913 return _eet_data_descriptor_new(eddc, 1); 1913 return _eet_data_descriptor_new(eddc, 1);
1914} /* eet_data_descriptor2_new */ 1914}
1915 1915
1916EAPI Eet_Data_Descriptor * 1916EAPI Eet_Data_Descriptor *
1917eet_data_descriptor3_new(const Eet_Data_Descriptor_Class *eddc) 1917eet_data_descriptor3_new(const Eet_Data_Descriptor_Class *eddc)
1918{ 1918{
1919 return _eet_data_descriptor_new(eddc, 2); 1919 return _eet_data_descriptor_new(eddc, 2);
1920} /* eet_data_descriptor3_new */ 1920}
1921 1921
1922EAPI Eet_Data_Descriptor * 1922EAPI Eet_Data_Descriptor *
1923eet_data_descriptor_stream_new(const Eet_Data_Descriptor_Class *eddc) 1923eet_data_descriptor_stream_new(const Eet_Data_Descriptor_Class *eddc)
1924{ 1924{
1925 return _eet_data_descriptor_new(eddc, 1); 1925 return _eet_data_descriptor_new(eddc, 1);
1926} /* eet_data_descriptor_stream_new */ 1926}
1927 1927
1928EAPI Eet_Data_Descriptor * 1928EAPI Eet_Data_Descriptor *
1929eet_data_descriptor_file_new(const Eet_Data_Descriptor_Class *eddc) 1929eet_data_descriptor_file_new(const Eet_Data_Descriptor_Class *eddc)
1930{ 1930{
1931 return _eet_data_descriptor_new(eddc, 2); 1931 return _eet_data_descriptor_new(eddc, 2);
1932} /* eet_data_descriptor_file_new */ 1932}
1933 1933
1934EAPI void 1934EAPI void
1935eet_data_descriptor_free(Eet_Data_Descriptor *edd) 1935eet_data_descriptor_free(Eet_Data_Descriptor *edd)
@@ -1942,7 +1942,7 @@ eet_data_descriptor_free(Eet_Data_Descriptor *edd)
1942 free(edd->elements.set); 1942 free(edd->elements.set);
1943 1943
1944 free(edd); 1944 free(edd);
1945} /* eet_data_descriptor_free */ 1945}
1946 1946
1947EAPI void 1947EAPI void
1948eet_data_descriptor_element_add(Eet_Data_Descriptor *edd, 1948eet_data_descriptor_element_add(Eet_Data_Descriptor *edd,
@@ -2039,7 +2039,7 @@ eet_data_descriptor_element_add(Eet_Data_Descriptor *edd,
2039 ede->counter_name = counter_name; 2039 ede->counter_name = counter_name;
2040 2040
2041 ede->subtype = subtype; 2041 ede->subtype = subtype;
2042} /* eet_data_descriptor_element_add */ 2042}
2043 2043
2044EAPI void * 2044EAPI void *
2045eet_data_read_cipher(Eet_File *ef, 2045eet_data_read_cipher(Eet_File *ef,
@@ -2075,7 +2075,7 @@ eet_data_read_cipher(Eet_File *ef,
2075 free((void *)data); 2075 free((void *)data);
2076 2076
2077 return data_dec; 2077 return data_dec;
2078} /* eet_data_read_cipher */ 2078}
2079 2079
2080EAPI Eet_Node * 2080EAPI Eet_Node *
2081eet_data_node_read_cipher(Eet_File *ef, 2081eet_data_node_read_cipher(Eet_File *ef,
@@ -2110,7 +2110,7 @@ eet_data_node_read_cipher(Eet_File *ef,
2110 free((void *)data); 2110 free((void *)data);
2111 2111
2112 return result; 2112 return result;
2113} /* eet_data_node_read_cipher */ 2113}
2114 2114
2115EAPI void * 2115EAPI void *
2116eet_data_read(Eet_File *ef, 2116eet_data_read(Eet_File *ef,
@@ -2118,7 +2118,7 @@ eet_data_read(Eet_File *ef,
2118 const char *name) 2118 const char *name)
2119{ 2119{
2120 return eet_data_read_cipher(ef, edd, name, NULL); 2120 return eet_data_read_cipher(ef, edd, name, NULL);
2121} /* eet_data_read */ 2121}
2122 2122
2123EAPI int 2123EAPI int
2124eet_data_write_cipher(Eet_File *ef, 2124eet_data_write_cipher(Eet_File *ef,
@@ -2142,7 +2142,7 @@ eet_data_write_cipher(Eet_File *ef,
2142 val = eet_write_cipher(ef, name, data_enc, size, compress, cipher_key); 2142 val = eet_write_cipher(ef, name, data_enc, size, compress, cipher_key);
2143 free(data_enc); 2143 free(data_enc);
2144 return val; 2144 return val;
2145} /* eet_data_write_cipher */ 2145}
2146 2146
2147EAPI int 2147EAPI int
2148eet_data_write(Eet_File *ef, 2148eet_data_write(Eet_File *ef,
@@ -2152,7 +2152,7 @@ eet_data_write(Eet_File *ef,
2152 int compress) 2152 int compress)
2153{ 2153{
2154 return eet_data_write_cipher(ef, edd, name, NULL, data, compress); 2154 return eet_data_write_cipher(ef, edd, name, NULL, data, compress);
2155} /* eet_data_write */ 2155}
2156 2156
2157static void 2157static void
2158eet_free_context_init(Eet_Free_Context *context) 2158eet_free_context_init(Eet_Free_Context *context)
@@ -2222,7 +2222,7 @@ _eet_free_hash(void *data)
2222#endif /* if defined (_WIN64) || ((!defined (_WIN32)) && (LONG_BIT != 32)) */ 2222#endif /* if defined (_WIN64) || ((!defined (_WIN32)) && (LONG_BIT != 32)) */
2223 2223
2224 return hash & 0xFF; 2224 return hash & 0xFF;
2225} /* _eet_free_hash */ 2225}
2226 2226
2227static void 2227static void
2228_eet_free_add(Eet_Free *ef, 2228_eet_free_add(Eet_Free *ef,
@@ -2240,7 +2240,7 @@ _eet_free_add(Eet_Free *ef,
2240 return; 2240 return;
2241 2241
2242 eina_array_push(&ef->list[hash], data); 2242 eina_array_push(&ef->list[hash], data);
2243} /* _eet_free_add */ 2243}
2244 2244
2245#if 0 2245#if 0
2246static void 2246static void
@@ -2274,19 +2274,19 @@ _eet_free_reset(Eet_Free *ef)
2274 2274
2275 for (i = 0; i < EET_FREE_COUNT; ++i) 2275 for (i = 0; i < EET_FREE_COUNT; ++i)
2276 eina_array_clean(&ef->list[i]); 2276 eina_array_clean(&ef->list[i]);
2277} /* _eet_free_reset */ 2277}
2278 2278
2279static void 2279static void
2280_eet_free_ref(Eet_Free *ef) 2280_eet_free_ref(Eet_Free *ef)
2281{ 2281{
2282 ef->ref++; 2282 ef->ref++;
2283} /* _eet_free_ref */ 2283}
2284 2284
2285static void 2285static void
2286_eet_free_unref(Eet_Free *ef) 2286_eet_free_unref(Eet_Free *ef)
2287{ 2287{
2288 ef->ref--; 2288 ef->ref--;
2289} /* _eet_free_unref */ 2289}
2290 2290
2291#define _eet_freelist_add(Ctx, Data) _eet_free_add(&Ctx->freelist, Data); 2291#define _eet_freelist_add(Ctx, Data) _eet_free_add(&Ctx->freelist, Data);
2292#define _eet_freelist_del(Ctx, Data) _eet_free_del(&Ctx->freelist, Data); 2292#define _eet_freelist_del(Ctx, Data) _eet_free_del(&Ctx->freelist, Data);
@@ -2316,7 +2316,7 @@ _eet_freelist_free(Eet_Free_Context *context,
2316 free(track); 2316 free(track);
2317 } 2317 }
2318 _eet_free_reset(&context->freelist); 2318 _eet_free_reset(&context->freelist);
2319} /* _eet_freelist_free */ 2319}
2320 2320
2321#define _eet_freelist_array_add(Ctx, Data) _eet_free_add(&Ctx->freelist_array, Data); 2321#define _eet_freelist_array_add(Ctx, Data) _eet_free_add(&Ctx->freelist_array, Data);
2322#define _eet_freelist_array_del(Ctx, Data) _eet_free_del(&Ctx->freelist_array, Data); 2322#define _eet_freelist_array_del(Ctx, Data) _eet_free_del(&Ctx->freelist_array, Data);
@@ -2351,7 +2351,7 @@ _eet_freelist_array_free(Eet_Free_Context *context,
2351 free(track); 2351 free(track);
2352 } 2352 }
2353 _eet_free_reset(&context->freelist_array); 2353 _eet_free_reset(&context->freelist_array);
2354} /* _eet_freelist_array_free */ 2354}
2355 2355
2356#define _eet_freelist_list_add(Ctx, Data) _eet_free_add(&Ctx->freelist_list, Data); 2356#define _eet_freelist_list_add(Ctx, Data) _eet_free_add(&Ctx->freelist_list, Data);
2357#define _eet_freelist_list_del(Ctx, Data) _eet_free_del(&Ctx->freelist_list, Data); 2357#define _eet_freelist_list_del(Ctx, Data) _eet_free_del(&Ctx->freelist_list, Data);
@@ -2379,7 +2379,7 @@ _eet_freelist_list_free(Eet_Free_Context *context,
2379 edd->func.list_free(*((void **)(track))); 2379 edd->func.list_free(*((void **)(track)));
2380 } 2380 }
2381 _eet_free_reset(&context->freelist_list); 2381 _eet_free_reset(&context->freelist_list);
2382} /* _eet_freelist_list_free */ 2382}
2383 2383
2384#define _eet_freelist_str_add(Ctx, Data) _eet_free_add(&Ctx->freelist_str, Data); 2384#define _eet_freelist_str_add(Ctx, Data) _eet_free_add(&Ctx->freelist_str, Data);
2385#define _eet_freelist_str_del(Ctx, Data) _eet_free_del(&Ctx->freelist_str, Data); 2385#define _eet_freelist_str_del(Ctx, Data) _eet_free_del(&Ctx->freelist_str, Data);
@@ -2409,7 +2409,7 @@ _eet_freelist_str_free(Eet_Free_Context *context,
2409 free(track); 2409 free(track);
2410 } 2410 }
2411 _eet_free_reset(&context->freelist_str); 2411 _eet_free_reset(&context->freelist_str);
2412} /* _eet_freelist_str_free */ 2412}
2413 2413
2414#define _eet_freelist_direct_str_add(Ctx, Data) _eet_free_add(&Ctx->freelist_direct_str, Data); 2414#define _eet_freelist_direct_str_add(Ctx, Data) _eet_free_add(&Ctx->freelist_direct_str, Data);
2415#define _eet_freelist_direct_str_del(Ctx, Data) _eet_free_del(&Ctx->freelist_direct_str, Data); 2415#define _eet_freelist_direct_str_del(Ctx, Data) _eet_free_del(&Ctx->freelist_direct_str, Data);
@@ -2439,7 +2439,7 @@ _eet_freelist_direct_str_free(Eet_Free_Context *context,
2439 free(track); 2439 free(track);
2440 } 2440 }
2441 _eet_free_reset(&context->freelist_direct_str); 2441 _eet_free_reset(&context->freelist_direct_str);
2442} /* _eet_freelist_direct_str_free */ 2442}
2443 2443
2444#define _eet_freelist_hash_add(Ctx, Data) _eet_free_add(&Ctx->freelist_hash, Data); 2444#define _eet_freelist_hash_add(Ctx, Data) _eet_free_add(&Ctx->freelist_hash, Data);
2445#define _eet_freelist_hash_del(Ctx, Data) _eet_free_del(&Ctx->freelist_hash, Data); 2445#define _eet_freelist_hash_del(Ctx, Data) _eet_free_del(&Ctx->freelist_hash, Data);
@@ -2469,7 +2469,7 @@ _eet_freelist_hash_free(Eet_Free_Context *context,
2469 free(track); 2469 free(track);
2470 } 2470 }
2471 _eet_free_reset(&context->freelist_hash); 2471 _eet_free_reset(&context->freelist_hash);
2472} /* _eet_freelist_hash_free */ 2472}
2473 2473
2474static void 2474static void
2475_eet_freelist_all_ref(Eet_Free_Context *freelist_context) 2475_eet_freelist_all_ref(Eet_Free_Context *freelist_context)
@@ -2479,7 +2479,7 @@ _eet_freelist_all_ref(Eet_Free_Context *freelist_context)
2479 _eet_freelist_list_ref(freelist_context); 2479 _eet_freelist_list_ref(freelist_context);
2480 _eet_freelist_hash_ref(freelist_context); 2480 _eet_freelist_hash_ref(freelist_context);
2481 _eet_freelist_direct_str_ref(freelist_context); 2481 _eet_freelist_direct_str_ref(freelist_context);
2482} /* _eet_freelist_all_ref */ 2482}
2483 2483
2484static void 2484static void
2485_eet_freelist_all_unref(Eet_Free_Context *freelist_context) 2485_eet_freelist_all_unref(Eet_Free_Context *freelist_context)
@@ -2489,7 +2489,7 @@ _eet_freelist_all_unref(Eet_Free_Context *freelist_context)
2489 _eet_freelist_list_unref(freelist_context); 2489 _eet_freelist_list_unref(freelist_context);
2490 _eet_freelist_hash_unref(freelist_context); 2490 _eet_freelist_hash_unref(freelist_context);
2491 _eet_freelist_direct_str_unref(freelist_context); 2491 _eet_freelist_direct_str_unref(freelist_context);
2492} /* _eet_freelist_all_unref */ 2492}
2493 2493
2494static int 2494static int
2495eet_data_descriptor_encode_hash_cb(void *hash __UNUSED__, 2495eet_data_descriptor_encode_hash_cb(void *hash __UNUSED__,
@@ -2556,7 +2556,7 @@ eet_data_descriptor_encode_hash_cb(void *hash __UNUSED__,
2556 } 2556 }
2557 2557
2558 return 1; 2558 return 1;
2559} /* eet_data_descriptor_encode_hash_cb */ 2559}
2560 2560
2561static char * 2561static char *
2562_eet_data_dump_token_get(const char *src, 2562_eet_data_dump_token_get(const char *src,
@@ -2639,7 +2639,7 @@ _eet_data_dump_token_get(const char *src,
2639 free(tok); 2639 free(tok);
2640 2640
2641 return NULL; 2641 return NULL;
2642} /* _eet_data_dump_token_get */ 2642}
2643 2643
2644static void 2644static void
2645eet_data_encode(Eet_Dictionary *ed, 2645eet_data_encode(Eet_Dictionary *ed,
@@ -2663,7 +2663,7 @@ eet_data_encode(Eet_Dictionary *ed,
2663 eet_data_chunk_put(ed, echnk, ds); 2663 eet_data_chunk_put(ed, echnk, ds);
2664 eet_data_chunk_free(echnk); 2664 eet_data_chunk_free(echnk);
2665 free(data); 2665 free(data);
2666} /* eet_data_encode */ 2666}
2667 2667
2668static void * 2668static void *
2669_eet_data_dump_encode(int parent_type, 2669_eet_data_dump_encode(int parent_type,
@@ -2976,7 +2976,7 @@ case Eet_Type: \
2976 eet_data_chunk_free(chnk); 2976 eet_data_chunk_free(chnk);
2977 2977
2978 return cdata; 2978 return cdata;
2979} /* _eet_data_dump_encode */ 2979}
2980 2980
2981static void * 2981static void *
2982_eet_data_dump_parse(Eet_Dictionary *ed, 2982_eet_data_dump_parse(Eet_Dictionary *ed,
@@ -3238,7 +3238,7 @@ _eet_data_dump_parse(Eet_Dictionary *ed,
3238 } 3238 }
3239 3239
3240 return cdata; 3240 return cdata;
3241} /* _eet_data_dump_parse */ 3241}
3242 3242
3243#define NEXT_CHUNK(P, Size, Echnk, Ed) \ 3243#define NEXT_CHUNK(P, Size, Echnk, Ed) \
3244 { \ 3244 { \
@@ -3352,7 +3352,7 @@ _eet_data_descriptor_decode(Eet_Free_Context *context,
3352 case EET_G_VARIANT: 3352 case EET_G_VARIANT:
3353 default: 3353 default:
3354 goto error; 3354 goto error;
3355 } /* switch */ 3355 }
3356 } 3356 }
3357 3357
3358 while (size > 0) 3358 while (size > 0)
@@ -3477,7 +3477,7 @@ error:
3477 3477
3478 /* FIXME: Warn that something goes wrong here. */ 3478 /* FIXME: Warn that something goes wrong here. */
3479 return NULL; 3479 return NULL;
3480} /* _eet_data_descriptor_decode */ 3480}
3481 3481
3482static int 3482static int
3483eet_data_get_list(Eet_Free_Context *context, 3483eet_data_get_list(Eet_Free_Context *context,
@@ -3544,7 +3544,7 @@ eet_data_get_list(Eet_Free_Context *context,
3544 3544
3545on_error: 3545on_error:
3546 return 0; 3546 return 0;
3547} /* eet_data_get_list */ 3547}
3548 3548
3549static int 3549static int
3550eet_data_get_hash(Eet_Free_Context *context, 3550eet_data_get_hash(Eet_Free_Context *context,
@@ -3629,7 +3629,7 @@ eet_data_get_hash(Eet_Free_Context *context,
3629 3629
3630on_error: 3630on_error:
3631 return 0; 3631 return 0;
3632} /* eet_data_get_hash */ 3632}
3633 3633
3634/* var arrays and fixed arrays have to 3634/* var arrays and fixed arrays have to
3635 * get all chunks at once. for fixed arrays 3635 * get all chunks at once. for fixed arrays
@@ -3793,7 +3793,7 @@ on_error:
3793 eet_node_del(tmp); 3793 eet_node_del(tmp);
3794 3794
3795 return 0; 3795 return 0;
3796} /* eet_data_get_array */ 3796}
3797 3797
3798static void 3798static void
3799eet_data_put_union(Eet_Dictionary *ed, 3799eet_data_put_union(Eet_Dictionary *ed,
@@ -3849,7 +3849,7 @@ eet_data_put_union(Eet_Dictionary *ed,
3849 3849
3850 break; 3850 break;
3851 } 3851 }
3852} /* eet_data_put_union */ 3852}
3853 3853
3854static int 3854static int
3855eet_data_get_union(Eet_Free_Context *context, 3855eet_data_get_union(Eet_Free_Context *context,
@@ -3947,7 +3947,7 @@ eet_data_get_union(Eet_Free_Context *context,
3947 3947
3948on_error: 3948on_error:
3949 return 0; 3949 return 0;
3950} /* eet_data_get_union */ 3950}
3951 3951
3952static void 3952static void
3953eet_data_put_variant(Eet_Dictionary *ed, 3953eet_data_put_variant(Eet_Dictionary *ed,
@@ -4058,7 +4058,7 @@ eet_data_put_variant(Eet_Dictionary *ed,
4058 4058
4059 break; 4059 break;
4060 } 4060 }
4061} /* eet_data_put_variant */ 4061}
4062 4062
4063static int 4063static int
4064eet_data_get_variant(Eet_Free_Context *context, 4064eet_data_get_variant(Eet_Free_Context *context,
@@ -4213,7 +4213,7 @@ eet_data_get_variant(Eet_Free_Context *context,
4213 4213
4214on_error: 4214on_error:
4215 return 0; 4215 return 0;
4216} /* eet_data_get_variant */ 4216}
4217 4217
4218static Eet_Node * 4218static Eet_Node *
4219eet_data_node_simple_type(int type, 4219eet_data_node_simple_type(int type,
@@ -4249,8 +4249,8 @@ case Eet_Type: \
4249 default: 4249 default:
4250 ERR("Unknow type passed to eet_data_node_simple_type"); 4250 ERR("Unknow type passed to eet_data_node_simple_type");
4251 return NULL; 4251 return NULL;
4252 } /* switch */ 4252 }
4253} /* eet_data_node_simple_type */ 4253}
4254 4254
4255static int 4255static int
4256eet_data_get_unknown(Eet_Free_Context *context, 4256eet_data_get_unknown(Eet_Free_Context *context,
@@ -4366,7 +4366,7 @@ eet_data_get_unknown(Eet_Free_Context *context,
4366 } 4366 }
4367 4367
4368 return 1; 4368 return 1;
4369} /* eet_data_get_unknown */ 4369}
4370 4370
4371static void 4371static void
4372eet_data_put_array(Eet_Dictionary *ed, 4372eet_data_put_array(Eet_Dictionary *ed,
@@ -4442,7 +4442,7 @@ eet_data_put_array(Eet_Dictionary *ed,
4442 4442
4443 offset += subsize; 4443 offset += subsize;
4444 } 4444 }
4445} /* eet_data_put_array */ 4445}
4446 4446
4447static void 4447static void
4448eet_data_put_unknown(Eet_Dictionary *ed, 4448eet_data_put_unknown(Eet_Dictionary *ed,
@@ -4471,7 +4471,7 @@ eet_data_put_unknown(Eet_Dictionary *ed,
4471 size, 4471 size,
4472 ede->type, 4472 ede->type,
4473 ede->group_type); 4473 ede->group_type);
4474} /* eet_data_put_unknown */ 4474}
4475 4475
4476static void 4476static void
4477eet_data_put_list(Eet_Dictionary *ed, 4477eet_data_put_list(Eet_Dictionary *ed,
@@ -4512,7 +4512,7 @@ eet_data_put_list(Eet_Dictionary *ed,
4512 ede->group_type); 4512 ede->group_type);
4513 } 4513 }
4514 } 4514 }
4515} /* eet_data_put_list */ 4515}
4516 4516
4517static void 4517static void
4518eet_data_put_hash(Eet_Dictionary *ed, 4518eet_data_put_hash(Eet_Dictionary *ed,
@@ -4529,7 +4529,7 @@ eet_data_put_hash(Eet_Dictionary *ed,
4529 fdata.ede = ede; 4529 fdata.ede = ede;
4530 fdata.ed = ed; 4530 fdata.ed = ed;
4531 edd->func.hash_foreach(l, eet_data_descriptor_encode_hash_cb, &fdata); 4531 edd->func.hash_foreach(l, eet_data_descriptor_encode_hash_cb, &fdata);
4532} /* eet_data_put_hash */ 4532}
4533 4533
4534EAPI int 4534EAPI int
4535eet_data_dump_cipher(Eet_File *ef, 4535eet_data_dump_cipher(Eet_File *ef,
@@ -4570,7 +4570,7 @@ eet_data_dump_cipher(Eet_File *ef,
4570 free((void *)data); 4570 free((void *)data);
4571 4571
4572 return result ? 1 : 0; 4572 return result ? 1 : 0;
4573} /* eet_data_dump_cipher */ 4573}
4574 4574
4575EAPI int 4575EAPI int
4576eet_data_dump(Eet_File *ef, 4576eet_data_dump(Eet_File *ef,
@@ -4579,7 +4579,7 @@ eet_data_dump(Eet_File *ef,
4579 void *dumpdata) 4579 void *dumpdata)
4580{ 4580{
4581 return eet_data_dump_cipher(ef, name, NULL, dumpfunc, dumpdata); 4581 return eet_data_dump_cipher(ef, name, NULL, dumpfunc, dumpdata);
4582} /* eet_data_dump */ 4582}
4583 4583
4584EAPI int 4584EAPI int
4585eet_data_text_dump_cipher(const void *data_in, 4585eet_data_text_dump_cipher(const void *data_in,
@@ -4624,7 +4624,7 @@ eet_data_text_dump_cipher(const void *data_in,
4624 free(ret); 4624 free(ret);
4625 4625
4626 return result ? 1 : 0; 4626 return result ? 1 : 0;
4627} /* eet_data_text_dump_cipher */ 4627}
4628 4628
4629EAPI int 4629EAPI int
4630eet_data_text_dump(const void *data_in, 4630eet_data_text_dump(const void *data_in,
@@ -4633,7 +4633,7 @@ eet_data_text_dump(const void *data_in,
4633 void *dumpdata) 4633 void *dumpdata)
4634{ 4634{
4635 return eet_data_text_dump_cipher(data_in, NULL, size_in, dumpfunc, dumpdata); 4635 return eet_data_text_dump_cipher(data_in, NULL, size_in, dumpfunc, dumpdata);
4636} /* eet_data_text_dump */ 4636}
4637 4637
4638EAPI void * 4638EAPI void *
4639eet_data_text_undump_cipher(const char *text, 4639eet_data_text_undump_cipher(const char *text,
@@ -4666,7 +4666,7 @@ eet_data_text_undump_cipher(const char *text,
4666 } 4666 }
4667 4667
4668 return ret; 4668 return ret;
4669} /* eet_data_text_undump_cipher */ 4669}
4670 4670
4671EAPI void * 4671EAPI void *
4672eet_data_text_undump(const char *text, 4672eet_data_text_undump(const char *text,
@@ -4674,7 +4674,7 @@ eet_data_text_undump(const char *text,
4674 int *size_ret) 4674 int *size_ret)
4675{ 4675{
4676 return eet_data_text_undump_cipher(text, NULL, textlen, size_ret); 4676 return eet_data_text_undump_cipher(text, NULL, textlen, size_ret);
4677} /* eet_data_text_undump */ 4677}
4678 4678
4679EAPI int 4679EAPI int
4680eet_data_undump_cipher(Eet_File *ef, 4680eet_data_undump_cipher(Eet_File *ef,
@@ -4698,7 +4698,7 @@ eet_data_undump_cipher(Eet_File *ef,
4698 val = eet_write_cipher(ef, name, data_enc, size, compress, cipher_key); 4698 val = eet_write_cipher(ef, name, data_enc, size, compress, cipher_key);
4699 free(data_enc); 4699 free(data_enc);
4700 return val; 4700 return val;
4701} /* eet_data_undump_cipher */ 4701}
4702 4702
4703EAPI int 4703EAPI int
4704eet_data_undump(Eet_File *ef, 4704eet_data_undump(Eet_File *ef,
@@ -4708,7 +4708,7 @@ eet_data_undump(Eet_File *ef,
4708 int compress) 4708 int compress)
4709{ 4709{
4710 return eet_data_undump_cipher(ef, name, NULL, text, textlen, compress); 4710 return eet_data_undump_cipher(ef, name, NULL, text, textlen, compress);
4711} /* eet_data_undump */ 4711}
4712 4712
4713EAPI void * 4713EAPI void *
4714eet_data_descriptor_decode_cipher(Eet_Data_Descriptor *edd, 4714eet_data_descriptor_decode_cipher(Eet_Data_Descriptor *edd,
@@ -4744,7 +4744,7 @@ eet_data_descriptor_decode_cipher(Eet_Data_Descriptor *edd,
4744 free(deciphered); 4744 free(deciphered);
4745 4745
4746 return ret; 4746 return ret;
4747} /* eet_data_descriptor_decode_cipher */ 4747}
4748 4748
4749EAPI void * 4749EAPI void *
4750eet_data_descriptor_decode(Eet_Data_Descriptor *edd, 4750eet_data_descriptor_decode(Eet_Data_Descriptor *edd,
@@ -4752,7 +4752,7 @@ eet_data_descriptor_decode(Eet_Data_Descriptor *edd,
4752 int size_in) 4752 int size_in)
4753{ 4753{
4754 return eet_data_descriptor_decode_cipher(edd, data_in, NULL, size_in); 4754 return eet_data_descriptor_decode_cipher(edd, data_in, NULL, size_in);
4755} /* eet_data_descriptor_decode */ 4755}
4756 4756
4757EAPI Eet_Node * 4757EAPI Eet_Node *
4758eet_data_node_decode_cipher(const void *data_in, 4758eet_data_node_decode_cipher(const void *data_in,
@@ -4787,7 +4787,7 @@ eet_data_node_decode_cipher(const void *data_in,
4787 free(deciphered); 4787 free(deciphered);
4788 4788
4789 return ret; 4789 return ret;
4790} /* eet_data_node_decode_cipher */ 4790}
4791 4791
4792static void * 4792static void *
4793_eet_data_descriptor_encode(Eet_Dictionary *ed, 4793_eet_data_descriptor_encode(Eet_Dictionary *ed,
@@ -4849,7 +4849,7 @@ _eet_data_descriptor_encode(Eet_Dictionary *ed,
4849 eet_data_chunk_free(chnk); 4849 eet_data_chunk_free(chnk);
4850 4850
4851 return cdata; 4851 return cdata;
4852} /* _eet_data_descriptor_encode */ 4852}
4853 4853
4854EAPI int 4854EAPI int
4855eet_data_node_write_cipher(Eet_File *ef, 4855eet_data_node_write_cipher(Eet_File *ef,
@@ -4872,7 +4872,7 @@ eet_data_node_write_cipher(Eet_File *ef,
4872 val = eet_write_cipher(ef, name, data_enc, size, compress, cipher_key); 4872 val = eet_write_cipher(ef, name, data_enc, size, compress, cipher_key);
4873 free(data_enc); 4873 free(data_enc);
4874 return val; 4874 return val;
4875} /* eet_data_node_write_cipher */ 4875}
4876 4876
4877EAPI void * 4877EAPI void *
4878eet_data_node_encode_cipher(Eet_Node *node, 4878eet_data_node_encode_cipher(Eet_Node *node,
@@ -4909,7 +4909,7 @@ eet_data_node_encode_cipher(Eet_Node *node,
4909 *size_ret = size; 4909 *size_ret = size;
4910 4910
4911 return ret; 4911 return ret;
4912} /* eet_data_node_encode_cipher */ 4912}
4913 4913
4914EAPI void * 4914EAPI void *
4915eet_data_descriptor_encode_cipher(Eet_Data_Descriptor *edd, 4915eet_data_descriptor_encode_cipher(Eet_Data_Descriptor *edd,
@@ -4947,7 +4947,7 @@ eet_data_descriptor_encode_cipher(Eet_Data_Descriptor *edd,
4947 *size_ret = size; 4947 *size_ret = size;
4948 4948
4949 return ret; 4949 return ret;
4950} /* eet_data_descriptor_encode_cipher */ 4950}
4951 4951
4952EAPI void * 4952EAPI void *
4953eet_data_descriptor_encode(Eet_Data_Descriptor *edd, 4953eet_data_descriptor_encode(Eet_Data_Descriptor *edd,
@@ -4955,7 +4955,7 @@ eet_data_descriptor_encode(Eet_Data_Descriptor *edd,
4955 int *size_ret) 4955 int *size_ret)
4956{ 4956{
4957 return eet_data_descriptor_encode_cipher(edd, data_in, NULL, size_ret); 4957 return eet_data_descriptor_encode_cipher(edd, data_in, NULL, size_ret);
4958} /* eet_data_descriptor_encode */ 4958}
4959 4959
4960EAPI void * 4960EAPI void *
4961eet_data_xattr_cipher_get(const char *filename, 4961eet_data_xattr_cipher_get(const char *filename,
diff --git a/libraries/eet/src/lib/eet_dictionary.c b/libraries/eet/src/lib/eet_dictionary.c
index 60d0ec1..287860d 100644
--- a/libraries/eet/src/lib/eet_dictionary.c
+++ b/libraries/eet/src/lib/eet_dictionary.c
@@ -16,34 +16,33 @@ eet_dictionary_add(void)
16{ 16{
17 Eet_Dictionary *new; 17 Eet_Dictionary *new;
18 18
19 new = calloc(1, sizeof (Eet_Dictionary)); 19 new = eet_dictionary_calloc(1);
20 if (!new) 20 if (!new)
21 return NULL; 21 return NULL;
22 22
23 memset(new->hash, -1, sizeof (int) * 256); 23 memset(new->hash, -1, sizeof (int) * 256);
24 24
25 return new; 25 return new;
26} /* eet_dictionary_add */ 26}
27 27
28void 28void
29eet_dictionary_free(Eet_Dictionary *ed) 29eet_dictionary_free(Eet_Dictionary *ed)
30{ 30{
31 if (ed) 31 int i;
32 {
33 int i;
34 32
35 for (i = 0; i < ed->count; ++i) 33 if (!ed) return;
36 if (ed->all[i].allocated)
37 eina_stringshare_del(ed->all[i].str);
38 34
39 if (ed->all) 35 for (i = 0; i < ed->count; ++i)
40 free(ed->all); 36 if (ed->all[i].allocated)
37 eina_stringshare_del(ed->all[i].str);
41 38
42 if (ed->converts) eina_hash_free(ed->converts); 39 if (ed->all)
40 free(ed->all);
43 41
44 free(ed); 42 if (ed->converts) eina_hash_free(ed->converts);
45 } 43
46} /* eet_dictionary_free */ 44 eet_dictionary_mp_free(ed);
45}
47 46
48static int 47static int
49_eet_dictionary_lookup(Eet_Dictionary *ed, 48_eet_dictionary_lookup(Eet_Dictionary *ed,
@@ -77,7 +76,7 @@ _eet_dictionary_lookup(Eet_Dictionary *ed,
77 return prev; 76 return prev;
78 77
79 return current; 78 return current;
80} /* _eet_dictionary_lookup */ 79}
81 80
82int 81int
83eet_dictionary_string_add(Eet_Dictionary *ed, 82eet_dictionary_string_add(Eet_Dictionary *ed,
@@ -110,7 +109,7 @@ eet_dictionary_string_add(Eet_Dictionary *ed,
110 109
111 total = ed->total + 8; 110 total = ed->total + 8;
112 111
113 new = realloc(ed->all, sizeof (Eet_String) * total); 112 new = realloc(ed->all, total * sizeof(Eet_String));
114 if (!new) 113 if (!new)
115 return -1; 114 return -1;
116 115
@@ -152,7 +151,7 @@ eet_dictionary_string_add(Eet_Dictionary *ed,
152 } 151 }
153 152
154 return ed->count++; 153 return ed->count++;
155} /* eet_dictionary_string_add */ 154}
156 155
157int 156int
158eet_dictionary_string_get_size(const Eet_Dictionary *ed, 157eet_dictionary_string_get_size(const Eet_Dictionary *ed,
@@ -168,7 +167,7 @@ eet_dictionary_string_get_size(const Eet_Dictionary *ed,
168 return ed->all[idx].len; 167 return ed->all[idx].len;
169 168
170 return 0; 169 return 0;
171} /* eet_dictionary_string_get_size */ 170}
172 171
173int 172int
174eet_dictionary_string_get_hash(const Eet_Dictionary *ed, 173eet_dictionary_string_get_hash(const Eet_Dictionary *ed,
@@ -184,7 +183,7 @@ eet_dictionary_string_get_hash(const Eet_Dictionary *ed,
184 return ed->all[idx].hash; 183 return ed->all[idx].hash;
185 184
186 return -1; 185 return -1;
187} /* eet_dictionary_string_get_hash */ 186}
188 187
189const char * 188const char *
190eet_dictionary_string_get_char(const Eet_Dictionary *ed, 189eet_dictionary_string_get_char(const Eet_Dictionary *ed,
@@ -210,7 +209,7 @@ eet_dictionary_string_get_char(const Eet_Dictionary *ed,
210 } 209 }
211 210
212 return NULL; 211 return NULL;
213} /* eet_dictionary_string_get_char */ 212}
214 213
215static inline Eina_Bool 214static inline Eina_Bool
216_eet_dictionary_string_get_me_cache(const char *s, 215_eet_dictionary_string_get_me_cache(const char *s,
@@ -227,7 +226,7 @@ _eet_dictionary_string_get_me_cache(const char *s,
227 } 226 }
228 227
229 return EINA_FALSE; 228 return EINA_FALSE;
230} /* _eet_dictionary_string_get_me_cache */ 229}
231 230
232static inline Eina_Bool 231static inline Eina_Bool
233_eet_dictionary_string_get_float_cache(const char *s, 232_eet_dictionary_string_get_float_cache(const char *s,
@@ -248,7 +247,7 @@ _eet_dictionary_string_get_float_cache(const char *s,
248 } 247 }
249 248
250 return EINA_FALSE; 249 return EINA_FALSE;
251} /* _eet_dictionary_string_get_float_cache */ 250}
252 251
253static inline Eina_Bool 252static inline Eina_Bool
254_eet_dictionary_string_get_double_cache(const char *s, 253_eet_dictionary_string_get_double_cache(const char *s,
@@ -269,7 +268,7 @@ _eet_dictionary_string_get_double_cache(const char *s,
269 } 268 }
270 269
271 return EINA_FALSE; 270 return EINA_FALSE;
272} /* _eet_dictionary_string_get_double_cache */ 271}
273 272
274static inline Eina_Bool 273static inline Eina_Bool
275_eet_dictionary_test(const Eet_Dictionary *ed, 274_eet_dictionary_test(const Eet_Dictionary *ed,
@@ -289,7 +288,7 @@ _eet_dictionary_test(const Eet_Dictionary *ed,
289 return EINA_FALSE; 288 return EINA_FALSE;
290 289
291 return EINA_TRUE; 290 return EINA_TRUE;
292} /* _eet_dictionary_test */ 291}
293 292
294static Eet_Convert * 293static Eet_Convert *
295eet_dictionary_convert_get(const Eet_Dictionary *ed, 294eet_dictionary_convert_get(const Eet_Dictionary *ed,
@@ -351,7 +350,7 @@ eet_dictionary_string_get_float(const Eet_Dictionary *ed,
351 350
352 *result = convert->f; 351 *result = convert->f;
353 return EINA_TRUE; 352 return EINA_TRUE;
354} /* eet_dictionary_string_get_float */ 353}
355 354
356Eina_Bool 355Eina_Bool
357eet_dictionary_string_get_double(const Eet_Dictionary *ed, 356eet_dictionary_string_get_double(const Eet_Dictionary *ed,
@@ -387,7 +386,7 @@ eet_dictionary_string_get_double(const Eet_Dictionary *ed,
387 386
388 *result = convert->d; 387 *result = convert->d;
389 return EINA_TRUE; 388 return EINA_TRUE;
390} /* eet_dictionary_string_get_double */ 389}
391 390
392Eina_Bool 391Eina_Bool
393eet_dictionary_string_get_fp(const Eet_Dictionary *ed, 392eet_dictionary_string_get_fp(const Eet_Dictionary *ed,
@@ -416,7 +415,7 @@ eet_dictionary_string_get_fp(const Eet_Dictionary *ed,
416 415
417 *result = convert->fp; 416 *result = convert->fp;
418 return EINA_TRUE; 417 return EINA_TRUE;
419} /* eet_dictionary_string_get_fp */ 418}
420 419
421EAPI int 420EAPI int
422eet_dictionary_string_check(Eet_Dictionary *ed, 421eet_dictionary_string_check(Eet_Dictionary *ed,
@@ -435,5 +434,5 @@ eet_dictionary_string_check(Eet_Dictionary *ed,
435 return 1; 434 return 1;
436 435
437 return 0; 436 return 0;
438} /* eet_dictionary_string_check */ 437}
439 438
diff --git a/libraries/eet/src/lib/eet_image.c b/libraries/eet/src/lib/eet_image.c
index 79f6f90..8c6c03c 100644
--- a/libraries/eet/src/lib/eet_image.c
+++ b/libraries/eet/src/lib/eet_image.c
@@ -66,7 +66,7 @@ _eet_jpeg_membuf_src_init(j_decompress_ptr cinfo)
66{ 66{
67 /* FIXME: Use attribute unused */ 67 /* FIXME: Use attribute unused */
68 (void)cinfo; 68 (void)cinfo;
69} /* _eet_jpeg_membuf_src_init */ 69}
70 70
71static boolean 71static boolean
72_eet_jpeg_membuf_src_fill(j_decompress_ptr cinfo) 72_eet_jpeg_membuf_src_fill(j_decompress_ptr cinfo)
@@ -78,7 +78,7 @@ _eet_jpeg_membuf_src_fill(j_decompress_ptr cinfo)
78 src->pub.next_input_byte = jpeg_eoi; 78 src->pub.next_input_byte = jpeg_eoi;
79 79
80 return TRUE; 80 return TRUE;
81} /* _eet_jpeg_membuf_src_fill */ 81}
82 82
83static void 83static void
84_eet_jpeg_membuf_src_skip(j_decompress_ptr cinfo, 84_eet_jpeg_membuf_src_skip(j_decompress_ptr cinfo,
@@ -88,7 +88,7 @@ _eet_jpeg_membuf_src_skip(j_decompress_ptr cinfo,
88 88
89 src->pub.bytes_in_buffer -= num_bytes; 89 src->pub.bytes_in_buffer -= num_bytes;
90 src->pub.next_input_byte += num_bytes; 90 src->pub.next_input_byte += num_bytes;
91} /* _eet_jpeg_membuf_src_skip */ 91}
92 92
93static void 93static void
94_eet_jpeg_membuf_src_term(j_decompress_ptr cinfo) 94_eet_jpeg_membuf_src_term(j_decompress_ptr cinfo)
@@ -97,7 +97,7 @@ _eet_jpeg_membuf_src_term(j_decompress_ptr cinfo)
97 97
98 free(src); 98 free(src);
99 cinfo->src = NULL; 99 cinfo->src = NULL;
100} /* _eet_jpeg_membuf_src_term */ 100}
101 101
102static int 102static int
103eet_jpeg_membuf_src(j_decompress_ptr cinfo, 103eet_jpeg_membuf_src(j_decompress_ptr cinfo,
@@ -124,7 +124,7 @@ eet_jpeg_membuf_src(j_decompress_ptr cinfo,
124 src->pub.next_input_byte = src->buf; 124 src->pub.next_input_byte = src->buf;
125 125
126 return 0; 126 return 0;
127} /* eet_jpeg_membuf_src */ 127}
128 128
129struct jpeg_membuf_dst 129struct jpeg_membuf_dst
130{ 130{
@@ -144,7 +144,7 @@ _eet_jpeg_membuf_dst_init(j_compress_ptr cinfo)
144{ 144{
145 /* FIXME: Use eina attribute */ 145 /* FIXME: Use eina attribute */
146 (void)cinfo; 146 (void)cinfo;
147} /* _eet_jpeg_membuf_dst_init */ 147}
148 148
149static boolean 149static boolean
150_eet_jpeg_membuf_dst_flush(j_compress_ptr cinfo) 150_eet_jpeg_membuf_dst_flush(j_compress_ptr cinfo)
@@ -168,7 +168,7 @@ _eet_jpeg_membuf_dst_flush(j_compress_ptr cinfo)
168 dst->len *= 2; 168 dst->len *= 2;
169 169
170 return FALSE; 170 return FALSE;
171} /* _eet_jpeg_membuf_dst_flush */ 171}
172 172
173static void 173static void
174_eet_jpeg_membuf_dst_term(j_compress_ptr cinfo) 174_eet_jpeg_membuf_dst_term(j_compress_ptr cinfo)
@@ -189,7 +189,7 @@ _eet_jpeg_membuf_dst_term(j_compress_ptr cinfo)
189 189
190 free(dst); 190 free(dst);
191 cinfo->dest = NULL; 191 cinfo->dest = NULL;
192} /* _eet_jpeg_membuf_dst_term */ 192}
193 193
194static int 194static int
195eet_jpeg_membuf_dst(j_compress_ptr cinfo, 195eet_jpeg_membuf_dst(j_compress_ptr cinfo,
@@ -223,7 +223,7 @@ eet_jpeg_membuf_dst(j_compress_ptr cinfo,
223 dst->failed = 0; 223 dst->failed = 0;
224 224
225 return 0; 225 return 0;
226} /* eet_jpeg_membuf_dst */ 226}
227 227
228/*---*/ 228/*---*/
229 229
@@ -336,7 +336,7 @@ _JPEGFatalErrorHandler(j_common_ptr cinfo)
336 /* cinfo->err->output_message(cinfo);*/ 336 /* cinfo->err->output_message(cinfo);*/
337 longjmp(errmgr->setjmp_buffer, 1); 337 longjmp(errmgr->setjmp_buffer, 1);
338 return; 338 return;
339} /* _JPEGFatalErrorHandler */ 339}
340 340
341static void 341static void
342_JPEGErrorHandler(j_common_ptr cinfo __UNUSED__) 342_JPEGErrorHandler(j_common_ptr cinfo __UNUSED__)
@@ -347,7 +347,7 @@ _JPEGErrorHandler(j_common_ptr cinfo __UNUSED__)
347 /* cinfo->err->output_message(cinfo);*/ 347 /* cinfo->err->output_message(cinfo);*/
348 /* longjmp(errmgr->setjmp_buffer, 1);*/ 348 /* longjmp(errmgr->setjmp_buffer, 1);*/
349 return; 349 return;
350} /* _JPEGErrorHandler */ 350}
351 351
352static void 352static void
353_JPEGErrorHandler2(j_common_ptr cinfo __UNUSED__, 353_JPEGErrorHandler2(j_common_ptr cinfo __UNUSED__,
@@ -359,7 +359,7 @@ _JPEGErrorHandler2(j_common_ptr cinfo __UNUSED__,
359 /* cinfo->err->output_message(cinfo);*/ 359 /* cinfo->err->output_message(cinfo);*/
360 /* longjmp(errmgr->setjmp_buffer, 1);*/ 360 /* longjmp(errmgr->setjmp_buffer, 1);*/
361 return; 361 return;
362} /* _JPEGErrorHandler2 */ 362}
363 363
364static int 364static int
365eet_data_image_jpeg_header_decode(const void *data, 365eet_data_image_jpeg_header_decode(const void *data,
@@ -405,7 +405,7 @@ eet_data_image_jpeg_header_decode(const void *data,
405 return 0; 405 return 0;
406 406
407 return 1; 407 return 1;
408} /* eet_data_image_jpeg_header_decode */ 408}
409 409
410static int 410static int
411eet_data_image_jpeg_rgb_decode(const void *data, 411eet_data_image_jpeg_rgb_decode(const void *data,
@@ -558,7 +558,7 @@ eet_data_image_jpeg_rgb_decode(const void *data,
558 jpeg_finish_decompress(&cinfo); 558 jpeg_finish_decompress(&cinfo);
559 jpeg_destroy_decompress(&cinfo); 559 jpeg_destroy_decompress(&cinfo);
560 return 1; 560 return 1;
561} /* eet_data_image_jpeg_rgb_decode */ 561}
562 562
563static void * 563static void *
564eet_data_image_jpeg_alpha_decode(const void *data, 564eet_data_image_jpeg_alpha_decode(const void *data,
@@ -667,7 +667,7 @@ eet_data_image_jpeg_alpha_decode(const void *data,
667 jpeg_finish_decompress(&cinfo); 667 jpeg_finish_decompress(&cinfo);
668 jpeg_destroy_decompress(&cinfo); 668 jpeg_destroy_decompress(&cinfo);
669 return d; 669 return d;
670} /* eet_data_image_jpeg_alpha_decode */ 670}
671 671
672static void * 672static void *
673eet_data_image_lossless_convert(int *size, 673eet_data_image_lossless_convert(int *size,
@@ -715,7 +715,7 @@ eet_data_image_lossless_convert(int *size,
715 *size = ((w * h * 4) + (8 * 4)); 715 *size = ((w * h * 4) + (8 * 4));
716 return d; 716 return d;
717 } 717 }
718} /* eet_data_image_lossless_convert */ 718}
719 719
720static void * 720static void *
721eet_data_image_lossless_compressed_convert(int *size, 721eet_data_image_lossless_compressed_convert(int *size,
@@ -789,7 +789,7 @@ eet_data_image_lossless_compressed_convert(int *size,
789 free(comp); 789 free(comp);
790 return d; 790 return d;
791 } 791 }
792} /* eet_data_image_lossless_compressed_convert */ 792}
793 793
794static void * 794static void *
795eet_data_image_jpeg_convert(int *size, 795eet_data_image_jpeg_convert(int *size,
@@ -872,7 +872,7 @@ eet_data_image_jpeg_convert(int *size,
872 872
873 *size = sz; 873 *size = sz;
874 return d; 874 return d;
875} /* eet_data_image_jpeg_convert */ 875}
876 876
877static void * 877static void *
878eet_data_image_jpeg_alpha_convert(int *size, 878eet_data_image_jpeg_alpha_convert(int *size,
@@ -1063,7 +1063,7 @@ eet_data_image_jpeg_alpha_convert(int *size,
1063 free(d2); 1063 free(d2);
1064 *size = 12 + sz1 + sz2; 1064 *size = 12 + sz1 + sz2;
1065 return d; 1065 return d;
1066} /* eet_data_image_jpeg_alpha_convert */ 1066}
1067 1067
1068EAPI int 1068EAPI int
1069eet_data_image_write_cipher(Eet_File *ef, 1069eet_data_image_write_cipher(Eet_File *ef,
@@ -1091,7 +1091,7 @@ eet_data_image_write_cipher(Eet_File *ef,
1091 } 1091 }
1092 1092
1093 return 0; 1093 return 0;
1094} /* eet_data_image_write_cipher */ 1094}
1095 1095
1096EAPI int 1096EAPI int
1097eet_data_image_write(Eet_File *ef, 1097eet_data_image_write(Eet_File *ef,
@@ -1114,7 +1114,7 @@ eet_data_image_write(Eet_File *ef,
1114 comp, 1114 comp,
1115 quality, 1115 quality,
1116 lossy); 1116 lossy);
1117} /* eet_data_image_write */ 1117}
1118 1118
1119EAPI void * 1119EAPI void *
1120eet_data_image_read_cipher(Eet_File *ef, 1120eet_data_image_read_cipher(Eet_File *ef,
@@ -1149,7 +1149,7 @@ eet_data_image_read_cipher(Eet_File *ef,
1149 free(data); 1149 free(data);
1150 1150
1151 return d; 1151 return d;
1152} /* eet_data_image_read_cipher */ 1152}
1153 1153
1154EAPI void * 1154EAPI void *
1155eet_data_image_read(Eet_File *ef, 1155eet_data_image_read(Eet_File *ef,
@@ -1163,7 +1163,7 @@ eet_data_image_read(Eet_File *ef,
1163{ 1163{
1164 return eet_data_image_read_cipher(ef, name, NULL, w, h, alpha, 1164 return eet_data_image_read_cipher(ef, name, NULL, w, h, alpha,
1165 comp, quality, lossy); 1165 comp, quality, lossy);
1166} /* eet_data_image_read */ 1166}
1167 1167
1168EAPI int 1168EAPI int
1169eet_data_image_read_to_surface_cipher(Eet_File *ef, 1169eet_data_image_read_to_surface_cipher(Eet_File *ef,
@@ -1204,7 +1204,7 @@ eet_data_image_read_to_surface_cipher(Eet_File *ef,
1204 free(data); 1204 free(data);
1205 1205
1206 return res; 1206 return res;
1207} /* eet_data_image_read_to_surface_cipher */ 1207}
1208 1208
1209EAPI int 1209EAPI int
1210eet_data_image_read_to_surface(Eet_File *ef, 1210eet_data_image_read_to_surface(Eet_File *ef,
@@ -1225,7 +1225,7 @@ eet_data_image_read_to_surface(Eet_File *ef,
1225 w, h, row_stride, 1225 w, h, row_stride,
1226 alpha, comp, quality, 1226 alpha, comp, quality,
1227 lossy); 1227 lossy);
1228} /* eet_data_image_read_to_surface */ 1228}
1229 1229
1230EAPI int 1230EAPI int
1231eet_data_image_header_read_cipher(Eet_File *ef, 1231eet_data_image_header_read_cipher(Eet_File *ef,
@@ -1260,7 +1260,7 @@ eet_data_image_header_read_cipher(Eet_File *ef,
1260 free(data); 1260 free(data);
1261 1261
1262 return d; 1262 return d;
1263} /* eet_data_image_header_read_cipher */ 1263}
1264 1264
1265EAPI int 1265EAPI int
1266eet_data_image_header_read(Eet_File *ef, 1266eet_data_image_header_read(Eet_File *ef,
@@ -1275,7 +1275,7 @@ eet_data_image_header_read(Eet_File *ef,
1275 return eet_data_image_header_read_cipher(ef, name, NULL, 1275 return eet_data_image_header_read_cipher(ef, name, NULL,
1276 w, h, alpha, 1276 w, h, alpha,
1277 comp, quality, lossy); 1277 comp, quality, lossy);
1278} /* eet_data_image_header_read */ 1278}
1279 1279
1280EAPI void * 1280EAPI void *
1281eet_data_image_encode_cipher(const void *data, 1281eet_data_image_encode_cipher(const void *data,
@@ -1333,7 +1333,7 @@ eet_data_image_encode_cipher(const void *data,
1333 *size_ret = size; 1333 *size_ret = size;
1334 1334
1335 return d; 1335 return d;
1336} /* eet_data_image_encode_cipher */ 1336}
1337 1337
1338EAPI void * 1338EAPI void *
1339eet_data_image_encode(const void *data, 1339eet_data_image_encode(const void *data,
@@ -1347,7 +1347,7 @@ eet_data_image_encode(const void *data,
1347{ 1347{
1348 return eet_data_image_encode_cipher(data, NULL, w, h, alpha, 1348 return eet_data_image_encode_cipher(data, NULL, w, h, alpha,
1349 comp, quality, lossy, size_ret); 1349 comp, quality, lossy, size_ret);
1350} /* eet_data_image_encode */ 1350}
1351 1351
1352EAPI int 1352EAPI int
1353eet_data_image_header_decode_cipher(const void *data, 1353eet_data_image_header_decode_cipher(const void *data,
@@ -1499,7 +1499,7 @@ eet_data_image_header_decode_cipher(const void *data,
1499 } 1499 }
1500 1500
1501 return 0; 1501 return 0;
1502} /* eet_data_image_header_decode_cipher */ 1502}
1503 1503
1504EAPI int 1504EAPI int
1505eet_data_image_header_decode(const void *data, 1505eet_data_image_header_decode(const void *data,
@@ -1520,7 +1520,7 @@ eet_data_image_header_decode(const void *data,
1520 comp, 1520 comp,
1521 quality, 1521 quality,
1522 lossy); 1522 lossy);
1523} /* eet_data_image_header_decode */ 1523}
1524 1524
1525static void 1525static void
1526_eet_data_image_copy_buffer(const unsigned int *src, 1526_eet_data_image_copy_buffer(const unsigned int *src,
@@ -1544,7 +1544,7 @@ _eet_data_image_copy_buffer(const unsigned int *src,
1544 for (y = 0; y < h; ++y, src += src_w, over += row_stride) 1544 for (y = 0; y < h; ++y, src += src_w, over += row_stride)
1545 memcpy(over, src, w * 4); 1545 memcpy(over, src, w * 4);
1546 } 1546 }
1547} /* _eet_data_image_copy_buffer */ 1547}
1548 1548
1549static int 1549static int
1550_eet_data_image_decode_inside(const void *data, 1550_eet_data_image_decode_inside(const void *data,
@@ -1647,7 +1647,7 @@ _eet_data_image_decode_inside(const void *data,
1647 abort(); 1647 abort();
1648 1648
1649 return 1; 1649 return 1;
1650} /* _eet_data_image_decode_inside */ 1650}
1651 1651
1652EAPI void * 1652EAPI void *
1653eet_data_image_decode_cipher(const void *data, 1653eet_data_image_decode_cipher(const void *data,
@@ -1714,7 +1714,7 @@ eet_data_image_decode_cipher(const void *data,
1714 *lossy = ilossy; 1714 *lossy = ilossy;
1715 1715
1716 return d; 1716 return d;
1717} /* eet_data_image_decode_cipher */ 1717}
1718 1718
1719EAPI void * 1719EAPI void *
1720eet_data_image_decode(const void *data, 1720eet_data_image_decode(const void *data,
@@ -1728,7 +1728,7 @@ eet_data_image_decode(const void *data,
1728{ 1728{
1729 return eet_data_image_decode_cipher(data, NULL, size, w, h, 1729 return eet_data_image_decode_cipher(data, NULL, size, w, h,
1730 alpha, comp, quality, lossy); 1730 alpha, comp, quality, lossy);
1731} /* eet_data_image_decode */ 1731}
1732 1732
1733EAPI int 1733EAPI int
1734eet_data_image_decode_to_surface_cipher(const void *data, 1734eet_data_image_decode_to_surface_cipher(const void *data,
@@ -1795,7 +1795,7 @@ eet_data_image_decode_to_surface_cipher(const void *data,
1795 *lossy = ilossy; 1795 *lossy = ilossy;
1796 1796
1797 return 1; 1797 return 1;
1798} /* eet_data_image_decode_to_surface_cipher */ 1798}
1799 1799
1800EAPI int 1800EAPI int
1801eet_data_image_decode_to_surface(const void *data, 1801eet_data_image_decode_to_surface(const void *data,
@@ -1816,5 +1816,5 @@ eet_data_image_decode_to_surface(const void *data,
1816 w, h, row_stride, 1816 w, h, row_stride,
1817 alpha, comp, quality, 1817 alpha, comp, quality,
1818 lossy); 1818 lossy);
1819} /* eet_data_image_decode_to_surface */ 1819}
1820 1820
diff --git a/libraries/eet/src/lib/eet_lib.c b/libraries/eet/src/lib/eet_lib.c
index a0d6435..04feebe 100644
--- a/libraries/eet/src/lib/eet_lib.c
+++ b/libraries/eet/src/lib/eet_lib.c
@@ -82,126 +82,6 @@ EAPI Eet_Version *eet_version = &_version;
82 82
83#define EET_MAGIC_FILE2 0x1ee70f42 83#define EET_MAGIC_FILE2 0x1ee70f42
84 84
85typedef struct _Eet_File_Header Eet_File_Header;
86typedef struct _Eet_File_Node Eet_File_Node;
87typedef struct _Eet_File_Directory Eet_File_Directory;
88
89struct _Eet_File
90{
91 char *path;
92 Eina_File *readfp;
93 Eet_File_Header *header;
94 Eet_Dictionary *ed;
95 Eet_Key *key;
96 const unsigned char *data;
97 const void *x509_der;
98 const void *signature;
99 void *sha1;
100
101 Eet_File_Mode mode;
102
103 int magic;
104 int references;
105
106 unsigned long int data_size;
107 int x509_length;
108 unsigned int signature_length;
109 int sha1_length;
110
111 Eina_Lock file_lock;
112
113 unsigned char writes_pending : 1;
114 unsigned char delete_me_now : 1;
115};
116
117struct _Eet_File_Header
118{
119 int magic;
120 Eet_File_Directory *directory;
121};
122
123struct _Eet_File_Directory
124{
125 int size;
126 Eet_File_Node **nodes;
127};
128
129struct _Eet_File_Node
130{
131 char *name;
132 void *data;
133 Eet_File_Node *next; /* FIXME: make buckets linked lists */
134
135 unsigned long int offset;
136 unsigned long int dictionary_offset;
137 unsigned long int name_offset;
138
139 unsigned int name_size;
140 unsigned int size;
141 unsigned int data_size;
142
143 unsigned char free_name : 1;
144 unsigned char compression : 1;
145 unsigned char ciphered : 1;
146 unsigned char alias : 1;
147};
148
149#if 0
150/* Version 2 */
151/* NB: all int's are stored in network byte order on disk */
152/* file format: */
153int magic; /* magic number ie 0x1ee7ff00 */
154int num_directory_entries; /* number of directory entries to follow */
155int bytes_directory_entries; /* bytes of directory entries to follow */
156struct
157{
158 int offset; /* bytes offset into file for data chunk */
159 int flags; /* flags - for now 0 = uncompressed and clear, 1 = compressed and clear, 2 = uncompressed and ciphered, 3 = compressed and ciphered */
160 int size; /* size of the data chunk */
161 int data_size; /* size of the (uncompressed) data chunk */
162 int name_size; /* length in bytes of the name field */
163 char name[name_size]; /* name string (variable length) and \0 terminated */
164} directory[num_directory_entries];
165/* and now startes the data stream... */
166#endif /* if 0 */
167
168#if 0
169/* Version 3 */
170/* NB: all int's are stored in network byte order on disk */
171/* file format: */
172int magic; /* magic number ie 0x1ee70f42 */
173int num_directory_entries; /* number of directory entries to follow */
174int num_dictionary_entries; /* number of dictionary entries to follow */
175struct
176{
177 int data_offset; /* bytes offset into file for data chunk */
178 int size; /* size of the data chunk */
179 int data_size; /* size of the (uncompressed) data chunk */
180 int name_offset; /* bytes offset into file for name string */
181 int name_size; /* length in bytes of the name field */
182 int flags; /* bit flags - for now:
183 bit 0 => compresion on/off
184 bit 1 => ciphered on/off
185 bit 2 => alias
186 */
187} directory[num_directory_entries];
188struct
189{
190 int hash;
191 int offset;
192 int size;
193 int prev;
194 int next;
195} dictionary[num_dictionary_entries];
196/* now start the string stream. */
197/* and right after them the data stream. */
198int magic_sign; /* Optional, only if the eet file is signed. */
199int signature_length; /* Signature length. */
200int x509_length; /* Public certificate that signed the file. */
201char signature[signature_length]; /* The signature. */
202char x509[x509_length]; /* The public certificate. */
203#endif /* if 0 */
204
205#define EET_FILE2_HEADER_COUNT 3 85#define EET_FILE2_HEADER_COUNT 3
206#define EET_FILE2_DIRECTORY_ENTRY_COUNT 6 86#define EET_FILE2_DIRECTORY_ENTRY_COUNT 6
207#define EET_FILE2_DICTIONARY_ENTRY_COUNT 5 87#define EET_FILE2_DICTIONARY_ENTRY_COUNT 5
@@ -280,7 +160,7 @@ eet_check_pointer(const Eet_File *ef)
280 return 1; 160 return 1;
281 161
282 return 0; 162 return 0;
283} /* eet_check_pointer */ 163}
284 164
285static inline int 165static inline int
286eet_check_header(const Eet_File *ef) 166eet_check_header(const Eet_File *ef)
@@ -292,7 +172,7 @@ eet_check_header(const Eet_File *ef)
292 return 1; 172 return 1;
293 173
294 return 0; 174 return 0;
295} /* eet_check_header */ 175}
296 176
297static inline int 177static inline int
298eet_test_close(int test, 178eet_test_close(int test,
@@ -305,7 +185,7 @@ eet_test_close(int test,
305 } 185 }
306 186
307 return test; 187 return test;
308} /* eet_test_close */ 188}
309 189
310/* find an eet file in the currently in use cache */ 190/* find an eet file in the currently in use cache */
311static Eet_File * 191static Eet_File *
@@ -326,7 +206,7 @@ eet_cache_find(const char *path,
326 206
327 /* not found */ 207 /* not found */
328 return NULL; 208 return NULL;
329} /* eet_cache_find */ 209}
330 210
331/* add to end of cache */ 211/* add to end of cache */
332/* this should only be called when the cache lock is already held */ 212/* this should only be called when the cache lock is already held */
@@ -382,7 +262,7 @@ eet_cache_add(Eet_File *ef,
382 *cache = new_cache; 262 *cache = new_cache;
383 *cache_num = new_cache_num; 263 *cache_num = new_cache_num;
384 *cache_alloc = new_cache_alloc; 264 *cache_alloc = new_cache_alloc;
385} /* eet_cache_add */ 265}
386 266
387/* delete from cache */ 267/* delete from cache */
388/* this should only be called when the cache lock is already held */ 268/* this should only be called when the cache lock is already held */
@@ -437,7 +317,7 @@ eet_cache_del(Eet_File *ef,
437 *cache = new_cache; 317 *cache = new_cache;
438 *cache_num = new_cache_num; 318 *cache_num = new_cache_num;
439 *cache_alloc = new_cache_alloc; 319 *cache_alloc = new_cache_alloc;
440} /* eet_cache_del */ 320}
441 321
442/* internal string match. null friendly, catches same ptr */ 322/* internal string match. null friendly, catches same ptr */
443static int 323static int
@@ -452,7 +332,7 @@ eet_string_match(const char *s1,
452 return 1; 332 return 1;
453 333
454 return !strcmp(s1, s2); 334 return !strcmp(s1, s2);
455} /* eet_string_match */ 335}
456 336
457/* flush out writes to a v2 eet file */ 337/* flush out writes to a v2 eet file */
458static Eet_Error 338static Eet_Error
@@ -494,7 +374,7 @@ eet_flush2(Eet_File *ef)
494 if (!fp) 374 if (!fp)
495 return EET_ERROR_NOT_WRITABLE; 375 return EET_ERROR_NOT_WRITABLE;
496 376
497 fcntl(fileno(fp), F_SETFD, FD_CLOEXEC); 377 fcntl(fd, F_SETFD, FD_CLOEXEC);
498 } 378 }
499 else 379 else
500 return EET_ERROR_NOT_WRITABLE; 380 return EET_ERROR_NOT_WRITABLE;
@@ -627,14 +507,6 @@ eet_flush2(Eet_File *ef)
627 507
628 /* flush all write to the file. */ 508 /* flush all write to the file. */
629 fflush(fp); 509 fflush(fp);
630// this is going to really cause trouble. if ANYTHING this needs to go into a
631// thread spawned off - but even then...
632// in this case... ext4 is "wrong". (yes we can jump up and down and point posix
633// manual pages at eachother, but ext4 broke behavior that has been in place
634// for decades and that 1000's of apps rely on daily - that is that one operation
635// to disk is committed to disk BEFORE following operations, so the fs retains
636// a consistent state
637// fsync(fileno(fp));
638 510
639 /* append signature if required */ 511 /* append signature if required */
640 if (ef->key) 512 if (ef->key)
@@ -665,13 +537,13 @@ write_error:
665 case EPIPE: error = EET_ERROR_WRITE_ERROR_FILE_CLOSED; break; 537 case EPIPE: error = EET_ERROR_WRITE_ERROR_FILE_CLOSED; break;
666 538
667 default: error = EET_ERROR_WRITE_ERROR; break; 539 default: error = EET_ERROR_WRITE_ERROR; break;
668 } /* switch */ 540 }
669 } 541 }
670 542
671sign_error: 543sign_error:
672 fclose(fp); 544 fclose(fp);
673 return error; 545 return error;
674} /* eet_flush2 */ 546}
675 547
676EAPI int 548EAPI int
677eet_init(void) 549eet_init(void)
@@ -680,10 +552,7 @@ eet_init(void)
680 return eet_init_count; 552 return eet_init_count;
681 553
682 if (!eina_init()) 554 if (!eina_init())
683 { 555 return --eet_init_count;
684 fprintf(stderr, "Eet: Eina init failed");
685 return --eet_init_count;
686 }
687 556
688 _eet_log_dom_global = eina_log_domain_register("eet", EET_DEFAULT_LOG_COLOR); 557 _eet_log_dom_global = eina_log_domain_register("eet", EET_DEFAULT_LOG_COLOR);
689 if (_eet_log_dom_global < 0) 558 if (_eet_log_dom_global < 0)
@@ -694,12 +563,18 @@ eet_init(void)
694 563
695 eina_lock_new(&eet_cache_lock); 564 eina_lock_new(&eet_cache_lock);
696 565
697 if (!eet_node_init()) 566 if (!eet_mempool_init())
698 { 567 {
699 EINA_LOG_ERR("Eet: Eet_Node mempool creation failed"); 568 EINA_LOG_ERR("Eet: Eet_Node mempool creation failed");
700 goto unregister_log_domain; 569 goto unregister_log_domain;
701 } 570 }
702 571
572 if (!eet_node_init())
573 {
574 EINA_LOG_ERR("Eet: Eet_Node mempool creation failed");
575 goto shutdown_mempool;
576 }
577
703#ifdef HAVE_GNUTLS 578#ifdef HAVE_GNUTLS
704 /* Before the library can be used, it must initialize itself if needed. */ 579 /* Before the library can be used, it must initialize itself if needed. */
705 if (gcry_control(GCRYCTL_ANY_INITIALIZATION_P) == 0) 580 if (gcry_control(GCRYCTL_ANY_INITIALIZATION_P) == 0)
@@ -741,13 +616,15 @@ eet_init(void)
741shutdown_eet: 616shutdown_eet:
742#endif 617#endif
743 eet_node_shutdown(); 618 eet_node_shutdown();
619shutdown_mempool:
620 eet_mempool_shutdown();
744unregister_log_domain: 621unregister_log_domain:
745 eina_log_domain_unregister(_eet_log_dom_global); 622 eina_log_domain_unregister(_eet_log_dom_global);
746 _eet_log_dom_global = -1; 623 _eet_log_dom_global = -1;
747shutdown_eina: 624shutdown_eina:
748 eina_shutdown(); 625 eina_shutdown();
749 return --eet_init_count; 626 return --eet_init_count;
750} /* eet_init */ 627}
751 628
752EAPI int 629EAPI int
753eet_shutdown(void) 630eet_shutdown(void)
@@ -757,6 +634,7 @@ eet_shutdown(void)
757 634
758 eet_clearcache(); 635 eet_clearcache();
759 eet_node_shutdown(); 636 eet_node_shutdown();
637 eet_mempool_shutdown();
760 638
761 eina_lock_free(&eet_cache_lock); 639 eina_lock_free(&eet_cache_lock);
762 640
@@ -772,7 +650,7 @@ eet_shutdown(void)
772 eina_shutdown(); 650 eina_shutdown();
773 651
774 return eet_init_count; 652 return eet_init_count;
775} /* eet_shutdown */ 653}
776 654
777EAPI Eet_Error 655EAPI Eet_Error
778eet_sync(Eet_File *ef) 656eet_sync(Eet_File *ef)
@@ -795,7 +673,7 @@ eet_sync(Eet_File *ef)
795 673
796 UNLOCK_FILE(ef); 674 UNLOCK_FILE(ef);
797 return ret; 675 return ret;
798} /* eet_sync */ 676}
799 677
800EAPI void 678EAPI void
801eet_clearcache(void) 679eet_clearcache(void)
@@ -853,7 +731,7 @@ eet_clearcache(void)
853 } 731 }
854 732
855 UNLOCK_CACHE; 733 UNLOCK_CACHE;
856} /* eet_clearcache */ 734}
857 735
858/* FIXME: MMAP race condition in READ_WRITE_MODE */ 736/* FIXME: MMAP race condition in READ_WRITE_MODE */
859static Eet_File * 737static Eet_File *
@@ -902,14 +780,14 @@ eet_internal_read2(Eet_File *ef)
902 return NULL; 780 return NULL;
903 781
904 /* allocate header */ 782 /* allocate header */
905 ef->header = calloc(1, sizeof(Eet_File_Header)); 783 ef->header = eet_file_header_calloc(1);
906 if (eet_test_close(!ef->header, ef)) 784 if (eet_test_close(!ef->header, ef))
907 return NULL; 785 return NULL;
908 786
909 ef->header->magic = EET_MAGIC_FILE_HEADER; 787 ef->header->magic = EET_MAGIC_FILE_HEADER;
910 788
911 /* allocate directory block in ram */ 789 /* allocate directory block in ram */
912 ef->header->directory = calloc(1, sizeof(Eet_File_Directory)); 790 ef->header->directory = eet_file_directory_calloc(1);
913 if (eet_test_close(!ef->header->directory, ef)) 791 if (eet_test_close(!ef->header->directory, ef))
914 return NULL; 792 return NULL;
915 793
@@ -939,10 +817,10 @@ eet_internal_read2(Eet_File *ef)
939 817
940 /* out directory block is inconsistent - we have overrun our */ 818 /* out directory block is inconsistent - we have overrun our */
941 /* dynamic block buffer before we finished scanning dir entries */ 819 /* dynamic block buffer before we finished scanning dir entries */
942 efn = malloc(sizeof(Eet_File_Node)); 820 efn = eet_file_node_malloc(1);
943 if (eet_test_close(!efn, ef)) 821 if (eet_test_close(!efn, ef))
944 { 822 {
945 if (efn) free(efn); /* yes i know - we only get here if 823 if (efn) eet_file_node_mp_free(efn); /* yes i know - we only get here if
946 * efn is null/0 -> trying to shut up 824 * efn is null/0 -> trying to shut up
947 * warning tools like cppcheck */ 825 * warning tools like cppcheck */
948 return NULL; 826 return NULL;
@@ -963,7 +841,7 @@ eet_internal_read2(Eet_File *ef)
963#define EFN_TEST(Test, Ef, Efn) \ 841#define EFN_TEST(Test, Ef, Efn) \
964 if (eet_test_close(Test, Ef)) \ 842 if (eet_test_close(Test, Ef)) \
965 { \ 843 { \
966 free(Efn); \ 844 eet_file_node_mp_free(Efn); \
967 return NULL; \ 845 return NULL; \
968 } 846 }
969 847
@@ -1022,11 +900,11 @@ eet_internal_read2(Eet_File *ef)
1022 ef)) 900 ef))
1023 return NULL; 901 return NULL;
1024 902
1025 ef->ed = calloc(1, sizeof (Eet_Dictionary)); 903 ef->ed = eet_dictionary_calloc(1);
1026 if (eet_test_close(!ef->ed, ef)) 904 if (eet_test_close(!ef->ed, ef))
1027 return NULL; 905 return NULL;
1028 906
1029 ef->ed->all = calloc(num_dictionary_entries, sizeof (Eet_String)); 907 ef->ed->all = calloc(1, num_dictionary_entries * sizeof(Eet_String));
1030 if (eet_test_close(!ef->ed->all, ef)) 908 if (eet_test_close(!ef->ed->all, ef))
1031 return NULL; 909 return NULL;
1032 910
@@ -1112,7 +990,7 @@ eet_internal_read2(Eet_File *ef)
1112 } 990 }
1113 991
1114 return ef; 992 return ef;
1115} /* eet_internal_read2 */ 993}
1116 994
1117#if EET_OLD_EET_FILE_FORMAT 995#if EET_OLD_EET_FILE_FORMAT
1118static Eet_File * 996static Eet_File *
@@ -1162,14 +1040,14 @@ eet_internal_read1(Eet_File *ef)
1162 return NULL; 1040 return NULL;
1163 1041
1164 /* allocate header */ 1042 /* allocate header */
1165 ef->header = calloc(1, sizeof(Eet_File_Header)); 1043 ef->header = eet_file_header_calloc(1);
1166 if (eet_test_close(!ef->header, ef)) 1044 if (eet_test_close(!ef->header, ef))
1167 return NULL; 1045 return NULL;
1168 1046
1169 ef->header->magic = EET_MAGIC_FILE_HEADER; 1047 ef->header->magic = EET_MAGIC_FILE_HEADER;
1170 1048
1171 /* allocate directory block in ram */ 1049 /* allocate directory block in ram */
1172 ef->header->directory = calloc(1, sizeof(Eet_File_Directory)); 1050 ef->header->directory = eet_file_directory_calloc(1);
1173 if (eet_test_close(!ef->header->directory, ef)) 1051 if (eet_test_close(!ef->header->directory, ef))
1174 return NULL; 1052 return NULL;
1175 1053
@@ -1204,10 +1082,10 @@ eet_internal_read1(Eet_File *ef)
1204 return NULL; 1082 return NULL;
1205 1083
1206 /* allocate all the ram needed for this stored node accounting */ 1084 /* allocate all the ram needed for this stored node accounting */
1207 efn = malloc (sizeof(Eet_File_Node)); 1085 efn = eet_file_node_malloc(1);
1208 if (eet_test_close(!efn, ef)) 1086 if (eet_test_close(!efn, ef))
1209 { 1087 {
1210 if (efn) free(efn); /* yes i know - we only get here if 1088 if (efn) eet_file_node_mp_free(efn); /* yes i know - we only get here if
1211 * efn is null/0 -> trying to shut up 1089 * efn is null/0 -> trying to shut up
1212 * warning tools like cppcheck */ 1090 * warning tools like cppcheck */
1213 return NULL; 1091 return NULL;
@@ -1227,21 +1105,21 @@ eet_internal_read1(Eet_File *ef)
1227 /* invalid size */ 1105 /* invalid size */
1228 if (eet_test_close(efn->size <= 0, ef)) 1106 if (eet_test_close(efn->size <= 0, ef))
1229 { 1107 {
1230 free(efn); 1108 eet_file_node_mp_free(efn);
1231 return NULL; 1109 return NULL;
1232 } 1110 }
1233 1111
1234 /* invalid name_size */ 1112 /* invalid name_size */
1235 if (eet_test_close(name_size <= 0, ef)) 1113 if (eet_test_close(name_size <= 0, ef))
1236 { 1114 {
1237 free(efn); 1115 eet_file_node_mp_free(efn);
1238 return NULL; 1116 return NULL;
1239 } 1117 }
1240 1118
1241 /* reading name would mean falling off end of dyn_buf - invalid */ 1119 /* reading name would mean falling off end of dyn_buf - invalid */
1242 if (eet_test_close((p + 16 + name_size) > (dyn_buf + byte_entries), ef)) 1120 if (eet_test_close((p + 16 + name_size) > (dyn_buf + byte_entries), ef))
1243 { 1121 {
1244 free(efn); 1122 eet_file_node_mp_free(efn);
1245 return NULL; 1123 return NULL;
1246 } 1124 }
1247 1125
@@ -1257,7 +1135,7 @@ eet_internal_read1(Eet_File *ef)
1257 efn->name = malloc(sizeof(char) * name_size + 1); 1135 efn->name = malloc(sizeof(char) * name_size + 1);
1258 if (eet_test_close(!efn->name, ef)) 1136 if (eet_test_close(!efn->name, ef))
1259 { 1137 {
1260 free(efn); 1138 eet_file_node_mp_free(efn);
1261 return NULL; 1139 return NULL;
1262 } 1140 }
1263 1141
@@ -1294,7 +1172,7 @@ eet_internal_read1(Eet_File *ef)
1294 p += HEADER_SIZE + name_size; 1172 p += HEADER_SIZE + name_size;
1295 } 1173 }
1296 return ef; 1174 return ef;
1297} /* eet_internal_read1 */ 1175}
1298 1176
1299#endif /* if EET_OLD_EET_FILE_FORMAT */ 1177#endif /* if EET_OLD_EET_FILE_FORMAT */
1300 1178
@@ -1329,10 +1207,10 @@ eet_internal_read(Eet_File *ef)
1329 ef->delete_me_now = 1; 1207 ef->delete_me_now = 1;
1330 eet_internal_close(ef, EINA_TRUE); 1208 eet_internal_close(ef, EINA_TRUE);
1331 break; 1209 break;
1332 } /* switch */ 1210 }
1333 1211
1334 return NULL; 1212 return NULL;
1335} /* eet_internal_read */ 1213}
1336 1214
1337static Eet_Error 1215static Eet_Error
1338eet_internal_close(Eet_File *ef, 1216eet_internal_close(Eet_File *ef,
@@ -1405,16 +1283,16 @@ eet_internal_close(Eet_File *ef,
1405 if (efn->free_name) 1283 if (efn->free_name)
1406 free(efn->name); 1284 free(efn->name);
1407 1285
1408 free(efn); 1286 eet_file_node_mp_free(efn);
1409 } 1287 }
1410 } 1288 }
1411 free(ef->header->directory->nodes); 1289 free(ef->header->directory->nodes);
1412 } 1290 }
1413 1291
1414 free(ef->header->directory); 1292 eet_file_directory_mp_free(ef->header->directory);
1415 } 1293 }
1416 1294
1417 free(ef->header); 1295 eet_file_header_mp_free(ef->header);
1418 } 1296 }
1419 1297
1420 eet_dictionary_free(ef->ed); 1298 eet_dictionary_free(ef->ed);
@@ -1434,7 +1312,8 @@ eet_internal_close(Eet_File *ef,
1434 memset(ef, 0, sizeof(Eet_File)); 1312 memset(ef, 0, sizeof(Eet_File));
1435 1313
1436 /* free it */ 1314 /* free it */
1437 free(ef); 1315 eina_stringshare_del(ef->path);
1316 eet_file_mp_free(ef);
1438 return err; 1317 return err;
1439 1318
1440on_error: 1319on_error:
@@ -1442,7 +1321,7 @@ on_error:
1442 UNLOCK_CACHE; 1321 UNLOCK_CACHE;
1443 1322
1444 return EET_ERROR_NONE; 1323 return EET_ERROR_NONE;
1445} /* eet_internal_close */ 1324}
1446 1325
1447EAPI Eet_File * 1326EAPI Eet_File *
1448eet_memopen_read(const void *data, 1327eet_memopen_read(const void *data,
@@ -1453,7 +1332,7 @@ eet_memopen_read(const void *data,
1453 if (!data || size == 0) 1332 if (!data || size == 0)
1454 return NULL; 1333 return NULL;
1455 1334
1456 ef = malloc (sizeof (Eet_File)); 1335 ef = eet_file_malloc(1);
1457 if (!ef) 1336 if (!ef)
1458 return NULL; 1337 return NULL;
1459 1338
@@ -1477,7 +1356,14 @@ eet_memopen_read(const void *data,
1477 ef = eet_internal_read(ef); 1356 ef = eet_internal_read(ef);
1478 UNLOCK_CACHE; 1357 UNLOCK_CACHE;
1479 return ef; 1358 return ef;
1480} /* eet_memopen_read */ 1359}
1360
1361EAPI const char *
1362eet_file_get(Eet_File *ef)
1363{
1364 if (eet_check_pointer(ef)) return NULL;
1365 return ef->path;
1366}
1481 1367
1482EAPI Eet_File * 1368EAPI Eet_File *
1483eet_open(const char *file, 1369eet_open(const char *file,
@@ -1578,7 +1464,7 @@ open_error:
1578 file_len = strlen(file) + 1; 1464 file_len = strlen(file) + 1;
1579 1465
1580 /* Allocate struct for eet file and have it zero'd out */ 1466 /* Allocate struct for eet file and have it zero'd out */
1581 ef = malloc(sizeof(Eet_File) + file_len); 1467 ef = eet_file_malloc(1);
1582 if (!ef) 1468 if (!ef)
1583 goto on_error; 1469 goto on_error;
1584 1470
@@ -1586,8 +1472,7 @@ open_error:
1586 INIT_FILE(ef); 1472 INIT_FILE(ef);
1587 ef->key = NULL; 1473 ef->key = NULL;
1588 ef->readfp = fp; 1474 ef->readfp = fp;
1589 ef->path = ((char *)ef) + sizeof(Eet_File); 1475 ef->path = eina_stringshare_add_length(file, file_len);
1590 memcpy(ef->path, file, file_len);
1591 ef->magic = EET_MAGIC_FILE; 1476 ef->magic = EET_MAGIC_FILE;
1592 ef->references = 1; 1477 ef->references = 1;
1593 ef->mode = mode; 1478 ef->mode = mode;
@@ -1641,7 +1526,7 @@ empty_file:
1641on_error: 1526on_error:
1642 UNLOCK_CACHE; 1527 UNLOCK_CACHE;
1643 return NULL; 1528 return NULL;
1644} /* eet_open */ 1529}
1645 1530
1646EAPI Eet_File_Mode 1531EAPI Eet_File_Mode
1647eet_mode_get(Eet_File *ef) 1532eet_mode_get(Eet_File *ef)
@@ -1651,7 +1536,7 @@ eet_mode_get(Eet_File *ef)
1651 return EET_FILE_MODE_INVALID; 1536 return EET_FILE_MODE_INVALID;
1652 else 1537 else
1653 return ef->mode; 1538 return ef->mode;
1654} /* eet_mode_get */ 1539}
1655 1540
1656EAPI const void * 1541EAPI const void *
1657eet_identity_x509(Eet_File *ef, 1542eet_identity_x509(Eet_File *ef,
@@ -1664,7 +1549,7 @@ eet_identity_x509(Eet_File *ef,
1664 *der_length = ef->x509_length; 1549 *der_length = ef->x509_length;
1665 1550
1666 return ef->x509_der; 1551 return ef->x509_der;
1667} /* eet_identity_x509 */ 1552}
1668 1553
1669EAPI const void * 1554EAPI const void *
1670eet_identity_signature(Eet_File *ef, 1555eet_identity_signature(Eet_File *ef,
@@ -1677,7 +1562,7 @@ eet_identity_signature(Eet_File *ef,
1677 *signature_length = ef->signature_length; 1562 *signature_length = ef->signature_length;
1678 1563
1679 return ef->signature; 1564 return ef->signature;
1680} /* eet_identity_signature */ 1565}
1681 1566
1682EAPI const void * 1567EAPI const void *
1683eet_identity_sha1(Eet_File *ef, 1568eet_identity_sha1(Eet_File *ef,
@@ -1692,7 +1577,7 @@ eet_identity_sha1(Eet_File *ef,
1692 *sha1_length = ef->sha1_length; 1577 *sha1_length = ef->sha1_length;
1693 1578
1694 return ef->sha1; 1579 return ef->sha1;
1695} /* eet_identity_sha1 */ 1580}
1696 1581
1697EAPI Eet_Error 1582EAPI Eet_Error
1698eet_identity_set(Eet_File *ef, 1583eet_identity_set(Eet_File *ef,
@@ -1712,13 +1597,13 @@ eet_identity_set(Eet_File *ef,
1712 ef->writes_pending = 1; 1597 ef->writes_pending = 1;
1713 1598
1714 return EET_ERROR_NONE; 1599 return EET_ERROR_NONE;
1715} /* eet_identity_set */ 1600}
1716 1601
1717EAPI Eet_Error 1602EAPI Eet_Error
1718eet_close(Eet_File *ef) 1603eet_close(Eet_File *ef)
1719{ 1604{
1720 return eet_internal_close(ef, EINA_FALSE); 1605 return eet_internal_close(ef, EINA_FALSE);
1721} /* eet_close */ 1606}
1722 1607
1723EAPI void * 1608EAPI void *
1724eet_read_cipher(Eet_File *ef, 1609eet_read_cipher(Eet_File *ef,
@@ -1889,7 +1774,7 @@ on_error:
1889 UNLOCK_FILE(ef); 1774 UNLOCK_FILE(ef);
1890 free(data); 1775 free(data);
1891 return NULL; 1776 return NULL;
1892} /* eet_read_cipher */ 1777}
1893 1778
1894EAPI void * 1779EAPI void *
1895eet_read(Eet_File *ef, 1780eet_read(Eet_File *ef,
@@ -1897,7 +1782,7 @@ eet_read(Eet_File *ef,
1897 int *size_ret) 1782 int *size_ret)
1898{ 1783{
1899 return eet_read_cipher(ef, name, size_ret, NULL); 1784 return eet_read_cipher(ef, name, size_ret, NULL);
1900} /* eet_read */ 1785}
1901 1786
1902EAPI const void * 1787EAPI const void *
1903eet_read_direct(Eet_File *ef, 1788eet_read_direct(Eet_File *ef,
@@ -1995,7 +1880,7 @@ eet_read_direct(Eet_File *ef,
1995on_error: 1880on_error:
1996 UNLOCK_FILE(ef); 1881 UNLOCK_FILE(ef);
1997 return NULL; 1882 return NULL;
1998} /* eet_read_direct */ 1883}
1999 1884
2000EAPI const char * 1885EAPI const char *
2001eet_alias_get(Eet_File *ef, 1886eet_alias_get(Eet_File *ef,
@@ -2102,16 +1987,16 @@ eet_alias(Eet_File *ef,
2102 if (!ef->header) 1987 if (!ef->header)
2103 { 1988 {
2104 /* allocate header */ 1989 /* allocate header */
2105 ef->header = calloc(1, sizeof(Eet_File_Header)); 1990 ef->header = eet_file_header_calloc(1);
2106 if (!ef->header) 1991 if (!ef->header)
2107 goto on_error; 1992 goto on_error;
2108 1993
2109 ef->header->magic = EET_MAGIC_FILE_HEADER; 1994 ef->header->magic = EET_MAGIC_FILE_HEADER;
2110 /* allocate directory block in ram */ 1995 /* allocate directory block in ram */
2111 ef->header->directory = calloc(1, sizeof(Eet_File_Directory)); 1996 ef->header->directory = eet_file_directory_calloc(1);
2112 if (!ef->header->directory) 1997 if (!ef->header->directory)
2113 { 1998 {
2114 free(ef->header); 1999 eet_file_header_mp_free(ef->header);
2115 ef->header = NULL; 2000 ef->header = NULL;
2116 goto on_error; 2001 goto on_error;
2117 } 2002 }
@@ -2124,7 +2009,7 @@ eet_alias(Eet_File *ef,
2124 (1 << ef->header->directory->size)); 2009 (1 << ef->header->directory->size));
2125 if (!ef->header->directory->nodes) 2010 if (!ef->header->directory->nodes)
2126 { 2011 {
2127 free(ef->header->directory); 2012 eet_file_directory_mp_free(ef->header->directory);
2128 ef->header = NULL; 2013 ef->header = NULL;
2129 goto on_error; 2014 goto on_error;
2130 } 2015 }
@@ -2198,7 +2083,7 @@ eet_alias(Eet_File *ef,
2198 } 2083 }
2199 if (!exists_already) 2084 if (!exists_already)
2200 { 2085 {
2201 efn = malloc(sizeof(Eet_File_Node)); 2086 efn = eet_file_node_malloc(1);
2202 if (!efn) 2087 if (!efn)
2203 { 2088 {
2204 free(data2); 2089 free(data2);
@@ -2230,7 +2115,7 @@ eet_alias(Eet_File *ef,
2230on_error: 2115on_error:
2231 UNLOCK_FILE(ef); 2116 UNLOCK_FILE(ef);
2232 return EINA_FALSE; 2117 return EINA_FALSE;
2233} /* eet_alias */ 2118}
2234 2119
2235EAPI int 2120EAPI int
2236eet_write_cipher(Eet_File *ef, 2121eet_write_cipher(Eet_File *ef,
@@ -2262,16 +2147,16 @@ eet_write_cipher(Eet_File *ef,
2262 if (!ef->header) 2147 if (!ef->header)
2263 { 2148 {
2264 /* allocate header */ 2149 /* allocate header */
2265 ef->header = calloc(1, sizeof(Eet_File_Header)); 2150 ef->header = eet_file_header_calloc(1);
2266 if (!ef->header) 2151 if (!ef->header)
2267 goto on_error; 2152 goto on_error;
2268 2153
2269 ef->header->magic = EET_MAGIC_FILE_HEADER; 2154 ef->header->magic = EET_MAGIC_FILE_HEADER;
2270 /* allocate directory block in ram */ 2155 /* allocate directory block in ram */
2271 ef->header->directory = calloc(1, sizeof(Eet_File_Directory)); 2156 ef->header->directory = eet_file_directory_calloc(1);
2272 if (!ef->header->directory) 2157 if (!ef->header->directory)
2273 { 2158 {
2274 free(ef->header); 2159 eet_file_header_mp_free(ef->header);
2275 ef->header = NULL; 2160 ef->header = NULL;
2276 goto on_error; 2161 goto on_error;
2277 } 2162 }
@@ -2284,7 +2169,7 @@ eet_write_cipher(Eet_File *ef,
2284 (1 << ef->header->directory->size)); 2169 (1 << ef->header->directory->size));
2285 if (!ef->header->directory->nodes) 2170 if (!ef->header->directory->nodes)
2286 { 2171 {
2287 free(ef->header->directory); 2172 eet_file_directory_mp_free(ef->header->directory);
2288 ef->header = NULL; 2173 ef->header = NULL;
2289 goto on_error; 2174 goto on_error;
2290 } 2175 }
@@ -2382,7 +2267,7 @@ eet_write_cipher(Eet_File *ef,
2382 } 2267 }
2383 if (!exists_already) 2268 if (!exists_already)
2384 { 2269 {
2385 efn = malloc(sizeof(Eet_File_Node)); 2270 efn = eet_file_node_malloc(1);
2386 if (!efn) 2271 if (!efn)
2387 { 2272 {
2388 free(data2); 2273 free(data2);
@@ -2413,7 +2298,7 @@ eet_write_cipher(Eet_File *ef,
2413on_error: 2298on_error:
2414 UNLOCK_FILE(ef); 2299 UNLOCK_FILE(ef);
2415 return 0; 2300 return 0;
2416} /* eet_write_cipher */ 2301}
2417 2302
2418EAPI int 2303EAPI int
2419eet_write(Eet_File *ef, 2304eet_write(Eet_File *ef,
@@ -2423,7 +2308,7 @@ eet_write(Eet_File *ef,
2423 int comp) 2308 int comp)
2424{ 2309{
2425 return eet_write_cipher(ef, name, data, size, comp, NULL); 2310 return eet_write_cipher(ef, name, data, size, comp, NULL);
2426} /* eet_write */ 2311}
2427 2312
2428EAPI int 2313EAPI int
2429eet_delete(Eet_File *ef, 2314eet_delete(Eet_File *ef,
@@ -2472,7 +2357,7 @@ eet_delete(Eet_File *ef,
2472 if (efn->free_name) 2357 if (efn->free_name)
2473 free(efn->name); 2358 free(efn->name);
2474 2359
2475 free(efn); 2360 eet_file_node_mp_free(efn);
2476 exists_already = 1; 2361 exists_already = 1;
2477 break; 2362 break;
2478 } 2363 }
@@ -2485,7 +2370,7 @@ eet_delete(Eet_File *ef,
2485 2370
2486 /* update access time */ 2371 /* update access time */
2487 return exists_already; 2372 return exists_already;
2488} /* eet_delete */ 2373}
2489 2374
2490EAPI Eet_Dictionary * 2375EAPI Eet_Dictionary *
2491eet_dictionary_get(Eet_File *ef) 2376eet_dictionary_get(Eet_File *ef)
@@ -2494,7 +2379,7 @@ eet_dictionary_get(Eet_File *ef)
2494 return NULL; 2379 return NULL;
2495 2380
2496 return ef->ed; 2381 return ef->ed;
2497} /* eet_dictionary_get */ 2382}
2498 2383
2499EAPI char ** 2384EAPI char **
2500eet_list(Eet_File *ef, 2385eet_list(Eet_File *ef,
@@ -2578,7 +2463,7 @@ on_error:
2578 *count_ret = 0; 2463 *count_ret = 0;
2579 2464
2580 return NULL; 2465 return NULL;
2581} /* eet_list */ 2466}
2582 2467
2583EAPI int 2468EAPI int
2584eet_num_entries(Eet_File *ef) 2469eet_num_entries(Eet_File *ef)
@@ -2605,7 +2490,7 @@ eet_num_entries(Eet_File *ef)
2605 UNLOCK_FILE(ef); 2490 UNLOCK_FILE(ef);
2606 2491
2607 return ret; 2492 return ret;
2608} /* eet_num_entries */ 2493}
2609 2494
2610static Eet_File_Node * 2495static Eet_File_Node *
2611find_node_by_name(Eet_File *ef, 2496find_node_by_name(Eet_File *ef,
@@ -2624,7 +2509,7 @@ find_node_by_name(Eet_File *ef,
2624 } 2509 }
2625 2510
2626 return NULL; 2511 return NULL;
2627} /* find_node_by_name */ 2512}
2628 2513
2629static int 2514static int
2630read_data_from_disk(Eet_File *ef, 2515read_data_from_disk(Eet_File *ef,
@@ -2644,5 +2529,5 @@ read_data_from_disk(Eet_File *ef,
2644 memcpy(buf, ef->data + efn->offset, len); 2529 memcpy(buf, ef->data + efn->offset, len);
2645 2530
2646 return len; 2531 return len;
2647} /* read_data_from_disk */ 2532}
2648 2533
diff --git a/libraries/eet/src/lib/eet_node.c b/libraries/eet/src/lib/eet_node.c
index d90ef83..11d7cc0 100644
--- a/libraries/eet/src/lib/eet_node.c
+++ b/libraries/eet/src/lib/eet_node.c
@@ -27,13 +27,13 @@ eet_node_new(void)
27 27
28 memset(result, 0, sizeof (Eet_Node)); 28 memset(result, 0, sizeof (Eet_Node));
29 return result; 29 return result;
30} /* eet_node_new */ 30}
31 31
32void 32void
33eet_node_free(Eet_Node *node) 33eet_node_free(Eet_Node *node)
34{ 34{
35 eina_mempool_free(_eet_node_mp, node); 35 eina_mempool_free(_eet_node_mp, node);
36} /* eet_node_free */ 36}
37 37
38static Eet_Node * 38static Eet_Node *
39_eet_node_new(const char *name, 39_eet_node_new(const char *name,
@@ -49,7 +49,7 @@ _eet_node_new(const char *name,
49 n->name = eina_stringshare_add(name); 49 n->name = eina_stringshare_add(name);
50 50
51 return n; 51 return n;
52} /* _eet_node_new */ 52}
53 53
54static void 54static void
55_eet_node_append(Eet_Node *n, 55_eet_node_append(Eet_Node *n,
@@ -63,7 +63,7 @@ _eet_node_append(Eet_Node *n,
63 value->next = n->values; 63 value->next = n->values;
64 n->values = value; 64 n->values = value;
65 } 65 }
66} /* _eet_node_append */ 66}
67 67
68#define EET_NODE_NEW(Eet_type, Name, Value, Type) \ 68#define EET_NODE_NEW(Eet_type, Name, Value, Type) \
69 EAPI Eet_Node * \ 69 EAPI Eet_Node * \
@@ -133,7 +133,7 @@ eet_node_list_new(const char *name,
133 _eet_node_append(n, nodes); 133 _eet_node_append(n, nodes);
134 134
135 return n; 135 return n;
136} /* eet_node_list_new */ 136}
137 137
138Eet_Node * 138Eet_Node *
139eet_node_array_new(const char *name, 139eet_node_array_new(const char *name,
@@ -151,7 +151,7 @@ eet_node_array_new(const char *name,
151 _eet_node_append(n, nodes); 151 _eet_node_append(n, nodes);
152 152
153 return n; 153 return n;
154} /* eet_node_array_new */ 154}
155 155
156Eet_Node * 156Eet_Node *
157eet_node_var_array_new(const char *name, 157eet_node_var_array_new(const char *name,
@@ -168,7 +168,7 @@ eet_node_var_array_new(const char *name,
168 _eet_node_append(n, nodes); 168 _eet_node_append(n, nodes);
169 169
170 return n; 170 return n;
171} /* eet_node_var_array_new */ 171}
172 172
173Eet_Node * 173Eet_Node *
174eet_node_hash_new(const char *name, 174eet_node_hash_new(const char *name,
@@ -191,7 +191,7 @@ eet_node_hash_new(const char *name,
191 _eet_node_append(n, nodes); 191 _eet_node_append(n, nodes);
192 192
193 return n; 193 return n;
194} /* eet_node_hash_new */ 194}
195 195
196Eet_Node * 196Eet_Node *
197eet_node_struct_new(const char *name, 197eet_node_struct_new(const char *name,
@@ -206,7 +206,7 @@ eet_node_struct_new(const char *name,
206 _eet_node_append(n, nodes); 206 _eet_node_append(n, nodes);
207 207
208 return n; 208 return n;
209} /* eet_node_struct_new */ 209}
210 210
211Eet_Node * 211Eet_Node *
212eet_node_struct_child_new(const char *parent, 212eet_node_struct_child_new(const char *parent,
@@ -226,7 +226,7 @@ eet_node_struct_child_new(const char *parent,
226 _eet_node_append(n, eina_list_prepend(NULL, child)); 226 _eet_node_append(n, eina_list_prepend(NULL, child));
227 227
228 return n; 228 return n;
229} /* eet_node_struct_child_new */ 229}
230 230
231Eet_Node * 231Eet_Node *
232eet_node_children_get(Eet_Node *node) 232eet_node_children_get(Eet_Node *node)
@@ -289,7 +289,7 @@ eet_node_list_append(Eet_Node *parent,
289 parent->values = nn; 289 parent->values = nn;
290 290
291 eina_stringshare_del(tmp); 291 eina_stringshare_del(tmp);
292} /* eet_node_list_append */ 292}
293 293
294void 294void
295eet_node_struct_append(Eet_Node *parent, 295eet_node_struct_append(Eet_Node *parent,
@@ -338,7 +338,7 @@ eet_node_struct_append(Eet_Node *parent,
338 } 338 }
339 339
340 eina_stringshare_del(tmp); 340 eina_stringshare_del(tmp);
341} /* eet_node_struct_append */ 341}
342 342
343void 343void
344eet_node_hash_add(Eet_Node *parent, 344eet_node_hash_add(Eet_Node *parent,
@@ -356,7 +356,7 @@ eet_node_hash_add(Eet_Node *parent,
356 /* And add it to the parent. */ 356 /* And add it to the parent. */
357 nn->next = parent->values; 357 nn->next = parent->values;
358 parent->values = nn; 358 parent->values = nn;
359} /* eet_node_hash_add */ 359}
360 360
361int 361int
362eet_node_type_get(Eet_Node *node) 362eet_node_type_get(Eet_Node *node)
@@ -420,11 +420,11 @@ eet_node_del(Eet_Node *n)
420 case EET_T_USHORT: 420 case EET_T_USHORT:
421 case EET_T_UINT: 421 case EET_T_UINT:
422 break; 422 break;
423 } /* switch */ 423 }
424 424
425 eina_stringshare_del(n->name); 425 eina_stringshare_del(n->name);
426 eet_node_free(n); 426 eet_node_free(n);
427} /* eet_node_del */ 427}
428 428
429static const char *eet_node_dump_g_name[6] = { 429static const char *eet_node_dump_g_name[6] = {
430 "struct", 430 "struct",
@@ -458,7 +458,7 @@ eet_node_dump_level(int level,
458 int i; 458 int i;
459 459
460 for (i = 0; i < level; i++) dumpfunc(dumpdata, " "); 460 for (i = 0; i < level; i++) dumpfunc(dumpdata, " ");
461} /* eet_node_dump_level */ 461}
462 462
463static char * 463static char *
464eet_node_string_escape(const char *str) 464eet_node_string_escape(const char *str)
@@ -499,7 +499,7 @@ eet_node_string_escape(const char *str)
499 } 499 }
500 *sp = 0; 500 *sp = 0;
501 return s; 501 return s;
502} /* eet_node_string_escape */ 502}
503 503
504static void 504static void
505eet_node_dump_string_escape(void *dumpdata, 505eet_node_dump_string_escape(void *dumpdata,
@@ -514,7 +514,7 @@ eet_node_dump_string_escape(void *dumpdata,
514 514
515 dumpfunc(dumpdata, s); 515 dumpfunc(dumpdata, s);
516 free(s); 516 free(s);
517} /* eet_node_dump_string_escape */ 517}
518 518
519static void 519static void
520eet_node_dump_simple_type(Eet_Node *n, 520eet_node_dump_simple_type(Eet_Node *n,
@@ -578,10 +578,10 @@ case Eet_Type: \
578 default: 578 default:
579 dumpfunc(dumpdata, "???: ???"); 579 dumpfunc(dumpdata, "???: ???");
580 break; 580 break;
581 } /* switch */ 581 }
582 582
583 dumpfunc(dumpdata, ";\n"); 583 dumpfunc(dumpdata, ";\n");
584} /* eet_node_dump_simple_type */ 584}
585 585
586static void 586static void
587eet_node_dump_group_start(int level, 587eet_node_dump_group_start(int level,
@@ -602,7 +602,7 @@ eet_node_dump_group_start(int level,
602 602
603 dumpfunc(dumpdata, eet_node_dump_g_name[chnk_type - EET_G_UNKNOWN]); 603 dumpfunc(dumpdata, eet_node_dump_g_name[chnk_type - EET_G_UNKNOWN]);
604 dumpfunc(dumpdata, " {\n"); 604 dumpfunc(dumpdata, " {\n");
605} /* eet_node_dump_group_start */ 605}
606 606
607static void 607static void
608eet_node_dump_group_end(int level, 608eet_node_dump_group_end(int level,
@@ -611,7 +611,7 @@ eet_node_dump_group_end(int level,
611{ 611{
612 eet_node_dump_level(level, dumpfunc, dumpdata); 612 eet_node_dump_level(level, dumpfunc, dumpdata);
613 dumpfunc(dumpdata, "}\n"); 613 dumpfunc(dumpdata, "}\n");
614} /* eet_node_dump_group_end */ 614}
615 615
616void 616void
617eet_node_dump(Eet_Node *n, 617eet_node_dump(Eet_Node *n,
@@ -676,8 +676,8 @@ eet_node_dump(Eet_Node *n,
676 case EET_T_ULONG_LONG: 676 case EET_T_ULONG_LONG:
677 eet_node_dump_simple_type(n, dumplevel, dumpfunc, dumpdata); 677 eet_node_dump_simple_type(n, dumplevel, dumpfunc, dumpdata);
678 break; 678 break;
679 } /* switch */ 679 }
680} /* eet_node_dump */ 680}
681 681
682void * 682void *
683eet_node_walk(void *parent, 683eet_node_walk(void *parent,
@@ -759,13 +759,13 @@ eet_node_walk(void *parent,
759 case EET_T_ULONG_LONG: 759 case EET_T_ULONG_LONG:
760 me = cb->simple(root->type, &root->data, user_data); 760 me = cb->simple(root->type, &root->data, user_data);
761 break; 761 break;
762 } /* switch */ 762 }
763 763
764 if (parent) 764 if (parent)
765 cb->struct_add(parent, name, me, user_data); 765 cb->struct_add(parent, name, me, user_data);
766 766
767 return me; 767 return me;
768} /* eet_node_walk */ 768}
769 769
770int 770int
771eet_node_init(void) 771eet_node_init(void)
@@ -778,7 +778,7 @@ eet_node_init(void)
778#else 778#else
779 choice = "chained_mempool"; 779 choice = "chained_mempool";
780#endif 780#endif
781 tmp = getenv("EET_MEMPOOL"); 781 tmp = getenv("EINA_MEMPOOL");
782 if (tmp && tmp[0]) 782 if (tmp && tmp[0])
783 choice = tmp; 783 choice = tmp;
784 784
@@ -786,12 +786,12 @@ eet_node_init(void)
786 eina_mempool_add(choice, "eet-node-alloc", NULL, sizeof(Eet_Node), 1024); 786 eina_mempool_add(choice, "eet-node-alloc", NULL, sizeof(Eet_Node), 1024);
787 787
788 return _eet_node_mp ? 1 : 0; 788 return _eet_node_mp ? 1 : 0;
789} /* eet_node_init */ 789}
790 790
791void 791void
792eet_node_shutdown(void) 792eet_node_shutdown(void)
793{ 793{
794 eina_mempool_del(_eet_node_mp); 794 eina_mempool_del(_eet_node_mp);
795 _eet_node_mp = NULL; 795 _eet_node_mp = NULL;
796} /* eet_node_shutdown */ 796}
797 797
diff --git a/libraries/eet/src/lib/eet_utils.c b/libraries/eet/src/lib/eet_utils.c
index 8e591a2..b04ad1b 100644
--- a/libraries/eet/src/lib/eet_utils.c
+++ b/libraries/eet/src/lib/eet_utils.c
@@ -32,5 +32,5 @@ _eet_hash_gen(const char *key,
32 hash_num &= mask; 32 hash_num &= mask;
33 /* return it */ 33 /* return it */
34 return hash_num; 34 return hash_num;
35} /* _eet_hash_gen */ 35}
36 36