summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2011-10-21 05:40:01 +0000
committerCarsten Haitzler <raster@rasterman.com>2011-10-21 05:40:01 +0000
commita9fc805e92cdec45e7e3322f4562cf8a2ed32502 (patch)
tree62e6dd4b7dbeed83c1db00c594ac3aa4949f57c6
parentd32e3400a0bd6f5b4e8490b0c8fcd5ffe6ce5607 (diff)
downloadeet-a9fc805e92cdec45e7e3322f4562cf8a2ed32502.tar.gz
ran ecrustify on eet. this seems to do a good job of eet. comments?
SVN revision: 64237
-rw-r--r--src/bin/eet_main.c147
-rw-r--r--src/examples/eet-basic.c53
-rw-r--r--src/examples/eet-data-cipher_decipher.c36
-rw-r--r--src/examples/eet-data-file_descriptor_01.c242
-rw-r--r--src/examples/eet-data-file_descriptor_02.c7
-rw-r--r--src/examples/eet-data-nested.c81
-rw-r--r--src/examples/eet-data-simple.c41
-rw-r--r--src/examples/eet-file.c121
-rw-r--r--src/lib/Eet.h1121
-rw-r--r--src/lib/Eet_private.h149
-rw-r--r--src/lib/eet_cipher.c258
-rw-r--r--src/lib/eet_connection.c52
-rw-r--r--src/lib/eet_data.c2969
-rw-r--r--src/lib/eet_dictionary.c82
-rw-r--r--src/lib/eet_image.c379
-rw-r--r--src/lib/eet_lib.c874
-rw-r--r--src/lib/eet_node.c435
-rw-r--r--src/lib/eet_utils.c4
-rw-r--r--src/tests/eet_data_suite.c26
-rw-r--r--src/tests/eet_suite.c690
-rw-r--r--src/tests/eet_suite.h3
21 files changed, 3965 insertions, 3805 deletions
diff --git a/src/bin/eet_main.c b/src/bin/eet_main.c
index a433bc5..7ab5555 100644
--- a/src/bin/eet_main.c
+++ b/src/bin/eet_main.c
@@ -44,11 +44,11 @@ static int _eet_main_log_dom = -1;
#define CRIT(...) EINA_LOG_DOM_CRIT(_eet_main_log_dom, __VA_ARGS__)
static void
-do_eet_list(const char * file)
+do_eet_list(const char *file)
{
int i, num;
- char ** list;
- Eet_File * ef;
+ char **list;
+ Eet_File *ef;
ef = eet_open(file, EET_FILE_MODE_READ);
if (!ef)
@@ -61,7 +61,7 @@ do_eet_list(const char * file)
if (list)
{
for (i = 0; i < num; i++)
- printf("%s\n",list[i]);
+ printf("%s\n", list[i]);
free(list);
}
@@ -69,15 +69,15 @@ do_eet_list(const char * file)
} /* do_eet_list */
static void
-do_eet_extract(const char * file,
- const char * key,
- const char * out,
- const char * crypto_key)
+do_eet_extract(const char *file,
+ const char *key,
+ const char *out,
+ const char *crypto_key)
{
- Eet_File * ef;
- void * data;
+ Eet_File *ef;
+ void *data;
int size = 0;
- FILE * f;
+ FILE *f;
ef = eet_open(file, EET_FILE_MODE_READ);
if (!ef)
@@ -112,19 +112,20 @@ do_eet_extract(const char * file,
} /* do_eet_extract */
static void
-do_eet_decode_dump(void * data, const char * str)
+do_eet_decode_dump(void *data,
+ const char *str)
{
fputs(str, (FILE *)data);
} /* do_eet_decode_dump */
static void
-do_eet_decode(const char * file,
- const char * key,
- const char * out,
- const char * crypto_key)
+do_eet_decode(const char *file,
+ const char *key,
+ const char *out,
+ const char *crypto_key)
{
- Eet_File * ef;
- FILE * f;
+ Eet_File *ef;
+ FILE *f;
ef = eet_open(file, EET_FILE_MODE_READ);
if (!ef)
@@ -151,20 +152,20 @@ do_eet_decode(const char * file,
} /* do_eet_decode */
static void
-do_eet_insert(const char * file,
- const char * key,
- const char * out,
- int compress,
- const char * crypto_key)
+do_eet_insert(const char *file,
+ const char *key,
+ const char *out,
+ int compress,
+ const char *crypto_key)
{
- Eet_File * ef;
- void * data;
+ Eet_File *ef;
+ void *data;
int size = 0;
- FILE * f;
+ FILE *f;
ef = eet_open(file, EET_FILE_MODE_READ_WRITE);
if (!ef)
- ef = eet_open(file, EET_FILE_MODE_WRITE);
+ ef = eet_open(file, EET_FILE_MODE_WRITE);
if (!ef)
{
@@ -202,21 +203,21 @@ do_eet_insert(const char * file,
} /* do_eet_insert */
static void
-do_eet_encode(const char * file,
- const char * key,
- const char * out,
- int compress,
- const char * crypto_key)
+do_eet_encode(const char *file,
+ const char *key,
+ const char *out,
+ int compress,
+ const char *crypto_key)
{
- Eet_File * ef;
- char * text;
+ Eet_File *ef;
+ char *text;
int textlen = 0;
int size = 0;
- FILE * f;
+ FILE *f;
ef = eet_open(file, EET_FILE_MODE_READ_WRITE);
if (!ef)
- ef = eet_open(file, EET_FILE_MODE_WRITE);
+ ef = eet_open(file, EET_FILE_MODE_WRITE);
if (!ef)
{
@@ -259,9 +260,10 @@ do_eet_encode(const char * file,
} /* do_eet_encode */
static void
-do_eet_remove(const char * file, const char * key)
+do_eet_remove(const char *file,
+ const char *key)
{
- Eet_File * ef;
+ Eet_File *ef;
ef = eet_open(file, EET_FILE_MODE_READ_WRITE);
if (!ef)
@@ -275,10 +277,10 @@ do_eet_remove(const char * file, const char * key)
} /* do_eet_remove */
static void
-do_eet_check(const char * file)
+do_eet_check(const char *file)
{
- Eet_File * ef;
- const void * der;
+ Eet_File *ef;
+ const void *der;
int der_length;
int sign_length;
@@ -301,10 +303,12 @@ do_eet_check(const char * file)
} /* do_eet_check */
static void
-do_eet_sign(const char * file, const char * private_key, const char * public_key)
+do_eet_sign(const char *file,
+ const char *private_key,
+ const char *public_key)
{
- Eet_File * ef;
- Eet_Key * key;
+ Eet_File *ef;
+ Eet_Key *key;
ef = eet_open(file, EET_FILE_MODE_READ_WRITE);
if (!ef)
@@ -329,77 +333,78 @@ do_eet_sign(const char * file, const char * private_key, const char * public_key
} /* do_eet_sign */
int
-main(int argc, char ** argv)
+main(int argc,
+ char **argv)
{
if (!eet_init())
- return -1;
+ return -1;
_eet_main_log_dom = eina_log_domain_register("eet_main", EINA_COLOR_CYAN);
if(_eet_main_log_dom < -1)
{
EINA_LOG_ERR("Impossible to create a log domain for eet_main.");
eet_shutdown();
- return(-1);
+ return -1;
}
if (argc < 2)
{
help:
printf(
- "Usage:\n"
- " eet -l FILE.EET list all keys in FILE.EET\n"
- " eet -x FILE.EET KEY OUT-FILE [CRYPTO_KEY] extract data stored in KEY in FILE.EET and write to OUT-FILE\n"
- " eet -d FILE.EET KEY OUT-FILE [CRYPTO_KEY] extract and decode data stored in KEY in FILE.EET and write to OUT-FILE\n"
- " eet -i FILE.EET KEY IN-FILE COMPRESS [CRYPTO_KEY] insert data to KEY in FILE.EET from IN-FILE and if COMPRESS is 1, compress it\n"
- " eet -e FILE.EET KEY IN-FILE COMPRESS [CRYPTO_KEY] insert and encode to KEY in FILE.EET from IN-FILE and if COMPRESS is 1, compress it\n"
- " eet -r FILE.EET KEY remove KEY in FILE.EET\n"
- " eet -c FILE.EET report and check the signature information of an eet file\n"
- " eet -s FILE.EET PRIVATE_KEY PUBLIC_KEY sign FILE.EET with PRIVATE_KEY and attach PUBLIC_KEY as it's certificate\n"
- );
+ "Usage:\n"
+ " eet -l FILE.EET list all keys in FILE.EET\n"
+ " eet -x FILE.EET KEY OUT-FILE [CRYPTO_KEY] extract data stored in KEY in FILE.EET and write to OUT-FILE\n"
+ " eet -d FILE.EET KEY OUT-FILE [CRYPTO_KEY] extract and decode data stored in KEY in FILE.EET and write to OUT-FILE\n"
+ " eet -i FILE.EET KEY IN-FILE COMPRESS [CRYPTO_KEY] insert data to KEY in FILE.EET from IN-FILE and if COMPRESS is 1, compress it\n"
+ " eet -e FILE.EET KEY IN-FILE COMPRESS [CRYPTO_KEY] insert and encode to KEY in FILE.EET from IN-FILE and if COMPRESS is 1, compress it\n"
+ " eet -r FILE.EET KEY remove KEY in FILE.EET\n"
+ " eet -c FILE.EET report and check the signature information of an eet file\n"
+ " eet -s FILE.EET PRIVATE_KEY PUBLIC_KEY sign FILE.EET with PRIVATE_KEY and attach PUBLIC_KEY as it's certificate\n"
+ );
eet_shutdown();
return -1;
}
if ((!strncmp(argv[1], "-h", 2)))
- goto help;
+ goto help;
else if ((!strcmp(argv[1], "-l")) && (argc > 2))
- do_eet_list(argv[2]);
+ do_eet_list(argv[2]);
else if ((!strcmp(argv[1], "-x")) && (argc > 4))
{
if (argc > 5)
- do_eet_extract(argv[2], argv[3], argv[4], argv[5]);
+ do_eet_extract(argv[2], argv[3], argv[4], argv[5]);
else
- do_eet_extract(argv[2], argv[3], argv[4], NULL);
+ do_eet_extract(argv[2], argv[3], argv[4], NULL);
}
else if ((!strcmp(argv[1], "-d")) && (argc > 4))
{
if (argc > 5)
- do_eet_decode(argv[2], argv[3], argv[4], argv[5]);
+ do_eet_decode(argv[2], argv[3], argv[4], argv[5]);
else
- do_eet_decode(argv[2], argv[3], argv[4], NULL);
+ do_eet_decode(argv[2], argv[3], argv[4], NULL);
}
else if ((!strcmp(argv[1], "-i")) && (argc > 5))
{
if (argc > 6)
- do_eet_insert(argv[2], argv[3], argv[4], atoi(argv[5]), argv[6]);
+ do_eet_insert(argv[2], argv[3], argv[4], atoi(argv[5]), argv[6]);
else
- do_eet_insert(argv[2], argv[3], argv[4], atoi(argv[5]), NULL);
+ do_eet_insert(argv[2], argv[3], argv[4], atoi(argv[5]), NULL);
}
else if ((!strcmp(argv[1], "-e")) && (argc > 5))
{
if (argc > 6)
- do_eet_encode(argv[2], argv[3], argv[4], atoi(argv[5]), argv[6]);
+ do_eet_encode(argv[2], argv[3], argv[4], atoi(argv[5]), argv[6]);
else
- do_eet_encode(argv[2], argv[3], argv[4], atoi(argv[5]), NULL);
+ do_eet_encode(argv[2], argv[3], argv[4], atoi(argv[5]), NULL);
}
else if ((!strcmp(argv[1], "-r")) && (argc > 3))
- do_eet_remove(argv[2], argv[3]);
+ do_eet_remove(argv[2], argv[3]);
else if ((!strcmp(argv[1], "-c")) && (argc > 2))
- do_eet_check(argv[2]);
+ do_eet_check(argv[2]);
else if ((!strcmp(argv[1], "-s")) && (argc > 4))
- do_eet_sign(argv[2], argv[3], argv[4]);
+ do_eet_sign(argv[2], argv[3], argv[4]);
else
- goto help;
+ goto help;
eina_log_domain_unregister(_eet_main_log_dom);
eet_shutdown();
diff --git a/src/examples/eet-basic.c b/src/examples/eet-basic.c
index 390cd71..05ff397 100644
--- a/src/examples/eet-basic.c
+++ b/src/examples/eet-basic.c
@@ -3,37 +3,38 @@
int
main(void)
{
- Eet_File *ef;
- char *ret;
- int size;
- char *entries[] =
- {
+ Eet_File *ef;
+ char *ret;
+ int size;
+ char *entries[] =
+ {
"Entry 1",
"Big text string here compared to others",
"Eet is cool"
- };
+ };
- eet_init();
+ eet_init();
- // blindly open an file for output and write strings with their NUL char
- ef = eet_open("test.eet", EET_FILE_MODE_WRITE);
- eet_write(ef, "Entry 1", entries[0], strlen(entries[0]) + 1, 0);
- eet_write(ef, "Entry 2", entries[1], strlen(entries[1]) + 1, 1);
- eet_write(ef, "Entry 3", entries[2], strlen(entries[2]) + 1, 0);
- eet_close(ef);
+ // blindly open an file for output and write strings with their NUL char
+ ef = eet_open("test.eet", EET_FILE_MODE_WRITE);
+ eet_write(ef, "Entry 1", entries[0], strlen(entries[0]) + 1, 0);
+ eet_write(ef, "Entry 2", entries[1], strlen(entries[1]) + 1, 1);
+ eet_write(ef, "Entry 3", entries[2], strlen(entries[2]) + 1, 0);
+ eet_close(ef);
- // open the file again and blindly get the entries we wrote
- ef = eet_open("test.eet", EET_FILE_MODE_READ);
- ret = eet_read(ef, "Entry 1", &size);
- printf("%s\n", ret);
- free(ret);
- ret = eet_read(ef, "Entry 2", &size);
- printf("%s\n", ret);
- free(ret);
- ret = eet_read(ef, "Entry 3", &size);
- printf("%s\n", ret);
- free(ret);
- eet_close(ef);
+ // open the file again and blindly get the entries we wrote
+ ef = eet_open("test.eet", EET_FILE_MODE_READ);
+ ret = eet_read(ef, "Entry 1", &size);
+ printf("%s\n", ret);
+ free(ret);
+ ret = eet_read(ef, "Entry 2", &size);
+ printf("%s\n", ret);
+ free(ret);
+ ret = eet_read(ef, "Entry 3", &size);
+ printf("%s\n", ret);
+ free(ret);
+ eet_close(ef);
- eet_shutdown();
+ eet_shutdown();
}
+
diff --git a/src/examples/eet-data-cipher_decipher.c b/src/examples/eet-data-cipher_decipher.c
index 1688e02..2ef965c 100644
--- a/src/examples/eet-data-cipher_decipher.c
+++ b/src/examples/eet-data-cipher_decipher.c
@@ -27,7 +27,7 @@ main(void)
if (!(file = tmpnam(file)))
{
fprintf(
- stderr, "ERROR: could not create temporary file (%s).\n", file);
+ stderr, "ERROR: could not create temporary file (%s).\n", file);
goto panic;
}
@@ -36,14 +36,14 @@ main(void)
if (!ef)
{
fprintf(
- stderr, "ERROR: could not access file (%s).\n", file);
+ stderr, "ERROR: could not access file (%s).\n", file);
goto error;
}
if (!eet_write_cipher(ef, "keys/tests", buffer, strlen(buffer) + 1, 0, key))
{
fprintf(
- stderr, "ERROR: could not access file (%s).\n", file);
+ stderr, "ERROR: could not access file (%s).\n", file);
goto error;
}
@@ -54,7 +54,7 @@ main(void)
if (!ef)
{
fprintf(
- stderr, "ERROR: could not access file (%s).\n", file);
+ stderr, "ERROR: could not access file (%s).\n", file);
goto error;
}
@@ -62,22 +62,22 @@ main(void)
if (!test)
{
fprintf(
- stderr, "ERROR: could decript contents on file %s, with key %s.\n",
- file, key);
+ stderr, "ERROR: could decript contents on file %s, with key %s.\n",
+ file, key);
goto error;
}
if (size != (int)strlen(buffer) + 1)
{
fprintf(
- stderr, "ERROR: something is wrong with the decripted data\n");
+ stderr, "ERROR: something is wrong with the decripted data\n");
goto error;
}
if (memcmp(test, buffer, strlen(buffer) + 1) != 0)
{
fprintf(
- stderr, "ERROR: something is wrong with the decripted data\n");
+ stderr, "ERROR: something is wrong with the decripted data\n");
goto error;
}
@@ -88,7 +88,7 @@ main(void)
if (!ef)
{
fprintf(
- stderr, "ERROR: could not access file (%s).\n", file);
+ stderr, "ERROR: could not access file (%s).\n", file);
goto error;
}
@@ -96,24 +96,24 @@ main(void)
if (size == (int)strlen(buffer) + 1)
if (memcmp(test, buffer, strlen(buffer) + 1) == 0)
- {
- fprintf(
+ {
+ fprintf(
stderr, "ERROR: something is wrong with the contents of %s, as"
- " we accessed it with a different key and it decripted our"
- " information right.\n", file);
- goto error;
- }
+ " we accessed it with a different key and it decripted our"
+ " information right.\n", file);
+ goto error;
+ }
eet_close(ef);
- error:
+error:
if (unlink(file) != 0)
{
fprintf(
- stderr, "ERROR: could not unlink file (%s).\n", file);
+ stderr, "ERROR: could not unlink file (%s).\n", file);
}
- panic:
+panic:
eet_shutdown();
}
diff --git a/src/examples/eet-data-file_descriptor_01.c b/src/examples/eet-data-file_descriptor_01.c
index ed0f724..4b5b75f 100644
--- a/src/examples/eet-data-file_descriptor_01.c
+++ b/src/examples/eet-data-file_descriptor_01.c
@@ -82,48 +82,48 @@ _my_cache_descriptor_init(void)
// Describe the members to be saved:
// Use a temporary macro so we don't type a lot, also avoid errors:
-#define ADD_BASIC(member, eet_type)\
- EET_DATA_DESCRIPTOR_ADD_BASIC\
- (_my_message_descriptor, My_Message, # member, member, eet_type)
+#define ADD_BASIC(member, eet_type) \
+ EET_DATA_DESCRIPTOR_ADD_BASIC \
+ (_my_message_descriptor, My_Message, # member, member, eet_type)
ADD_BASIC(screen_name, EET_T_STRING);
- ADD_BASIC(name, EET_T_STRING);
- ADD_BASIC(message, EET_T_STRING);
- ADD_BASIC(id, EET_T_UINT);
- ADD_BASIC(status_id, EET_T_UINT);
- ADD_BASIC(date, EET_T_UINT);
- ADD_BASIC(timeline, EET_T_UINT);
+ ADD_BASIC(name, EET_T_STRING);
+ ADD_BASIC(message, EET_T_STRING);
+ ADD_BASIC(id, EET_T_UINT);
+ ADD_BASIC(status_id, EET_T_UINT);
+ ADD_BASIC(date, EET_T_UINT);
+ ADD_BASIC(timeline, EET_T_UINT);
#undef ADD_BASIC
-#define ADD_BASIC(member, eet_type)\
- EET_DATA_DESCRIPTOR_ADD_BASIC\
- (_my_post_descriptor, My_Post, # member, member, eet_type)
- ADD_BASIC(dm_to, EET_T_STRING);
+#define ADD_BASIC(member, eet_type) \
+ EET_DATA_DESCRIPTOR_ADD_BASIC \
+ (_my_post_descriptor, My_Post, # member, member, eet_type)
+ ADD_BASIC(dm_to, EET_T_STRING);
ADD_BASIC(message, EET_T_STRING);
#undef ADD_BASIC
-#define ADD_BASIC(member, eet_type)\
- EET_DATA_DESCRIPTOR_ADD_BASIC\
- (_my_account_descriptor, My_Account, # member, member, eet_type)
+#define ADD_BASIC(member, eet_type) \
+ EET_DATA_DESCRIPTOR_ADD_BASIC \
+ (_my_account_descriptor, My_Account, # member, member, eet_type)
ADD_BASIC(name, EET_T_STRING);
- ADD_BASIC(id, EET_T_UINT);
+ ADD_BASIC(id, EET_T_UINT);
#undef ADD_BASIC
EET_DATA_DESCRIPTOR_ADD_LIST
- (_my_account_descriptor, My_Account, "messages", messages,
- _my_message_descriptor);
+ (_my_account_descriptor, My_Account, "messages", messages,
+ _my_message_descriptor);
EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY
- (_my_account_descriptor, My_Account, "posts", posts,
- _my_post_descriptor);
+ (_my_account_descriptor, My_Account, "posts", posts,
+ _my_post_descriptor);
-#define ADD_BASIC(member, eet_type)\
- EET_DATA_DESCRIPTOR_ADD_BASIC\
- (_my_cache_descriptor, My_Cache, # member, member, eet_type)
+#define ADD_BASIC(member, eet_type) \
+ EET_DATA_DESCRIPTOR_ADD_BASIC \
+ (_my_cache_descriptor, My_Cache, # member, member, eet_type)
ADD_BASIC(version, EET_T_UINT);
#undef ADD_BASIC
EET_DATA_DESCRIPTOR_ADD_HASH
- (_my_cache_descriptor, My_Cache, "accounts", accounts,
- _my_account_descriptor);
+ (_my_cache_descriptor, My_Cache, "accounts", accounts,
+ _my_account_descriptor);
} /* _my_cache_descriptor_init */
static void
@@ -138,21 +138,21 @@ _my_cache_descriptor_shutdown(void)
// need to check if the pointer came from mmaped area in eet_dictionary
// or it was allocated with eina_stringshare_add()
static void
-_eet_string_free(const char * str)
+_eet_string_free(const char *str)
{
if (!str)
- return;
+ return;
if ((_my_cache_dict) && (eet_dictionary_string_check(_my_cache_dict, str)))
- return;
+ return;
eina_stringshare_del(str);
} /* _eet_string_free */
static My_Message *
-_my_message_new(const char * message)
+_my_message_new(const char *message)
{
- My_Message * msg = calloc(1, sizeof(My_Message));
+ My_Message *msg = calloc(1, sizeof(My_Message));
if (!msg)
{
fprintf(stderr, "ERROR: could not calloc My_Message\n");
@@ -164,7 +164,7 @@ _my_message_new(const char * message)
} /* _my_message_new */
static void
-_my_message_free(My_Message * msg)
+_my_message_free(My_Message *msg)
{
_eet_string_free(msg->screen_name);
_eet_string_free(msg->name);
@@ -173,7 +173,8 @@ _my_message_free(My_Message * msg)
} /* _my_message_free */
static Eina_Bool
-_my_post_add(My_Account *acc, const char * message)
+_my_post_add(My_Account *acc,
+ const char *message)
{
int new_count = acc->posts_count + 1;
My_Post *post = realloc(acc->posts, new_count * sizeof(My_Post));
@@ -187,20 +188,20 @@ _my_post_add(My_Account *acc, const char * message)
post[acc->posts_count].dm_to = NULL;
acc->posts_count = new_count;
acc->posts = post;
- return EINA_TRUE;;
+ return EINA_TRUE;
} /* _my_post_new */
static void
-_my_post_free(My_Post * post)
+_my_post_free(My_Post *post)
{
_eet_string_free(post->dm_to);
_eet_string_free(post->message);
} /* _my_post_free */
static My_Account *
-_my_account_new(const char * name)
+_my_account_new(const char *name)
{
- My_Account * acc = calloc(1, sizeof(My_Account));
+ My_Account *acc = calloc(1, sizeof(My_Account));
if (!acc)
{
fprintf(stderr, "ERROR: could not calloc My_Account\n");
@@ -212,15 +213,15 @@ _my_account_new(const char * name)
} /* _my_account_new */
static void
-_my_account_free(My_Account * acc)
+_my_account_free(My_Account *acc)
{
- My_Message * m;
+ My_Message *m;
int i;
_eet_string_free(acc->name);
EINA_LIST_FREE(acc->messages, m)
- _my_message_free(m);
+ _my_message_free(m);
for (i = 0; i < acc->posts_count; i++)
_my_post_free(&acc->posts[i]);
@@ -232,7 +233,7 @@ _my_account_free(My_Account * acc)
static My_Cache *
_my_cache_new(void)
{
- My_Cache * my_cache = calloc(1, sizeof(My_Cache));
+ My_Cache *my_cache = calloc(1, sizeof(My_Cache));
if (!my_cache)
{
fprintf(stderr, "ERROR: could not calloc My_Cache\n");
@@ -246,32 +247,36 @@ _my_cache_new(void)
} /* _my_cache_new */
static Eina_Bool
-_my_cache_account_free_cb(const Eina_Hash *hash, const void *key, void *data, void *fdata)
+_my_cache_account_free_cb(const Eina_Hash *hash,
+ const void *key,
+ void *data,
+ void *fdata)
{
_my_account_free(data);
return EINA_TRUE;
}
static void
-_my_cache_free(My_Cache * my_cache)
+_my_cache_free(My_Cache *my_cache)
{
- My_Account * acc;
+ My_Account *acc;
eina_hash_foreach(my_cache->accounts, _my_cache_account_free_cb, NULL);
eina_hash_free(my_cache->accounts);
free(my_cache);
} /* _my_cache_free */
static My_Account *
-_my_cache_account_find(My_Cache * my_cache, const char * name)
+_my_cache_account_find(My_Cache *my_cache,
+ const char *name)
{
return eina_hash_find(my_cache->accounts, name);
} /* _my_cache_account_find */
static My_Cache *
-_my_cache_load(const char * filename)
+_my_cache_load(const char *filename)
{
- My_Cache * my_cache;
- Eet_File * ef = eet_open(filename, EET_FILE_MODE_READ);
+ My_Cache *my_cache;
+ Eet_File *ef = eet_open(filename, EET_FILE_MODE_READ);
if (!ef)
{
fprintf(stderr, "ERROR: could not open '%s' for read\n", filename);
@@ -295,7 +300,7 @@ _my_cache_load(const char * filename)
}
if (_my_cache_file)
- eet_close(_my_cache_file);
+ eet_close(_my_cache_file);
_my_cache_file = ef;
_my_cache_dict = eet_dictionary_get(ef);
@@ -304,10 +309,11 @@ _my_cache_load(const char * filename)
} /* _my_cache_load */
static Eina_Bool
-_my_cache_save(const My_Cache * my_cache, const char * filename)
+_my_cache_save(const My_Cache *my_cache,
+ const char *filename)
{
char tmp[PATH_MAX];
- Eet_File * ef;
+ Eet_File *ef;
Eina_Bool ret;
unsigned int i, len;
struct stat st;
@@ -335,7 +341,7 @@ _my_cache_save(const My_Cache * my_cache, const char * filename)
}
ret = eet_data_write
- (ef, _my_cache_descriptor, MY_CACHE_FILE_ENTRY, my_cache, EINA_TRUE);
+ (ef, _my_cache_descriptor, MY_CACHE_FILE_ENTRY, my_cache, EINA_TRUE);
// VERY IMPORTANT NOTE:
// after eet_close(), all strings mmaped from file will be GONE, invalid!
@@ -356,12 +362,14 @@ _my_cache_save(const My_Cache * my_cache, const char * filename)
return ret;
} /* _my_cache_save */
-int main(int argc, char * argv[])
+int
+main(int argc,
+ char *argv[])
{
- My_Cache * my_cache;
- const Eina_List * l_acc;
+ My_Cache *my_cache;
+ const Eina_List *l_acc;
Eina_Iterator *it;
- My_Account * acc;
+ My_Account *acc;
int ret = 0;
if (argc < 3)
@@ -399,58 +407,58 @@ int main(int argc, char * argv[])
{
if (argc == 5)
{
- My_Account * acc = _my_cache_account_find(my_cache, argv[4]);
+ My_Account *acc = _my_cache_account_find(my_cache, argv[4]);
if (!acc)
{
acc = _my_account_new(argv[4]);
eina_hash_direct_add(my_cache->accounts, acc->name, acc);
}
else
- fprintf(stderr, "ERROR: account '%s' already exists.\n",
- argv[4]);
+ fprintf(stderr, "ERROR: account '%s' already exists.\n",
+ argv[4]);
}
else
- fprintf(stderr,
- "ERROR: wrong number of parameters (%d).\n",
- argc);
+ fprintf(stderr,
+ "ERROR: wrong number of parameters (%d).\n",
+ argc);
}
else if (strcmp(argv[3], "post") == 0)
{
if (argc == 6)
{
- My_Account * acc = _my_cache_account_find(my_cache, argv[4]);
+ My_Account *acc = _my_cache_account_find(my_cache, argv[4]);
if (acc)
{
_my_post_add(acc, argv[5]);
}
else
- fprintf(stderr, "ERROR: unknown account: '%s'\n", argv[4]);
+ fprintf(stderr, "ERROR: unknown account: '%s'\n", argv[4]);
}
else
- fprintf(stderr,
- "ERROR: wrong number of parameters (%d).\n",
- argc);
+ fprintf(stderr,
+ "ERROR: wrong number of parameters (%d).\n",
+ argc);
}
else if (strcmp(argv[3], "message") == 0)
{
if (argc == 6)
{
- My_Account * acc = _my_cache_account_find(my_cache, argv[4]);
+ My_Account *acc = _my_cache_account_find(my_cache, argv[4]);
if (acc)
{
- My_Message * msg = _my_message_new(argv[5]);
+ My_Message *msg = _my_message_new(argv[5]);
acc->messages = eina_list_append(acc->messages, msg);
}
else
- fprintf(stderr, "ERROR: unknown account: '%s'\n", argv[4]);
+ fprintf(stderr, "ERROR: unknown account: '%s'\n", argv[4]);
}
else
- fprintf(stderr,
- "ERROR: wrong number of parameters (%d).\n",
- argc);
+ fprintf(stderr,
+ "ERROR: wrong number of parameters (%d).\n",
+ argc);
}
else
- fprintf(stderr, "ERROR: unknown action '%s'\n", argv[2]);
+ fprintf(stderr, "ERROR: unknown action '%s'\n", argv[2]);
}
printf("My_Cache:\n"
@@ -460,52 +468,52 @@ int main(int argc, char * argv[])
eina_hash_population(my_cache->accounts));
it = eina_hash_iterator_data_new(my_cache->accounts);
EINA_ITERATOR_FOREACH(it, acc)
- {
- const My_Post * post;
-
- printf("\t > %-#8x '%.20s' stats: m=%u, p=%u\n",
- acc->id, acc->name ? acc->name : "",
- eina_list_count(acc->messages),
- acc->posts_count);
-
- if (eina_list_count(acc->messages))
- {
- const Eina_List * l;
- const My_Message * msg;
- printf("\t |messages:\n");
-
- EINA_LIST_FOREACH(acc->messages, l, msg)
- {
- printf("\t | %-8x '%s' [%s]: '%.20s'\n",
- msg->id,
- msg->name ? msg->name : "",
- msg->screen_name ? msg->screen_name : "",
- msg->message ? msg->message : "");
- }
- }
-
- if (acc->posts_count)
- {
- const My_Post * post;
- int i;
- printf("\t |posts:\n");
-
- for (i = 0; i < acc->posts_count; i++)
- {
- post = &acc->posts[i];
- if (post->dm_to)
- printf("\t | @%s: '%.20s'\n", post->dm_to, post->message);
- else
- printf("\t | '%.20s'\n", post->message);
- }
- }
-
- printf("\n");
- }
+ {
+ const My_Post *post;
+
+ printf("\t > %-#8x '%.20s' stats: m=%u, p=%u\n",
+ acc->id, acc->name ? acc->name : "",
+ eina_list_count(acc->messages),
+ acc->posts_count);
+
+ if (eina_list_count(acc->messages))
+ {
+ const Eina_List *l;
+ const My_Message *msg;
+ printf("\t |messages:\n");
+
+ EINA_LIST_FOREACH(acc->messages, l, msg)
+ {
+ printf("\t | %-8x '%s' [%s]: '%.20s'\n",
+ msg->id,
+ msg->name ? msg->name : "",
+ msg->screen_name ? msg->screen_name : "",
+ msg->message ? msg->message : "");
+ }
+ }
+
+ if (acc->posts_count)
+ {
+ const My_Post *post;
+ int i;
+ printf("\t |posts:\n");
+
+ for (i = 0; i < acc->posts_count; i++)
+ {
+ post = &acc->posts[i];
+ if (post->dm_to)
+ printf("\t | @%s: '%.20s'\n", post->dm_to, post->message);
+ else
+ printf("\t | '%.20s'\n", post->message);
+ }
+ }
+
+ printf("\n");
+ }
eina_iterator_free(it);
if (!_my_cache_save(my_cache, argv[2]))
- ret = -3;
+ ret = -3;
_my_cache_free(my_cache);
diff --git a/src/examples/eet-data-file_descriptor_02.c b/src/examples/eet-data-file_descriptor_02.c
index 9690d6b..65ba79e 100644
--- a/src/examples/eet-data-file_descriptor_02.c
+++ b/src/examples/eet-data-file_descriptor_02.c
@@ -115,7 +115,9 @@ _st3_set(Example_Struct3 *st3,
st3->body = v1;
} /* _st3_set */
-static const char * /* union type_get() */
+static const char *
+/* union
+ type_get() */
_union_type_get(const void *data,
Eina_Bool *unknow)
{
@@ -259,7 +261,8 @@ static Eet_Data_Descriptor *_variant_unified_descriptor;
static Eet_File *_cache_file = NULL;
static Eet_Dictionary *_cache_dict = NULL;
-static void /* declaring types */
+static void
+/* declaring types */
_data_descriptors_init(void)
{
Eet_Data_Descriptor_Class eddc;
diff --git a/src/examples/eet-data-nested.c b/src/examples/eet-data-nested.c
index 882fc24..a6b0e12 100644
--- a/src/examples/eet-data-nested.c
+++ b/src/examples/eet-data-nested.c
@@ -17,17 +17,17 @@
typedef struct
{
unsigned int version; // it is recommended to use versioned configuration!
- const char * name;
+ const char *name;
int id;
int not_saved_value; // example of not saved data inside!
Eina_Bool enabled;
- Eina_List * subs;
+ Eina_List *subs;
} My_Conf_Type;
typedef struct
{
- const char * server;
- int port;
+ const char *server;
+ int port;
} My_Conf_Subtype;
// string that represents the entry in eet file, you might like to have
@@ -38,8 +38,8 @@ static const char MY_CONF_FILE_ENTRY[] = "config";
// keep the descriptor static global, so it can be
// shared by different functions (load/save) of this and only this
// file.
-static Eet_Data_Descriptor * _my_conf_descriptor;
-static Eet_Data_Descriptor * _my_conf_sub_descriptor;
+static Eet_Data_Descriptor *_my_conf_descriptor;
+static Eet_Data_Descriptor *_my_conf_sub_descriptor;
static void
_my_conf_descriptor_init(void)
@@ -66,24 +66,24 @@ _my_conf_descriptor_init(void)
// Describe the members to be saved:
// Use a temporary macro so we don't type a lot, also avoid errors:
-#define MY_CONF_ADD_BASIC(member, eet_type)\
- EET_DATA_DESCRIPTOR_ADD_BASIC\
- (_my_conf_descriptor, My_Conf_Type, # member, member, eet_type)
-#define MY_CONF_SUB_ADD_BASIC(member, eet_type)\
- EET_DATA_DESCRIPTOR_ADD_BASIC\
- (_my_conf_sub_descriptor, My_Conf_Subtype, # member, member, eet_type)
+#define MY_CONF_ADD_BASIC(member, eet_type) \
+ EET_DATA_DESCRIPTOR_ADD_BASIC \
+ (_my_conf_descriptor, My_Conf_Type, # member, member, eet_type)
+#define MY_CONF_SUB_ADD_BASIC(member, eet_type) \
+ EET_DATA_DESCRIPTOR_ADD_BASIC \
+ (_my_conf_sub_descriptor, My_Conf_Subtype, # member, member, eet_type)
MY_CONF_SUB_ADD_BASIC(server, EET_T_STRING);
- MY_CONF_SUB_ADD_BASIC(port, EET_T_INT);
+ MY_CONF_SUB_ADD_BASIC(port, EET_T_INT);
MY_CONF_ADD_BASIC(version, EET_T_UINT);
- MY_CONF_ADD_BASIC(name, EET_T_STRING);
- MY_CONF_ADD_BASIC(id, EET_T_INT);
+ MY_CONF_ADD_BASIC(name, EET_T_STRING);
+ MY_CONF_ADD_BASIC(id, EET_T_INT);
MY_CONF_ADD_BASIC(enabled, EET_T_UCHAR);
// And add the sub descriptor as a linked list at 'subs' in the main struct
EET_DATA_DESCRIPTOR_ADD_LIST
- (_my_conf_descriptor, My_Conf_Type, "subs", subs, _my_conf_sub_descriptor);
+ (_my_conf_descriptor, My_Conf_Type, "subs", subs, _my_conf_sub_descriptor);
#undef MY_CONF_ADD_BASIC
#undef MY_CONF_SUB_ADD_BASIC
@@ -99,8 +99,8 @@ _my_conf_descriptor_shutdown(void)
static My_Conf_Type *
_my_conf_new(void)
{
- My_Conf_Type * my_conf = calloc(1, sizeof(My_Conf_Type));
- My_Conf_Subtype * sub;
+ My_Conf_Type *my_conf = calloc(1, sizeof(My_Conf_Type));
+ My_Conf_Subtype *sub;
if (!my_conf)
{
fprintf(stderr, "ERROR: could not calloc My_Conf_Type\n");
@@ -122,24 +122,24 @@ _my_conf_new(void)
} /* _my_conf_new */
static void
-_my_conf_free(My_Conf_Type * my_conf)
+_my_conf_free(My_Conf_Type *my_conf)
{
- My_Conf_Subtype * sub;
+ My_Conf_Subtype *sub;
EINA_LIST_FREE(my_conf->subs, sub)
- {
- eina_stringshare_del(sub->server);
- free(sub);
- }
+ {
+ eina_stringshare_del(sub->server);
+ free(sub);
+ }
eina_stringshare_del(my_conf->name);
free(my_conf);
} /* _my_conf_free */
static My_Conf_Type *
-_my_conf_load(const char * filename)
+_my_conf_load(const char *filename)
{
- My_Conf_Type * my_conf;
- Eet_File * ef = eet_open(filename, EET_FILE_MODE_READ);
+ My_Conf_Type *my_conf;
+ Eet_File *ef = eet_open(filename, EET_FILE_MODE_READ);
if (!ef)
{
fprintf(stderr, "ERROR: could not open '%s' for read\n", filename);
@@ -148,7 +148,7 @@ _my_conf_load(const char * filename)
my_conf = eet_data_read(ef, _my_conf_descriptor, MY_CONF_FILE_ENTRY);
if (!my_conf)
- goto end;
+ goto end;
if (my_conf->version < 0x112233)
{
@@ -166,10 +166,11 @@ end:
} /* _my_conf_load */
static Eina_Bool
-_my_conf_save(const My_Conf_Type * my_conf, const char * filename)
+_my_conf_save(const My_Conf_Type *my_conf,
+ const char *filename)
{
char tmp[PATH_MAX];
- Eet_File * ef;
+ Eet_File *ef;
Eina_Bool ret;
unsigned int i, len;
struct stat st;
@@ -197,7 +198,7 @@ _my_conf_save(const My_Conf_Type * my_conf, const char * filename)
}
ret = eet_data_write
- (ef, _my_conf_descriptor, MY_CONF_FILE_ENTRY, my_conf, EINA_TRUE);
+ (ef, _my_conf_descriptor, MY_CONF_FILE_ENTRY, my_conf, EINA_TRUE);
eet_close(ef);
if (ret)
@@ -209,11 +210,13 @@ _my_conf_save(const My_Conf_Type * my_conf, const char * filename)
return ret;
} /* _my_conf_save */
-int main(int argc, char * argv[])
+int
+main(int argc,
+ char *argv[])
{
- My_Conf_Type * my_conf;
- const My_Conf_Subtype * sub;
- const Eina_List * l;
+ My_Conf_Type *my_conf;
+ const My_Conf_Subtype *sub;
+ const Eina_List *l;
int ret = 0;
if (argc != 3)
@@ -250,12 +253,12 @@ int main(int argc, char * argv[])
my_conf->enabled);
EINA_LIST_FOREACH(my_conf->subs, l, sub)
- printf("\t\tserver: '%s', port: %d\n",
- sub->server ? sub->server : "",
- sub->port);
+ printf("\t\tserver: '%s', port: %d\n",
+ sub->server ? sub->server : "",
+ sub->port);
if (!_my_conf_save(my_conf, argv[2]))
- ret = -3;
+ ret = -3;
_my_conf_free(my_conf);
diff --git a/src/examples/eet-data-simple.c b/src/examples/eet-data-simple.c
index 395a8d6..1951fc0 100644
--- a/src/examples/eet-data-simple.c
+++ b/src/examples/eet-data-simple.c
@@ -17,7 +17,7 @@
typedef struct
{
unsigned int version; // it is recommended to use versioned configuration!
- const char * name;
+ const char *name;
int id;
int not_saved_value; // example of not saved data inside!
Eina_Bool enabled;
@@ -31,7 +31,7 @@ static const char MY_CONF_FILE_ENTRY[] = "config";
// keep the descriptor static global, so it can be
// shared by different functions (load/save) of this and only this
// file.
-static Eet_Data_Descriptor * _my_conf_descriptor;
+static Eet_Data_Descriptor *_my_conf_descriptor;
static void
_my_conf_descriptor_init(void)
@@ -55,13 +55,13 @@ _my_conf_descriptor_init(void)
// Describe the members to be saved:
// Use a temporary macro so we don't type a lot, also avoid errors:
-#define MY_CONF_ADD_BASIC(member, eet_type)\
- EET_DATA_DESCRIPTOR_ADD_BASIC\
- (_my_conf_descriptor, My_Conf_Type, # member, member, eet_type)
+#define MY_CONF_ADD_BASIC(member, eet_type) \
+ EET_DATA_DESCRIPTOR_ADD_BASIC \
+ (_my_conf_descriptor, My_Conf_Type, # member, member, eet_type)
MY_CONF_ADD_BASIC(version, EET_T_UINT);
- MY_CONF_ADD_BASIC(name, EET_T_STRING);
- MY_CONF_ADD_BASIC(id, EET_T_INT);
+ MY_CONF_ADD_BASIC(name, EET_T_STRING);
+ MY_CONF_ADD_BASIC(id, EET_T_INT);
MY_CONF_ADD_BASIC(enabled, EET_T_UCHAR);
#undef MY_CONF_ADD_BASIC
@@ -76,7 +76,7 @@ _my_conf_descriptor_shutdown(void)
static My_Conf_Type *
_my_conf_new(void)
{
- My_Conf_Type * my_conf = calloc(1, sizeof(My_Conf_Type));
+ My_Conf_Type *my_conf = calloc(1, sizeof(My_Conf_Type));
if (!my_conf)
{
fprintf(stderr, "ERROR: could not calloc My_Conf_Type\n");
@@ -89,17 +89,17 @@ _my_conf_new(void)
} /* _my_conf_new */
static void
-_my_conf_free(My_Conf_Type * my_conf)
+_my_conf_free(My_Conf_Type *my_conf)
{
eina_stringshare_del(my_conf->name);
free(my_conf);
} /* _my_conf_free */
static My_Conf_Type *
-_my_conf_load(const char * filename)
+_my_conf_load(const char *filename)
{
- My_Conf_Type * my_conf;
- Eet_File * ef = eet_open(filename, EET_FILE_MODE_READ);
+ My_Conf_Type *my_conf;
+ Eet_File *ef = eet_open(filename, EET_FILE_MODE_READ);
if (!ef)
{
fprintf(stderr, "ERROR: could not open '%s' for read\n", filename);
@@ -108,7 +108,7 @@ _my_conf_load(const char * filename)
my_conf = eet_data_read(ef, _my_conf_descriptor, MY_CONF_FILE_ENTRY);
if (!my_conf)
- goto end;
+ goto end;
if (my_conf->version < 0x112233)
{
@@ -126,10 +126,11 @@ end:
} /* _my_conf_load */
static Eina_Bool
-_my_conf_save(const My_Conf_Type * my_conf, const char * filename)
+_my_conf_save(const My_Conf_Type *my_conf,
+ const char *filename)
{
char tmp[PATH_MAX];
- Eet_File * ef;
+ Eet_File *ef;
Eina_Bool ret;
unsigned int i, len;
struct stat st;
@@ -157,7 +158,7 @@ _my_conf_save(const My_Conf_Type * my_conf, const char * filename)
}
ret = eet_data_write
- (ef, _my_conf_descriptor, MY_CONF_FILE_ENTRY, my_conf, EINA_TRUE);
+ (ef, _my_conf_descriptor, MY_CONF_FILE_ENTRY, my_conf, EINA_TRUE);
eet_close(ef);
if (ret)
@@ -169,9 +170,11 @@ _my_conf_save(const My_Conf_Type * my_conf, const char * filename)
return ret;
} /* _my_conf_save */
-int main(int argc, char * argv[])
+int
+main(int argc,
+ char *argv[])
{
- My_Conf_Type * my_conf;
+ My_Conf_Type *my_conf;
int ret = 0;
if (argc != 3)
@@ -207,7 +210,7 @@ int main(int argc, char * argv[])
my_conf->enabled);
if (!_my_conf_save(my_conf, argv[2]))
- ret = -3;
+ ret = -3;
_my_conf_free(my_conf);
diff --git a/src/examples/eet-file.c b/src/examples/eet-file.c
index 017a6cd..740c179 100644
--- a/src/examples/eet-file.c
+++ b/src/examples/eet-file.c
@@ -12,25 +12,25 @@ create_eet_file(void)
char buf[1024], *ptr;
int size, len, i;
const char *some_strings[] = {
- "And some more strings",
- "spread across several",
- "elements of an array!"
+ "And some more strings",
+ "spread across several",
+ "elements of an array!"
};
const char some_data[] =
- "\x1e\xe7\x0f\x42\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x35"
- "\x00\x00\x00\xa0\x00\x00\x00\xa0\x00\x00\x00\x24\x00\x00\x00\x11"
- "\x00\x00\x00\x00\x2f\x6d\x69\x73\x74\x65\x72\x69\x6f\x75\x73\x2f"
- "\x64\x61\x74\x61\x00\x41\x6e\x20\x45\x45\x54\x20\x69\x6e\x73\x69"
- "\x64\x65\x20\x6f\x66\x20\x61\x6e\x20\x45\x45\x54\x21\x0a\x54\x68"
- "\x69\x73\x20\x77\x61\x73\x6e\x27\x74\x20\x72\x65\x61\x6c\x6c\x79"
- "\x20\x75\x73\x65\x66\x75\x6c\x20\x62\x75\x74\x20\x69\x74\x20\x68"
- "\x65\x6c\x70\x65\x64\x20\x74\x6f\x20\x73\x68\x6f\x77\x20\x68\x6f"
- "\x77\x0a\x74\x6f\x20\x75\x73\x65\x20\x65\x65\x74\x5f\x6d\x65\x6d"
- "\x6f\x70\x65\x6e\x5f\x72\x65\x61\x64\x28\x29\x20\x74\x6f\x20\x6f"
- "\x70\x65\x6e\x20\x61\x6e\x20\x65\x65\x74\x20\x66\x69\x6c\x65\x20"
- "\x66\x72\x6f\x6d\x0a\x64\x61\x74\x61\x20\x61\x6c\x72\x65\x61\x64"
- "\x79\x20\x6c\x6f\x61\x64\x65\x64\x20\x69\x6e\x20\x6d\x65\x6d\x6f"
- "\x72\x79\x2e\x0a\x00";
+ "\x1e\xe7\x0f\x42\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x35"
+ "\x00\x00\x00\xa0\x00\x00\x00\xa0\x00\x00\x00\x24\x00\x00\x00\x11"
+ "\x00\x00\x00\x00\x2f\x6d\x69\x73\x74\x65\x72\x69\x6f\x75\x73\x2f"
+ "\x64\x61\x74\x61\x00\x41\x6e\x20\x45\x45\x54\x20\x69\x6e\x73\x69"
+ "\x64\x65\x20\x6f\x66\x20\x61\x6e\x20\x45\x45\x54\x21\x0a\x54\x68"
+ "\x69\x73\x20\x77\x61\x73\x6e\x27\x74\x20\x72\x65\x61\x6c\x6c\x79"
+ "\x20\x75\x73\x65\x66\x75\x6c\x20\x62\x75\x74\x20\x69\x74\x20\x68"
+ "\x65\x6c\x70\x65\x64\x20\x74\x6f\x20\x73\x68\x6f\x77\x20\x68\x6f"
+ "\x77\x0a\x74\x6f\x20\x75\x73\x65\x20\x65\x65\x74\x5f\x6d\x65\x6d"
+ "\x6f\x70\x65\x6e\x5f\x72\x65\x61\x64\x28\x29\x20\x74\x6f\x20\x6f"
+ "\x70\x65\x6e\x20\x61\x6e\x20\x65\x65\x74\x20\x66\x69\x6c\x65\x20"
+ "\x66\x72\x6f\x6d\x0a\x64\x61\x74\x61\x20\x61\x6c\x72\x65\x61\x64"
+ "\x79\x20\x6c\x6f\x61\x64\x65\x64\x20\x69\x6e\x20\x6d\x65\x6d\x6f"
+ "\x72\x79\x2e\x0a\x00";
ef = eet_open("/tmp/my_file.eet", EET_FILE_MODE_WRITE);
if (!ef) return 0;
@@ -60,67 +60,68 @@ create_eet_file(void)
eet_delete(ef, "/several/strings");
- return (eet_close(ef) == EET_ERROR_NONE);
+ return eet_close(ef) == EET_ERROR_NONE;
}
int
main(void)
{
- Eet_File *ef;
- char *ret, **list;
- int size, num, i;
+ Eet_File *ef;
+ char *ret, **list;
+ int size, num, i;
- eet_init();
+ eet_init();
- if (!create_eet_file())
- return -1;
+ if (!create_eet_file())
+ return -1;
- ef = eet_open("/tmp/my_file.eet", EET_FILE_MODE_READ);
- if (!ef) return -1;
+ ef = eet_open("/tmp/my_file.eet", EET_FILE_MODE_READ);
+ if (!ef) return -1;
- list = eet_list(ef, "*", &num);
- if (list)
- {
- for (i = 0; i < num; i++)
- printf("Key stored: %s\n", list[i]);
- free(list);
- }
+ list = eet_list(ef, "*", &num);
+ if (list)
+ {
+ for (i = 0; i < num; i++)
+ printf("Key stored: %s\n", list[i]);
+ free(list);
+ }
- ret = eet_read(ef, "/key/to_store/at", &size);
- if (ret)
- {
- printf("Data read (%i bytes):\n%s\n", size, ret);
- free(ret);
- }
+ ret = eet_read(ef, "/key/to_store/at", &size);
+ if (ret)
+ {
+ printf("Data read (%i bytes):\n%s\n", size, ret);
+ free(ret);
+ }
- ret = eet_read(ef, "/several/strings", &size);
- if (ret)
- {
- printf("More data read (%i bytes):\n%s\n", size, ret);
- free(ret);
- }
+ ret = eet_read(ef, "/several/strings", &size);
+ if (ret)
+ {
+ printf("More data read (%i bytes):\n%s\n", size, ret);
+ free(ret);
+ }
- ret = eet_read(ef, "/some/mysterious/data", &size);
- if (ret)
- {
- Eet_File *ef2;
+ ret = eet_read(ef, "/some/mysterious/data", &size);
+ if (ret)
+ {
+ Eet_File *ef2;
- ef2 = eet_memopen_read(ret, size);
+ ef2 = eet_memopen_read(ret, size);
- num = eet_num_entries(ef2);
- printf("Mysterious data has %d entries\n", num);
+ num = eet_num_entries(ef2);
+ printf("Mysterious data has %d entries\n", num);
- printf("Mysterious data:\n%s\n",
- (char *)eet_read_direct(ef2, "/mysterious/data", NULL));
+ printf("Mysterious data:\n%s\n",
+ (char *)eet_read_direct(ef2, "/mysterious/data", NULL));
- eet_close(ef2);
+ eet_close(ef2);
- free(ret);
- }
+ free(ret);
+ }
- eet_close(ef);
+ eet_close(ef);
- eet_shutdown();
+ eet_shutdown();
- return 0;
+ return 0;
}
+
diff --git a/src/lib/Eet.h b/src/lib/Eet.h
index 1d01af3..c4dfb89 100644
--- a/src/lib/Eet.h
+++ b/src/lib/Eet.h
@@ -1,145 +1,146 @@
/**
-@brief Eet Data Handling Library Public API Calls
+ @brief Eet Data Handling Library Public API Calls
-These routines are used for Eet Library interaction
+ These routines are used for Eet Library interaction
-@mainpage Eet Library Documentation
+ @mainpage Eet Library Documentation
-@version 1.5.0
-@date 2000-2011
+ @version 1.5.0
+ @date 2000-2011
-Please see the @ref authors page for contact details.
+ Please see the @ref authors page for contact details.
-@section toc Table of Contents
+ @section toc Table of Contents
-@li @ref intro
-@li @ref example
-@li @ref compiling
-@li @ref install
-@li @ref next_steps
-@li @ref intro_example
+ @li @ref intro
+ @li @ref example
+ @li @ref compiling
+ @li @ref install
+ @li @ref next_steps
+ @li @ref intro_example
-@section intro What is Eet?
+ @section intro What is Eet?
-It is a tiny library designed to write an arbitrary set of chunks of data
-to a file and optionally compress each chunk (very much like a zip file)
-and allow fast random-access reading of the file later on. It does not
-do zip as a zip itself has more complexity than is needed, and it was much
-simpler to implement this once here.
+ It is a tiny library designed to write an arbitrary set of chunks of data
+ to a file and optionally compress each chunk (very much like a zip file)
+ and allow fast random-access reading of the file later on. It does not
+ do zip as a zip itself has more complexity than is needed, and it was much
+ simpler to implement this once here.
-Eet is extremely fast, small and simple. Eet files can be very small and
-highly compressed, making them very optimal for just sending across the
-internet without having to archive, compress or decompress and install them.
-They allow for lightning-fast random-acess reads once created, making them
-perfect for storing data that is written once (or rarely) and read many
-times, but the program does not want to have to read it all in at once.
+ Eet is extremely fast, small and simple. Eet files can be very small and
+ highly compressed, making them very optimal for just sending across the
+ internet without having to archive, compress or decompress and install them.
+ They allow for lightning-fast random-acess reads once created, making them
+ perfect for storing data that is written once (or rarely) and read many
+ times, but the program does not want to have to read it all in at once.
-It also can encode and decode data structures in memory, as well as image
-data for saving to Eet files or sending across the network to other
-machines, or just writing to arbitrary files on the system. All data is
-encoded in a platform independent way and can be written and read by any
-architecture.
+ It also can encode and decode data structures in memory, as well as image
+ data for saving to Eet files or sending across the network to other
+ machines, or just writing to arbitrary files on the system. All data is
+ encoded in a platform independent way and can be written and read by any
+ architecture.
-@section example A simple example on using Eet
+ @section example A simple example on using Eet
-Here is a simple example on how to use Eet to save a series of strings to a
-file and load them again. The advantage of using Eet over just fprintf() and
-fscanf() is that not only can these entries be strings, they need no special
-parsing to handle delimiter characters or escaping, they can be binary data,
-image data, data structures containing integers, strings, other data
-structures, linked lists and much more, without the programmer having to
-worry about parsing, and best of all, Eet is very fast.
+ Here is a simple example on how to use Eet to save a series of strings to a
+ file and load them again. The advantage of using Eet over just
+ fprintf() and
+ fscanf() is that not only can these entries be strings, they need no special
+ parsing to handle delimiter characters or escaping, they can be binary data,
+ image data, data structures containing integers, strings, other data
+ structures, linked lists and much more, without the programmer having to
+ worry about parsing, and best of all, Eet is very fast.
-This is just a very simple example that doesn't show all of the capabilities
-of Eet, but it serves to illustrate its simplicity.
+ This is just a very simple example that doesn't show all of the capabilities
+ of Eet, but it serves to illustrate its simplicity.
-@include eet-basic.c
+ @include eet-basic.c
-@section compiling How to compile using Eet ?
+ @section compiling How to compile using Eet ?
-Eet is a library your application links to. The procedure for this is very
-simple. You simply have to compile your application with the appropriate
-compiler flags that the @p pkg-config script outputs. For example:
+ Eet is a library your application links to. The procedure for this is very
+ simple. You simply have to compile your application with the appropriate
+ compiler flags that the @p pkg-config script outputs. For example:
-Compiling C or C++ files into object files:
+ Compiling C or C++ files into object files:
-@verbatim
-gcc -c -o main.o main.c `pkg-config --cflags eet`
-@endverbatim
+ @verbatim
+ gcc -c -o main.o main.c `pkg-config --cflags eet`
+ @endverbatim
-Linking object files into a binary executable:
+ Linking object files into a binary executable:
-@verbatim
-gcc -o my_application main.o `pkg-config --libs eet`
-@endverbatim
+ @verbatim
+ gcc -o my_application main.o `pkg-config --libs eet`
+ @endverbatim
-You simply have to make sure that pkg-config is in your shell's PATH (see
-the manual page for your appropriate shell) and eet.pc in /usr/lib/pkgconfig
-or its path is in the PKG_CONFIG_PATH environment variable. It's that simple
-to link and use Eet once you have written your code to use it.
+ You simply have to make sure that pkg-config is in your shell's PATH (see
+ the manual page for your appropriate shell) and eet.pc in /usr/lib/pkgconfig
+ or its path is in the PKG_CONFIG_PATH environment variable. It's that simple
+ to link and use Eet once you have written your code to use it.
-Since the program is linked to Eet, it is now able to use any advertised
-API calls to serialize your data.
+ Since the program is linked to Eet, it is now able to use any advertised
+ API calls to serialize your data.
-You should make sure you add any extra compile and link flags to your
-compile commands that your application may need as well. The above example
-is only guaranteed to make Eet add it's own requirements.
+ You should make sure you add any extra compile and link flags to your
+ compile commands that your application may need as well. The above example
+ is only guaranteed to make Eet add it's own requirements.
-@section install How is it installed?
+ @section install How is it installed?
-Simple:
+ Simple:
-@verbatim
-./configure
-make
-su -
-...
-make install
-@endverbatim
+ @verbatim
+ ./configure
+ make
+ su -
+ ...
+ make install
+ @endverbatim
-@section next_steps Next Steps
+ @section next_steps Next Steps
-After you understood what Eet is and installed it in your system you
-should proceed understanding the programming interface. We'd recommend
-you to take a while to learn Eina
-(http://docs.enlightenment.org/auto/eina/) as it is very convenient
-and optimized, and Eet provides integration with it.
+ After you understood what Eet is and installed it in your system you
+ should proceed understanding the programming interface. We'd recommend
+ you to take a while to learn Eina
+ (http://docs.enlightenment.org/auto/eina/) as it is very convenient
+ and optimized, and Eet provides integration with it.
-Recommended reading:
+ Recommended reading:
-@li @ref Eet_File_Group to know the basics to open and save files.
-@li @ref Eet_Data_Group to know the convenient way to serialize and
+ @li @ref Eet_File_Group to know the basics to open and save files.
+ @li @ref Eet_Data_Group to know the convenient way to serialize and
parse your data structures automatically. Just create your
descriptors and let Eet do the work for you.
-@section intro_example Introductory Examples
+ @section intro_example Introductory Examples
-@ref Examples
+ @ref Examples
-@todo Document data format for images and data structures.
+ @todo Document data format for images and data structures.
-*/
+ */
/**
-@page authors Authors
-@author Carsten Haitzler <raster@@rasterman.com>
-@author David Goodlad <dgoodlad@@gmail.com>
-@author Cedric Bail <cedric.bail@@free.fr>
-@author Arnaud de Turckheim <quarium@@gmail.com>
-@author Luis Felipe Strano Moraes <lfelipe@@profusion.mobi>
-@author Chidambar Zinnoury <illogict@@online.fr>
-@author Vincent Torri <vtorri@@univ-evry.fr>
-@author Gustavo Sverzut Barbieri <barbieri@@profusion.mobi>
-@author Raphael Kubo da Costa <kubo@@profusion.mobi>
-@author Mathieu Taillefumier <mathieu.taillefumier@@free.fr>
-@author Albin "Lutin" Tonnerre <albin.tonnerre@@gmail.com>
-@author Adam Simpkins <adam@@adamsimpkins.net>
-@author Mike Blumenkrantz <mike@zentific.com>
+ @page authors Authors
+ @author Carsten Haitzler <raster@@rasterman.com>
+ @author David Goodlad <dgoodlad@@gmail.com>
+ @author Cedric Bail <cedric.bail@@free.fr>
+ @author Arnaud de Turckheim <quarium@@gmail.com>
+ @author Luis Felipe Strano Moraes <lfelipe@@profusion.mobi>
+ @author Chidambar Zinnoury <illogict@@online.fr>
+ @author Vincent Torri <vtorri@@univ-evry.fr>
+ @author Gustavo Sverzut Barbieri <barbieri@@profusion.mobi>
+ @author Raphael Kubo da Costa <kubo@@profusion.mobi>
+ @author Mathieu Taillefumier <mathieu.taillefumier@@free.fr>
+ @author Albin "Lutin" Tonnerre <albin.tonnerre@@gmail.com>
+ @author Adam Simpkins <adam@@adamsimpkins.net>
+ @author Mike Blumenkrantz <mike@zentific.com>
-Please contact <enlightenment-devel@lists.sourceforge.net> to get in
-contact with the developers and maintainers.
-*/
+ Please contact <enlightenment-devel@lists.sourceforge.net> to get in
+ contact with the developers and maintainers.
+ */
#ifndef _EET_H
#define _EET_H
@@ -495,13 +496,13 @@ typedef enum _Eet_File_Mode
* @see eet_memopen_read()
* @see eet_close()
*/
-typedef struct _Eet_File Eet_File;
+typedef struct _Eet_File Eet_File;
/**
* @typedef Eet_Dictionary
* Opaque handle that defines a file-backed (mmaped) dictionary of strings.
*/
-typedef struct _Eet_Dictionary Eet_Dictionary;
+typedef struct _Eet_Dictionary Eet_Dictionary;
/**
* @}
@@ -547,7 +548,7 @@ typedef struct _Eet_Dictionary Eet_Dictionary;
* @since 1.0.0
*/
EAPI Eet_File *
-eet_open(const char *file,
+eet_open(const char *file,
Eet_File_Mode mode);
/**
@@ -562,7 +563,7 @@ eet_open(const char *file,
*/
EAPI Eet_File *
eet_memopen_read(const void *data,
- size_t size);
+ size_t size);
/**
* Get the mode an Eet_File was opened with.
@@ -641,7 +642,7 @@ eet_dictionary_get(Eet_File *ef);
*/
EAPI int
eet_dictionary_string_check(Eet_Dictionary *ed,
- const char *string);
+ const char *string);
/**
* Read a specified entry from an eet file and return data
@@ -666,9 +667,9 @@ eet_dictionary_string_check(Eet_Dictionary *ed,
* @ingroup Eet_File_Group
*/
EAPI void *
-eet_read(Eet_File *ef,
+eet_read(Eet_File *ef,
const char *name,
- int *size_ret);
+ int *size_ret);
/**
* Read a specified entry from an eet file and return data
@@ -691,9 +692,9 @@ eet_read(Eet_File *ef,
* @ingroup Eet_File_Group
*/
EAPI const void *
-eet_read_direct(Eet_File *ef,
+eet_read_direct(Eet_File *ef,
const char *name,
- int *size_ret);
+ int *size_ret);
/**
* Write a specified entry to an eet file handle
@@ -724,11 +725,11 @@ eet_read_direct(Eet_File *ef,
* @ingroup Eet_File_Group
*/
EAPI int
-eet_write(Eet_File *ef,
+eet_write(Eet_File *ef,
const char *name,
const void *data,
- int size,
- int compress);
+ int size,
+ int compress);
/**
* Delete a specified entry from an Eet file being written or re-written
@@ -749,7 +750,7 @@ eet_write(Eet_File *ef,
* @ingroup Eet_File_Group
*/
EAPI int
-eet_delete(Eet_File *ef,
+eet_delete(Eet_File *ef,
const char *name);
/**
@@ -768,10 +769,10 @@ eet_delete(Eet_File *ef,
* @ingroup Eet_File_Group
*/
EAPI Eina_Bool
-eet_alias(Eet_File *ef,
+eet_alias(Eet_File *ef,
const char *name,
const char *destination,
- int compress);
+ int compress);
/**
* Retrieve the destination name of an alias
@@ -819,9 +820,9 @@ eet_alias_get(Eet_File *ef,
* @ingroup Eet_File_Group
*/
EAPI char **
-eet_list(Eet_File *ef,
+eet_list(Eet_File *ef,
const char *glob,
- int *count_ret);
+ int *count_ret);
/**
* Return the number of entries in the specified eet file.
@@ -870,9 +871,9 @@ eet_num_entries(Eet_File *ef);
* @ingroup Eet_File_Cipher_Group
*/
EAPI void *
-eet_read_cipher(Eet_File *ef,
+eet_read_cipher(Eet_File *ef,
const char *name,
- int *size_ret,
+ int *size_ret,
const char *cipher_key);
/**
@@ -905,11 +906,11 @@ eet_read_cipher(Eet_File *ef,
* @ingroup Eet_File_Cipher_Group
*/
EAPI int
-eet_write_cipher(Eet_File *ef,
+eet_write_cipher(Eet_File *ef,
const char *name,
const void *data,
- int size,
- int compress,
+ int size,
+ int compress,
const char *cipher_key);
/**
@@ -968,14 +969,14 @@ eet_write_cipher(Eet_File *ef,
* @ingroup Eet_File_Image_Group
*/
EAPI int
-eet_data_image_header_read(Eet_File *ef,
- const char *name,
+eet_data_image_header_read(Eet_File *ef,
+ const char *name,
unsigned int *w,
unsigned int *h,
- int *alpha,
- int *compress,
- int *quality,
- int *lossy);
+ int *alpha,
+ int *compress,
+ int *quality,
+ int *lossy);
/**
* Read image data from the named key in the eet file.
@@ -1013,14 +1014,14 @@ eet_data_image_header_read(Eet_File *ef,
* @ingroup Eet_File_Image_Group
*/
EAPI void *
-eet_data_image_read(Eet_File *ef,
- const char *name,
+eet_data_image_read(Eet_File *ef,
+ const char *name,
unsigned int *w,
unsigned int *h,
- int *alpha,
- int *compress,
- int *quality,
- int *lossy);
+ int *alpha,
+ int *compress,
+ int *quality,
+ int *lossy);
/**
* Read image data from the named key in the eet file and store it in the given buffer.
@@ -1070,18 +1071,18 @@ eet_data_image_read(Eet_File *ef,
* @ingroup Eet_File_Image_Group
*/
EAPI int
-eet_data_image_read_to_surface(Eet_File *ef,
- const char *name,
- unsigned int src_x,
- unsigned int src_y,
+eet_data_image_read_to_surface(Eet_File *ef,
+ const char *name,
+ unsigned int src_x,
+ unsigned int src_y,
unsigned int *d,
- unsigned int w,
- unsigned int h,
- unsigned int row_stride,
- int *alpha,
- int *compress,
- int *quality,
- int *lossy);
+ unsigned int w,
+ unsigned int h,
+ unsigned int row_stride,
+ int *alpha,
+ int *compress,
+ int *quality,
+ int *lossy);
/**
* Write image data to the named key in an eet file.
@@ -1121,15 +1122,15 @@ eet_data_image_read_to_surface(Eet_File *ef,
* @ingroup Eet_File_Image_Group
*/
EAPI int
-eet_data_image_write(Eet_File *ef,
- const char *name,
- const void *data,
+eet_data_image_write(Eet_File *ef,
+ const char *name,
+ const void *data,
unsigned int w,
unsigned int h,
- int alpha,
- int compress,
- int quality,
- int lossy);
+ int alpha,
+ int compress,
+ int quality,
+ int lossy);
/**
* Decode Image data header only to get information.
@@ -1157,14 +1158,14 @@ eet_data_image_write(Eet_File *ef,
* @ingroup Eet_File_Image_Group
*/
EAPI int
-eet_data_image_header_decode(const void *data,
- int size,
+eet_data_image_header_decode(const void *data,
+ int size,
unsigned int *w,
unsigned int *h,
- int *alpha,
- int *compress,
- int *quality,
- int *lossy);
+ int *alpha,
+ int *compress,
+ int *quality,
+ int *lossy);
/**
* Decode Image data into pixel data.
@@ -1197,14 +1198,14 @@ eet_data_image_header_decode(const void *data,
* @ingroup Eet_File_Image_Group
*/
EAPI void *
-eet_data_image_decode(const void *data,
- int size,
+eet_data_image_decode(const void *data,
+ int size,
unsigned int *w,
unsigned int *h,
- int *alpha,
- int *compress,
- int *quality,
- int *lossy);
+ int *alpha,
+ int *compress,
+ int *quality,
+ int *lossy);
/**
* Decode Image data into pixel data and stores in the given buffer.
@@ -1235,18 +1236,18 @@ eet_data_image_decode(const void *data,
* @ingroup Eet_File_Image_Group
*/
EAPI int
-eet_data_image_decode_to_surface(const void *data,
- int size,
- unsigned int src_x,
- unsigned int src_y,
+eet_data_image_decode_to_surface(const void *data,
+ int size,
+ unsigned int src_x,
+ unsigned int src_y,
unsigned int *d,
- unsigned int w,
- unsigned int h,
- unsigned int row_stride,
- int *alpha,
- int *compress,
- int *quality,
- int *lossy);
+ unsigned int w,
+ unsigned int h,
+ unsigned int row_stride,
+ int *alpha,
+ int *compress,
+ int *quality,
+ int *lossy);
/**
* Encode image data for storage or transmission.
@@ -1279,14 +1280,14 @@ eet_data_image_decode_to_surface(const void *data,
* @ingroup Eet_File_Image_Group
*/
EAPI void *
-eet_data_image_encode(const void *data,
- int *size_ret,
+eet_data_image_encode(const void *data,
+ int *size_ret,
unsigned int w,
unsigned int h,
- int alpha,
- int compress,
- int quality,
- int lossy);
+ int alpha,
+ int compress,
+ int quality,
+ int lossy);
/**
* @defgroup Eet_File_Image_Cipher_Group Image Store and Load using a Cipher
@@ -1337,15 +1338,15 @@ eet_data_image_encode(const void *data,
* @ingroup Eet_File_Image_Cipher_Group
*/
EAPI int
-eet_data_image_header_read_cipher(Eet_File *ef,
- const char *name,
- const char *cipher_key,
+eet_data_image_header_read_cipher(Eet_File *ef,
+ const char *name,
+ const char *cipher_key,
unsigned int *w,
unsigned int *h,
- int *alpha,
- int *compress,
- int *quality,
- int *lossy);
+ int *alpha,
+ int *compress,
+ int *quality,
+ int *lossy);
/**
* Read image data from the named key in the eet file using a cipher.
@@ -1387,15 +1388,15 @@ eet_data_image_header_read_cipher(Eet_File *ef,
* @ingroup Eet_File_Image_Cipher_Group
*/
EAPI void *
-eet_data_image_read_cipher(Eet_File *ef,
- const char *name,
- const char *cipher_key,
+eet_data_image_read_cipher(Eet_File *ef,
+ const char *name,
+ const char *cipher_key,
unsigned int *w,
unsigned int *h,
- int *alpha,
- int *compress,
- int *quality,
- int *lossy);
+ int *alpha,
+ int *compress,
+ int *quality,
+ int *lossy);
/**
* Read image data from the named key in the eet file using a cipher.
@@ -1439,19 +1440,19 @@ eet_data_image_read_cipher(Eet_File *ef,
* @ingroup Eet_File_Image_Cipher_Group
*/
EAPI int
-eet_data_image_read_to_surface_cipher(Eet_File *ef,
- const char *name,
- const char *cipher_key,
- unsigned int src_x,
- unsigned int src_y,
+eet_data_image_read_to_surface_cipher(Eet_File *ef,
+ const char *name,
+ const char *cipher_key,
+ unsigned int src_x,
+ unsigned int src_y,
unsigned int *d,
- unsigned int w,
- unsigned int h,
- unsigned int row_stride,
- int *alpha,
- int *compress,
- int *quality,
- int *lossy);
+ unsigned int w,
+ unsigned int h,
+ unsigned int row_stride,
+ int *alpha,
+ int *compress,
+ int *quality,
+ int *lossy);
/**
* Write image data to the named key in an eet file using a cipher.
@@ -1490,16 +1491,16 @@ eet_data_image_read_to_surface_cipher(Eet_File *ef,
* @ingroup Eet_File_Image_Cipher_Group
*/
EAPI int
-eet_data_image_write_cipher(Eet_File *ef,
- const char *name,
- const char *cipher_key,
- const void *data,
+eet_data_image_write_cipher(Eet_File *ef,
+ const char *name,
+ const char *cipher_key,
+ const void *data,
unsigned int w,
unsigned int h,
- int alpha,
- int compress,
- int quality,
- int lossy);
+ int alpha,
+ int compress,
+ int quality,
+ int lossy);
/**
* Decode Image data header only to get information using a cipher.
@@ -1539,15 +1540,15 @@ eet_data_image_write_cipher(Eet_File *ef,
* @ingroup Eet_File_Image_Cipher_Group
*/
EAPI int
-eet_data_image_header_decode_cipher(const void *data,
- const char *cipher_key,
- int size,
+eet_data_image_header_decode_cipher(const void *data,
+ const char *cipher_key,
+ int size,
unsigned int *w,
unsigned int *h,
- int *alpha,
- int *compress,
- int *quality,
- int *lossy);
+ int *alpha,
+ int *compress,
+ int *quality,
+ int *lossy);
/**
* Decode Image data into pixel data using a cipher.
@@ -1589,15 +1590,15 @@ eet_data_image_header_decode_cipher(const void *data,
* @ingroup Eet_File_Image_Cipher_Group
*/
EAPI void *
-eet_data_image_decode_cipher(const void *data,
- const char *cipher_key,
- int size,
+eet_data_image_decode_cipher(const void *data,
+ const char *cipher_key,
+ int size,
unsigned int *w,
unsigned int *h,
- int *alpha,
- int *compress,
- int *quality,
- int *lossy);
+ int *alpha,
+ int *compress,
+ int *quality,
+ int *lossy);
/**
* Decode Image data into pixel data using a cipher.
@@ -1641,19 +1642,19 @@ eet_data_image_decode_cipher(const void *data,
* @ingroup Eet_File_Image_Cipher_Group
*/
EAPI int
-eet_data_image_decode_to_surface_cipher(const void *data,
- const char *cipher_key,
- int size,
- unsigned int src_x,
- unsigned int src_y,
+eet_data_image_decode_to_surface_cipher(const void *data,
+ const char *cipher_key,
+ int size,
+ unsigned int src_x,
+ unsigned int src_y,
unsigned int *d,
- unsigned int w,
- unsigned int h,
- unsigned int row_stride,
- int *alpha,
- int *compress,
- int *quality,
- int *lossy);
+ unsigned int w,
+ unsigned int h,
+ unsigned int row_stride,
+ int *alpha,
+ int *compress,
+ int *quality,
+ int *lossy);
/**
* Encode image data for storage or transmission using a cipher.
@@ -1691,15 +1692,15 @@ eet_data_image_decode_to_surface_cipher(const void *data,
* @ingroup Eet_File_Image_Cipher_Group
*/
EAPI void *
-eet_data_image_encode_cipher(const void *data,
- const char *cipher_key,
- unsigned int w,
- unsigned int h,
- int alpha,
- int compress,
- int quality,
- int lossy,
- int *size_ret);
+eet_data_image_encode_cipher(const void *data,
+ const char *cipher_key,
+ unsigned int w,
+ unsigned int h,
+ int alpha,
+ int compress,
+ int quality,
+ int lossy,
+ int *size_ret);
/**
* @defgroup Eet_Cipher_Group Cipher, Identity and Protection Mechanisms
@@ -1719,7 +1720,7 @@ eet_data_image_encode_cipher(const void *data,
* Opaque handle that defines an identity (also known as key)
* in Eet's cipher system.
*/
-typedef struct _Eet_Key Eet_Key;
+typedef struct _Eet_Key Eet_Key;
/**
* @}
@@ -1737,7 +1738,7 @@ typedef struct _Eet_Key Eet_Key;
* @since 1.2.0
* @ingroup Eet_Cipher_Group
*/
-typedef int (*Eet_Key_Password_Callback) (char *buffer, int size, int rwflag, void *data);
+typedef int (*Eet_Key_Password_Callback)(char *buffer, int size, int rwflag, void *data);
/**
* Create an Eet_Key needed for signing an eet file.
@@ -1757,9 +1758,9 @@ typedef int (*Eet_Key_Password_Callback) (char *buffer, int size, int rwflag, vo
* @ingroup Eet_Cipher_Group
*/
EAPI Eet_Key *
-eet_identity_open(const char *certificate_file,
- const char *private_key_file,
- Eet_Key_Password_Callback cb);
+eet_identity_open(const char *certificate_file,
+ const char *private_key_file,
+ Eet_Key_Password_Callback cb);
/**
* Close and release all ressource used by an Eet_Key. An
@@ -1787,7 +1788,7 @@ eet_identity_close(Eet_Key *key);
*/
EAPI Eet_Error
eet_identity_set(Eet_File *ef,
- Eet_Key *key);
+ Eet_Key *key);
/**
* Display both private and public key of an Eet_Key.
@@ -1800,7 +1801,7 @@ eet_identity_set(Eet_File *ef,
*/
EAPI void
eet_identity_print(Eet_Key *key,
- FILE *out);
+ FILE *out);
/**
* Get the x509 der certificate associated with an Eet_File. Will return NULL
@@ -1815,7 +1816,7 @@ eet_identity_print(Eet_Key *key,
*/
EAPI const void *
eet_identity_x509(Eet_File *ef,
- int *der_length);
+ int *der_length);
/**
* Get the raw signature associated with an Eet_File. Will return NULL
@@ -1829,7 +1830,7 @@ eet_identity_x509(Eet_File *ef,
*/
EAPI const void *
eet_identity_signature(Eet_File *ef,
- int *signature_length);
+ int *signature_length);
/**
* Get the SHA1 associated with a file. Could be the one used to
@@ -1845,7 +1846,7 @@ eet_identity_signature(Eet_File *ef,
*/
EAPI const void *
eet_identity_sha1(Eet_File *ef,
- int *sha1_length);
+ int *sha1_length);
/**
* Display the x509 der certificate to out.
@@ -1859,8 +1860,8 @@ eet_identity_sha1(Eet_File *ef,
*/
EAPI void
eet_identity_certificate_print(const unsigned char *certificate,
- int der_length,
- FILE *out);
+ int der_length,
+ FILE *out);
/**
* @defgroup Eet_Data_Group Eet Data Serialization
@@ -2332,7 +2333,7 @@ eet_identity_certificate_print(const unsigned char *certificate,
* @see eet_data_descriptor_file_new()
* @see eet_data_descriptor_free()
*/
-typedef struct _Eet_Data_Descriptor Eet_Data_Descriptor;
+typedef struct _Eet_Data_Descriptor Eet_Data_Descriptor;
/**
* @def EET_DATA_DESCRIPTOR_CLASS_VERSION
@@ -2349,27 +2350,27 @@ typedef struct _Eet_Data_Descriptor Eet_Data_Descriptor;
* Instructs Eet about memory management for different needs under
* serialization and parse process.
*/
-typedef struct _Eet_Data_Descriptor_Class Eet_Data_Descriptor_Class;
-
-typedef int (*Eet_Descriptor_Hash_Foreach_Callback_Callback)(void *h, const char *k, void *dt, void *fdt);
-
-typedef void *(*Eet_Descriptor_Mem_Alloc_Callback)(size_t size);
-typedef void (*Eet_Descriptor_Mem_Free_Callback)(void *mem);
-typedef char *(*Eet_Descriptor_Str_Alloc_Callback)(const char *str);
-typedef void (*Eet_Descriptor_Str_Free_Callback)(const char *str);
-typedef void *(*Eet_Descriptor_List_Next_Callback)(void *l);
-typedef void *(*Eet_Descriptor_List_Append_Callback)(void *l, void *d);
-typedef void *(*Eet_Descriptor_List_Data_Callback)(void *l);
-typedef void *(*Eet_Descriptor_List_Free_Callback)(void *l);
-typedef void (*Eet_Descriptor_Hash_Foreach_Callback)(void *h, Eet_Descriptor_Hash_Foreach_Callback_Callback func, void *fdt);
-typedef void *(*Eet_Descriptor_Hash_Add_Callback)(void *h, const char *k, void *d);
-typedef void (*Eet_Descriptor_Hash_Free_Callback)(void *h);
-typedef char *(*Eet_Descriptor_Str_Direct_Alloc_Callback)(const char *str);
-typedef void (*Eet_Descriptor_Str_Direct_Free_Callback)(const char *str);
-typedef const char *(*Eet_Descriptor_Type_Get_Callback)(const void *data, Eina_Bool *unknow);
-typedef Eina_Bool (*Eet_Descriptor_Type_Set_Callback)(const char *type, void *data, Eina_Bool unknow);
-typedef void *(*Eet_Descriptor_Array_Alloc_Callback)(size_t size);
-typedef void (*Eet_Descriptor_Array_Free_Callback)(void *mem);
+typedef struct _Eet_Data_Descriptor_Class Eet_Data_Descriptor_Class;
+
+typedef int (*Eet_Descriptor_Hash_Foreach_Callback_Callback)(void *h, const char *k, void *dt, void *fdt);
+
+typedef void * (*Eet_Descriptor_Mem_Alloc_Callback)(size_t size);
+typedef void (*Eet_Descriptor_Mem_Free_Callback)(void *mem);
+typedef char * (*Eet_Descriptor_Str_Alloc_Callback)(const char *str);
+typedef void (*Eet_Descriptor_Str_Free_Callback)(const char *str);
+typedef void * (*Eet_Descriptor_List_Next_Callback)(void *l);
+typedef void * (*Eet_Descriptor_List_Append_Callback)(void *l, void *d);
+typedef void * (*Eet_Descriptor_List_Data_Callback)(void *l);
+typedef void * (*Eet_Descriptor_List_Free_Callback)(void *l);
+typedef void (*Eet_Descriptor_Hash_Foreach_Callback)(void *h, Eet_Descriptor_Hash_Foreach_Callback_Callback func, void *fdt);
+typedef void * (*Eet_Descriptor_Hash_Add_Callback)(void *h, const char *k, void *d);
+typedef void (*Eet_Descriptor_Hash_Free_Callback)(void *h);
+typedef char * (*Eet_Descriptor_Str_Direct_Alloc_Callback)(const char *str);
+typedef void (*Eet_Descriptor_Str_Direct_Free_Callback)(const char *str);
+typedef const char * (*Eet_Descriptor_Type_Get_Callback)(const void *data, Eina_Bool *unknow);
+typedef Eina_Bool (*Eet_Descriptor_Type_Set_Callback)(const char *type, void *data, Eina_Bool unknow);
+typedef void * (*Eet_Descriptor_Array_Alloc_Callback)(size_t size);
+typedef void (*Eet_Descriptor_Array_Free_Callback)(void *mem);
/**
* @struct _Eet_Data_Descriptor_Class
*
@@ -2389,24 +2390,25 @@ struct _Eet_Data_Descriptor_Class
int version; /**< ABI version. Should always be set to #EET_DATA_DESCRIPTOR_CLASS_VERSION */
const char *name; /**< Name of the user data type to be serialized */
int size; /**< Size in bytes of the user data type to be serialized */
- struct {
- Eet_Descriptor_Mem_Alloc_Callback mem_alloc; /**< how to allocate memory (usually malloc()) */
- Eet_Descriptor_Mem_Free_Callback mem_free; /**< how to free memory (usually free()) */
- Eet_Descriptor_Str_Alloc_Callback str_alloc; /**< how to allocate a string */
- Eet_Descriptor_Str_Free_Callback str_free; /**< how to free a string */
- Eet_Descriptor_List_Next_Callback list_next; /**< how to iterate to the next element of a list. Receives and should return the list node. */
- Eet_Descriptor_List_Append_Callback list_append; /**< how to append data @p d to list which head node is @p l */
- Eet_Descriptor_List_Data_Callback list_data; /**< retrieves the data from node @p l */
- Eet_Descriptor_List_Free_Callback list_free; /**< free all the nodes from the list which head node is @p l */
- Eet_Descriptor_Hash_Foreach_Callback hash_foreach; /**< iterates over all elements in the hash @p h in no specific order */
- Eet_Descriptor_Hash_Add_Callback hash_add; /**< add a new data @p d with key @p k in hash @p h */
- Eet_Descriptor_Hash_Free_Callback hash_free; /**< free all entries from the hash @p h */
- Eet_Descriptor_Str_Direct_Alloc_Callback str_direct_alloc; /**< how to allocate a string directly from file backed/mmaped region pointed by @p str */
- Eet_Descriptor_Str_Direct_Free_Callback str_direct_free; /**< how to free a string returned by str_direct_alloc */
- Eet_Descriptor_Type_Get_Callback type_get; /**< get the type, as used in the union or variant mapping, that should be used to store the given data into the eet file. */
- Eet_Descriptor_Type_Set_Callback type_set; /**< called when loading a mapped type with the given @p type used to describe the type in the descriptor */
- Eet_Descriptor_Array_Alloc_Callback array_alloc; /**< how to allocate memory for array (usually malloc()) */
- Eet_Descriptor_Array_Free_Callback array_free; /**< how to free memory for array (usually free()) */
+ struct
+ {
+ Eet_Descriptor_Mem_Alloc_Callback mem_alloc; /**< how to allocate memory (usually malloc()) */
+ Eet_Descriptor_Mem_Free_Callback mem_free; /**< how to free memory (usually free()) */
+ Eet_Descriptor_Str_Alloc_Callback str_alloc; /**< how to allocate a string */
+ Eet_Descriptor_Str_Free_Callback str_free; /**< how to free a string */
+ Eet_Descriptor_List_Next_Callback list_next; /**< how to iterate to the next element of a list. Receives and should return the list node. */
+ Eet_Descriptor_List_Append_Callback list_append; /**< how to append data @p d to list which head node is @p l */
+ Eet_Descriptor_List_Data_Callback list_data; /**< retrieves the data from node @p l */
+ Eet_Descriptor_List_Free_Callback list_free; /**< free all the nodes from the list which head node is @p l */
+ Eet_Descriptor_Hash_Foreach_Callback hash_foreach; /**< iterates over all elements in the hash @p h in no specific order */
+ Eet_Descriptor_Hash_Add_Callback hash_add; /**< add a new data @p d with key @p k in hash @p h */
+ Eet_Descriptor_Hash_Free_Callback hash_free; /**< free all entries from the hash @p h */
+ Eet_Descriptor_Str_Direct_Alloc_Callback str_direct_alloc; /**< how to allocate a string directly from file backed/mmaped region pointed by @p str */
+ Eet_Descriptor_Str_Direct_Free_Callback str_direct_free; /**< how to free a string returned by str_direct_alloc */
+ Eet_Descriptor_Type_Get_Callback type_get; /**< get the type, as used in the union or variant mapping, that should be used to store the given data into the eet file. */
+ Eet_Descriptor_Type_Set_Callback type_set; /**< called when loading a mapped type with the given @p type used to describe the type in the descriptor */
+ Eet_Descriptor_Array_Alloc_Callback array_alloc; /**< how to allocate memory for array (usually malloc()) */
+ Eet_Descriptor_Array_Free_Callback array_free; /**< how to free memory for array (usually free()) */
} func;
};
@@ -2414,7 +2416,6 @@ struct _Eet_Data_Descriptor_Class
* @}
*/
-
/**
* Create a new empty data structure descriptor.
* @param name The string name of this data structure (most be a
@@ -2470,9 +2471,9 @@ eet_data_descriptor_new(const char *name,
* move happens - but be warned
*/
EINA_DEPRECATED EAPI Eet_Data_Descriptor *
-eet_data_descriptor2_new(const Eet_Data_Descriptor_Class *eddc);
+ eet_data_descriptor2_new(const Eet_Data_Descriptor_Class *eddc);
EINA_DEPRECATED EAPI Eet_Data_Descriptor *
-eet_data_descriptor3_new(const Eet_Data_Descriptor_Class *eddc);
+ eet_data_descriptor3_new(const Eet_Data_Descriptor_Class *eddc);
/**
* This function creates a new data descriptor and returns a handle to the
@@ -2570,9 +2571,9 @@ eet_data_descriptor_file_new(const Eet_Data_Descriptor_Class *eddc);
*/
EAPI Eina_Bool
eet_eina_stream_data_descriptor_class_set(Eet_Data_Descriptor_Class *eddc,
- unsigned int eddc_size,
- const char *name,
- int size);
+ unsigned int eddc_size,
+ const char *name,
+ int size);
/**
* This macro is an helper that set all the parameter of an
@@ -2588,8 +2589,8 @@ eet_eina_stream_data_descriptor_class_set(Eet_Data_Descriptor_Class *eddc,
* @since 1.2.3
* @ingroup Eet_Data_Group
*/
-#define EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(clas, type)\
- (eet_eina_stream_data_descriptor_class_set(clas, sizeof (*(clas)), # type, sizeof(type)))
+#define EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(clas, type) \
+ (eet_eina_stream_data_descriptor_class_set(clas, sizeof (*(clas)), # type, sizeof(type)))
/**
* This function is an helper that set all the parameter of an
@@ -2611,9 +2612,9 @@ eet_eina_stream_data_descriptor_class_set(Eet_Data_Descriptor_Class *eddc,
*/
EAPI Eina_Bool
eet_eina_file_data_descriptor_class_set(Eet_Data_Descriptor_Class *eddc,
- unsigned int eddc_size,
- const char *name,
- int size);
+ unsigned int eddc_size,
+ const char *name,
+ int size);
/**
* This macro is an helper that set all the parameter of an
@@ -2629,7 +2630,7 @@ eet_eina_file_data_descriptor_class_set(Eet_Data_Descriptor_Class *eddc,
* @since 1.2.3
* @ingroup Eet_Data_Group
*/
-#define EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(clas, type)\
+#define EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(clas, type) \
(eet_eina_file_data_descriptor_class_set(clas, sizeof (*(clas)), # type, sizeof(type)))
/**
@@ -2674,13 +2675,13 @@ eet_data_descriptor_free(Eet_Data_Descriptor *edd);
*/
EAPI void
eet_data_descriptor_element_add(Eet_Data_Descriptor *edd,
- const char *name,
- int type,
- int group_type,
- int offset,
- /* int count_offset, */
- int count,
- const char *counter_name,
+ const char *name,
+ int type,
+ int group_type,
+ int offset,
+ /* int count_offset, */
+ int count,
+ const char *counter_name,
Eet_Data_Descriptor *subtype);
/**
@@ -2711,9 +2712,9 @@ eet_data_descriptor_element_add(Eet_Data_Descriptor *edd,
* @ingroup Eet_Data_Group
*/
EAPI void *
-eet_data_read(Eet_File *ef,
+eet_data_read(Eet_File *ef,
Eet_Data_Descriptor *edd,
- const char *name);
+ const char *name);
/**
* Write a data structure from memory and store in an eet file.
@@ -2735,11 +2736,11 @@ eet_data_read(Eet_File *ef,
* @ingroup Eet_Data_Group
*/
EAPI int
-eet_data_write(Eet_File *ef,
+eet_data_write(Eet_File *ef,
Eet_Data_Descriptor *edd,
- const char *name,
- const void *data,
- int compress);
+ const char *name,
+ const void *data,
+ int compress);
typedef void (*Eet_Dump_Callback)(void *data, const char *str);
@@ -2791,10 +2792,10 @@ typedef void (*Eet_Dump_Callback)(void *data, const char *str);
* @ingroup Eet_Data_Group
*/
EAPI int
-eet_data_text_dump(const void *data_in,
- int size_in,
+eet_data_text_dump(const void *data_in,
+ int size_in,
Eet_Dump_Callback dumpfunc,
- void *dumpdata);
+ void *dumpdata);
/**
* Take an ascii encoding from eet_data_text_dump() and re-encode in binary.
@@ -2817,8 +2818,8 @@ eet_data_text_dump(const void *data_in,
*/
EAPI void *
eet_data_text_undump(const char *text,
- int textlen,
- int *size_ret);
+ int textlen,
+ int *size_ret);
/**
* Dump an eet encoded data structure from an eet file into ascii text
@@ -2844,10 +2845,10 @@ eet_data_text_undump(const char *text,
* @ingroup Eet_Data_Group
*/
EAPI int
-eet_data_dump(Eet_File *ef,
- const char *name,
+eet_data_dump(Eet_File *ef,
+ const char *name,
Eet_Dump_Callback dumpfunc,
- void *dumpdata);
+ void *dumpdata);
/**
* Take an ascii encoding from eet_data_dump() and re-encode in binary.
@@ -2872,11 +2873,11 @@ eet_data_dump(Eet_File *ef,
* @ingroup Eet_Data_Group
*/
EAPI int
-eet_data_undump(Eet_File *ef,
+eet_data_undump(Eet_File *ef,
const char *name,
const char *text,
- int textlen,
- int compress);
+ int textlen,
+ int compress);
/**
* Decode a data structure from an arbitrary location in memory.
@@ -2907,8 +2908,8 @@ eet_data_undump(Eet_File *ef,
*/
EAPI void *
eet_data_descriptor_decode(Eet_Data_Descriptor *edd,
- const void *data_in,
- int size_in);
+ const void *data_in,
+ int size_in);
/**
* Encode a dsata struct to memory and return that encoded data.
@@ -2941,8 +2942,8 @@ eet_data_descriptor_decode(Eet_Data_Descriptor *edd,
*/
EAPI void *
eet_data_descriptor_encode(Eet_Data_Descriptor *edd,
- const void *data_in,
- int *size_ret);
+ const void *data_in,
+ int *size_ret);
/**
* Add a basic data element to a data descriptor.
@@ -2968,13 +2969,13 @@ eet_data_descriptor_encode(Eet_Data_Descriptor *edd,
* @ingroup Eet_Data_Group
*/
#define EET_DATA_DESCRIPTOR_ADD_BASIC(edd, struct_type, name, member, type) \
- do { \
- struct_type ___ett; \
- eet_data_descriptor_element_add(edd, name, type, EET_G_UNKNOWN, \
- (char *)(& (___ett.member)) - \
- (char *)(& (___ett)), \
- 0, /* 0, */ NULL, NULL); \
- } while(0)
+ do { \
+ struct_type ___ett; \
+ eet_data_descriptor_element_add(edd, name, type, EET_G_UNKNOWN, \
+ (char *)(& (___ett.member)) - \
+ (char *)(& (___ett)), \
+ 0, /* 0, */ NULL, NULL); \
+ } while(0)
/**
* Add a sub-element type to a data descriptor
@@ -2994,14 +2995,14 @@ eet_data_descriptor_encode(Eet_Data_Descriptor *edd,
* @since 1.0.0
* @ingroup Eet_Data_Group
*/
-#define EET_DATA_DESCRIPTOR_ADD_SUB(edd, struct_type, name, member, subtype) \
- do { \
- struct_type ___ett; \
- eet_data_descriptor_element_add(edd, name, EET_T_UNKNOW, EET_G_UNKNOWN, \
- (char *)(& (___ett.member)) - \
- (char *)(& (___ett)), \
- 0, /* 0, */ NULL, subtype); \
- } while (0)
+#define EET_DATA_DESCRIPTOR_ADD_SUB(edd, struct_type, name, member, subtype) \
+ do { \
+ struct_type ___ett; \
+ eet_data_descriptor_element_add(edd, name, EET_T_UNKNOW, EET_G_UNKNOWN, \
+ (char *)(& (___ett.member)) - \
+ (char *)(& (___ett)), \
+ 0, /* 0, */ NULL, subtype); \
+ } while (0)
/**
* Add a linked list type to a data descriptor
@@ -3021,13 +3022,13 @@ eet_data_descriptor_encode(Eet_Data_Descriptor *edd,
* @ingroup Eet_Data_Group
*/
#define EET_DATA_DESCRIPTOR_ADD_LIST(edd, struct_type, name, member, subtype) \
- do { \
- struct_type ___ett; \
- eet_data_descriptor_element_add(edd, name, EET_T_UNKNOW, EET_G_LIST, \
- (char *)(& (___ett.member)) - \
- (char *)(& (___ett)), \
- 0, /* 0, */ NULL, subtype); \
- } while (0)
+ do { \
+ struct_type ___ett; \
+ eet_data_descriptor_element_add(edd, name, EET_T_UNKNOW, EET_G_LIST, \
+ (char *)(& (___ett.member)) - \
+ (char *)(& (___ett)), \
+ 0, /* 0, */ NULL, subtype); \
+ } while (0)
/**
* Add a linked list of string to a data descriptor
@@ -3044,13 +3045,13 @@ eet_data_descriptor_encode(Eet_Data_Descriptor *edd,
* @ingroup Eet_Data_Group
*/
#define EET_DATA_DESCRIPTOR_ADD_LIST_STRING(edd, struct_type, name, member) \
- do { \
- struct_type ___ett; \
- eet_data_descriptor_element_add(edd, name, EET_T_STRING, EET_G_LIST, \
- (char *)(& (___ett.member)) - \
- (char *)(& (___ett)), \
- 0, /* 0, */ NULL, NULL); \
- } while (0)
+ do { \
+ struct_type ___ett; \
+ eet_data_descriptor_element_add(edd, name, EET_T_STRING, EET_G_LIST, \
+ (char *)(& (___ett.member)) - \
+ (char *)(& (___ett)), \
+ 0, /* 0, */ NULL, NULL); \
+ } while (0)
/**
* Add a hash type to a data descriptor
@@ -3071,13 +3072,13 @@ eet_data_descriptor_encode(Eet_Data_Descriptor *edd,
* @ingroup Eet_Data_Group
*/
#define EET_DATA_DESCRIPTOR_ADD_HASH(edd, struct_type, name, member, subtype) \
- do { \
- struct_type ___ett; \
- eet_data_descriptor_element_add(edd, name, EET_T_UNKNOW, EET_G_HASH, \
- (char *)(& (___ett.member)) - \
- (char *)(& (___ett)), \
- 0, /* 0, */ NULL, subtype); \
- } while (0)
+ do { \
+ struct_type ___ett; \
+ eet_data_descriptor_element_add(edd, name, EET_T_UNKNOW, EET_G_HASH, \
+ (char *)(& (___ett.member)) - \
+ (char *)(& (___ett)), \
+ 0, /* 0, */ NULL, subtype); \
+ } while (0)
/**
* Add a hash of string to a data descriptor
@@ -3094,13 +3095,13 @@ eet_data_descriptor_encode(Eet_Data_Descriptor *edd,
* @ingroup Eet_Data_Group
*/
#define EET_DATA_DESCRIPTOR_ADD_HASH_STRING(edd, struct_type, name, member) \
- do { \
- struct_type ___ett; \
- eet_data_descriptor_element_add(edd, name, EET_T_STRING, EET_G_HASH, \
- (char *)(& (___ett.member)) - \
- (char *)(& (___ett)), \
- 0, /* 0, */ NULL, NULL); \
- } while (0)
+ do { \
+ struct_type ___ett; \
+ eet_data_descriptor_element_add(edd, name, EET_T_STRING, EET_G_HASH, \
+ (char *)(& (___ett.member)) - \
+ (char *)(& (___ett)), \
+ 0, /* 0, */ NULL, NULL); \
+ } while (0)
/**
* Add a fixed size array type to a data descriptor
@@ -3122,15 +3123,15 @@ eet_data_descriptor_encode(Eet_Data_Descriptor *edd,
* @since 1.0.2
* @ingroup Eet_Data_Group
*/
-#define EET_DATA_DESCRIPTOR_ADD_ARRAY(edd, struct_type, name, member, subtype) \
- do { \
- struct_type ___ett; \
- eet_data_descriptor_element_add(edd, name, EET_T_UNKNOW, EET_G_ARRAY, \
- (char *)(& (___ett.member)) - \
- (char *)(& (___ett)), \
- /* 0, */ sizeof(___ett.member) / \
- sizeof(___ett.member[0]), NULL, subtype); \
- } while (0)
+#define EET_DATA_DESCRIPTOR_ADD_ARRAY(edd, struct_type, name, member, subtype) \
+ do { \
+ struct_type ___ett; \
+ eet_data_descriptor_element_add(edd, name, EET_T_UNKNOW, EET_G_ARRAY, \
+ (char *)(& (___ett.member)) - \
+ (char *)(& (___ett)), \
+ /* 0, */ sizeof(___ett.member) / \
+ sizeof(___ett.member[0]), NULL, subtype); \
+ } while (0)
/**
* Add a variable size array type to a data descriptor
@@ -3155,19 +3156,19 @@ eet_data_descriptor_encode(Eet_Data_Descriptor *edd,
* @ingroup Eet_Data_Group
*/
#define EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(edd, struct_type, name, member, subtype) \
- do { \
- struct_type ___ett; \
- eet_data_descriptor_element_add(edd, \
- name, \
- EET_T_UNKNOW, \
- EET_G_VAR_ARRAY, \
- (char *)(& (___ett.member)) - \
- (char *)(& (___ett)), \
- (char *)(& (___ett.member ## _count)) - \
- (char *)(& (___ett)), \
- /* 0, */ NULL, \
- subtype); \
- } while (0)
+ do { \
+ struct_type ___ett; \
+ eet_data_descriptor_element_add(edd, \
+ name, \
+ EET_T_UNKNOW, \
+ EET_G_VAR_ARRAY, \
+ (char *)(& (___ett.member)) - \
+ (char *)(& (___ett)), \
+ (char *)(& (___ett.member ## _count)) - \
+ (char *)(& (___ett)), \
+ /* 0, */ NULL, \
+ subtype); \
+ } while (0)
/**
* Add a variable size array type to a data descriptor
@@ -3184,19 +3185,19 @@ eet_data_descriptor_encode(Eet_Data_Descriptor *edd,
* @ingroup Eet_Data_Group
*/
#define EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY_STRING(edd, struct_type, name, member) \
- do { \
- struct_type ___ett; \
- eet_data_descriptor_element_add(edd, \
- name, \
- EET_T_STRING, \
- EET_G_VAR_ARRAY, \
- (char *)(& (___ett.member)) - \
- (char *)(& (___ett)), \
- (char *)(& (___ett.member ## _count)) - \
- (char *)(& (___ett)), \
- /* 0, */ NULL, \
- NULL); \
- } while (0)
+ do { \
+ struct_type ___ett; \
+ eet_data_descriptor_element_add(edd, \
+ name, \
+ EET_T_STRING, \
+ EET_G_VAR_ARRAY, \
+ (char *)(& (___ett.member)) - \
+ (char *)(& (___ett)), \
+ (char *)(& (___ett.member ## _count)) - \
+ (char *)(& (___ett)), \
+ /* 0, */ NULL, \
+ NULL); \
+ } while (0)
/**
* Add an union type to a data descriptor
@@ -3218,15 +3219,15 @@ eet_data_descriptor_encode(Eet_Data_Descriptor *edd,
* @see Eet_Data_Descriptor_Class
*/
#define EET_DATA_DESCRIPTOR_ADD_UNION(edd, struct_type, name, member, type_member, unified_type) \
- do { \
- struct_type ___ett; \
- eet_data_descriptor_element_add(edd, name, EET_T_UNKNOW, EET_G_UNION, \
- (char *)(& (___ett.member)) - \
- (char *)(& (___ett)), \
- (char *)(& (___ett.type_member)) - \
- (char *)(& (___ett)), \
- NULL, unified_type); \
- } while (0)
+ do { \
+ struct_type ___ett; \
+ eet_data_descriptor_element_add(edd, name, EET_T_UNKNOW, EET_G_UNION, \
+ (char *)(& (___ett.member)) - \
+ (char *)(& (___ett)), \
+ (char *)(& (___ett.type_member)) - \
+ (char *)(& (___ett)), \
+ NULL, unified_type); \
+ } while (0)
/**
* Add a automatically selectable type to a data descriptor
@@ -3250,15 +3251,15 @@ eet_data_descriptor_encode(Eet_Data_Descriptor *edd,
* @see Eet_Data_Descriptor_Class
*/
#define EET_DATA_DESCRIPTOR_ADD_VARIANT(edd, struct_type, name, member, type_member, unified_type) \
- do { \
- struct_type ___ett; \
- eet_data_descriptor_element_add(edd, name, EET_T_UNKNOW, EET_G_VARIANT, \
- (char *)(& (___ett.member)) - \
- (char *)(& (___ett)), \
- (char *)(& (___ett.type_member)) - \
- (char *)(& (___ett)), \
- NULL, unified_type); \
- } while (0)
+ do { \
+ struct_type ___ett; \
+ eet_data_descriptor_element_add(edd, name, EET_T_UNKNOW, EET_G_VARIANT, \
+ (char *)(& (___ett.member)) - \
+ (char *)(& (___ett)), \
+ (char *)(& (___ett.type_member)) - \
+ (char *)(& (___ett)), \
+ NULL, unified_type); \
+ } while (0)
/**
* Add a mapping to a data descriptor that will be used by union, variant or inherited type
@@ -3271,14 +3272,14 @@ eet_data_descriptor_encode(Eet_Data_Descriptor *edd,
* @see Eet_Data_Descriptor_Class
*/
#define EET_DATA_DESCRIPTOR_ADD_MAPPING(unified_type, name, subtype) \
- eet_data_descriptor_element_add(unified_type, \
- name, \
- EET_T_UNKNOW, \
- EET_G_UNKNOWN, \
- 0, \
- 0, \
- NULL, \
- subtype)
+ eet_data_descriptor_element_add(unified_type, \
+ name, \
+ EET_T_UNKNOW, \
+ EET_G_UNKNOWN, \
+ 0, \
+ 0, \
+ NULL, \
+ subtype)
/**
* @defgroup Eet_Data_Cipher_Group Eet Data Serialization using A Ciphers
@@ -3320,10 +3321,10 @@ eet_data_descriptor_encode(Eet_Data_Descriptor *edd,
* @ingroup Eet_Data_Cipher_Group
*/
EAPI void *
-eet_data_read_cipher(Eet_File *ef,
+eet_data_read_cipher(Eet_File *ef,
Eet_Data_Descriptor *edd,
- const char *name,
- const char *cipher_key);
+ const char *name,
+ const char *cipher_key);
/**
* Read a data structure from an eet extended attribute and decodes it using a cipher.
@@ -3350,9 +3351,9 @@ eet_data_read_cipher(Eet_File *ef,
*/
EAPI void *
eet_data_xattr_cipher_get(const char *filename,
- const char *attribute,
- Eet_Data_Descriptor *edd,
- const char *cipher_key);
+ const char *attribute,
+ Eet_Data_Descriptor *edd,
+ const char *cipher_key);
/**
* Write a data structure from memory and store in an eet file
@@ -3372,12 +3373,12 @@ eet_data_xattr_cipher_get(const char *filename,
* @ingroup Eet_Data_Cipher_Group
*/
EAPI int
-eet_data_write_cipher(Eet_File *ef,
+eet_data_write_cipher(Eet_File *ef,
Eet_Data_Descriptor *edd,
- const char *name,
- const char *cipher_key,
- const void *data,
- int compress);
+ const char *name,
+ const char *cipher_key,
+ const void *data,
+ int compress);
/**
* Write a data structure from memory and store in an eet extended attribute
@@ -3398,11 +3399,11 @@ eet_data_write_cipher(Eet_File *ef,
*/
EAPI Eina_Bool
eet_data_xattr_cipher_set(const char *filename,
- const char *attribute,
- Eet_Data_Descriptor *edd,
- const char *cipher_key,
- const void *data,
- Eina_Xattr_Flags flags);
+ const char *attribute,
+ Eet_Data_Descriptor *edd,
+ const char *cipher_key,
+ const void *data,
+ Eina_Xattr_Flags flags);
/**
* Dump an eet encoded data structure into ascii text using a cipher.
@@ -3483,8 +3484,8 @@ eet_data_text_dump_cipher(const void *data_in,
EAPI void *
eet_data_text_undump_cipher(const char *text,
const char *cipher_key,
- int textlen,
- int *size_ret);
+ int textlen,
+ int *size_ret);
/**
* Dump an eet encoded data structure from an eet file into ascii
@@ -3512,11 +3513,11 @@ eet_data_text_undump_cipher(const char *text,
* @ingroup Eet_Data_Cipher_Group
*/
EAPI int
-eet_data_dump_cipher(Eet_File *ef,
- const char *name,
- const char *cipher_key,
+eet_data_dump_cipher(Eet_File *ef,
+ const char *name,
+ const char *cipher_key,
Eet_Dump_Callback dumpfunc,
- void *dumpdata);
+ void *dumpdata);
/**
* Take an ascii encoding from eet_data_dump() and re-encode in
@@ -3543,12 +3544,12 @@ eet_data_dump_cipher(Eet_File *ef,
* @ingroup Eet_Data_Cipher_Group
*/
EAPI int
-eet_data_undump_cipher(Eet_File *ef,
+eet_data_undump_cipher(Eet_File *ef,
const char *name,
const char *cipher_key,
const char *text,
- int textlen,
- int compress);
+ int textlen,
+ int compress);
/**
* Decode a data structure from an arbitrary location in memory
@@ -3581,9 +3582,9 @@ eet_data_undump_cipher(Eet_File *ef,
*/
EAPI void *
eet_data_descriptor_decode_cipher(Eet_Data_Descriptor *edd,
- const void *data_in,
- const char *cipher_key,
- int size_in);
+ const void *data_in,
+ const char *cipher_key,
+ int size_in);
/**
* Encode a data struct to memory and return that encoded data
@@ -3618,9 +3619,9 @@ eet_data_descriptor_decode_cipher(Eet_Data_Descriptor *edd,
*/
EAPI void *
eet_data_descriptor_encode_cipher(Eet_Data_Descriptor *edd,
- const void *data_in,
- const char *cipher_key,
- int *size_ret);
+ const void *data_in,
+ const char *cipher_key,
+ int *size_ret);
/**
* @defgroup Eet_Node_Group Low-level Serialization Structures.
@@ -3635,13 +3636,13 @@ eet_data_descriptor_encode_cipher(Eet_Data_Descriptor *edd,
* @typedef Eet_Node
* Opaque handle to manage serialization node.
*/
-typedef struct _Eet_Node Eet_Node;
+typedef struct _Eet_Node Eet_Node;
/**
* @typedef Eet_Node_Data
* Contains an union that can fit any kind of node.
*/
-typedef struct _Eet_Node_Data Eet_Node_Data;
+typedef struct _Eet_Node_Data Eet_Node_Data;
/**
* @struct _Eet_Node_Data
@@ -3650,17 +3651,17 @@ typedef struct _Eet_Node_Data Eet_Node_Data;
struct _Eet_Node_Data
{
union {
- char c;
- short s;
- int i;
- long long l;
- float f;
- double d;
- unsigned char uc;
- unsigned short us;
- unsigned int ui;
- unsigned long long ul;
- const char *str;
+ char c;
+ short s;
+ int i;
+ long long l;
+ float f;
+ double d;
+ unsigned char uc;
+ unsigned short us;
+ unsigned int ui;
+ unsigned long long ul;
+ const char *str;
} value;
};
@@ -3673,8 +3674,8 @@ struct _Eet_Node_Data
* @ingroup Eet_Node_Group
*/
EAPI Eet_Node *
- eet_node_char_new(const char *name,
- char c);
+eet_node_char_new(const char *name,
+ char c);
/**
* TODO FIX ME
@@ -3682,7 +3683,7 @@ EAPI Eet_Node *
*/
EAPI Eet_Node *
eet_node_short_new(const char *name,
- short s);
+ short s);
/**
* TODO FIX ME
@@ -3690,7 +3691,7 @@ eet_node_short_new(const char *name,
*/
EAPI Eet_Node *
eet_node_int_new(const char *name,
- int i);
+ int i);
/**
* TODO FIX ME
@@ -3698,7 +3699,7 @@ eet_node_int_new(const char *name,
*/
EAPI Eet_Node *
eet_node_long_long_new(const char *name,
- long long l);
+ long long l);
/**
* TODO FIX ME
@@ -3706,7 +3707,7 @@ eet_node_long_long_new(const char *name,
*/
EAPI Eet_Node *
eet_node_float_new(const char *name,
- float f);
+ float f);
/**
* TODO FIX ME
@@ -3714,39 +3715,39 @@ eet_node_float_new(const char *name,
*/
EAPI Eet_Node *
eet_node_double_new(const char *name,
- double d);
+ double d);
/**
* TODO FIX ME
* @ingroup Eet_Node_Group
*/
EAPI Eet_Node *
-eet_node_unsigned_char_new(const char *name,
- unsigned char uc);
+eet_node_unsigned_char_new(const char *name,
+ unsigned char uc);
/**
* TODO FIX ME
* @ingroup Eet_Node_Group
*/
EAPI Eet_Node *
-eet_node_unsigned_short_new(const char *name,
- unsigned short us);
+eet_node_unsigned_short_new(const char *name,
+ unsigned short us);
/**
* TODO FIX ME
* @ingroup Eet_Node_Group
*/
EAPI Eet_Node *
-eet_node_unsigned_int_new(const char *name,
- unsigned int ui);
+eet_node_unsigned_int_new(const char *name,
+ unsigned int ui);
/**
* TODO FIX ME
* @ingroup Eet_Node_Group
*/
EAPI Eet_Node *
-eet_node_unsigned_long_long_new(const char *name,
- unsigned long long l);
+eet_node_unsigned_long_long_new(const char *name,
+ unsigned long long l);
/**
* TODO FIX ME
@@ -3777,7 +3778,7 @@ eet_node_null_new(const char *name);
*/
EAPI Eet_Node *
eet_node_list_new(const char *name,
- Eina_List *nodes);
+ Eina_List *nodes);
/**
* TODO FIX ME
@@ -3785,8 +3786,8 @@ eet_node_list_new(const char *name,
*/
EAPI Eet_Node *
eet_node_array_new(const char *name,
- int count,
- Eina_List *nodes);
+ int count,
+ Eina_List *nodes);
/**
* TODO FIX ME
@@ -3794,7 +3795,7 @@ eet_node_array_new(const char *name,
*/
EAPI Eet_Node *
eet_node_var_array_new(const char *name,
- Eina_List *nodes);
+ Eina_List *nodes);
/**
* TODO FIX ME
@@ -3803,7 +3804,7 @@ eet_node_var_array_new(const char *name,
EAPI Eet_Node *
eet_node_hash_new(const char *name,
const char *key,
- Eet_Node *node);
+ Eet_Node *node);
/**
* TODO FIX ME
@@ -3811,7 +3812,7 @@ eet_node_hash_new(const char *name,
*/
EAPI Eet_Node *
eet_node_struct_new(const char *name,
- Eina_List *nodes);
+ Eina_List *nodes);
/**
* TODO FIX ME
@@ -3819,7 +3820,7 @@ eet_node_struct_new(const char *name,
*/
EAPI Eet_Node *
eet_node_struct_child_new(const char *parent,
- Eet_Node *child);
+ Eet_Node *child);
/**
* @brief Get a node's child nodes
@@ -3855,38 +3856,38 @@ eet_node_parent_get(Eet_Node *node);
* @ingroup Eet_Node_Group
*/
EAPI void
-eet_node_list_append(Eet_Node *parent,
+eet_node_list_append(Eet_Node *parent,
const char *name,
- Eet_Node *child);
+ Eet_Node *child);
/**
* TODO FIX ME
* @ingroup Eet_Node_Group
*/
EAPI void
-eet_node_struct_append(Eet_Node *parent,
+eet_node_struct_append(Eet_Node *parent,
const char *name,
- Eet_Node *child);
+ Eet_Node *child);
/**
* TODO FIX ME
* @ingroup Eet_Node_Group
*/
EAPI void
-eet_node_hash_add(Eet_Node *parent,
+eet_node_hash_add(Eet_Node *parent,
const char *name,
const char *key,
- Eet_Node *child);
+ Eet_Node *child);
/**
* TODO FIX ME
* @ingroup Eet_Node_Group
*/
EAPI void
-eet_node_dump(Eet_Node *n,
- int dumplevel,
+eet_node_dump(Eet_Node *n,
+ int dumplevel,
Eet_Dump_Callback dumpfunc,
- void *dumpdata);
+ void *dumpdata);
/**
* @brief Return the type of a node
@@ -3918,9 +3919,9 @@ eet_node_del(Eet_Node *n);
* @ingroup Eet_Node_Group
*/
EAPI void *
-eet_data_node_encode_cipher(Eet_Node *node,
+eet_data_node_encode_cipher(Eet_Node *node,
const char *cipher_key,
- int *size_ret);
+ int *size_ret);
/**
* TODO FIX ME
@@ -3929,14 +3930,14 @@ eet_data_node_encode_cipher(Eet_Node *node,
EAPI Eet_Node *
eet_data_node_decode_cipher(const void *data_in,
const char *cipher_key,
- int size_in);
+ int size_in);
/**
* TODO FIX ME
* @ingroup Eet_Node_Group
*/
EAPI Eet_Node *
-eet_data_node_read_cipher(Eet_File *ef,
+eet_data_node_read_cipher(Eet_File *ef,
const char *name,
const char *cipher_key);
@@ -3945,11 +3946,11 @@ eet_data_node_read_cipher(Eet_File *ef,
* @ingroup Eet_Node_Group
*/
EAPI int
-eet_data_node_write_cipher(Eet_File *ef,
+eet_data_node_write_cipher(Eet_File *ef,
const char *name,
const char *cipher_key,
- Eet_Node *node,
- int compress);
+ Eet_Node *node,
+ int compress);
/* EXPERIMENTAL: THIS API MAY CHANGE IN THE FUTURE, USE IT ONLY IF YOU KNOW WHAT YOU ARE DOING. */
@@ -3957,16 +3958,16 @@ eet_data_node_write_cipher(Eet_File *ef,
* @typedef Eet_Node_Walk
* Describes how to walk trees of #Eet_Node.
*/
-typedef struct _Eet_Node_Walk Eet_Node_Walk;
+typedef struct _Eet_Node_Walk Eet_Node_Walk;
-typedef void *(*Eet_Node_Walk_Struct_Alloc_Callback)(const char *type, void *user_data);
-typedef void (*Eet_Node_Walk_Struct_Add_Callback)(void *parent, const char *name, void *child, void *user_data);
-typedef void *(*Eet_Node_Walk_Array_Callback)(Eina_Bool variable, const char *name, int count, void *user_data);
-typedef void (*Eet_Node_Walk_Insert_Callback)(void *array, int index, void *child, void *user_data);
-typedef void *(*Eet_Node_Walk_List_Callback)(const char *name, void *user_data);
-typedef void (*Eet_Node_Walk_Append_Callback)(void *list, void *child, void *user_data);
-typedef void *(*Eet_Node_Walk_Hash_Callback)(void *parent, const char *name, const char *key, void *value, void *user_data);
-typedef void *(*Eet_Node_Walk_Simple_Callback)(int type, Eet_Node_Data *data, void *user_data);
+typedef void * (*Eet_Node_Walk_Struct_Alloc_Callback)(const char *type, void *user_data);
+typedef void (*Eet_Node_Walk_Struct_Add_Callback)(void *parent, const char *name, void *child, void *user_data);
+typedef void * (*Eet_Node_Walk_Array_Callback)(Eina_Bool variable, const char *name, int count, void *user_data);
+typedef void (*Eet_Node_Walk_Insert_Callback)(void *array, int index, void *child, void *user_data);
+typedef void * (*Eet_Node_Walk_List_Callback)(const char *name, void *user_data);
+typedef void (*Eet_Node_Walk_Append_Callback)(void *list, void *child, void *user_data);
+typedef void * (*Eet_Node_Walk_Hash_Callback)(void *parent, const char *name, const char *key, void *value, void *user_data);
+typedef void * (*Eet_Node_Walk_Simple_Callback)(int type, Eet_Node_Data *data, void *user_data);
/**
* @struct _Eet_Node_Walk
@@ -3975,21 +3976,21 @@ typedef void *(*Eet_Node_Walk_Simple_Callback)(int type, Eet_Node_Data *data, vo
struct _Eet_Node_Walk
{
Eet_Node_Walk_Struct_Alloc_Callback struct_alloc;
- Eet_Node_Walk_Struct_Add_Callback struct_add;
- Eet_Node_Walk_Array_Callback array;
- Eet_Node_Walk_Insert_Callback insert;
- Eet_Node_Walk_List_Callback list;
- Eet_Node_Walk_Append_Callback append;
- Eet_Node_Walk_Hash_Callback hash;
- Eet_Node_Walk_Simple_Callback simple;
+ Eet_Node_Walk_Struct_Add_Callback struct_add;
+ Eet_Node_Walk_Array_Callback array;
+ Eet_Node_Walk_Insert_Callback insert;
+ Eet_Node_Walk_List_Callback list;
+ Eet_Node_Walk_Append_Callback append;
+ Eet_Node_Walk_Hash_Callback hash;
+ Eet_Node_Walk_Simple_Callback simple;
};
EAPI void *
-eet_node_walk(void *parent,
- const char *name,
- Eet_Node *root,
+eet_node_walk(void *parent,
+ const char *name,
+ Eet_Node *root,
Eet_Node_Walk *cb,
- void *user_data);
+ void *user_data);
/*******/
@@ -4006,7 +4007,7 @@ eet_node_walk(void *parent,
*
* @ingroup Eet_Connection_Group
*/
-typedef struct _Eet_Connection Eet_Connection;
+typedef struct _Eet_Connection Eet_Connection;
/**
* @typedef Eet_Read_Cb
@@ -4037,9 +4038,9 @@ typedef Eina_Bool Eet_Write_Cb (const void *data, size_t size, void *user_data);
* @ingroup Eet_Connection_Group
*/
EAPI Eet_Connection *
-eet_connection_new(Eet_Read_Cb *eet_read_cb,
+eet_connection_new(Eet_Read_Cb *eet_read_cb,
Eet_Write_Cb *eet_write_cb,
- const void *user_data);
+ const void *user_data);
/**
* Process a raw packet received over the link
@@ -4057,8 +4058,8 @@ eet_connection_new(Eet_Read_Cb *eet_read_cb,
*/
EAPI int
eet_connection_received(Eet_Connection *conn,
- const void *data,
- size_t size);
+ const void *data,
+ size_t size);
/**
* Convert a complex structure and prepare it to be send.
@@ -4078,10 +4079,10 @@ eet_connection_received(Eet_Connection *conn,
* @ingroup Eet_Connection_Group
*/
EAPI Eina_Bool
-eet_connection_send(Eet_Connection *conn,
+eet_connection_send(Eet_Connection *conn,
Eet_Data_Descriptor *edd,
- const void *data_in,
- const char *cipher_key);
+ const void *data_in,
+ const char *cipher_key);
/**
* Convert a Eet_Node tree and prepare it to be send.
@@ -4101,8 +4102,8 @@ eet_connection_send(Eet_Connection *conn,
*/
EAPI Eina_Bool
eet_connection_node_send(Eet_Connection *conn,
- Eet_Node *node,
- const char *cipher_key);
+ Eet_Node *node,
+ const char *cipher_key);
/**
* Close a connection and lost its track.
@@ -4115,7 +4116,7 @@ eet_connection_node_send(Eet_Connection *conn,
*/
EAPI void *
eet_connection_close(Eet_Connection *conn,
- Eina_Bool *on_going);
+ Eina_Bool *on_going);
/***************************************************************************/
diff --git a/src/lib/Eet_private.h b/src/lib/Eet_private.h
index 1b7b9de..83f4c18 100644
--- a/src/lib/Eet_private.h
+++ b/src/lib/Eet_private.h
@@ -3,7 +3,7 @@
#include <Eina.h>
-typedef enum _Eet_Convert_Type Eet_Convert_Type;
+typedef enum _Eet_Convert_Type Eet_Convert_Type;
enum _Eet_Convert_Type
{
@@ -13,8 +13,8 @@ enum _Eet_Convert_Type
EET_D_FIXED_POINT = 1 << 4
};
-typedef struct _Eet_String Eet_String;
-typedef struct _Eet_Convert Eet_Convert;
+typedef struct _Eet_String Eet_String;
+typedef struct _Eet_Convert Eet_Convert;
struct _Eet_Convert
{
@@ -27,15 +27,15 @@ struct _Eet_Convert
struct _Eet_String
{
- const char *str;
+ const char *str;
- int len;
+ int len;
- int next;
- int prev;
+ int next;
+ int prev;
- unsigned char hash;
- unsigned char allocated : 1;
+ unsigned char hash;
+ unsigned char allocated : 1;
};
struct _Eet_Dictionary
{
@@ -101,61 +101,82 @@ extern int _eet_log_dom_global;
#endif /* ifdef CRIT */
#define CRIT(...) EINA_LOG_DOM_CRIT(_eet_log_dom_global, __VA_ARGS__)
-Eet_Dictionary * eet_dictionary_add(void);
-void eet_dictionary_free(Eet_Dictionary *ed);
-int eet_dictionary_string_add(Eet_Dictionary *ed,
- const char *string);
-int eet_dictionary_string_get_size(const Eet_Dictionary *ed,
- int index);
-const char * eet_dictionary_string_get_char(const Eet_Dictionary *ed,
- int index);
-Eina_Bool eet_dictionary_string_get_float(const Eet_Dictionary *ed,
- int index,
- float *result);
-Eina_Bool eet_dictionary_string_get_double(const Eet_Dictionary *ed,
- int index,
- double *result);
-Eina_Bool eet_dictionary_string_get_fp(const Eet_Dictionary *ed,
- int index,
- Eina_F32p32 *result);
-int eet_dictionary_string_get_hash(const Eet_Dictionary *ed,
- int index);
-
-int _eet_hash_gen(const char *key, int hash_size);
-
-const void * eet_identity_check(const void *data_base,
- unsigned int data_length,
- void **sha1,
- int *sha1_length,
- const void *signature_base,
- unsigned int signature_length,
- const void **raw_signature_base,
- unsigned int *raw_signature_length,
- int *x509_length);
-void * eet_identity_compute_sha1(const void *data_base,
- unsigned int data_length,
- int *sha1_length);
-Eet_Error eet_cipher(const void *data,
- unsigned int size,
- const char *key,
- unsigned int length,
- void **result,
- unsigned int *result_length);
-Eet_Error eet_decipher(const void *data,
- unsigned int size,
- const char *key,
- unsigned int length,
- void **result,
- unsigned int *result_length);
-Eet_Error eet_identity_sign(FILE *fp,
- Eet_Key *key);
-void eet_identity_unref(Eet_Key *key);
-void eet_identity_ref(Eet_Key *key);
-
-void eet_node_shutdown(void);
-int eet_node_init(void);
-Eet_Node * eet_node_new(void);
-void eet_node_free(Eet_Node *node);
+Eet_Dictionary *
+ eet_dictionary_add(void);
+void
+ eet_dictionary_free(Eet_Dictionary *ed);
+int
+ eet_dictionary_string_add(Eet_Dictionary *ed,
+ const char *string);
+int
+eet_dictionary_string_get_size(const Eet_Dictionary *ed,
+ int index);
+const char *
+eet_dictionary_string_get_char(const Eet_Dictionary *ed,
+ int index);
+Eina_Bool
+eet_dictionary_string_get_float(const Eet_Dictionary *ed,
+ int index,
+ float *result);
+Eina_Bool
+eet_dictionary_string_get_double(const Eet_Dictionary *ed,
+ int index,
+ double *result);
+Eina_Bool
+eet_dictionary_string_get_fp(const Eet_Dictionary *ed,
+ int index,
+ Eina_F32p32 *result);
+int
+eet_dictionary_string_get_hash(const Eet_Dictionary *ed,
+ int index);
+
+int _eet_hash_gen(const char *key,
+ int hash_size);
+
+const void *
+eet_identity_check(const void *data_base,
+ unsigned int data_length,
+ void **sha1,
+ int *sha1_length,
+ const void *signature_base,
+ unsigned int signature_length,
+ const void **raw_signature_base,
+ unsigned int *raw_signature_length,
+ int *x509_length);
+void *
+eet_identity_compute_sha1(const void *data_base,
+ unsigned int data_length,
+ int *sha1_length);
+Eet_Error
+eet_cipher(const void *data,
+ unsigned int size,
+ const char *key,
+ unsigned int length,
+ void **result,
+ unsigned int *result_length);
+Eet_Error
+eet_decipher(const void *data,
+ unsigned int size,
+ const char *key,
+ unsigned int length,
+ void **result,
+ unsigned int *result_length);
+Eet_Error
+eet_identity_sign(FILE *fp,
+ Eet_Key *key);
+void
+ eet_identity_unref(Eet_Key *key);
+void
+ eet_identity_ref(Eet_Key *key);
+
+void
+ eet_node_shutdown(void);
+int
+ eet_node_init(void);
+Eet_Node *
+ eet_node_new(void);
+void
+ eet_node_free(Eet_Node *node);
#ifndef PATH_MAX
# define PATH_MAX 4096
diff --git a/src/lib/eet_cipher.c b/src/lib/eet_cipher.c
index 505af64..3f9895c 100644
--- a/src/lib/eet_cipher.c
+++ b/src/lib/eet_cipher.c
@@ -16,7 +16,7 @@
# ifdef __cplusplus
extern "C"
# endif /* ifdef __cplusplus */
-void * alloca (size_t);
+void *alloca(size_t);
#endif /* ifdef HAVE_ALLOCA_H */
#include <stdio.h>
@@ -80,19 +80,21 @@ void * alloca (size_t);
#ifdef HAVE_CIPHER
# ifdef HAVE_GNUTLS
-static Eet_Error eet_hmac_sha1(const void *key,
- size_t key_len,
- const void *data,
- size_t data_len,
- unsigned char *res);
+static Eet_Error
+eet_hmac_sha1(const void *key,
+ size_t key_len,
+ const void *data,
+ size_t data_len,
+ unsigned char *res);
# endif /* ifdef HAVE_GNUTLS */
-static Eet_Error eet_pbkdf2_sha1(const char *key,
- int key_len,
- const unsigned char *salt,
- unsigned int salt_len,
- int iter,
- unsigned char *res,
- int res_len);
+static Eet_Error
+eet_pbkdf2_sha1(const char *key,
+ int key_len,
+ const unsigned char *salt,
+ unsigned int salt_len,
+ int iter,
+ unsigned char *res,
+ int res_len);
#endif /* ifdef HAVE_CIPHER */
struct _Eet_Key
@@ -126,20 +128,20 @@ eet_identity_open(const char *certificate_file,
/* Init */
if (!(key = malloc(sizeof(Eet_Key))))
- goto on_error;
+ goto on_error;
key->references = 1;
if (gnutls_x509_crt_init(&(key->certificate)))
- goto on_error;
+ goto on_error;
if (gnutls_x509_privkey_init(&(key->private_key)))
- goto on_error;
+ goto on_error;
/* Mmap certificate_file */
f = eina_file_open(certificate_file, 0);
if (!f)
- goto on_error;
+ goto on_error;
/* let's make mmap safe and just get 0 pages for IO erro */
eina_mmap_safety_enabled_set(EINA_TRUE);
@@ -149,10 +151,10 @@ eet_identity_open(const char *certificate_file,
/* Import the certificate in Eet_Key structure */
load_file.data = data;
- load_file.size = eina_file_size_get(f);;
+ load_file.size = eina_file_size_get(f);
if (gnutls_x509_crt_import(key->certificate, &load_file,
GNUTLS_X509_FMT_PEM) < 0)
- goto on_error;
+ goto on_error;
eina_file_map_free(f, data);
@@ -166,34 +168,34 @@ eet_identity_open(const char *certificate_file,
/* Mmap private_key_file */
f = eina_file_open(private_key_file, 0);
if (!f)
- goto on_error;
+ goto on_error;
/* let's make mmap safe and just get 0 pages for IO erro */
eina_mmap_safety_enabled_set(EINA_TRUE);
data = eina_file_map_all(f, EINA_FILE_SEQUENTIAL);
if (!data)
- goto on_error;
+ goto on_error;
/* Import the private key in Eet_Key structure */
load_file.data = data;
- load_file.size = eina_file_size_get(f);;
+ load_file.size = eina_file_size_get(f);
/* Try to directly import the PEM encoded private key */
if (gnutls_x509_privkey_import(key->private_key, &load_file,
GNUTLS_X509_FMT_PEM) < 0)
{
/* Else ask for the private key pass */
- if (cb && cb(pass, 1024, 0, NULL))
- {
- /* If pass then try to decode the pkcs 8 private key */
- if (gnutls_x509_privkey_import_pkcs8(key->private_key, &load_file,
- GNUTLS_X509_FMT_PEM, pass, 0))
- goto on_error;
- }
- else
- /* Else try to import the pkcs 8 private key without pass */
- if (gnutls_x509_privkey_import_pkcs8(key->private_key, &load_file,
- GNUTLS_X509_FMT_PEM, NULL, 1))
+ if (cb && cb(pass, 1024, 0, NULL))
+ {
+ /* If pass then try to decode the pkcs 8 private key */
+ if (gnutls_x509_privkey_import_pkcs8(key->private_key, &load_file,
+ GNUTLS_X509_FMT_PEM, pass, 0))
+ goto on_error;
+ }
+ else
+ /* Else try to import the pkcs 8 private key without pass */
+ if (gnutls_x509_privkey_import_pkcs8(key->private_key, &load_file,
+ GNUTLS_X509_FMT_PEM, NULL, 1))
goto on_error;
}
@@ -209,10 +211,10 @@ on_error:
if (key)
{
if (key->certificate)
- gnutls_x509_crt_deinit(key->certificate);
+ gnutls_x509_crt_deinit(key->certificate);
if (key->private_key)
- gnutls_x509_privkey_deinit(key->private_key);
+ gnutls_x509_privkey_deinit(key->private_key);
free(key);
}
@@ -226,32 +228,32 @@ on_error:
/* Load the X509 certificate in memory. */
fp = fopen(certificate_file, "r");
if (!fp)
- return NULL;
+ return NULL;
cert = PEM_read_X509(fp, NULL, NULL, NULL);
fclose(fp);
if (!cert)
- goto on_error;
+ goto on_error;
/* Check the presence of the public key. Just in case. */
pkey = X509_get_pubkey(cert);
if (!pkey)
- goto on_error;
+ goto on_error;
/* Load the private key in memory. */
fp = fopen(private_key_file, "r");
if (!fp)
- goto on_error;
+ goto on_error;
pkey = PEM_read_PrivateKey(fp, NULL, cb, NULL);
fclose(fp);
if (!pkey)
- goto on_error;
+ goto on_error;
/* Load the certificate and the private key in Eet_Key structure */
key = malloc(sizeof(Eet_Key));
if (!key)
- goto on_error;
+ goto on_error;
key->references = 1;
key->certificate = cert;
@@ -261,10 +263,10 @@ on_error:
on_error:
if (cert)
- X509_free(cert);
+ X509_free(cert);
if (pkey)
- EVP_PKEY_free(pkey);
+ EVP_PKEY_free(pkey);
# endif /* ifdef HAVE_GNUTLS */
#else
@@ -280,7 +282,7 @@ eet_identity_close(Eet_Key *key)
{
#ifdef HAVE_SIGNATURE
if (!key || (key->references > 0))
- return;
+ return;
# ifdef HAVE_GNUTLS
gnutls_x509_crt_deinit(key->certificate);
@@ -318,7 +320,7 @@ eet_identity_print(Eet_Key *key,
unsigned int i, j;
if (!key)
- return;
+ return;
if (key->private_key)
{
@@ -329,10 +331,10 @@ eet_identity_print(Eet_Key *key,
rsa_raw + 3, /* First prime */
rsa_raw + 4, /* Second prime */
rsa_raw + 5)) /* Coefficient */
- goto on_error;
+ goto on_error;
if (!(res = malloc(size)))
- goto on_error;
+ goto on_error;
fprintf(out, "Private Key:\n");
buf[32] = '\0';
@@ -344,10 +346,10 @@ eet_identity_print(Eet_Key *key,
{
size += 128;
if (!(res = realloc(res, size)))
- goto on_error;
+ goto on_error;
}
if (err)
- goto on_error;
+ goto on_error;
fprintf(out, "\t%s:\n", names[i]);
for (j = 0; strlen(res) > j; j += 32)
@@ -365,7 +367,7 @@ eet_identity_print(Eet_Key *key,
fprintf(out, "Public certificate:\n");
if (gnutls_x509_crt_print(key->certificate, GNUTLS_X509_CRT_FULL,
&data))
- goto on_error;
+ goto on_error;
fprintf(out, "%s\n", data.data);
gnutls_free(data.data);
@@ -374,10 +376,10 @@ eet_identity_print(Eet_Key *key,
on_error:
if (res)
- free(res);
+ free(res);
if (data.data)
- gnutls_free(data.data);
+ gnutls_free(data.data);
return;
# else /* ifdef HAVE_GNUTLS */
@@ -386,7 +388,7 @@ on_error:
DH *dh;
if (!key)
- return;
+ return;
rsa = EVP_PKEY_get1_RSA(key->private_key);
if (rsa)
@@ -423,7 +425,7 @@ void
eet_identity_ref(Eet_Key *key)
{
if (!key)
- return;
+ return;
key->references++;
} /* eet_identity_ref */
@@ -432,7 +434,7 @@ void
eet_identity_unref(Eet_Key *key)
{
if (!key)
- return;
+ return;
key->references--;
eet_identity_close(key);
@@ -449,21 +451,21 @@ eet_identity_compute_sha1(const void *data_base,
# ifdef HAVE_GNUTLS
result = malloc(gcry_md_get_algo_dlen(GCRY_MD_SHA1));
if (!result)
- return NULL;
+ return NULL;
gcry_md_hash_buffer(GCRY_MD_SHA1, result, data_base, data_length);
if (sha1_length)
- *sha1_length = gcry_md_get_algo_dlen(GCRY_MD_SHA1);
+ *sha1_length = gcry_md_get_algo_dlen(GCRY_MD_SHA1);
# else /* ifdef HAVE_GNUTLS */
# ifdef HAVE_OPENSSL
result = malloc(SHA_DIGEST_LENGTH);
if (!result)
- return NULL;
+ return NULL;
SHA1(data_base, data_length, result);
if (sha1_length)
- *sha1_length = SHA_DIGEST_LENGTH;
+ *sha1_length = SHA_DIGEST_LENGTH;
# else /* ifdef HAVE_OPENSSL */
result = NULL;
@@ -503,15 +505,15 @@ eet_identity_sign(FILE *fp,
/* A few check and flush pending write. */
if (!fp || !key || !key->certificate || !key->private_key)
- return EET_ERROR_BAD_OBJECT;
+ return EET_ERROR_BAD_OBJECT;
/* Get the file size. */
fd = fileno(fp);
if (fd < 0)
- return EET_ERROR_BAD_OBJECT;
+ return EET_ERROR_BAD_OBJECT;
if (fstat(fd, &st_buf) < 0)
- return EET_ERROR_MMAP_FAILED;
+ return EET_ERROR_MMAP_FAILED;
/* let's make mmap safe and just get 0 pages for IO erro */
eina_mmap_safety_enabled_set(EINA_TRUE);
@@ -519,7 +521,7 @@ eet_identity_sign(FILE *fp,
/* Map the file in memory. */
data = mmap(NULL, st_buf.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
if (data == MAP_FAILED)
- return EET_ERROR_MMAP_FAILED;
+ return EET_ERROR_MMAP_FAILED;
# ifdef HAVE_GNUTLS
datum.data = data;
@@ -542,9 +544,9 @@ eet_identity_sign(FILE *fp,
sign, &sign_len))
{
if (!sign)
- err = EET_ERROR_OUT_OF_MEMORY;
+ err = EET_ERROR_OUT_OF_MEMORY;
else
- err = EET_ERROR_SIGNATURE_FAILED;
+ err = EET_ERROR_SIGNATURE_FAILED;
goto on_error;
}
@@ -565,9 +567,9 @@ eet_identity_sign(FILE *fp,
&cert_len))
{
if (!cert)
- err = EET_ERROR_OUT_OF_MEMORY;
+ err = EET_ERROR_OUT_OF_MEMORY;
else
- err = EET_ERROR_SIGNATURE_FAILED;
+ err = EET_ERROR_SIGNATURE_FAILED;
goto on_error;
}
@@ -631,15 +633,15 @@ eet_identity_sign(FILE *fp,
on_error:
# ifdef HAVE_GNUTLS
if (cert)
- free(cert);
+ free(cert);
# else /* ifdef HAVE_GNUTLS */
if (cert)
- OPENSSL_free(cert);
+ OPENSSL_free(cert);
# endif /* ifdef HAVE_GNUTLS */
if (sign)
- free(sign);
+ free(sign);
munmap(data, st_buf.st_size);
return err;
@@ -671,7 +673,7 @@ eet_identity_check(const void *data_base,
/* At least the header size */
if (signature_length < sizeof(int) * 3)
- return NULL;
+ return NULL;
/* Get the header */
magic = ntohl(header[0]);
@@ -680,10 +682,10 @@ eet_identity_check(const void *data_base,
/* Verify the header */
if (magic != EET_MAGIC_SIGN)
- return NULL;
+ return NULL;
if (sign_len + cert_len + sizeof(int) * 3 > signature_length)
- return NULL;
+ return NULL;
/* Update the signature and certificate pointer */
sign = (unsigned char *)signature_base + sizeof(int) * 3;
@@ -716,7 +718,7 @@ eet_identity_check(const void *data_base,
*/
err = gcry_md_open (&md, GCRY_MD_SHA1, 0);
if (err < 0)
- return NULL;
+ return NULL;
gcry_md_write(md, data_base, data_length);
@@ -755,7 +757,7 @@ eet_identity_check(const void *data_base,
datum.size = data_length;
if (!gnutls_x509_crt_verify_data(cert, 0, &datum, &signature))
- return NULL;
+ return NULL;
if (sha1)
{
@@ -778,7 +780,7 @@ eet_identity_check(const void *data_base,
memcpy((char *)tmp, cert_der, cert_len);
x509 = d2i_X509(NULL, &tmp, cert_len);
if (!x509)
- return NULL;
+ return NULL;
/* Get public key - eay */
pkey = X509_get_pubkey(x509);
@@ -803,17 +805,17 @@ eet_identity_check(const void *data_base,
}
if (err != 1)
- return NULL;
+ return NULL;
# endif /* ifdef HAVE_GNUTLS */
if (x509_length)
- *x509_length = cert_len;
+ *x509_length = cert_len;
if (raw_signature_base)
- *raw_signature_base = sign;
+ *raw_signature_base = sign;
if (raw_signature_length)
- *raw_signature_length = sign_len;
+ *raw_signature_length = sign_len;
return cert_der;
#else /* ifdef HAVE_SIGNATURE */
@@ -850,23 +852,23 @@ eet_identity_certificate_print(const unsigned char *certificate,
datum.data = (void *)certificate;
datum.size = der_length;
if (gnutls_x509_crt_init(&cert))
- goto on_error;
+ goto on_error;
if (gnutls_x509_crt_import(cert, &datum, GNUTLS_X509_FMT_DER))
- goto on_error;
+ goto on_error;
/* Pretty print the certificate */
datum.data = NULL;
datum.size = 0;
if (gnutls_x509_crt_print(cert, GNUTLS_X509_CRT_FULL, &datum))
- goto on_error;
+ goto on_error;
INF("Public certificate :");
INF("%s", datum.data);
on_error:
if (datum.data)
- gnutls_free(datum.data);
+ gnutls_free(datum.data);
gnutls_x509_crt_deinit(cert);
# else /* ifdef HAVE_GNUTLS */
@@ -931,7 +933,7 @@ eet_cipher(const void *data,
# else /* ifdef HAVE_GNUTLS */
/* Openssl salt generation */
if (!RAND_bytes((unsigned char *)&salt, sizeof (unsigned int)))
- return EET_ERROR_PRNG_NOT_SEEDED;
+ return EET_ERROR_PRNG_NOT_SEEDED;
# endif /* ifdef HAVE_GNUTLS */
@@ -943,7 +945,7 @@ eet_cipher(const void *data,
key_material,
MAX_KEY_LEN + MAX_IV_LEN);
- memcpy(iv, key_material, MAX_IV_LEN);
+ memcpy(iv, key_material, MAX_IV_LEN);
memcpy(ik, key_material + MAX_IV_LEN, MAX_KEY_LEN);
memset(key_material, 0, sizeof (key_material));
@@ -952,8 +954,8 @@ eet_cipher(const void *data,
ret = malloc(crypted_length + sizeof(unsigned int));
if (!ret)
{
- memset(iv, 0, sizeof (iv));
- memset(ik, 0, sizeof (ik));
+ memset(iv, 0, sizeof (iv));
+ memset(ik, 0, sizeof (ik));
memset(&salt, 0, sizeof (salt));
return EET_ERROR_OUT_OF_MEMORY;
}
@@ -970,16 +972,16 @@ eet_cipher(const void *data,
AES with a 256 bit key, Cipher Block Chaining mode */
err = gcry_cipher_open(&cipher, GCRY_CIPHER_AES256, GCRY_CIPHER_MODE_CBC, 0);
if (err)
- goto on_error;
+ goto on_error;
opened = 1;
err = gcry_cipher_setiv(cipher, iv, MAX_IV_LEN);
if (err)
- goto on_error;
+ goto on_error;
err = gcry_cipher_setkey(cipher, ik, MAX_KEY_LEN);
if (err)
- goto on_error;
+ goto on_error;
memset(iv, 0, sizeof (iv));
memset(ik, 0, sizeof (ik));
@@ -991,7 +993,7 @@ eet_cipher(const void *data,
NULL,
0);
if (err)
- goto on_error;
+ goto on_error;
/* Gcrypt close the cipher */
gcry_cipher_close(cipher);
@@ -1005,7 +1007,7 @@ eet_cipher(const void *data,
AES with a 256 bit key, Cipher Block Chaining mode */
EVP_CIPHER_CTX_init(&ctx);
if (!EVP_EncryptInit_ex(&ctx, EVP_aes_256_cbc(), NULL, ik, iv))
- goto on_error;
+ goto on_error;
opened = 1;
@@ -1016,24 +1018,24 @@ eet_cipher(const void *data,
if (!EVP_EncryptUpdate(&ctx, (unsigned char *)(ret + 1), &tmp_len,
(unsigned char *)buffer,
size + sizeof(unsigned int)))
- goto on_error;
+ goto on_error;
/* Openssl close the cipher */
if (!EVP_EncryptFinal_ex(&ctx, ((unsigned char *)(ret + 1)) + tmp_len,
&tmp_len))
- goto on_error;
+ goto on_error;
EVP_CIPHER_CTX_cleanup(&ctx);
# endif /* ifdef HAVE_GNUTLS */
/* Set return values */
if (result_length)
- *result_length = crypted_length + sizeof(unsigned int);
+ *result_length = crypted_length + sizeof(unsigned int);
if (result)
- *result = ret;
+ *result = ret;
else
- free(ret);
+ free(ret);
return EET_ERROR_NONE;
@@ -1044,21 +1046,21 @@ on_error:
# ifdef HAVE_GNUTLS
/* Gcrypt error */
if (opened)
- gcry_cipher_close(cipher);
+ gcry_cipher_close(cipher);
# else /* ifdef HAVE_GNUTLS */
/* Openssl error */
if (opened)
- EVP_CIPHER_CTX_cleanup(&ctx);
+ EVP_CIPHER_CTX_cleanup(&ctx);
# endif /* ifdef HAVE_GNUTLS */
/* General error */
free(ret);
if (result)
- *result = NULL;
+ *result = NULL;
if (result_length)
- *result_length = 0;
+ *result_length = 0;
return EET_ERROR_ENCRYPT_FAILED;
#else /* ifdef HAVE_CIPHER */
@@ -1093,7 +1095,7 @@ eet_decipher(const void *data,
/* At least the salt and an AES block */
if (size < sizeof(unsigned int) + 16)
- return EET_ERROR_BAD_OBJECT;
+ return EET_ERROR_BAD_OBJECT;
/* Get the salt */
salt = *over;
@@ -1103,20 +1105,20 @@ eet_decipher(const void *data,
sizeof(unsigned int), 2048, key_material,
MAX_KEY_LEN + MAX_IV_LEN);
- memcpy(iv, key_material, MAX_IV_LEN);
+ memcpy(iv, key_material, MAX_IV_LEN);
memcpy(ik, key_material + MAX_IV_LEN, MAX_KEY_LEN);
memset(key_material, 0, sizeof (key_material));
- memset(&salt, 0, sizeof (salt));
+ memset(&salt, 0, sizeof (salt));
/* Align to AES block size if size is not align */
tmp_len = size - sizeof (unsigned int);
if ((tmp_len & 0x1F) != 0)
- goto on_error;
+ goto on_error;
ret = malloc(tmp_len);
if (!ret)
- goto on_error;
+ goto on_error;
# ifdef HAVE_GNUTLS
gcry_error_t err = 0;
@@ -1125,15 +1127,15 @@ eet_decipher(const void *data,
/* Gcrypt create the corresponding cipher */
err = gcry_cipher_open(&cipher, GCRY_CIPHER_AES256, GCRY_CIPHER_MODE_CBC, 0);
if (err)
- return EET_ERROR_DECRYPT_FAILED;
+ return EET_ERROR_DECRYPT_FAILED;
err = gcry_cipher_setiv(cipher, iv, MAX_IV_LEN);
if (err)
- goto on_error;
+ goto on_error;
err = gcry_cipher_setkey(cipher, ik, MAX_KEY_LEN);
if (err)
- goto on_error;
+ goto on_error;
memset(iv, 0, sizeof (iv));
memset(ik, 0, sizeof (ik));
@@ -1142,7 +1144,7 @@ eet_decipher(const void *data,
err = gcry_cipher_decrypt(cipher, ret, tmp_len,
((unsigned int *)data) + 1, tmp_len);
if (err)
- goto on_error;
+ goto on_error;
/* Gcrypt close the cipher */
gcry_cipher_close(cipher);
@@ -1156,7 +1158,7 @@ eet_decipher(const void *data,
opened = 1;
if (!EVP_DecryptInit_ex(&ctx, EVP_aes_256_cbc(), NULL, ik, iv))
- goto on_error;
+ goto on_error;
memset(iv, 0, sizeof (iv));
memset(ik, 0, sizeof (ik));
@@ -1164,7 +1166,7 @@ eet_decipher(const void *data,
/* Openssl decrypt */
if (!EVP_DecryptUpdate(&ctx, (unsigned char *)ret, &tmp,
(unsigned char *)(over + 1), tmp_len))
- goto on_error;
+ goto on_error;
/* Openssl close the cipher*/
EVP_CIPHER_CTX_cleanup(&ctx);
@@ -1173,18 +1175,18 @@ eet_decipher(const void *data,
tmp = *ret;
tmp = ntohl(tmp);
if (tmp > tmp_len)
- goto on_error;
+ goto on_error;
/* Update the return values */
if (result_length)
- *result_length = tmp;
+ *result_length = tmp;
if (result)
{
*result = NULL;
*result = malloc(tmp);
if (!*result)
- goto on_error;
+ goto on_error;
memcpy(*result, ret + 1, tmp);
}
@@ -1200,17 +1202,17 @@ on_error:
# ifdef HAVE_GNUTLS
# else
if (opened)
- EVP_CIPHER_CTX_cleanup(&ctx);
+ EVP_CIPHER_CTX_cleanup(&ctx);
# endif /* ifdef HAVE_GNUTLS */
if (result)
- *result = NULL;
+ *result = NULL;
if (result_length)
- *result_length = 0;
+ *result_length = 0;
if (ret)
- free(ret);
+ free(ret);
return EET_ERROR_DECRYPT_FAILED;
#else /* ifdef HAVE_CIPHER */
@@ -1240,7 +1242,7 @@ eet_hmac_sha1(const void *key,
err = gcry_md_open(&mdh, GCRY_MD_SHA1, GCRY_MD_FLAG_HMAC);
if (err != GPG_ERR_NO_ERROR)
- return 1;
+ return 1;
err = gcry_md_setkey(mdh, key, key_len);
if (err != GPG_ERR_NO_ERROR)
@@ -1292,14 +1294,14 @@ eet_pbkdf2_sha1(const char *key,
buf = alloca(salt_len + 4);
if (!buf)
- return 1;
+ return 1;
for (i = 1; len; len -= tmp_len, p += tmp_len, i++)
{
if (len > digest_len)
- tmp_len = digest_len;
+ tmp_len = digest_len;
else
- tmp_len = len;
+ tmp_len = len;
tab[0] = (unsigned char)(i & 0xff000000) >> 24;
tab[1] = (unsigned char)(i & 0x00ff0000) >> 16;
@@ -1307,13 +1309,13 @@ eet_pbkdf2_sha1(const char *key,
tab[3] = (unsigned char)(i & 0x000000ff) >> 0;
# ifdef HAVE_GNUTLS
- memcpy(buf, salt, salt_len);
- memcpy(buf + salt_len, tab, 4);
+ memcpy(buf, salt, salt_len);
+ memcpy(buf + salt_len, tab, 4);
eet_hmac_sha1(key, key_len, buf, salt_len + 4, digest);
# else /* ifdef HAVE_GNUTLS */
HMAC_Init(&hctx, key, key_len, EVP_sha1());
HMAC_Update(&hctx, salt, salt_len);
- HMAC_Update(&hctx, tab, 4);
+ HMAC_Update(&hctx, tab, 4);
HMAC_Final(&hctx, digest, NULL);
# endif /* ifdef HAVE_GNUTLS */
memcpy(p, digest, tmp_len);
@@ -1326,7 +1328,7 @@ eet_pbkdf2_sha1(const char *key,
HMAC(EVP_sha1(), key, key_len, digest, 20, digest, NULL);
# endif /* ifdef HAVE_GNUTLS */
for (k = 0; k < tmp_len; k++)
- p[k] ^= digest[k];
+ p[k] ^= digest[k];
}
}
diff --git a/src/lib/eet_connection.c b/src/lib/eet_connection.c
index 026f4f4..6171b7e 100644
--- a/src/lib/eet_connection.c
+++ b/src/lib/eet_connection.c
@@ -16,7 +16,7 @@
# ifdef __cplusplus
extern "C"
# endif /* ifdef __cplusplus */
-void * alloca (size_t);
+void *alloca(size_t);
#endif /* ifdef HAVE_ALLOCA_H */
#include <string.h>
@@ -58,11 +58,11 @@ eet_connection_new(Eet_Read_Cb *eet_read_cb,
Eet_Connection *conn;
if (!eet_read_cb || !eet_write_cb)
- return NULL;
+ return NULL;
conn = calloc(1, sizeof (Eet_Connection));
if (!conn)
- return NULL;
+ return NULL;
conn->eet_read_cb = eet_read_cb;
conn->eet_write_cb = eet_write_cb;
@@ -77,7 +77,7 @@ eet_connection_received(Eet_Connection *conn,
size_t size)
{
if ((!conn) || (!data) || (!size))
- return size;
+ return size;
do {
size_t copy_size;
@@ -88,31 +88,31 @@ eet_connection_received(Eet_Connection *conn,
size_t packet_size;
if (size < sizeof (int) * 2)
- break;
+ break;
msg = data;
/* Check the magic */
if (ntohl(msg[0]) != MAGIC_EET_DATA_PACKET)
- break;
+ break;
packet_size = ntohl(msg[1]);
/* Message should always be under 64K */
if (packet_size > 64 * 1024)
- break;
+ break;
data = (void *)(msg + 2);
size -= sizeof (int) * 2;
if ((size_t)packet_size <= size)
{
- /* Not a partial receive, go the quick way. */
- if (!conn->eet_read_cb(data, packet_size, conn->user_data))
+ /* Not a partial receive, go the quick way. */
+ if (!conn->eet_read_cb(data, packet_size, conn->user_data))
break;
- data = (void *)((char *)data + packet_size);
- size -= packet_size;
+ data = (void *)((char *)data + packet_size);
+ size -= packet_size;
- conn->received = 0;
- continue;
+ conn->received = 0;
+ continue;
}
conn->size = packet_size;
@@ -122,7 +122,7 @@ eet_connection_received(Eet_Connection *conn,
tmp = realloc(conn->buffer, conn->size);
if (!tmp)
- break;
+ break;
conn->buffer = tmp;
conn->allocated = conn->size;
@@ -131,8 +131,8 @@ eet_connection_received(Eet_Connection *conn,
/* Partial receive */
copy_size =
- (conn->size - conn->received >=
- size) ? size : conn->size - conn->received;
+ (conn->size - conn->received >=
+ size) ? size : conn->size - conn->received;
memcpy((char *)conn->buffer + conn->received, data, copy_size);
conn->received += copy_size;
@@ -150,9 +150,9 @@ eet_connection_received(Eet_Connection *conn,
/* Completed a packet. */
if (!conn->eet_read_cb(conn->buffer, data_size, conn->user_data))
{
- /* Something goes wrong. Stop now. */
- size += data_size;
- break;
+ /* Something goes wrong. Stop now. */
+ size += data_size;
+ break;
}
}
} while (size > 0);
@@ -169,7 +169,7 @@ _eet_connection_raw_send(Eet_Connection *conn,
/* Message should never be above 64K */
if (data_size > 64 * 1024)
- return EINA_FALSE;
+ return EINA_FALSE;
message = alloca(data_size + sizeof (int) * 2);
message[0] = htonl(MAGIC_EET_DATA_PACKET);
@@ -198,10 +198,10 @@ eet_connection_send(Eet_Connection *conn,
cipher_key,
&data_size);
if (!flat_data)
- return EINA_FALSE;
+ return EINA_FALSE;
if (_eet_connection_raw_send(conn, flat_data, data_size))
- ret = EINA_TRUE;
+ ret = EINA_TRUE;
free(flat_data);
return ret;
@@ -218,10 +218,10 @@ eet_connection_node_send(Eet_Connection *conn,
data = eet_data_node_encode_cipher(node, cipher_key, &data_size);
if (!data)
- return EINA_FALSE;
+ return EINA_FALSE;
if (_eet_connection_raw_send(conn, data, data_size))
- ret = EINA_TRUE;
+ ret = EINA_TRUE;
free(data);
return ret;
@@ -234,10 +234,10 @@ eet_connection_close(Eet_Connection *conn,
void *user_data;
if (!conn)
- return NULL;
+ return NULL;
if (on_going)
- *on_going = conn->received == 0 ? EINA_FALSE : EINA_TRUE;
+ *on_going = conn->received == 0 ? EINA_FALSE : EINA_TRUE;
user_data = conn->user_data;
diff --git a/src/lib/eet_data.c b/src/lib/eet_data.c
index 7b2d394..4eabf4d 100644
--- a/src/lib/eet_data.c
+++ b/src/lib/eet_data.c
@@ -22,14 +22,14 @@
#include "Eet_private.h"
#ifdef _WIN32
-# define FMT_CHAR "%c"
-# define FMT_UCHAR "%c"
-# define FMT_LONG_LONG "%I64i"
+# define FMT_CHAR "%c"
+# define FMT_UCHAR "%c"
+# define FMT_LONG_LONG "%I64i"
# define FMT_ULONG_LONG "%I64u"
#else
-# define FMT_CHAR "%hhi"
-# define FMT_UCHAR "%hhu"
-# define FMT_LONG_LONG "%lli"
+# define FMT_CHAR "%hhi"
+# define FMT_UCHAR "%hhu"
+# define FMT_LONG_LONG "%lli"
# define FMT_ULONG_LONG "%llu"
#endif
@@ -73,16 +73,16 @@
/*---*/
-typedef struct _Eet_Data_Element Eet_Data_Element;
-typedef struct _Eet_Data_Basic_Type_Codec Eet_Data_Basic_Type_Codec;
-typedef struct _Eet_Data_Group_Type_Codec Eet_Data_Group_Type_Codec;
-typedef struct _Eet_Data_Chunk Eet_Data_Chunk;
-typedef struct _Eet_Data_Stream Eet_Data_Stream;
-typedef struct _Eet_Data_Descriptor_Hash Eet_Data_Descriptor_Hash;
-typedef struct _Eet_Data_Encode_Hash_Info Eet_Data_Encode_Hash_Info;
-typedef struct _Eet_Free Eet_Free;
-typedef struct _Eet_Free_Context Eet_Free_Context;
-typedef struct _Eet_Variant_Unknow Eet_Variant_Unknow;
+typedef struct _Eet_Data_Element Eet_Data_Element;
+typedef struct _Eet_Data_Basic_Type_Codec Eet_Data_Basic_Type_Codec;
+typedef struct _Eet_Data_Group_Type_Codec Eet_Data_Group_Type_Codec;
+typedef struct _Eet_Data_Chunk Eet_Data_Chunk;
+typedef struct _Eet_Data_Stream Eet_Data_Stream;
+typedef struct _Eet_Data_Descriptor_Hash Eet_Data_Descriptor_Hash;
+typedef struct _Eet_Data_Encode_Hash_Info Eet_Data_Encode_Hash_Info;
+typedef struct _Eet_Free Eet_Free;
+typedef struct _Eet_Free_Context Eet_Free_Context;
+typedef struct _Eet_Variant_Unknow Eet_Variant_Unknow;
/*---*/
@@ -94,14 +94,30 @@ struct _Eet_Data_Basic_Type_Codec
{
int size;
const char *name;
- int (*get)(const Eet_Dictionary *ed, const void *src, const void *src_end, void *dest);
+ int (*get)(const Eet_Dictionary *ed,
+ const void *src,
+ const void *src_end,
+ void *dest);
void * (*put)(Eet_Dictionary *ed, const void *src, int *size_ret);
};
struct _Eet_Data_Group_Type_Codec
{
- int (*get)(Eet_Free_Context *context, const Eet_Dictionary *ed, Eet_Data_Descriptor *edd, Eet_Data_Element *ede, Eet_Data_Chunk *echnk, int type, int group_type, void *data_in, char **p, int *size);
- void (*put)(Eet_Dictionary *ed, Eet_Data_Descriptor *edd, Eet_Data_Element *ede, Eet_Data_Stream *ds, void *data_in);
+ int (*get)(Eet_Free_Context *context,
+ const Eet_Dictionary *ed,
+ Eet_Data_Descriptor *edd,
+ Eet_Data_Element *ede,
+ Eet_Data_Chunk *echnk,
+ int type,
+ int group_type,
+ void *data_in,
+ char **p,
+ int *size);
+ void (*put)(Eet_Dictionary *ed,
+ Eet_Data_Descriptor *edd,
+ Eet_Data_Element *ede,
+ Eet_Data_Stream *ds,
+ void *data_in);
};
struct _Eet_Data_Chunk
@@ -145,11 +161,18 @@ struct _Eet_Data_Descriptor
void * (*list_append)(void *l, void *d);
void * (*list_data)(void *l);
void * (*list_free)(void *l);
- void (*hash_foreach)(void *h, int (*func)(void *h, const char *k, void *dt, void *fdt), void *fdt);
+ void (*hash_foreach)(void *h,
+ int (*func)(void *h,
+ const char *k,
+ void *dt,
+ void *fdt),
+ void *fdt);
void * (*hash_add)(void *h, const char *k, void *d);
void (*hash_free)(void *h);
const char *(*type_get)(const void *data, Eina_Bool *unknow);
- Eina_Bool (*type_set)(const char *type, void *data, Eina_Bool unknow);
+ Eina_Bool (*type_set)(const char *type,
+ void *data,
+ Eina_Bool unknow);
void * (*array_alloc)(size_t size);
void (*array_free)(void *mem);
} func;
@@ -192,7 +215,7 @@ struct _Eet_Data_Encode_Hash_Info
#define EET_FREE_COUNT 256
struct _Eet_Free
{
- int ref;
+ int ref;
Eina_Array list[EET_FREE_COUNT];
};
@@ -216,290 +239,339 @@ struct _Eet_Variant_Unknow
/*---*/
-static void eet_free_context_init(Eet_Free_Context *context);
-static void eet_free_context_shutdown(Eet_Free_Context *context);
-
-static int eet_data_get_char(const Eet_Dictionary *ed,
- const void *src,
- const void *src_end,
- void *dest);
-static void * eet_data_put_char(Eet_Dictionary *ed,
- const void *src,
- int *size_ret);
-static int eet_data_get_short(const Eet_Dictionary *ed,
- const void *src,
- const void *src_end,
- void *dest);
-static void * eet_data_put_short(Eet_Dictionary *ed,
- const void *src,
- int *size_ret);
-static inline int eet_data_get_int(const Eet_Dictionary *ed,
- const void *src,
- const void *src_end,
- void *dest);
-static void * eet_data_put_int(Eet_Dictionary *ed,
- const void *src,
- int *size_ret);
-static int eet_data_get_long_long(const Eet_Dictionary *ed,
- const void *src,
- const void *src_end,
- void *dest);
-static void * eet_data_put_long_long(Eet_Dictionary *ed,
- const void *src,
- int *size_ret);
-static int eet_data_get_float(const Eet_Dictionary *ed,
- const void *src,
- const void *src_end,
- void *dest);
-static void * eet_data_put_float(Eet_Dictionary *ed,
- const void *src,
- int *size_ret);
-static int eet_data_get_double(const Eet_Dictionary *ed,
- const void *src,
- const void *src_end,
- void *dest);
-static void * eet_data_put_double(Eet_Dictionary *ed,
- const void *src,
- int *size_ret);
-static int eet_data_get_f32p32(const Eet_Dictionary *ed,
- const void *src,
- const void *src_end,
- void *dest);
-static void * eet_data_put_f32p32(Eet_Dictionary *ed,
- const void *src,
- int *size_ret);
-static int eet_data_get_f16p16(const Eet_Dictionary *ed,
- const void *src,
- const void *src_end,
- void *dest);
-static void * eet_data_put_f16p16(Eet_Dictionary *ed,
- const void *src,
- int *size_ret);
-static int eet_data_get_f8p24(const Eet_Dictionary *ed,
- const void *src,
- const void *src_end,
- void *dest);
-static void * eet_data_put_f8p24(Eet_Dictionary *ed,
- const void *src,
- int *size_ret);
-static inline int eet_data_get_string(const Eet_Dictionary *ed,
- const void *src,
- const void *src_end,
- void *dest);
-static void * eet_data_put_string(Eet_Dictionary *ed,
- const void *src,
- int *size_ret);
-static int eet_data_get_istring(const Eet_Dictionary *ed,
- const void *src,
- const void *src_end,
- void *dest);
-static void * eet_data_put_istring(Eet_Dictionary *ed,
- const void *src,
- int *size_ret);
-static int eet_data_get_null(const Eet_Dictionary *ed,
- const void *src,
- const void *src_end,
- void *dest);
-static void * eet_data_put_null(Eet_Dictionary *ed,
- const void *src,
- int *size_ret);
-
-static int eet_data_get_type(const Eet_Dictionary *ed,
- int type,
- const void *src,
- const void *src_end,
- void *dest);
-static void * eet_data_put_type(Eet_Dictionary *ed,
- int type,
- const void *src,
- int *size_ret);
-
-static Eet_Node * eet_data_node_simple_type(int type,
- const char *name,
- void *dd);
-
-static int eet_data_get_unknown(Eet_Free_Context *context,
- const Eet_Dictionary *ed,
- Eet_Data_Descriptor *edd,
- Eet_Data_Element *ede,
- Eet_Data_Chunk *echnk,
- int type,
- int group_type,
- void *data_in,
- char **p,
- int *size);
-static void eet_data_put_unknown(Eet_Dictionary *ed,
- Eet_Data_Descriptor *edd,
- Eet_Data_Element *ede,
- Eet_Data_Stream *ds,
- void *data_in);
-static void eet_data_put_array(Eet_Dictionary *ed,
- Eet_Data_Descriptor *edd,
- Eet_Data_Element *ede,
- Eet_Data_Stream *ds,
- void *data_in);
-static int eet_data_get_array(Eet_Free_Context *context,
- const Eet_Dictionary *ed,
- Eet_Data_Descriptor *edd,
- Eet_Data_Element *ede,
- Eet_Data_Chunk *echnk,
- int type,
- int group_type,
- void *data,
- char **p,
- int *size);
-static int eet_data_get_list(Eet_Free_Context *context,
- const Eet_Dictionary *ed,
- Eet_Data_Descriptor *edd,
- Eet_Data_Element *ede,
- Eet_Data_Chunk *echnk,
- int type,
- int group_type,
- void *data_in,
- char **p,
- int *size);
-static void eet_data_put_list(Eet_Dictionary *ed,
- Eet_Data_Descriptor *edd,
- Eet_Data_Element *ede,
- Eet_Data_Stream *ds,
- void *data_in);
-static void eet_data_put_hash(Eet_Dictionary *ed,
- Eet_Data_Descriptor *edd,
- Eet_Data_Element *ede,
- Eet_Data_Stream *ds,
- void *data_in);
-static int eet_data_get_hash(Eet_Free_Context *context,
- const Eet_Dictionary *ed,
- Eet_Data_Descriptor *edd,
- Eet_Data_Element *ede,
- Eet_Data_Chunk *echnk,
- int type,
- int group_type,
- void *data,
- char **p,
- int *size);
-static void eet_data_put_union(Eet_Dictionary *ed,
- Eet_Data_Descriptor *edd,
- Eet_Data_Element *ede,
- Eet_Data_Stream *ds,
- void *data_in);
-static int eet_data_get_union(Eet_Free_Context *context,
- const Eet_Dictionary *ed,
- Eet_Data_Descriptor *edd,
- Eet_Data_Element *ede,
- Eet_Data_Chunk *echnk,
- int type,
- int group_type,
- void *data,
- char **p,
- int *size);
-static void eet_data_put_variant(Eet_Dictionary *ed,
- Eet_Data_Descriptor *edd,
- Eet_Data_Element *ede,
- Eet_Data_Stream *ds,
- void *data_in);
-static int eet_data_get_variant(Eet_Free_Context *context,
- const Eet_Dictionary *ed,
- Eet_Data_Descriptor *edd,
- Eet_Data_Element *ede,
- Eet_Data_Chunk *echnk,
- int type,
- int group_type,
- void *data,
- char **p,
- int *size);
-
-static void eet_data_chunk_get(const Eet_Dictionary *ed,
- Eet_Data_Chunk *chnk,
- const void *src,
- int size);
-static Eet_Data_Chunk * eet_data_chunk_new(void *data,
- int size,
- const char *name,
- int type,
- int group_type);
-static void eet_data_chunk_free(Eet_Data_Chunk *chnk);
-
-static Eet_Data_Stream * eet_data_stream_new(void);
-static void eet_data_stream_write(Eet_Data_Stream *ds,
- const void *data,
- int size);
-static void eet_data_stream_free(Eet_Data_Stream *ds);
-
-static void eet_data_chunk_put(Eet_Dictionary *ed,
- Eet_Data_Chunk *chnk,
- Eet_Data_Stream *ds);
-
-static int eet_data_descriptor_encode_hash_cb(void *hash,
- const char *key,
- void *hdata,
- void *fdata);
-static void * _eet_data_descriptor_encode(Eet_Dictionary *ed,
- Eet_Data_Descriptor *edd,
- const void *data_in,
- int *size_ret);
-static void * _eet_data_descriptor_decode(Eet_Free_Context *context,
- const Eet_Dictionary *ed,
- Eet_Data_Descriptor *edd,
- const void *data_in,
- int size_in,
- void *data_out,
- int size_out);
+static void
+ eet_free_context_init(Eet_Free_Context *context);
+static void
+ eet_free_context_shutdown(Eet_Free_Context *context);
+
+static int
+eet_data_get_char(const Eet_Dictionary *ed,
+ const void *src,
+ const void *src_end,
+ void *dest);
+static void *
+eet_data_put_char(Eet_Dictionary *ed,
+ const void *src,
+ int *size_ret);
+static int
+eet_data_get_short(const Eet_Dictionary *ed,
+ const void *src,
+ const void *src_end,
+ void *dest);
+static void *
+eet_data_put_short(Eet_Dictionary *ed,
+ const void *src,
+ int *size_ret);
+static inline int
+eet_data_get_int(const Eet_Dictionary *ed,
+ const void *src,
+ const void *src_end,
+ void *dest);
+static void *
+eet_data_put_int(Eet_Dictionary *ed,
+ const void *src,
+ int *size_ret);
+static int
+eet_data_get_long_long(const Eet_Dictionary *ed,
+ const void *src,
+ const void *src_end,
+ void *dest);
+static void *
+eet_data_put_long_long(Eet_Dictionary *ed,
+ const void *src,
+ int *size_ret);
+static int
+eet_data_get_float(const Eet_Dictionary *ed,
+ const void *src,
+ const void *src_end,
+ void *dest);
+static void *
+eet_data_put_float(Eet_Dictionary *ed,
+ const void *src,
+ int *size_ret);
+static int
+eet_data_get_double(const Eet_Dictionary *ed,
+ const void *src,
+ const void *src_end,
+ void *dest);
+static void *
+eet_data_put_double(Eet_Dictionary *ed,
+ const void *src,
+ int *size_ret);
+static int
+eet_data_get_f32p32(const Eet_Dictionary *ed,
+ const void *src,
+ const void *src_end,
+ void *dest);
+static void *
+eet_data_put_f32p32(Eet_Dictionary *ed,
+ const void *src,
+ int *size_ret);
+static int
+eet_data_get_f16p16(const Eet_Dictionary *ed,
+ const void *src,
+ const void *src_end,
+ void *dest);
+static void *
+eet_data_put_f16p16(Eet_Dictionary *ed,
+ const void *src,
+ int *size_ret);
+static int
+eet_data_get_f8p24(const Eet_Dictionary *ed,
+ const void *src,
+ const void *src_end,
+ void *dest);
+static void *
+eet_data_put_f8p24(Eet_Dictionary *ed,
+ const void *src,
+ int *size_ret);
+static inline int
+eet_data_get_string(const Eet_Dictionary *ed,
+ const void *src,
+ const void *src_end,
+ void *dest);
+static void *
+eet_data_put_string(Eet_Dictionary *ed,
+ const void *src,
+ int *size_ret);
+static int
+eet_data_get_istring(const Eet_Dictionary *ed,
+ const void *src,
+ const void *src_end,
+ void *dest);
+static void *
+eet_data_put_istring(Eet_Dictionary *ed,
+ const void *src,
+ int *size_ret);
+static int
+eet_data_get_null(const Eet_Dictionary *ed,
+ const void *src,
+ const void *src_end,
+ void *dest);
+static void *
+eet_data_put_null(Eet_Dictionary *ed,
+ const void *src,
+ int *size_ret);
+
+static int
+eet_data_get_type(const Eet_Dictionary *ed,
+ int type,
+ const void *src,
+ const void *src_end,
+ void *dest);
+static void *
+eet_data_put_type(Eet_Dictionary *ed,
+ int type,
+ const void *src,
+ int *size_ret);
+
+static Eet_Node *
+eet_data_node_simple_type(int type,
+ const char *name,
+ void *dd);
+
+static int
+eet_data_get_unknown(Eet_Free_Context *context,
+ const Eet_Dictionary *ed,
+ Eet_Data_Descriptor *edd,
+ Eet_Data_Element *ede,
+ Eet_Data_Chunk *echnk,
+ int type,
+ int group_type,
+ void *data_in,
+ char **p,
+ int *size);
+static void
+eet_data_put_unknown(Eet_Dictionary *ed,
+ Eet_Data_Descriptor *edd,
+ Eet_Data_Element *ede,
+ Eet_Data_Stream *ds,
+ void *data_in);
+static void
+eet_data_put_array(Eet_Dictionary *ed,
+ Eet_Data_Descriptor *edd,
+ Eet_Data_Element *ede,
+ Eet_Data_Stream *ds,
+ void *data_in);
+static int
+eet_data_get_array(Eet_Free_Context *context,
+ const Eet_Dictionary *ed,
+ Eet_Data_Descriptor *edd,
+ Eet_Data_Element *ede,
+ Eet_Data_Chunk *echnk,
+ int type,
+ int group_type,
+ void *data,
+ char **p,
+ int *size);
+static int
+eet_data_get_list(Eet_Free_Context *context,
+ const Eet_Dictionary *ed,
+ Eet_Data_Descriptor *edd,
+ Eet_Data_Element *ede,
+ Eet_Data_Chunk *echnk,
+ int type,
+ int group_type,
+ void *data_in,
+ char **p,
+ int *size);
+static void
+eet_data_put_list(Eet_Dictionary *ed,
+ Eet_Data_Descriptor *edd,
+ Eet_Data_Element *ede,
+ Eet_Data_Stream *ds,
+ void *data_in);
+static void
+eet_data_put_hash(Eet_Dictionary *ed,
+ Eet_Data_Descriptor *edd,
+ Eet_Data_Element *ede,
+ Eet_Data_Stream *ds,
+ void *data_in);
+static int
+eet_data_get_hash(Eet_Free_Context *context,
+ const Eet_Dictionary *ed,
+ Eet_Data_Descriptor *edd,
+ Eet_Data_Element *ede,
+ Eet_Data_Chunk *echnk,
+ int type,
+ int group_type,
+ void *data,
+ char **p,
+ int *size);
+static void
+eet_data_put_union(Eet_Dictionary *ed,
+ Eet_Data_Descriptor *edd,
+ Eet_Data_Element *ede,
+ Eet_Data_Stream *ds,
+ void *data_in);
+static int
+eet_data_get_union(Eet_Free_Context *context,
+ const Eet_Dictionary *ed,
+ Eet_Data_Descriptor *edd,
+ Eet_Data_Element *ede,
+ Eet_Data_Chunk *echnk,
+ int type,
+ int group_type,
+ void *data,
+ char **p,
+ int *size);
+static void
+eet_data_put_variant(Eet_Dictionary *ed,
+ Eet_Data_Descriptor *edd,
+ Eet_Data_Element *ede,
+ Eet_Data_Stream *ds,
+ void *data_in);
+static int
+eet_data_get_variant(Eet_Free_Context *context,
+ const Eet_Dictionary *ed,
+ Eet_Data_Descriptor *edd,
+ Eet_Data_Element *ede,
+ Eet_Data_Chunk *echnk,
+ int type,
+ int group_type,
+ void *data,
+ char **p,
+ int *size);
+
+static void
+eet_data_chunk_get(const Eet_Dictionary *ed,
+ Eet_Data_Chunk *chnk,
+ const void *src,
+ int size);
+static Eet_Data_Chunk *
+eet_data_chunk_new(void *data,
+ int size,
+ const char *name,
+ int type,
+ int group_type);
+static void
+eet_data_chunk_free(Eet_Data_Chunk *chnk);
+
+static Eet_Data_Stream *
+ eet_data_stream_new(void);
+static void
+ eet_data_stream_write(Eet_Data_Stream *ds,
+ const void *data,
+ int size);
+static void
+eet_data_stream_free(Eet_Data_Stream *ds);
+
+static void
+eet_data_chunk_put(Eet_Dictionary *ed,
+ Eet_Data_Chunk *chnk,
+ Eet_Data_Stream *ds);
+
+static int
+eet_data_descriptor_encode_hash_cb(void *hash,
+ const char *key,
+ void *hdata,
+ void *fdata);
+static void *_eet_data_descriptor_encode(Eet_Dictionary *ed,
+ Eet_Data_Descriptor *edd,
+ const void *data_in,
+ int *size_ret);
+static void *_eet_data_descriptor_decode(Eet_Free_Context *context,
+ const Eet_Dictionary *ed,
+ Eet_Data_Descriptor *edd,
+ const void *data_in,
+ int size_in,
+ void *data_out,
+ int size_out);
/*---*/
static const Eet_Data_Basic_Type_Codec eet_basic_codec[] =
{
- {sizeof(char), "char", eet_data_get_char, eet_data_put_char },
- {sizeof(short), "short", eet_data_get_short, eet_data_put_short },
- {sizeof(int), "int", eet_data_get_int, eet_data_put_int },
- {sizeof(long long), "long_long", eet_data_get_long_long, eet_data_put_long_long},
- {sizeof(float), "float", eet_data_get_float, eet_data_put_float },
- {sizeof(double), "double", eet_data_get_double, eet_data_put_double },
- {sizeof(char), "uchar", eet_data_get_char, eet_data_put_char },
- {sizeof(short), "ushort", eet_data_get_short, eet_data_put_short },
- {sizeof(int), "uint", eet_data_get_int, eet_data_put_int },
+ {sizeof(char), "char", eet_data_get_char, eet_data_put_char },
+ {sizeof(short), "short", eet_data_get_short, eet_data_put_short },
+ {sizeof(int), "int", eet_data_get_int, eet_data_put_int },
+ {sizeof(long long), "long_long", eet_data_get_long_long, eet_data_put_long_long},
+ {sizeof(float), "float", eet_data_get_float, eet_data_put_float },
+ {sizeof(double), "double", eet_data_get_double, eet_data_put_double },
+ {sizeof(char), "uchar", eet_data_get_char, eet_data_put_char },
+ {sizeof(short), "ushort", eet_data_get_short, eet_data_put_short },
+ {sizeof(int), "uint", eet_data_get_int, eet_data_put_int },
{sizeof(long long), "ulong_long", eet_data_get_long_long, eet_data_put_long_long},
- {sizeof(char *), "string", eet_data_get_string, eet_data_put_string },
- {sizeof(char *), "inlined", eet_data_get_istring, eet_data_put_istring },
- {sizeof(void *), "NULL", eet_data_get_null, eet_data_put_null },
- {sizeof(Eina_F32p32),"f32p32", eet_data_get_f32p32, eet_data_put_f32p32 },
- {sizeof(Eina_F16p16),"f16p16", eet_data_get_f16p16, eet_data_put_f16p16 },
- {sizeof(Eina_F8p24),"f8p24", eet_data_get_f8p24, eet_data_put_f8p24 }
+ {sizeof(char *), "string", eet_data_get_string, eet_data_put_string },
+ {sizeof(char *), "inlined", eet_data_get_istring, eet_data_put_istring },
+ {sizeof(void *), "NULL", eet_data_get_null, eet_data_put_null },
+ {sizeof(Eina_F32p32), "f32p32", eet_data_get_f32p32, eet_data_put_f32p32 },
+ {sizeof(Eina_F16p16), "f16p16", eet_data_get_f16p16, eet_data_put_f16p16 },
+ {sizeof(Eina_F8p24), "f8p24", eet_data_get_f8p24, eet_data_put_f8p24 }
};
static const Eet_Data_Group_Type_Codec eet_group_codec[] =
{
- { eet_data_get_unknown, eet_data_put_unknown },
- { eet_data_get_array, eet_data_put_array },
- { eet_data_get_array, eet_data_put_array },
- { eet_data_get_list, eet_data_put_list },
- { eet_data_get_hash, eet_data_put_hash },
- { eet_data_get_union, eet_data_put_union },
- { eet_data_get_variant, eet_data_put_variant }
+ { eet_data_get_unknown, eet_data_put_unknown },
+ { eet_data_get_array, eet_data_put_array },
+ { eet_data_get_array, eet_data_put_array },
+ { eet_data_get_list, eet_data_put_list },
+ { eet_data_get_hash, eet_data_put_hash },
+ { eet_data_get_union, eet_data_put_union },
+ { eet_data_get_variant, eet_data_put_variant }
};
static int _eet_data_words_bigendian = -1;
/*---*/
-#define SWAP64(x) (x) =\
- ((((unsigned long long)(x) & 0x00000000000000ffULL) << 56) |\
- (((unsigned long long)(x) & 0x000000000000ff00ULL) << 40) |\
- (((unsigned long long)(x) & 0x0000000000ff0000ULL) << 24) |\
- (((unsigned long long)(x) & 0x00000000ff000000ULL) << 8) |\
- (((unsigned long long)(x) & 0x000000ff00000000ULL) >> 8) |\
- (((unsigned long long)(x) & 0x0000ff0000000000ULL) >> 24) |\
- (((unsigned long long)(x) & 0x00ff000000000000ULL) >> 40) |\
- (((unsigned long long)(x) & 0xff00000000000000ULL) >> 56))
-#define SWAP32(x) (x) =\
- ((((int)(x) & 0x000000ff) << 24) |\
- (((int)(x) & 0x0000ff00) << 8) |\
- (((int)(x) & 0x00ff0000) >> 8) |\
- (((int)(x) & 0xff000000) >> 24))
-#define SWAP16(x) (x) =\
- ((((short)(x) & 0x00ff) << 8) |\
- (((short)(x) & 0xff00) >> 8))
+#define SWAP64(x) (x) = \
+ ((((unsigned long long)(x) & 0x00000000000000ffULL) << 56) | \
+ (((unsigned long long)(x) & 0x000000000000ff00ULL) << 40) | \
+ (((unsigned long long)(x) & 0x0000000000ff0000ULL) << 24) | \
+ (((unsigned long long)(x) & 0x00000000ff000000ULL) << 8) | \
+ (((unsigned long long)(x) & 0x000000ff00000000ULL) >> 8) | \
+ (((unsigned long long)(x) & 0x0000ff0000000000ULL) >> 24) | \
+ (((unsigned long long)(x) & 0x00ff000000000000ULL) >> 40) | \
+ (((unsigned long long)(x) & 0xff00000000000000ULL) >> 56))
+#define SWAP32(x) (x) = \
+ ((((int)(x) & 0x000000ff) << 24) | \
+ (((int)(x) & 0x0000ff00) << 8) | \
+ (((int)(x) & 0x00ff0000) >> 8) | \
+ (((int)(x) & 0xff000000) >> 24))
+#define SWAP16(x) (x) = \
+ ((((short)(x) & 0x00ff) << 8) | \
+ (((short)(x) & 0xff00) >> 8))
#ifdef CONV8
# undef CONV8
@@ -522,38 +594,38 @@ static int _eet_data_words_bigendian = -1;
#define IS_SIMPLE_TYPE(Type) (Type > EET_T_UNKNOW && Type < EET_T_LAST)
#define IS_POINTER_TYPE(Type) (Type >= EET_T_STRING && Type <= EET_T_NULL)
-#define POINTER_TYPE_DECODE(Context,\
- Ed,\
- Edd,\
- Ede,\
- Echnk,\
- Type,\
- Data,\
- P,\
- Size,\
- Label)\
- do {\
- int ___r;\
- ___r = eet_data_get_unknown(Context,\
- Ed,\
- Edd, Ede,\
- Echnk,\
- Type, EET_G_UNKNOWN,\
- Data, P, Size);\
- if (!___r) { goto Label; }\
- } while (0)
+#define POINTER_TYPE_DECODE(Context, \
+ Ed, \
+ Edd, \
+ Ede, \
+ Echnk, \
+ Type, \
+ Data, \
+ P, \
+ Size, \
+ Label) \
+ do { \
+ int ___r; \
+ ___r = eet_data_get_unknown(Context, \
+ Ed, \
+ Edd, Ede, \
+ Echnk, \
+ Type, EET_G_UNKNOWN, \
+ Data, P, Size); \
+ if (!___r) { goto Label; } \
+ } while (0)
#define STRUCT_TYPE_DECODE(Data_Ret, Context, Ed, Ede, Data, Size, SubSize, Label) \
- do {\
- Data_Ret = _eet_data_descriptor_decode(Context,\
- Ed,\
- Ede,\
- Data,\
- Size,\
- SubSize > 0 ? Data_Ret : NULL,\
- SubSize); \
- if (!Data_Ret) { goto Label; }\
- } while (0)
+ do { \
+ Data_Ret = _eet_data_descriptor_decode(Context, \
+ Ed, \
+ Ede, \
+ Data, \
+ Size, \
+ SubSize > 0 ? Data_Ret : NULL, \
+ SubSize); \
+ if (!Data_Ret) { goto Label; } \
+ } while (0)
#define EET_I_STRING 1 << 4
#define EET_I_INLINED_STRING 2 << 4
@@ -565,14 +637,14 @@ static int _eet_data_words_bigendian = -1;
/* CHAR TYPE */
static int
eet_data_get_char(const Eet_Dictionary *ed __UNUSED__,
- const void *src,
- const void *src_end,
- void *dst)
+ const void *src,
+ const void *src_end,
+ void *dst)
{
char *s, *d;
if (((char *)src + sizeof(char)) > (char *)src_end)
- return -1;
+ return -1;
s = (char *)src;
d = (char *)dst;
@@ -583,14 +655,14 @@ eet_data_get_char(const Eet_Dictionary *ed __UNUSED__,
static void *
eet_data_put_char(Eet_Dictionary *ed __UNUSED__,
- const void *src,
- int *size_ret)
+ const void *src,
+ int *size_ret)
{
char *s, *d;
d = (char *)malloc(sizeof(char));
if (!d)
- return NULL;
+ return NULL;
s = (char *)src;
*d = *s;
@@ -602,14 +674,14 @@ eet_data_put_char(Eet_Dictionary *ed __UNUSED__,
/* SHORT TYPE */
static int
eet_data_get_short(const Eet_Dictionary *ed __UNUSED__,
- const void *src,
- const void *src_end,
- void *dst)
+ const void *src,
+ const void *src_end,
+ void *dst)
{
short *d;
if (((char *)src + sizeof(short)) > (char *)src_end)
- return -1;
+ return -1;
memcpy(dst, src, sizeof(short));
d = (short *)dst;
@@ -619,14 +691,14 @@ eet_data_get_short(const Eet_Dictionary *ed __UNUSED__,
static void *
eet_data_put_short(Eet_Dictionary *ed __UNUSED__,
- const void *src,
- int *size_ret)
+ const void *src,
+ int *size_ret)
{
short *s, *d;
d = (short *)malloc(sizeof(short));
if (!d)
- return NULL;
+ return NULL;
s = (short *)src;
*d = *s;
@@ -638,14 +710,14 @@ eet_data_put_short(Eet_Dictionary *ed __UNUSED__,
/* INT TYPE */
static inline int
eet_data_get_int(const Eet_Dictionary *ed __UNUSED__,
- const void *src,
- const void *src_end,
- void *dst)
+ const void *src,
+ const void *src_end,
+ void *dst)
{
int *d;
if (((char *)src + sizeof(int)) > (char *)src_end)
- return -1;
+ return -1;
memcpy(dst, src, sizeof(int));
d = (int *)dst;
@@ -655,14 +727,14 @@ eet_data_get_int(const Eet_Dictionary *ed __UNUSED__,
static void *
eet_data_put_int(Eet_Dictionary *ed __UNUSED__,
- const void *src,
- int *size_ret)
+ const void *src,
+ int *size_ret)
{
int *s, *d;
d = (int *)malloc(sizeof(int));
if (!d)
- return NULL;
+ return NULL;
s = (int *)src;
*d = *s;
@@ -674,14 +746,14 @@ eet_data_put_int(Eet_Dictionary *ed __UNUSED__,
/* LONG LONG TYPE */
static int
eet_data_get_long_long(const Eet_Dictionary *ed __UNUSED__,
- const void *src,
- const void *src_end,
- void *dst)
+ const void *src,
+ const void *src_end,
+ void *dst)
{
unsigned long long *d;
if (((char *)src + sizeof(unsigned long long)) > (char *)src_end)
- return -1;
+ return -1;
memcpy(dst, src, sizeof(unsigned long long));
d = (unsigned long long *)dst;
@@ -691,14 +763,14 @@ eet_data_get_long_long(const Eet_Dictionary *ed __UNUSED__,
static void *
eet_data_put_long_long(Eet_Dictionary *ed __UNUSED__,
- const void *src,
- int *size_ret)
+ const void *src,
+ int *size_ret)
{
unsigned long long *s, *d;
d = (unsigned long long *)malloc(sizeof(unsigned long long));
if (!d)
- return NULL;
+ return NULL;
s = (unsigned long long *)src;
*d = *s;
@@ -718,7 +790,7 @@ eet_data_get_string_hash(const Eet_Dictionary *ed,
int idx;
if (eet_data_get_int(ed, src, src_end, &idx) < 0)
- return -1;
+ return -1;
return eet_dictionary_string_get_hash(ed, idx);
}
@@ -742,11 +814,11 @@ eet_data_get_string(const Eet_Dictionary *ed,
int idx;
if (eet_data_get_int(ed, src, src_end, &idx) < 0)
- return -1;
+ return -1;
str = eet_dictionary_string_get_char(ed, idx);
if (!str)
- return -1;
+ return -1;
*d = (char *)str;
return eet_dictionary_string_get_size(ed, idx);
@@ -778,23 +850,23 @@ eet_data_put_string(Eet_Dictionary *ed,
str = *((const char **)src);
if (!str)
- return NULL;
+ return NULL;
idx = eet_dictionary_string_add(ed, str);
if (idx == -1)
- return NULL;
+ return NULL;
return eet_data_put_int(ed, &idx, size_ret);
}
s = (char *)(*((char **)src));
if (!s)
- return NULL;
+ return NULL;
len = strlen(s);
d = malloc(len + 1);
if (!d)
- return NULL;
+ return NULL;
memcpy(d, s, len + 1);
*size_ret = len + 1;
@@ -804,17 +876,17 @@ eet_data_put_string(Eet_Dictionary *ed,
/* ALWAYS INLINED STRING TYPE */
static int
eet_data_get_istring(const Eet_Dictionary *ed __UNUSED__,
- const void *src,
- const void *src_end,
- void *dst)
+ const void *src,
+ const void *src_end,
+ void *dst)
{
return eet_data_get_string(NULL, src, src_end, dst);
} /* eet_data_get_istring */
static void *
eet_data_put_istring(Eet_Dictionary *ed __UNUSED__,
- const void *src,
- int *size_ret)
+ const void *src,
+ int *size_ret)
{
return eet_data_put_string(NULL, src, size_ret);
} /* eet_data_put_istring */
@@ -822,9 +894,9 @@ eet_data_put_istring(Eet_Dictionary *ed __UNUSED__,
/* ALWAYS NULL TYPE */
static int
eet_data_get_null(const Eet_Dictionary *ed __UNUSED__,
- const void *src __UNUSED__,
- const void *src_end __UNUSED__,
- void *dst)
+ const void *src __UNUSED__,
+ const void *src_end __UNUSED__,
+ void *dst)
{
char **d;
@@ -836,8 +908,8 @@ eet_data_get_null(const Eet_Dictionary *ed __UNUSED__,
static void *
eet_data_put_null(Eet_Dictionary *ed __UNUSED__,
- const void *src __UNUSED__,
- int *size_ret)
+ const void *src __UNUSED__,
+ int *size_ret)
{
*size_ret = 0;
return NULL;
@@ -855,20 +927,20 @@ _eet_data_float_cache_get(const char *s,
float *d)
{
/* fast handle of simple case 0xMp+E*/
- if ((len == 6) && (s[0] == '0') && (s[1] == 'x') && (s[3] == 'p'))
- {
- int mantisse = (s[2] >= 'a') ? (s[2] - 'a' + 10) : (s[2] - '0');
- int exponent = (s[5] - '0');
+ if ((len == 6) && (s[0] == '0') && (s[1] == 'x') && (s[3] == 'p'))
+ {
+ int mantisse = (s[2] >= 'a') ? (s[2] - 'a' + 10) : (s[2] - '0');
+ int exponent = (s[5] - '0');
- if (s[4] == '+')
+ if (s[4] == '+')
*d = (float)(mantisse << exponent);
- else
+ else
*d = (float)mantisse / (float)(1 << exponent);
- return 1;
- }
+ return 1;
+ }
- return 0;
+ return 0;
} /* _eet_data_float_cache_get */
static inline int
@@ -877,20 +949,20 @@ _eet_data_double_cache_get(const char *s,
double *d)
{
/* fast handle of simple case 0xMp+E*/
- if ((len == 6) && (s[0] == '0') && (s[1] == 'x') && (s[3] == 'p'))
- {
- int mantisse = (s[2] >= 'a') ? (s[2] - 'a' + 10) : (s[2] - '0');
- int exponent = (s[5] - '0');
+ if ((len == 6) && (s[0] == '0') && (s[1] == 'x') && (s[3] == 'p'))
+ {
+ int mantisse = (s[2] >= 'a') ? (s[2] - 'a' + 10) : (s[2] - '0');
+ int exponent = (s[5] - '0');
- if (s[4] == '+')
+ if (s[4] == '+')
*d = (double)(mantisse << exponent);
- else
+ else
*d = (double)mantisse / (double)(1 << exponent);
- return 1;
- }
+ return 1;
+ }
- return 0;
+ return 0;
} /* _eet_data_double_cache_get */
/* FLOAT TYPE */
@@ -917,10 +989,10 @@ eet_data_get_float(const Eet_Dictionary *ed,
while ((p < (const char *)src_end) && (*p != 0)) {len++; p++; }
if (_eet_data_float_cache_get(s, len, d) != 0)
- return len + 1;
+ return len + 1;
if (eina_convert_atod(s, len, &mantisse, &exponent) == EINA_FALSE)
- return -1;
+ return -1;
*d = (float)ldexp((double)mantisse, exponent);
@@ -928,10 +1000,10 @@ eet_data_get_float(const Eet_Dictionary *ed,
}
if (eet_data_get_int(ed, src, src_end, &idx) < 0)
- return -1;
+ return -1;
if (!eet_dictionary_string_get_float(ed, idx, d))
- return -1;
+ return -1;
return 1;
} /* eet_data_get_float */
@@ -954,7 +1026,7 @@ eet_data_put_float(Eet_Dictionary *ed,
len = strlen(buf);
d = malloc(len + 1);
if (!d)
- return NULL;
+ return NULL;
memcpy(d, buf, len + 1);
*size_ret = len + 1;
@@ -963,7 +1035,7 @@ eet_data_put_float(Eet_Dictionary *ed,
idx = eet_dictionary_string_add(ed, buf);
if (idx == -1)
- return NULL;
+ return NULL;
return eet_data_put_int(ed, &idx, size_ret);
} /* eet_data_put_float */
@@ -993,10 +1065,10 @@ eet_data_get_double(const Eet_Dictionary *ed,
while ((p < (const char *)src_end) && (*p != 0)) {len++; p++; }
if (_eet_data_double_cache_get(s, len, d) != 0)
- return len + 1;
+ return len + 1;
if (eina_convert_atod(s, len, &mantisse, &exponent) == EINA_FALSE)
- return -1;
+ return -1;
*d = ldexp((double)mantisse, exponent);
@@ -1004,10 +1076,10 @@ eet_data_get_double(const Eet_Dictionary *ed,
}
if (eet_data_get_int(ed, src, src_end, &idx) < 0)
- return -1;
+ return -1;
if (!eet_dictionary_string_get_double(ed, idx, d))
- return -1;
+ return -1;
return 1;
} /* eet_data_get_double */
@@ -1030,7 +1102,7 @@ eet_data_put_double(Eet_Dictionary *ed,
len = strlen(buf);
d = malloc(len + 1);
if (!d)
- return NULL;
+ return NULL;
memcpy(d, buf, len + 1);
*size_ret = len + 1;
@@ -1040,7 +1112,7 @@ eet_data_put_double(Eet_Dictionary *ed,
idx = eet_dictionary_string_add(ed, buf);
if (idx == -1)
- return NULL;
+ return NULL;
return eet_data_put_int(ed, &idx, size_ret);
} /* eet_data_put_double */
@@ -1067,16 +1139,16 @@ eet_data_get_f32p32(const Eet_Dictionary *ed,
while ((p < (const char *)src_end) && (*p != 0)) { len++; p++; }
if (!(eina_convert_atofp(s, len, fp)))
- return -1;
+ return -1;
return 1;
}
if (eet_data_get_int(ed, src, src_end, &idx) < 0)
- return -1;
+ return -1;
if (!eet_dictionary_string_get_fp(ed, idx, fp))
- return -1;
+ return -1;
return 1;
} /* eet_data_get_f32p32 */
@@ -1099,7 +1171,7 @@ eet_data_put_f32p32(Eet_Dictionary *ed,
len = strlen(buf);
d = malloc(len + 1);
if (!d)
- return NULL;
+ return NULL;
memcpy(d, buf, len + 1);
*size_ret = len + 1;
@@ -1109,7 +1181,7 @@ eet_data_put_f32p32(Eet_Dictionary *ed,
idx = eet_dictionary_string_add(ed, buf);
if (idx == -1)
- return NULL;
+ return NULL;
return eet_data_put_int(ed, &idx, size_ret);
} /* eet_data_put_f32p32 */
@@ -1126,7 +1198,7 @@ eet_data_get_f16p16(const Eet_Dictionary *ed,
fp = (Eina_F16p16 *)dst;
if (eet_data_get_f32p32(ed, src, src_end, &tmp) < 0)
- return -1;
+ return -1;
*fp = eina_f32p32_to_f16p16(tmp);
return 1;
@@ -1155,7 +1227,7 @@ eet_data_get_f8p24(const Eet_Dictionary *ed,
fp = (Eina_F8p24 *)dst;
if (eet_data_get_f32p32(ed, src, src_end, &tmp) < 0)
- return -1;
+ return -1;
*fp = eina_f32p32_to_f8p24(tmp);
return 1;
@@ -1202,7 +1274,7 @@ eet_data_type_match(int type1,
int type2)
{
if (type1 == type2)
- return EINA_TRUE;
+ return EINA_TRUE;
/* Note: All floating point type are equivalent and could be read
without problem by any other floating point getter. */
@@ -1213,22 +1285,22 @@ eet_data_type_match(int type1,
case EET_T_F32P32:
case EET_T_F16P16:
case EET_T_F8P24:
- switch (type2)
- {
- case EET_T_FLOAT:
- case EET_T_DOUBLE:
- case EET_T_F32P32:
- case EET_T_F16P16:
- case EET_T_F8P24:
- return EINA_TRUE;
-
- default:
- break;
- } /* switch */
- break;
+ switch (type2)
+ {
+ case EET_T_FLOAT:
+ case EET_T_DOUBLE:
+ case EET_T_F32P32:
+ case EET_T_F16P16:
+ case EET_T_F8P24:
+ return EINA_TRUE;
+
+ default:
+ break;
+ } /* switch */
+ break;
default:
- break;
+ break;
} /* switch */
return EINA_FALSE;
@@ -1257,36 +1329,36 @@ eet_data_chunk_get(const Eet_Dictionary *ed,
int ret1, ret2;
if (!src)
- return;
+ return;
if (size <= 8)
- return;
+ return;
if (!chnk)
- return;
+ return;
s = src;
if (s[2] == 'K')
{
if ((s[0] != 'C') || (s[1] != 'H') || (s[2] != 'K'))
- return;
+ return;
chnk->type = (unsigned char)(s[3]);
if (chnk->type >= EET_I_LIMIT)
{
chnk->group_type =
- ((chnk->type - EET_I_LIMIT) & 0xF) + EET_G_UNKNOWN;
+ ((chnk->type - EET_I_LIMIT) & 0xF) + EET_G_UNKNOWN;
switch ((chnk->type - EET_I_LIMIT) & 0xF0)
{
-#define EET_UNMATCH_TYPE(Type)\
- case EET_I_ ## Type: chnk->type = EET_T_ ## Type; break;
+#define EET_UNMATCH_TYPE(Type) \
+case EET_I_ ## Type: chnk->type = EET_T_ ## Type; break;
EET_UNMATCH_TYPE(STRING);
EET_UNMATCH_TYPE(INLINED_STRING);
EET_UNMATCH_TYPE(NULL);
default:
- return;
+ return;
} /* switch */
}
else if (chnk->type > EET_T_LAST)
@@ -1295,7 +1367,7 @@ eet_data_chunk_get(const Eet_Dictionary *ed,
chnk->type = EET_T_UNKNOW;
}
else
- chnk->group_type = EET_G_UNKNOWN;
+ chnk->group_type = EET_G_UNKNOWN;
if ((chnk->type >= EET_T_LAST) ||
(chnk->group_type >=
EET_G_LAST))
@@ -1305,20 +1377,20 @@ eet_data_chunk_get(const Eet_Dictionary *ed,
}
}
else if ((s[0] != 'C') || (s[1] != 'H') || (s[2] != 'n') || (s[3] != 'K'))
- return;
+ return;
ret1 = eet_data_get_type(ed, EET_T_INT, (s + 4), (s + size), &(chnk->size));
if (ret1 <= 0)
- return;
+ return;
if ((chnk->size < 0) || ((chnk->size + 8) > size))
- return;
+ return;
ret2 = eet_data_get_type(ed, EET_T_STRING, (s + 8), (s + size), &(chnk->name));
if (ret2 <= 0)
- return;
+ return;
chnk->len = ret2;
@@ -1349,18 +1421,18 @@ eet_data_chunk_new(void *data,
Eet_Data_Chunk *chnk;
if (!name)
- return NULL;
+ return NULL;
chnk = calloc(1, sizeof(Eet_Data_Chunk));
if (!chnk)
- return NULL;
+ return NULL;
/* Note: Another security, so older eet library could read file
saved with fixed point value. */
if (type == EET_T_F32P32
|| type == EET_T_F16P16
|| type == EET_T_F8P24)
- type = EET_T_DOUBLE;
+ type = EET_T_DOUBLE;
chnk->name = strdup(name);
chnk->len = strlen(name) + 1;
@@ -1375,7 +1447,7 @@ static inline void
eet_data_chunk_free(Eet_Data_Chunk *chnk)
{
if (chnk->name)
- free(chnk->name);
+ free(chnk->name);
free(chnk);
} /* eet_data_chunk_free */
@@ -1387,7 +1459,7 @@ eet_data_stream_new(void)
ds = calloc(1, sizeof(Eet_Data_Stream));
if (!ds)
- return NULL;
+ return NULL;
return ds;
} /* eet_data_stream_new */
@@ -1396,7 +1468,7 @@ static inline void
eet_data_stream_free(Eet_Data_Stream *ds)
{
if (ds->data)
- free(ds->data);
+ free(ds->data);
free(ds);
} /* eet_data_stream_free */
@@ -1459,29 +1531,29 @@ eet_data_chunk_put(Eet_Dictionary *ed,
switch (chnk->type)
{
- /* Only make sense with pointer type. */
-#define EET_MATCH_TYPE(Type)\
- case EET_T_ ## Type: type += EET_I_ ## Type; break;
+ /* Only make sense with pointer type. */
+#define EET_MATCH_TYPE(Type) \
+case EET_T_ ## Type: type += EET_I_ ## Type; break;
- EET_MATCH_TYPE(STRING);
- EET_MATCH_TYPE(INLINED_STRING);
- EET_MATCH_TYPE(NULL);
+ EET_MATCH_TYPE(STRING);
+ EET_MATCH_TYPE(INLINED_STRING);
+ EET_MATCH_TYPE(NULL);
- default:
+ default:
return;
} /* switch */
buf[3] = type;
}
else
- buf[3] = chnk->type;
+ buf[3] = chnk->type;
}
else
- buf[3] = chnk->group_type;
+ buf[3] = chnk->group_type;
string = eet_data_put_string(ed, &chnk->name, &string_ret);
if (!string)
- return;
+ return;
/* size of chunk payload data + name */
s = chnk->size + string_ret;
@@ -1489,19 +1561,19 @@ eet_data_chunk_put(Eet_Dictionary *ed,
/* FIXME: If something goes wrong the resulting file will be corrupted. */
if (!size)
- goto on_error;
+ goto on_error;
- eet_data_stream_write(ds, buf, 4);
+ eet_data_stream_write(ds, buf, 4);
/* write chunk length */
- eet_data_stream_write(ds, size, size_ret);
+ eet_data_stream_write(ds, size, size_ret);
/* write chunk name */
eet_data_stream_write(ds, string, string_ret);
/* write payload */
if (chnk->data)
- eet_data_stream_write(ds, chnk->data, chnk->size);
+ eet_data_stream_write(ds, chnk->data, chnk->size);
free(string);
on_error:
@@ -1517,9 +1589,9 @@ _eet_descriptor_hash_new(Eet_Data_Descriptor *edd)
edd->elements.hash.size = 1 << 6;
edd->elements.hash.buckets = calloc(
- 1,
- sizeof(Eet_Data_Descriptor_Hash) *
- edd->elements.hash.size);
+ 1,
+ sizeof(Eet_Data_Descriptor_Hash) *
+ edd->elements.hash.size);
for (i = 0; i < edd->elements.num; i++)
{
Eet_Data_Element *ede;
@@ -1528,7 +1600,7 @@ _eet_descriptor_hash_new(Eet_Data_Descriptor *edd)
ede = &(edd->elements.set[i]);
hash = _eet_hash_gen((char *)ede->name, 6);
if (!edd->elements.hash.buckets[hash].element)
- edd->elements.hash.buckets[hash].element = ede;
+ edd->elements.hash.buckets[hash].element = ede;
else
{
Eet_Data_Descriptor_Hash *bucket;
@@ -1559,7 +1631,7 @@ _eet_descriptor_hash_free(Eet_Data_Descriptor *edd)
}
}
if (edd->elements.hash.buckets)
- free(edd->elements.hash.buckets);
+ free(edd->elements.hash.buckets);
} /* _eet_descriptor_hash_free */
static Eet_Data_Element *
@@ -1570,19 +1642,19 @@ _eet_descriptor_hash_find(Eet_Data_Descriptor *edd,
Eet_Data_Descriptor_Hash *bucket;
if (hash < 0)
- hash = _eet_hash_gen(name, 6);
+ hash = _eet_hash_gen(name, 6);
else
- hash &= 0x3f;
+ hash &= 0x3f;
if (!edd->elements.hash.buckets[hash].element)
- return NULL; /*
- When we use the dictionary as a source for chunk name, we will always
- have the same pointer in name. It's a good idea to just compare pointer
- instead of running strcmp on both string.
- */
+ return NULL; /*
+ When we use the dictionary as a source for chunk name, we will always
+ have the same pointer in name. It's a good idea to just compare pointer
+ instead of running strcmp on both string.
+ */
if (edd->elements.hash.buckets[hash].element->directory_name_ptr == name)
- return edd->elements.hash.buckets[hash].element;
+ return edd->elements.hash.buckets[hash].element;
if (!strcmp(edd->elements.hash.buckets[hash].element->name, name))
{
@@ -1594,7 +1666,7 @@ _eet_descriptor_hash_find(Eet_Data_Descriptor *edd,
while (bucket)
{
if (bucket->element->directory_name_ptr == name)
- return bucket->element;
+ return bucket->element;
if (!strcmp(bucket->element->name, name))
{
@@ -1637,10 +1709,10 @@ _eet_eina_hash_add_alloc(Eina_Hash *hash,
void *data)
{
if (!hash)
- hash = eina_hash_string_small_new(NULL);
+ hash = eina_hash_string_small_new(NULL);
if (!hash)
- return NULL;
+ return NULL;
eina_hash_add(hash, key, data);
return hash;
@@ -1652,10 +1724,10 @@ _eet_eina_hash_direct_add_alloc(Eina_Hash *hash,
void *data)
{
if (!hash)
- hash = eina_hash_string_small_new(NULL);
+ hash = eina_hash_string_small_new(NULL);
if (!hash)
- return NULL;
+ return NULL;
eina_hash_direct_add(hash, key, data);
return hash;
@@ -1678,26 +1750,26 @@ _eet_eina_hash_foreach(void *hash,
void *fdata)
{
if (hash)
- eina_hash_foreach(hash, cb, fdata);
+ eina_hash_foreach(hash, cb, fdata);
} /* _eet_eina_hash_foreach */
static void
_eet_eina_hash_free(void *hash)
{
if (hash)
- eina_hash_free(hash);
+ eina_hash_free(hash);
} /* _eet_eina_hash_free */
/*---*/
EAPI Eina_Bool
eet_eina_stream_data_descriptor_class_set(Eet_Data_Descriptor_Class *eddc,
- /* When we change the structure content in the future, we need to handle old structure type too */
- unsigned int eddc_size,
+ /* When we change the structure content in the future, we need to handle old structure type too */
+ unsigned int eddc_size,
const char *name,
int size)
{
if (!eddc || !name || eddc_size != sizeof (Eet_Data_Descriptor_Class))
- return EINA_FALSE;
+ return EINA_FALSE;
eddc->name = name;
eddc->size = size;
@@ -1712,7 +1784,7 @@ eet_eina_stream_data_descriptor_class_set(Eet_Data_Descriptor_Class *eddc,
eddc->func.list_data = (void *(*)(void *))eina_list_data_get;
eddc->func.list_free = (void *(*)(void *))eina_list_free;
eddc->func.hash_foreach = (void (*)(void *, int (*)(void *, const char *, void *, void *), void *))_eet_eina_hash_foreach;
- eddc->func.hash_add = (void * (*)(void *, const char *, void *))_eet_eina_hash_add_alloc;
+ eddc->func.hash_add = (void *(*)(void *, const char *, void *))_eet_eina_hash_add_alloc;
eddc->func.hash_free = (void (*)(void *))_eet_eina_hash_free;
/* This will cause an ABI incompatibility */
@@ -1724,17 +1796,17 @@ eet_eina_stream_data_descriptor_class_set(Eet_Data_Descriptor_Class *eddc,
EAPI Eina_Bool
eet_eina_file_data_descriptor_class_set(Eet_Data_Descriptor_Class *eddc,
- /* When we change the structure content in the future, we need to handle old structure type too */
- unsigned int eddc_size,
+ /* When we change the structure content in the future, we need to handle old structure type too */
+ unsigned int eddc_size,
const char *name,
int size)
{
if (!eet_eina_stream_data_descriptor_class_set(eddc, eddc_size, name, size))
- return EINA_FALSE;
+ return EINA_FALSE;
eddc->version = EET_DATA_DESCRIPTOR_CLASS_VERSION;
- eddc->func.hash_add = (void * (*)(void *, const char *, void *))_eet_eina_hash_direct_add_alloc;
+ eddc->func.hash_add = (void *(*)(void *, const char *, void *))_eet_eina_hash_direct_add_alloc;
eddc->func.str_direct_alloc = _eet_str_direct_alloc;
eddc->func.str_direct_free = _eet_str_direct_free;
@@ -1748,11 +1820,11 @@ _eet_data_descriptor_new(const Eet_Data_Descriptor_Class *eddc,
Eet_Data_Descriptor *edd;
if (!eddc)
- return NULL;
+ return NULL;
edd = calloc(1, sizeof (Eet_Data_Descriptor));
if (!edd)
- return NULL;
+ return NULL;
edd->name = eddc->name;
edd->ed = NULL;
@@ -1762,16 +1834,16 @@ _eet_data_descriptor_new(const Eet_Data_Descriptor_Class *eddc,
edd->func.str_alloc = _eet_str_alloc;
edd->func.str_free = _eet_str_free;
if (eddc->func.mem_alloc)
- edd->func.mem_alloc = eddc->func.mem_alloc;
+ edd->func.mem_alloc = eddc->func.mem_alloc;
if (eddc->func.mem_free)
- edd->func.mem_free = eddc->func.mem_free;
+ edd->func.mem_free = eddc->func.mem_free;
if (eddc->func.str_alloc)
- edd->func.str_alloc = eddc->func.str_alloc;
+ edd->func.str_alloc = eddc->func.str_alloc;
if (eddc->func.str_free)
- edd->func.str_free = eddc->func.str_free;
+ edd->func.str_free = eddc->func.str_free;
edd->func.list_next = eddc->func.list_next;
edd->func.list_append = eddc->func.list_append;
@@ -1795,28 +1867,28 @@ _eet_data_descriptor_new(const Eet_Data_Descriptor_Class *eddc,
if (eddc->version > 3)
{
- edd->func.array_alloc = eddc->func.array_alloc;
- edd->func.array_free = eddc->func.array_free;
+ edd->func.array_alloc = eddc->func.array_alloc;
+ edd->func.array_free = eddc->func.array_free;
}
return edd;
} /* _eet_data_descriptor_new */
EAPI Eet_Data_Descriptor *
-eet_data_descriptor_new(const char *name,
- int size,
- Eet_Descriptor_List_Next_Callback func_list_next,
- Eet_Descriptor_List_Append_Callback func_list_append,
- Eet_Descriptor_List_Data_Callback func_list_data,
- Eet_Descriptor_List_Free_Callback func_list_free,
+eet_data_descriptor_new(const char *name,
+ int size,
+ Eet_Descriptor_List_Next_Callback func_list_next,
+ Eet_Descriptor_List_Append_Callback func_list_append,
+ Eet_Descriptor_List_Data_Callback func_list_data,
+ Eet_Descriptor_List_Free_Callback func_list_free,
Eet_Descriptor_Hash_Foreach_Callback func_hash_foreach,
- Eet_Descriptor_Hash_Add_Callback func_hash_add,
- Eet_Descriptor_Hash_Free_Callback func_hash_free)
+ Eet_Descriptor_Hash_Add_Callback func_hash_add,
+ Eet_Descriptor_Hash_Free_Callback func_hash_free)
{
Eet_Data_Descriptor_Class eddc;
if (!name)
- return NULL;
+ return NULL;
memset(&eddc, 0, sizeof (Eet_Data_Descriptor_Class));
@@ -1863,11 +1935,11 @@ EAPI void
eet_data_descriptor_free(Eet_Data_Descriptor *edd)
{
if (!edd)
- return;
+ return;
_eet_descriptor_hash_free(edd);
if (edd->elements.set)
- free(edd->elements.set);
+ free(edd->elements.set);
free(edd);
} /* eet_data_descriptor_free */
@@ -1894,7 +1966,7 @@ eet_data_descriptor_element_add(Eet_Data_Descriptor *edd,
|| !subtype
|| !subtype->func.type_get
|| !subtype->func.type_set))
- return;
+ return;
/* VARIANT type will only work if the map only contains EET_G_*, but not UNION, VARIANT and ARRAY. */
if (group_type == EET_G_VARIANT)
@@ -1902,10 +1974,10 @@ eet_data_descriptor_element_add(Eet_Data_Descriptor *edd,
int i;
for (i = 0; i < subtype->elements.num; ++i)
- if (subtype->elements.set[i].type != EET_T_UNKNOW
- && subtype->elements.set[i].group_type > EET_G_VAR_ARRAY
- && subtype->elements.set[i].group_type < EET_G_UNION)
- return;
+ if (subtype->elements.set[i].type != EET_T_UNKNOW
+ && subtype->elements.set[i].group_type > EET_G_VAR_ARRAY
+ && subtype->elements.set[i].group_type < EET_G_UNION)
+ return;
subtype->unified_type = EINA_TRUE;
}
@@ -1914,13 +1986,13 @@ eet_data_descriptor_element_add(Eet_Data_Descriptor *edd,
&& subtype->unified_type
&& (type != EET_T_UNKNOW
|| group_type < EET_G_UNION))
- return;
+ return;
/* Sanity check done, let allocate ! */
edd->elements.num++;
tmp = realloc(edd->elements.set, edd->elements.num * sizeof(Eet_Data_Element));
if (!tmp)
- return;
+ return;
edd->elements.set = tmp;
ede = &(edd->elements.set[edd->elements.num - 1]);
@@ -1940,7 +2012,7 @@ eet_data_descriptor_element_add(Eet_Data_Descriptor *edd,
{
subtype = calloc(1, sizeof (Eet_Data_Descriptor));
if (!subtype)
- return;
+ return;
subtype->name = "implicit";
subtype->size = eet_basic_codec[type - 1].size;
@@ -1985,14 +2057,14 @@ eet_data_read_cipher(Eet_File *ef,
ed = eet_dictionary_get(ef);
if (!cipher_key)
- data = eet_read_direct(ef, name, &size);
+ data = eet_read_direct(ef, name, &size);
if (!data)
{
required_free = 1;
data = eet_read_cipher(ef, name, &size, cipher_key);
if (!data)
- return NULL;
+ return NULL;
}
eet_free_context_init(&context);
@@ -2000,7 +2072,7 @@ eet_data_read_cipher(Eet_File *ef,
eet_free_context_shutdown(&context);
if (required_free)
- free((void *)data);
+ free((void *)data);
return data_dec;
} /* eet_data_read_cipher */
@@ -2020,14 +2092,14 @@ eet_data_node_read_cipher(Eet_File *ef,
ed = eet_dictionary_get(ef);
if (!cipher_key)
- data = eet_read_direct(ef, name, &size);
+ data = eet_read_direct(ef, name, &size);
if (!data)
{
required_free = 1;
data = eet_read_cipher(ef, name, &size, cipher_key);
if (!data)
- return NULL;
+ return NULL;
}
eet_free_context_init(&context);
@@ -2035,7 +2107,7 @@ eet_data_node_read_cipher(Eet_File *ef,
eet_free_context_shutdown(&context);
if (required_free)
- free((void *)data);
+ free((void *)data);
return result;
} /* eet_data_node_read_cipher */
@@ -2065,7 +2137,7 @@ eet_data_write_cipher(Eet_File *ef,
data_enc = _eet_data_descriptor_encode(ed, edd, data, &size);
if (!data_enc)
- return 0;
+ return 0;
val = eet_write_cipher(ef, name, data_enc, size, compress, cipher_key);
free(data_enc);
@@ -2164,8 +2236,8 @@ _eet_free_add(Eet_Free *ef,
hash = _eet_free_hash(data);
EINA_ARRAY_ITER_NEXT(&ef->list[hash], i, track, it)
- if (track == data)
- return;
+ if (track == data)
+ return;
eina_array_push(&ef->list[hash], data);
} /* _eet_free_add */
@@ -2183,12 +2255,13 @@ _eet_free_del(Eet_Free *ef,
hash = _eet_free_hash(data);
EINA_ARRAY_ITER_NEXT(&ef->list[hash], i, track, it)
- if (track == data)
- {
- eina_array_data_set(&ef->list[hash], i, NULL);
- return;
- }
+ if (track == data)
+ {
+ eina_array_data_set(&ef->list[hash], i, NULL);
+ return;
+ }
}
+
#endif
static void
@@ -2197,7 +2270,7 @@ _eet_free_reset(Eet_Free *ef)
unsigned int i;
if (ef->ref > 0)
- return;
+ return;
for (i = 0; i < EET_FREE_COUNT; ++i)
eina_array_clean(&ef->list[i]);
@@ -2231,17 +2304,17 @@ _eet_freelist_free(Eet_Free_Context *context,
unsigned int i;
if (context->freelist.ref > 0)
- return;
+ return;
for (j = 0; j < EET_FREE_COUNT; ++j)
EINA_ARRAY_ITER_NEXT(&context->freelist.list[j], i, track, it)
- if (track)
- {
- if (edd)
- edd->func.mem_free(track);
- else
- free(track);
- }
+ if (track)
+ {
+ if (edd)
+ edd->func.mem_free(track);
+ else
+ free(track);
+ }
_eet_free_reset(&context->freelist);
} /* _eet_freelist_free */
@@ -2253,7 +2326,7 @@ _eet_freelist_free(Eet_Free_Context *context,
static void
_eet_freelist_array_free(Eet_Free_Context *context,
- Eet_Data_Descriptor *edd)
+ Eet_Data_Descriptor *edd)
{
void *track;
Eina_Array_Iterator it;
@@ -2261,22 +2334,22 @@ _eet_freelist_array_free(Eet_Free_Context *context,
unsigned int i;
if (context->freelist_array.ref > 0)
- return;
+ return;
for (j = 0; j < EET_FREE_COUNT; ++j)
EINA_ARRAY_ITER_NEXT(&context->freelist_array.list[j], i, track, it)
- if (track)
- {
- if (edd)
- {
- if (edd->func.array_free)
- edd->func.array_free(track);
- else
- edd->func.mem_free(track);
- }
- else
- free(track);
- }
+ if (track)
+ {
+ if (edd)
+ {
+ if (edd->func.array_free)
+ edd->func.array_free(track);
+ else
+ edd->func.mem_free(track);
+ }
+ else
+ free(track);
+ }
_eet_free_reset(&context->freelist_array);
} /* _eet_freelist_array_free */
@@ -2296,15 +2369,15 @@ _eet_freelist_list_free(Eet_Free_Context *context,
unsigned int i;
if (context->freelist_list.ref > 0)
- return;
+ return;
for (j = 0; j < EET_FREE_COUNT; ++j)
EINA_ARRAY_ITER_NEXT(&context->freelist_list.list[j], i, track, it)
- if (track)
- {
- if (edd)
- edd->func.list_free(*((void **)(track)));
- }
+ if (track)
+ {
+ if (edd)
+ edd->func.list_free(*((void **)(track)));
+ }
_eet_free_reset(&context->freelist_list);
} /* _eet_freelist_list_free */
@@ -2315,7 +2388,8 @@ _eet_freelist_list_free(Eet_Free_Context *context,
#define _eet_freelist_str_unref(Ctx) _eet_free_unref(&Ctx->freelist_str);
static void
-_eet_freelist_str_free(Eet_Free_Context *context, Eet_Data_Descriptor *edd)
+_eet_freelist_str_free(Eet_Free_Context *context,
+ Eet_Data_Descriptor *edd)
{
void *track;
Eina_Array_Iterator it;
@@ -2323,17 +2397,17 @@ _eet_freelist_str_free(Eet_Free_Context *context, Eet_Data_Descriptor *edd)
unsigned int i;
if (context->freelist_str.ref > 0)
- return;
+ return;
for (j = 0; j < EET_FREE_COUNT; ++j)
EINA_ARRAY_ITER_NEXT(&context->freelist_str.list[j], i, track, it)
- if (track)
- {
- if (edd)
- edd->func.str_free(track);
- else
- free(track);
- }
+ if (track)
+ {
+ if (edd)
+ edd->func.str_free(track);
+ else
+ free(track);
+ }
_eet_free_reset(&context->freelist_str);
} /* _eet_freelist_str_free */
@@ -2353,17 +2427,17 @@ _eet_freelist_direct_str_free(Eet_Free_Context *context,
unsigned int i;
if (context->freelist_direct_str.ref > 0)
- return;
+ return;
for (j = 0; j < EET_FREE_COUNT; ++j)
EINA_ARRAY_ITER_NEXT(&context->freelist_str.list[j], i, track, it)
- if (track)
- {
- if (edd)
- edd->func.str_direct_free(track);
- else
- free(track);
- }
+ if (track)
+ {
+ if (edd)
+ edd->func.str_direct_free(track);
+ else
+ free(track);
+ }
_eet_free_reset(&context->freelist_direct_str);
} /* _eet_freelist_direct_str_free */
@@ -2383,17 +2457,17 @@ _eet_freelist_hash_free(Eet_Free_Context *context,
unsigned int i;
if (context->freelist_hash.ref > 0)
- return;
+ return;
for (j = 0; j < EET_FREE_COUNT; ++j)
EINA_ARRAY_ITER_NEXT(&context->freelist_hash.list[j], i, track, it)
- if (track)
- {
- if (edd)
- edd->func.hash_free(track);
- else
- free(track);
- }
+ if (track)
+ {
+ if (edd)
+ edd->func.hash_free(track);
+ else
+ free(track);
+ }
_eet_free_reset(&context->freelist_hash);
} /* _eet_freelist_hash_free */
@@ -2418,7 +2492,7 @@ _eet_freelist_all_unref(Eet_Free_Context *freelist_context)
} /* _eet_freelist_all_unref */
static int
-eet_data_descriptor_encode_hash_cb(void *hash __UNUSED__,
+eet_data_descriptor_encode_hash_cb(void *hash __UNUSED__,
const char *cipher_key,
void *hdata,
void *fdata)
@@ -2458,14 +2532,14 @@ eet_data_descriptor_encode_hash_cb(void *hash __UNUSED__,
/* Store data */
if (ede->type >= EET_T_STRING)
- eet_data_put_unknown(ed, NULL, ede, ds, &hdata);
+ eet_data_put_unknown(ed, NULL, ede, ds, &hdata);
else
{
if (ede->subtype)
- data = _eet_data_descriptor_encode(ed,
- ede->subtype,
- hdata,
- &size);
+ data = _eet_data_descriptor_encode(ed,
+ ede->subtype,
+ hdata,
+ &size);
if (data)
{
@@ -2494,16 +2568,16 @@ _eet_data_dump_token_get(const char *src,
int in_quote = 0;
int tlen = 0, tsize = 0;
-#define TOK_ADD(x)\
- do {\
- tlen++;\
- if (tlen >= tsize)\
- {\
- tsize += 32;\
- tok = realloc(tok, tsize);\
- }\
- tok[tlen - 1] = x;\
- } while (0)
+#define TOK_ADD(x) \
+ do { \
+ tlen++; \
+ if (tlen >= tsize) \
+ { \
+ tsize += 32; \
+ tok = realloc(tok, tsize); \
+ } \
+ tok[tlen - 1] = x; \
+ } while (0)
for (p = src; *len > 0; p++, (*len)--)
{
@@ -2512,7 +2586,7 @@ _eet_data_dump_token_get(const char *src,
if (in_quote)
{
if ((p[0] == '\"') && (p > src) && (p[-1] != '\\'))
- in_quote = 0;
+ in_quote = 0;
else if ((p[0] == '\\') && (*len > 1) &&
(p[1] == '\"'))
{
@@ -2527,14 +2601,14 @@ _eet_data_dump_token_get(const char *src,
/* skip */
}
else if ((p[0] == 'n') && (p > src) && (p[-1] == '\\'))
- TOK_ADD('\n');
+ TOK_ADD('\n');
else
- TOK_ADD(p[0]);
+ TOK_ADD(p[0]);
}
else
{
if (p[0] == '\"')
- in_quote = 1;
+ in_quote = 1;
else
{
if ((isspace(p[0])) || (p[0] == ';')) /* token ends here */
@@ -2544,7 +2618,7 @@ _eet_data_dump_token_get(const char *src,
return tok;
}
else
- TOK_ADD(p[0]);
+ TOK_ADD(p[0]);
}
}
}
@@ -2562,7 +2636,7 @@ _eet_data_dump_token_get(const char *src,
}
if (tok)
- free(tok);
+ free(tok);
return NULL;
} /* _eet_data_dump_token_get */
@@ -2579,11 +2653,11 @@ eet_data_encode(Eet_Dictionary *ed,
Eet_Data_Chunk *echnk;
if (!data)
- type = EET_T_NULL;
+ type = EET_T_NULL;
if (group_type != EET_G_UNKNOWN)
- if (type >= EET_T_LAST)
- type = EET_T_UNKNOW;
+ if (type >= EET_T_LAST)
+ type = EET_T_UNKNOW;
echnk = eet_data_chunk_new(data, size, name, type, group_type);
eet_data_chunk_put(ed, echnk, ds);
@@ -2611,85 +2685,70 @@ _eet_data_dump_encode(int parent_type,
v = htonl(0x12345678);
if (v == 0x12345678)
- _eet_data_words_bigendian = 1;
+ _eet_data_words_bigendian = 1;
else
- _eet_data_words_bigendian = 0;
+ _eet_data_words_bigendian = 0;
}
if (!node)
- return NULL;
+ return NULL;
ds = eet_data_stream_new();
if (!ds)
- return NULL;
+ return NULL;
switch (node->type)
{
case EET_G_UNKNOWN:
- for (n = node->values; n; n = n->next)
- {
- data = _eet_data_dump_encode(node->type, ed, n, &size);
- if (data)
- {
- eet_data_stream_write(ds, data, size);
- free(data);
- }
- }
- break;
+ for (n = node->values; n; n = n->next)
+ {
+ data = _eet_data_dump_encode(node->type, ed, n, &size);
+ if (data)
+ {
+ eet_data_stream_write(ds, data, size);
+ free(data);
+ }
+ }
+ break;
case EET_G_ARRAY:
case EET_G_VAR_ARRAY:
- for (child_type = EET_T_NULL, n = node->values; n; n = n->next)
- {
- if (n->type != EET_T_NULL)
- {
- child_type = n->type;
- break;
- }
- }
-
- data = eet_data_put_type(ed,
- EET_T_INT,
- &node->count,
- &size);
- eet_data_encode(ed,
- ds,
- data,
- node->name,
- size,
- child_type,
- node->type);
-
- count = node->count;
-
- for (n = node->values; n; n = n->next)
- {
- int pos = ds->pos;
-
- switch (n->type)
- {
- case EET_T_STRING:
- case EET_T_INLINED_STRING:
- data = eet_data_put_type(ed,
- n->type,
- &(n->data.value.str),
- &size);
- if (data)
- eet_data_encode(ed,
- ds,
- data,
- node->name,
- size,
- n->type,
- node->type);
-
- break;
+ for (child_type = EET_T_NULL, n = node->values; n; n = n->next)
+ {
+ if (n->type != EET_T_NULL)
+ {
+ child_type = n->type;
+ break;
+ }
+ }
- case EET_T_NULL:
- continue;
+ data = eet_data_put_type(ed,
+ EET_T_INT,
+ &node->count,
+ &size);
+ eet_data_encode(ed,
+ ds,
+ data,
+ node->name,
+ size,
+ child_type,
+ node->type);
+
+ count = node->count;
+
+ for (n = node->values; n; n = n->next)
+ {
+ int pos = ds->pos;
- default:
- data = _eet_data_dump_encode(n->type, ed, n, &size);
+ switch (n->type)
+ {
+ case EET_T_STRING:
+ case EET_T_INLINED_STRING:
+ data = eet_data_put_type(ed,
+ n->type,
+ &(n->data.value.str),
+ &size);
+ if (data)
eet_data_encode(ed,
ds,
data,
@@ -2697,61 +2756,61 @@ _eet_data_dump_encode(int parent_type,
size,
n->type,
node->type);
- break;
- } /* switch */
- if (ds->pos != pos)
- count--;
- }
- for (; count; count--)
- {
- eet_data_encode(ed,
- ds,
- NULL,
- node->name,
- 0,
- EET_T_NULL,
- node->type);
- }
+ break;
- /* Array is somekind of special case, so we should embed it inside another chunk. */
- *size_ret = ds->pos;
- cdata = ds->data;
+ case EET_T_NULL:
+ continue;
- ds->data = NULL;
- ds->size = 0;
- eet_data_stream_free(ds);
+ default:
+ data = _eet_data_dump_encode(n->type, ed, n, &size);
+ eet_data_encode(ed,
+ ds,
+ data,
+ node->name,
+ size,
+ n->type,
+ node->type);
+ break;
+ } /* switch */
+ if (ds->pos != pos)
+ count--;
+ }
- return cdata;
- break;
+ for (; count; count--)
+ {
+ eet_data_encode(ed,
+ ds,
+ NULL,
+ node->name,
+ 0,
+ EET_T_NULL,
+ node->type);
+ }
- case EET_G_LIST:
- for (n = node->values; n; n = n->next)
- {
- switch (n->type)
- {
- case EET_T_STRING:
- case EET_T_INLINED_STRING:
- data = eet_data_put_type(ed,
- n->type,
- &(n->data.value.str),
- &size);
- if (data)
- eet_data_encode(ed,
- ds,
- data,
- node->name,
- size,
- n->type,
- node->type);
+ /* Array is somekind of special case, so we should embed it inside another chunk. */
+ *size_ret = ds->pos;
+ cdata = ds->data;
- break;
+ ds->data = NULL;
+ ds->size = 0;
+ eet_data_stream_free(ds);
- case EET_T_NULL:
- continue;
+ return cdata;
+ break;
- default:
- data = _eet_data_dump_encode(node->type, ed, n, &size);
+ case EET_G_LIST:
+ for (n = node->values; n; n = n->next)
+ {
+ switch (n->type)
+ {
+ case EET_T_STRING:
+ case EET_T_INLINED_STRING:
+ data = eet_data_put_type(ed,
+ n->type,
+ &(n->data.value.str),
+ &size);
+ if (data)
eet_data_encode(ed,
ds,
data,
@@ -2759,65 +2818,65 @@ _eet_data_dump_encode(int parent_type,
size,
n->type,
node->type);
- } /* switch */
- }
- /* List is another somekind of special case, every chunk is embed inside a list chunk. */
- *size_ret = ds->pos;
- cdata = ds->data;
+ break;
- ds->data = NULL;
- ds->size = 0;
- eet_data_stream_free(ds);
+ case EET_T_NULL:
+ continue;
- return cdata;
- break;
+ default:
+ data = _eet_data_dump_encode(node->type, ed, n, &size);
+ eet_data_encode(ed,
+ ds,
+ data,
+ node->name,
+ size,
+ n->type,
+ node->type);
+ } /* switch */
+ }
- case EET_G_HASH:
- if (node->key)
- {
- data = eet_data_put_type(ed,
- EET_T_STRING,
- &node->key,
- &size);
- eet_data_encode(ed,
- ds,
- data,
- node->name,
- size,
- node->type,
- node->type);
- }
- else
- /* A Hash without key will not decode correctly. */
- return NULL;
-
- for (n = node->values; n; n = n->next)
- {
- switch (n->type)
- {
- case EET_T_STRING:
- case EET_T_INLINED_STRING:
- data = eet_data_put_type(ed,
- n->type,
- &(n->data.value.str),
- &size);
- if (data)
- eet_data_encode(ed,
- ds,
- data,
- node->name,
- size,
- n->type,
- node->type);
+ /* List is another somekind of special case, every chunk is embed inside a list chunk. */
+ *size_ret = ds->pos;
+ cdata = ds->data;
- break;
+ ds->data = NULL;
+ ds->size = 0;
+ eet_data_stream_free(ds);
- case EET_T_NULL:
- continue;
+ return cdata;
+ break;
- default:
- data = _eet_data_dump_encode(node->type, ed, n, &size);
+ case EET_G_HASH:
+ if (node->key)
+ {
+ data = eet_data_put_type(ed,
+ EET_T_STRING,
+ &node->key,
+ &size);
+ eet_data_encode(ed,
+ ds,
+ data,
+ node->name,
+ size,
+ node->type,
+ node->type);
+ }
+ else
+ /* A Hash without key will not decode correctly. */
+ return NULL;
+
+ for (n = node->values; n; n = n->next)
+ {
+ switch (n->type)
+ {
+ case EET_T_STRING:
+ case EET_T_INLINED_STRING:
+ data = eet_data_put_type(ed,
+ n->type,
+ &(n->data.value.str),
+ &size);
+ if (data)
eet_data_encode(ed,
ds,
data,
@@ -2825,68 +2884,83 @@ _eet_data_dump_encode(int parent_type,
size,
n->type,
node->type);
- } /* switch */
- }
- /* Hash is somekind of special case, so we should embed it inside another chunk. */
- *size_ret = ds->pos;
- cdata = ds->data;
+ break;
+
+ case EET_T_NULL:
+ continue;
+
+ default:
+ data = _eet_data_dump_encode(node->type, ed, n, &size);
+ eet_data_encode(ed,
+ ds,
+ data,
+ node->name,
+ size,
+ n->type,
+ node->type);
+ } /* switch */
+ }
+
+ /* Hash is somekind of special case, so we should embed it inside another chunk. */
+ *size_ret = ds->pos;
+ cdata = ds->data;
- eet_data_stream_flush(ds);
+ eet_data_stream_flush(ds);
- return cdata;
+ return cdata;
case EET_T_NULL:
- break;
-
-#define EET_DATA_NODE_ENCODE(Eet_Type, Type)\
- case Eet_Type:\
- data = eet_data_put_type(ed, node->type, &(node->data.value.Type), &size);\
- if (data)\
- {\
- eet_data_encode(ed,\
- ds,\
- data,\
- node->name,\
- size,\
- node->type,\
- parent_type);\
- cdata = ds->data;\
- *size_ret = ds->pos;\
- eet_data_stream_flush(ds);\
- return cdata;\
- } /* switch */\
- break;
-
- EET_DATA_NODE_ENCODE(EET_T_CHAR, c);
- EET_DATA_NODE_ENCODE(EET_T_SHORT, s);
- EET_DATA_NODE_ENCODE(EET_T_INT, i);
- EET_DATA_NODE_ENCODE(EET_T_LONG_LONG, l);
- EET_DATA_NODE_ENCODE(EET_T_FLOAT, f);
- EET_DATA_NODE_ENCODE(EET_T_DOUBLE, d);
- EET_DATA_NODE_ENCODE(EET_T_UCHAR, uc);
- EET_DATA_NODE_ENCODE(EET_T_USHORT, us);
- EET_DATA_NODE_ENCODE(EET_T_UINT, ui);
- EET_DATA_NODE_ENCODE(EET_T_ULONG_LONG, ul);
- EET_DATA_NODE_ENCODE(EET_T_INLINED_STRING, str);
- EET_DATA_NODE_ENCODE(EET_T_STRING, str);
+ break;
+
+#define EET_DATA_NODE_ENCODE(Eet_Type, Type) \
+case Eet_Type: \
+ data = eet_data_put_type(ed, node->type, &(node->data.value.Type), &size); \
+ if (data) \
+ { \
+ eet_data_encode(ed, \
+ ds, \
+ data, \
+ node->name, \
+ size, \
+ node->type, \
+ parent_type); \
+ cdata = ds->data; \
+ *size_ret = ds->pos; \
+ eet_data_stream_flush(ds); \
+ return cdata; \
+ } /* switch */ \
+ break;
+
+ EET_DATA_NODE_ENCODE(EET_T_CHAR, c);
+ EET_DATA_NODE_ENCODE(EET_T_SHORT, s);
+ EET_DATA_NODE_ENCODE(EET_T_INT, i);
+ EET_DATA_NODE_ENCODE(EET_T_LONG_LONG, l);
+ EET_DATA_NODE_ENCODE(EET_T_FLOAT, f);
+ EET_DATA_NODE_ENCODE(EET_T_DOUBLE, d);
+ EET_DATA_NODE_ENCODE(EET_T_UCHAR, uc);
+ EET_DATA_NODE_ENCODE(EET_T_USHORT, us);
+ EET_DATA_NODE_ENCODE(EET_T_UINT, ui);
+ EET_DATA_NODE_ENCODE(EET_T_ULONG_LONG, ul);
+ EET_DATA_NODE_ENCODE(EET_T_INLINED_STRING, str);
+ EET_DATA_NODE_ENCODE(EET_T_STRING, str);
default:
- break;
+ break;
}
if ((node->type >= EET_G_UNKNOWN) && (node->type < EET_G_LAST))
- chnk = eet_data_chunk_new(ds->data,
- ds->pos,
- node->name,
- EET_T_UNKNOW,
- node->type);
+ chnk = eet_data_chunk_new(ds->data,
+ ds->pos,
+ node->name,
+ EET_T_UNKNOW,
+ node->type);
else
- chnk = eet_data_chunk_new(ds->data,
- ds->pos,
- node->name,
- node->type,
- EET_G_UNKNOWN);
+ chnk = eet_data_chunk_new(ds->data,
+ ds->pos,
+ node->name,
+ node->type,
+ EET_G_UNKNOWN);
eet_data_stream_flush(ds);
@@ -2921,8 +2995,8 @@ _eet_data_dump_parse(Eet_Dictionary *ed,
Eet_Node *n = NULL, *nn = NULL;
/* FIXME; handle parse errors */
-#define TOK_GET(t)\
- jump = left; t = _eet_data_dump_token_get(p, &left); p += jump - left;
+#define TOK_GET(t) \
+ jump = left; t = _eet_data_dump_token_get(p, &left); p += jump - left;
left = size;
for (p = src; p < (src + size); )
{
@@ -2945,48 +3019,48 @@ _eet_data_dump_parse(Eet_Dictionary *ed,
if (!strcmp(tok4, "{"))
{
/* we have 'group NAM TYP {' */
- n = eet_node_new();
- if (n)
- {
- n->parent = node;
- if (!node_base)
+ n = eet_node_new();
+ if (n)
+ {
+ n->parent = node;
+ if (!node_base)
node_base = n;
- if (node)
- {
+ if (node)
+ {
/* append node */
- if (!node->values)
- node->values = n;
- else
- for (nn = node->values; nn;
- nn = nn->next)
- {
- if (!nn->next)
- {
- nn->next = n;
- break;
- }
- }
- }
-
- n->name = eina_stringshare_add(tok2);
- if (!strcmp(tok3, "struct"))
+ if (!node->values)
+ node->values = n;
+ else
+ for (nn = node->values; nn;
+ nn = nn->next)
+ {
+ if (!nn->next)
+ {
+ nn->next = n;
+ break;
+ }
+ }
+ }
+
+ n->name = eina_stringshare_add(tok2);
+ if (!strcmp(tok3, "struct"))
n->type = EET_G_UNKNOWN;
- else if (!strcmp(tok3, "array"))
+ else if (!strcmp(tok3, "array"))
n->type = EET_G_ARRAY;
- else if (!strcmp(tok3, "var_array"))
+ else if (!strcmp(tok3, "var_array"))
n->type = EET_G_VAR_ARRAY;
- else if (!strcmp(tok3, "list"))
+ else if (!strcmp(tok3, "list"))
n->type = EET_G_LIST;
- else if (!strcmp(tok3, "hash"))
+ else if (!strcmp(tok3, "hash"))
n->type = EET_G_HASH;
- else
+ else
ERR(
- "ERROR: group type '%s' invalid.",
- tok3);
+ "ERROR: group type '%s' invalid.",
+ tok3);
- node = n;
- }
+ node = n;
+ }
}
free(tok4);
@@ -3010,16 +3084,16 @@ _eet_data_dump_parse(Eet_Dictionary *ed,
if (tok4)
{
/* we have 'value NAME TYP XXX' */
- if (node_base)
- {
- n = eet_node_new();
- if (n)
- {
- n->parent = node;
+ if (node_base)
+ {
+ n = eet_node_new();
+ if (n)
+ {
+ n->parent = node;
/* append node */
- if (!node->values)
+ if (!node->values)
node->values = n;
- else
+ else
for (nn = node->values; nn;
nn = nn->next)
{
@@ -3030,92 +3104,92 @@ _eet_data_dump_parse(Eet_Dictionary *ed,
}
}
- n->name = eina_stringshare_add(tok2);
- if (!strcmp(tok3, "char:"))
- {
- n->type = EET_T_CHAR;
- sscanf(tok4, FMT_CHAR,
- &(n->data.value.c));
- }
- else if (!strcmp(tok3, "short:"))
- {
- n->type = EET_T_SHORT;
- sscanf(tok4, "%hi",
- &(n->data.value.s));
- }
- else if (!strcmp(tok3, "int:"))
- {
- n->type = EET_T_INT;
- sscanf(tok4, "%i",
- &(n->data.value.i));
- }
- else if (!strcmp(tok3, "long_long:"))
- {
- n->type = EET_T_LONG_LONG;
- sscanf(tok4, FMT_LONG_LONG,
- &(n->data.value.l));
- }
- else if (!strcmp(tok3, "float:"))
- {
- n->type = EET_T_FLOAT;
- sscanf(tok4, "%f",
- &(n->data.value.f));
- }
- else if (!strcmp(tok3, "double:"))
- {
- n->type = EET_T_DOUBLE;
- sscanf(tok4, "%lf",
- &(n->data.value.d));
- }
- else if (!strcmp(tok3, "uchar:"))
- {
- n->type = EET_T_UCHAR;
- sscanf(tok4, FMT_UCHAR,
- &(n->data.value.uc));
- }
- else if (!strcmp(tok3, "ushort:"))
- {
- n->type = EET_T_USHORT;
- sscanf(tok4, "%hu",
- &(n->data.value.us));
- }
- else if (!strcmp(tok3, "uint:"))
- {
- n->type = EET_T_UINT;
- sscanf(tok4, "%u",
- &(n->data.value.ui));
- }
- else if (!strcmp(tok3, "ulong_long:"))
- {
- n->type = EET_T_ULONG_LONG;
- sscanf(tok4, FMT_ULONG_LONG,
- &(n->data.value.ul));
- }
- else if (!strcmp(tok3, "string:"))
- {
- n->type = EET_T_STRING;
- n->data.value.str =
+ n->name = eina_stringshare_add(tok2);
+ if (!strcmp(tok3, "char:"))
+ {
+ n->type = EET_T_CHAR;
+ sscanf(tok4, FMT_CHAR,
+ &(n->data.value.c));
+ }
+ else if (!strcmp(tok3, "short:"))
+ {
+ n->type = EET_T_SHORT;
+ sscanf(tok4, "%hi",
+ &(n->data.value.s));
+ }
+ else if (!strcmp(tok3, "int:"))
+ {
+ n->type = EET_T_INT;
+ sscanf(tok4, "%i",
+ &(n->data.value.i));
+ }
+ else if (!strcmp(tok3, "long_long:"))
+ {
+ n->type = EET_T_LONG_LONG;
+ sscanf(tok4, FMT_LONG_LONG,
+ &(n->data.value.l));
+ }
+ else if (!strcmp(tok3, "float:"))
+ {
+ n->type = EET_T_FLOAT;
+ sscanf(tok4, "%f",
+ &(n->data.value.f));
+ }
+ else if (!strcmp(tok3, "double:"))
+ {
+ n->type = EET_T_DOUBLE;
+ sscanf(tok4, "%lf",
+ &(n->data.value.d));
+ }
+ else if (!strcmp(tok3, "uchar:"))
+ {
+ n->type = EET_T_UCHAR;
+ sscanf(tok4, FMT_UCHAR,
+ &(n->data.value.uc));
+ }
+ else if (!strcmp(tok3, "ushort:"))
+ {
+ n->type = EET_T_USHORT;
+ sscanf(tok4, "%hu",
+ &(n->data.value.us));
+ }
+ else if (!strcmp(tok3, "uint:"))
+ {
+ n->type = EET_T_UINT;
+ sscanf(tok4, "%u",
+ &(n->data.value.ui));
+ }
+ else if (!strcmp(tok3, "ulong_long:"))
+ {
+ n->type = EET_T_ULONG_LONG;
+ sscanf(tok4, FMT_ULONG_LONG,
+ &(n->data.value.ul));
+ }
+ else if (!strcmp(tok3, "string:"))
+ {
+ n->type = EET_T_STRING;
+ n->data.value.str =
eina_stringshare_add(tok4);
- }
- else if (!strcmp(tok3, "inlined:"))
- {
- n->type = EET_T_INLINED_STRING;
- n->data.value.str =
+ }
+ else if (!strcmp(tok3, "inlined:"))
+ {
+ n->type = EET_T_INLINED_STRING;
+ n->data.value.str =
eina_stringshare_add(tok4);
- }
- else if (!strcmp(tok3, "null"))
- {
- n->type = EET_T_NULL;
- n->data.value.str = NULL;
- }
- else
+ }
+ else if (!strcmp(tok3, "null"))
+ {
+ n->type = EET_T_NULL;
+ n->data.value.str = NULL;
+ }
+ else
ERR(
- "ERROR: value type '%s' invalid.",
- tok4);
- }
- }
+ "ERROR: value type '%s' invalid.",
+ tok4);
+ }
+ }
- free(tok4);
+ free(tok4);
}
free(tok3);
@@ -3130,10 +3204,10 @@ _eet_data_dump_parse(Eet_Dictionary *ed,
if (tok2)
{
/* we have 'key NAME' */
- if (node)
+ if (node)
node->key = eina_stringshare_add(tok2);
- free(tok2);
+ free(tok2);
}
}
else if (!strcmp(tok1, "count"))
@@ -3142,16 +3216,16 @@ _eet_data_dump_parse(Eet_Dictionary *ed,
if (tok2)
{
/* we have a 'count COUNT' */
- if (node)
+ if (node)
sscanf(tok2, "%i", &(node->count));
- free(tok2);
+ free(tok2);
}
}
else if (!strcmp(tok1, "}"))
- /* we have an end of the group */
- if (node)
- node = node->parent;
+ /* we have an end of the group */
+ if (node)
+ node = node->parent;
free(tok1);
}
@@ -3166,13 +3240,13 @@ _eet_data_dump_parse(Eet_Dictionary *ed,
return cdata;
} /* _eet_data_dump_parse */
-#define NEXT_CHUNK(P, Size, Echnk, Ed)\
- {\
- int __tmp;\
- __tmp = Ed ? (int)(sizeof(int) * 2) : Echnk.len + 4;\
- P += (4 + Echnk.size + __tmp);\
- Size -= (4 + Echnk.size + __tmp);\
- }
+#define NEXT_CHUNK(P, Size, Echnk, Ed) \
+ { \
+ int __tmp; \
+ __tmp = Ed ? (int)(sizeof(int) * 2) : Echnk.len + 4; \
+ P += (4 + Echnk.size + __tmp); \
+ Size -= (4 + Echnk.size + __tmp); \
+ }
static void *
_eet_data_descriptor_decode(Eet_Free_Context *context,
@@ -3195,9 +3269,9 @@ _eet_data_descriptor_decode(Eet_Free_Context *context,
v = htonl(0x12345678);
if (v == 0x12345678)
- _eet_data_words_bigendian = 1;
+ _eet_data_words_bigendian = 1;
else
- _eet_data_words_bigendian = 0;
+ _eet_data_words_bigendian = 0;
}
if (edd)
@@ -3213,63 +3287,63 @@ _eet_data_descriptor_decode(Eet_Free_Context *context,
}
if (!data)
- return NULL;
+ return NULL;
if (edd->ed != ed)
{
for (i = 0; i < edd->elements.num; i++)
- edd->elements.set[i].directory_name_ptr = NULL;
+ edd->elements.set[i].directory_name_ptr = NULL;
edd->ed = ed;
}
}
_eet_freelist_all_ref(context);
if (data && !data_out)
- _eet_freelist_add(context, data);
+ _eet_freelist_add(context, data);
memset(&chnk, 0, sizeof(Eet_Data_Chunk));
eet_data_chunk_get(ed, &chnk, data_in, size_in);
if (!chnk.name)
- goto error;
+ goto error;
if (edd)
- if (strcmp(chnk.name, edd->name))
- goto error;
+ if (strcmp(chnk.name, edd->name))
+ goto error;
p = chnk.data;
if (ed)
- size = size_in - (4 + sizeof(int) * 2);
+ size = size_in - (4 + sizeof(int) * 2);
else
- size = size_in - (4 + 4 + chnk.len);
+ size = size_in - (4 + 4 + chnk.len);
if (edd)
{
if (!edd->elements.hash.buckets)
- _eet_descriptor_hash_new(edd);
+ _eet_descriptor_hash_new(edd);
}
else
{
switch (chnk.group_type)
{
case EET_G_UNKNOWN:
- switch (chnk.type)
- {
- case EET_T_STRING:
- return eet_node_string_new(chnk.name, chnk.data);
+ switch (chnk.type)
+ {
+ case EET_T_STRING:
+ return eet_node_string_new(chnk.name, chnk.data);
- case EET_T_INLINED_STRING:
- return eet_node_inlined_string_new(chnk.name, chnk.data);
+ case EET_T_INLINED_STRING:
+ return eet_node_inlined_string_new(chnk.name, chnk.data);
- case EET_T_NULL:
- return eet_node_null_new(chnk.name);
+ case EET_T_NULL:
+ return eet_node_null_new(chnk.name);
- default:
- result = eet_node_struct_new(chnk.name, NULL);
- } /* switch */
- break;
+ default:
+ result = eet_node_struct_new(chnk.name, NULL);
+ } /* switch */
+ break;
case EET_G_VAR_ARRAY:
- return eet_node_var_array_new(chnk.name, NULL);
+ return eet_node_var_array_new(chnk.name, NULL);
case EET_G_LIST:
case EET_G_HASH:
@@ -3277,7 +3351,7 @@ _eet_data_descriptor_decode(Eet_Free_Context *context,
case EET_G_UNION:
case EET_G_VARIANT:
default:
- goto error;
+ goto error;
} /* switch */
}
@@ -3293,7 +3367,7 @@ _eet_data_descriptor_decode(Eet_Free_Context *context,
memset(&echnk, 0, sizeof(Eet_Data_Chunk));
eet_data_chunk_get(ed, &echnk, p, size);
if (!echnk.name)
- goto error; /* FIXME: don't REPLY on edd - work without */
+ goto error; /* FIXME: don't REPLY on edd - work without */
if (edd)
{
@@ -3312,11 +3386,11 @@ _eet_data_descriptor_decode(Eet_Free_Context *context,
if (IS_SIMPLE_TYPE(echnk.type) &&
eet_data_type_match(echnk.type, ede->type))
/* Needed when converting on the fly from FP to Float */
- type = ede->type;
+ type = ede->type;
else if ((echnk.group_type > EET_G_UNKNOWN) &&
(echnk.group_type < EET_G_LAST) &&
(echnk.group_type == ede->group_type))
- group_type = echnk.group_type;
+ group_type = echnk.group_type;
}
}
}
@@ -3337,7 +3411,7 @@ _eet_data_descriptor_decode(Eet_Free_Context *context,
((char *)echnk.data) + echnk.size,
dd);
if (ret <= 0)
- goto error;
+ goto error;
child = eet_data_node_simple_type(type, echnk.name, dd);
@@ -3346,19 +3420,19 @@ _eet_data_descriptor_decode(Eet_Free_Context *context,
else
{
ret = eet_group_codec[group_type - 100].get(
- context,
- ed,
- edd,
- ede,
- &echnk,
- type,
- group_type,
- ede ? (void *)(((char*) data) + ede->offset) : (void **)&result,
- &p,
- &size);
+ context,
+ ed,
+ edd,
+ ede,
+ &echnk,
+ type,
+ group_type,
+ ede ? (void *)(((char *)data) + ede->offset) : (void **)&result,
+ &p,
+ &size);
if (ret <= 0)
- goto error;
+ goto error;
}
/* advance to next chunk */
@@ -3372,7 +3446,7 @@ _eet_data_descriptor_decode(Eet_Free_Context *context,
_eet_freelist_direct_str_free(context, edd);
_eet_freelist_list_free(context, edd);
_eet_freelist_hash_free(context, edd);
- _eet_freelist_array_free(context, edd);
+ _eet_freelist_array_free(context, edd);
_eet_freelist_free(context, edd);
}
else
@@ -3382,11 +3456,11 @@ _eet_data_descriptor_decode(Eet_Free_Context *context,
_eet_freelist_list_reset(context);
_eet_freelist_hash_reset(context);
_eet_freelist_direct_str_reset(context);
- _eet_freelist_array_reset(context);
+ _eet_freelist_array_reset(context);
}
if (!edd)
- return result;
+ return result;
return data;
@@ -3412,7 +3486,7 @@ eet_data_get_list(Eet_Free_Context *context,
Eet_Data_Element *ede,
Eet_Data_Chunk *echnk,
int type,
- int group_type __UNUSED__,
+ int group_type __UNUSED__,
void *data,
char **p,
int *size)
@@ -3429,7 +3503,7 @@ eet_data_get_list(Eet_Free_Context *context,
subtype = ede->subtype;
if (type != ede->type)
- return 0;
+ return 0;
}
ptr = (void **)data;
@@ -3437,25 +3511,25 @@ eet_data_get_list(Eet_Free_Context *context,
data_ret = NULL;
if (IS_POINTER_TYPE(type))
- POINTER_TYPE_DECODE(context,
- ed,
- edd,
- ede,
- echnk,
- type,
- &data_ret,
- p,
- size,
- on_error);
- else
- STRUCT_TYPE_DECODE(data_ret,
- context,
+ POINTER_TYPE_DECODE(context,
ed,
- subtype,
- echnk->data,
- echnk->size,
- -1,
+ edd,
+ ede,
+ echnk,
+ type,
+ &data_ret,
+ p,
+ size,
on_error);
+ else
+ STRUCT_TYPE_DECODE(data_ret,
+ context,
+ ed,
+ subtype,
+ echnk->data,
+ echnk->size,
+ -1,
+ on_error);
if (edd)
{
@@ -3464,7 +3538,7 @@ eet_data_get_list(Eet_Free_Context *context,
_eet_freelist_list_add(context, ptr);
}
else
- eet_node_list_append(*((Eet_Node **)data), echnk->name, data_ret);
+ eet_node_list_append(*((Eet_Node **)data), echnk->name, data_ret);
return 1;
@@ -3479,7 +3553,7 @@ eet_data_get_hash(Eet_Free_Context *context,
Eet_Data_Element *ede,
Eet_Data_Chunk *echnk,
int type,
- int group_type __UNUSED__,
+ int group_type __UNUSED__,
void *data,
char **p,
int *size)
@@ -3502,10 +3576,10 @@ eet_data_get_hash(Eet_Free_Context *context,
((char *)echnk->data) + echnk->size,
&key);
if (ret <= 0)
- goto on_error;
+ goto on_error;
if (!key)
- goto on_error;
+ goto on_error;
/* Advance to next chunk */
NEXT_CHUNK((*p), (*size), (*echnk), ed);
@@ -3514,33 +3588,33 @@ eet_data_get_hash(Eet_Free_Context *context,
/* Read value */
eet_data_chunk_get(ed, echnk, *p, *size);
if (!echnk->name)
- goto on_error;
+ goto on_error;
if (ede)
if ((ede->group_type != echnk->group_type)
- || (ede->type != echnk->type))
+ || (ede->type != echnk->type))
goto on_error;
if (IS_POINTER_TYPE(echnk->type))
- POINTER_TYPE_DECODE(context,
- ed,
- edd,
- ede,
- echnk,
- echnk->type,
- &data_ret,
- p,
- size,
- on_error);
- else
- STRUCT_TYPE_DECODE(data_ret,
- context,
+ POINTER_TYPE_DECODE(context,
ed,
- ede ? ede->subtype : NULL,
- echnk->data,
- echnk->size,
- -1,
+ edd,
+ ede,
+ echnk,
+ echnk->type,
+ &data_ret,
+ p,
+ size,
on_error);
+ else
+ STRUCT_TYPE_DECODE(data_ret,
+ context,
+ ed,
+ ede ? ede->subtype : NULL,
+ echnk->data,
+ echnk->size,
+ -1,
+ on_error);
if (edd)
{
@@ -3549,7 +3623,7 @@ eet_data_get_hash(Eet_Free_Context *context,
_eet_freelist_hash_add(context, hash);
}
else
- eet_node_hash_add(*((Eet_Node **)data), echnk->name, key, data_ret);
+ eet_node_hash_add(*((Eet_Node **)data), echnk->name, key, data_ret);
return 1;
@@ -3598,34 +3672,34 @@ eet_data_get_array(Eet_Free_Context *context,
((char *)echnk->data) + echnk->size,
&count);
if (ret <= 0)
- return ret;
+ return ret;
name = echnk->name;
if (ede)
{
if (IS_POINTER_TYPE(type))
- subsize = eet_basic_codec[ede->type].size;
+ subsize = eet_basic_codec[ede->type].size;
else
- subsize = ede->subtype->size;
+ subsize = ede->subtype->size;
if (group_type == EET_G_VAR_ARRAY)
{
/* store the number of elements
* on the counter offset */
- *(int *)(((char *)data) + ede->count - ede->offset) = count;
- /* allocate space for the array of elements */
- if (edd->func.array_alloc)
- *(void **) ptr = edd->func.array_alloc(count * subsize);
- else
- *(void **) ptr = edd->func.mem_alloc(count * subsize);
+ *(int *)(((char *)data) + ede->count - ede->offset) = count;
+ /* allocate space for the array of elements */
+ if (edd->func.array_alloc)
+ *(void **)ptr = edd->func.array_alloc(count * subsize);
+ else
+ *(void **)ptr = edd->func.mem_alloc(count * subsize);
- if (!*(void **)ptr)
- return 0;
+ if (!*(void **)ptr)
+ return 0;
- memset(*(void **)ptr, 0, count * subsize);
+ memset(*(void **)ptr, 0, count * subsize);
- _eet_freelist_array_add(context, *(void **)ptr);
+ _eet_freelist_array_add(context, *(void **)ptr);
}
}
@@ -3640,24 +3714,24 @@ eet_data_get_array(Eet_Free_Context *context,
eet_data_chunk_get(ed, echnk, *p, *size);
if (!echnk->name || strcmp(echnk->name, name) != 0)
- goto on_error; /* get the data */
+ goto on_error; /* get the data */
if ((echnk->group_type != group_type)
|| ((echnk->type != type) && (echnk->type != EET_T_NULL)))
- goto on_error;
+ goto on_error;
if (ede)
- if ((ede->group_type != echnk->group_type)
- || ((echnk->type != ede->type) && (echnk->type != EET_T_NULL)))
- goto on_error;
+ if ((ede->group_type != echnk->group_type)
+ || ((echnk->type != ede->type) && (echnk->type != EET_T_NULL)))
+ goto on_error;
/* get the destination pointer */
if (ede)
{
if (group_type == EET_G_ARRAY)
- dst = (char *)ptr + (subsize * i);
+ dst = (char *)ptr + (subsize * i);
else
- dst = *(char **)ptr + (subsize * i);
+ dst = *(char **)ptr + (subsize * i);
}
if (IS_POINTER_TYPE(echnk->type))
@@ -3675,10 +3749,10 @@ eet_data_get_array(Eet_Free_Context *context,
size,
on_error);
if (dst)
- memcpy(dst, &data_ret, subsize);
+ memcpy(dst, &data_ret, subsize);
if (!edd)
- childs = eina_list_append(childs, data_ret);
+ childs = eina_list_append(childs, data_ret);
}
else
{
@@ -3692,7 +3766,7 @@ eet_data_get_array(Eet_Free_Context *context,
on_error);
if (!edd)
- childs = eina_list_append(childs, dst);
+ childs = eina_list_append(childs, dst);
}
}
@@ -3702,12 +3776,12 @@ eet_data_get_array(Eet_Free_Context *context,
Eet_Node *array;
if (group_type == EET_G_ARRAY)
- array = eet_node_array_new(name, count, childs);
+ array = eet_node_array_new(name, count, childs);
else
- array = eet_node_var_array_new(name, childs);
+ array = eet_node_var_array_new(name, childs);
if (!array)
- goto on_error;
+ goto on_error;
eet_node_struct_append(parent, name, array);
}
@@ -3716,17 +3790,17 @@ eet_data_get_array(Eet_Free_Context *context,
on_error:
EINA_LIST_FREE(childs, tmp)
- eet_node_del(tmp);
+ eet_node_del(tmp);
return 0;
} /* eet_data_get_array */
static void
-eet_data_put_union(Eet_Dictionary *ed,
+eet_data_put_union(Eet_Dictionary *ed,
Eet_Data_Descriptor *edd __UNUSED__,
- Eet_Data_Element *ede,
- Eet_Data_Stream *ds,
- void *data_in)
+ Eet_Data_Element *ede,
+ Eet_Data_Stream *ds,
+ void *data_in)
{
const char *union_type;
int i;
@@ -3734,61 +3808,60 @@ eet_data_put_union(Eet_Dictionary *ed,
EET_ASSERT(!((ede->type != EET_T_UNKNOW) || (!ede->subtype)), return );
union_type = ede->subtype->func.type_get(
- ((char *)data_in) + ede->count - ede->offset,
- NULL);
+ ((char *)data_in) + ede->count - ede->offset,
+ NULL);
if (!union_type)
- return;
+ return;
/* Search the structure of the union to encode. */
for (i = 0; i < ede->subtype->elements.num; ++i)
- if (strcmp(ede->subtype->elements.set[i].name, union_type) == 0)
- {
- Eet_Data_Element *sede;
- void *data;
- int size;
-
- /* Yeah we found it ! */
- data = eet_data_put_type(ed, EET_T_STRING, &union_type, &size);
- if (data)
- eet_data_encode(ed,
- ds,
- data,
- ede->name,
- size,
- ede->type,
- ede->group_type);
-
- sede = &(ede->subtype->elements.set[i]);
- data = _eet_data_descriptor_encode(ed,
- sede->subtype,
- data_in,
- &size);
- if (data)
- eet_data_encode(ed,
- ds,
- data,
- ede->name,
- size,
- ede->type,
- ede->group_type);
-
- break;
- }
-
+ if (strcmp(ede->subtype->elements.set[i].name, union_type) == 0)
+ {
+ Eet_Data_Element *sede;
+ void *data;
+ int size;
+
+ /* Yeah we found it ! */
+ data = eet_data_put_type(ed, EET_T_STRING, &union_type, &size);
+ if (data)
+ eet_data_encode(ed,
+ ds,
+ data,
+ ede->name,
+ size,
+ ede->type,
+ ede->group_type);
+
+ sede = &(ede->subtype->elements.set[i]);
+ data = _eet_data_descriptor_encode(ed,
+ sede->subtype,
+ data_in,
+ &size);
+ if (data)
+ eet_data_encode(ed,
+ ds,
+ data,
+ ede->name,
+ size,
+ ede->type,
+ ede->group_type);
+
+ break;
+ }
} /* eet_data_put_union */
static int
-eet_data_get_union(Eet_Free_Context *context,
- const Eet_Dictionary *ed,
- Eet_Data_Descriptor *edd __UNUSED__,
- Eet_Data_Element *ede,
- Eet_Data_Chunk *echnk,
- int type,
- int group_type,
- void *data,
- char **p,
- int *size)
+eet_data_get_union(Eet_Free_Context *context,
+ const Eet_Dictionary *ed,
+ Eet_Data_Descriptor *edd __UNUSED__,
+ Eet_Data_Element *ede,
+ Eet_Data_Chunk *echnk,
+ int type,
+ int group_type,
+ void *data,
+ char **p,
+ int *size)
{
const char *union_type;
void *data_ret = NULL;
@@ -3802,7 +3875,7 @@ eet_data_get_union(Eet_Free_Context *context,
((char *)echnk->data) + echnk->size,
&union_type);
if (ret <= 0)
- goto on_error;
+ goto on_error;
/* Advance to next chunk */
NEXT_CHUNK((*p), (*size), (*echnk), ed);
@@ -3811,7 +3884,7 @@ eet_data_get_union(Eet_Free_Context *context,
/* Read value */
eet_data_chunk_get(ed, echnk, *p, *size);
if (!echnk->name)
- goto on_error;
+ goto on_error;
if (ede)
{
@@ -3820,55 +3893,54 @@ eet_data_get_union(Eet_Free_Context *context,
/* Search the structure of the union to decode */
for (i = 0; i < ede->subtype->elements.num; ++i)
- if (strcmp(ede->subtype->elements.set[i].name, union_type) == 0)
- {
- Eet_Data_Element *sede;
- char *ut;
-
- /* Yeah we found it ! */
- sede = &(ede->subtype->elements.set[i]);
- EET_ASSERT(sede->subtype, goto on_error);
-
- data_ret = _eet_data_descriptor_decode(context,
- ed,
- sede->subtype,
- echnk->data,
- echnk->size,
- data,
- sede->subtype->size);
- if (!data_ret)
- goto on_error;
-
- /* Set union type. */
- if ((!ed) || (!ede->subtype->func.str_direct_alloc))
- {
- ut = ede->subtype->func.str_alloc(union_type);
- _eet_freelist_str_add(context, ut);
- }
- else
- {
- ut = ede->subtype->func.str_direct_alloc(union_type);
- _eet_freelist_direct_str_add(context, ut);
- }
-
- ede->subtype->func.type_set(
- ut,
- ((char *)data) + ede->count -
- ede->offset,
- EINA_FALSE);
-
- break;
- }
+ if (strcmp(ede->subtype->elements.set[i].name, union_type) == 0)
+ {
+ Eet_Data_Element *sede;
+ char *ut;
+
+ /* Yeah we found it ! */
+ sede = &(ede->subtype->elements.set[i]);
+ EET_ASSERT(sede->subtype, goto on_error);
+ data_ret = _eet_data_descriptor_decode(context,
+ ed,
+ sede->subtype,
+ echnk->data,
+ echnk->size,
+ data,
+ sede->subtype->size);
+ if (!data_ret)
+ goto on_error;
+
+ /* Set union type. */
+ if ((!ed) || (!ede->subtype->func.str_direct_alloc))
+ {
+ ut = ede->subtype->func.str_alloc(union_type);
+ _eet_freelist_str_add(context, ut);
+ }
+ else
+ {
+ ut = ede->subtype->func.str_direct_alloc(union_type);
+ _eet_freelist_direct_str_add(context, ut);
+ }
+
+ ede->subtype->func.type_set(
+ ut,
+ ((char *)data) + ede->count -
+ ede->offset,
+ EINA_FALSE);
+
+ break;
+ }
}
else
{
/* FIXME: generate node structure. */
- data_ret = _eet_data_descriptor_decode(context,
- ed, NULL,
- echnk->data, echnk->size,
- NULL, 0);
- goto on_error;
+ data_ret = _eet_data_descriptor_decode(context,
+ ed, NULL,
+ echnk->data, echnk->size,
+ NULL, 0);
+ goto on_error;
}
return 1;
@@ -3878,11 +3950,11 @@ on_error:
} /* eet_data_get_union */
static void
-eet_data_put_variant(Eet_Dictionary *ed,
+eet_data_put_variant(Eet_Dictionary *ed,
Eet_Data_Descriptor *edd __UNUSED__,
- Eet_Data_Element *ede,
- Eet_Data_Stream *ds,
- void *data_in)
+ Eet_Data_Element *ede,
+ Eet_Data_Stream *ds,
+ void *data_in)
{
const char *union_type;
void *data;
@@ -3893,19 +3965,19 @@ eet_data_put_variant(Eet_Dictionary *ed,
EET_ASSERT(!((ede->type != EET_T_UNKNOW) || (!ede->subtype)), return );
union_type = ede->subtype->func.type_get(
- ((char *)data_in) + ede->count - ede->offset,
- &unknow);
+ ((char *)data_in) + ede->count - ede->offset,
+ &unknow);
if (!union_type && unknow == EINA_FALSE)
- return;
+ return;
if (unknow)
{
/* Handle opaque internal representation */
- Eet_Variant_Unknow *evu;
+ Eet_Variant_Unknow *evu;
- data = eet_data_put_type(ed, EET_T_STRING, &union_type, &size);
- if (data)
+ data = eet_data_put_type(ed, EET_T_STRING, &union_type, &size);
+ if (data)
eet_data_encode(ed,
ds,
data,
@@ -3914,8 +3986,8 @@ eet_data_put_variant(Eet_Dictionary *ed,
ede->type,
ede->group_type);
- evu = (Eet_Variant_Unknow *)data_in;
- if (evu && EINA_MAGIC_CHECK(evu, EET_MAGIC_VARIANT))
+ evu = (Eet_Variant_Unknow *)data_in;
+ if (evu && EINA_MAGIC_CHECK(evu, EET_MAGIC_VARIANT))
eet_data_encode(ed,
ds,
evu->data,
@@ -3925,81 +3997,80 @@ eet_data_put_variant(Eet_Dictionary *ed,
ede->group_type);
}
else
- /* Search the structure of the union to encode. */
- for (i = 0; i < ede->subtype->elements.num; ++i)
- if (strcmp(ede->subtype->elements.set[i].name, union_type) == 0)
- {
- Eet_Data_Element *sede;
-
- /* Yeah we found it ! */
- data = eet_data_put_type(ed, EET_T_STRING, &union_type, &size);
- if (data)
- eet_data_encode(ed,
- ds,
- data,
- ede->name,
- size,
- ede->type,
- ede->group_type);
-
- sede = &(ede->subtype->elements.set[i]);
-
- if (sede->group_type != EET_G_UNKNOWN)
- {
- Eet_Data_Stream *lds;
-
- lds = eet_data_stream_new();
- eet_group_codec[sede->group_type - 100].put(ed,
- sede->subtype,
- sede,
- lds,
- data_in);
- if (lds->size != 0)
- {
- eet_data_encode(ed, ds, lds->data, ede->name, lds->pos,
- ede->type, ede->group_type);
-
- lds->data = NULL;
- lds->size = 0;
- }
- else
- eet_data_encode(ed, ds, NULL, ede->name, 0,
- EET_T_NULL, ede->group_type);
-
- eet_data_stream_free(lds);
- }
- else
- {
- data = _eet_data_descriptor_encode(ed,
- sede->subtype,
- *(void **)data_in,
- &size);
- if (data)
- eet_data_encode(ed,
- ds,
- data,
- ede->name,
- size,
- ede->type,
- ede->group_type);
- }
-
- break;
- }
+ /* Search the structure of the union to encode. */
+ for (i = 0; i < ede->subtype->elements.num; ++i)
+ if (strcmp(ede->subtype->elements.set[i].name, union_type) == 0)
+ {
+ Eet_Data_Element *sede;
+
+ /* Yeah we found it ! */
+ data = eet_data_put_type(ed, EET_T_STRING, &union_type, &size);
+ if (data)
+ eet_data_encode(ed,
+ ds,
+ data,
+ ede->name,
+ size,
+ ede->type,
+ ede->group_type);
+
+ sede = &(ede->subtype->elements.set[i]);
+
+ if (sede->group_type != EET_G_UNKNOWN)
+ {
+ Eet_Data_Stream *lds;
+
+ lds = eet_data_stream_new();
+ eet_group_codec[sede->group_type - 100].put(ed,
+ sede->subtype,
+ sede,
+ lds,
+ data_in);
+ if (lds->size != 0)
+ {
+ eet_data_encode(ed, ds, lds->data, ede->name, lds->pos,
+ ede->type, ede->group_type);
+
+ lds->data = NULL;
+ lds->size = 0;
+ }
+ else
+ eet_data_encode(ed, ds, NULL, ede->name, 0,
+ EET_T_NULL, ede->group_type);
+
+ eet_data_stream_free(lds);
+ }
+ else
+ {
+ data = _eet_data_descriptor_encode(ed,
+ sede->subtype,
+ *(void **)data_in,
+ &size);
+ if (data)
+ eet_data_encode(ed,
+ ds,
+ data,
+ ede->name,
+ size,
+ ede->type,
+ ede->group_type);
+ }
+ break;
+ }
} /* eet_data_put_variant */
static int
-eet_data_get_variant(Eet_Free_Context *context,
- const Eet_Dictionary *ed,
- Eet_Data_Descriptor *edd __UNUSED__,
- Eet_Data_Element *ede,
- Eet_Data_Chunk *echnk,
- int type __UNUSED__,
- int group_type __UNUSED__,
- void *data,
- char **p,
- int *size)
+eet_data_get_variant(Eet_Free_Context *context,
+ const Eet_Dictionary *ed,
+ Eet_Data_Descriptor *edd __UNUSED__,
+ Eet_Data_Element *ede,
+ Eet_Data_Chunk *echnk,
+ int type __UNUSED__,
+ int group_type __UNUSED__,
+ void *data,
+ char **p,
+ int *size)
{
const char *union_type;
void *data_ret = NULL;
@@ -4013,7 +4084,7 @@ eet_data_get_variant(Eet_Free_Context *context,
((char *)echnk->data) + echnk->size,
&union_type);
if (ret <= 0)
- goto on_error;
+ goto on_error;
/* Advance to next chunk */
NEXT_CHUNK((*p), (*size), (*echnk), ed);
@@ -4022,7 +4093,7 @@ eet_data_get_variant(Eet_Free_Context *context,
/* Read value */
eet_data_chunk_get(ed, echnk, *p, *size);
if (!echnk->name)
- goto on_error;
+ goto on_error;
if (ede)
{
@@ -4043,70 +4114,70 @@ eet_data_get_variant(Eet_Free_Context *context,
/* Search the structure of the union to decode */
for (i = 0; i < ede->subtype->elements.num; ++i)
- if (strcmp(ede->subtype->elements.set[i].name, union_type) == 0)
- {
- Eet_Data_Element *sede;
+ if (strcmp(ede->subtype->elements.set[i].name, union_type) == 0)
+ {
+ Eet_Data_Element *sede;
- /* Yeah we found it ! */
- sede = &(ede->subtype->elements.set[i]);
+ /* Yeah we found it ! */
+ sede = &(ede->subtype->elements.set[i]);
- if (sede->group_type != EET_G_UNKNOWN)
- {
- Eet_Data_Chunk chnk;
- char *p2;
- int size2;
+ if (sede->group_type != EET_G_UNKNOWN)
+ {
+ Eet_Data_Chunk chnk;
+ char *p2;
+ int size2;
- p2 = echnk->data;
- size2 = echnk->size;
+ p2 = echnk->data;
+ size2 = echnk->size;
- /* Didn't find a proper way to provide this
- without duplicating code */
- while (size2 > 0)
- {
- memset(&chnk, 0, sizeof(Eet_Data_Chunk));
- eet_data_chunk_get(ed, &chnk, p2, size2);
+ /* Didn't find a proper way to provide this
+ without duplicating code */
+ while (size2 > 0)
+ {
+ memset(&chnk, 0, sizeof(Eet_Data_Chunk));
+ eet_data_chunk_get(ed, &chnk, p2, size2);
- if (!chnk.name)
- goto on_error;
+ if (!chnk.name)
+ goto on_error;
- ret = eet_group_codec[sede->group_type - 100].get
- (context, ed, sede->subtype, sede, &chnk, sede->type,
- sede->group_type, data, &p2, &size2);
+ ret = eet_group_codec[sede->group_type - 100].get
+ (context, ed, sede->subtype, sede, &chnk, sede->type,
+ sede->group_type, data, &p2, &size2);
- if (ret <= 0)
- goto on_error;
+ if (ret <= 0)
+ goto on_error;
/* advance to next chunk */
- NEXT_CHUNK(p2, size2, chnk, ed);
- }
-
- /* Put garbage so that we will not put eet_variant_unknow in it */
- data_ret = (void *)data;
-
- /* Set variant type. */
- ede->subtype->func.type_set
- (ut, ((char *)data) + ede->count - ede->offset,
- EINA_FALSE);
- break;
- }
-
- data_ret = _eet_data_descriptor_decode(context,
- ed,
- sede->subtype,
- echnk->data,
- echnk->size,
- NULL, 0);
- if (!data_ret)
- break;
-
- /* And point to the variant data. */
- *(void **)data = data_ret;
-
- /* Set variant type. */
- ede->subtype->func.type_set
- (ut, ((char *)data) + ede->count - ede->offset, EINA_FALSE);
- break;
- }
+ NEXT_CHUNK(p2, size2, chnk, ed);
+ }
+
+ /* Put garbage so that we will not put eet_variant_unknow in it */
+ data_ret = (void *)data;
+
+ /* Set variant type. */
+ ede->subtype->func.type_set
+ (ut, ((char *)data) + ede->count - ede->offset,
+ EINA_FALSE);
+ break;
+ }
+
+ data_ret = _eet_data_descriptor_decode(context,
+ ed,
+ sede->subtype,
+ echnk->data,
+ echnk->size,
+ NULL, 0);
+ if (!data_ret)
+ break;
+
+ /* And point to the variant data. */
+ *(void **)data = data_ret;
+
+ /* Set variant type. */
+ ede->subtype->func.type_set
+ (ut, ((char *)data) + ede->count - ede->offset, EINA_FALSE);
+ break;
+ }
if (!data_ret)
{
@@ -4114,7 +4185,7 @@ eet_data_get_variant(Eet_Free_Context *context,
evu = calloc(1, sizeof (Eet_Variant_Unknow) + echnk->size - 1);
if (!evu)
- goto on_error;
+ goto on_error;
evu->size = echnk->size;
memcpy(evu->data, echnk->data, evu->size);
@@ -4125,17 +4196,17 @@ eet_data_get_variant(Eet_Free_Context *context,
/* Set variant type. */
ede->subtype->func.type_set
- (ut, ((char *)data) + ede->count - ede->offset, EINA_TRUE);
+ (ut, ((char *)data) + ede->count - ede->offset, EINA_TRUE);
}
}
else
{
/* FIXME: dump node structure. */
- data_ret = _eet_data_descriptor_decode(context,
- ed, NULL,
- echnk->data, echnk->size,
- NULL, 0);
- goto on_error;
+ data_ret = _eet_data_descriptor_decode(context,
+ ed, NULL,
+ echnk->data, echnk->size,
+ NULL, 0);
+ goto on_error;
}
return 1;
@@ -4145,37 +4216,39 @@ on_error:
} /* eet_data_get_variant */
static Eet_Node *
-eet_data_node_simple_type(int type, const char *name, void *dd)
+eet_data_node_simple_type(int type,
+ const char *name,
+ void *dd)
{
#ifdef EET_T_TYPE
# undef EET_T_TYPE
#endif /* ifdef EET_T_TYPE */
-#define EET_T_TYPE(Eet_Type, Eet_Node_Type, Type)\
- case Eet_Type:\
- return eet_node_ ## Eet_Node_Type ## _new(name, *((Type *)dd));\
+#define EET_T_TYPE(Eet_Type, Eet_Node_Type, Type) \
+case Eet_Type: \
+ return eet_node_ ## Eet_Node_Type ## _new(name, *((Type *)dd)); \
switch (type)
{
- EET_T_TYPE(EET_T_CHAR, char, char);
- EET_T_TYPE(EET_T_SHORT, short, short);
- EET_T_TYPE(EET_T_INT, int, int);
- EET_T_TYPE(EET_T_LONG_LONG, long_long, long long);
- EET_T_TYPE(EET_T_FLOAT, float, float);
- EET_T_TYPE(EET_T_DOUBLE, double, double);
- EET_T_TYPE(EET_T_UCHAR, unsigned_char, unsigned char);
- EET_T_TYPE(EET_T_USHORT, unsigned_short, unsigned short);
- EET_T_TYPE(EET_T_UINT, unsigned_int, unsigned int);
- EET_T_TYPE(EET_T_ULONG_LONG, unsigned_long_long, unsigned long long);
- EET_T_TYPE(EET_T_STRING, string, char *);
- EET_T_TYPE(EET_T_INLINED_STRING, inlined_string, char *);
+ EET_T_TYPE(EET_T_CHAR, char, char);
+ EET_T_TYPE(EET_T_SHORT, short, short);
+ EET_T_TYPE(EET_T_INT, int, int);
+ EET_T_TYPE(EET_T_LONG_LONG, long_long, long long);
+ EET_T_TYPE(EET_T_FLOAT, float, float);
+ EET_T_TYPE(EET_T_DOUBLE, double, double);
+ EET_T_TYPE(EET_T_UCHAR, unsigned_char, unsigned char);
+ EET_T_TYPE(EET_T_USHORT, unsigned_short, unsigned short);
+ EET_T_TYPE(EET_T_UINT, unsigned_int, unsigned int);
+ EET_T_TYPE(EET_T_ULONG_LONG, unsigned_long_long, unsigned long long);
+ EET_T_TYPE(EET_T_STRING, string, char *);
+ EET_T_TYPE(EET_T_INLINED_STRING, inlined_string, char *);
case EET_T_NULL:
- return eet_node_null_new(name);
+ return eet_node_null_new(name);
default:
- ERR("Unknow type passed to eet_data_node_simple_type");
- return NULL;
+ ERR("Unknow type passed to eet_data_node_simple_type");
+ return NULL;
} /* switch */
} /* eet_data_node_simple_type */
@@ -4186,10 +4259,10 @@ eet_data_get_unknown(Eet_Free_Context *context,
Eet_Data_Element *ede,
Eet_Data_Chunk *echnk,
int type,
- int group_type __UNUSED__,
+ int group_type __UNUSED__,
void *data,
- char **p __UNUSED__,
- int *size __UNUSED__)
+ char **p __UNUSED__,
+ int *size __UNUSED__)
{
int ret;
void *data_ret;
@@ -4204,7 +4277,7 @@ eet_data_get_unknown(Eet_Free_Context *context,
((char *)echnk->data) + echnk->size,
edd ? (char *)data : (char *)dd);
if (ret <= 0)
- return ret;
+ return ret;
if (!edd)
{
@@ -4214,9 +4287,9 @@ eet_data_get_unknown(Eet_Free_Context *context,
node = eet_data_node_simple_type(type, echnk->name, dd);
if (*parent)
- eet_node_struct_append(*parent, echnk->name, node);
+ eet_node_struct_append(*parent, echnk->name, node);
else
- *parent = node;
+ *parent = node;
}
else
{
@@ -4270,7 +4343,7 @@ eet_data_get_unknown(Eet_Free_Context *context,
echnk->size,
NULL, 0);
if (!data_ret)
- return 0;
+ return 0;
if (edd)
{
@@ -4287,7 +4360,7 @@ eet_data_get_unknown(Eet_Free_Context *context,
eet_node_struct_append(*parent, echnk->name, node);
}
else
- *parent = node;
+ *parent = node;
}
}
}
@@ -4296,11 +4369,11 @@ eet_data_get_unknown(Eet_Free_Context *context,
} /* eet_data_get_unknown */
static void
-eet_data_put_array(Eet_Dictionary *ed,
+eet_data_put_array(Eet_Dictionary *ed,
Eet_Data_Descriptor *edd __UNUSED__,
- Eet_Data_Element *ede,
- Eet_Data_Stream *ds,
- void *data_in)
+ Eet_Data_Element *ede,
+ Eet_Data_Stream *ds,
+ void *data_in)
{
void *data;
int offset = 0;
@@ -4313,21 +4386,21 @@ eet_data_put_array(Eet_Dictionary *ed,
return );
if (ede->group_type == EET_G_ARRAY)
- count = ede->counter_offset;
+ count = ede->counter_offset;
else
- count = *(int *)(((char *)data_in) + ede->count - ede->offset);
+ count = *(int *)(((char *)data_in) + ede->count - ede->offset);
if (count <= 0)
- return; /* Store number of elements */
+ return; /* Store number of elements */
data = eet_data_put_type(ed, EET_T_INT, &count, &size);
if (data)
- eet_data_encode(ed, ds, data, ede->name, size, ede->type, ede->group_type);
+ eet_data_encode(ed, ds, data, ede->name, size, ede->type, ede->group_type);
if (IS_POINTER_TYPE(ede->type))
- subsize = eet_basic_codec[ede->type].size;
+ subsize = eet_basic_codec[ede->type].size;
else
- subsize = ede->subtype->size;
+ subsize = ede->subtype->size;
for (j = 0; j < count; j++)
{
@@ -4335,69 +4408,69 @@ eet_data_put_array(Eet_Dictionary *ed,
int pos = ds->pos;
if (ede->group_type == EET_G_ARRAY)
- d = (void *)(((char *)data_in) + offset);
+ d = (void *)(((char *)data_in) + offset);
else
- d = *(((char **)data_in)) + offset;
+ d = *(((char **)data_in)) + offset;
if (IS_POINTER_TYPE(ede->type))
{
if (*(char **)d)
- eet_data_put_unknown(ed, NULL, ede, ds, d);
+ eet_data_put_unknown(ed, NULL, ede, ds, d);
}
else
{
data = _eet_data_descriptor_encode(ed, ede->subtype, d, &size);
if (data)
- eet_data_encode(ed,
- ds,
- data,
- ede->name,
- size,
- ede->type,
- ede->group_type);
+ eet_data_encode(ed,
+ ds,
+ data,
+ ede->name,
+ size,
+ ede->type,
+ ede->group_type);
}
if (pos == ds->pos)
- /* Add a NULL element just to have the correct array layout. */
- eet_data_encode(ed,
- ds,
- NULL,
- ede->name,
- 0,
- EET_T_NULL,
- ede->group_type);
+ /* Add a NULL element just to have the correct array layout. */
+ eet_data_encode(ed,
+ ds,
+ NULL,
+ ede->name,
+ 0,
+ EET_T_NULL,
+ ede->group_type);
offset += subsize;
}
} /* eet_data_put_array */
static void
-eet_data_put_unknown(Eet_Dictionary *ed,
+eet_data_put_unknown(Eet_Dictionary *ed,
Eet_Data_Descriptor *edd __UNUSED__,
- Eet_Data_Element *ede,
- Eet_Data_Stream *ds,
- void *data_in)
+ Eet_Data_Element *ede,
+ Eet_Data_Stream *ds,
+ void *data_in)
{
void *data = NULL;
int size;
if (IS_SIMPLE_TYPE(ede->type))
- data = eet_data_put_type(ed, ede->type, data_in, &size);
+ data = eet_data_put_type(ed, ede->type, data_in, &size);
else if (ede->subtype)
- if (*((char **)data_in))
- data = _eet_data_descriptor_encode(ed,
- ede->subtype,
- *((char **)((char *)(data_in))),
- &size);
+ if (*((char **)data_in))
+ data = _eet_data_descriptor_encode(ed,
+ ede->subtype,
+ *((char **)((char *)(data_in))),
+ &size);
if (data)
- eet_data_encode(ed,
- ds,
- data,
- ede->name,
- size,
- ede->type,
- ede->group_type);
+ eet_data_encode(ed,
+ ds,
+ data,
+ ede->name,
+ size,
+ ede->type,
+ ede->group_type);
} /* eet_data_put_unknown */
static void
@@ -4430,13 +4503,13 @@ eet_data_put_list(Eet_Dictionary *ed,
edd->func.list_data(l),
&size);
if (data)
- eet_data_encode(ed,
- ds,
- data,
- ede->name,
- size,
- ede->type,
- ede->group_type);
+ eet_data_encode(ed,
+ ds,
+ data,
+ ede->name,
+ size,
+ ede->type,
+ ede->group_type);
}
}
} /* eet_data_put_list */
@@ -4459,11 +4532,11 @@ eet_data_put_hash(Eet_Dictionary *ed,
} /* eet_data_put_hash */
EAPI int
-eet_data_dump_cipher(Eet_File *ef,
- const char *name,
- const char *cipher_key,
+eet_data_dump_cipher(Eet_File *ef,
+ const char *name,
+ const char *cipher_key,
Eet_Dump_Callback dumpfunc,
- void *dumpdata)
+ void *dumpdata)
{
const Eet_Dictionary *ed = NULL;
const void *data = NULL;
@@ -4475,14 +4548,14 @@ eet_data_dump_cipher(Eet_File *ef,
ed = eet_dictionary_get(ef);
if (!cipher_key)
- data = eet_read_direct(ef, name, &size);
+ data = eet_read_direct(ef, name, &size);
if (!data)
{
required_free = 1;
data = eet_read_cipher(ef, name, &size, cipher_key);
if (!data)
- return 0;
+ return 0;
}
eet_free_context_init(&context);
@@ -4494,26 +4567,26 @@ eet_data_dump_cipher(Eet_File *ef,
eet_node_del(result);
if (required_free)
- free((void *)data);
+ free((void *)data);
return result ? 1 : 0;
} /* eet_data_dump_cipher */
EAPI int
-eet_data_dump(Eet_File *ef,
- const char *name,
+eet_data_dump(Eet_File *ef,
+ const char *name,
Eet_Dump_Callback dumpfunc,
- void *dumpdata)
+ void *dumpdata)
{
return eet_data_dump_cipher(ef, name, NULL, dumpfunc, dumpdata);
} /* eet_data_dump */
EAPI int
-eet_data_text_dump_cipher(const void *data_in,
- const char *cipher_key,
- int size_in,
+eet_data_text_dump_cipher(const void *data_in,
+ const char *cipher_key,
+ int size_in,
Eet_Dump_Callback dumpfunc,
- void *dumpdata)
+ void *dumpdata)
{
void *ret = NULL;
Eet_Node *result;
@@ -4521,7 +4594,7 @@ eet_data_text_dump_cipher(const void *data_in,
unsigned int ret_len = 0;
if (!data_in)
- return 0;
+ return 0;
if (cipher_key)
{
@@ -4529,7 +4602,7 @@ eet_data_text_dump_cipher(const void *data_in,
strlen(cipher_key), &ret, &ret_len))
{
if (ret)
- free(ret);
+ free(ret);
return 0;
}
@@ -4548,16 +4621,16 @@ eet_data_text_dump_cipher(const void *data_in,
eet_node_del(result);
if (cipher_key)
- free(ret);
+ free(ret);
return result ? 1 : 0;
} /* eet_data_text_dump_cipher */
EAPI int
-eet_data_text_dump(const void *data_in,
- int size_in,
+eet_data_text_dump(const void *data_in,
+ int size_in,
Eet_Dump_Callback dumpfunc,
- void *dumpdata)
+ void *dumpdata)
{
return eet_data_text_dump_cipher(data_in, NULL, size_in, dumpfunc, dumpdata);
} /* eet_data_text_dump */
@@ -4580,7 +4653,7 @@ eet_data_text_undump_cipher(const char *text,
strlen(cipher_key), &ciphered, &ciphered_len))
{
if (ciphered)
- free(ciphered);
+ free(ciphered);
size_ret = 0;
free(ret);
@@ -4620,7 +4693,7 @@ eet_data_undump_cipher(Eet_File *ef,
data_enc = _eet_data_dump_parse(ed, &size, text, textlen);
if (!data_enc)
- return 0;
+ return 0;
val = eet_write_cipher(ef, name, data_enc, size, compress, cipher_key);
free(data_enc);
@@ -4649,14 +4722,14 @@ eet_data_descriptor_decode_cipher(Eet_Data_Descriptor *edd,
unsigned int deciphered_len = size_in;
if (cipher_key && data_in)
- if (eet_decipher(data_in, size_in, cipher_key,
- strlen(cipher_key), &deciphered, &deciphered_len))
- {
- if (deciphered)
- free(deciphered);
+ if (eet_decipher(data_in, size_in, cipher_key,
+ strlen(cipher_key), &deciphered, &deciphered_len))
+ {
+ if (deciphered)
+ free(deciphered);
- return NULL;
- }
+ return NULL;
+ }
eet_free_context_init(&context);
ret = _eet_data_descriptor_decode(&context,
@@ -4668,7 +4741,7 @@ eet_data_descriptor_decode_cipher(Eet_Data_Descriptor *edd,
eet_free_context_shutdown(&context);
if (data_in != deciphered)
- free(deciphered);
+ free(deciphered);
return ret;
} /* eet_data_descriptor_decode_cipher */
@@ -4692,14 +4765,14 @@ eet_data_node_decode_cipher(const void *data_in,
unsigned int deciphered_len = size_in;
if (cipher_key && data_in)
- if (eet_decipher(data_in, size_in, cipher_key,
- strlen(cipher_key), &deciphered, &deciphered_len))
- {
- if (deciphered)
- free(deciphered);
+ if (eet_decipher(data_in, size_in, cipher_key,
+ strlen(cipher_key), &deciphered, &deciphered_len))
+ {
+ if (deciphered)
+ free(deciphered);
- return NULL;
- }
+ return NULL;
+ }
eet_free_context_init(&context);
ret = _eet_data_descriptor_decode(&context,
@@ -4711,7 +4784,7 @@ eet_data_node_decode_cipher(const void *data_in,
eet_free_context_shutdown(&context);
if (data_in != deciphered)
- free(deciphered);
+ free(deciphered);
return ret;
} /* eet_data_node_decode_cipher */
@@ -4734,9 +4807,9 @@ _eet_data_descriptor_encode(Eet_Dictionary *ed,
v = htonl(0x12345678);
if (v == 0x12345678)
- _eet_data_words_bigendian = 1;
+ _eet_data_words_bigendian = 1;
else
- _eet_data_words_bigendian = 0;
+ _eet_data_words_bigendian = 0;
}
ds = eet_data_stream_new();
@@ -4746,12 +4819,12 @@ _eet_data_descriptor_encode(Eet_Dictionary *ed,
ede = &(edd->elements.set[i]);
eet_group_codec[ede->group_type - 100].put(
- ed,
- edd,
- ede,
- ds,
- ((char *)data_in) +
- ede->offset);
+ ed,
+ edd,
+ ede,
+ ds,
+ ((char *)data_in) +
+ ede->offset);
}
chnk = eet_data_chunk_new(ds->data,
ds->pos,
@@ -4794,7 +4867,7 @@ eet_data_node_write_cipher(Eet_File *ef,
data_enc = _eet_data_dump_encode(EET_G_UNKNOWN, ed, node, &size);
if (!data_enc)
- return 0;
+ return 0;
val = eet_write_cipher(ef, name, data_enc, size, compress, cipher_key);
free(data_enc);
@@ -4818,10 +4891,10 @@ eet_data_node_encode_cipher(Eet_Node *node,
strlen(cipher_key), &ciphered, &ciphered_len))
{
if (ciphered)
- free(ciphered);
+ free(ciphered);
if (size_ret)
- *size_ret = 0;
+ *size_ret = 0;
free(ret);
return NULL;
@@ -4833,7 +4906,7 @@ eet_data_node_encode_cipher(Eet_Node *node,
}
if (size_ret)
- *size_ret = size;
+ *size_ret = size;
return ret;
} /* eet_data_node_encode_cipher */
@@ -4856,10 +4929,10 @@ eet_data_descriptor_encode_cipher(Eet_Data_Descriptor *edd,
strlen(cipher_key), &ciphered, &ciphered_len))
{
if (ciphered)
- free(ciphered);
+ free(ciphered);
if (size_ret)
- *size_ret = 0;
+ *size_ret = 0;
free(ret);
return NULL;
@@ -4871,7 +4944,7 @@ eet_data_descriptor_encode_cipher(Eet_Data_Descriptor *edd,
}
if (size_ret)
- *size_ret = size;
+ *size_ret = size;
return ret;
} /* eet_data_descriptor_encode_cipher */
@@ -4885,10 +4958,10 @@ eet_data_descriptor_encode(Eet_Data_Descriptor *edd,
} /* eet_data_descriptor_encode */
EAPI void *
-eet_data_xattr_cipher_get(const char *filename,
- const char *attribute,
- Eet_Data_Descriptor *edd,
- const char *cipher_key)
+eet_data_xattr_cipher_get(const char *filename,
+ const char *attribute,
+ Eet_Data_Descriptor *edd,
+ const char *cipher_key)
{
void *blob;
void *ret;
@@ -4904,12 +4977,12 @@ eet_data_xattr_cipher_get(const char *filename,
}
EAPI Eina_Bool
-eet_data_xattr_cipher_set(const char *filename,
- const char *attribute,
- Eet_Data_Descriptor *edd,
- const char *cipher_key,
- const void *data,
- Eina_Xattr_Flags flags)
+eet_data_xattr_cipher_set(const char *filename,
+ const char *attribute,
+ Eet_Data_Descriptor *edd,
+ const char *cipher_key,
+ const void *data,
+ Eina_Xattr_Flags flags)
{
void *blob;
int size;
diff --git a/src/lib/eet_dictionary.c b/src/lib/eet_dictionary.c
index 0e167ae..60d0ec1 100644
--- a/src/lib/eet_dictionary.c
+++ b/src/lib/eet_dictionary.c
@@ -18,7 +18,7 @@ eet_dictionary_add(void)
new = calloc(1, sizeof (Eet_Dictionary));
if (!new)
- return NULL;
+ return NULL;
memset(new->hash, -1, sizeof (int) * 256);
@@ -48,7 +48,7 @@ eet_dictionary_free(Eet_Dictionary *ed)
static int
_eet_dictionary_lookup(Eet_Dictionary *ed,
const char *string,
- int len,
+ int len,
int hash)
{
Eina_Bool found = EINA_FALSE;
@@ -59,22 +59,22 @@ _eet_dictionary_lookup(Eet_Dictionary *ed,
while (current != -1)
{
- if (ed->all[current].len == len)
- {
+ if (ed->all[current].len == len)
+ {
if (ed->all[current].str &&
(ed->all[current].str == string || strcmp(ed->all[current].str, string) == 0))
{
found = EINA_TRUE;
break;
}
- }
+ }
prev = current;
current = ed->all[current].next;
}
if (current == -1 && found)
- return prev;
+ return prev;
return current;
} /* _eet_dictionary_lookup */
@@ -90,7 +90,7 @@ eet_dictionary_string_add(Eet_Dictionary *ed,
int len;
if (!ed)
- return -1;
+ return -1;
hash = _eet_hash_gen(string, 8);
len = strlen(string) + 1;
@@ -99,7 +99,7 @@ eet_dictionary_string_add(Eet_Dictionary *ed,
if (idx != -1)
{
- if (ed->all[idx].str && (ed->all[idx].str == string || strcmp(ed->all[idx].str, string) == 0))
+ if (ed->all[idx].str && (ed->all[idx].str == string || strcmp(ed->all[idx].str, string) == 0))
return idx;
}
@@ -112,7 +112,7 @@ eet_dictionary_string_add(Eet_Dictionary *ed,
new = realloc(ed->all, sizeof (Eet_String) * total);
if (!new)
- return -1;
+ return -1;
ed->all = new;
ed->total = total;
@@ -120,7 +120,7 @@ eet_dictionary_string_add(Eet_Dictionary *ed,
str = eina_stringshare_add(string);
if (!str)
- return -1;
+ return -1;
current = ed->all + ed->count;
@@ -143,12 +143,12 @@ eet_dictionary_string_add(Eet_Dictionary *ed,
current->prev = ed->all[idx].prev;
if (current->next != -1)
- ed->all[current->next].prev = ed->count;
+ ed->all[current->next].prev = ed->count;
if (current->prev != -1)
- ed->all[current->prev].next = ed->count;
+ ed->all[current->prev].next = ed->count;
else
- ed->hash[hash] = ed->count;
+ ed->hash[hash] = ed->count;
}
return ed->count++;
@@ -159,13 +159,13 @@ eet_dictionary_string_get_size(const Eet_Dictionary *ed,
int idx)
{
if (!ed)
- return 0;
+ return 0;
if (idx < 0)
- return 0;
+ return 0;
if (idx < ed->count)
- return ed->all[idx].len;
+ return ed->all[idx].len;
return 0;
} /* eet_dictionary_string_get_size */
@@ -175,13 +175,13 @@ eet_dictionary_string_get_hash(const Eet_Dictionary *ed,
int idx)
{
if (!ed)
- return -1;
+ return -1;
if (idx < 0)
- return -1;
+ return -1;
if (idx < ed->count)
- return ed->all[idx].hash;
+ return ed->all[idx].hash;
return -1;
} /* eet_dictionary_string_get_hash */
@@ -191,10 +191,10 @@ eet_dictionary_string_get_char(const Eet_Dictionary *ed,
int idx)
{
if (!ed)
- return NULL;
+ return NULL;
if (idx < 0)
- return NULL;
+ return NULL;
if (idx < ed->count)
{
@@ -240,9 +240,9 @@ _eet_dictionary_string_get_float_cache(const char *s,
if (_eet_dictionary_string_get_me_cache(s, len, &mantisse, &exponent))
{
if (s[4] == '+')
- *result = (float)(mantisse << exponent);
+ *result = (float)(mantisse << exponent);
else
- *result = (float)mantisse / (float)(1 << exponent);
+ *result = (float)mantisse / (float)(1 << exponent);
return EINA_TRUE;
}
@@ -261,9 +261,9 @@ _eet_dictionary_string_get_double_cache(const char *s,
if (_eet_dictionary_string_get_me_cache(s, len, &mantisse, &exponent))
{
if (s[4] == '+')
- *result = (double)(mantisse << exponent);
+ *result = (double)(mantisse << exponent);
else
- *result = (double)mantisse / (float)(1 << exponent);
+ *result = (double)mantisse / (float)(1 << exponent);
return EINA_TRUE;
}
@@ -277,24 +277,24 @@ _eet_dictionary_test(const Eet_Dictionary *ed,
void *result)
{
if (!result)
- return EINA_FALSE;
+ return EINA_FALSE;
if (!ed)
- return EINA_FALSE;
+ return EINA_FALSE;
if (idx < 0)
- return EINA_FALSE;
+ return EINA_FALSE;
if (!(idx < ed->count))
- return EINA_FALSE;
+ return EINA_FALSE;
return EINA_TRUE;
} /* _eet_dictionary_test */
static Eet_Convert *
eet_dictionary_convert_get(const Eet_Dictionary *ed,
- int idx,
- const char **str)
+ int idx,
+ const char **str)
{
Eet_Convert *result;
@@ -302,7 +302,7 @@ eet_dictionary_convert_get(const Eet_Dictionary *ed,
if (!ed->converts)
{
- ((Eet_Dictionary*)ed)->converts = eina_hash_int32_new(free);
+ ((Eet_Dictionary *)ed)->converts = eina_hash_int32_new(free);
goto add_convert;
}
@@ -310,7 +310,7 @@ eet_dictionary_convert_get(const Eet_Dictionary *ed,
result = eina_hash_find(ed->converts, &idx);
if (result) return result;
- add_convert:
+add_convert:
result = calloc(1, sizeof (Eet_Convert));
eina_hash_add(ed->converts, &idx, result);
@@ -326,7 +326,7 @@ eet_dictionary_string_get_float(const Eet_Dictionary *ed,
const char *str;
if (!_eet_dictionary_test(ed, idx, result))
- return EINA_FALSE;
+ return EINA_FALSE;
convert = eet_dictionary_convert_get(ed, idx, &str);
if (!convert) return EINA_FALSE;
@@ -341,7 +341,7 @@ eet_dictionary_string_get_float(const Eet_Dictionary *ed,
if (eina_convert_atod(str, ed->all[idx].len, &mantisse,
&exponent) == EINA_FALSE)
- return EINA_FALSE;
+ return EINA_FALSE;
convert->f = ldexpf((float)mantisse, exponent);
}
@@ -362,7 +362,7 @@ eet_dictionary_string_get_double(const Eet_Dictionary *ed,
const char *str;
if (!_eet_dictionary_test(ed, idx, result))
- return EINA_FALSE;
+ return EINA_FALSE;
convert = eet_dictionary_convert_get(ed, idx, &str);
if (!convert) return EINA_FALSE;
@@ -377,7 +377,7 @@ eet_dictionary_string_get_double(const Eet_Dictionary *ed,
if (eina_convert_atod(str, ed->all[idx].len, &mantisse,
&exponent) == EINA_FALSE)
- return EINA_FALSE;
+ return EINA_FALSE;
convert->d = ldexp((double)mantisse, exponent);
}
@@ -398,7 +398,7 @@ eet_dictionary_string_get_fp(const Eet_Dictionary *ed,
const char *str;
if (!_eet_dictionary_test(ed, idx, result))
- return EINA_FALSE;
+ return EINA_FALSE;
convert = eet_dictionary_convert_get(ed, idx, &str);
if (!convert) return EINA_FALSE;
@@ -408,7 +408,7 @@ eet_dictionary_string_get_fp(const Eet_Dictionary *ed,
Eina_F32p32 fp;
if (!eina_convert_atofp(str, ed->all[idx].len, &fp))
- return EINA_FALSE;
+ return EINA_FALSE;
convert->fp = fp;
convert->type |= EET_D_FIXED_POINT;
@@ -425,10 +425,10 @@ eet_dictionary_string_check(Eet_Dictionary *ed,
int i;
if ((!ed) || (!string))
- return 0;
+ return 0;
if ((ed->start <= string) && (string < ed->end))
- return 1;
+ return 1;
for (i = 0; i < ed->count; ++i)
if ((ed->all[i].allocated) && ed->all[i].str == string)
diff --git a/src/lib/eet_image.c b/src/lib/eet_image.c
index 8b48e7b..06816b1 100644
--- a/src/lib/eet_image.c
+++ b/src/lib/eet_image.c
@@ -16,7 +16,7 @@
# ifdef __cplusplus
extern "C"
# endif /* ifdef __cplusplus */
-void * alloca (size_t);
+void *alloca(size_t);
#endif /* ifdef HAVE_ALLOCA_H */
#ifdef HAVE_NETINET_IN_H
@@ -42,7 +42,7 @@ void * alloca (size_t);
/*---*/
-typedef struct _JPEG_error_mgr * emptr;
+typedef struct _JPEG_error_mgr *emptr;
/*---*/
@@ -54,7 +54,7 @@ struct _JPEG_error_mgr
struct jpeg_membuf_src
{
- struct jpeg_source_mgr pub;
+ struct jpeg_source_mgr pub;
const unsigned char *buf;
size_t len;
@@ -65,7 +65,7 @@ static void
_eet_jpeg_membuf_src_init(j_decompress_ptr cinfo)
{
/* FIXME: Use attribute unused */
- (void)cinfo;
+ (void)cinfo;
} /* _eet_jpeg_membuf_src_init */
static boolean
@@ -108,7 +108,7 @@ eet_jpeg_membuf_src(j_decompress_ptr cinfo,
src = calloc(1, sizeof(*src));
if (!src)
- return -1;
+ return -1;
src->self = src;
@@ -143,7 +143,7 @@ static void
_eet_jpeg_membuf_dst_init(j_compress_ptr cinfo)
{
/* FIXME: Use eina attribute */
- (void)cinfo;
+ (void)cinfo;
} /* _eet_jpeg_membuf_dst_init */
static boolean
@@ -162,7 +162,7 @@ _eet_jpeg_membuf_dst_flush(j_compress_ptr cinfo)
}
dst->pub.next_output_byte =
- buf + ((unsigned char *)dst->pub.next_output_byte - dst->buf);
+ buf + ((unsigned char *)dst->pub.next_output_byte - dst->buf);
dst->buf = buf;
dst->pub.free_in_buffer += dst->len;
dst->len *= 2;
@@ -200,7 +200,7 @@ eet_jpeg_membuf_dst(j_compress_ptr cinfo,
dst = calloc(1, sizeof(*dst));
if (!dst)
- return -1;
+ return -1;
dst->buf = malloc(32768);
if (!dst->buf)
@@ -227,54 +227,61 @@ eet_jpeg_membuf_dst(j_compress_ptr cinfo,
/*---*/
-static void _JPEGFatalErrorHandler(j_common_ptr cinfo);
-static void _JPEGErrorHandler(j_common_ptr cinfo);
-static void _JPEGErrorHandler2(j_common_ptr cinfo,
- int msg_level);
-
-static int eet_data_image_jpeg_header_decode(const void *data,
- int size,
- unsigned int *w,
- unsigned int *h);
-static int eet_data_image_jpeg_rgb_decode(const void *data,
- int size,
- unsigned int src_x,
- unsigned int src_y,
- unsigned int *d,
- unsigned int w,
- unsigned int h,
- unsigned int row_stride);
-static void * eet_data_image_jpeg_alpha_decode(const void *data,
- int size,
- unsigned int src_x,
- unsigned int src_y,
- unsigned int *d,
- unsigned int w,
- unsigned int h,
- unsigned int row_stride);
-static void * eet_data_image_lossless_convert(int *size,
- const void *data,
- unsigned int w,
- unsigned int h,
- int alpha);
-static void * eet_data_image_lossless_compressed_convert(int *size,
- const void *data,
- unsigned int w,
- unsigned int h,
- int alpha,
- int compression);
-static void * eet_data_image_jpeg_convert(int *size,
- const void *data,
- unsigned int w,
- unsigned int h,
- int alpha,
- int quality);
-static void * eet_data_image_jpeg_alpha_convert(int *size,
- const void *data,
- unsigned int w,
- unsigned int h,
- int alpha,
- int quality);
+static void _JPEGFatalErrorHandler(j_common_ptr cinfo);
+static void _JPEGErrorHandler(j_common_ptr cinfo);
+static void _JPEGErrorHandler2(j_common_ptr cinfo,
+ int msg_level);
+
+static int
+eet_data_image_jpeg_header_decode(const void *data,
+ int size,
+ unsigned int *w,
+ unsigned int *h);
+static int
+eet_data_image_jpeg_rgb_decode(const void *data,
+ int size,
+ unsigned int src_x,
+ unsigned int src_y,
+ unsigned int *d,
+ unsigned int w,
+ unsigned int h,
+ unsigned int row_stride);
+static void *
+eet_data_image_jpeg_alpha_decode(const void *data,
+ int size,
+ unsigned int src_x,
+ unsigned int src_y,
+ unsigned int *d,
+ unsigned int w,
+ unsigned int h,
+ unsigned int row_stride);
+static void *
+eet_data_image_lossless_convert(int *size,
+ const void *data,
+ unsigned int w,
+ unsigned int h,
+ int alpha);
+static void *
+eet_data_image_lossless_compressed_convert(int *size,
+ const void *data,
+ unsigned int w,
+ unsigned int h,
+ int alpha,
+ int compression);
+static void *
+eet_data_image_jpeg_convert(int *size,
+ const void *data,
+ unsigned int w,
+ unsigned int h,
+ int alpha,
+ int quality);
+static void *
+eet_data_image_jpeg_alpha_convert(int *size,
+ const void *data,
+ unsigned int w,
+ unsigned int h,
+ int alpha,
+ int quality);
/*---*/
@@ -282,23 +289,23 @@ static int _eet_image_words_bigendian = -1;
/*---*/
-#define SWAP64(x) (x) =\
- ((((unsigned long long)(x) & 0x00000000000000ffULL) << 56) |\
- (((unsigned long long)(x) & 0x000000000000ff00ULL) << 40) |\
- (((unsigned long long)(x) & 0x0000000000ff0000ULL) << 24) |\
- (((unsigned long long)(x) & 0x00000000ff000000ULL) << 8) |\
- (((unsigned long long)(x) & 0x000000ff00000000ULL) >> 8) |\
- (((unsigned long long)(x) & 0x0000ff0000000000ULL) >> 24) |\
- (((unsigned long long)(x) & 0x00ff000000000000ULL) >> 40) |\
- (((unsigned long long)(x) & 0xff00000000000000ULL) >> 56))
-#define SWAP32(x) (x) =\
- ((((int)(x) & 0x000000ff) << 24) |\
- (((int)(x) & 0x0000ff00) << 8) |\
- (((int)(x) & 0x00ff0000) >> 8) |\
- (((int)(x) & 0xff000000) >> 24))
-#define SWAP16(x) (x) =\
- ((((short)(x) & 0x00ff) << 8) |\
- (((short)(x) & 0xff00) >> 8))
+#define SWAP64(x) (x) = \
+ ((((unsigned long long)(x) & 0x00000000000000ffULL) << 56) | \
+ (((unsigned long long)(x) & 0x000000000000ff00ULL) << 40) | \
+ (((unsigned long long)(x) & 0x0000000000ff0000ULL) << 24) | \
+ (((unsigned long long)(x) & 0x00000000ff000000ULL) << 8) | \
+ (((unsigned long long)(x) & 0x000000ff00000000ULL) >> 8) | \
+ (((unsigned long long)(x) & 0x0000ff0000000000ULL) >> 24) | \
+ (((unsigned long long)(x) & 0x00ff000000000000ULL) >> 40) | \
+ (((unsigned long long)(x) & 0xff00000000000000ULL) >> 56))
+#define SWAP32(x) (x) = \
+ ((((int)(x) & 0x000000ff) << 24) | \
+ (((int)(x) & 0x0000ff00) << 8) | \
+ (((int)(x) & 0x00ff0000) >> 8) | \
+ (((int)(x) & 0xff000000) >> 24))
+#define SWAP16(x) (x) = \
+ ((((short)(x) & 0x00ff) << 8) | \
+ (((short)(x) & 0xff00) >> 8))
#ifdef CONV8
# undef CONV8
@@ -336,22 +343,22 @@ _JPEGErrorHandler(j_common_ptr cinfo __UNUSED__)
{
/* emptr errmgr; */
- /* errmgr = (emptr) cinfo->err; */
- /* cinfo->err->output_message(cinfo);*/
- /* longjmp(errmgr->setjmp_buffer, 1);*/
- return;
+ /* errmgr = (emptr) cinfo->err; */
+ /* cinfo->err->output_message(cinfo);*/
+ /* longjmp(errmgr->setjmp_buffer, 1);*/
+ return;
} /* _JPEGErrorHandler */
static void
_JPEGErrorHandler2(j_common_ptr cinfo __UNUSED__,
- int msg_level __UNUSED__)
+ int msg_level __UNUSED__)
{
/* emptr errmgr; */
- /* errmgr = (emptr) cinfo->err; */
- /* cinfo->err->output_message(cinfo);*/
- /* longjmp(errmgr->setjmp_buffer, 1);*/
- return;
+ /* errmgr = (emptr) cinfo->err; */
+ /* cinfo->err->output_message(cinfo);*/
+ /* longjmp(errmgr->setjmp_buffer, 1);*/
+ return;
} /* _JPEGErrorHandler2 */
static int
@@ -370,7 +377,7 @@ eet_data_image_jpeg_header_decode(const void *data,
jerr.pub.emit_message = _JPEGErrorHandler2;
jerr.pub.output_message = _JPEGErrorHandler;
if (setjmp(jerr.setjmp_buffer))
- return 0;
+ return 0;
jpeg_create_decompress(&cinfo);
@@ -395,7 +402,7 @@ eet_data_image_jpeg_header_decode(const void *data,
jpeg_destroy_decompress(&cinfo);
if ((*w < 1) || (*h < 1) || (*w > 8192) || (*h > 8192))
- return 0;
+ return 0;
return 1;
} /* eet_data_image_jpeg_header_decode */
@@ -420,7 +427,7 @@ eet_data_image_jpeg_rgb_decode(const void *data,
/* FIXME: handle src_x, src_y and row_stride correctly */
if (!d)
- return 0;
+ return 0;
memset(&cinfo, 0, sizeof (struct jpeg_decompress_struct));
@@ -429,7 +436,7 @@ eet_data_image_jpeg_rgb_decode(const void *data,
jerr.pub.emit_message = _JPEGErrorHandler2;
jerr.pub.output_message = _JPEGErrorHandler;
if (setjmp(jerr.setjmp_buffer))
- return 0;
+ return 0;
jpeg_create_decompress(&cinfo);
@@ -474,13 +481,13 @@ eet_data_image_jpeg_rgb_decode(const void *data,
if (cinfo.output_components == 3)
{
for (i = 0; i < (unsigned int)cinfo.rec_outbuf_height; i++)
- line[i] = tdata + (i * (iw) * 3);
+ line[i] = tdata + (i * (iw) * 3);
for (l = 0; l < ih; l += cinfo.rec_outbuf_height)
{
jpeg_read_scanlines(&cinfo, line, cinfo.rec_outbuf_height);
scans = cinfo.rec_outbuf_height;
if ((ih - l) < scans)
- scans = ih - l;
+ scans = ih - l;
ptr = tdata;
@@ -488,7 +495,7 @@ eet_data_image_jpeg_rgb_decode(const void *data,
{
y = src_y - l;
if (src_y < l)
- y = 0;
+ y = 0;
for (ptr += 3 * iw * y; y < scans && (y + l) < (src_y + h);
y++)
@@ -498,8 +505,8 @@ eet_data_image_jpeg_rgb_decode(const void *data,
for (x = 0; x < w; x++)
{
*ptr2 =
- (0xff000000) |
- ((ptr[0]) << 16) | ((ptr[1]) << 8) | (ptr[2]);
+ (0xff000000) |
+ ((ptr[0]) << 16) | ((ptr[1]) << 8) | (ptr[2]);
ptr += 3;
ptr2++;
}
@@ -512,13 +519,13 @@ eet_data_image_jpeg_rgb_decode(const void *data,
else if (cinfo.output_components == 1)
{
for (i = 0; i < (unsigned int)cinfo.rec_outbuf_height; i++)
- line[i] = tdata + (i * (iw));
+ line[i] = tdata + (i * (iw));
for (l = 0; l < (ih); l += cinfo.rec_outbuf_height)
{
jpeg_read_scanlines(&cinfo, line, cinfo.rec_outbuf_height);
scans = cinfo.rec_outbuf_height;
if (((ih) - l) < scans)
- scans = (ih) - l;
+ scans = (ih) - l;
ptr = tdata;
@@ -526,7 +533,7 @@ eet_data_image_jpeg_rgb_decode(const void *data,
{
y = src_y - l;
if (src_y < l)
- y = 0;
+ y = 0;
for (ptr += iw * y; y < scans && (y + l) < (src_y + h); y++)
{
@@ -535,8 +542,8 @@ eet_data_image_jpeg_rgb_decode(const void *data,
for (x = 0; x < w; x++)
{
*ptr2 =
- (0xff000000) |
- ((ptr[0]) << 16) | ((ptr[0]) << 8) | (ptr[0]);
+ (0xff000000) |
+ ((ptr[0]) << 16) | ((ptr[0]) << 8) | (ptr[0]);
ptr++;
ptr2++;
}
@@ -577,7 +584,7 @@ eet_data_image_jpeg_alpha_decode(const void *data,
jerr.pub.emit_message = _JPEGErrorHandler2;
jerr.pub.output_message = _JPEGErrorHandler;
if (setjmp(jerr.setjmp_buffer))
- return NULL;
+ return NULL;
jpeg_create_decompress(&cinfo);
@@ -621,13 +628,13 @@ eet_data_image_jpeg_alpha_decode(const void *data,
if (cinfo.output_components == 1)
{
for (i = 0; i < (unsigned int)cinfo.rec_outbuf_height; i++)
- line[i] = tdata + (i * w);
+ line[i] = tdata + (i * w);
for (l = 0; l < h; l += cinfo.rec_outbuf_height)
{
jpeg_read_scanlines(&cinfo, line, cinfo.rec_outbuf_height);
scans = cinfo.rec_outbuf_height;
if ((h - l) < scans)
- scans = h - l;
+ scans = h - l;
ptr = tdata;
@@ -635,7 +642,7 @@ eet_data_image_jpeg_alpha_decode(const void *data,
{
y = src_y - l;
if (src_y < l)
- y = 0;
+ y = 0;
for (ptr += iw * y; y < scans && (y + l) < (src_y + h); y++)
{
@@ -644,8 +651,8 @@ eet_data_image_jpeg_alpha_decode(const void *data,
for (x = 0; x < w; x++)
{
*ptr2 =
- ((*ptr2) & 0x00ffffff) |
- ((ptr[0]) << 24);
+ ((*ptr2) & 0x00ffffff) |
+ ((ptr[0]) << 24);
ptr++;
ptr2++;
}
@@ -675,9 +682,9 @@ eet_data_image_lossless_convert(int *size,
v = htonl(0x12345678);
if (v == 0x12345678)
- _eet_image_words_bigendian = 1;
+ _eet_image_words_bigendian = 1;
else
- _eet_image_words_bigendian = 0;
+ _eet_image_words_bigendian = 0;
}
{
@@ -686,7 +693,7 @@ eet_data_image_lossless_convert(int *size,
d = malloc((w * h * 4) + (8 * 4));
if (!d)
- return NULL;
+ return NULL;
header = (int *)d;
memset(d, 0, 32);
@@ -724,9 +731,9 @@ eet_data_image_lossless_compressed_convert(int *size,
v = htonl(0x12345678);
if (v == 0x12345678)
- _eet_image_words_bigendian = 1;
+ _eet_image_words_bigendian = 1;
else
- _eet_image_words_bigendian = 0;
+ _eet_image_words_bigendian = 0;
}
{
@@ -738,7 +745,7 @@ eet_data_image_lossless_compressed_convert(int *size,
d = malloc((w * h * 4) + (8 * 4));
if (!d)
- return NULL;
+ return NULL;
buflen = (((w * h * 101) / 100) + 3) * 4;
comp = malloc(buflen);
@@ -811,7 +818,7 @@ eet_data_image_jpeg_convert(int *size,
jerr.pub.emit_message = _JPEGErrorHandler2;
jerr.pub.output_message = _JPEGErrorHandler;
if (setjmp(jerr.setjmp_buffer))
- return NULL;
+ return NULL;
jpeg_create_compress(&cinfo);
@@ -884,9 +891,9 @@ eet_data_image_jpeg_alpha_convert(int *size,
v = htonl(0x12345678);
if (v == 0x12345678)
- _eet_image_words_bigendian = 1;
+ _eet_image_words_bigendian = 1;
else
- _eet_image_words_bigendian = 0;
+ _eet_image_words_bigendian = 0;
}
{
@@ -905,7 +912,7 @@ eet_data_image_jpeg_alpha_convert(int *size,
jerr.pub.emit_message = _JPEGErrorHandler2;
jerr.pub.output_message = _JPEGErrorHandler;
if (setjmp(jerr.setjmp_buffer))
- return NULL;
+ return NULL;
jpeg_create_compress(&cinfo);
if (eet_jpeg_membuf_dst(&cinfo, &dst, &sz))
@@ -1042,7 +1049,7 @@ eet_data_image_jpeg_alpha_convert(int *size,
for (i = 0; i < 3; i++) SWAP32(header[i]);
}
- memcpy(d + 12, d1, sz1);
+ memcpy(d + 12, d1, sz1);
memcpy(d + 12 + sz1, d2, sz2);
free(d1);
@@ -1119,20 +1126,20 @@ eet_data_image_read_cipher(Eet_File *ef,
int size;
if (!cipher_key)
- data = (void *)eet_read_direct(ef, name, &size);
+ data = (void *)eet_read_direct(ef, name, &size);
if (!data)
{
data = eet_read_cipher(ef, name, &size, cipher_key);
free_data = 1;
if (!data)
- return NULL;
+ return NULL;
}
d = eet_data_image_decode(data, size, w, h, alpha, comp, quality, lossy);
if (free_data)
- free(data);
+ free(data);
return d;
} /* eet_data_image_read_cipher */
@@ -1172,14 +1179,14 @@ eet_data_image_read_to_surface_cipher(Eet_File *ef,
int size;
if (!cipher_key)
- data = (void *)eet_read_direct(ef, name, &size);
+ data = (void *)eet_read_direct(ef, name, &size);
if (!data)
{
data = eet_read_cipher(ef, name, &size, cipher_key);
free_data = 1;
if (!data)
- return 0;
+ return 0;
}
res = eet_data_image_decode_to_surface(data, size, src_x, src_y, d,
@@ -1187,7 +1194,7 @@ eet_data_image_read_to_surface_cipher(Eet_File *ef,
comp, quality, lossy);
if (free_data)
- free(data);
+ free(data);
return res;
} /* eet_data_image_read_to_surface_cipher */
@@ -1230,20 +1237,20 @@ eet_data_image_header_read_cipher(Eet_File *ef,
int d;
if (!cipher_key)
- data = (void *)eet_read_direct(ef, name, &size);
+ data = (void *)eet_read_direct(ef, name, &size);
if (!data)
{
data = eet_read_cipher(ef, name, &size, cipher_key);
free_data = 1;
if (!data)
- return 0;
+ return 0;
}
d = eet_data_image_header_decode(data, size, w, h, alpha,
comp, quality, lossy);
if (free_data)
- free(data);
+ free(data);
return d;
} /* eet_data_image_header_read_cipher */
@@ -1282,21 +1289,21 @@ eet_data_image_encode_cipher(const void *data,
if (lossy == 0)
{
if (comp > 0)
- d = eet_data_image_lossless_compressed_convert(&size, data,
- w, h, alpha, comp);
+ d = eet_data_image_lossless_compressed_convert(&size, data,
+ w, h, alpha, comp);
/* eet_data_image_lossless_compressed_convert will refuse to compress something
if the result is bigger than the entry. */
if (comp <= 0 || !d)
- d = eet_data_image_lossless_convert(&size, data, w, h, alpha);
+ d = eet_data_image_lossless_convert(&size, data, w, h, alpha);
}
else
{
if (!alpha)
- d = eet_data_image_jpeg_convert(&size, data, w, h, alpha, quality);
+ d = eet_data_image_jpeg_convert(&size, data, w, h, alpha, quality);
else
- d = eet_data_image_jpeg_alpha_convert(&size, data,
- w, h, alpha, quality);
+ d = eet_data_image_jpeg_alpha_convert(&size, data,
+ w, h, alpha, quality);
}
if (cipher_key)
@@ -1305,18 +1312,18 @@ eet_data_image_encode_cipher(const void *data,
&ciphered_sz))
{
if (d)
- free(d);
+ free(d);
d = ciphered_d;
size = ciphered_sz;
}
else
if (ciphered_d)
- free(ciphered_d);
+ free(ciphered_d);
}
if (size_ret)
- *size_ret = size;
+ *size_ret = size;
return d;
} /* eet_data_image_encode_cipher */
@@ -1360,7 +1367,7 @@ eet_data_image_header_decode_cipher(const void *data,
}
else
if (deciphered_d)
- free(deciphered_d);
+ free(deciphered_d);
}
if (_eet_image_words_bigendian == -1)
@@ -1369,13 +1376,13 @@ eet_data_image_header_decode_cipher(const void *data,
v = htonl(0x12345678);
if (v == 0x12345678)
- _eet_image_words_bigendian = 1;
+ _eet_image_words_bigendian = 1;
else
- _eet_image_words_bigendian = 0;
+ _eet_image_words_bigendian = 0;
}
if (size < 32)
- return 0;
+ return 0;
memcpy(header, data, 32);
if (_eet_image_words_bigendian)
@@ -1394,28 +1401,28 @@ eet_data_image_header_decode_cipher(const void *data,
al = header[3];
cp = header[4];
if ((iw < 1) || (ih < 1) || (iw > 8192) || (ih > 8192))
- return 0;
+ return 0;
if ((cp == 0) && (size < ((iw * ih * 4) + 32)))
- return 0;
+ return 0;
if (w)
- *w = iw;
+ *w = iw;
if (h)
- *h = ih;
+ *h = ih;
if (alpha)
- *alpha = al ? 1 : 0;
+ *alpha = al ? 1 : 0;
if (comp)
- *comp = cp;
+ *comp = cp;
if (lossy)
- *lossy = 0;
+ *lossy = 0;
if (quality)
- *quality = 100;
+ *quality = 100;
return 1;
}
@@ -1434,22 +1441,22 @@ eet_data_image_header_decode_cipher(const void *data,
if (ok)
{
if (w)
- *w = iw;
+ *w = iw;
if (h)
- *h = ih;
+ *h = ih;
if (alpha)
- *alpha = 1;
+ *alpha = 1;
if (comp)
- *comp = 0;
+ *comp = 0;
if (lossy)
- *lossy = 1;
+ *lossy = 1;
if (quality)
- *quality = 75;
+ *quality = 75;
return 1;
}
@@ -1463,22 +1470,22 @@ eet_data_image_header_decode_cipher(const void *data,
if (ok)
{
if (w)
- *w = iw;
+ *w = iw;
if (h)
- *h = ih;
+ *h = ih;
if (alpha)
- *alpha = 0;
+ *alpha = 0;
if (comp)
- *comp = 0;
+ *comp = 0;
if (lossy)
- *lossy = 1;
+ *lossy = 1;
if (quality)
- *quality = 75;
+ *quality = 75;
return 1;
}
@@ -1521,14 +1528,14 @@ _eet_data_image_copy_buffer(const unsigned int *src,
src += src_x + src_y * src_w;
if (row_stride == src_w * 4 && w == src_w)
- memcpy(dst, src, row_stride * h);
+ memcpy(dst, src, row_stride * h);
else
{
unsigned int *over = dst;
unsigned int y;
for (y = 0; y < h; ++y, src += src_w, over += row_stride)
- memcpy(over, src, w * 4);
+ memcpy(over, src, w * 4);
}
} /* _eet_data_image_copy_buffer */
@@ -1554,8 +1561,8 @@ _eet_data_image_decode_inside(const void *data,
body = ((unsigned int *)data) + 8;
if (!comp)
- _eet_data_image_copy_buffer(body, src_x, src_y, src_w, d,
- w, h, row_stride);
+ _eet_data_image_copy_buffer(body, src_x, src_y, src_w, d,
+ w, h, row_stride);
else
{
if (src_h == h && src_w == w && row_stride == src_w * 4)
@@ -1571,11 +1578,11 @@ _eet_data_image_decode_inside(const void *data,
Bytef *dtmp;
uLongf dlen = src_w * src_h * 4;
- /* FIXME: This could create a huge alloc. So compressed
- data and tile could not always work. */
+ /* FIXME: This could create a huge alloc. So compressed
+ data and tile could not always work. */
dtmp = malloc(dlen);
if (!dtmp)
- return 0;
+ return 0;
uncompress(dtmp, &dlen, (Bytef *)body, (uLongf)(size - 32));
@@ -1622,15 +1629,15 @@ _eet_data_image_decode_inside(const void *data,
dt += sz1;
if (!eet_data_image_jpeg_alpha_decode(dt, sz2, src_x, src_y,
d, w, h, row_stride))
- return 0;
+ return 0;
}
}
else if (!eet_data_image_jpeg_rgb_decode(data, size, src_x, src_y, d, w,
h, row_stride))
- return 0;
+ return 0;
}
else
- abort();
+ abort();
return 1;
} /* _eet_data_image_decode_inside */
@@ -1662,17 +1669,17 @@ eet_data_image_decode_cipher(const void *data,
}
else
if (deciphered_d)
- free(deciphered_d);
+ free(deciphered_d);
}
/* All check are done during header decode, this simplify the code a lot. */
if (!eet_data_image_header_decode(data, size, &iw, &ih, &ialpha, &icompress,
&iquality, &ilossy))
- return NULL;
+ return NULL;
d = malloc(iw * ih * 4);
if (!d)
- return NULL;
+ return NULL;
if (!_eet_data_image_decode_inside(data, size, 0, 0, iw, ih, d, iw, ih, iw *
4, ialpha, icompress, iquality, ilossy))
@@ -1682,22 +1689,22 @@ eet_data_image_decode_cipher(const void *data,
}
if (w)
- *w = iw;
+ *w = iw;
if (h)
- *h = ih;
+ *h = ih;
if (alpha)
- *alpha = ialpha;
+ *alpha = ialpha;
if (comp)
- *comp = icompress;
+ *comp = icompress;
if (quality)
- *quality = iquality;
+ *quality = iquality;
if (lossy)
- *lossy = ilossy;
+ *lossy = ilossy;
return d;
} /* eet_data_image_decode_cipher */
@@ -1746,39 +1753,39 @@ eet_data_image_decode_to_surface_cipher(const void *data,
}
else
if (deciphered_d)
- free(deciphered_d);
+ free(deciphered_d);
}
/* All check are done during header decode, this simplify the code a lot. */
if (!eet_data_image_header_decode(data, size, &iw, &ih, &ialpha, &icompress,
&iquality, &ilossy))
- return 0;
+ return 0;
if (!d)
- return 0;
+ return 0;
if (w * 4 > row_stride)
- return 0;
+ return 0;
if (w > iw || h > ih)
- return 0;
+ return 0;
if (!_eet_data_image_decode_inside(data, size, src_x, src_y, iw, ih, d, w, h,
row_stride, ialpha, icompress, iquality,
ilossy))
- return 0;
+ return 0;
if (alpha)
- *alpha = ialpha;
+ *alpha = ialpha;
if (comp)
- *comp = icompress;
+ *comp = icompress;
if (quality)
- *quality = iquality;
+ *quality = iquality;
if (lossy)
- *lossy = ilossy;
+ *lossy = ilossy;
return 1;
} /* eet_data_image_decode_to_surface_cipher */
@@ -1798,8 +1805,8 @@ eet_data_image_decode_to_surface(const void *data,
int *lossy)
{
return eet_data_image_decode_to_surface_cipher(data, NULL, size,
- src_x, src_y, d,
- w, h, row_stride,
+ src_x, src_y, d,
+ w, h, row_stride,
alpha, comp, quality,
lossy);
} /* eet_data_image_decode_to_surface */
diff --git a/src/lib/eet_lib.c b/src/lib/eet_lib.c
index 594ecca..a0d6435 100644
--- a/src/lib/eet_lib.c
+++ b/src/lib/eet_lib.c
@@ -16,7 +16,7 @@
# ifdef __cplusplus
extern "C"
# endif /* ifdef __cplusplus */
-void * alloca (size_t);
+void *alloca(size_t);
#endif /* ifdef HAVE_ALLOCA_H */
#ifdef _WIN32
@@ -66,7 +66,6 @@ GCRY_THREAD_OPTION_PTHREAD_IMPL;
#include "Eet.h"
#include "Eet_private.h"
-
#ifndef O_BINARY
# define O_BINARY 0
#endif
@@ -83,9 +82,9 @@ EAPI Eet_Version *eet_version = &_version;
#define EET_MAGIC_FILE2 0x1ee70f42
-typedef struct _Eet_File_Header Eet_File_Header;
-typedef struct _Eet_File_Node Eet_File_Node;
-typedef struct _Eet_File_Directory Eet_File_Directory;
+typedef struct _Eet_File_Header Eet_File_Header;
+typedef struct _Eet_File_Node Eet_File_Node;
+typedef struct _Eet_File_Directory Eet_File_Directory;
struct _Eet_File
{
@@ -129,22 +128,22 @@ struct _Eet_File_Directory
struct _Eet_File_Node
{
- char *name;
- void *data;
- Eet_File_Node *next; /* FIXME: make buckets linked lists */
-
- unsigned long int offset;
- unsigned long int dictionary_offset;
- unsigned long int name_offset;
-
- unsigned int name_size;
- unsigned int size;
- unsigned int data_size;
-
- unsigned char free_name : 1;
- unsigned char compression : 1;
- unsigned char ciphered : 1;
- unsigned char alias : 1;
+ char *name;
+ void *data;
+ Eet_File_Node *next; /* FIXME: make buckets linked lists */
+
+ unsigned long int offset;
+ unsigned long int dictionary_offset;
+ unsigned long int name_offset;
+
+ unsigned int name_size;
+ unsigned int size;
+ unsigned int data_size;
+
+ unsigned char free_name : 1;
+ unsigned char compression : 1;
+ unsigned char ciphered : 1;
+ unsigned char alias : 1;
};
#if 0
@@ -207,42 +206,54 @@ char x509[x509_length]; /* The public certificate. */
#define EET_FILE2_DIRECTORY_ENTRY_COUNT 6
#define EET_FILE2_DICTIONARY_ENTRY_COUNT 5
-#define EET_FILE2_HEADER_SIZE (sizeof(int) *\
+#define EET_FILE2_HEADER_SIZE (sizeof(int) * \
EET_FILE2_HEADER_COUNT)
-#define EET_FILE2_DIRECTORY_ENTRY_SIZE (sizeof(int) *\
+#define EET_FILE2_DIRECTORY_ENTRY_SIZE (sizeof(int) * \
EET_FILE2_DIRECTORY_ENTRY_COUNT)
-#define EET_FILE2_DICTIONARY_ENTRY_SIZE (sizeof(int) *\
+#define EET_FILE2_DICTIONARY_ENTRY_SIZE (sizeof(int) * \
EET_FILE2_DICTIONARY_ENTRY_COUNT)
/* prototypes of internal calls */
-static Eet_File * eet_cache_find(const char *path,
- Eet_File **cache,
- int cache_num);
-static void eet_cache_add(Eet_File *ef,
- Eet_File ***cache,
- int *cache_num,
- int *cache_alloc);
-static void eet_cache_del(Eet_File *ef,
- Eet_File ***cache,
- int *cache_num,
- int *cache_alloc);
-static int eet_string_match(const char *s1, const char *s2);
+static Eet_File *
+eet_cache_find(const char *path,
+ Eet_File **cache,
+ int cache_num);
+static void
+eet_cache_add(Eet_File *ef,
+ Eet_File ***cache,
+ int *cache_num,
+ int *cache_alloc);
+static void
+eet_cache_del(Eet_File *ef,
+ Eet_File ***cache,
+ int *cache_num,
+ int *cache_alloc);
+static int
+eet_string_match(const char *s1,
+ const char *s2);
#if 0 /* Unused */
-static Eet_Error eet_flush(Eet_File *ef);
+static Eet_Error
+eet_flush(Eet_File *ef);
#endif /* if 0 */
-static Eet_Error eet_flush2(Eet_File *ef);
-static Eet_File_Node * find_node_by_name(Eet_File *ef, const char *name);
-static int read_data_from_disk(Eet_File *ef,
- Eet_File_Node *efn,
- void *buf,
- int len);
+static Eet_Error
+ eet_flush2(Eet_File *ef);
+static Eet_File_Node *
+ find_node_by_name(Eet_File *ef,
+ const char *name);
+static int
+read_data_from_disk(Eet_File *ef,
+ Eet_File_Node *efn,
+ void *buf,
+ int len);
-static Eet_Error eet_internal_close(Eet_File *ef, Eina_Bool locked);
+static Eet_Error
+eet_internal_close(Eet_File *ef,
+ Eina_Bool locked);
-static Eina_Lock eet_cache_lock;
+static Eina_Lock eet_cache_lock;
-#define LOCK_CACHE eina_lock_take(&eet_cache_lock)
-#define UNLOCK_CACHE eina_lock_release(&eet_cache_lock)
+#define LOCK_CACHE eina_lock_take(&eet_cache_lock)
+#define UNLOCK_CACHE eina_lock_release(&eet_cache_lock)
#define INIT_FILE(File) eina_lock_new(&File->file_lock)
#define LOCK_FILE(File) eina_lock_take(&File->file_lock)
@@ -266,7 +277,7 @@ static inline int
eet_check_pointer(const Eet_File *ef)
{
if ((!ef) || (ef->magic != EET_MAGIC_FILE))
- return 1;
+ return 1;
return 0;
} /* eet_check_pointer */
@@ -275,10 +286,10 @@ static inline int
eet_check_header(const Eet_File *ef)
{
if (!ef->header)
- return 1;
+ return 1;
if (!ef->header->directory)
- return 1;
+ return 1;
return 0;
} /* eet_check_header */
@@ -308,10 +319,9 @@ eet_cache_find(const char *path,
for (i = 0; i < cache_num; i++)
{
/* if matches real path - return it */
- if (eet_string_match(cache[i]->path, path))
+ if (eet_string_match(cache[i]->path, path))
if (!cache[i]->delete_me_now)
- return cache[i];
-
+ return cache[i];
}
/* not found */
@@ -390,20 +400,20 @@ eet_cache_del(Eet_File *ef,
new_cache_num = *cache_num;
new_cache_alloc = *cache_alloc;
if (new_cache_num <= 0)
- return;
+ return;
for (i = 0; i < new_cache_num; i++)
{
if (new_cache[i] == ef)
- break;
+ break;
}
if (i >= new_cache_num)
- return;
+ return;
new_cache_num--;
for (j = i; j < new_cache_num; j++)
- new_cache[j] = new_cache[j + 1];
+ new_cache[j] = new_cache[j + 1];
if (new_cache_num <= (new_cache_alloc - 16))
{
@@ -435,13 +445,13 @@ eet_string_match(const char *s1,
const char *s2)
{
/* both null- no match */
- if ((!s1) || (!s2))
+ if ((!s1) || (!s2))
return 0;
- if (s1 == s2)
+ if (s1 == s2)
return 1;
- return (!strcmp(s1, s2));
+ return !strcmp(s1, s2);
} /* eet_string_match */
/* flush out writes to a v2 eet file */
@@ -464,13 +474,13 @@ eet_flush2(Eet_File *ef)
int j;
if (eet_check_pointer(ef))
- return EET_ERROR_BAD_OBJECT;
+ return EET_ERROR_BAD_OBJECT;
if (eet_check_header(ef))
- return EET_ERROR_EMPTY;
+ return EET_ERROR_EMPTY;
if (!ef->writes_pending)
- return EET_ERROR_NONE;
+ return EET_ERROR_NONE;
if ((ef->mode == EET_FILE_MODE_READ_WRITE)
|| (ef->mode == EET_FILE_MODE_WRITE))
@@ -482,12 +492,12 @@ eet_flush2(Eet_File *ef)
fd = open(ef->path, O_CREAT | O_TRUNC | O_RDWR | O_BINARY, S_IRUSR | S_IWUSR);
fp = fdopen(fd, "wb");
if (!fp)
- return EET_ERROR_NOT_WRITABLE;
+ return EET_ERROR_NOT_WRITABLE;
fcntl(fileno(fp), F_SETFD, FD_CLOEXEC);
}
else
- return EET_ERROR_NOT_WRITABLE;
+ return EET_ERROR_NOT_WRITABLE;
/* calculate string base offset and data base offset */
num = (1 << ef->header->directory->size);
@@ -504,19 +514,19 @@ eet_flush2(Eet_File *ef)
num_dictionary_entries = ef->ed->count;
for (i = 0; i < num_dictionary_entries; ++i)
- bytes_strings += ef->ed->all[i].len;
+ bytes_strings += ef->ed->all[i].len;
}
/* calculate section bytes size */
bytes_directory_entries = EET_FILE2_DIRECTORY_ENTRY_SIZE *
- num_directory_entries + EET_FILE2_HEADER_SIZE;
+ num_directory_entries + EET_FILE2_HEADER_SIZE;
bytes_dictionary_entries = EET_FILE2_DICTIONARY_ENTRY_SIZE *
- num_dictionary_entries;
+ num_dictionary_entries;
/* calculate per entry offset */
strings_offset = bytes_directory_entries + bytes_dictionary_entries;
data_offset = bytes_directory_entries + bytes_dictionary_entries +
- bytes_strings;
+ bytes_strings;
for (i = 0; i < num; ++i)
{
@@ -532,7 +542,7 @@ eet_flush2(Eet_File *ef)
/* calculate dictionary strings offset */
if (ef->ed)
- ef->ed->offset = strings_offset;
+ ef->ed->offset = strings_offset;
/* go thru and write the header */
head[0] = (int)htonl((unsigned int)EET_MAGIC_FILE2);
@@ -541,7 +551,7 @@ eet_flush2(Eet_File *ef)
fseek(fp, 0, SEEK_SET);
if (fwrite(head, sizeof (head), 1, fp) != 1)
- goto write_error;
+ goto write_error;
/* write directories entry */
for (i = 0; i < num; i++)
@@ -561,7 +571,7 @@ eet_flush2(Eet_File *ef)
ibuf[5] = (int)htonl((unsigned int)flag);
if (fwrite(ibuf, sizeof(ibuf), 1, fp) != 1)
- goto write_error;
+ goto write_error;
}
}
@@ -583,7 +593,7 @@ eet_flush2(Eet_File *ef)
offset += ef->ed->all[j].len;
if (fwrite(sbuf, sizeof (sbuf), 1, fp) != 1)
- goto write_error;
+ goto write_error;
}
}
@@ -593,17 +603,17 @@ eet_flush2(Eet_File *ef)
for (efn = ef->header->directory->nodes[i]; efn; efn = efn->next)
{
if (fwrite(efn->name, efn->name_size, 1, fp) != 1)
- goto write_error;
+ goto write_error;
}
}
/* write strings */
if (ef->ed)
- for (j = 0; j < ef->ed->count; ++j)
- {
- if (fwrite(ef->ed->all[j].str, ef->ed->all[j].len, 1, fp) != 1)
- goto write_error;
- }
+ for (j = 0; j < ef->ed->count; ++j)
+ {
+ if (fwrite(ef->ed->all[j].str, ef->ed->all[j].len, 1, fp) != 1)
+ goto write_error;
+ }
/* write data */
for (i = 0; i < num; i++)
@@ -611,7 +621,7 @@ eet_flush2(Eet_File *ef)
for (efn = ef->header->directory->nodes[i]; efn; efn = efn->next)
{
if (fwrite(efn->data, efn->size, 1, fp) != 1)
- goto write_error;
+ goto write_error;
}
}
@@ -631,7 +641,7 @@ eet_flush2(Eet_File *ef)
{
error = eet_identity_sign(fp, ef->key);
if (error != EET_ERROR_NONE)
- goto sign_error;
+ goto sign_error;
}
/* no more writes pending */
@@ -667,7 +677,7 @@ EAPI int
eet_init(void)
{
if (++eet_init_count != 1)
- return eet_init_count;
+ return eet_init_count;
if (!eina_init())
{
@@ -698,26 +708,26 @@ eet_init(void)
/* Disable warning messages about problems with the secure memory subsystem.
This command should be run right after gcry_check_version. */
if (gcry_control(GCRYCTL_DISABLE_SECMEM_WARN))
- goto shutdown_eet; /* This command is used to allocate a pool of secure memory and thus
- enabling the use of secure memory. It also drops all extra privileges the
- process has (i.e. if it is run as setuid (root)). If the argument nbytes
- is 0, secure memory will be disabled. The minimum amount of secure memory
- allocated is currently 16384 bytes; you may thus use a value of 1 to
- request that default size. */
+ goto shutdown_eet; /* This command is used to allocate a pool of secure memory and thus
+ enabling the use of secure memory. It also drops all extra privileges the
+ process has (i.e. if it is run as setuid (root)). If the argument nbytes
+ is 0, secure memory will be disabled. The minimum amount of secure memory
+ allocated is currently 16384 bytes; you may thus use a value of 1 to
+ request that default size. */
if (gcry_control(GCRYCTL_INIT_SECMEM, 16384, 0))
- WRN(
- "BIG FAT WARNING: I AM UNABLE TO REQUEST SECMEM, Cryptographic operation are at risk !");
+ WRN(
+ "BIG FAT WARNING: I AM UNABLE TO REQUEST SECMEM, Cryptographic operation are at risk !");
}
# ifdef EINA_HAVE_THREADS
if (gcry_control(GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread))
- WRN(
- "YOU ARE USING PTHREADS, BUT I CANNOT INITIALIZE THREADSAFE GCRYPT OPERATIONS!");
+ WRN(
+ "YOU ARE USING PTHREADS, BUT I CANNOT INITIALIZE THREADSAFE GCRYPT OPERATIONS!");
# endif /* ifdef EINA_HAVE_THREADS */
if (gnutls_global_init())
- goto shutdown_eet;
+ goto shutdown_eet;
#endif /* ifdef HAVE_GNUTLS */
#ifdef HAVE_OPENSSL
@@ -743,7 +753,7 @@ EAPI int
eet_shutdown(void)
{
if (--eet_init_count != 0)
- return eet_init_count;
+ return eet_init_count;
eet_clearcache();
eet_node_shutdown();
@@ -770,14 +780,14 @@ eet_sync(Eet_File *ef)
Eet_Error ret;
if (eet_check_pointer(ef))
- return EET_ERROR_BAD_OBJECT;
+ return EET_ERROR_BAD_OBJECT;
if ((ef->mode != EET_FILE_MODE_WRITE) &&
(ef->mode != EET_FILE_MODE_READ_WRITE))
- return EET_ERROR_NOT_WRITABLE;
+ return EET_ERROR_NOT_WRITABLE;
if (!ef->writes_pending)
- return EET_ERROR_NONE;
+ return EET_ERROR_NONE;
LOCK_FILE(ef);
@@ -801,13 +811,13 @@ eet_clearcache(void)
for (i = 0; i < eet_writers_num; i++)
{
if (eet_writers[i]->references <= 0)
- num++;
+ num++;
}
for (i = 0; i < eet_readers_num; i++)
{
if (eet_readers[i]->references <= 0)
- num++;
+ num++;
}
if (num > 0)
@@ -861,55 +871,55 @@ eet_internal_read2(Eet_File *ef)
idx += sizeof(int);
if (eet_test_close((int)ntohl(*data) != EET_MAGIC_FILE2, ef))
- return NULL;
+ return NULL;
data++;
-#define GET_INT(Value, Pointer, Index)\
- {\
- Value = ntohl(*Pointer);\
- Pointer++;\
- Index += sizeof(int);\
- }
+#define GET_INT(Value, Pointer, Index) \
+ { \
+ Value = ntohl(*Pointer); \
+ Pointer++; \
+ Index += sizeof(int); \
+ }
/* get entries count and byte count */
- GET_INT(num_directory_entries, data, idx);
+ GET_INT(num_directory_entries, data, idx);
/* get dictionary count and byte count */
GET_INT(num_dictionary_entries, data, idx);
bytes_directory_entries = EET_FILE2_DIRECTORY_ENTRY_SIZE *
- num_directory_entries + EET_FILE2_HEADER_SIZE;
+ num_directory_entries + EET_FILE2_HEADER_SIZE;
bytes_dictionary_entries = EET_FILE2_DICTIONARY_ENTRY_SIZE *
- num_dictionary_entries;
+ num_dictionary_entries;
/* we can't have > 0x7fffffff values here - invalid */
if (eet_test_close((num_directory_entries > 0x7fffffff), ef))
- return NULL;
+ return NULL;
/* we can't have more bytes directory and bytes in dictionaries than the size of the file */
if (eet_test_close((bytes_directory_entries + bytes_dictionary_entries) >
ef->data_size, ef))
- return NULL;
+ return NULL;
/* allocate header */
ef->header = calloc(1, sizeof(Eet_File_Header));
if (eet_test_close(!ef->header, ef))
- return NULL;
+ return NULL;
ef->header->magic = EET_MAGIC_FILE_HEADER;
/* allocate directory block in ram */
ef->header->directory = calloc(1, sizeof(Eet_File_Directory));
if (eet_test_close(!ef->header->directory, ef))
- return NULL;
+ return NULL;
/* 8 bit hash table (256 buckets) */
ef->header->directory->size = 8;
/* allocate base hash table */
ef->header->directory->nodes =
- calloc(1, sizeof(Eet_File_Node *) * (1 << ef->header->directory->size));
+ calloc(1, sizeof(Eet_File_Node *) * (1 << ef->header->directory->size));
if (eet_test_close(!ef->header->directory->nodes, ef))
- return NULL;
+ return NULL;
signature_base_offset = 0;
if (num_directory_entries == 0)
@@ -932,30 +942,30 @@ eet_internal_read2(Eet_File *ef)
efn = malloc(sizeof(Eet_File_Node));
if (eet_test_close(!efn, ef))
{
- if (efn) free(efn); /* yes i know - we only get here if
- * efn is null/0 -> trying to shut up
- * warning tools like cppcheck */
+ if (efn) free(efn); /* yes i know - we only get here if
+ * efn is null/0 -> trying to shut up
+ * warning tools like cppcheck */
return NULL;
}
/* get entrie header */
- GET_INT(efn->offset, data, idx);
- GET_INT(efn->size, data, idx);
+ GET_INT(efn->offset, data, idx);
+ GET_INT(efn->size, data, idx);
GET_INT(efn->data_size, data, idx);
- GET_INT(name_offset, data, idx);
- GET_INT(name_size, data, idx);
- GET_INT(flag, data, idx);
+ GET_INT(name_offset, data, idx);
+ GET_INT(name_size, data, idx);
+ GET_INT(flag, data, idx);
efn->compression = flag & 0x1 ? 1 : 0;
efn->ciphered = flag & 0x2 ? 1 : 0;
efn->alias = flag & 0x4 ? 1 : 0;
-#define EFN_TEST(Test, Ef, Efn)\
- if (eet_test_close(Test, Ef))\
- {\
- free(Efn);\
- return NULL;\
- }
+#define EFN_TEST(Test, Ef, Efn) \
+ if (eet_test_close(Test, Ef)) \
+ { \
+ free(Efn); \
+ return NULL; \
+ }
/* check data pointer position */
EFN_TEST(!((efn->size > 0)
@@ -984,17 +994,17 @@ eet_internal_read2(Eet_File *ef)
/* read-only mode, so currently we have no data loaded */
if (ef->mode == EET_FILE_MODE_READ)
- efn->data = NULL; /* read-write mode - read everything into ram */
+ efn->data = NULL; /* read-write mode - read everything into ram */
else
{
efn->data = malloc(efn->size);
if (efn->data)
- memcpy(efn->data, ef->data + efn->offset, efn->size);
+ memcpy(efn->data, ef->data + efn->offset, efn->size);
}
/* compute the possible position of a signature */
if (signature_base_offset < efn->offset + efn->size)
- signature_base_offset = efn->offset + efn->size;
+ signature_base_offset = efn->offset + efn->size;
}
ef->ed = NULL;
@@ -1002,28 +1012,28 @@ eet_internal_read2(Eet_File *ef)
if (num_dictionary_entries)
{
const int *dico = (const int *)ef->data +
- EET_FILE2_DIRECTORY_ENTRY_COUNT * num_directory_entries +
- EET_FILE2_HEADER_COUNT;
+ EET_FILE2_DIRECTORY_ENTRY_COUNT * num_directory_entries +
+ EET_FILE2_HEADER_COUNT;
int j;
if (eet_test_close((num_dictionary_entries *
(int)EET_FILE2_DICTIONARY_ENTRY_SIZE + idx) >
(bytes_dictionary_entries + bytes_directory_entries),
ef))
- return NULL;
+ return NULL;
ef->ed = calloc(1, sizeof (Eet_Dictionary));
if (eet_test_close(!ef->ed, ef))
- return NULL;
+ return NULL;
ef->ed->all = calloc(num_dictionary_entries, sizeof (Eet_String));
if (eet_test_close(!ef->ed->all, ef))
- return NULL;
+ return NULL;
ef->ed->count = num_dictionary_entries;
ef->ed->total = num_dictionary_entries;
ef->ed->start = start + bytes_dictionary_entries +
- bytes_directory_entries;
+ bytes_directory_entries;
ef->ed->end = ef->ed->start;
for (j = 0; j < ef->ed->count; ++j)
@@ -1031,16 +1041,16 @@ eet_internal_read2(Eet_File *ef)
unsigned int offset;
int hash;
- GET_INT(hash, dico, idx);
- GET_INT(offset, dico, idx);
- GET_INT(ef->ed->all[j].len, dico, idx);
+ GET_INT(hash, dico, idx);
+ GET_INT(offset, dico, idx);
+ GET_INT(ef->ed->all[j].len, dico, idx);
GET_INT(ef->ed->all[j].prev, dico, idx);
GET_INT(ef->ed->all[j].next, dico, idx);
/* Hash value could be stored on 8bits data, but this will break alignment of all the others data.
So stick to int and check the value. */
if (eet_test_close(hash & 0xFFFFFF00, ef))
- return NULL;
+ return NULL;
/* Check string position */
if (eet_test_close(!((ef->ed->all[j].len > 0)
@@ -1049,25 +1059,25 @@ eet_internal_read2(Eet_File *ef)
bytes_directory_entries))
&& (offset + ef->ed->all[j].len <
ef->data_size)), ef))
- return NULL;
+ return NULL;
ef->ed->all[j].str = start + offset;
if (ef->ed->all[j].str + ef->ed->all[j].len > ef->ed->end)
- ef->ed->end = ef->ed->all[j].str + ef->ed->all[j].len;
+ ef->ed->end = ef->ed->all[j].str + ef->ed->all[j].len;
/* Check '\0' at the end of the string */
if (eet_test_close(ef->ed->all[j].str[ef->ed->all[j].len - 1] !=
'\0', ef))
- return NULL;
+ return NULL;
ef->ed->all[j].hash = hash;
if (ef->ed->all[j].prev == -1)
- ef->ed->hash[hash] = j;
+ ef->ed->hash[hash] = j;
/* compute the possible position of a signature */
if (signature_base_offset < offset + ef->ed->all[j].len)
- signature_base_offset = offset + ef->ed->all[j].len;
+ signature_base_offset = offset + ef->ed->all[j].len;
}
}
@@ -1081,7 +1091,7 @@ eet_internal_read2(Eet_File *ef)
{
#ifdef HAVE_SIGNATURE
const unsigned char *buffer = ((const unsigned char *)ef->data) +
- signature_base_offset;
+ signature_base_offset;
ef->x509_der = eet_identity_check(ef->data,
signature_base_offset,
&ef->sha1,
@@ -1093,11 +1103,11 @@ eet_internal_read2(Eet_File *ef)
&ef->x509_length);
if (eet_test_close(!ef->x509_der, ef))
- return NULL;
+ return NULL;
#else /* ifdef HAVE_SIGNATURE */
ERR(
- "This file could be signed but you didn't compile the necessary code to check the signature.");
+ "This file could be signed but you didn't compile the necessary code to check the signature.");
#endif /* ifdef HAVE_SIGNATURE */
}
@@ -1116,60 +1126,60 @@ eet_internal_read1(Eet_File *ef)
int idx = 0;
WRN(
- "EET file format of '%s' is deprecated. You should just open it one time with mode == EET_FILE_MODE_READ_WRITE to solve this issue.",
- ef->path);
+ "EET file format of '%s' is deprecated. You should just open it one time with mode == EET_FILE_MODE_READ_WRITE to solve this issue.",
+ ef->path);
/* build header table if read mode */
/* geat header */
idx += sizeof(int);
if (eet_test_close((int)ntohl(*((int *)ef->data)) != EET_MAGIC_FILE, ef))
- return NULL;
+ return NULL;
-#define EXTRACT_INT(Value, Pointer, Index)\
- {\
- int tmp;\
- memcpy(&tmp, Pointer + Index, sizeof(int));\
- Value = ntohl(tmp);\
- Index += sizeof(int);\
- }
+#define EXTRACT_INT(Value, Pointer, Index) \
+ { \
+ int tmp; \
+ memcpy(&tmp, Pointer + Index, sizeof(int)); \
+ Value = ntohl(tmp); \
+ Index += sizeof(int); \
+ }
/* get entries count and byte count */
- EXTRACT_INT(num_entries, ef->data, idx);
+ EXTRACT_INT(num_entries, ef->data, idx);
EXTRACT_INT(byte_entries, ef->data, idx);
/* we can't have <= 0 values here - invalid */
- if (eet_test_close((num_entries > 0x7fffffff) ||
+ if (eet_test_close((num_entries > 0x7fffffff) ||
(byte_entries > 0x7fffffff), ef))
- return NULL;
+ return NULL;
/* we can't have more entires than minimum bytes for those! invalid! */
if (eet_test_close((num_entries * 20) > byte_entries, ef))
- return NULL;
+ return NULL;
/* check we will not outrun the file limit */
- if (eet_test_close(((byte_entries + (int)(sizeof(int) * 3)) >
+ if (eet_test_close(((byte_entries + (int)(sizeof(int) * 3)) >
ef->data_size), ef))
- return NULL;
+ return NULL;
/* allocate header */
ef->header = calloc(1, sizeof(Eet_File_Header));
if (eet_test_close(!ef->header, ef))
- return NULL;
+ return NULL;
ef->header->magic = EET_MAGIC_FILE_HEADER;
/* allocate directory block in ram */
ef->header->directory = calloc(1, sizeof(Eet_File_Directory));
if (eet_test_close(!ef->header->directory, ef))
- return NULL;
+ return NULL;
/* 8 bit hash table (256 buckets) */
ef->header->directory->size = 8;
/* allocate base hash table */
ef->header->directory->nodes =
- calloc(1, sizeof(Eet_File_Node *) * (1 << ef->header->directory->size));
+ calloc(1, sizeof(Eet_File_Node *) * (1 << ef->header->directory->size));
if (eet_test_close(!ef->header->directory->nodes, ef))
- return NULL;
+ return NULL;
/* actually read the directory block - all of it, into ram */
dyn_buf = ef->data + idx;
@@ -1191,24 +1201,24 @@ eet_internal_read1(Eet_File *ef)
/* out directory block is inconsistent - we have overrun our */
/* dynamic block buffer before we finished scanning dir entries */
if (eet_test_close(p + HEADER_SIZE >= (dyn_buf + byte_entries), ef))
- return NULL;
+ return NULL;
/* allocate all the ram needed for this stored node accounting */
efn = malloc (sizeof(Eet_File_Node));
if (eet_test_close(!efn, ef))
{
- if (efn) free(efn); /* yes i know - we only get here if
- * efn is null/0 -> trying to shut up
- * warning tools like cppcheck */
+ if (efn) free(efn); /* yes i know - we only get here if
+ * efn is null/0 -> trying to shut up
+ * warning tools like cppcheck */
return NULL;
}
/* get entrie header */
- EXTRACT_INT(efn->offset, p, indexn);
+ EXTRACT_INT(efn->offset, p, indexn);
EXTRACT_INT(efn->compression, p, indexn);
- EXTRACT_INT(efn->size, p, indexn);
- EXTRACT_INT(efn->data_size, p, indexn);
- EXTRACT_INT(name_size, p, indexn);
+ EXTRACT_INT(efn->size, p, indexn);
+ EXTRACT_INT(efn->data_size, p, indexn);
+ EXTRACT_INT(name_size, p, indexn);
efn->name_size = name_size;
efn->ciphered = 0;
@@ -1238,7 +1248,7 @@ eet_internal_read1(Eet_File *ef)
/* This code is useless if we dont want backward compatibility */
for (k = name_size;
k > 0 && ((unsigned char)*(p + HEADER_SIZE + k)) != 0; --k)
- ;
+ ;
efn->free_name = ((unsigned char)*(p + HEADER_SIZE + k)) != 0;
@@ -1255,13 +1265,13 @@ eet_internal_read1(Eet_File *ef)
efn->name[name_size] = 0;
WRN(
- "File: %s is not up to date for key \"%s\" - needs rebuilding sometime",
- ef->path,
- efn->name);
+ "File: %s is not up to date for key \"%s\" - needs rebuilding sometime",
+ ef->path,
+ efn->name);
}
else
- /* The only really useful peace of code for efn->name (no backward compatibility) */
- efn->name = (char *)((unsigned char *)(p + HEADER_SIZE));
+ /* The only really useful peace of code for efn->name (no backward compatibility) */
+ efn->name = (char *)((unsigned char *)(p + HEADER_SIZE));
/* get hash bucket it should go in */
hash = _eet_hash_gen(efn->name, ef->header->directory->size);
@@ -1270,12 +1280,12 @@ eet_internal_read1(Eet_File *ef)
/* read-only mode, so currently we have no data loaded */
if (ef->mode == EET_FILE_MODE_READ)
- efn->data = NULL; /* read-write mode - read everything into ram */
+ efn->data = NULL; /* read-write mode - read everything into ram */
else
{
data = malloc(efn->size);
if (data)
- memcpy(data, ef->data + efn->offset, efn->size);
+ memcpy(data, ef->data + efn->offset, efn->size);
efn->data = data;
}
@@ -1300,25 +1310,25 @@ eet_internal_read(Eet_File *ef)
const int *data = (const int *)ef->data;
if (eet_test_close((ef->data == (void *)-1) || (!ef->data), ef))
- return NULL;
+ return NULL;
if (eet_test_close(ef->data_size < (int)sizeof(int) * 3, ef))
- return NULL;
+ return NULL;
switch (ntohl(*data))
{
#if EET_OLD_EET_FILE_FORMAT
case EET_MAGIC_FILE:
- return eet_internal_read1(ef);
+ return eet_internal_read1(ef);
#endif /* if EET_OLD_EET_FILE_FORMAT */
case EET_MAGIC_FILE2:
- return eet_internal_read2(ef);
+ return eet_internal_read2(ef);
default:
- ef->delete_me_now = 1;
- eet_internal_close(ef, EINA_TRUE);
- break;
+ ef->delete_me_now = 1;
+ eet_internal_close(ef, EINA_TRUE);
+ break;
} /* switch */
return NULL;
@@ -1332,10 +1342,10 @@ eet_internal_close(Eet_File *ef,
/* check to see its' an eet file pointer */
if (eet_check_pointer(ef))
- return EET_ERROR_BAD_OBJECT;
+ return EET_ERROR_BAD_OBJECT;
if (!locked)
- LOCK_CACHE;
+ LOCK_CACHE;
/* deref */
ef->references--;
@@ -1343,10 +1353,10 @@ eet_internal_close(Eet_File *ef,
if (ef->references > 0)
{
/* flush any writes */
- if ((ef->mode == EET_FILE_MODE_WRITE) ||
- (ef->mode == EET_FILE_MODE_READ_WRITE))
- eet_sync(ef);
- goto on_error;
+ if ((ef->mode == EET_FILE_MODE_WRITE) ||
+ (ef->mode == EET_FILE_MODE_READ_WRITE))
+ eet_sync(ef);
+ goto on_error;
}
err = eet_flush2(ef);
@@ -1356,18 +1366,18 @@ eet_internal_close(Eet_File *ef,
/* if not urgent to delete it - dont free it - leave it in cache */
if ((!ef->delete_me_now) && (ef->mode == EET_FILE_MODE_READ))
- goto on_error;
+ goto on_error;
/* remove from cache */
if (ef->mode == EET_FILE_MODE_READ)
- eet_cache_del(ef, &eet_readers, &eet_readers_num, &eet_readers_alloc);
+ eet_cache_del(ef, &eet_readers, &eet_readers_num, &eet_readers_alloc);
else if ((ef->mode == EET_FILE_MODE_WRITE) ||
(ef->mode == EET_FILE_MODE_READ_WRITE))
- eet_cache_del(ef, &eet_writers, &eet_writers_num, &eet_writers_alloc);
+ eet_cache_del(ef, &eet_writers, &eet_writers_num, &eet_writers_alloc);
/* we can unlock the cache now */
if (!locked)
- UNLOCK_CACHE;
+ UNLOCK_CACHE;
DESTROY_FILE(ef);
@@ -1388,12 +1398,12 @@ eet_internal_close(Eet_File *ef,
while ((efn = ef->header->directory->nodes[i]))
{
if (efn->data)
- free(efn->data);
+ free(efn->data);
ef->header->directory->nodes[i] = efn->next;
if (efn->free_name)
- free(efn->name);
+ free(efn->name);
free(efn);
}
@@ -1415,7 +1425,7 @@ eet_internal_close(Eet_File *ef,
if (ef->readfp)
{
if (ef->data)
- eina_file_map_free(ef->readfp, (void *) ef->data);
+ eina_file_map_free(ef->readfp, (void *)ef->data);
eina_file_close(ef->readfp);
}
@@ -1429,7 +1439,7 @@ eet_internal_close(Eet_File *ef,
on_error:
if (!locked)
- UNLOCK_CACHE;
+ UNLOCK_CACHE;
return EET_ERROR_NONE;
} /* eet_internal_close */
@@ -1441,11 +1451,11 @@ eet_memopen_read(const void *data,
Eet_File *ef;
if (!data || size == 0)
- return NULL;
+ return NULL;
ef = malloc (sizeof (Eet_File));
if (!ef)
- return NULL;
+ return NULL;
INIT_FILE(ef);
ef->ed = NULL;
@@ -1479,7 +1489,7 @@ eet_open(const char *file,
unsigned long int size;
if (!file)
- return NULL;
+ return NULL;
/* find the current file handle in cache*/
ef = NULL;
@@ -1515,30 +1525,30 @@ eet_open(const char *file,
if ((mode == EET_FILE_MODE_READ) || (mode == EET_FILE_MODE_READ_WRITE))
{
/* Prevent garbage in futur comparison. */
- fp = eina_file_open(file, EINA_FALSE);
- if (!fp)
+ fp = eina_file_open(file, EINA_FALSE);
+ if (!fp)
goto open_error;
- size = eina_file_size_get(fp);
+ size = eina_file_size_get(fp);
- if (size < ((int)sizeof(int) * 3))
- {
- eina_file_close(fp);
- fp = NULL;
+ if (size < ((int)sizeof(int) * 3))
+ {
+ eina_file_close(fp);
+ fp = NULL;
- size = 0;
+ size = 0;
- goto open_error;
- }
+ goto open_error;
+ }
open_error:
- if (!fp && mode == EET_FILE_MODE_READ)
+ if (!fp && mode == EET_FILE_MODE_READ)
goto on_error;
}
else
{
if (mode != EET_FILE_MODE_WRITE)
- return NULL;
+ return NULL;
size = 0;
@@ -1557,12 +1567,12 @@ open_error:
if (ef)
{
/* reference it up and return it */
- if (fp)
- eina_file_close(fp);
+ if (fp)
+ eina_file_close(fp);
- ef->references++;
- UNLOCK_CACHE;
- return ef;
+ ef->references++;
+ UNLOCK_CACHE;
+ return ef;
}
file_len = strlen(file) + 1;
@@ -1570,7 +1580,7 @@ open_error:
/* Allocate struct for eet file and have it zero'd out */
ef = malloc(sizeof(Eet_File) + file_len);
if (!ef)
- goto on_error;
+ goto on_error;
/* fill some of the members */
INIT_FILE(ef);
@@ -1590,16 +1600,16 @@ open_error:
ef->sha1_length = 0;
ef->ed = (mode == EET_FILE_MODE_WRITE)
- || (!ef->readfp && mode == EET_FILE_MODE_READ_WRITE) ?
- eet_dictionary_add() : NULL;
+ || (!ef->readfp && mode == EET_FILE_MODE_READ_WRITE) ?
+ eet_dictionary_add() : NULL;
if (!ef->readfp &&
(mode == EET_FILE_MODE_READ_WRITE || mode == EET_FILE_MODE_WRITE))
- goto empty_file;
+ goto empty_file;
/* if we can't open - bail out */
if (eet_test_close(!ef->readfp, ef))
- goto on_error;
+ goto on_error;
/* if we opened for read or read-write */
if ((mode == EET_FILE_MODE_READ) || (mode == EET_FILE_MODE_READ_WRITE))
@@ -1607,11 +1617,11 @@ open_error:
ef->data_size = size;
ef->data = eina_file_map_all(fp, EINA_FILE_SEQUENTIAL);
if (eet_test_close((ef->data == NULL), ef))
- goto on_error;
+ goto on_error;
ef = eet_internal_read(ef);
if (!ef)
- goto on_error;
+ goto on_error;
}
empty_file:
@@ -1637,9 +1647,9 @@ EAPI Eet_File_Mode
eet_mode_get(Eet_File *ef)
{
/* check to see its' an eet file pointer */
- if ((!ef) || (ef->magic != EET_MAGIC_FILE))
+ if ((!ef) || (ef->magic != EET_MAGIC_FILE))
return EET_FILE_MODE_INVALID;
- else
+ else
return ef->mode;
} /* eet_mode_get */
@@ -1648,10 +1658,10 @@ eet_identity_x509(Eet_File *ef,
int *der_length)
{
if (!ef->x509_der)
- return NULL;
+ return NULL;
if (der_length)
- *der_length = ef->x509_length;
+ *der_length = ef->x509_length;
return ef->x509_der;
} /* eet_identity_x509 */
@@ -1661,10 +1671,10 @@ eet_identity_signature(Eet_File *ef,
int *signature_length)
{
if (!ef->signature)
- return NULL;
+ return NULL;
if (signature_length)
- *signature_length = ef->signature_length;
+ *signature_length = ef->signature_length;
return ef->signature;
} /* eet_identity_signature */
@@ -1674,12 +1684,12 @@ eet_identity_sha1(Eet_File *ef,
int *sha1_length)
{
if (!ef->sha1)
- ef->sha1 = eet_identity_compute_sha1(ef->data,
- ef->data_size,
- &ef->sha1_length);
+ ef->sha1 = eet_identity_compute_sha1(ef->data,
+ ef->data_size,
+ &ef->sha1_length);
if (sha1_length)
- *sha1_length = ef->sha1_length;
+ *sha1_length = ef->sha1_length;
return ef->sha1;
} /* eet_identity_sha1 */
@@ -1691,7 +1701,7 @@ eet_identity_set(Eet_File *ef,
Eet_Key *tmp;
if (!ef)
- return EET_ERROR_BAD_OBJECT;
+ return EET_ERROR_BAD_OBJECT;
tmp = ef->key;
ef->key = key;
@@ -1721,29 +1731,29 @@ eet_read_cipher(Eet_File *ef,
unsigned long int size = 0;
if (size_ret)
- *size_ret = 0;
+ *size_ret = 0;
/* check to see its' an eet file pointer */
if (eet_check_pointer(ef))
- return NULL;
+ return NULL;
if (!name)
- return NULL;
+ return NULL;
if ((ef->mode != EET_FILE_MODE_READ) &&
(ef->mode != EET_FILE_MODE_READ_WRITE))
- return NULL;
+ return NULL;
/* no header, return NULL */
if (eet_check_header(ef))
- return NULL;
+ return NULL;
LOCK_FILE(ef);
/* hunt hash bucket */
efn = find_node_by_name(ef, name);
if (!efn)
- goto on_error;
+ goto on_error;
/* get size (uncompressed, if compressed at all) */
size = efn->data_size;
@@ -1751,7 +1761,7 @@ eet_read_cipher(Eet_File *ef,
/* allocate data */
data = malloc(size);
if (!data)
- goto on_error;
+ goto on_error;
/* uncompressed data */
if (efn->compression == 0)
@@ -1767,10 +1777,10 @@ eet_read_cipher(Eet_File *ef,
}
if (efn->data)
- memcpy(data, efn->data, size);
+ memcpy(data, efn->data, size);
else
- if (!read_data_from_disk(ef, efn, data, size))
- goto on_error;
+ if (!read_data_from_disk(ef, efn, data, size))
+ goto on_error;
if (efn->ciphered && cipher_key)
{
@@ -1778,7 +1788,7 @@ eet_read_cipher(Eet_File *ef,
&data_deciphered, &data_deciphered_sz))
{
if (data_deciphered)
- free(data_deciphered);
+ free(data_deciphered);
goto on_error;
}
@@ -1800,12 +1810,12 @@ eet_read_cipher(Eet_File *ef,
/* if we already have the data in ram... copy that */
if (efn->data)
- tmp_data = efn->data;
+ tmp_data = efn->data;
else
{
tmp_data = malloc(compr_size);
if (!tmp_data)
- goto on_error;
+ goto on_error;
free_tmp = 1;
@@ -1823,16 +1833,16 @@ eet_read_cipher(Eet_File *ef,
&data_deciphered_sz))
{
if (free_tmp)
- free(tmp_data);
+ free(tmp_data);
if (data_deciphered)
- free(data_deciphered);
+ free(data_deciphered);
goto on_error;
}
if (free_tmp)
- free(tmp_data);
+ free(tmp_data);
free_tmp = 1;
tmp_data = data_deciphered;
compr_size = data_deciphered_sz;
@@ -1844,12 +1854,12 @@ eet_read_cipher(Eet_File *ef,
tmp_data, (uLongf)compr_size))
{
if (free_tmp)
- free(tmp_data);
+ free(tmp_data);
goto on_error;
}
if (free_tmp)
- free(tmp_data);
+ free(tmp_data);
}
UNLOCK_FILE(ef);
@@ -1860,7 +1870,7 @@ eet_read_cipher(Eet_File *ef,
void *tmp;
if (data[size - 1] != '\0')
- goto on_error;
+ goto on_error;
tmp = eet_read_cipher(ef, data, size_ret, cipher_key);
@@ -1871,7 +1881,7 @@ eet_read_cipher(Eet_File *ef,
else
/* fill in return values */
if (size_ret)
- *size_ret = size;
+ *size_ret = size;
return data;
@@ -1899,33 +1909,33 @@ eet_read_direct(Eet_File *ef,
int size = 0;
if (size_ret)
- *size_ret = 0;
+ *size_ret = 0;
/* check to see its' an eet file pointer */
if (eet_check_pointer(ef))
- return NULL;
+ return NULL;
if (!name)
- return NULL;
+ return NULL;
if ((ef->mode != EET_FILE_MODE_READ) &&
(ef->mode != EET_FILE_MODE_READ_WRITE))
- return NULL;
+ return NULL;
/* no header, return NULL */
if (eet_check_header(ef))
- return NULL;
+ return NULL;
LOCK_FILE(ef);
/* hunt hash bucket */
efn = find_node_by_name(ef, name);
if (!efn)
- goto on_error;
+ goto on_error;
/* trick to detect data in memory instead of mmaped from disk */
if (efn->offset > ef->data_size && !efn->data)
- goto on_error;
+ goto on_error;
/* get size (uncompressed, if compressed at all) */
size = efn->data_size;
@@ -1946,23 +1956,23 @@ eet_read_direct(Eet_File *ef,
if (uncompress((Bytef *)tmp, &dlen, (Bytef *)data,
(uLongf)compr_size))
- goto on_error;
+ goto on_error;
if (tmp[compr_size - 1] != '\0')
- goto on_error;
+ goto on_error;
- UNLOCK_FILE(ef);
+ UNLOCK_FILE(ef);
return eet_read_direct(ef, tmp, size_ret);
}
if (!data)
- goto on_error;
+ goto on_error;
if (data[size - 1] != '\0')
- goto on_error;
+ goto on_error;
- UNLOCK_FILE(ef);
+ UNLOCK_FILE(ef);
return eet_read_direct(ef, data, size_ret);
}
@@ -1970,13 +1980,13 @@ eet_read_direct(Eet_File *ef,
/* uncompressed data */
if (efn->compression == 0
&& efn->ciphered == 0)
- data = efn->data ? efn->data : ef->data + efn->offset; /* compressed data */
+ data = efn->data ? efn->data : ef->data + efn->offset; /* compressed data */
else
- data = NULL;
+ data = NULL;
/* fill in return values */
if (size_ret)
- *size_ret = size;
+ *size_ret = size;
UNLOCK_FILE(ef);
@@ -1988,7 +1998,7 @@ on_error:
} /* eet_read_direct */
EAPI const char *
-eet_alias_get(Eet_File *ef,
+eet_alias_get(Eet_File *ef,
const char *name)
{
Eet_File_Node *efn;
@@ -1997,29 +2007,29 @@ eet_alias_get(Eet_File *ef,
/* check to see its' an eet file pointer */
if (eet_check_pointer(ef))
- return NULL;
+ return NULL;
if (!name)
- return NULL;
+ return NULL;
if ((ef->mode != EET_FILE_MODE_READ) &&
(ef->mode != EET_FILE_MODE_READ_WRITE))
- return NULL;
+ return NULL;
/* no header, return NULL */
if (eet_check_header(ef))
- return NULL;
+ return NULL;
LOCK_FILE(ef);
/* hunt hash bucket */
efn = find_node_by_name(ef, name);
if (!efn)
- goto on_error;
+ goto on_error;
/* trick to detect data in memory instead of mmaped from disk */
if (efn->offset > ef->data_size && !efn->data)
- goto on_error;
+ goto on_error;
/* get size (uncompressed, if compressed at all) */
size = efn->data_size;
@@ -2039,10 +2049,10 @@ eet_alias_get(Eet_File *ef,
if (uncompress((Bytef *)tmp, &dlen, (Bytef *)data,
(uLongf)compr_size))
- goto on_error;
+ goto on_error;
if (tmp[compr_size - 1] != '\0')
- goto on_error;
+ goto on_error;
UNLOCK_FILE(ef);
@@ -2050,10 +2060,10 @@ eet_alias_get(Eet_File *ef,
}
if (!data)
- goto on_error;
+ goto on_error;
if (data[size - 1] != '\0')
- goto on_error;
+ goto on_error;
UNLOCK_FILE(ef);
@@ -2078,58 +2088,58 @@ eet_alias(Eet_File *ef,
/* check to see its' an eet file pointer */
if (eet_check_pointer(ef))
- return EINA_FALSE;
+ return EINA_FALSE;
if ((!name) || (!destination))
- return EINA_FALSE;
+ return EINA_FALSE;
if ((ef->mode != EET_FILE_MODE_WRITE) &&
(ef->mode != EET_FILE_MODE_READ_WRITE))
- return EINA_FALSE;
+ return EINA_FALSE;
LOCK_FILE(ef);
if (!ef->header)
{
/* allocate header */
- ef->header = calloc(1, sizeof(Eet_File_Header));
- if (!ef->header)
+ ef->header = calloc(1, sizeof(Eet_File_Header));
+ if (!ef->header)
goto on_error;
- ef->header->magic = EET_MAGIC_FILE_HEADER;
- /* allocate directory block in ram */
- ef->header->directory = calloc(1, sizeof(Eet_File_Directory));
- if (!ef->header->directory)
- {
- free(ef->header);
- ef->header = NULL;
- goto on_error;
- }
-
- /* 8 bit hash table (256 buckets) */
- ef->header->directory->size = 8;
- /* allocate base hash table */
- ef->header->directory->nodes =
+ ef->header->magic = EET_MAGIC_FILE_HEADER;
+ /* allocate directory block in ram */
+ ef->header->directory = calloc(1, sizeof(Eet_File_Directory));
+ if (!ef->header->directory)
+ {
+ free(ef->header);
+ ef->header = NULL;
+ goto on_error;
+ }
+
+ /* 8 bit hash table (256 buckets) */
+ ef->header->directory->size = 8;
+ /* allocate base hash table */
+ ef->header->directory->nodes =
calloc(1, sizeof(Eet_File_Node *) *
(1 << ef->header->directory->size));
- if (!ef->header->directory->nodes)
- {
- free(ef->header->directory);
- ef->header = NULL;
- goto on_error;
- }
+ if (!ef->header->directory->nodes)
+ {
+ free(ef->header->directory);
+ ef->header = NULL;
+ goto on_error;
+ }
}
/* figure hash bucket */
hash = _eet_hash_gen(name, ef->header->directory->size);
data_size = comp ?
- 12 + (((strlen(destination) + 1) * 101) / 100)
- : strlen(destination) + 1;
+ 12 + (((strlen(destination) + 1) * 101) / 100)
+ : strlen(destination) + 1;
data2 = malloc(data_size);
if (!data2)
- goto on_error;
+ goto on_error;
/* if we want to compress */
if (comp)
@@ -2159,32 +2169,32 @@ eet_alias(Eet_File *ef,
data3 = realloc(data2, data_size);
if (data3)
- data2 = data3;
+ data2 = data3;
}
}
if (!comp)
- memcpy(data2, destination, data_size);
+ memcpy(data2, destination, data_size);
/* Does this node already exist? */
for (efn = ef->header->directory->nodes[hash]; efn; efn = efn->next)
{
/* if it matches */
- if ((efn->name) && (eet_string_match(efn->name, name)))
- {
- free(efn->data);
- efn->alias = 1;
- efn->ciphered = 0;
- efn->compression = !!comp;
- efn->size = data_size;
- efn->data_size = strlen(destination) + 1;
- efn->data = data2;
- /* Put the offset above the limit to avoid direct access */
- efn->offset = ef->data_size + 1;
- exists_already = EINA_TRUE;
-
- break;
- }
+ if ((efn->name) && (eet_string_match(efn->name, name)))
+ {
+ free(efn->data);
+ efn->alias = 1;
+ efn->ciphered = 0;
+ efn->compression = !!comp;
+ efn->size = data_size;
+ efn->data_size = strlen(destination) + 1;
+ efn->data = data2;
+ /* Put the offset above the limit to avoid direct access */
+ efn->offset = ef->data_size + 1;
+ exists_already = EINA_TRUE;
+
+ break;
+ }
}
if (!exists_already)
{
@@ -2238,46 +2248,46 @@ eet_write_cipher(Eet_File *ef,
/* check to see its' an eet file pointer */
if (eet_check_pointer(ef))
- return 0;
+ return 0;
if ((!name) || (!data) || (size <= 0))
- return 0;
+ return 0;
if ((ef->mode != EET_FILE_MODE_WRITE) &&
(ef->mode != EET_FILE_MODE_READ_WRITE))
- return 0;
+ return 0;
LOCK_FILE(ef);
if (!ef->header)
{
/* allocate header */
- ef->header = calloc(1, sizeof(Eet_File_Header));
- if (!ef->header)
+ ef->header = calloc(1, sizeof(Eet_File_Header));
+ if (!ef->header)
goto on_error;
- ef->header->magic = EET_MAGIC_FILE_HEADER;
- /* allocate directory block in ram */
- ef->header->directory = calloc(1, sizeof(Eet_File_Directory));
- if (!ef->header->directory)
- {
- free(ef->header);
- ef->header = NULL;
- goto on_error;
- }
-
- /* 8 bit hash table (256 buckets) */
- ef->header->directory->size = 8;
- /* allocate base hash table */
- ef->header->directory->nodes =
+ ef->header->magic = EET_MAGIC_FILE_HEADER;
+ /* allocate directory block in ram */
+ ef->header->directory = calloc(1, sizeof(Eet_File_Directory));
+ if (!ef->header->directory)
+ {
+ free(ef->header);
+ ef->header = NULL;
+ goto on_error;
+ }
+
+ /* 8 bit hash table (256 buckets) */
+ ef->header->directory->size = 8;
+ /* allocate base hash table */
+ ef->header->directory->nodes =
calloc(1, sizeof(Eet_File_Node *) *
(1 << ef->header->directory->size));
- if (!ef->header->directory->nodes)
- {
- free(ef->header->directory);
- ef->header = NULL;
- goto on_error;
- }
+ if (!ef->header->directory->nodes)
+ {
+ free(ef->header->directory);
+ ef->header = NULL;
+ goto on_error;
+ }
}
/* figure hash bucket */
@@ -2289,7 +2299,7 @@ eet_write_cipher(Eet_File *ef,
{
data2 = malloc(data_size);
if (!data2)
- goto on_error;
+ goto on_error;
}
/* if we want to compress */
@@ -2319,7 +2329,7 @@ eet_write_cipher(Eet_File *ef,
data3 = realloc(data2, data_size);
if (data3)
- data2 = data3;
+ data2 = data3;
}
}
@@ -2334,7 +2344,7 @@ eet_write_cipher(Eet_File *ef,
&data_ciphered, &data_ciphered_sz))
{
if (data2)
- free(data2);
+ free(data2);
data2 = data_ciphered;
data_size = data_ciphered_sz;
@@ -2342,33 +2352,33 @@ eet_write_cipher(Eet_File *ef,
else
{
if (data_ciphered)
- free(data_ciphered);
+ free(data_ciphered);
cipher_key = NULL;
}
}
else
- if (!comp)
- memcpy(data2, data, size);
+ if (!comp)
+ memcpy(data2, data, size);
/* Does this node already exist? */
for (efn = ef->header->directory->nodes[hash]; efn; efn = efn->next)
{
/* if it matches */
- if ((efn->name) && (eet_string_match(efn->name, name)))
- {
- free(efn->data);
- efn->alias = 0;
- efn->ciphered = cipher_key ? 1 : 0;
- efn->compression = !!comp;
- efn->size = data_size;
- efn->data_size = size;
- efn->data = data2;
- /* Put the offset above the limit to avoid direct access */
- efn->offset = ef->data_size + 1;
- exists_already = 1;
- break;
- }
+ if ((efn->name) && (eet_string_match(efn->name, name)))
+ {
+ free(efn->data);
+ efn->alias = 0;
+ efn->ciphered = cipher_key ? 1 : 0;
+ efn->compression = !!comp;
+ efn->size = data_size;
+ efn->data_size = size;
+ efn->data = data2;
+ /* Put the offset above the limit to avoid direct access */
+ efn->offset = ef->data_size + 1;
+ exists_already = 1;
+ break;
+ }
}
if (!exists_already)
{
@@ -2426,17 +2436,17 @@ eet_delete(Eet_File *ef,
/* check to see its' an eet file pointer */
if (eet_check_pointer(ef))
- return 0;
+ return 0;
if (!name)
- return 0;
+ return 0;
/* deleting keys is only possible in RW or WRITE mode */
if (ef->mode == EET_FILE_MODE_READ)
- return 0;
+ return 0;
if (eet_check_header(ef))
- return 0;
+ return 0;
LOCK_FILE(ef);
@@ -2449,27 +2459,27 @@ eet_delete(Eet_File *ef,
pefn = efn, efn = efn->next)
{
/* if it matches */
- if (eet_string_match(efn->name, name))
- {
- if (efn->data)
+ if (eet_string_match(efn->name, name))
+ {
+ if (efn->data)
free(efn->data);
- if (!pefn)
+ if (!pefn)
ef->header->directory->nodes[hash] = efn->next;
- else
+ else
pefn->next = efn->next;
- if (efn->free_name)
+ if (efn->free_name)
free(efn->name);
- free(efn);
- exists_already = 1;
- break;
- }
+ free(efn);
+ exists_already = 1;
+ break;
+ }
}
/* flags that writes are pending */
if (exists_already)
- ef->writes_pending = 1;
+ ef->writes_pending = 1;
UNLOCK_FILE(ef);
@@ -2481,7 +2491,7 @@ EAPI Eet_Dictionary *
eet_dictionary_get(Eet_File *ef)
{
if (eet_check_pointer(ef))
- return NULL;
+ return NULL;
return ef->ed;
} /* eet_dictionary_get */
@@ -2504,13 +2514,13 @@ eet_list(Eet_File *ef,
(ef->mode != EET_FILE_MODE_READ_WRITE)))
{
if (count_ret)
- *count_ret = 0;
+ *count_ret = 0;
return NULL;
}
if (!strcmp(glob, "*"))
- glob = NULL;
+ glob = NULL;
LOCK_FILE(ef);
@@ -2524,32 +2534,32 @@ eet_list(Eet_File *ef,
* check for * explicitly, because on some systems, * isn't well
* supported
*/
- if ((!glob) || !fnmatch(glob, efn->name, 0))
- {
- /* add it to our list */
- list_count++;
-
- /* only realloc in 32 entry chunks */
- if (list_count > list_count_alloc)
- {
- char **new_list = NULL;
-
- list_count_alloc += 64;
- new_list =
- realloc(list_ret, list_count_alloc * (sizeof(char *)));
- if (!new_list)
- {
- free(list_ret);
-
- goto on_error;
- }
-
- list_ret = new_list;
- }
-
- /* put pointer of name string in */
- list_ret[list_count - 1] = efn->name;
- }
+ if ((!glob) || !fnmatch(glob, efn->name, 0))
+ {
+ /* add it to our list */
+ list_count++;
+
+ /* only realloc in 32 entry chunks */
+ if (list_count > list_count_alloc)
+ {
+ char **new_list = NULL;
+
+ list_count_alloc += 64;
+ new_list =
+ realloc(list_ret, list_count_alloc * (sizeof(char *)));
+ if (!new_list)
+ {
+ free(list_ret);
+
+ goto on_error;
+ }
+
+ list_ret = new_list;
+ }
+
+ /* put pointer of name string in */
+ list_ret[list_count - 1] = efn->name;
+ }
}
}
@@ -2557,7 +2567,7 @@ eet_list(Eet_File *ef,
/* return count and list */
if (count_ret)
- *count_ret = list_count;
+ *count_ret = list_count;
return list_ret;
@@ -2565,7 +2575,7 @@ on_error:
UNLOCK_FILE(ef);
if (count_ret)
- *count_ret = 0;
+ *count_ret = 0;
return NULL;
} /* eet_list */
@@ -2580,7 +2590,7 @@ eet_num_entries(Eet_File *ef)
if (eet_check_pointer(ef) || eet_check_header(ef) ||
((ef->mode != EET_FILE_MODE_READ) &&
(ef->mode != EET_FILE_MODE_READ_WRITE)))
- return -1;
+ return -1;
LOCK_FILE(ef);
@@ -2589,7 +2599,7 @@ eet_num_entries(Eet_File *ef)
for (i = 0; i < num; i++)
{
for (efn = ef->header->directory->nodes[i]; efn; efn = efn->next)
- ret++;
+ ret++;
}
UNLOCK_FILE(ef);
@@ -2610,7 +2620,7 @@ find_node_by_name(Eet_File *ef,
for (efn = ef->header->directory->nodes[hash]; efn; efn = efn->next)
{
if (eet_string_match(efn->name, name))
- return efn;
+ return efn;
}
return NULL;
@@ -2623,7 +2633,7 @@ read_data_from_disk(Eet_File *ef,
int len)
{
if (efn->offset > ef->data_size)
- return 0;
+ return 0;
if (!ef->data)
return 0;
diff --git a/src/lib/eet_node.c b/src/lib/eet_node.c
index 12bb0e6..d90ef83 100644
--- a/src/lib/eet_node.c
+++ b/src/lib/eet_node.c
@@ -23,7 +23,7 @@ eet_node_new(void)
result = eina_mempool_malloc(_eet_node_mp, sizeof (Eet_Node));
if (!result)
- return NULL;
+ return NULL;
memset(result, 0, sizeof (Eet_Node));
return result;
@@ -43,7 +43,7 @@ _eet_node_new(const char *name,
n = eet_node_new();
if (!n)
- return NULL;
+ return NULL;
n->type = type;
n->name = eina_stringshare_add(name);
@@ -52,57 +52,58 @@ _eet_node_new(const char *name,
} /* _eet_node_new */
static void
-_eet_node_append(Eet_Node *n, Eina_List *nodes)
+_eet_node_append(Eet_Node *n,
+ Eina_List *nodes)
{
Eet_Node *value;
Eina_List *l;
EINA_LIST_REVERSE_FOREACH(nodes, l, value)
- {
- value->next = n->values;
- n->values = value;
- }
+ {
+ value->next = n->values;
+ n->values = value;
+ }
} /* _eet_node_append */
-#define EET_NODE_NEW(Eet_type, Name, Value, Type)\
- EAPI Eet_Node *\
- eet_node_ ## Name ## _new(const char *name, Type Value)\
- {\
- Eet_Node *n;\
-\
- n = _eet_node_new(name, Eet_type);\
- if (!n) { return NULL; }\
-\
- n->data.value.Value = Value;\
-\
- return n;\
- }
-
-#define EET_NODE_STR_NEW(Eet_type, Name, Value, Type)\
- EAPI Eet_Node *\
- eet_node_ ## Name ## _new(const char *name, Type Value)\
- {\
- Eet_Node *n;\
-\
- n = _eet_node_new(name, Eet_type);\
- if (!n) { return NULL; }\
-\
- n->data.value.Value = eina_stringshare_add(Value);\
-\
- return n;\
- }
-
-EET_NODE_NEW(EET_T_CHAR, char, c, char)
-EET_NODE_NEW(EET_T_SHORT, short, s, short)
-EET_NODE_NEW(EET_T_INT, int, i, int)
-EET_NODE_NEW(EET_T_LONG_LONG, long_long, l, long long)
-EET_NODE_NEW(EET_T_FLOAT, float, f, float)
-EET_NODE_NEW(EET_T_DOUBLE, double, d, double)
-EET_NODE_NEW(EET_T_UCHAR, unsigned_char, uc, unsigned char)
-EET_NODE_NEW(EET_T_USHORT, unsigned_short, us, unsigned short)
-EET_NODE_NEW(EET_T_UINT, unsigned_int, ui, unsigned int)
+#define EET_NODE_NEW(Eet_type, Name, Value, Type) \
+ EAPI Eet_Node * \
+ eet_node_ ## Name ## _new(const char *name, Type Value) \
+ { \
+ Eet_Node *n; \
+ \
+ n = _eet_node_new(name, Eet_type); \
+ if (!n) { return NULL; } \
+ \
+ n->data.value.Value = Value; \
+ \
+ return n; \
+ }
+
+#define EET_NODE_STR_NEW(Eet_type, Name, Value, Type) \
+ EAPI Eet_Node * \
+ eet_node_ ## Name ## _new(const char *name, Type Value) \
+ { \
+ Eet_Node *n; \
+ \
+ n = _eet_node_new(name, Eet_type); \
+ if (!n) { return NULL; } \
+ \
+ n->data.value.Value = eina_stringshare_add(Value); \
+ \
+ return n; \
+ }
+
+EET_NODE_NEW(EET_T_CHAR, char, c, char)
+EET_NODE_NEW(EET_T_SHORT, short, s, short)
+EET_NODE_NEW(EET_T_INT, int, i, int)
+EET_NODE_NEW(EET_T_LONG_LONG, long_long, l, long long)
+EET_NODE_NEW(EET_T_FLOAT, float, f, float)
+EET_NODE_NEW(EET_T_DOUBLE, double, d, double)
+EET_NODE_NEW(EET_T_UCHAR, unsigned_char, uc, unsigned char)
+EET_NODE_NEW(EET_T_USHORT, unsigned_short, us, unsigned short)
+EET_NODE_NEW(EET_T_UINT, unsigned_int, ui, unsigned int)
EET_NODE_NEW(EET_T_ULONG_LONG, unsigned_long_long, ul, unsigned long long)
-EET_NODE_STR_NEW(EET_T_STRING, string, str, const char *)
+EET_NODE_STR_NEW(EET_T_STRING, string, str, const char *)
EET_NODE_STR_NEW(EET_T_INLINED_STRING, inlined_string, str, const char *)
Eet_Node *
@@ -112,7 +113,7 @@ eet_node_null_new(const char *name)
n = _eet_node_new(name, EET_T_NULL);
if (!n)
- return NULL;
+ return NULL;
n->data.value.str = NULL;
@@ -127,7 +128,7 @@ eet_node_list_new(const char *name,
n = _eet_node_new(name, EET_G_LIST);
if (!n)
- return NULL;
+ return NULL;
_eet_node_append(n, nodes);
@@ -143,7 +144,7 @@ eet_node_array_new(const char *name,
n = _eet_node_new(name, EET_G_ARRAY);
if (!n)
- return NULL;
+ return NULL;
n->count = count;
@@ -160,7 +161,7 @@ eet_node_var_array_new(const char *name,
n = _eet_node_new(name, EET_G_VAR_ARRAY);
if (!n)
- return NULL;
+ return NULL;
n->count = eina_list_count(nodes);
@@ -178,11 +179,11 @@ eet_node_hash_new(const char *name,
Eet_Node *n;
if (!node)
- return NULL;
+ return NULL;
n = _eet_node_new(name, EET_G_HASH);
if (!n)
- return NULL;
+ return NULL;
n->key = eina_stringshare_add(key);
nodes = eina_list_append(NULL, node);
@@ -200,7 +201,7 @@ eet_node_struct_new(const char *name,
n = _eet_node_new(name, EET_G_UNKNOWN);
if (!n)
- return NULL;
+ return NULL;
_eet_node_append(n, nodes);
@@ -216,11 +217,11 @@ eet_node_struct_child_new(const char *parent,
if (!child) return NULL;
if (child->type != EET_G_UNKNOWN)
- return child;
+ return child;
n = _eet_node_new(parent, EET_G_UNKNOWN);
if (!n)
- return NULL;
+ return NULL;
_eet_node_append(n, eina_list_prepend(NULL, child));
@@ -260,25 +261,25 @@ eet_node_list_append(Eet_Node *parent,
tmp = eina_stringshare_add(name);
for (nn = parent->values; nn; nn = nn->next)
- if (nn->name == tmp && nn->type == EET_G_LIST)
- {
- Eet_Node *n;
+ if (nn->name == tmp && nn->type == EET_G_LIST)
+ {
+ Eet_Node *n;
- if (!nn->values)
- nn->values = child;
- else
- {
- for (n = nn->values; n->next; n = n->next)
- ;
- n->next = child;
- }
+ if (!nn->values)
+ nn->values = child;
+ else
+ {
+ for (n = nn->values; n->next; n = n->next)
+ ;
+ n->next = child;
+ }
- child->next = NULL;
+ child->next = NULL;
- eina_stringshare_del(tmp);
+ eina_stringshare_del(tmp);
- return;
- }
+ return;
+ }
/* No list found, so create it. */
nn = eet_node_list_new(tmp, eina_list_append(NULL, child));
@@ -312,18 +313,18 @@ eet_node_struct_append(Eet_Node *parent,
tmp = eina_stringshare_add(name);
for (prev = NULL, nn = parent->values; nn; prev = nn, nn = nn->next)
- if (nn->name == tmp && nn->type == child->type)
- {
- if (prev)
- prev->next = nn->next;
- else
- parent->values = nn->next;
+ if (nn->name == tmp && nn->type == child->type)
+ {
+ if (prev)
+ prev->next = nn->next;
+ else
+ parent->values = nn->next;
- nn->next = NULL;
- eet_node_del(nn);
+ nn->next = NULL;
+ eet_node_del(nn);
- break;
- }
+ break;
+ }
if (prev)
{
@@ -357,7 +358,6 @@ eet_node_hash_add(Eet_Node *parent,
parent->values = nn;
} /* eet_node_hash_add */
-
int
eet_node_type_get(Eet_Node *node)
{
@@ -386,29 +386,29 @@ eet_node_del(Eet_Node *n)
Eet_Node *tmp;
if (!n)
- return;
+ return;
switch (n->type)
{
case EET_G_HASH:
- eina_stringshare_del(n->key);
+ eina_stringshare_del(n->key);
case EET_G_UNKNOWN:
case EET_G_VAR_ARRAY:
case EET_G_ARRAY:
case EET_G_LIST:
- for (nn = n->values; nn; )
- {
- tmp = nn;
- nn = nn->next;
- eet_node_del(tmp);
- }
- break;
+ for (nn = n->values; nn; )
+ {
+ tmp = nn;
+ nn = nn->next;
+ eet_node_del(tmp);
+ }
+ break;
case EET_T_STRING:
case EET_T_INLINED_STRING:
- eina_stringshare_del(n->data.value.str);
- break;
+ eina_stringshare_del(n->data.value.str);
+ break;
case EET_T_CHAR:
case EET_T_SHORT:
@@ -419,7 +419,7 @@ eet_node_del(Eet_Node *n)
case EET_T_UCHAR:
case EET_T_USHORT:
case EET_T_UINT:
- break;
+ break;
} /* switch */
eina_stringshare_del(n->name);
@@ -451,9 +451,9 @@ static const char *eet_node_dump_t_name[14][2] = {
};
static void
-eet_node_dump_level(int level,
+eet_node_dump_level(int level,
Eet_Dump_Callback dumpfunc,
- void *dumpdata)
+ void *dumpdata)
{
int i;
@@ -470,17 +470,17 @@ eet_node_string_escape(const char *str)
for (strp = str; *strp; strp++)
{
if (*strp == '\"')
- sz += 2;
+ sz += 2;
else if (*strp == '\\')
- sz += 2;
+ sz += 2;
else if (*strp == '\n')
- sz += 2;
+ sz += 2;
else
- sz += 1;
+ sz += 1;
}
s = malloc(sz + 1);
if (!s)
- return NULL;
+ return NULL;
for (strp = str, sp = s; *strp; strp++, sp++)
{
@@ -493,33 +493,34 @@ eet_node_string_escape(const char *str)
}
if (*strp == '\n')
- *sp = 'n';
+ *sp = 'n';
else
- *sp = *strp;
+ *sp = *strp;
}
*sp = 0;
return s;
} /* eet_node_string_escape */
static void
-eet_node_dump_string_escape(void *dumpdata,
+eet_node_dump_string_escape(void *dumpdata,
Eet_Dump_Callback dumpfunc,
- const char *str)
+ const char *str)
{
char *s;
s = eet_node_string_escape(str);
if (!s)
- return;
+ return;
dumpfunc(dumpdata, s);
free(s);
} /* eet_node_dump_string_escape */
static void
-eet_node_dump_simple_type(Eet_Node *n, int level,
+eet_node_dump_simple_type(Eet_Node *n,
+ int level,
Eet_Dump_Callback dumpfunc,
- void *dumpdata)
+ void *dumpdata)
{
const char *type_name = NULL;
char tbuf[256];
@@ -533,95 +534,95 @@ eet_node_dump_simple_type(Eet_Node *n, int level,
# undef EET_T_TYPE
#endif /* ifdef EET_T_TYPE */
-#define EET_T_TYPE(Eet_Type, Type)\
- case Eet_Type:\
- {\
- dumpfunc(dumpdata, eet_node_dump_t_name[Eet_Type][0]);\
- snprintf(tbuf,\
- sizeof (tbuf),\
- eet_node_dump_t_name[Eet_Type][1],\
- n->data.value.Type);\
- dumpfunc(dumpdata, tbuf);\
- break;\
- }
+#define EET_T_TYPE(Eet_Type, Type) \
+case Eet_Type: \
+{ \
+ dumpfunc(dumpdata, eet_node_dump_t_name[Eet_Type][0]); \
+ snprintf(tbuf, \
+ sizeof (tbuf), \
+ eet_node_dump_t_name[Eet_Type][1], \
+ n->data.value.Type); \
+ dumpfunc(dumpdata, tbuf); \
+ break; \
+}
switch (n->type)
{
- EET_T_TYPE(EET_T_CHAR, c);
- EET_T_TYPE(EET_T_SHORT, s);
- EET_T_TYPE(EET_T_INT, i);
- EET_T_TYPE(EET_T_LONG_LONG, l);
- EET_T_TYPE(EET_T_FLOAT, f);
- EET_T_TYPE(EET_T_DOUBLE, d);
- EET_T_TYPE(EET_T_UCHAR, uc);
- EET_T_TYPE(EET_T_USHORT, us);
- EET_T_TYPE(EET_T_UINT, ui);
+ EET_T_TYPE(EET_T_CHAR, c);
+ EET_T_TYPE(EET_T_SHORT, s);
+ EET_T_TYPE(EET_T_INT, i);
+ EET_T_TYPE(EET_T_LONG_LONG, l);
+ EET_T_TYPE(EET_T_FLOAT, f);
+ EET_T_TYPE(EET_T_DOUBLE, d);
+ EET_T_TYPE(EET_T_UCHAR, uc);
+ EET_T_TYPE(EET_T_USHORT, us);
+ EET_T_TYPE(EET_T_UINT, ui);
EET_T_TYPE(EET_T_ULONG_LONG, ul);
case EET_T_INLINED_STRING:
- type_name = "inlined: \"";
+ type_name = "inlined: \"";
case EET_T_STRING:
- if (!type_name)
- type_name = "string: \"";
+ if (!type_name)
+ type_name = "string: \"";
- dumpfunc(dumpdata, type_name);
- eet_node_dump_string_escape(dumpdata, dumpfunc, n->data.value.str);
- dumpfunc(dumpdata, "\"");
- break;
+ dumpfunc(dumpdata, type_name);
+ eet_node_dump_string_escape(dumpdata, dumpfunc, n->data.value.str);
+ dumpfunc(dumpdata, "\"");
+ break;
case EET_T_NULL:
- dumpfunc(dumpdata, "null");
- break;
+ dumpfunc(dumpdata, "null");
+ break;
default:
- dumpfunc(dumpdata, "???: ???");
- break;
+ dumpfunc(dumpdata, "???: ???");
+ break;
} /* switch */
dumpfunc(dumpdata, ";\n");
} /* eet_node_dump_simple_type */
static void
-eet_node_dump_group_start(int level,
+eet_node_dump_group_start(int level,
Eet_Dump_Callback dumpfunc,
- void *dumpdata,
- int group_type,
- const char *name)
+ void *dumpdata,
+ int group_type,
+ const char *name)
{
int chnk_type;
chnk_type = (group_type >= EET_G_UNKNOWN && group_type <= EET_G_HASH) ?
- group_type : EET_G_LAST;
+ group_type : EET_G_LAST;
eet_node_dump_level(level, dumpfunc, dumpdata);
dumpfunc(dumpdata, "group \"");
eet_node_dump_string_escape(dumpdata, dumpfunc, name);
- dumpfunc(dumpdata, "\" ");
+ dumpfunc(dumpdata, "\" ");
dumpfunc(dumpdata, eet_node_dump_g_name[chnk_type - EET_G_UNKNOWN]);
- dumpfunc(dumpdata, " {\n");
+ dumpfunc(dumpdata, " {\n");
} /* eet_node_dump_group_start */
static void
-eet_node_dump_group_end(int level,
+eet_node_dump_group_end(int level,
Eet_Dump_Callback dumpfunc,
- void *dumpdata)
+ void *dumpdata)
{
eet_node_dump_level(level, dumpfunc, dumpdata);
dumpfunc(dumpdata, "}\n");
} /* eet_node_dump_group_end */
void
-eet_node_dump(Eet_Node *n,
- int dumplevel,
+eet_node_dump(Eet_Node *n,
+ int dumplevel,
Eet_Dump_Callback dumpfunc,
- void *dumpdata)
+ void *dumpdata)
{
Eet_Node *it;
if (!n)
- return;
+ return;
switch (n->type)
{
@@ -630,36 +631,36 @@ eet_node_dump(Eet_Node *n,
case EET_G_UNKNOWN:
case EET_G_HASH:
case EET_G_LIST:
- eet_node_dump_group_start(dumplevel,
- dumpfunc,
- dumpdata,
- n->type,
- n->name);
-
- if (n->type == EET_G_VAR_ARRAY
- || n->type == EET_G_ARRAY)
- {
- char tbuf[256];
-
- eet_node_dump_level(dumplevel, dumpfunc, dumpdata);
- dumpfunc(dumpdata, " count ");
- eina_convert_itoa(n->count, tbuf);
- dumpfunc(dumpdata, tbuf);
- dumpfunc(dumpdata, ";\n");
- }
- else if (n->type == EET_G_HASH)
- {
- eet_node_dump_level(dumplevel, dumpfunc, dumpdata);
- dumpfunc(dumpdata, " key \"");
- eet_node_dump_string_escape(dumpdata, dumpfunc, n->key);
- dumpfunc(dumpdata, "\";\n");
- }
-
- for (it = n->values; it; it = it->next)
- eet_node_dump(it, dumplevel + 2, dumpfunc, dumpdata);
-
- eet_node_dump_group_end(dumplevel, dumpfunc, dumpdata);
- break;
+ eet_node_dump_group_start(dumplevel,
+ dumpfunc,
+ dumpdata,
+ n->type,
+ n->name);
+
+ if (n->type == EET_G_VAR_ARRAY
+ || n->type == EET_G_ARRAY)
+ {
+ char tbuf[256];
+
+ eet_node_dump_level(dumplevel, dumpfunc, dumpdata);
+ dumpfunc(dumpdata, " count ");
+ eina_convert_itoa(n->count, tbuf);
+ dumpfunc(dumpdata, tbuf);
+ dumpfunc(dumpdata, ";\n");
+ }
+ else if (n->type == EET_G_HASH)
+ {
+ eet_node_dump_level(dumplevel, dumpfunc, dumpdata);
+ dumpfunc(dumpdata, " key \"");
+ eet_node_dump_string_escape(dumpdata, dumpfunc, n->key);
+ dumpfunc(dumpdata, "\";\n");
+ }
+
+ for (it = n->values; it; it = it->next)
+ eet_node_dump(it, dumplevel + 2, dumpfunc, dumpdata);
+
+ eet_node_dump_group_end(dumplevel, dumpfunc, dumpdata);
+ break;
case EET_T_STRING:
case EET_T_INLINED_STRING:
@@ -673,8 +674,8 @@ eet_node_dump(Eet_Node *n,
case EET_T_USHORT:
case EET_T_UINT:
case EET_T_ULONG_LONG:
- eet_node_dump_simple_type(n, dumplevel, dumpfunc, dumpdata);
- break;
+ eet_node_dump_simple_type(n, dumplevel, dumpfunc, dumpdata);
+ break;
} /* switch */
} /* eet_node_dump */
@@ -692,7 +693,7 @@ eet_node_walk(void *parent,
if (!root)
{
if (parent)
- cb->struct_add(parent, name, NULL, user_data);
+ cb->struct_add(parent, name, NULL, user_data);
return NULL;
}
@@ -700,49 +701,49 @@ eet_node_walk(void *parent,
switch (root->type)
{
case EET_G_UNKNOWN:
- me = cb->struct_alloc(root->name, user_data);
+ me = cb->struct_alloc(root->name, user_data);
- for (it = root->values; it; it = it->next)
- eet_node_walk(me, it->name, it, cb, user_data);
+ for (it = root->values; it; it = it->next)
+ eet_node_walk(me, it->name, it, cb, user_data);
- break;
+ break;
case EET_G_VAR_ARRAY:
case EET_G_ARRAY:
- me = cb->array(root->type == EET_G_VAR_ARRAY ? EINA_TRUE : EINA_FALSE,
- root->name, root->count, user_data);
+ me = cb->array(root->type == EET_G_VAR_ARRAY ? EINA_TRUE : EINA_FALSE,
+ root->name, root->count, user_data);
- for (i = 0, it = root->values; it; it = it->next)
- cb->insert(me, i++, eet_node_walk(NULL,
- NULL,
- it,
- cb,
- user_data), user_data);
+ for (i = 0, it = root->values; it; it = it->next)
+ cb->insert(me, i++, eet_node_walk(NULL,
+ NULL,
+ it,
+ cb,
+ user_data), user_data);
- break;
+ break;
case EET_G_LIST:
- me = cb->list(root->name, user_data);
+ me = cb->list(root->name, user_data);
- for (it = root->values; it; it = it->next)
- cb->append(me, eet_node_walk(NULL,
- NULL,
- it,
- cb,
- user_data), user_data);
+ for (it = root->values; it; it = it->next)
+ cb->append(me, eet_node_walk(NULL,
+ NULL,
+ it,
+ cb,
+ user_data), user_data);
- break;
+ break;
case EET_G_HASH:
- if (!parent)
- return NULL;
+ if (!parent)
+ return NULL;
- return cb->hash(parent, root->name, root->key,
- eet_node_walk(NULL,
- NULL,
- root->values,
- cb,
- user_data), user_data);
+ return cb->hash(parent, root->name, root->key,
+ eet_node_walk(NULL,
+ NULL,
+ root->values,
+ cb,
+ user_data), user_data);
case EET_T_STRING:
case EET_T_INLINED_STRING:
@@ -756,12 +757,12 @@ eet_node_walk(void *parent,
case EET_T_USHORT:
case EET_T_UINT:
case EET_T_ULONG_LONG:
- me = cb->simple(root->type, &root->data, user_data);
- break;
+ me = cb->simple(root->type, &root->data, user_data);
+ break;
} /* switch */
if (parent)
- cb->struct_add(parent, name, me, user_data);
+ cb->struct_add(parent, name, me, user_data);
return me;
} /* eet_node_walk */
@@ -779,10 +780,10 @@ eet_node_init(void)
#endif
tmp = getenv("EET_MEMPOOL");
if (tmp && tmp[0])
- choice = tmp;
+ choice = tmp;
_eet_node_mp =
- eina_mempool_add(choice, "eet-node-alloc", NULL, sizeof(Eet_Node), 1024);
+ eina_mempool_add(choice, "eet-node-alloc", NULL, sizeof(Eet_Node), 1024);
return _eet_node_mp ? 1 : 0;
} /* eet_node_init */
diff --git a/src/lib/eet_utils.c b/src/lib/eet_utils.c
index 5fcdaf4..8e591a2 100644
--- a/src/lib/eet_utils.c
+++ b/src/lib/eet_utils.c
@@ -19,13 +19,13 @@ _eet_hash_gen(const char *key,
/* no string - index 0 */
if (!key)
- return 0;
+ return 0;
/* calc hash num */
for (i = 0, ptr = (unsigned char *)key, value = (int)(*ptr);
value;
ptr++, i++, value = (int)(*ptr))
- hash_num ^= (value | (value << 8)) >> (i & 0x7);
+ hash_num ^= (value | (value << 8)) >> (i & 0x7);
/* mask it */
mask = (1 << hash_size) - 1;
diff --git a/src/tests/eet_data_suite.c b/src/tests/eet_data_suite.c
index f6fb7f1..c4d5e50 100644
--- a/src/tests/eet_data_suite.c
+++ b/src/tests/eet_data_suite.c
@@ -6,48 +6,52 @@
#include "eet_suite.h"
static char *
-_eet_str_direct_alloc(const char * str)
+_eet_str_direct_alloc(const char *str)
{
return (char *)str;
} /* _eet_str_direct_alloc */
static void
-_eet_str_direct_free(const char * str)
+_eet_str_direct_free(const char *str)
{
/* FIXME: Use attribute unused */
- (void)str;
+ (void)str;
} /* _eet_str_direct_free */
static void
-_eet_eina_hash_foreach(void * hash, Eina_Hash_Foreach cb, void * fdata)
+_eet_eina_hash_foreach(void *hash,
+ Eina_Hash_Foreach cb,
+ void *fdata)
{
if (hash)
- eina_hash_foreach(hash, cb, fdata);
+ eina_hash_foreach(hash, cb, fdata);
} /* _eet_eina_hash_foreach */
/* Internal wrapper for eina_hash */
static Eina_Hash *
-_eet_eina_hash_add(Eina_Hash * hash, const char * key, const void * data)
+_eet_eina_hash_add(Eina_Hash *hash,
+ const char *key,
+ const void *data)
{
if (!hash)
- hash = eina_hash_string_superfast_new(NULL);
+ hash = eina_hash_string_superfast_new(NULL);
if (!hash)
- return NULL;
+ return NULL;
eina_hash_add(hash, key, data);
return hash;
} /* _eet_eina_hash_add */
static void
-_eet_eina_hash_free(Eina_Hash * hash)
+_eet_eina_hash_free(Eina_Hash *hash)
{
if (hash)
- eina_hash_free(hash);
+ eina_hash_free(hash);
} /* _eet_eina_hash_free */
void
-eet_test_setup_eddc(Eet_Data_Descriptor_Class * eddc)
+eet_test_setup_eddc(Eet_Data_Descriptor_Class *eddc)
{
eddc->version = EET_DATA_DESCRIPTOR_CLASS_VERSION;
eddc->func.mem_alloc = NULL;
diff --git a/src/tests/eet_suite.c b/src/tests/eet_suite.c
index 1fbe75b..5230c86 100644
--- a/src/tests/eet_suite.c
+++ b/src/tests/eet_suite.c
@@ -36,24 +36,24 @@ START_TEST(eet_test_init)
}
END_TEST
-typedef struct _Eet_Test_Basic_Type Eet_Test_Basic_Type;
+typedef struct _Eet_Test_Basic_Type Eet_Test_Basic_Type;
struct _Eet_Test_Basic_Type
{
- char c;
- short s;
- int i;
- long long l;
- char * str;
- char * istr;
- float f1;
- float f2;
- double d;
- unsigned char uc;
- unsigned short us;
- unsigned int ui;
- unsigned long long ul;
- Eet_Test_Basic_Type * empty;
- Eet_Test_Basic_Type * with;
+ char c;
+ short s;
+ int i;
+ long long l;
+ char *str;
+ char *istr;
+ float f1;
+ float f2;
+ double d;
+ unsigned char uc;
+ unsigned short us;
+ unsigned int ui;
+ unsigned long long ul;
+ Eet_Test_Basic_Type *empty;
+ Eet_Test_Basic_Type *with;
};
#define EET_TEST_CHAR 0x42
@@ -74,7 +74,7 @@ struct _Eet_Test_Basic_Type
#define EET_TEST_FILE_KEY2 "keys/data/2"
#define EET_TEST_FILE_IMAGE "keys/images/"
-typedef struct _Eet_Test_Image Eet_Test_Image;
+typedef struct _Eet_Test_Image Eet_Test_Image;
struct _Eet_Test_Image
{
unsigned int w;
@@ -128,7 +128,8 @@ static const Eet_Test_Image test_alpha = {
};
static void
-_eet_test_basic_set(Eet_Test_Basic_Type * res, int i)
+_eet_test_basic_set(Eet_Test_Basic_Type *res,
+ int i)
{
res->c = EET_TEST_CHAR;
res->s = EET_TEST_SHORT;
@@ -148,7 +149,7 @@ _eet_test_basic_set(Eet_Test_Basic_Type * res, int i)
if (i == 0)
{
- Eet_Test_Basic_Type * tmp;
+ Eet_Test_Basic_Type *tmp;
tmp = malloc(sizeof (Eet_Test_Basic_Type));
fail_if(!tmp);
@@ -173,7 +174,8 @@ _eet_test_basic_set(Eet_Test_Basic_Type * res, int i)
} /* _eet_test_basic_set */
static void
-_eet_test_basic_check(Eet_Test_Basic_Type * result, int i)
+_eet_test_basic_check(Eet_Test_Basic_Type *result,
+ int i)
{
float tmp;
@@ -190,26 +192,26 @@ _eet_test_basic_check(Eet_Test_Basic_Type * result, int i)
tmp = (result->f1 + EET_TEST_FLOAT);
if (tmp < 0)
- tmp = -tmp;
+ tmp = -tmp;
fail_if(tmp > 0.005);
tmp = (result->f2 - EET_TEST_FLOAT4);
if (tmp < 0)
- tmp = -tmp;
+ tmp = -tmp;
fail_if(tmp > 0.005);
tmp = (result->d + EET_TEST_DOUBLE);
if (tmp < 0)
- tmp = -tmp;
+ tmp = -tmp;
fail_if(tmp > 0.00005);
fail_if(result->empty != NULL);
if (i == 0)
{
- Eet_Test_Basic_Type * tmp;
+ Eet_Test_Basic_Type *tmp;
tmp = result->with;
fail_if(tmp == NULL);
@@ -226,11 +228,11 @@ _eet_test_basic_check(Eet_Test_Basic_Type * result, int i)
fail_if(tmp->ul != EET_TEST_LONG_LONG);
}
else
- fail_if(result->with != NULL);
+ fail_if(result->with != NULL);
} /* _eet_test_basic_check */
static void
-_eet_build_basic_descriptor(Eet_Data_Descriptor * edd)
+_eet_build_basic_descriptor(Eet_Data_Descriptor *edd)
{
EET_DATA_DESCRIPTOR_ADD_BASIC(edd,
Eet_Test_Basic_Type,
@@ -299,16 +301,16 @@ _eet_build_basic_descriptor(Eet_Data_Descriptor * edd)
EET_T_ULONG_LONG);
EET_DATA_DESCRIPTOR_ADD_SUB(edd, Eet_Test_Basic_Type, "empty", empty, edd);
- EET_DATA_DESCRIPTOR_ADD_SUB(edd, Eet_Test_Basic_Type, "with", with, edd);
+ EET_DATA_DESCRIPTOR_ADD_SUB(edd, Eet_Test_Basic_Type, "with", with, edd);
} /* _eet_build_basic_descriptor */
START_TEST(eet_test_basic_data_type_encoding_decoding)
{
- Eet_Data_Descriptor * edd;
- Eet_Test_Basic_Type * result;
+ Eet_Data_Descriptor *edd;
+ Eet_Test_Basic_Type *result;
Eet_Data_Descriptor_Class eddc;
Eet_Test_Basic_Type etbt;
- void * transfert;
+ void *transfert;
int size;
eet_init();
@@ -341,51 +343,51 @@ START_TEST(eet_test_basic_data_type_encoding_decoding)
}
END_TEST
-typedef struct _Eet_Test_Ex_Type Eet_Test_Ex_Type;
+typedef struct _Eet_Test_Ex_Type Eet_Test_Ex_Type;
struct _Eet_Test_Ex_Type
{
- char c;
- short s;
- int i;
- unsigned long long l;
- char * str;
- char * istr;
- float f1;
- float f2;
- float f3;
- float f4;
- double d1;
- double d2;
- double d3;
- double d4;
- Eina_List * list;
- Eina_Hash * hash;
- Eina_List * ilist;
- Eina_List * slist;
- Eina_Hash * ihash;
- Eina_Hash * shash;
- Eet_Test_Basic_Type sarray1[10];
- unsigned int sarray2[5];
- unsigned int varray1_count;
- unsigned int * varray1;
- unsigned int varray2_count;
- Eet_Test_Basic_Type * varray2;
- unsigned char uc;
- unsigned short us;
- unsigned int ui;
- unsigned long long ul;
- char * charray[10];
+ char c;
+ short s;
+ int i;
+ unsigned long long l;
+ char *str;
+ char *istr;
+ float f1;
+ float f2;
+ float f3;
+ float f4;
+ double d1;
+ double d2;
+ double d3;
+ double d4;
+ Eina_List *list;
+ Eina_Hash *hash;
+ Eina_List *ilist;
+ Eina_List *slist;
+ Eina_Hash *ihash;
+ Eina_Hash *shash;
+ Eet_Test_Basic_Type sarray1[10];
+ unsigned int sarray2[5];
+ unsigned int varray1_count;
+ unsigned int *varray1;
+ unsigned int varray2_count;
+ Eet_Test_Basic_Type *varray2;
+ unsigned char uc;
+ unsigned short us;
+ unsigned int ui;
+ unsigned long long ul;
+ char *charray[10];
};
static int i42 = 42;
static int i7 = 7;
static void
-_eet_build_ex_descriptor(Eet_Data_Descriptor * edd)
+_eet_build_ex_descriptor(Eet_Data_Descriptor *edd)
{
Eet_Data_Descriptor_Class eddc;
Eet_Test_Ex_Type etbt;
- Eet_Data_Descriptor * eddb;
+ Eet_Data_Descriptor *eddb;
eet_test_setup_eddc(&eddc);
eddc.name = "Eet_Test_Basic_Type";
@@ -510,10 +512,10 @@ _eet_build_ex_descriptor(Eet_Data_Descriptor * edd)
sizeof(etbt.charray[0]), NULL, NULL);
EET_DATA_DESCRIPTOR_ADD_LIST(edd, Eet_Test_Ex_Type, "list", list, edd);
EET_DATA_DESCRIPTOR_ADD_HASH(edd, Eet_Test_Ex_Type, "hash", hash, edd);
- eet_data_descriptor_element_add(edd, "ilist", EET_T_INT, EET_G_LIST,
+ eet_data_descriptor_element_add(edd, "ilist", EET_T_INT, EET_G_LIST,
(char *)(&(etbt.ilist)) - (char *)(&(etbt)),
0, /* 0, */ NULL, NULL);
- eet_data_descriptor_element_add(edd, "ihash", EET_T_INT, EET_G_HASH,
+ eet_data_descriptor_element_add(edd, "ihash", EET_T_INT, EET_G_HASH,
(char *)(&(etbt.ihash)) - (char *)(&(etbt)),
0, /* 0, */ NULL, NULL);
eet_data_descriptor_element_add(edd, "slist", EET_T_STRING, EET_G_LIST,
@@ -525,15 +527,16 @@ _eet_build_ex_descriptor(Eet_Data_Descriptor * edd)
} /* _eet_build_ex_descriptor */
static Eet_Test_Ex_Type *
-_eet_test_ex_set(Eet_Test_Ex_Type * res, int offset)
+_eet_test_ex_set(Eet_Test_Ex_Type *res,
+ int offset)
{
unsigned int i;
if (!res)
- res = malloc( sizeof(Eet_Test_Ex_Type));
+ res = malloc(sizeof(Eet_Test_Ex_Type));
if (!res)
- return NULL;
+ return NULL;
res->c = EET_TEST_CHAR + offset;
res->s = EET_TEST_SHORT + offset;
@@ -556,7 +559,7 @@ _eet_test_ex_set(Eet_Test_Ex_Type * res, int offset)
res->slist = NULL;
res->shash = NULL;
for (i = 0; i < sizeof(res->charray) / sizeof(res->charray[0]); ++i)
- res->charray[i] = NULL;
+ res->charray[i] = NULL;
res->varray2 = malloc(sizeof (Eet_Test_Basic_Type) * 10);
res->varray1 = malloc(sizeof (int) * 5);
@@ -583,85 +586,86 @@ _eet_test_ex_set(Eet_Test_Ex_Type * res, int offset)
} /* _eet_test_ex_set */
static int
-_eet_test_ex_check(Eet_Test_Ex_Type * stuff, int offset)
+_eet_test_ex_check(Eet_Test_Ex_Type *stuff,
+ int offset)
{
double tmp;
unsigned int i;
if (!stuff)
- return 1;
+ return 1;
if (stuff->c != EET_TEST_CHAR + offset)
- return 1;
+ return 1;
if (stuff->s != EET_TEST_SHORT + offset)
- return 1;
+ return 1;
if (stuff->i != EET_TEST_INT + offset)
- return 1;
+ return 1;
if (stuff->l != EET_TEST_LONG_LONG + offset)
- return 1;
+ return 1;
if (strcmp(stuff->str, EET_TEST_STRING) != 0)
- return 1;
+ return 1;
if (strcmp(stuff->istr, EET_TEST_STRING) != 0)
- return 1;
+ return 1;
tmp = stuff->f1 - (EET_TEST_FLOAT + offset);
if (tmp < 0)
- tmp = -tmp;
+ tmp = -tmp;
if (tmp > 0.005)
- return 1;
+ return 1;
tmp = stuff->d1 - (EET_TEST_DOUBLE + offset);
if (tmp < 0)
- tmp = -tmp;
+ tmp = -tmp;
if (tmp > 0.00005)
- return 1;
+ return 1;
if (stuff->f2 != -(EET_TEST_FLOAT2 + offset))
- return 1;
+ return 1;
if (stuff->d2 != -(EET_TEST_DOUBLE2 + offset))
- return 1;
+ return 1;
if (stuff->f3 != EET_TEST_FLOAT3 + offset)
- return 1;
+ return 1;
if (stuff->d3 != EET_TEST_DOUBLE3 + offset)
- return 1;
+ return 1;
if (stuff->f4 != EET_TEST_FLOAT2 + offset)
- return 1;
+ return 1;
if (stuff->d4 != EET_TEST_DOUBLE2 + offset)
- return 1;
+ return 1;
if (stuff->uc != EET_TEST_CHAR + offset)
- return 1;
+ return 1;
if (stuff->us != EET_TEST_SHORT + offset)
- return 1;
+ return 1;
if (stuff->ui != (unsigned int)EET_TEST_INT + offset)
- return 1;
+ return 1;
if (stuff->ul != EET_TEST_LONG_LONG + offset)
- return 1;
+ return 1;
if (stuff->varray1_count != 5)
- return 1;
+ return 1;
if (stuff->varray2_count != 10)
- return 1;
+ return 1;
for (i = 0; i < 5; ++i)
- if (stuff->sarray2[i] != i * 42 + 1 && stuff->varray1[i] != i * 42 + 1)
- return 1;
+ if (stuff->sarray2[i] != i * 42 + 1 && stuff->varray1[i] != i * 42 + 1)
+ return 1;
for (i = 0; i < 10; ++i)
{
@@ -673,44 +677,47 @@ _eet_test_ex_check(Eet_Test_Ex_Type * stuff, int offset)
} /* _eet_test_ex_check */
static Eina_Bool
-func(__UNUSED__ const Eina_Hash * hash, const void * key, void * data, void * fdata)
+func(__UNUSED__ const Eina_Hash *hash,
+ const void *key,
+ void *data,
+ void *fdata)
{
- int * res = fdata;
+ int *res = fdata;
if (strcmp(key, EET_TEST_KEY1) != 0
&& strcmp(key, EET_TEST_KEY2) != 0)
- *res = 1;
+ *res = 1;
if (_eet_test_ex_check(data, 2))
- *res = 1;
+ *res = 1;
return EINA_TRUE;
} /* func */
static Eina_Bool
-func7(__UNUSED__ const Eina_Hash * hash,
- __UNUSED__ const void * key,
- void * data,
- void * fdata)
+func7(__UNUSED__ const Eina_Hash *hash,
+ __UNUSED__ const void *key,
+ void *data,
+ void *fdata)
{
- int * res = fdata;
- int * val;
+ int *res = fdata;
+ int *val;
val = data;
if (!val)
- *res = 1;
+ *res = 1;
if (*val != 7)
- *res = 1;
+ *res = 1;
return EINA_TRUE;
} /* func7 */
START_TEST(eet_test_data_type_encoding_decoding)
{
- Eet_Data_Descriptor * edd;
- Eet_Test_Ex_Type * result;
- void * transfert;
+ Eet_Data_Descriptor *edd;
+ Eet_Test_Ex_Type *result;
+ void *transfert;
Eet_Data_Descriptor_Class eddc;
Eet_Test_Ex_Type etbt;
int size;
@@ -721,7 +728,7 @@ START_TEST(eet_test_data_type_encoding_decoding)
_eet_test_ex_set(&etbt, 0);
etbt.list = eina_list_prepend(etbt.list, _eet_test_ex_set(NULL, 1));
etbt.hash = eina_hash_string_superfast_new(NULL);
- eina_hash_add(etbt.hash, EET_TEST_KEY1, _eet_test_ex_set(NULL, 2));
+ eina_hash_add(etbt.hash, EET_TEST_KEY1, _eet_test_ex_set(NULL, 2));
etbt.ilist = eina_list_prepend(etbt.ilist, &i42);
etbt.ihash = eina_hash_string_superfast_new(NULL);
eina_hash_add(etbt.ihash, EET_TEST_KEY1, &i7);
@@ -760,11 +767,11 @@ START_TEST(eet_test_data_type_encoding_decoding)
test = 0;
if (result->hash)
- eina_hash_foreach(result->hash, func, &test);
+ eina_hash_foreach(result->hash, func, &test);
fail_if(test != 0);
if (result->ihash)
- eina_hash_foreach(result->ihash, func7, &test);
+ eina_hash_foreach(result->ihash, func7, &test);
fail_if(test != 0);
@@ -773,13 +780,14 @@ START_TEST(eet_test_data_type_encoding_decoding)
END_TEST
static void
-append_string(void * data, const char * str)
+append_string(void *data,
+ const char *str)
{
- char ** string = data;
+ char **string = data;
int length;
if (!data)
- return;
+ return;
length = *string ? strlen(*string) : 0;
*string = realloc(*string, strlen(str) + length + 1);
@@ -789,14 +797,14 @@ append_string(void * data, const char * str)
START_TEST(eet_test_data_type_dump_undump)
{
- Eet_Data_Descriptor * edd;
- Eet_Test_Ex_Type * result;
+ Eet_Data_Descriptor *edd;
+ Eet_Test_Ex_Type *result;
Eet_Data_Descriptor_Class eddc;
Eet_Test_Ex_Type etbt;
- char * transfert1;
- char * transfert2;
- char * string1;
- char * string2;
+ char *transfert1;
+ char *transfert2;
+ char *string1;
+ char *string2;
int size1;
int size2;
int test;
@@ -839,7 +847,7 @@ START_TEST(eet_test_data_type_dump_undump)
fail_if(!string1);
transfert2 = eet_data_text_undump(string1, string1 ? strlen(
- string1) : 0, &size2);
+ string1) : 0, &size2);
fail_if(!transfert2 && size2 <= 0);
string2 = NULL;
@@ -863,24 +871,23 @@ START_TEST(eet_test_data_type_dump_undump)
test = 0;
if (result->hash)
- eina_hash_foreach(result->hash, func, &test);
+ eina_hash_foreach(result->hash, func, &test);
fail_if(test != 0);
if (result->ihash)
- eina_hash_foreach(result->ihash, func7, &test);
+ eina_hash_foreach(result->ihash, func7, &test);
fail_if(test != 0);
eet_shutdown();
}
END_TEST
-
START_TEST(eet_file_simple_write)
{
- const char * buffer = "Here is a string of data to save !";
- Eet_File * ef;
- char * test;
- char * file = strdup("/tmp/eet_suite_testXXXXXX");
+ const char *buffer = "Here is a string of data to save !";
+ Eet_File *ef;
+ char *test;
+ char *file = strdup("/tmp/eet_suite_testXXXXXX");
int size;
eet_init();
@@ -942,15 +949,14 @@ START_TEST(eet_file_simple_write)
} /* START_TEST */
END_TEST
-
START_TEST(eet_file_data_test)
{
- Eet_Data_Descriptor * edd;
- Eet_Test_Ex_Type * result;
- Eet_Dictionary * ed;
- Eet_File * ef;
- char ** list;
- char * file = strdup("/tmp/eet_suite_testXXXXXX");
+ Eet_Data_Descriptor *edd;
+ Eet_Test_Ex_Type *result;
+ Eet_Dictionary *ed;
+ Eet_File *ef;
+ char **list;
+ char *file = strdup("/tmp/eet_suite_testXXXXXX");
Eet_Data_Descriptor_Class eddc;
Eet_Test_Ex_Type etbt;
int size;
@@ -1055,11 +1061,11 @@ START_TEST(eet_file_data_test)
test = 0;
if (result->hash)
- eina_hash_foreach(result->hash, func, &test);
+ eina_hash_foreach(result->hash, func, &test);
fail_if(test != 0);
if (result->ihash)
- eina_hash_foreach(result->ihash, func7, &test);
+ eina_hash_foreach(result->ihash, func7, &test);
fail_if(test != 0);
@@ -1099,16 +1105,15 @@ START_TEST(eet_file_data_test)
} /* START_TEST */
END_TEST
-
START_TEST(eet_file_data_dump_test)
{
- Eet_Data_Descriptor * edd;
- Eet_Test_Ex_Type * result;
+ Eet_Data_Descriptor *edd;
+ Eet_Test_Ex_Type *result;
Eet_Data_Descriptor_Class eddc;
Eet_Test_Ex_Type etbt;
- Eet_File * ef;
- char * string1;
- char * file = strdup("/tmp/eet_suite_testXXXXXX");
+ Eet_File *ef;
+ char *string1;
+ char *file = strdup("/tmp/eet_suite_testXXXXXX");
int test;
eet_init();
@@ -1131,7 +1136,7 @@ START_TEST(eet_file_data_dump_test)
etbt.charray[0] = "test";
eet_eina_file_data_descriptor_class_set(&eddc, sizeof (eddc),
- "Eet_Test_Ex_Type",
+ "Eet_Test_Ex_Type",
sizeof(Eet_Test_Ex_Type));
edd = eet_data_descriptor_file_new(&eddc);
@@ -1182,11 +1187,11 @@ START_TEST(eet_file_data_dump_test)
test = 0;
if (result->hash)
- eina_hash_foreach(result->hash, func, &test);
+ eina_hash_foreach(result->hash, func, &test);
fail_if(test != 0);
if (result->ihash)
- eina_hash_foreach(result->ihash, func7, &test);
+ eina_hash_foreach(result->ihash, func7, &test);
fail_if(test != 0);
@@ -1196,12 +1201,11 @@ START_TEST(eet_file_data_dump_test)
} /* START_TEST */
END_TEST
-
START_TEST(eet_image)
{
- Eet_File * ef;
- char * file = strdup("/tmp/eet_suite_testXXXXXX");
- unsigned int * data;
+ Eet_File *ef;
+ char *file = strdup("/tmp/eet_suite_testXXXXXX");
+ unsigned int *data;
int compress;
int quality;
int result;
@@ -1564,10 +1568,10 @@ END_TEST
START_TEST(eet_small_image)
{
- char * file = strdup("/tmp/eet_suite_testXXXXXX");
+ char *file = strdup("/tmp/eet_suite_testXXXXXX");
unsigned int image[4];
- unsigned int * data;
- Eet_File * ef;
+ unsigned int *data;
+ Eet_File *ef;
unsigned int w;
unsigned int h;
int alpha;
@@ -1621,16 +1625,15 @@ START_TEST(eet_small_image)
} /* START_TEST */
END_TEST
-
START_TEST(eet_identity_simple)
{
- const char * buffer = "Here is a string of data to save !";
- const void * tmp;
- Eet_File * ef;
- Eet_Key * k;
- FILE * noread;
- char * test;
- char * file = strdup("/tmp/eet_suite_testXXXXXX");
+ const char *buffer = "Here is a string of data to save !";
+ const void *tmp;
+ Eet_File *ef;
+ Eet_Key *k;
+ FILE *noread;
+ char *test;
+ char *file = strdup("/tmp/eet_suite_testXXXXXX");
int size;
int fd;
@@ -1698,10 +1701,9 @@ START_TEST(eet_identity_simple)
} /* START_TEST */
END_TEST
-
START_TEST(eet_identity_open_simple)
{
- Eet_Key * k = NULL;
+ Eet_Key *k = NULL;
eet_init();
@@ -1711,16 +1713,15 @@ START_TEST(eet_identity_open_simple)
fail_if(!k);
if (k)
- eet_identity_close(k);
+ eet_identity_close(k);
eet_shutdown();
} /* START_TEST */
END_TEST
-
START_TEST(eet_identity_open_pkcs8)
{
- Eet_Key * k = NULL;
+ Eet_Key *k = NULL;
eet_init();
@@ -1730,36 +1731,38 @@ START_TEST(eet_identity_open_pkcs8)
fail_if(!k);
if (k)
- eet_identity_close(k);
+ eet_identity_close(k);
eet_shutdown();
} /* START_TEST */
END_TEST
-static int pass_get(char * pass,
- int size,
- __UNUSED__ int rwflags,
- __UNUSED__ void * u)
+static int
+pass_get(char *pass,
+ int size,
+ __UNUSED__ int rwflags,
+ __UNUSED__ void *u)
{
memset(pass, 0, size);
if ((int)strlen("password") > size)
- return 0;
+ return 0;
snprintf(pass, size, "%s", "password");
return strlen(pass);
} /* pass_get */
-static int badpass_get(char * pass,
- int size,
- __UNUSED__ int rwflags,
- __UNUSED__ void * u)
+static int
+badpass_get(char *pass,
+ int size,
+ __UNUSED__ int rwflags,
+ __UNUSED__ void *u)
{
memset(pass, 0, size);
if ((int)strlen("bad password") > size)
- return 0;
+ return 0;
snprintf(pass, size, "%s", "bad password");
return strlen(pass);
@@ -1767,7 +1770,7 @@ static int badpass_get(char * pass,
START_TEST(eet_identity_open_pkcs8_enc)
{
- Eet_Key * k = NULL;
+ Eet_Key *k = NULL;
eet_init();
@@ -1777,32 +1780,31 @@ START_TEST(eet_identity_open_pkcs8_enc)
fail_if(k);
if (k)
- eet_identity_close(k);
+ eet_identity_close(k);
k = eet_identity_open("cert.pem", "key_enc.pem", &badpass_get);
fail_if(k);
if (k)
- eet_identity_close(k);
+ eet_identity_close(k);
k = eet_identity_open("cert.pem", "key_enc.pem", &pass_get);
fail_if(!k);
if (k)
- eet_identity_close(k);
+ eet_identity_close(k);
eet_shutdown();
}
END_TEST
-
START_TEST(eet_cipher_decipher_simple)
{
- const char * buffer = "Here is a string of data to save !";
- const char * key = "This is a crypto key";
- const char * key_bad = "This is another crypto key";
- Eet_File * ef;
- char * test;
- char * file = strdup("/tmp/eet_suite_testXXXXXX");
+ const char *buffer = "Here is a string of data to save !";
+ const char *key = "This is a crypto key";
+ const char *key_bad = "This is another crypto key";
+ Eet_File *ef;
+ char *test;
+ char *file = strdup("/tmp/eet_suite_testXXXXXX");
int size;
eet_init();
@@ -1838,7 +1840,7 @@ START_TEST(eet_cipher_decipher_simple)
test = eet_read_cipher(ef, "keys/tests", &size, key_bad);
if (size == (int)strlen(buffer) + 1)
- fail_if(memcmp(test, buffer, strlen(buffer) + 1) == 0);
+ fail_if(memcmp(test, buffer, strlen(buffer) + 1) == 0);
eet_close(ef);
@@ -1856,18 +1858,18 @@ static Eina_Bool open_worker_stop;
# ifdef _EET_INCLUDED_PTHREAD
static void *
-open_close_worker(void * path)
+open_close_worker(void *path)
{
while (!open_worker_stop)
{
- Eet_File * ef = eet_open((char const *)path, EET_FILE_MODE_READ);
+ Eet_File *ef = eet_open((char const *)path, EET_FILE_MODE_READ);
if (ef == NULL)
- pthread_exit("eet_open() failed");
+ pthread_exit("eet_open() failed");
else
{
Eet_Error err_code = eet_close(ef);
if (err_code != EET_ERROR_NONE)
- pthread_exit("eet_close() failed");
+ pthread_exit("eet_close() failed");
}
}
@@ -1877,18 +1879,18 @@ open_close_worker(void * path)
# else /* ifdef _EET_INCLUDED_PTHREAD */
static unsigned int __stdcall
-open_close_worker(void * path)
+open_close_worker(void *path)
{
while (!open_worker_stop)
{
- Eet_File * ef = eet_open((char const *)path, EET_FILE_MODE_READ);
+ Eet_File *ef = eet_open((char const *)path, EET_FILE_MODE_READ);
if (ef == NULL)
- _endthreadex(-1);
+ _endthreadex(-1);
else
{
Eet_Error err_code = eet_close(ef);
if (err_code != EET_ERROR_NONE)
- _endthreadex(-2);
+ _endthreadex(-2);
}
}
@@ -1899,10 +1901,10 @@ open_close_worker(void * path)
START_TEST(eet_cache_concurrency)
{
- char * file = strdup("/tmp/eet_suite_testXXXXXX");
- const char * buffer = "test data";
- Eet_File * ef;
- void * thread_ret;
+ char *file = strdup("/tmp/eet_suite_testXXXXXX");
+ const char *buffer = "test data";
+ Eet_File *ef;
+ void *thread_ret;
unsigned int n;
# ifdef _EET_INCLUDED_PTHREAD
pthread_t thread;
@@ -1955,20 +1957,22 @@ END_TEST
#endif /* EINA_HAVE_THREADS */
-typedef struct _Eet_Connection_Data Eet_Connection_Data;
+typedef struct _Eet_Connection_Data Eet_Connection_Data;
struct _Eet_Connection_Data
{
- Eet_Connection * conn;
- Eet_Data_Descriptor * edd;
- Eina_Bool test;
+ Eet_Connection *conn;
+ Eet_Data_Descriptor *edd;
+ Eina_Bool test;
};
static Eina_Bool
-_eet_connection_read(const void * eet_data, size_t size, void * user_data)
+_eet_connection_read(const void *eet_data,
+ size_t size,
+ void *user_data)
{
- Eet_Connection_Data * dt = user_data;
- Eet_Test_Ex_Type * result;
- Eet_Node * node;
+ Eet_Connection_Data *dt = user_data;
+ Eet_Test_Ex_Type *result;
+ Eet_Node *node;
int test;
result = eet_data_descriptor_decode(dt->edd, eet_data, size);
@@ -1988,11 +1992,11 @@ _eet_connection_read(const void * eet_data, size_t size, void * user_data)
test = 0;
if (result->hash)
- eina_hash_foreach(result->hash, func, &test);
+ eina_hash_foreach(result->hash, func, &test);
fail_if(test != 0);
if (result->ihash)
- eina_hash_foreach(result->ihash, func7, &test);
+ eina_hash_foreach(result->ihash, func7, &test);
fail_if(test != 0);
@@ -2006,22 +2010,24 @@ _eet_connection_read(const void * eet_data, size_t size, void * user_data)
} /* _eet_connection_read */
static Eina_Bool
-_eet_connection_write(const void * data, size_t size, void * user_data)
+_eet_connection_write(const void *data,
+ size_t size,
+ void *user_data)
{
- Eet_Connection_Data * dt = user_data;
+ Eet_Connection_Data *dt = user_data;
int still;
if (!dt->test)
{
int step = size / 3;
- eet_connection_received(dt->conn, data, step);
+ eet_connection_received(dt->conn, data, step);
eet_connection_received(dt->conn, (char *)data + step, step);
size -= 2 * step;
still = eet_connection_received(dt->conn, (char *)data + 2 * step, size);
}
else
- still = eet_connection_received(dt->conn, data, size);
+ still = eet_connection_received(dt->conn, data, size);
fail_if(still);
@@ -2030,8 +2036,8 @@ _eet_connection_write(const void * data, size_t size, void * user_data)
START_TEST(eet_connection_check)
{
- Eet_Connection * conn;
- Eet_Data_Descriptor * edd;
+ Eet_Connection *conn;
+ Eet_Data_Descriptor *edd;
Eet_Data_Descriptor_Class eddc;
Eet_Connection_Data ecd;
Eet_Test_Ex_Type etbt;
@@ -2057,7 +2063,7 @@ START_TEST(eet_connection_check)
etbt.charray[0] = "test";
eet_eina_file_data_descriptor_class_set(&eddc, sizeof (eddc),
- "Eet_Test_Ex_Type",
+ "Eet_Test_Ex_Type",
sizeof(Eet_Test_Ex_Type));
edd = eet_data_descriptor_file_new(&eddc);
@@ -2095,7 +2101,7 @@ struct _Eet_5FP
Eina_F32p32 f1;
Eina_F32p32 f0;
};
-typedef struct _Eet_5FP Eet_5FP;
+typedef struct _Eet_5FP Eet_5FP;
struct _Eet_5DBL
{
@@ -2105,17 +2111,17 @@ struct _Eet_5DBL
double f1;
double f0;
};
-typedef struct _Eet_5DBL Eet_5DBL;
+typedef struct _Eet_5DBL Eet_5DBL;
START_TEST(eet_fp)
{
Eet_Data_Descriptor_Class eddc;
- Eet_Data_Descriptor * edd_5FP;
- Eet_Data_Descriptor * edd_5DBL;
+ Eet_Data_Descriptor *edd_5FP;
+ Eet_Data_Descriptor *edd_5DBL;
Eet_5FP origin;
- Eet_5DBL * convert;
- Eet_5FP * build;
- void * blob;
+ Eet_5DBL *convert;
+ Eet_5FP *build;
+ void *blob;
int size;
eet_init();
@@ -2125,18 +2131,18 @@ START_TEST(eet_fp)
EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5FP, Eet_5FP, "fp32", fp32, EET_T_F32P32);
EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5FP, Eet_5FP, "fp16", fp16, EET_T_F16P16);
- EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5FP, Eet_5FP, "fp8", fp8, EET_T_F8P24);
- EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5FP, Eet_5FP, "f1", f1, EET_T_F32P32);
- EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5FP, Eet_5FP, "f0", f0, EET_T_F32P32);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5FP, Eet_5FP, "fp8", fp8, EET_T_F8P24);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5FP, Eet_5FP, "f1", f1, EET_T_F32P32);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5FP, Eet_5FP, "f0", f0, EET_T_F32P32);
eet_eina_stream_data_descriptor_class_set(&eddc, sizeof (eddc), "Eet_5FP", sizeof (Eet_5DBL));
edd_5DBL = eet_data_descriptor_stream_new(&eddc);
EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5DBL, Eet_5DBL, "fp32", fp32, EET_T_DOUBLE);
EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5DBL, Eet_5DBL, "fp16", fp16, EET_T_DOUBLE);
- EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5DBL, Eet_5DBL, "fp8", fp8, EET_T_FLOAT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5DBL, Eet_5DBL, "f1", f1, EET_T_DOUBLE);
- EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5DBL, Eet_5DBL, "f0", f0, EET_T_DOUBLE);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5DBL, Eet_5DBL, "fp8", fp8, EET_T_FLOAT);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5DBL, Eet_5DBL, "f1", f1, EET_T_DOUBLE);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5DBL, Eet_5DBL, "f0", f0, EET_T_DOUBLE);
origin.fp32 = eina_f32p32_double_from(1.125);
origin.fp16 = eina_f16p16_int_from(2000);
@@ -2168,17 +2174,16 @@ START_TEST(eet_fp)
eet_shutdown();
}
END_TEST
-
START_TEST(eet_file_fp)
{
- char * file = strdup("/tmp/eet_suite_testXXXXXX");
+ char *file = strdup("/tmp/eet_suite_testXXXXXX");
Eet_Data_Descriptor_Class eddc;
- Eet_Data_Descriptor * edd_5FP;
- Eet_Data_Descriptor * edd_5DBL;
- Eet_File * ef;
+ Eet_Data_Descriptor *edd_5FP;
+ Eet_Data_Descriptor *edd_5DBL;
+ Eet_File *ef;
Eet_5FP origin;
- Eet_5DBL * convert;
- Eet_5FP * build;
+ Eet_5DBL *convert;
+ Eet_5FP *build;
eet_init();
@@ -2187,18 +2192,18 @@ START_TEST(eet_file_fp)
EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5FP, Eet_5FP, "fp32", fp32, EET_T_F32P32);
EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5FP, Eet_5FP, "fp16", fp16, EET_T_F16P16);
- EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5FP, Eet_5FP, "fp8", fp8, EET_T_F8P24);
- EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5FP, Eet_5FP, "f1", f1, EET_T_F32P32);
- EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5FP, Eet_5FP, "f0", f0, EET_T_F32P32);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5FP, Eet_5FP, "fp8", fp8, EET_T_F8P24);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5FP, Eet_5FP, "f1", f1, EET_T_F32P32);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5FP, Eet_5FP, "f0", f0, EET_T_F32P32);
eet_eina_file_data_descriptor_class_set(&eddc, sizeof (eddc), "Eet_5FP", sizeof (Eet_5DBL));
edd_5DBL = eet_data_descriptor_file_new(&eddc);
EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5DBL, Eet_5DBL, "fp32", fp32, EET_T_DOUBLE);
EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5DBL, Eet_5DBL, "fp16", fp16, EET_T_DOUBLE);
- EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5DBL, Eet_5DBL, "fp8", fp8, EET_T_FLOAT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5DBL, Eet_5DBL, "f1", f1, EET_T_DOUBLE);
- EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5DBL, Eet_5DBL, "f0", f0, EET_T_DOUBLE);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5DBL, Eet_5DBL, "fp8", fp8, EET_T_FLOAT);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5DBL, Eet_5DBL, "f1", f1, EET_T_DOUBLE);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5DBL, Eet_5DBL, "f0", f0, EET_T_DOUBLE);
origin.fp32 = eina_f32p32_double_from(1.125);
origin.fp16 = eina_f16p16_int_from(2000);
@@ -2240,16 +2245,16 @@ START_TEST(eet_file_fp)
END_TEST
-typedef struct _Eet_Union_Test Eet_Union_Test;
-typedef struct _Eet_Variant_Test Eet_Variant_Test;
-typedef struct _Eet_Variant_Type Eet_Variant_Type;
-typedef struct _Eet_Inherit_Test1 Eet_Inherit_Test1;
-typedef struct _Eet_Inherit_Test2 Eet_Inherit_Test2;
-typedef struct _Eet_Inherit_Test3 Eet_Inherit_Test3;
-typedef struct _Eet_St1 Eet_St1;
-typedef struct _Eet_St2 Eet_St2;
-typedef struct _Eet_St3 Eet_St3;
-typedef struct _Eet_List Eet_List;
+typedef struct _Eet_Union_Test Eet_Union_Test;
+typedef struct _Eet_Variant_Test Eet_Variant_Test;
+typedef struct _Eet_Variant_Type Eet_Variant_Type;
+typedef struct _Eet_Inherit_Test1 Eet_Inherit_Test1;
+typedef struct _Eet_Inherit_Test2 Eet_Inherit_Test2;
+typedef struct _Eet_Inherit_Test3 Eet_Inherit_Test3;
+typedef struct _Eet_St1 Eet_St1;
+typedef struct _Eet_St2 Eet_St2;
+typedef struct _Eet_St3 Eet_St3;
+typedef struct _Eet_List Eet_List;
typedef enum _Eet_Union
{
@@ -2261,8 +2266,8 @@ typedef enum _Eet_Union
struct
{
- Eet_Union u;
- const char * name;
+ Eet_Union u;
+ const char *name;
} eet_mapping[] = {
{ EET_ST1, "ST1" },
{ EET_ST2, "ST2" },
@@ -2274,7 +2279,7 @@ struct _Eet_St1
{
double val1;
int stuff;
- char * s1;
+ char *s1;
};
struct _Eet_St2
@@ -2301,16 +2306,16 @@ struct _Eet_Union_Test
struct _Eet_Variant_Type
{
- const char * type;
- Eina_Bool unknow : 1;
+ const char *type;
+ Eina_Bool unknow : 1;
};
struct _Eet_Variant_Test
{
Eet_Variant_Type t;
- void * data;
- Eina_List * data_list;
+ void *data;
+ Eina_List *data_list;
};
struct _Eet_Inherit_Test1
@@ -2331,70 +2336,76 @@ struct _Eet_Inherit_Test3
struct _Eet_List
{
- Eina_List * list;
+ Eina_List *list;
};
static const char *
-_eet_union_type_get(const void * data, Eina_Bool * unknow)
+_eet_union_type_get(const void *data,
+ Eina_Bool *unknow)
{
- const Eet_Union * u = data;
+ const Eet_Union *u = data;
int i;
if (unknow)
- *unknow = EINA_FALSE;
+ *unknow = EINA_FALSE;
for (i = 0; eet_mapping[i].name != NULL; ++i)
- if (*u == eet_mapping[i].u)
- return eet_mapping[i].name;
+ if (*u == eet_mapping[i].u)
+ return eet_mapping[i].name;
if (unknow)
- *unknow = EINA_TRUE;
+ *unknow = EINA_TRUE;
return NULL;
} /* _eet_union_type_get */
static Eina_Bool
-_eet_union_type_set(const char * type, void * data, Eina_Bool unknow)
+_eet_union_type_set(const char *type,
+ void *data,
+ Eina_Bool unknow)
{
- Eet_Union * u = data;
+ Eet_Union *u = data;
int i;
if (unknow)
- return EINA_FALSE;
+ return EINA_FALSE;
for (i = 0; eet_mapping[i].name != NULL; ++i)
- if (strcmp(eet_mapping[i].name, type) == 0)
- {
- *u = eet_mapping[i].u;
- return EINA_TRUE;
- }
+ if (strcmp(eet_mapping[i].name, type) == 0)
+ {
+ *u = eet_mapping[i].u;
+ return EINA_TRUE;
+ }
return EINA_FALSE;
} /* _eet_union_type_set */
static const char *
-_eet_variant_type_get(const void * data, Eina_Bool * unknow)
+_eet_variant_type_get(const void *data,
+ Eina_Bool *unknow)
{
- const Eet_Variant_Type * type = data;
+ const Eet_Variant_Type *type = data;
int i;
if (unknow)
- *unknow = type->unknow;
+ *unknow = type->unknow;
for (i = 0; eet_mapping[i].name != NULL; ++i)
- if (strcmp(type->type, eet_mapping[i].name) == 0)
- return eet_mapping[i].name;
+ if (strcmp(type->type, eet_mapping[i].name) == 0)
+ return eet_mapping[i].name;
if (unknow)
- *unknow = EINA_FALSE;
+ *unknow = EINA_FALSE;
return type->type;
} /* _eet_variant_type_get */
static Eina_Bool
-_eet_variant_type_set(const char * type, void * data, Eina_Bool unknow)
+_eet_variant_type_set(const char *type,
+ void *data,
+ Eina_Bool unknow)
{
- Eet_Variant_Type * vt = data;
+ Eet_Variant_Type *vt = data;
vt->type = type;
vt->unknow = unknow;
@@ -2405,19 +2416,20 @@ static Eet_Data_Descriptor *
_eet_st1_dd(void)
{
Eet_Data_Descriptor_Class eddc;
- Eet_Data_Descriptor * res;
+ Eet_Data_Descriptor *res;
EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, Eet_St1);
res = eet_data_descriptor_stream_new(&eddc);
- EET_DATA_DESCRIPTOR_ADD_BASIC(res, Eet_St1, "val1", val1, EET_T_DOUBLE);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(res, Eet_St1, "val1", val1, EET_T_DOUBLE);
EET_DATA_DESCRIPTOR_ADD_BASIC(res, Eet_St1, "stuff", stuff, EET_T_INT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(res, Eet_St1, "s1", s1, EET_T_STRING);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(res, Eet_St1, "s1", s1, EET_T_STRING);
return res;
} /* _eet_st1_dd */
static void
-_eet_st1_set(Eet_St1 * st1, int i)
+_eet_st1_set(Eet_St1 *st1,
+ int i)
{
st1->val1 = EET_TEST_DOUBLE;
st1->stuff = EET_TEST_INT + i;
@@ -2425,7 +2437,8 @@ _eet_st1_set(Eet_St1 * st1, int i)
} /* _eet_st1_set */
static void
-_eet_st1_cmp(Eet_St1 * st1, int i)
+_eet_st1_cmp(Eet_St1 *st1,
+ int i)
{
double tmp;
@@ -2433,7 +2446,7 @@ _eet_st1_cmp(Eet_St1 * st1, int i)
tmp = st1->val1 - EET_TEST_DOUBLE;
if (tmp < 0)
- tmp = -tmp;
+ tmp = -tmp;
fail_if(tmp > 0.005);
fail_if(st1->stuff != EET_TEST_INT + i);
@@ -2444,7 +2457,7 @@ static Eet_Data_Descriptor *
_eet_st2_dd(void)
{
Eet_Data_Descriptor_Class eddc;
- Eet_Data_Descriptor * res;
+ Eet_Data_Descriptor *res;
EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, Eet_St2);
res = eet_data_descriptor_stream_new(&eddc);
@@ -2455,14 +2468,16 @@ _eet_st2_dd(void)
} /* _eet_st2_dd */
static void
-_eet_st2_set(Eet_St2 * st2, int i)
+_eet_st2_set(Eet_St2 *st2,
+ int i)
{
st2->b1 = EINA_TRUE;
st2->v1 = EET_TEST_LONG_LONG + i;
} /* _eet_st2_set */
static void
-_eet_st2_cmp(Eet_St2 * st2, int i)
+_eet_st2_cmp(Eet_St2 *st2,
+ int i)
{
fail_if(!st2->b1);
fail_if(st2->v1 != EET_TEST_LONG_LONG + i);
@@ -2472,7 +2487,7 @@ static Eet_Data_Descriptor *
_eet_st3_dd(void)
{
Eet_Data_Descriptor_Class eddc;
- Eet_Data_Descriptor * res;
+ Eet_Data_Descriptor *res;
EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, Eet_St3);
res = eet_data_descriptor_stream_new(&eddc);
@@ -2482,26 +2497,28 @@ _eet_st3_dd(void)
} /* _eet_st3_dd */
static void
-_eet_st3_set(Eet_St3 * st3, int i)
+_eet_st3_set(Eet_St3 *st3,
+ int i)
{
st3->boby = EET_TEST_INT + i;
} /* _eet_st3_set */
static void
-_eet_st3_cmp(Eet_St3 * st3, int i)
+_eet_st3_cmp(Eet_St3 *st3,
+ int i)
{
fail_if(st3->boby != EET_TEST_INT + i);
} /* _eet_st3_cmp */
START_TEST(eet_test_union)
{
- Eet_Union_Test * eut;
- Eet_List * l;
+ Eet_Union_Test *eut;
+ Eet_List *l;
Eet_Data_Descriptor_Class eddc;
- Eet_Data_Descriptor * edd;
- Eet_Data_Descriptor * unified;
- Eet_Data_Descriptor * m;
- void * blob;
+ Eet_Data_Descriptor *edd;
+ Eet_Data_Descriptor *unified;
+ Eet_Data_Descriptor *m;
+ void *blob;
int size;
int i;
@@ -2529,10 +2546,10 @@ START_TEST(eet_test_union)
l = calloc(1, sizeof (Eet_List));
-#define EUT_NEW(Type_Index)\
- eut = calloc(1, sizeof (Eet_Union_Test));\
- eut->type = EET_ST ## Type_Index;\
- _eet_st ## Type_Index ## _set(&(eut->u.st ## Type_Index), i);
+#define EUT_NEW(Type_Index) \
+ eut = calloc(1, sizeof (Eet_Union_Test)); \
+ eut->type = EET_ST ## Type_Index; \
+ _eet_st ## Type_Index ## _set(&(eut->u.st ## Type_Index), i);
for (i = 0; i < 3; ++i)
{
@@ -2554,10 +2571,10 @@ START_TEST(eet_test_union)
fail_if(eina_list_count(l->list) != 9);
-#define EUT_CMP(Type_Index)\
- eut = eina_list_nth(l->list, i * 3 + Type_Index - 1);\
- fail_if(eut->type != EET_ST ## Type_Index);\
- _eet_st ## Type_Index ## _cmp(&(eut->u.st ## Type_Index), i);
+#define EUT_CMP(Type_Index) \
+ eut = eina_list_nth(l->list, i * 3 + Type_Index - 1); \
+ fail_if(eut->type != EET_ST ## Type_Index); \
+ _eet_st ## Type_Index ## _cmp(&(eut->u.st ## Type_Index), i);
for (i = 0; i < 3; ++i)
{
@@ -2570,19 +2587,18 @@ START_TEST(eet_test_union)
eina_shutdown();
}
END_TEST
-
START_TEST(eet_test_variant)
{
- Eet_Variant_Test * evt;
- Eet_List * l;
- Eet_St1 * st1;
- Eet_St2 * st2;
- Eet_St3 * st3;
+ Eet_Variant_Test *evt;
+ Eet_List *l;
+ Eet_St1 *st1;
+ Eet_St2 *st2;
+ Eet_St3 *st3;
Eet_Data_Descriptor_Class eddc;
- Eet_Data_Descriptor * edd;
- Eet_Data_Descriptor * unified;
- Eet_Data_Descriptor * m;
- void * blob;
+ Eet_Data_Descriptor *edd;
+ Eet_Data_Descriptor *unified;
+ Eet_Data_Descriptor *m;
+ void *blob;
int size;
int i;
@@ -2626,12 +2642,12 @@ START_TEST(eet_test_variant)
l = calloc(1, sizeof (Eet_List));
-#define EVT_NEW(Type_Index)\
- evt = calloc(1, sizeof (Eet_Variant_Test));\
- evt->t.type = eet_mapping[Type_Index - 1].name;\
- st ## Type_Index = calloc(1, sizeof (Eet_St ## Type_Index));\
- _eet_st ## Type_Index ## _set(st ## Type_Index, i);\
- evt->data = st ## Type_Index;
+#define EVT_NEW(Type_Index) \
+ evt = calloc(1, sizeof (Eet_Variant_Test)); \
+ evt->t.type = eet_mapping[Type_Index - 1].name; \
+ st ## Type_Index = calloc(1, sizeof (Eet_St ## Type_Index)); \
+ _eet_st ## Type_Index ## _set(st ## Type_Index, i); \
+ evt->data = st ## Type_Index;
for (i = 0; i < 3; ++i)
{
@@ -2657,10 +2673,10 @@ START_TEST(eet_test_variant)
fail_if(eina_list_count(l->list) != 9);
-#define EVT_CMP(Type_Index)\
- evt = eina_list_nth(l->list, i * 3 + Type_Index - 1);\
- fail_if(strcmp(evt->t.type, eet_mapping[Type_Index - 1].name) != 0);\
- _eet_st ## Type_Index ## _cmp(evt->data, i);
+#define EVT_CMP(Type_Index) \
+ evt = eina_list_nth(l->list, i * 3 + Type_Index - 1); \
+ fail_if(strcmp(evt->t.type, eet_mapping[Type_Index - 1].name) != 0); \
+ _eet_st ## Type_Index ## _cmp(evt->data, i);
for (i = 0; i < 3; ++i)
{
@@ -2685,8 +2701,8 @@ END_TEST
Suite *
eet_suite(void)
{
- Suite * s;
- TCase * tc;
+ Suite *s;
+ TCase *tc;
s = suite_create("Eet");
@@ -2746,8 +2762,8 @@ eet_suite(void)
int
main(void)
{
- Suite * s;
- SRunner * sr;
+ Suite *s;
+ SRunner *sr;
int failed_count;
s = eet_suite();
diff --git a/src/tests/eet_suite.h b/src/tests/eet_suite.h
index a0f5ed3..c5c91aa 100644
--- a/src/tests/eet_suite.h
+++ b/src/tests/eet_suite.h
@@ -3,6 +3,7 @@
#include "Eet.h"
-void eet_test_setup_eddc(Eet_Data_Descriptor_Class * eddc);
+void
+eet_test_setup_eddc(Eet_Data_Descriptor_Class *eddc);
#endif /* _EET_SUITE_H */