summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2010-07-31 01:54:48 +0000
committerCarsten Haitzler <raster@rasterman.com>2010-07-31 01:54:48 +0000
commit28ccb50c2d7dd291d49a315473af9137cae751f5 (patch)
treed26e94d1618defc7562ebc23b3f8439e0873271b
parent4ca6a6338f9e5db5b117f782c86974fbd0660cbb (diff)
downloadeet-28ccb50c2d7dd291d49a315473af9137cae751f5.tar.gz
formatting. <- uncrustify
SVN revision: 50698
-rw-r--r--src/bin/eet_main.c134
-rw-r--r--src/examples/eet-data-file_descriptor.c167
-rw-r--r--src/examples/eet-data-nested.c70
-rw-r--r--src/examples/eet-data-simple.c50
-rw-r--r--src/lib/Eet.h1197
-rw-r--r--src/lib/Eet_private.h195
-rw-r--r--src/lib/eet_cipher.c429
-rw-r--r--src/lib/eet_connection.c92
-rw-r--r--src/lib/eet_data.c2304
-rw-r--r--src/lib/eet_dictionary.c120
-rw-r--r--src/lib/eet_image.c910
-rw-r--r--src/lib/eet_lib.c640
-rw-r--r--src/lib/eet_node.c316
-rw-r--r--src/lib/eet_utils.c9
-rw-r--r--src/tests/eet_data_suite.c24
-rw-r--r--src/tests/eet_suite.c700
-rw-r--r--src/tests/eet_suite.h3
17 files changed, 3698 insertions, 3662 deletions
diff --git a/src/bin/eet_main.c b/src/bin/eet_main.c
index 587146f..68c3886 100644
--- a/src/bin/eet_main.c
+++ b/src/bin/eet_main.c
@@ -4,55 +4,54 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
-#endif
+#endif /* ifdef HAVE_CONFIG_H */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifndef _MSC_VER
# include <unistd.h>
-#endif
+#endif /* ifndef _MSC_VER */
#ifdef HAVE_EVIL
# include <Evil.h>
-#endif
+#endif /* ifdef HAVE_EVIL */
#include <Eet.h>
-
static int _eet_main_log_dom = -1;
#ifdef EET_DEFAULT_LOG_COLOR
#undef EET_DEFAULT_LOG_COLOR
-#endif
+#endif /* ifdef EET_DEFAULT_LOG_COLOR */
#define EET_DEFAULT_LOG_COLOR EINA_COLOR_CYAN
#ifdef ERR
#undef ERR
-#endif
-#define ERR(...) EINA_LOG_DOM_ERR(_eet_main_log_dom, __VA_ARGS__)
+#endif /* ifdef ERR */
+#define ERR(...) EINA_LOG_DOM_ERR(_eet_main_log_dom, __VA_ARGS__)
#ifdef DBG
#undef DBG
-#endif
-#define DBG(...) EINA_LOG_DOM_DBG(_eet_main_log_dom, __VA_ARGS__)
+#endif /* ifdef DBG */
+#define DBG(...) EINA_LOG_DOM_DBG(_eet_main_log_dom, __VA_ARGS__)
#ifdef INF
#undef INF
-#endif
-#define INF(...) EINA_LOG_DOM_INFO(_eet_main_log_dom, __VA_ARGS__)
+#endif /* ifdef INF */
+#define INF(...) EINA_LOG_DOM_INFO(_eet_main_log_dom, __VA_ARGS__)
#ifdef WRN
#undef WRN
-#endif
-#define WRN(...) EINA_LOG_DOM_WARN(_eet_main_log_dom, __VA_ARGS__)
+#endif /* ifdef WRN */
+#define WRN(...) EINA_LOG_DOM_WARN(_eet_main_log_dom, __VA_ARGS__)
#ifdef CRIT
#undef CRIT
-#endif
+#endif /* ifdef CRIT */
#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)
@@ -70,18 +69,18 @@ do_eet_list(const char *file)
}
eet_close(ef);
-}
+} /* 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)
@@ -113,22 +112,22 @@ do_eet_extract(const char *file,
fclose(f);
free(data);
eet_close(ef);
-}
+} /* 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)
@@ -152,19 +151,19 @@ do_eet_decode(const char *file,
fclose(f);
eet_close(ef);
-}
+} /* 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)
@@ -203,20 +202,20 @@ do_eet_insert(const char *file,
eet_write_cipher(ef, key, data, size, compress, crypto_key);
free(data);
eet_close(ef);
-}
+} /* 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)
@@ -260,12 +259,12 @@ do_eet_encode(const char *file,
free(text);
eet_close(ef);
-}
+} /* 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)
@@ -276,13 +275,13 @@ do_eet_remove(const char *file, const char *key)
eet_delete(ef, key);
eet_close(ef);
-}
+} /* 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;
@@ -302,13 +301,13 @@ do_eet_check(const char *file)
fprintf(stdout, "Signature length %i.\n", sign_length);
eet_close(ef);
-}
+} /* 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)
@@ -330,10 +329,10 @@ do_eet_sign(const char *file, const char *private_key, const char *public_key)
eet_identity_set(ef, key);
eet_close(ef);
-}
+} /* do_eet_sign */
int
-main(int argc, char **argv)
+main(int argc, char ** argv)
{
if (!eet_init())
return -1;
@@ -397,7 +396,7 @@ help:
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]);
else if ((!strcmp(argv[1], "-s")) && (argc > 4))
@@ -408,4 +407,5 @@ help:
eina_log_domain_unregister(_eet_main_log_dom);
eet_shutdown();
return 0;
-}
+} /* main */
+
diff --git a/src/examples/eet-data-file_descriptor.c b/src/examples/eet-data-file_descriptor.c
index a917e1d..70fba7b 100644
--- a/src/examples/eet-data-file_descriptor.c
+++ b/src/examples/eet-data-file_descriptor.c
@@ -9,9 +9,9 @@
// complex real-world structures based on elmdentica database
typedef struct
{
- const char *screen_name;
- const char *name;
- const char *message;
+ const char * screen_name;
+ const char * name;
+ const char * message;
unsigned int id;
unsigned int status_id;
unsigned int date;
@@ -20,22 +20,22 @@ typedef struct
typedef struct
{
- const char *dm_to;
- const char *message;
+ const char * dm_to;
+ const char * message;
} My_Post;
typedef struct
{
unsigned int id;
- const char *name;
- Eina_List *messages;
- Eina_List *posts;
+ const char * name;
+ Eina_List * messages;
+ Eina_List * posts;
} My_Account;
typedef struct
{
unsigned int version; // it is recommended to use versioned configuration!
- Eina_List *accounts;
+ Eina_List * accounts;
} My_Cache;
// string that represents the entry in eet file, you might like to have
@@ -46,14 +46,14 @@ static const char MY_CACHE_FILE_ENTRY[] = "cache";
// 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_cache_descriptor;
-static Eet_Data_Descriptor *_my_account_descriptor;
-static Eet_Data_Descriptor *_my_message_descriptor;
-static Eet_Data_Descriptor *_my_post_descriptor;
+static Eet_Data_Descriptor * _my_cache_descriptor;
+static Eet_Data_Descriptor * _my_account_descriptor;
+static Eet_Data_Descriptor * _my_message_descriptor;
+static Eet_Data_Descriptor * _my_post_descriptor;
// keep file handle alive, so mmap()ed strings are all alive as well
-static Eet_File *_my_cache_file = NULL;
-static Eet_Dictionary *_my_cache_dict = NULL;
+static Eet_File * _my_cache_file = NULL;
+static Eet_Dictionary * _my_cache_dict = NULL;
static void
_my_cache_descriptor_init(void)
@@ -78,8 +78,8 @@ _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 \
+#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);
@@ -90,15 +90,15 @@ _my_cache_descriptor_init(void)
ADD_BASIC(timeline, EET_T_UINT);
#undef ADD_BASIC
-#define ADD_BASIC(member, eet_type) \
- EET_DATA_DESCRIPTOR_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);
ADD_BASIC(message, EET_T_STRING);
#undef ADD_BASIC
-#define ADD_BASIC(member, eet_type) \
- EET_DATA_DESCRIPTOR_ADD_BASIC \
+#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);
@@ -111,8 +111,8 @@ _my_cache_descriptor_init(void)
(_my_account_descriptor, My_Account, "posts", posts,
_my_post_descriptor);
-#define ADD_BASIC(member, eet_type) \
- EET_DATA_DESCRIPTOR_ADD_BASIC \
+#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
@@ -120,7 +120,7 @@ _my_cache_descriptor_init(void)
EET_DATA_DESCRIPTOR_ADD_LIST
(_my_cache_descriptor, My_Cache, "accounts", accounts,
_my_account_descriptor);
-}
+} /* _my_cache_descriptor_init */
static void
_my_cache_descriptor_shutdown(void)
@@ -129,12 +129,12 @@ _my_cache_descriptor_shutdown(void)
eet_data_descriptor_free(_my_account_descriptor);
eet_data_descriptor_free(_my_message_descriptor);
eet_data_descriptor_free(_my_post_descriptor);
-}
+} /* _my_cache_descriptor_shutdown */
// 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;
@@ -143,12 +143,12 @@ _eet_string_free(const char *str)
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");
@@ -157,21 +157,21 @@ _my_message_new(const char *message)
msg->message = eina_stringshare_add(message);
return msg;
-}
+} /* _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);
_eet_string_free(msg->message);
free(msg);
-}
+} /* _my_message_free */
static My_Post *
-_my_post_new(const char *message)
+_my_post_new(const char * message)
{
- My_Post *post = calloc(1, sizeof(My_Post));
+ My_Post * post = calloc(1, sizeof(My_Post));
if (!post)
{
fprintf(stderr, "ERROR: could not calloc My_Post\n");
@@ -180,20 +180,20 @@ _my_post_new(const char *message)
post->message = eina_stringshare_add(message);
return post;
-}
+} /* _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);
free(post);
-}
+} /* _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");
@@ -202,13 +202,13 @@ _my_account_new(const char *name)
acc->name = eina_stringshare_add(name);
return acc;
-}
+} /* _my_account_new */
static void
-_my_account_free(My_Account *acc)
+_my_account_free(My_Account * acc)
{
- My_Message *m;
- My_Post *p;
+ My_Message * m;
+ My_Post * p;
_eet_string_free(acc->name);
@@ -219,12 +219,12 @@ _my_account_free(My_Account *acc)
_my_post_free(p);
free(acc);
-}
+} /* _my_account_free */
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");
@@ -233,34 +233,34 @@ _my_cache_new(void)
my_cache->version = 1;
return my_cache;
-}
+} /* _my_cache_new */
static void
-_my_cache_free(My_Cache *my_cache)
+_my_cache_free(My_Cache * my_cache)
{
- My_Account *acc;
+ My_Account * acc;
EINA_LIST_FREE(my_cache->accounts, acc)
_my_account_free(acc);
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)
{
- My_Account *acc;
- Eina_List *l;
+ My_Account * acc;
+ Eina_List * l;
EINA_LIST_FOREACH(my_cache->accounts, l, acc)
if (strcmp(acc->name, name) == 0)
return acc;
return NULL;
-}
+} /* _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);
@@ -290,13 +290,13 @@ _my_cache_load(const char *filename)
_my_cache_dict = eet_dictionary_get(ef);
return my_cache;
-}
+} /* _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;
@@ -343,13 +343,13 @@ _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_Account *acc;
+ My_Cache * my_cache;
+ const Eina_List * l_acc;
+ My_Account * acc;
int ret = 0;
if (argc < 3)
@@ -387,7 +387,7 @@ 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]);
@@ -399,7 +399,7 @@ int main(int argc, char *argv[])
argv[4]);
}
else
- fprintf(stderr,
+ fprintf(stderr,
"ERROR: wrong number of parameters (%d).\n",
argc);
}
@@ -407,17 +407,17 @@ int main(int argc, char *argv[])
{
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 *post = _my_post_new(argv[5]);
+ My_Post * post = _my_post_new(argv[5]);
acc->posts = eina_list_append(acc->posts, post);
}
else
fprintf(stderr, "ERROR: unknown account: '%s'\n", argv[4]);
}
else
- fprintf(stderr,
+ fprintf(stderr,
"ERROR: wrong number of parameters (%d).\n",
argc);
}
@@ -425,32 +425,32 @@ int main(int argc, char *argv[])
{
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]);
}
else
- fprintf(stderr,
+ 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"
+ printf("My_Cache:\n"
"\tversion.: %#x\n"
"\taccounts: %u\n",
my_cache->version,
eina_list_count(my_cache->accounts));
EINA_LIST_FOREACH(my_cache->accounts, l_acc, acc)
{
- const My_Post *post;
+ const My_Post * post;
printf("\t > %-#8x '%.20s' stats: m=%u, p=%u\n",
acc->id, acc->name ? acc->name : "",
@@ -459,8 +459,8 @@ int main(int argc, char *argv[])
if (eina_list_count(acc->messages))
{
- const Eina_List *l;
- const My_Message *msg;
+ const Eina_List * l;
+ const My_Message * msg;
printf("\t |messages:\n");
EINA_LIST_FOREACH(acc->messages, l, msg)
@@ -475,11 +475,11 @@ int main(int argc, char *argv[])
if (eina_list_count(acc->posts))
{
- const Eina_List *l;
- const My_Post *post;
- printf("\t |posts:\n");
+ const Eina_List * l;
+ const My_Post * post;
+ printf("\t |posts:\n");
- EINA_LIST_FOREACH(acc->posts, l, post)
+ EINA_LIST_FOREACH(acc->posts, l, post)
{
if (post->dm_to)
printf("\t | @%s: '%.20s'\n", post->dm_to, post->message);
@@ -488,7 +488,7 @@ int main(int argc, char *argv[])
}
}
- printf("\n");
+ printf("\n");
}
if (!_my_cache_save(my_cache, argv[2]))
@@ -502,4 +502,5 @@ end:
eina_shutdown();
return ret;
-}
+} /* main */
+
diff --git a/src/examples/eet-data-nested.c b/src/examples/eet-data-nested.c
index 3675718..b11956f 100644
--- a/src/examples/eet-data-nested.c
+++ b/src/examples/eet-data-nested.c
@@ -14,17 +14,17 @@
typedef struct
{
unsigned int version; // it is recommended to use versioned configuration!
- const char *name;
- int id;
- int not_saved_value; // example of not saved data inside!
- Eina_Bool enabled;
- Eina_List *subs;
+ const char * name;
+ int id;
+ int not_saved_value; // example of not saved data inside!
+ Eina_Bool enabled;
+ 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
@@ -32,12 +32,11 @@ typedef struct
// different strings
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)
@@ -64,11 +63,11 @@ _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 \
+#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 \
+#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);
@@ -85,20 +84,20 @@ _my_conf_descriptor_init(void)
#undef MY_CONF_ADD_BASIC
#undef MY_CONF_SUB_ADD_BASIC
-}
+} /* _my_conf_descriptor_init */
static void
_my_conf_descriptor_shutdown(void)
{
eet_data_descriptor_free(_my_conf_sub_descriptor);
eet_data_descriptor_free(_my_conf_descriptor);
-}
+} /* _my_conf_descriptor_shutdown */
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");
@@ -117,12 +116,12 @@ _my_conf_new(void)
}
return my_conf;
-}
+} /* _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);
@@ -131,13 +130,13 @@ _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);
@@ -161,13 +160,13 @@ _my_conf_load(const char *filename)
end:
eet_close(ef);
return my_conf;
-}
+} /* _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;
@@ -205,13 +204,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)
@@ -236,7 +235,7 @@ int main(int argc, char *argv[])
}
}
- printf("My_Conf_Type:\n"
+ printf("My_Conf_Type:\n"
"\tversion: %#x\n"
"\tname...: '%s'\n"
"\tid.....: %d\n"
@@ -263,4 +262,5 @@ end:
eina_shutdown();
return ret;
-}
+} /* main */
+
diff --git a/src/examples/eet-data-simple.c b/src/examples/eet-data-simple.c
index a4efd4a..14b0a86 100644
--- a/src/examples/eet-data-simple.c
+++ b/src/examples/eet-data-simple.c
@@ -14,10 +14,10 @@
typedef struct
{
unsigned int version; // it is recommended to use versioned configuration!
- const char *name;
- int id;
- int not_saved_value; // example of not saved data inside!
- Eina_Bool enabled;
+ const char * name;
+ int id;
+ int not_saved_value; // example of not saved data inside!
+ Eina_Bool enabled;
} My_Conf_Type;
// string that represents the entry in eet file, you might like to have
@@ -25,11 +25,10 @@ typedef struct
// different strings
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)
@@ -53,8 +52,8 @@ _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 \
+#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);
@@ -63,18 +62,18 @@ _my_conf_descriptor_init(void)
MY_CONF_ADD_BASIC(enabled, EET_T_UCHAR);
#undef MY_CONF_ADD_BASIC
-}
+} /* _my_conf_descriptor_init */
static void
_my_conf_descriptor_shutdown(void)
{
eet_data_descriptor_free(_my_conf_descriptor);
-}
+} /* _my_conf_descriptor_shutdown */
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");
@@ -84,20 +83,20 @@ _my_conf_new(void)
my_conf->version = 0x112233;
my_conf->enabled = EINA_TRUE;
return my_conf;
-}
+} /* _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);
@@ -121,13 +120,13 @@ _my_conf_load(const char *filename)
end:
eet_close(ef);
return my_conf;
-}
+} /* _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;
@@ -165,11 +164,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)
@@ -194,7 +193,7 @@ int main(int argc, char *argv[])
}
}
- printf("My_Conf_Type:\n"
+ printf("My_Conf_Type:\n"
"\tversion: %#x\n"
"\tname...: '%s'\n"
"\tid.....: %d\n"
@@ -215,4 +214,5 @@ end:
eina_shutdown();
return ret;
-}
+} /* main */
+
diff --git a/src/lib/Eet.h b/src/lib/Eet.h
index 2104d80..96ebbee 100644
--- a/src/lib/Eet.h
+++ b/src/lib/Eet.h
@@ -7,33 +7,33 @@
#ifdef EAPI
# undef EAPI
-#endif
+#endif /* ifdef EAPI */
#ifdef _WIN32
# ifdef EFL_EET_BUILD
# ifdef DLL_EXPORT
# define EAPI __declspec(dllexport)
-# else
+# else /* ifdef DLL_EXPORT */
# define EAPI
# endif /* ! DLL_EXPORT */
-# else
+# else /* ifdef EFL_EET_BUILD */
# define EAPI __declspec(dllimport)
# endif /* ! EFL_EET_BUILD */
-#else
+#else /* ifdef _WIN32 */
# ifdef __GNUC__
# if __GNUC__ >= 4
# define EAPI __attribute__ ((visibility("default")))
-# else
+# else /* if __GNUC__ >= 4 */
# define EAPI
-# endif
-# else
+# endif /* if __GNUC__ >= 4 */
+# else /* ifdef __GNUC__ */
# define EAPI
-# endif
+# endif /* ifdef __GNUC__ */
#endif /* ! _WIN32 */
#ifdef __cplusplus
extern "C" {
-#endif
+#endif /* ifdef __cplusplus */
/**
* @file Eet.h
@@ -76,7 +76,7 @@ typedef struct _Eet_Version
int revision; /** < svn revision (0 if a proper rlease or the svn revsion number Eet is built from) */
} Eet_Version;
-EAPI extern Eet_Version *eet_version;
+EAPI extern Eet_Version * eet_version;
/**
* @defgroup Eet_Group Top level functions
@@ -124,7 +124,7 @@ typedef enum _Eet_Error
* @since 1.0.0
* @ingroup Eet_Group
*/
-EAPI int eet_init(void);
+EAPI int eet_init(void);
/**
* Shut down the EET library.
@@ -134,7 +134,7 @@ EAPI int eet_init(void);
* @since 1.0.0
* @ingroup Eet_Group
*/
-EAPI int eet_shutdown(void);
+EAPI int eet_shutdown(void);
/**
* Clear eet cache
@@ -147,8 +147,7 @@ EAPI int eet_shutdown(void);
* @since 1.0.0
* @ingroup Eet_Group
*/
-EAPI void eet_clearcache(void);
-
+EAPI void eet_clearcache(void);
/**
* @defgroup Eet_File_Group Eet File Main Functions
@@ -179,14 +178,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;
/**
* @}
@@ -262,7 +260,8 @@ typedef struct _Eet_Dictionary Eet_Dictionary;
*
* @since 1.0.0
*/
-EAPI Eet_File * eet_open(const char *file, Eet_File_Mode mode);
+EAPI Eet_File * eet_open(const char * file,
+ Eet_File_Mode mode);
/**
* Open an eet file directly from a memory location. The data are not copied,
@@ -273,7 +272,8 @@ EAPI Eet_File * eet_open(const char *file, Eet_File_Mode mode);
* @since 1.1.0
* @ingroup Eet_File_Group
*/
-EAPI Eet_File * eet_memopen_read(const void *data, size_t size);
+EAPI Eet_File * eet_memopen_read(const void * data,
+ size_t size);
/**
* Get the mode an Eet_File was opened with.
@@ -283,7 +283,7 @@ EAPI Eet_File * eet_memopen_read(const void *data, size_t size);
* @since 1.0.0
* @ingroup Eet_File_Group
*/
-EAPI Eet_File_Mode eet_mode_get(Eet_File *ef);
+EAPI Eet_File_Mode eet_mode_get(Eet_File * ef);
/**
* Close an eet file handle and flush and writes pending.
@@ -298,7 +298,7 @@ EAPI Eet_File_Mode eet_mode_get(Eet_File *ef);
* @since 1.0.0
* @ingroup Eet_File_Group
*/
-EAPI Eet_Error eet_close(Eet_File *ef);
+EAPI Eet_Error eet_close(Eet_File * ef);
/**
* Sync content of an eet file handle, flushing pending writes.
@@ -312,7 +312,7 @@ EAPI Eet_Error eet_close(Eet_File *ef);
* @since 1.2.4
* @ingroup Eet_File_Group
*/
-EAPI Eet_Error eet_sync(Eet_File *ef);
+EAPI Eet_Error eet_sync(Eet_File * ef);
/**
* Return a handle to the shared string dictionary of the Eet file
@@ -330,7 +330,7 @@ EAPI Eet_Error eet_sync(Eet_File *ef);
* @since 1.0.0
* @ingroup Eet_File_Group
*/
-EAPI Eet_Dictionary *eet_dictionary_get(Eet_File *ef);
+EAPI Eet_Dictionary * eet_dictionary_get(Eet_File * ef);
/**
* Check if a given string comes from a given dictionary
@@ -346,8 +346,8 @@ EAPI Eet_Dictionary *eet_dictionary_get(Eet_File *ef);
* @since 1.0.0
* @ingroup Eet_File_Group
*/
-EAPI int eet_dictionary_string_check(Eet_Dictionary *ed,
- const char *string);
+EAPI int eet_dictionary_string_check(Eet_Dictionary * ed,
+ const char * string);
/**
* Read a specified entry from an eet file and return data
@@ -371,7 +371,9 @@ EAPI int eet_dictionary_string_check(Eet_Dictionary *ed,
* @since 1.0.0
* @ingroup Eet_File_Group
*/
-EAPI void * eet_read(Eet_File *ef, const char *name, int *size_ret);
+EAPI void * eet_read(Eet_File * ef,
+ const char * name,
+ int * size_ret);
/**
* Read a specified entry from an eet file and return data
@@ -393,9 +395,9 @@ EAPI void * eet_read(Eet_File *ef, const char *name, int *size_ret);
* @since 1.0.0
* @ingroup Eet_File_Group
*/
-EAPI const void * eet_read_direct(Eet_File *ef,
- const char *name,
- int *size_ret);
+EAPI const void * eet_read_direct(Eet_File * ef,
+ const char * name,
+ int * size_ret);
/**
* Write a specified entry to an eet file handle
@@ -425,11 +427,11 @@ EAPI const void * eet_read_direct(Eet_File *ef,
* @since 1.0.0
* @ingroup Eet_File_Group
*/
-EAPI int eet_write(Eet_File *ef,
- const char *name,
- const void *data,
- int size,
- int compress);
+EAPI int eet_write(Eet_File * ef,
+ const char * name,
+ const void * data,
+ int size,
+ int compress);
/**
* Delete a specified entry from an Eet file being written or re-written
@@ -449,7 +451,8 @@ EAPI int eet_write(Eet_File *ef,
* @since 1.0.0
* @ingroup Eet_File_Group
*/
-EAPI int eet_delete(Eet_File *ef, const char *name);
+EAPI int eet_delete(Eet_File * ef,
+ const char * name);
/**
* Alias a specific section to another one. Destination may exist or not,
@@ -465,11 +468,10 @@ EAPI int eet_delete(Eet_File *ef, const char *name);
* @since 1.3.3
* @ingroup Eet_File_Group
*/
-EAPI Eina_Bool eet_alias(Eet_File *ef,
- const char *name,
- const char *destination,
- int compress);
-
+EAPI Eina_Bool eet_alias(Eet_File * ef,
+ const char * name,
+ const char * destination,
+ int compress);
/**
* List all entries in eet file matching shell glob.
@@ -501,7 +503,9 @@ EAPI Eina_Bool eet_alias(Eet_File *ef,
* @since 1.0.0
* @ingroup Eet_File_Group
*/
-EAPI char **eet_list(Eet_File *ef, const char *glob, int *count_ret);
+EAPI char ** eet_list(Eet_File * ef,
+ const char * glob,
+ int * count_ret);
/**
* Return the number of entries in the specified eet file.
@@ -512,7 +516,7 @@ EAPI char **eet_list(Eet_File *ef, const char *glob, int *count_ret);
* @since 1.0.0
* @ingroup Eet_File_Group
*/
-EAPI int eet_num_entries(Eet_File *ef);
+EAPI int eet_num_entries(Eet_File * ef);
/**
* @defgroup Eet_File_Cipher_Group Eet File Ciphered Main Functions
@@ -548,10 +552,10 @@ EAPI int eet_num_entries(Eet_File *ef);
* @since 1.0.0
* @ingroup Eet_File_Cipher_Group
*/
-EAPI void * eet_read_cipher(Eet_File *ef,
- const char *name,
- int *size_ret,
- const char *cipher_key);
+EAPI void * eet_read_cipher(Eet_File * ef,
+ const char * name,
+ int * size_ret,
+ const char * cipher_key);
/**
* Write a specified entry to an eet file handle using a cipher.
@@ -582,13 +586,12 @@ EAPI void * eet_read_cipher(Eet_File *ef,
* @since 1.0.0
* @ingroup Eet_File_Cipher_Group
*/
-EAPI int eet_write_cipher(Eet_File *ef,
- const char *name,
- const void *data,
- int size,
- int compress,
- const char *cipher_key);
-
+EAPI int eet_write_cipher(Eet_File * ef,
+ const char * name,
+ const void * data,
+ int size,
+ int compress,
+ const char * cipher_key);
/**
* @defgroup Eet_File_Image_Group Image Store and Load
@@ -633,14 +636,14 @@ EAPI int eet_write_cipher(Eet_File *ef,
* @since 1.0.0
* @ingroup Eet_File_Image_Group
*/
-EAPI int 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);
+EAPI int 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);
/**
* Read image data from the named key in the eet file.
@@ -680,14 +683,14 @@ EAPI int eet_data_image_header_read(Eet_File *ef,
* @since 1.0.0
* @ingroup Eet_File_Image_Group
*/
-EAPI void *eet_data_image_read(Eet_File *ef,
- const char *name,
- unsigned int *w,
- unsigned int *h,
- int *alpha,
- int *compress,
- int *quality,
- int *lossy);
+EAPI void * eet_data_image_read(Eet_File * ef,
+ const char * name,
+ unsigned int * w,
+ unsigned int * h,
+ int * alpha,
+ int * compress,
+ int * quality,
+ int * lossy);
/**
* Read image data from the named key in the eet file.
@@ -729,18 +732,18 @@ EAPI void *eet_data_image_read(Eet_File *ef,
* @since 1.0.2
* @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,
- unsigned int *d,
- unsigned int w,
- unsigned int h,
- unsigned int row_stride,
- int *alpha,
- int *compress,
- int *quality,
- int *lossy);
+EAPI int 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);
/**
* Write image data to the named key in an eet file.
@@ -777,15 +780,15 @@ EAPI int eet_data_image_read_to_surface(Eet_File *ef,
* @since 1.0.0
* @ingroup Eet_File_Image_Group
*/
-EAPI int 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);
+EAPI int 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);
/**
* Decode Image data header only to get information.
@@ -823,14 +826,14 @@ EAPI int eet_data_image_write(Eet_File *ef,
* @since 1.0.0
* @ingroup Eet_File_Image_Group
*/
-EAPI int eet_data_image_header_decode(const void *data,
- int size,
- unsigned int *w,
- unsigned int *h,
- int *alpha,
- int *compress,
- int *quality,
- int *lossy);
+EAPI int eet_data_image_header_decode(const void * data,
+ int size,
+ unsigned int * w,
+ unsigned int * h,
+ int * alpha,
+ int * compress,
+ int * quality,
+ int * lossy);
/**
* Decode Image data into pixel data.
@@ -870,14 +873,14 @@ EAPI int eet_data_image_header_decode(const void *data,
* @since 1.0.0
* @ingroup Eet_File_Image_Group
*/
-EAPI void *eet_data_image_decode(const void *data,
- int size,
- unsigned int *w,
- unsigned int *h,
- int *alpha,
- int *compress,
- int *quality,
- int *lossy);
+EAPI void * eet_data_image_decode(const void * data,
+ int size,
+ unsigned int * w,
+ unsigned int * h,
+ int * alpha,
+ int * compress,
+ int * quality,
+ int * lossy);
/**
* Decode Image data into pixel data.
@@ -919,18 +922,18 @@ EAPI void *eet_data_image_decode(const void *data,
* @since 1.0.2
* @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,
- unsigned int *d,
- unsigned int w,
- unsigned int h,
- unsigned int row_stride,
- int *alpha,
- int *compress,
- int *quality,
- int *lossy);
+EAPI int 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);
/**
* Encode image data for storage or transmission.
@@ -966,14 +969,14 @@ EAPI int eet_data_image_decode_to_surface(const void *data,
* @since 1.0.0
* @ingroup Eet_File_Image_Group
*/
-EAPI void *eet_data_image_encode(const void *data,
- int *size_ret,
- unsigned int w,
- unsigned int h,
- int alpha,
- int compress,
- int quality,
- int lossy);
+EAPI void * eet_data_image_encode(const void * data,
+ int * size_ret,
+ unsigned int w,
+ unsigned int h,
+ int alpha,
+ int compress,
+ int quality,
+ int lossy);
/**
* @defgroup Eet_File_Image_Cipher_Group Image Store and Load using a Cipher
@@ -1023,15 +1026,15 @@ EAPI void *eet_data_image_encode(const void *data,
* @since 1.0.0
* @ingroup Eet_File_Image_Cipher_Group
*/
-EAPI int 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);
+EAPI int 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);
/**
* Read image data from the named key in the eet file using a cipher.
@@ -1072,15 +1075,15 @@ EAPI int eet_data_image_header_read_cipher(Eet_File *ef,
* @since 1.0.0
* @ingroup Eet_File_Image_Cipher_Group
*/
-EAPI void *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);
+EAPI void * 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);
/**
* Read image data from the named key in the eet file using a cipher.
@@ -1123,19 +1126,19 @@ EAPI void *eet_data_image_read_cipher(Eet_File *ef,
* @since 1.0.2
* @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,
- unsigned int *d,
- unsigned int w,
- unsigned int h,
- unsigned int row_stride,
- int *alpha,
- int *compress,
- int *quality,
- int *lossy);
+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,
+ unsigned int * d,
+ 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.
@@ -1173,17 +1176,16 @@ EAPI int eet_data_image_read_to_surface_cipher(Eet_File *ef,
* @since 1.0.0
* @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,
- unsigned int w,
- unsigned int h,
- int alpha,
- int compress,
- int quality,
- int lossy);
-
+EAPI int 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);
/**
* Decode Image data header only to get information using a cipher.
@@ -1222,15 +1224,15 @@ EAPI int eet_data_image_write_cipher(Eet_File *ef,
* @since 1.0.0
* @ingroup Eet_File_Image_Cipher_Group
*/
-EAPI int 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);
+EAPI int 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);
/**
* Decode Image data into pixel data using a cipher.
@@ -1271,15 +1273,15 @@ EAPI int eet_data_image_header_decode_cipher(const void *data,
* @since 1.0.0
* @ingroup Eet_File_Image_Cipher_Group
*/
-EAPI void *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);
+EAPI void * 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);
/**
* Decode Image data into pixel data using a cipher.
@@ -1322,19 +1324,19 @@ EAPI void *eet_data_image_decode_cipher(const void *data,
* @since 1.0.2
* @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,
- unsigned int *d,
- unsigned int w,
- unsigned int h,
- unsigned int row_stride,
- int *alpha,
- int *compress,
- int *quality,
- int *lossy);
+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,
+ unsigned int * d,
+ 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.
@@ -1371,16 +1373,15 @@ EAPI int eet_data_image_decode_to_surface_cipher(const void *data,
* @since 1.0.0
* @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);
-
+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);
/**
* @defgroup Eet_Cipher_Group Cipher, Identity and Protection Mechanisms
@@ -1400,13 +1401,12 @@ EAPI void *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;
/**
* @}
*/
-
/**
* Callback used to request if needed the password of a private key.
*
@@ -1419,8 +1419,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.
@@ -1439,9 +1438,9 @@ typedef int (*Eet_Key_Password_Callback)(char *buffer, int size, int rwflag,
* @since 1.2.0
* @ingroup Eet_Cipher_Group
*/
-EAPI Eet_Key * eet_identity_open(const char *certificate_file,
- const char *private_key_file,
- Eet_Key_Password_Callback cb);
+EAPI Eet_Key * 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
@@ -1453,7 +1452,7 @@ EAPI Eet_Key * eet_identity_open(const char *certificate_file,
* @since 1.2.0
* @ingroup Eet_Cipher_Group
*/
-EAPI void eet_identity_close(Eet_Key *key);
+EAPI void eet_identity_close(Eet_Key * key);
/**
* Set a key to sign a file
@@ -1466,7 +1465,8 @@ EAPI void eet_identity_close(Eet_Key *key);
* @since 1.2.0
* @ingroup Eet_Cipher_Group
*/
-EAPI Eet_Error eet_identity_set(Eet_File *ef, Eet_Key *key);
+EAPI Eet_Error eet_identity_set(Eet_File * ef,
+ Eet_Key * key);
/**
* Display both private and public key of an Eet_Key.
@@ -1477,7 +1477,8 @@ EAPI Eet_Error eet_identity_set(Eet_File *ef, Eet_Key *key);
* @since 1.2.0
* @ingroup Eet_Cipher_Group
*/
-EAPI void eet_identity_print(Eet_Key *key, FILE *out);
+EAPI void eet_identity_print(Eet_Key * key,
+ FILE * out);
/**
* Get the x509 der certificate associated with an Eet_File. Will return NULL
@@ -1490,7 +1491,8 @@ EAPI void eet_identity_print(Eet_Key *key, FILE *out);
* @since 1.2.0
* @ingroup Eet_Cipher_Group
*/
-EAPI const void *eet_identity_x509(Eet_File *ef, int *der_length);
+EAPI const void * eet_identity_x509(Eet_File * ef,
+ int * der_length);
/**
* Get the raw signature associated with an Eet_File. Will return NULL
@@ -1502,7 +1504,8 @@ EAPI const void *eet_identity_x509(Eet_File *ef, int *der_length);
*
* @ingroup Eet_Cipher_Group
*/
-EAPI const void *eet_identity_signature(Eet_File *ef, int *signature_length);
+EAPI const void * eet_identity_signature(Eet_File * ef,
+ int * signature_length);
/**
* Get the SHA1 associated with a file. Could be the one used to
@@ -1516,7 +1519,8 @@ EAPI const void *eet_identity_signature(Eet_File *ef, int *signature_length);
* @since 1.2.0
* @ingroup Eet_Cipher_Group
*/
-EAPI const void *eet_identity_sha1(Eet_File *ef, int *sha1_length);
+EAPI const void * eet_identity_sha1(Eet_File * ef,
+ int * sha1_length);
/**
* Display the x509 der certificate to out.
@@ -1528,11 +1532,9 @@ EAPI const void *eet_identity_sha1(Eet_File *ef, int *sha1_length);
* @since 1.2.0
* @ingroup Eet_Cipher_Group
*/
-EAPI void eet_identity_certificate_print(
- const unsigned char *certificate,
- int der_length,
- FILE *out);
-
+EAPI void eet_identity_certificate_print(const unsigned char * certificate,
+ int der_length,
+ FILE * out);
/**
* @defgroup Eet_Data_Group Eet Data Serialization
@@ -1681,35 +1683,35 @@ EAPI void eet_identity_certificate_print(
*
* @{
*/
-#define EET_T_UNKNOW 0 /**< Unknown data encoding type */
-#define EET_T_CHAR 1 /**< Data type: char */
-#define EET_T_SHORT 2 /**< Data type: short */
-#define EET_T_INT 3 /**< Data type: int */
-#define EET_T_LONG_LONG 4 /**< Data type: long long */
-#define EET_T_FLOAT 5 /**< Data type: float */
-#define EET_T_DOUBLE 6 /**< Data type: double */
-#define EET_T_UCHAR 7 /**< Data type: unsigned char */
-#define EET_T_USHORT 8 /**< Data type: unsigned short */
-#define EET_T_UINT 9 /**< Data type: unsigned int */
-#define EET_T_ULONG_LONG 10 /**< Data type: unsigned long long */
-#define EET_T_STRING 11 /**< Data type: char * */
-#define EET_T_INLINED_STRING 12 /**< Data type: char * (but compressed inside the resulting eet) */
-#define EET_T_NULL 13 /**< Data type: (void *) (only use it if you know why) */
-#define EET_T_F32P32 14 /**< Data type: fixed point 32.32 */
-#define EET_T_F16P16 15 /**< Data type: fixed point 16.16 */
-#define EET_T_F8P24 16 /**< Data type: fixed point 8.24 */
-#define EET_T_LAST 18 /**< Last data type */
-
-#define EET_G_UNKNOWN 100 /**< Unknown group data encoding type */
-#define EET_G_ARRAY 101 /**< Fixed size array group type */
-#define EET_G_VAR_ARRAY 102 /**< Variable size array group type */
-#define EET_G_LIST 103 /**< Linked list group type */
-#define EET_G_HASH 104 /**< Hash table group type */
-#define EET_G_UNION 105 /**< Union group type */
-#define EET_G_VARIANT 106 /**< Selectable subtype group */
-#define EET_G_LAST 107 /**< Last group type */
-
-#define EET_I_LIMIT 128 /**< Other type exist but are reserved for internal purpose. */
+#define EET_T_UNKNOW 0 /**< Unknown data encoding type */
+#define EET_T_CHAR 1 /**< Data type: char */
+#define EET_T_SHORT 2 /**< Data type: short */
+#define EET_T_INT 3 /**< Data type: int */
+#define EET_T_LONG_LONG 4 /**< Data type: long long */
+#define EET_T_FLOAT 5 /**< Data type: float */
+#define EET_T_DOUBLE 6 /**< Data type: double */
+#define EET_T_UCHAR 7 /**< Data type: unsigned char */
+#define EET_T_USHORT 8 /**< Data type: unsigned short */
+#define EET_T_UINT 9 /**< Data type: unsigned int */
+#define EET_T_ULONG_LONG 10 /**< Data type: unsigned long long */
+#define EET_T_STRING 11 /**< Data type: char * */
+#define EET_T_INLINED_STRING 12 /**< Data type: char * (but compressed inside the resulting eet) */
+#define EET_T_NULL 13 /**< Data type: (void *) (only use it if you know why) */
+#define EET_T_F32P32 14 /**< Data type: fixed point 32.32 */
+#define EET_T_F16P16 15 /**< Data type: fixed point 16.16 */
+#define EET_T_F8P24 16 /**< Data type: fixed point 8.24 */
+#define EET_T_LAST 18 /**< Last data type */
+
+#define EET_G_UNKNOWN 100 /**< Unknown group data encoding type */
+#define EET_G_ARRAY 101 /**< Fixed size array group type */
+#define EET_G_VAR_ARRAY 102 /**< Variable size array group type */
+#define EET_G_LIST 103 /**< Linked list group type */
+#define EET_G_HASH 104 /**< Hash table group type */
+#define EET_G_UNION 105 /**< Union group type */
+#define EET_G_VARIANT 106 /**< Selectable subtype group */
+#define EET_G_LAST 107 /**< Last group type */
+
+#define EET_I_LIMIT 128 /**< Other type exist but are reserved for internal purpose. */
/**
* @typedef Eet_Data_Descriptor
@@ -1725,7 +1727,7 @@ EAPI void eet_identity_certificate_print(
* @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
@@ -1742,7 +1744,7 @@ 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 struct _Eet_Data_Descriptor_Class Eet_Data_Descriptor_Class;
/**
* @struct _Eet_Data_Descriptor_Class
@@ -1756,29 +1758,26 @@ typedef struct _Eet_Data_Descriptor_Class Eet_Data_Descriptor_Class;
*/
struct _Eet_Data_Descriptor_Class
{
- int version; /**< ABI version as #EET_DATA_DESCRIPTOR_CLASS_VERSION */
- const char *name; /**< Name of data type to be serialized */
- int size; /**< Size in bytes of data type to be serialized */
+ int version; /**< ABI version as #EET_DATA_DESCRIPTOR_CLASS_VERSION */
+ const char * name; /**< Name of data type to be serialized */
+ int size; /**< Size in bytes of data type to be serialized */
struct
{
- void *(*mem_alloc)(size_t size); /**< how to allocate memory (usually malloc()) */
- void (*mem_free)(void *mem); /**< how to free memory (usually free()) */
- char *(*str_alloc)(const char *str); /**< how to allocate a string */
- void (*str_free)(const char *str); /**< how to free a string */
- void *(*list_next)(void *l); /**< how to iterate to the next element of a list. Receives and should return the list node. */
- void *(*list_append)(void *l, void *d); /**< how to append data @p d to list which head node is @p l */
- void *(*list_data)(void *l); /**< retrieves the data from node @p l */
- void *(*list_free)(void *l); /**< free all the nodes from the list which head node is @p l */
- void (*hash_foreach)(void *h,
- int (*func)(void *h, const char *k, void *dt,
- void *fdt), void *fdt); /**< iterates over all elements in the hash @p h in no specific order */
- void *(*hash_add)(void *h, const char *k, void *d); /**< add a new data @p d as key @p k in hash @p h */
- void (*hash_free)(void *h); /**< free all entries from the hash @p h */
- char *(*str_direct_alloc)(const char *str); /**< how to allocate a string directly from file backed/mmaped region pointed by @p str */
- void (*str_direct_free)(const char *str); /**< how to free a string returned by str_direct_alloc */
-
- const char *(*type_get)(const void *data, Eina_Bool *unknow); /**< convert any kind of data type to a name that define an Eet_Data_Element. */
- Eina_Bool (*type_set)(const char *type, void *data, Eina_Bool unknow); /**< set the type at a particular adress */
+ void * (* mem_alloc)(size_t size); /**< how to allocate memory (usually malloc()) */
+ void (* mem_free)(void * mem); /**< how to free memory (usually free()) */
+ char * (* str_alloc)(const char * str); /**< how to allocate a string */
+ void (* str_free)(const char * str); /**< how to free a string */
+ void * (* list_next)(void * l); /**< how to iterate to the next element of a list. Receives and should return the list node. */
+ void * (* list_append)(void * l, void * d); /**< how to append data @p d to list which head node is @p l */
+ void * (* list_data)(void * l); /**< retrieves the data from node @p l */
+ void * (* list_free)(void * l); /**< free all the nodes from the list which head node is @p l */
+ void (* hash_foreach)(void * h, int (* func)(void * h, const char * k, void * dt, void * fdt), void * fdt); /**< iterates over all elements in the hash @p h in no specific order */
+ void * (* hash_add)(void * h, const char * k, void * d); /**< add a new data @p d as key @p k in hash @p h */
+ void (* hash_free)(void * h); /**< free all entries from the hash @p h */
+ char * (* str_direct_alloc)(const char * str); /**< how to allocate a string directly from file backed/mmaped region pointed by @p str */
+ void (* str_direct_free)(const char * str); /**< how to free a string returned by str_direct_alloc */
+ const char *(* type_get)(const void * data, Eina_Bool * unknow); /**< convert any kind of data type to a name that define an Eet_Data_Element. */
+ Eina_Bool (* type_set)(const char * type, void * data, Eina_Bool unknow); /**< set the type at a particular adress */
} func;
};
@@ -1824,29 +1823,26 @@ struct _Eet_Data_Descriptor_Class
* @deprecated use eet_data_descriptor_stream_new() or
* eet_data_descriptor_file_new()
*/
-EINA_DEPRECATED EAPI Eet_Data_Descriptor *eet_data_descriptor_new(
- const char *name,
- int size,
- void *(*func_list_next)(void *l),
- void *(*func_list_append)(void *l, void *d),
- void *(*func_list_data)(void *l),
- void *(*func_list_free)(void *l),
- void (*func_hash_foreach)(void *h, int (*func)(void *h,
- const char *k,
- void *dt,
- void *fdt), void *fdt),
- void *(*func_hash_add)(void *h, const char *k, void *d),
- void (*func_hash_free)(void *h));
+EINA_DEPRECATED EAPI Eet_Data_Descriptor * eet_data_descriptor_new(const char * name,
+ int size,
+ void *(*func_list_next)(void * l),
+ void *(*func_list_append)(void * l, void * d),
+ void *(*func_list_data)(void * l),
+ void *(*func_list_free)(void * l),
+ void (* func_hash_foreach)(void * h, int (* func)(void * h,
+ const char * k,
+ void * dt,
+ void * fdt), void * fdt),
+ void *(*func_hash_add)(void * h, const char * k, void * d),
+ void (* func_hash_free)(void * h));
/*
* FIXME:
*
* moving to this api from the old above. this will break things when the
* move happens - but be warned
*/
-EINA_DEPRECATED EAPI Eet_Data_Descriptor *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);
+EINA_DEPRECATED EAPI Eet_Data_Descriptor * 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);
/**
* This function creates a new data descriptore and returns a handle to the
@@ -1872,8 +1868,7 @@ EINA_DEPRECATED EAPI Eet_Data_Descriptor *eet_data_descriptor3_new(
* @since 1.2.3
* @ingroup Eet_Data_Group
*/
-EAPI Eet_Data_Descriptor * eet_data_descriptor_stream_new(
- const Eet_Data_Descriptor_Class *eddc);
+EAPI Eet_Data_Descriptor * eet_data_descriptor_stream_new(const Eet_Data_Descriptor_Class * eddc);
/**
* This function creates a new data descriptore and returns a handle to the
@@ -1902,8 +1897,7 @@ EAPI Eet_Data_Descriptor * eet_data_descriptor_stream_new(
* @since 1.2.3
* @ingroup Eet_Data_Group
*/
-EAPI Eet_Data_Descriptor * eet_data_descriptor_file_new(
- const Eet_Data_Descriptor_Class *eddc);
+EAPI Eet_Data_Descriptor * eet_data_descriptor_file_new(const Eet_Data_Descriptor_Class * eddc);
/**
* This function is an helper that set all the parameter of an
@@ -1919,11 +1913,9 @@ EAPI Eet_Data_Descriptor * eet_data_descriptor_file_new(
* @since 1.2.3
* @ingroup Eet_Data_Group
*/
-EAPI Eina_Bool
- eet_eina_stream_data_descriptor_class_set(
- Eet_Data_Descriptor_Class *eddc,
- const char *name,
- int size);
+EAPI Eina_Bool eet_eina_stream_data_descriptor_class_set(Eet_Data_Descriptor_Class * eddc,
+ const char * name,
+ int size);
/**
* This macro is an helper that set all the parameter of an
@@ -1938,9 +1930,8 @@ EAPI Eina_Bool
* @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, # Type, sizeof (Type)))
+#define EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(clas, type)\
+ (eet_eina_stream_data_descriptor_class_set(clas, # type, sizeof(type)))
/**
* This function is an helper that set all the parameter of an
@@ -1956,10 +1947,9 @@ EAPI Eina_Bool
* @since 1.2.3
* @ingroup Eet_Data_Group
*/
-EAPI Eina_Bool eet_eina_file_data_descriptor_class_set(
- Eet_Data_Descriptor_Class *eddc,
- const char *name,
- int size);
+EAPI Eina_Bool eet_eina_file_data_descriptor_class_set(Eet_Data_Descriptor_Class * eddc,
+ const char * name,
+ int size);
/**
* This macro is an helper that set all the parameter of an
@@ -1974,9 +1964,8 @@ EAPI Eina_Bool eet_eina_file_data_descriptor_class_set(
* @since 1.2.3
* @ingroup Eet_Data_Group
*/
-#define EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(Clas, \
- Type) ( \
- eet_eina_file_data_descriptor_class_set(Clas, # Type, sizeof (Type)))
+#define EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(clas, type) (\
+ eet_eina_file_data_descriptor_class_set(clas, # type, sizeof(type)))
/**
* This function frees a data descriptor when it is not needed anymore.
@@ -1989,7 +1978,7 @@ EAPI Eina_Bool eet_eina_file_data_descriptor_class_set(
* @since 1.0.0
* @ingroup Eet_Data_Group
*/
-EAPI void eet_data_descriptor_free(Eet_Data_Descriptor *edd);
+EAPI void eet_data_descriptor_free(Eet_Data_Descriptor * edd);
/**
* This function is an internal used by macros.
@@ -2017,14 +2006,15 @@ EAPI void eet_data_descriptor_free(Eet_Data_Descriptor *edd);
* @since 1.0.0
* @ingroup Eet_Data_Group
*/
-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,
- Eet_Data_Descriptor *subtype);
+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,
+ Eet_Data_Descriptor * subtype);
/**
* Read a data structure from an eet file and decodes it.
@@ -2053,9 +2043,9 @@ EAPI void eet_data_descriptor_element_add(Eet_Data_Descriptor *edd,
* @since 1.0.0
* @ingroup Eet_Data_Group
*/
-EAPI void *eet_data_read(Eet_File *ef,
- Eet_Data_Descriptor *edd,
- const char *name);
+EAPI void * eet_data_read(Eet_File * ef,
+ Eet_Data_Descriptor * edd,
+ const char * name);
/**
* Write a data structure from memory and store in an eet file.
@@ -2074,11 +2064,11 @@ EAPI void *eet_data_read(Eet_File *ef,
* @since 1.0.0
* @ingroup Eet_Data_Group
*/
-EAPI int eet_data_write(Eet_File *ef,
- Eet_Data_Descriptor *edd,
- const char *name,
- const void *data,
- int compress);
+EAPI int eet_data_write(Eet_File * ef,
+ Eet_Data_Descriptor * edd,
+ const char * name,
+ const void * data,
+ int compress);
/**
* Dump an eet encoded data structure into ascii text
@@ -2127,9 +2117,10 @@ EAPI int eet_data_write(Eet_File *ef,
* @since 1.0.0
* @ingroup Eet_Data_Group
*/
-EAPI int eet_data_text_dump(const void *data_in, int size_in, void (*dumpfunc)(
- void *data,
- const char *str), void *dumpdata);
+EAPI int eet_data_text_dump(const void * data_in,
+ int size_in,
+ void (* dumpfunc)(void * data, const char * str),
+ void * dumpdata);
/**
* Take an ascii encoding from eet_data_text_dump() and re-encode in binary.
@@ -2150,7 +2141,9 @@ EAPI int eet_data_text_dump(const void *data_in, int size_in, void (*dumpfunc)
* @since 1.0.0
* @ingroup Eet_Data_Group
*/
-EAPI void *eet_data_text_undump(const char *text, int textlen, int *size_ret);
+EAPI void * eet_data_text_undump(const char * text,
+ int textlen,
+ int * size_ret);
/**
* Dump an eet encoded data structure from an eet file into ascii text
@@ -2175,9 +2168,10 @@ EAPI void *eet_data_text_undump(const char *text, int textlen, int *size_ret);
* @since 1.0.0
* @ingroup Eet_Data_Group
*/
-EAPI int eet_data_dump(Eet_File *ef, const char *name, void (*dumpfunc)(
- void *data,
- const char *str), void *dumpdata);
+EAPI int eet_data_dump(Eet_File * ef,
+ const char * name,
+ void (* dumpfunc)(void * data, const char * str),
+ void * dumpdata);
/**
* Take an ascii encoding from eet_data_dump() and re-encode in binary.
@@ -2201,11 +2195,11 @@ EAPI int eet_data_dump(Eet_File *ef, const char *name, void (*dumpfunc)(
* @since 1.0.0
* @ingroup Eet_Data_Group
*/
-EAPI int eet_data_undump(Eet_File *ef,
- const char *name,
- const char *text,
- int textlen,
- int compress);
+EAPI int eet_data_undump(Eet_File * ef,
+ const char * name,
+ const char * text,
+ int textlen,
+ int compress);
/**
* Decode a data structure from an arbitary location in memory.
@@ -2234,9 +2228,9 @@ EAPI int eet_data_undump(Eet_File *ef,
* @since 1.0.0
* @ingroup Eet_Data_Group
*/
-EAPI void *eet_data_descriptor_decode(Eet_Data_Descriptor *edd,
- const void *data_in,
- int size_in);
+EAPI void * eet_data_descriptor_decode(Eet_Data_Descriptor * edd,
+ const void * data_in,
+ int size_in);
/**
* Encode a dsata struct to memory and return that encoded data.
@@ -2267,9 +2261,9 @@ EAPI void *eet_data_descriptor_decode(Eet_Data_Descriptor *edd,
* @since 1.0.0
* @ingroup Eet_Data_Group
*/
-EAPI void *eet_data_descriptor_encode(Eet_Data_Descriptor *edd,
- const void *data_in,
- int *size_ret);
+EAPI void * eet_data_descriptor_encode(Eet_Data_Descriptor * edd,
+ const void * data_in,
+ int * size_ret);
/**
* Add a basic data element to a data descriptor.
@@ -2295,15 +2289,14 @@ EAPI void *eet_data_descriptor_encode(Eet_Data_Descriptor *edd,
* @since 1.0.0
* @ingroup Eet_Data_Group
*/
-#define EET_DATA_DESCRIPTOR_ADD_BASIC(edd, struct_type, name, member, type) \
- { \
- struct_type ___ett; \
- \
- eet_data_descriptor_element_add(edd, name, type, EET_G_UNKNOWN, \
- (char *)(& (___ett.member)) - \
- (char *)(& (___ett)), \
- 0, /* 0, */ NULL, NULL); \
- }
+#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)
/**
* Add a sub-element type to a data descriptor
@@ -2323,15 +2316,15 @@ EAPI void *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) \
- { \
- 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); \
- }
+#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
@@ -2350,15 +2343,15 @@ EAPI void *eet_data_descriptor_encode(Eet_Data_Descriptor *edd,
* @since 1.0.0
* @ingroup Eet_Data_Group
*/
-#define EET_DATA_DESCRIPTOR_ADD_LIST(edd, struct_type, name, member, subtype) \
- { \
- 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); \
- }
+#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)
/**
* Add a hash type to a data descriptor
@@ -2377,15 +2370,15 @@ EAPI void *eet_data_descriptor_encode(Eet_Data_Descriptor *edd,
* @since 1.0.0
* @ingroup Eet_Data_Group
*/
-#define EET_DATA_DESCRIPTOR_ADD_HASH(edd, struct_type, name, member, subtype) \
- { \
- 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); \
- }
+#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)
/**
* Add a fixed size array type to a data descriptor
@@ -2405,16 +2398,16 @@ EAPI void *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) \
- { \
- 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); \
- }
+#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
@@ -2434,25 +2427,25 @@ EAPI void *eet_data_descriptor_encode(Eet_Data_Descriptor *edd,
* @since 1.0.2
* @ingroup Eet_Data_Group
*/
-#define EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(edd, \
- struct_type, \
- name, \
- member, \
- subtype) \
- { \
- 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); \
- }
+#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)
/**
* Add an union type to a data descriptor
@@ -2473,22 +2466,22 @@ EAPI void *eet_data_descriptor_encode(Eet_Data_Descriptor *edd,
* @ingroup Eet_Data_Group
* @see Eet_Data_Descriptor_Class
*/
-#define EET_DATA_DESCRIPTOR_ADD_UNION(edd, \
- struct_type, \
- name, \
- member, \
- type_member, \
- unified_type) \
- { \
- 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); \
- }
+#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)
/**
* Add a automatically selectable type to a data descriptor
@@ -2511,22 +2504,22 @@ EAPI void *eet_data_descriptor_encode(Eet_Data_Descriptor *edd,
* @ingroup Eet_Data_Group
* @see Eet_Data_Descriptor_Class
*/
-#define EET_DATA_DESCRIPTOR_ADD_VARIANT(edd, \
- struct_type, \
- name, \
- member, \
- type_member, \
- unified_type) \
- { \
- 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); \
- }
+#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)
/**
* Add a mapping to a data descriptor that will be used by union, variant or inherited type
@@ -2538,15 +2531,15 @@ EAPI void *eet_data_descriptor_encode(Eet_Data_Descriptor *edd,
* @ingroup Eet_Data_Group
* @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);
+#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)
/**
* @defgroup Eet_Data_Cipher_Group Eet Data Serialization using A Ciphers
@@ -2587,10 +2580,10 @@ EAPI void *eet_data_descriptor_encode(Eet_Data_Descriptor *edd,
* @since 1.0.0
* @ingroup Eet_Data_Cipher_Group
*/
-EAPI void *eet_data_read_cipher(Eet_File *ef,
- Eet_Data_Descriptor *edd,
- const char *name,
- const char *cipher_key);
+EAPI void * eet_data_read_cipher(Eet_File * ef,
+ Eet_Data_Descriptor * edd,
+ const char * name,
+ const char * cipher_key);
/**
* Write a data structure from memory and store in an eet file
@@ -2611,12 +2604,12 @@ EAPI void *eet_data_read_cipher(Eet_File *ef,
* @since 1.0.0
* @ingroup Eet_Data_Cipher_Group
*/
-EAPI int eet_data_write_cipher(Eet_File *ef,
- Eet_Data_Descriptor *edd,
- const char *name,
- const char *cipher_key,
- const void *data,
- int compress);
+EAPI int eet_data_write_cipher(Eet_File * ef,
+ Eet_Data_Descriptor * edd,
+ const char * name,
+ const char * cipher_key,
+ const void * data,
+ int compress);
/**
* Dump an eet encoded data structure into ascii text using a cipher.
@@ -2666,11 +2659,11 @@ EAPI int eet_data_write_cipher(Eet_File *ef,
* @since 1.0.0
* @ingroup Eet_Data_Cipher_Group
*/
-EAPI int eet_data_text_dump_cipher(const void *data_in,
- const char *cipher_key,
- int size_in,
- void (*dumpfunc)(void *data, const char *str),
- void *dumpdata);
+EAPI int eet_data_text_dump_cipher(const void * data_in,
+ const char * cipher_key,
+ int size_in,
+ void (* dumpfunc)(void * data, const char * str),
+ void * dumpdata);
/**
* Take an ascii encoding from eet_data_text_dump() and re-encode
@@ -2693,10 +2686,10 @@ EAPI int eet_data_text_dump_cipher(const void *data_in,
* @since 1.0.0
* @ingroup Eet_Data_Cipher_Group
*/
-EAPI void *eet_data_text_undump_cipher(const char *text,
- const char *cipher_key,
- int textlen,
- int *size_ret);
+EAPI void * eet_data_text_undump_cipher(const char * text,
+ const char * cipher_key,
+ int textlen,
+ int * size_ret);
/**
* Dump an eet encoded data structure from an eet file into ascii
@@ -2723,11 +2716,11 @@ EAPI void *eet_data_text_undump_cipher(const char *text,
* @since 1.0.0
* @ingroup Eet_Data_Cipher_Group
*/
-EAPI int eet_data_dump_cipher(Eet_File *ef,
- const char *name,
- const char *cipher_key,
- void (*dumpfunc)(void *data, const char *str),
- void *dumpdata);
+EAPI int eet_data_dump_cipher(Eet_File * ef,
+ const char * name,
+ const char * cipher_key,
+ void (* dumpfunc)(void * data, const char * str),
+ void * dumpdata);
/**
* Take an ascii encoding from eet_data_dump() and re-encode in
@@ -2753,12 +2746,12 @@ EAPI int eet_data_dump_cipher(Eet_File *ef,
* @since 1.0.0
* @ingroup Eet_Data_Cipher_Group
*/
-EAPI int eet_data_undump_cipher(Eet_File *ef,
- const char *name,
- const char *cipher_key,
- const char *text,
- int textlen,
- int compress);
+EAPI int eet_data_undump_cipher(Eet_File * ef,
+ const char * name,
+ const char * cipher_key,
+ const char * text,
+ int textlen,
+ int compress);
/**
* Decode a data structure from an arbitary location in memory
@@ -2789,10 +2782,10 @@ EAPI int eet_data_undump_cipher(Eet_File *ef,
* @since 1.0.0
* @ingroup Eet_Data_Cipher_Group
*/
-EAPI void *eet_data_descriptor_decode_cipher(Eet_Data_Descriptor *edd,
- const void *data_in,
- const char *cipher_key,
- int size_in);
+EAPI void * eet_data_descriptor_decode_cipher(Eet_Data_Descriptor * edd,
+ const void * data_in,
+ const char * cipher_key,
+ int size_in);
/**
* Encode a data struct to memory and return that encoded data
@@ -2825,10 +2818,10 @@ EAPI void *eet_data_descriptor_decode_cipher(Eet_Data_Descriptor *edd,
* @since 1.0.0
* @ingroup Eet_Data_Cipher_Group
*/
-EAPI void *eet_data_descriptor_encode_cipher(Eet_Data_Descriptor *edd,
- const void *data_in,
- const char *cipher_key,
- int *size_ret);
+EAPI void * eet_data_descriptor_encode_cipher(Eet_Data_Descriptor * edd,
+ const void * data_in,
+ const char * cipher_key,
+ int * size_ret);
/**
* @defgroup Eet_Node_Group Low-level Serialization Structures.
@@ -2843,13 +2836,13 @@ EAPI void *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
@@ -2858,17 +2851,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;
+ 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;
+ const char * str;
} value;
};
@@ -2880,193 +2873,209 @@ struct _Eet_Node_Data
* TODO FIX ME
* @ingroup Eet_Node_Group
*/
-EAPI Eet_Node *eet_node_char_new(const char *name, char c);
+EAPI Eet_Node * eet_node_char_new(const char * name,
+ char c);
/**
* TODO FIX ME
* @ingroup Eet_Node_Group
*/
-EAPI Eet_Node *eet_node_short_new(const char *name, short s);
+EAPI Eet_Node * eet_node_short_new(const char * name,
+ short s);
/**
* TODO FIX ME
* @ingroup Eet_Node_Group
*/
-EAPI Eet_Node *eet_node_int_new(const char *name, int i);
+EAPI Eet_Node * eet_node_int_new(const char * name,
+ int i);
/**
* TODO FIX ME
* @ingroup Eet_Node_Group
*/
-EAPI Eet_Node *eet_node_long_long_new(const char *name, long long l);
+EAPI Eet_Node * eet_node_long_long_new(const char * name,
+ long long l);
/**
* TODO FIX ME
* @ingroup Eet_Node_Group
*/
-EAPI Eet_Node *eet_node_float_new(const char *name, float f);
+EAPI Eet_Node * eet_node_float_new(const char * name,
+ float f);
/**
* TODO FIX ME
* @ingroup Eet_Node_Group
*/
-EAPI Eet_Node *eet_node_double_new(const char *name, double d);
+EAPI Eet_Node * eet_node_double_new(const char * name,
+ double d);
/**
* TODO FIX ME
* @ingroup Eet_Node_Group
*/
-EAPI Eet_Node *eet_node_unsigned_char_new(const char *name, unsigned char uc);
+EAPI Eet_Node * 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);
+EAPI Eet_Node * 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);
+EAPI Eet_Node * 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);
+EAPI Eet_Node * eet_node_unsigned_long_long_new(const char * name,
+ unsigned long long l);
/**
* TODO FIX ME
* @ingroup Eet_Node_Group
*/
-EAPI Eet_Node *eet_node_string_new(const char *name, const char *str);
+EAPI Eet_Node * eet_node_string_new(const char * name,
+ const char * str);
/**
* TODO FIX ME
* @ingroup Eet_Node_Group
*/
-EAPI Eet_Node *eet_node_inlined_string_new(const char *name, const char *str);
+EAPI Eet_Node * eet_node_inlined_string_new(const char * name,
+ const char * str);
/**
* TODO FIX ME
* @ingroup Eet_Node_Group
*/
-EAPI Eet_Node *eet_node_null_new(const char *name);
+EAPI Eet_Node * eet_node_null_new(const char * name);
/**
* TODO FIX ME
* @ingroup Eet_Node_Group
*/
-EAPI Eet_Node *eet_node_list_new(const char *name, Eina_List *nodes);
+EAPI Eet_Node * eet_node_list_new(const char * name,
+ Eina_List * nodes);
/**
* TODO FIX ME
* @ingroup Eet_Node_Group
*/
-EAPI Eet_Node *eet_node_array_new(const char *name, int count, Eina_List *nodes);
+EAPI Eet_Node * eet_node_array_new(const char * name,
+ int count,
+ Eina_List * nodes);
/**
* TODO FIX ME
* @ingroup Eet_Node_Group
*/
-EAPI Eet_Node *eet_node_var_array_new(const char *name, Eina_List *nodes);
+EAPI Eet_Node * eet_node_var_array_new(const char * name,
+ Eina_List * nodes);
/**
* TODO FIX ME
* @ingroup Eet_Node_Group
*/
-EAPI Eet_Node *eet_node_hash_new(const char *name,
- const char *key,
- Eet_Node *node);
+EAPI Eet_Node * eet_node_hash_new(const char * name,
+ const char * key,
+ Eet_Node * node);
/**
* TODO FIX ME
* @ingroup Eet_Node_Group
*/
-EAPI Eet_Node *eet_node_struct_new(const char *name, Eina_List *nodes);
+EAPI Eet_Node * eet_node_struct_new(const char * name,
+ Eina_List * nodes);
/**
* TODO FIX ME
* @ingroup Eet_Node_Group
*/
-EAPI Eet_Node *eet_node_struct_child_new(const char *parent, Eet_Node *child);
-
+EAPI Eet_Node * eet_node_struct_child_new(const char * parent,
+ Eet_Node * child);
/**
* TODO FIX ME
* @ingroup Eet_Node_Group
*/
-EAPI void eet_node_list_append(Eet_Node *parent,
- const char *name,
- Eet_Node *child);
+EAPI void eet_node_list_append(Eet_Node * parent,
+ const char * name,
+ Eet_Node * child);
/**
* TODO FIX ME
* @ingroup Eet_Node_Group
*/
-EAPI void eet_node_struct_append(Eet_Node *parent,
- const char *name,
- Eet_Node *child);
+EAPI void eet_node_struct_append(Eet_Node * parent,
+ const char * name,
+ Eet_Node * child);
/**
* TODO FIX ME
* @ingroup Eet_Node_Group
*/
-EAPI void eet_node_hash_add(Eet_Node *parent,
- const char *name,
- const char *key,
- Eet_Node *child);
-
+EAPI void eet_node_hash_add(Eet_Node * parent,
+ const char * name,
+ const char * key,
+ Eet_Node * child);
/**
* TODO FIX ME
* @ingroup Eet_Node_Group
*/
-EAPI void eet_node_dump(Eet_Node *n, int dumplevel, void (*dumpfunc)(
- void *data,
- const char *str), void *dumpdata);
+EAPI void eet_node_dump(Eet_Node * n,
+ int dumplevel,
+ void (* dumpfunc)(void * data, const char * str),
+ void * dumpdata);
/**
* TODO FIX ME
* @ingroup Eet_Node_Group
*/
-EAPI void eet_node_del(Eet_Node *n);
+EAPI void eet_node_del(Eet_Node * n);
/**
* TODO FIX ME
* @ingroup Eet_Node_Group
*/
-EAPI void * eet_data_node_encode_cipher(Eet_Node *node,
- const char *cipher_key,
- int *size_ret);
+EAPI void * eet_data_node_encode_cipher(Eet_Node * node,
+ const char * cipher_key,
+ int * size_ret);
/**
* TODO FIX ME
* @ingroup Eet_Node_Group
*/
-EAPI Eet_Node *eet_data_node_decode_cipher(const void *data_in,
- const char *cipher_key,
- int size_in);
+EAPI Eet_Node * eet_data_node_decode_cipher(const void * data_in,
+ const char * cipher_key,
+ int size_in);
/**
* TODO FIX ME
* @ingroup Eet_Node_Group
*/
-EAPI Eet_Node *eet_data_node_read_cipher(Eet_File *ef,
- const char *name,
- const char *cipher_key);
+EAPI Eet_Node * eet_data_node_read_cipher(Eet_File * ef,
+ const char * name,
+ const char * cipher_key);
/**
* TODO FIX ME
* @ingroup Eet_Node_Group
*/
-EAPI int eet_data_node_write_cipher(Eet_File *ef,
- const char *name,
- const char *cipher_key,
- Eet_Node *node,
- int compress);
+EAPI int eet_data_node_write_cipher(Eet_File * ef,
+ const char * name,
+ const char * cipher_key,
+ Eet_Node * node,
+ int compress);
/* EXPERIMENTAL: THIS API MAY CHANGE IN THE FUTURE, USE IT ONLY IF YOU KNOW WHAT YOU ARE DOING. */
@@ -3074,7 +3083,7 @@ EAPI int 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;
/**
* @struct _Eet_Node_Walk
@@ -3082,24 +3091,21 @@ typedef struct _Eet_Node_Walk Eet_Node_Walk;
*/
struct _Eet_Node_Walk
{
- void *(*struct_alloc)(const char *type, void *user_data);
- void (*struct_add)(void *parent, const char *name, void *child,
- void *user_data);
- void *(*array)(Eina_Bool variable, const char *name, int count,
- void *user_data);
- void (*insert)(void *array, int index, void *child, void *user_data);
- void *(*list)(const char *name, void *user_data);
- void (*append)(void *list, void *child, void *user_data);
- void *(*hash)(void *parent, const char *name, const char *key, void *value,
- void *user_data);
- void *(*simple)(int type, Eet_Node_Data *data, void *user_data);
+ void *(* struct_alloc)(const char * type, void * user_data);
+ void (* struct_add)(void * parent, const char * name, void * child, void * user_data);
+ void *(* array)(Eina_Bool variable, const char * name, int count, void * user_data);
+ void (* insert)(void * array, int index, void * child, void * user_data);
+ void *(* list)(const char * name, void * user_data);
+ void (* append)(void * list, void * child, void * user_data);
+ void *(* hash)(void * parent, const char * name, const char * key, void * value, void * user_data);
+ void *(* simple)(int type, Eet_Node_Data * data, void * user_data);
};
-EAPI void *eet_node_walk(void *parent,
- const char *name,
- Eet_Node *root,
- Eet_Node_Walk *cb,
- void *user_data);
+EAPI void * eet_node_walk(void * parent,
+ const char * name,
+ Eet_Node * root,
+ Eet_Node_Walk * cb,
+ void * user_data);
/*******/
@@ -3116,7 +3122,7 @@ EAPI void *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
@@ -3124,8 +3130,7 @@ typedef struct _Eet_Connection Eet_Connection;
*
* @ingroup Eet_Connection_Group
*/
-typedef Eina_Bool Eet_Read_Cb (const void *eet_data, size_t size,
- void *user_data);
+typedef Eina_Bool Eet_Read_Cb (const void * eet_data, size_t size, void * user_data);
/**
* @typedef Eet_Write_Cb
@@ -3133,7 +3138,7 @@ typedef Eina_Bool Eet_Read_Cb (const void *eet_data, size_t size,
*
* @ingroup Eet_Connection_Group
*/
-typedef Eina_Bool Eet_Write_Cb (const void *data, size_t size, void *user_data);
+typedef Eina_Bool Eet_Write_Cb (const void * data, size_t size, void * user_data);
/**
* Instanciate a new connection to track.
@@ -3147,9 +3152,9 @@ typedef Eina_Bool Eet_Write_Cb (const void *data, size_t size, void *user_data);
* @since 1.2.4
* @ingroup Eet_Connection_Group
*/
-EAPI Eet_Connection *eet_connection_new(Eet_Read_Cb *eet_read_cb,
- Eet_Write_Cb *eet_write_cb,
- const void *user_data);
+EAPI Eet_Connection * eet_connection_new(Eet_Read_Cb * eet_read_cb,
+ Eet_Write_Cb * eet_write_cb,
+ const void * user_data);
/**
* Process a raw packet received over the link
@@ -3165,9 +3170,9 @@ EAPI Eet_Connection *eet_connection_new(Eet_Read_Cb *eet_read_cb,
* @since 1.2.4
* @ingroup Eet_Connection_Group
*/
-EAPI int eet_connection_received(Eet_Connection *conn,
- const void *data,
- size_t size);
+EAPI int eet_connection_received(Eet_Connection * conn,
+ const void * data,
+ size_t size);
/**
* Convert a complex structure and prepare it to be send.
@@ -3186,10 +3191,10 @@ EAPI int eet_connection_received(Eet_Connection *conn,
* @since 1.2.4
* @ingroup Eet_Connection_Group
*/
-EAPI Eina_Bool eet_connection_send(Eet_Connection *conn,
- Eet_Data_Descriptor *edd,
- const void *data_in,
- const char *cipher_key);
+EAPI Eina_Bool eet_connection_send(Eet_Connection * conn,
+ Eet_Data_Descriptor * edd,
+ const void * data_in,
+ const char * cipher_key);
/**
* Convert a Eet_Node tree and prepare it to be send.
@@ -3207,9 +3212,9 @@ EAPI Eina_Bool eet_connection_send(Eet_Connection *conn,
* @since 1.2.4
* @ingroup Eet_Connection_Group
*/
-EAPI Eina_Bool eet_connection_node_send(Eet_Connection *conn,
- Eet_Node *node,
- const char *cipher_key);
+EAPI Eina_Bool eet_connection_node_send(Eet_Connection * conn,
+ Eet_Node * node,
+ const char * cipher_key);
/**
* Close a connection and lost its track.
@@ -3220,13 +3225,13 @@ EAPI Eina_Bool eet_connection_node_send(Eet_Connection *conn,
* @since 1.2.4
* @ingroup Eet_Connection_Group
*/
-EAPI void * eet_connection_close(Eet_Connection *conn,
- Eina_Bool *on_going);
+EAPI void * eet_connection_close(Eet_Connection * conn,
+ Eina_Bool * on_going);
/***************************************************************************/
#ifdef __cplusplus
}
-#endif
+#endif /* ifdef __cplusplus */
-#endif
+#endif /* ifndef _EET_H */
diff --git a/src/lib/Eet_private.h b/src/lib/Eet_private.h
index b3b935b..9e2221f 100644
--- a/src/lib/Eet_private.h
+++ b/src/lib/Eet_private.h
@@ -7,60 +7,60 @@
#include <Eina.h>
-typedef enum _Eet_Convert_Type Eet_Convert_Type;
+typedef enum _Eet_Convert_Type Eet_Convert_Type;
enum _Eet_Convert_Type
{
EET_D_NOT_CONVERTED = 0,
- EET_D_FLOAT = 1 << 1,
- EET_D_DOUBLE = 1 << 2,
- EET_D_FIXED_POINT = 1 << 4
+ EET_D_FLOAT = 1 << 1,
+ EET_D_DOUBLE = 1 << 2,
+ EET_D_FIXED_POINT = 1 << 4
};
-typedef struct _Eet_String Eet_String;
+typedef struct _Eet_String Eet_String;
struct _Eet_String
{
- const char *mmap;
- char *str;
+ const char * mmap;
+ char * str;
- int hash;
- int len;
+ int hash;
+ int len;
- int next;
- int prev;
+ int next;
+ int prev;
- float f;
- double d;
- Eina_F32p32 fp;
+ float f;
+ double d;
+ Eina_F32p32 fp;
Eet_Convert_Type type;
};
struct _Eet_Dictionary
{
- Eet_String *all;
+ Eet_String * all;
- int size;
- int offset;
+ int size;
+ int offset;
- int hash[256];
+ int hash[256];
- int count;
- int total;
+ int count;
+ int total;
- const char *start;
- const char *end;
+ const char * start;
+ const char * end;
};
struct _Eet_Node
{
- int type;
- int count;
- const char *name;
- const char *key;
- Eet_Node *values;
- Eet_Node *next;
- Eet_Node *parent;
+ int type;
+ int count;
+ const char * name;
+ const char * key;
+ Eet_Node * values;
+ Eet_Node * next;
+ Eet_Node * parent;
Eet_Node_Data data;
};
@@ -76,92 +76,93 @@ extern int _eet_log_dom_global;
*/
#ifdef EET_DEFAULT_LOG_COLOR
# undef EET_DEFAULT_LOG_COLOR
-#endif
+#endif /* ifdef EET_DEFAULT_LOG_COLOR */
#define EET_DEFAULT_LOG_COLOR EINA_COLOR_CYAN
#ifdef ERR
# undef ERR
-#endif
-#define ERR(...) EINA_LOG_DOM_ERR(_eet_log_dom_global, __VA_ARGS__)
+#endif /* ifdef ERR */
+#define ERR(...) EINA_LOG_DOM_ERR(_eet_log_dom_global, __VA_ARGS__)
#ifdef DBG
# undef DBG
-#endif
-#define DBG(...) EINA_LOG_DOM_DBG(_eet_log_dom_global, __VA_ARGS__)
+#endif /* ifdef DBG */
+#define DBG(...) EINA_LOG_DOM_DBG(_eet_log_dom_global, __VA_ARGS__)
#ifdef INF
# undef INF
-#endif
-#define INF(...) EINA_LOG_DOM_INFO(_eet_log_dom_global, __VA_ARGS__)
+#endif /* ifdef INF */
+#define INF(...) EINA_LOG_DOM_INFO(_eet_log_dom_global, __VA_ARGS__)
#ifdef WRN
# undef WRN
-#endif
-#define WRN(...) EINA_LOG_DOM_WARN(_eet_log_dom_global, __VA_ARGS__)
+#endif /* ifdef WRN */
+#define WRN(...) EINA_LOG_DOM_WARN(_eet_log_dom_global, __VA_ARGS__)
#ifdef CRIT
# undef CRIT
-#endif
+#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
-#endif
+#endif /* ifndef PATH_MAX */
#ifdef DNDEBUG
# define EET_ASSERT(Test, Do) if (Test == 0) {Do; }
-#else
+#else /* ifdef DNDEBUG */
# define EET_ASSERT(Test, Do) if (Test == 0) {abort(); }
-#endif
+#endif /* ifdef DNDEBUG */
-#endif
+#endif /* ifndef _EET_PRIVATE_H */
diff --git a/src/lib/eet_cipher.c b/src/lib/eet_cipher.c
index 028c28f..bc60e60 100644
--- a/src/lib/eet_cipher.c
+++ b/src/lib/eet_cipher.c
@@ -1,6 +1,6 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
-#endif
+#endif /* ifdef HAVE_CONFIG_H */
#ifdef HAVE_ALLOCA_H
# include <alloca.h>
@@ -11,13 +11,13 @@
#elif defined _MSC_VER
# include <malloc.h>
# define alloca _alloca
-#else
+#else /* ifdef HAVE_ALLOCA_H */
# include <stddef.h>
# ifdef __cplusplus
extern "C"
-# endif
-void *alloca (size_t);
-#endif
+# endif /* ifdef __cplusplus */
+void * alloca (size_t);
+#endif /* ifdef HAVE_ALLOCA_H */
#include <stdio.h>
#include <string.h>
@@ -27,17 +27,17 @@ void *alloca (size_t);
#ifndef _MSC_VER
# include <unistd.h>
-#endif
+#endif /* ifndef _MSC_VER */
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
-#endif
+#endif /* ifdef HAVE_NETINET_IN_H */
#ifdef HAVE_SIGNATURE
# ifdef HAVE_GNUTLS
# include <gnutls/gnutls.h>
# include <gnutls/x509.h>
-# else
+# else /* ifdef HAVE_GNUTLS */
# include <openssl/rsa.h>
# include <openssl/objects.h>
# include <openssl/err.h>
@@ -47,23 +47,23 @@ void *alloca (size_t);
# include <openssl/evp.h>
# include <openssl/x509.h>
# include <openssl/pem.h>
-# endif
-#endif
+# endif /* ifdef HAVE_GNUTLS */
+#endif /* ifdef HAVE_SIGNATURE */
#ifdef HAVE_OPENSSL
-# include <openssl/sha.h>
-#endif
+# include <openssl/sha.h>
+#endif /* ifdef HAVE_OPENSSL */
#ifdef HAVE_CIPHER
# ifdef HAVE_GNUTLS
# include <gnutls/x509.h>
# include <gcrypt.h>
-# else
+# else /* ifdef HAVE_GNUTLS */
# include <openssl/evp.h>
# include <openssl/hmac.h>
# include <openssl/rand.h>
-# endif
-#endif
+# endif /* ifdef HAVE_GNUTLS */
+#endif /* ifdef HAVE_CIPHER */
#include "Eet.h"
#include "Eet_private.h"
@@ -71,58 +71,58 @@ void *alloca (size_t);
#define EET_MAGIC_SIGN 0x1ee74271
#ifdef HAVE_GNUTLS
-# define MAX_KEY_LEN 32
-# define MAX_IV_LEN 16
-#else
-# define MAX_KEY_LEN EVP_MAX_KEY_LENGTH
-# define MAX_IV_LEN EVP_MAX_IV_LENGTH
-#endif
+# define MAX_KEY_LEN 32
+# define MAX_IV_LEN 16
+#else /* ifdef HAVE_GNUTLS */
+# define MAX_KEY_LEN EVP_MAX_KEY_LENGTH
+# define MAX_IV_LEN EVP_MAX_IV_LENGTH
+#endif /* ifdef HAVE_GNUTLS */
#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);
-# endif
-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
+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);
+#endif /* ifdef HAVE_CIPHER */
struct _Eet_Key
{
- int references;
+ int references;
#ifdef HAVE_SIGNATURE
# ifdef HAVE_GNUTLS
- gnutls_x509_crt_t certificate;
+ gnutls_x509_crt_t certificate;
gnutls_x509_privkey_t private_key;
-# else
- X509 *certificate;
- EVP_PKEY *private_key;
-# endif
-#endif
+# else /* ifdef HAVE_GNUTLS */
+ X509 * certificate;
+ EVP_PKEY * private_key;
+# endif /* ifdef HAVE_GNUTLS */
+#endif /* ifdef HAVE_SIGNATURE */
};
EAPI Eet_Key *
-eet_identity_open(const char *certificate_file,
- const char *private_key_file,
+eet_identity_open(const char * certificate_file,
+ const char * private_key_file,
Eet_Key_Password_Callback cb)
{
#ifdef HAVE_SIGNATURE
/* Signature declarations */
- Eet_Key *key = NULL;
- FILE *fp = NULL;
+ Eet_Key * key = NULL;
+ FILE * fp = NULL;
# ifdef HAVE_GNUTLS
/* Gnutls private declarations */
int fd = -1;
struct stat st;
- void *data = NULL;
+ void * data = NULL;
gnutls_datum_t load_file = { NULL, 0 };
char pass[1024];
@@ -208,7 +208,7 @@ eet_identity_open(const char *certificate_file,
if (munmap(data, st.st_size))
goto on_error;
- fclose(fp);
+ fclose(fp);
return key;
@@ -230,10 +230,10 @@ on_error:
if (data)
munmap(data, st.st_size);
-# else
+# else /* ifdef HAVE_GNUTLS */
/* Openssl private declarations */
- EVP_PKEY *pkey = NULL;
- X509 *cert = NULL;
+ EVP_PKEY * pkey = NULL;
+ X509 * cert = NULL;
/* Load the X509 certificate in memory. */
fp = fopen(certificate_file, "r");
@@ -278,13 +278,13 @@ on_error:
if (pkey)
EVP_PKEY_free(pkey);
-# endif
-#endif
+# endif /* ifdef HAVE_GNUTLS */
+#endif /* ifdef HAVE_SIGNATURE */
return NULL;
-}
+} /* eet_identity_open */
EAPI void
-eet_identity_close(Eet_Key *key)
+eet_identity_close(Eet_Key * key)
{
#ifdef HAVE_SIGNATURE
if (!key || (key->references > 0))
@@ -293,20 +293,21 @@ eet_identity_close(Eet_Key *key)
# ifdef HAVE_GNUTLS
gnutls_x509_crt_deinit(key->certificate);
gnutls_x509_privkey_deinit(key->private_key);
-# else
+# else /* ifdef HAVE_GNUTLS */
X509_free(key->certificate);
EVP_PKEY_free(key->private_key);
-# endif
+# endif /* ifdef HAVE_GNUTLS */
free(key);
-#endif
-}
+#endif /* ifdef HAVE_SIGNATURE */
+} /* eet_identity_close */
EAPI void
-eet_identity_print(Eet_Key *key, FILE *out)
+eet_identity_print(Eet_Key * key,
+ FILE * out)
{
#ifdef HAVE_SIGNATURE
# ifdef HAVE_GNUTLS
- const char *names[6] = {
+ const char * names[6] = {
"Modulus",
"Public exponent",
"Private exponent",
@@ -318,7 +319,7 @@ eet_identity_print(Eet_Key *key, FILE *out)
gnutls_datum_t data = { NULL, 0 };
gnutls_datum_t rsa_raw[6];
size_t size = 128;
- char *res = NULL;
+ char * res = NULL;
char buf[33];
unsigned int i, j;
@@ -344,9 +345,7 @@ eet_identity_print(Eet_Key *key, FILE *out)
for (i = 0; i < 6; i++)
{
- while ((err =
- gnutls_hex_encode(rsa_raw + i, res,
- &size)) ==
+ while ((err = gnutls_hex_encode(rsa_raw + i, res, &size)) ==
GNUTLS_E_SHORT_MEMORY_BUFFER)
{
size += 128;
@@ -370,7 +369,8 @@ eet_identity_print(Eet_Key *key, FILE *out)
if (key->certificate)
{
fprintf(out, "Public certificate:\n");
- if (gnutls_x509_crt_print(key->certificate, GNUTLS_X509_CRT_FULL, &data))
+ if (gnutls_x509_crt_print(key->certificate, GNUTLS_X509_CRT_FULL,
+ &data))
goto on_error;
fprintf(out, "%s\n", data.data);
@@ -386,10 +386,10 @@ on_error:
gnutls_free(data.data);
return;
-# else
- RSA *rsa;
- DSA *dsa;
- DH *dh;
+# else /* ifdef HAVE_GNUTLS */
+ RSA * rsa;
+ DSA * dsa;
+ DH * dh;
if (!key)
return;
@@ -417,39 +417,40 @@ on_error:
fprintf(out, "Public certificate:\n");
X509_print_fp(out, key->certificate);
-# endif
-#else
+# endif /* ifdef HAVE_GNUTLS */
+#else /* ifdef HAVE_SIGNATURE */
ERR("You need to compile signature support in EET.");
-#endif
-}
+#endif /* ifdef HAVE_SIGNATURE */
+} /* eet_identity_print */
void
-eet_identity_ref(Eet_Key *key)
+eet_identity_ref(Eet_Key * key)
{
if (key == NULL)
return;
key->references++;
-}
+} /* eet_identity_ref */
void
-eet_identity_unref(Eet_Key *key)
+eet_identity_unref(Eet_Key * key)
{
if (key == NULL)
return;
key->references--;
eet_identity_close(key);
-}
+} /* eet_identity_unref */
void *
-eet_identity_compute_sha1(const void *data_base, unsigned int data_length,
- int *sha1_length)
+eet_identity_compute_sha1(const void * data_base,
+ unsigned int data_length,
+ int * sha1_length)
{
- void *result;
+ void * result;
#ifdef HAVE_SIGNATURE
-# ifdef HAVE_GNUTLS
+# ifdef HAVE_GNUTLS
result = malloc(gcry_md_get_algo_dlen(GCRY_MD_SHA1));
if (!result)
return NULL;
@@ -458,8 +459,8 @@ eet_identity_compute_sha1(const void *data_base, unsigned int data_length,
if (sha1_length)
*sha1_length = gcry_md_get_algo_dlen(GCRY_MD_SHA1);
-# else
-# ifdef HAVE_OPENSSL
+# else /* ifdef HAVE_GNUTLS */
+# ifdef HAVE_OPENSSL
result = malloc(SHA_DIGEST_LENGTH);
if (!result)
return NULL;
@@ -468,37 +469,38 @@ eet_identity_compute_sha1(const void *data_base, unsigned int data_length,
if (sha1_length)
*sha1_length = SHA_DIGEST_LENGTH;
-# else
+# else /* ifdef HAVE_OPENSSL */
result = NULL;
-# endif
-# endif
-#else
+# endif /* ifdef HAVE_OPENSSL */
+# endif /* ifdef HAVE_GNUTLS */
+#else /* ifdef HAVE_SIGNATURE */
result = NULL;
-#endif
+#endif /* ifdef HAVE_SIGNATURE */
return result;
-}
+} /* eet_identity_compute_sha1 */
Eet_Error
-eet_identity_sign(FILE *fp, Eet_Key *key)
+eet_identity_sign(FILE * fp,
+ Eet_Key * key)
{
#ifdef HAVE_SIGNATURE
Eet_Error err = EET_ERROR_NONE;
struct stat st_buf;
- void *data;
+ void * data;
int fd;
int head[3];
- unsigned char *sign = NULL;
- unsigned char *cert = NULL;
+ unsigned char * sign = NULL;
+ unsigned char * cert = NULL;
# ifdef HAVE_GNUTLS
gnutls_datum_t datum = { NULL, 0 };
size_t sign_len = 0;
size_t cert_len = 0;
-# else
+# else /* ifdef HAVE_GNUTLS */
EVP_MD_CTX md_ctx;
unsigned int sign_len = 0;
int cert_len = 0;
-# endif
+# endif /* ifdef HAVE_GNUTLS */
/* A few check and flush pending write. */
if (!fp || !key || !key->certificate || !key->private_key)
@@ -568,7 +570,7 @@ eet_identity_sign(FILE *fp, Eet_Key *key)
goto on_error;
}
-# else
+# else /* ifdef HAVE_GNUTLS */
sign_len = EVP_PKEY_size(key->private_key);
sign = malloc(sign_len);
if (sign == NULL)
@@ -600,7 +602,7 @@ eet_identity_sign(FILE *fp, Eet_Key *key)
goto on_error;
}
-# endif
+# endif /* ifdef HAVE_GNUTLS */
/* Append the signature at the end of the file. */
head[0] = (int)htonl ((unsigned int)EET_MAGIC_SIGN);
head[1] = (int)htonl ((unsigned int)sign_len);
@@ -629,36 +631,36 @@ on_error:
if (cert)
free(cert);
-# else
+# else /* ifdef HAVE_GNUTLS */
if (cert)
OPENSSL_free(cert);
-# endif
+# endif /* ifdef HAVE_GNUTLS */
if (sign)
free(sign);
munmap(data, st_buf.st_size);
return err;
-#else
+#else /* ifdef HAVE_SIGNATURE */
return EET_ERROR_NOT_IMPLEMENTED;
-#endif
-}
+#endif /* ifdef HAVE_SIGNATURE */
+} /* eet_identity_sign */
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)
+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)
{
#ifdef HAVE_SIGNATURE
- const int *header = signature_base;
- const unsigned char *sign;
- const unsigned char *cert_der;
+ const int * header = signature_base;
+ const unsigned char * sign;
+ const unsigned char * cert_der;
int sign_len;
int cert_len;
int magic;
@@ -688,10 +690,10 @@ eet_identity_check(const void *data_base,
gnutls_datum_t datum;
gnutls_datum_t signature;
# if EET_USE_NEW_GNUTLS_API
- unsigned char *hash;
+ unsigned char * hash;
gcry_md_hd_t md;
int err;
-# endif
+# endif /* if EET_USE_NEW_GNUTLS_API */
/* Create an understanding certificate structure for gnutls */
datum.data = (void *)cert_der;
@@ -717,7 +719,7 @@ eet_identity_check(const void *data_base,
hash = gcry_md_read(md, GCRY_MD_SHA1);
if (hash == NULL)
{
- gcry_md_close(md);
+ gcry_md_close(md);
return NULL;
}
@@ -726,7 +728,7 @@ eet_identity_check(const void *data_base,
if (!gnutls_x509_crt_verify_hash(cert, 0, &datum, &signature))
{
- gcry_md_close(md);
+ gcry_md_close(md);
return NULL;
}
@@ -744,7 +746,7 @@ eet_identity_check(const void *data_base,
}
gcry_md_close(md);
-# else
+# else /* if EET_USE_NEW_GNUTLS_API */
datum.data = (void *)data_base;
datum.size = data_length;
@@ -757,13 +759,13 @@ eet_identity_check(const void *data_base,
*sha1_length = -1;
}
-# endif
+# endif /* if EET_USE_NEW_GNUTLS_API */
gnutls_x509_crt_deinit(cert);
-# else
- const unsigned char *tmp;
- EVP_PKEY *pkey;
- X509 *x509;
+# else /* ifdef HAVE_GNUTLS */
+ const unsigned char * tmp;
+ EVP_PKEY * pkey;
+ X509 * x509;
EVP_MD_CTX md_ctx;
int err;
@@ -799,7 +801,7 @@ eet_identity_check(const void *data_base,
if (err != 1)
return NULL;
-# endif
+# endif /* ifdef HAVE_GNUTLS */
if (x509_length)
*x509_length = cert_len;
@@ -810,15 +812,15 @@ eet_identity_check(const void *data_base,
*raw_signature_length = sign_len;
return cert_der;
-#else
+#else /* ifdef HAVE_SIGNATURE */
return NULL;
-#endif
-}
+#endif /* ifdef HAVE_SIGNATURE */
+} /* eet_identity_check */
EAPI void
-eet_identity_certificate_print(const unsigned char *certificate,
- int der_length,
- FILE *out)
+eet_identity_certificate_print(const unsigned char * certificate,
+ int der_length,
+ FILE * out)
{
#ifdef HAVE_SIGNATURE
if (!certificate || !out || der_length <= 0)
@@ -854,9 +856,9 @@ on_error:
gnutls_free(datum.data);
gnutls_x509_crt_deinit(cert);
-# else
- const unsigned char *tmp;
- X509 *x509;
+# else /* ifdef HAVE_GNUTLS */
+ const unsigned char * tmp;
+ X509 * x509;
/* Strange but d2i_X509 seems to put 0 all over the place. */
tmp = alloca(der_length);
@@ -868,27 +870,27 @@ on_error:
return;
}
- INF("Public certificate :");
- X509_print_fp(out, x509);
+ INF("Public certificate :");
+ X509_print_fp(out, x509);
X509_free(x509);
-# endif
-#else
+# endif /* ifdef HAVE_GNUTLS */
+#else /* ifdef HAVE_SIGNATURE */
ERR("You need to compile signature support in EET.");
-#endif
-}
+#endif /* ifdef HAVE_SIGNATURE */
+} /* eet_identity_certificate_print */
Eet_Error
-eet_cipher(const void *data,
- unsigned int size,
- const char *key,
- unsigned int length,
- void **result,
- unsigned int *result_length)
+eet_cipher(const void * data,
+ unsigned int size,
+ const char * key,
+ unsigned int length,
+ void ** result,
+ unsigned int * result_length)
{
#ifdef HAVE_CIPHER
/* Cipher declarations */
- unsigned int *ret = NULL;
+ unsigned int * ret = NULL;
unsigned char iv[MAX_IV_LEN];
unsigned char ik[MAX_KEY_LEN];
unsigned char key_material[MAX_IV_LEN + MAX_KEY_LEN];
@@ -900,22 +902,22 @@ eet_cipher(const void *data,
/* Gcrypt declarations */
gcry_error_t err = 0;
gcry_cipher_hd_t cipher;
-# else
+# else /* ifdef HAVE_GNUTLS */
/* Openssl declarations*/
EVP_CIPHER_CTX ctx;
- unsigned int *buffer;
+ unsigned int * buffer;
int tmp_len;
-# endif
+# endif /* ifdef HAVE_GNUTLS */
# ifdef HAVE_GNUTLS
/* Gcrypt salt generation */
gcry_create_nonce((unsigned char *)&salt, sizeof(salt));
-# else
+# else /* ifdef HAVE_GNUTLS */
/* Openssl salt generation */
if (!RAND_bytes((unsigned char *)&salt, sizeof (unsigned int)))
return EET_ERROR_PRNG_NOT_SEEDED;
-#endif
+# endif /* ifdef HAVE_GNUTLS */
eet_pbkdf2_sha1(key,
length,
@@ -925,10 +927,10 @@ eet_cipher(const void *data,
key_material,
MAX_KEY_LEN + MAX_IV_LEN);
- memcpy(iv, key_material, MAX_IV_LEN);
- memcpy(ik, key_material + MAX_IV_LEN, MAX_KEY_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(key_material, 0, sizeof (key_material));
crypted_length = ((((size + sizeof (unsigned int)) >> 5) + 1) << 5);
ret = malloc(crypted_length + sizeof(unsigned int));
@@ -941,10 +943,10 @@ eet_cipher(const void *data,
}
*ret = salt;
- memset(&salt, 0, sizeof (salt));
+ memset(&salt, 0, sizeof (salt));
tmp = htonl(size);
-#ifdef HAVE_GNUTLS
+# ifdef HAVE_GNUTLS
*(ret + 1) = tmp;
memcpy(ret + 2, data, size);
@@ -977,7 +979,7 @@ eet_cipher(const void *data,
/* Gcrypt close the cipher */
gcry_cipher_close(cipher);
-# else
+# else /* ifdef HAVE_GNUTLS */
buffer = alloca(crypted_length);
*buffer = tmp;
@@ -996,7 +998,8 @@ eet_cipher(const void *data,
/* Openssl encrypt */
if (!EVP_EncryptUpdate(&ctx, (unsigned char *)(ret + 1), &tmp_len,
- (unsigned char *)buffer, size + sizeof (unsigned int)))
+ (unsigned char *)buffer,
+ size + sizeof(unsigned int)))
goto on_error;
/* Openssl close the cipher */
@@ -1005,7 +1008,7 @@ eet_cipher(const void *data,
goto on_error;
EVP_CIPHER_CTX_cleanup(&ctx);
-# endif
+# endif /* ifdef HAVE_GNUTLS */
/* Set return values */
if (result_length)
@@ -1027,12 +1030,12 @@ on_error:
if (opened)
gcry_cipher_close(cipher);
-# else
+# else /* ifdef HAVE_GNUTLS */
/* Openssl error */
if (opened)
EVP_CIPHER_CTX_cleanup(&ctx);
-# endif
+# endif /* ifdef HAVE_GNUTLS */
/* General error */
free(ret);
if (result)
@@ -1042,8 +1045,8 @@ on_error:
*result_length = 0;
return EET_ERROR_ENCRYPT_FAILED;
-#else
- /* Cipher not supported */
+#else /* ifdef HAVE_CIPHER */
+ /* Cipher not supported */
(void)data;
(void)size;
(void)key;
@@ -1051,20 +1054,20 @@ on_error:
(void)result;
(void)result_length;
return EET_ERROR_NOT_IMPLEMENTED;
-#endif
-}
+#endif /* ifdef HAVE_CIPHER */
+} /* eet_cipher */
Eet_Error
-eet_decipher(const void *data,
- unsigned int size,
- const char *key,
- unsigned int length,
- void **result,
- unsigned int *result_length)
+eet_decipher(const void * data,
+ unsigned int size,
+ const char * key,
+ unsigned int length,
+ void ** result,
+ unsigned int * result_length)
{
#ifdef HAVE_CIPHER
- const unsigned int *over = data;
- unsigned int *ret = NULL;
+ const unsigned int * over = data;
+ unsigned int * ret = NULL;
unsigned char ik[MAX_KEY_LEN];
unsigned char iv[MAX_IV_LEN];
unsigned char key_material[MAX_KEY_LEN + MAX_IV_LEN];
@@ -1080,12 +1083,8 @@ eet_decipher(const void *data,
salt = *over;
/* Generate the iv and the key with the salt */
- eet_pbkdf2_sha1(key,
- length,
- (unsigned char *)&salt,
- sizeof(unsigned int),
- 2048,
- key_material,
+ eet_pbkdf2_sha1(key, length, (unsigned char *)&salt,
+ sizeof(unsigned int), 2048, key_material,
MAX_KEY_LEN + MAX_IV_LEN);
memcpy(iv, key_material, MAX_IV_LEN);
@@ -1124,18 +1123,15 @@ eet_decipher(const void *data,
memset(ik, 0, sizeof (ik));
/* Gcrypt decrypt */
- err = gcry_cipher_decrypt(cipher,
- ret,
- tmp_len,
- ((unsigned int *)data) + 1,
- tmp_len);
+ err = gcry_cipher_decrypt(cipher, ret, tmp_len,
+ ((unsigned int *)data) + 1, tmp_len);
if (err)
goto on_error;
/* Gcrypt close the cipher */
gcry_cipher_close(cipher);
-# else
+# else /* ifdef HAVE_GNUTLS */
EVP_CIPHER_CTX ctx;
int opened = 0;
@@ -1156,7 +1152,7 @@ eet_decipher(const void *data,
/* Openssl close the cipher*/
EVP_CIPHER_CTX_cleanup(&ctx);
-# endif
+# endif /* ifdef HAVE_GNUTLS */
/* Get the decrypted data size */
tmp = *ret;
tmp = ntohl(tmp);
@@ -1190,7 +1186,7 @@ on_error:
if (opened)
EVP_CIPHER_CTX_cleanup(&ctx);
-# endif
+# endif /* ifdef HAVE_GNUTLS */
if (result)
*result = NULL;
@@ -1201,7 +1197,7 @@ on_error:
free(ret);
return EET_ERROR_DECRYPT_FAILED;
-#else
+#else /* ifdef HAVE_CIPHER */
(void)data;
(void)size;
(void)key;
@@ -1209,18 +1205,21 @@ on_error:
(void)result;
(void)result_length;
return EET_ERROR_NOT_IMPLEMENTED;
-#endif
-}
+#endif /* ifdef HAVE_CIPHER */
+} /* eet_decipher */
#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)
+eet_hmac_sha1(const void * key,
+ size_t key_len,
+ const void * data,
+ size_t data_len,
+ unsigned char * res)
{
size_t hlen = gcry_md_get_algo_dlen (GCRY_MD_SHA1);
gcry_md_hd_t mdh;
- unsigned char *hash;
+ unsigned char * hash;
gpg_error_t err;
err = gcry_md_open(&mdh, GCRY_MD_SHA1, GCRY_MD_FLAG_HMAC);
@@ -1248,22 +1247,23 @@ eet_hmac_sha1(const void *key, size_t key_len,
gcry_md_close(mdh);
return 0;
-}
-# endif
+} /* eet_hmac_sha1 */
+
+# 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)
+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)
{
unsigned char digest[20];
unsigned char tab[4];
- unsigned char *p = res;
- unsigned char *buf;
+ unsigned char * p = res;
+ unsigned char * buf;
unsigned long i;
int digest_len = 20;
int len = res_len;
@@ -1272,7 +1272,7 @@ eet_pbkdf2_sha1(const char *key,
# ifdef HAVE_GNUTLS
# else
HMAC_CTX hctx;
-# endif
+# endif /* ifdef HAVE_GNUTLS */
buf = alloca(salt_len + 4);
if (!buf)
@@ -1294,21 +1294,21 @@ eet_pbkdf2_sha1(const char *key,
memcpy(buf, salt, salt_len);
memcpy(buf + salt_len, tab, 4);
eet_hmac_sha1(key, key_len, buf, salt_len + 4, digest);
-# else
+# else /* ifdef HAVE_GNUTLS */
HMAC_Init(&hctx, key, key_len, EVP_sha1());
HMAC_Update(&hctx, salt, salt_len);
HMAC_Update(&hctx, tab, 4);
HMAC_Final(&hctx, digest, NULL);
-# endif
+# endif /* ifdef HAVE_GNUTLS */
memcpy(p, digest, tmp_len);
for (j = 1; j < iter; j++)
{
# ifdef HAVE_GNUTLS
eet_hmac_sha1(key, key_len, digest, 20, digest);
-# else
+# else /* ifdef HAVE_GNUTLS */
HMAC(EVP_sha1(), key, key_len, digest, 20, digest, NULL);
-# endif
+# endif /* ifdef HAVE_GNUTLS */
for (k = 0; k < tmp_len; k++)
p[k] ^= digest[k];
}
@@ -1317,7 +1317,8 @@ eet_pbkdf2_sha1(const char *key,
# ifdef HAVE_GNUTLS
# else
HMAC_cleanup(&hctx);
-# endif
+# endif /* ifdef HAVE_GNUTLS */
return 0;
-}
-#endif
+} /* eet_pbkdf2_sha1 */
+
+#endif /* ifdef HAVE_CIPHER */
diff --git a/src/lib/eet_connection.c b/src/lib/eet_connection.c
index fb41ff0..66b4911 100644
--- a/src/lib/eet_connection.c
+++ b/src/lib/eet_connection.c
@@ -4,7 +4,7 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
-#endif
+#endif /* ifdef HAVE_CONFIG_H */
#ifdef HAVE_ALLOCA_H
# include <alloca.h>
@@ -15,24 +15,24 @@
#elif defined _MSC_VER
# include <malloc.h>
# define alloca _alloca
-#else
+#else /* ifdef HAVE_ALLOCA_H */
# include <stddef.h>
# ifdef __cplusplus
extern "C"
-# endif
-void *alloca (size_t);
-#endif
+# endif /* ifdef __cplusplus */
+void * alloca (size_t);
+#endif /* ifdef HAVE_ALLOCA_H */
#include <string.h>
#include <stdlib.h>
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
-#endif
+#endif /* ifdef HAVE_NETINET_IN_H */
#ifdef _WIN32
# include <winsock2.h>
-#endif
+#endif /* ifdef _WIN32 */
#include <Eina.h>
@@ -41,7 +41,7 @@ void *alloca (size_t);
#define MAGIC_EET_DATA_PACKET 0x4270ACE1
-typedef struct _Eet_Message Eet_Message;
+typedef struct _Eet_Message Eet_Message;
struct _Eet_Message
{
int magic;
@@ -50,23 +50,23 @@ struct _Eet_Message
struct _Eet_Connection
{
- Eet_Read_Cb *eet_read_cb;
- Eet_Write_Cb *eet_write_cb;
- void *user_data;
+ Eet_Read_Cb * eet_read_cb;
+ Eet_Write_Cb * eet_write_cb;
+ void * user_data;
- size_t allocated;
- size_t size;
- size_t received;
+ size_t allocated;
+ size_t size;
+ size_t received;
- void *buffer;
+ void * buffer;
};
EAPI Eet_Connection *
-eet_connection_new(Eet_Read_Cb *eet_read_cb,
- Eet_Write_Cb *eet_write_cb,
- const void *user_data)
+eet_connection_new(Eet_Read_Cb * eet_read_cb,
+ Eet_Write_Cb * eet_write_cb,
+ const void * user_data)
{
- Eet_Connection *conn;
+ Eet_Connection * conn;
if (!eet_read_cb || !eet_write_cb)
return NULL;
@@ -80,12 +80,14 @@ eet_connection_new(Eet_Read_Cb *eet_read_cb,
conn->user_data = (void *)user_data;
return conn;
-}
+} /* eet_connection_new */
EAPI int
-eet_connection_received(Eet_Connection *conn, const void *data, size_t size)
+eet_connection_received(Eet_Connection * conn,
+ const void * data,
+ size_t size)
{
- if (!conn || !data || !size)
+ if ((!conn) || (!data) || (!size))
return size;
do {
@@ -93,7 +95,7 @@ eet_connection_received(Eet_Connection *conn, const void *data, size_t size)
if (conn->size == 0)
{
- const Eet_Message *msg;
+ const Eet_Message * msg;
size_t packet_size;
if (size < sizeof (Eet_Message))
@@ -127,7 +129,7 @@ eet_connection_received(Eet_Connection *conn, const void *data, size_t size)
conn->size = packet_size;
if (conn->allocated < conn->size)
{
- void *tmp;
+ void * tmp;
tmp = realloc(conn->buffer, conn->size);
if (!tmp)
@@ -167,12 +169,14 @@ eet_connection_received(Eet_Connection *conn, const void *data, size_t size)
} while (size > 0);
return size;
-}
+} /* eet_connection_received */
static Eina_Bool
-_eet_connection_raw_send(Eet_Connection *conn, void *data, int data_size)
+_eet_connection_raw_send(Eet_Connection * conn,
+ void * data,
+ int data_size)
{
- Eet_Message *message;
+ Eet_Message * message;
/* Message should never be above 64K */
if (data_size > 64 * 1024)
@@ -182,21 +186,21 @@ _eet_connection_raw_send(Eet_Connection *conn, void *data, int data_size)
message->magic = htonl(MAGIC_EET_DATA_PACKET);
message->size = htonl(data_size);
- memcpy(message + 1, data, data_size);
+ memcpy(message + 1, data, data_size);
conn->eet_write_cb(message,
data_size + sizeof (Eet_Message),
conn->user_data);
return EINA_TRUE;
-}
+} /* _eet_connection_raw_send */
EAPI Eina_Bool
-eet_connection_send(Eet_Connection *conn,
- Eet_Data_Descriptor *edd,
- const void *data_in,
- const char *cipher_key)
+eet_connection_send(Eet_Connection * conn,
+ Eet_Data_Descriptor * edd,
+ const void * data_in,
+ const char * cipher_key)
{
- void *flat_data;
+ void * flat_data;
int data_size;
Eina_Bool ret = EINA_FALSE;
@@ -212,14 +216,14 @@ eet_connection_send(Eet_Connection *conn,
free(flat_data);
return ret;
-}
+} /* eet_connection_send */
EAPI Eina_Bool
-eet_connection_node_send(Eet_Connection *conn,
- Eet_Node *node,
- const char *cipher_key)
+eet_connection_node_send(Eet_Connection * conn,
+ Eet_Node * node,
+ const char * cipher_key)
{
- void *data;
+ void * data;
int data_size;
Eina_Bool ret = EINA_FALSE;
@@ -232,12 +236,13 @@ eet_connection_node_send(Eet_Connection *conn,
free(data);
return ret;
-}
+} /* eet_connection_node_send */
EAPI void *
-eet_connection_close(Eet_Connection *conn, Eina_Bool *on_going)
+eet_connection_close(Eet_Connection * conn,
+ Eina_Bool * on_going)
{
- void *user_data;
+ void * user_data;
if (!conn)
return NULL;
@@ -251,4 +256,5 @@ eet_connection_close(Eet_Connection *conn, Eina_Bool *on_going)
free(conn);
return user_data;
-}
+} /* eet_connection_close */
+
diff --git a/src/lib/eet_data.c b/src/lib/eet_data.c
index f919730..bf774e4 100644
--- a/src/lib/eet_data.c
+++ b/src/lib/eet_data.c
@@ -4,7 +4,7 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
-#endif
+#endif /* ifdef HAVE_CONFIG_H */
#include <stdio.h>
#include <string.h>
@@ -14,11 +14,11 @@
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
-#endif
+#endif /* ifdef HAVE_NETINET_IN_H */
#ifdef _WIN32
# include <winsock2.h>
-#endif
+#endif /* ifdef _WIN32 */
#include <Eina.h>
@@ -65,16 +65,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;
/*---*/
@@ -84,80 +84,73 @@ typedef struct _Eet_Variant_Unknow Eet_Variant_Unknow;
*/
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);
- void *(*put)(Eet_Dictionary *ed, const void *src, int *size_ret);
+ int size;
+ const char * name;
+ 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
{
- char *name;
- int len;
- int size;
- int hash;
- void *data;
+ char * name;
+ int len;
+ int size;
+ int hash;
+ void * data;
unsigned char type;
unsigned char group_type;
};
struct _Eet_Data_Stream
{
- void *data;
- int size;
- int pos;
+ void * data;
+ int size;
+ int pos;
};
struct _Eet_Data_Descriptor_Hash
{
- Eet_Data_Element *element;
- Eet_Data_Descriptor_Hash *next;
+ Eet_Data_Element * element;
+ Eet_Data_Descriptor_Hash * next;
};
struct _Eet_Data_Descriptor
{
- const char *name;
- const Eet_Dictionary *ed;
- int size;
+ const char * name;
+ const Eet_Dictionary * ed;
+ int size;
struct
{
- void *(*mem_alloc)(size_t size);
- void (*mem_free)(void *mem);
- char *(*str_alloc)(const char *str);
- char *(*str_direct_alloc)(const char *str);
- void (*str_free)(const char *str);
- void (*str_direct_free)(const char *str);
- void *(*list_next)(void *l);
- 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_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);
+ void * (* mem_alloc)(size_t size);
+ void (* mem_free)(void * mem);
+ char * (* str_alloc)(const char * str);
+ char * (* str_direct_alloc)(const char * str);
+ void (* str_free)(const char * str);
+ void (* str_direct_free)(const char * str);
+ void * (* list_next)(void * l);
+ 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_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);
} func;
struct
{
- int num;
- Eet_Data_Element *set;
+ int num;
+ Eet_Data_Element * set;
struct
{
- int size;
- Eet_Data_Descriptor_Hash *buckets;
+ int size;
+ Eet_Data_Descriptor_Hash * buckets;
} hash;
} elements;
@@ -168,30 +161,30 @@ struct _Eet_Data_Descriptor
struct _Eet_Data_Element
{
- const char *name;
- const char *counter_name;
- const char *directory_name_ptr;
- Eet_Data_Descriptor *subtype;
- int offset; /* offset in bytes from the base element */
- int count; /* number of elements for a fixed array */
- int counter_offset; /* for a variable array we need the offset of the count variable */
- unsigned char type; /* EET_T_XXX */
- unsigned char group_type; /* EET_G_XXX */
+ const char * name;
+ const char * counter_name;
+ const char * directory_name_ptr;
+ Eet_Data_Descriptor * subtype;
+ int offset; /* offset in bytes from the base element */
+ int count; /* number of elements for a fixed array */
+ int counter_offset; /* for a variable array we need the offset of the count variable */
+ unsigned char type; /* EET_T_XXX */
+ unsigned char group_type; /* EET_G_XXX */
};
struct _Eet_Data_Encode_Hash_Info
{
- Eet_Data_Stream *ds;
- Eet_Data_Element *ede;
- Eet_Dictionary *ed;
+ Eet_Data_Stream * ds;
+ Eet_Data_Element * ede;
+ Eet_Dictionary * ed;
};
struct _Eet_Free
{
- int ref;
- int len[256];
- int num[256];
- void **list[256];
+ int ref;
+ int len[256];
+ int num[256];
+ void ** list[256];
};
struct _Eet_Free_Context
@@ -205,238 +198,238 @@ struct _Eet_Free_Context
struct _Eet_Variant_Unknow
{
- EINA_MAGIC;
+ EINA_MAGIC;
- int size;
+ int size;
char data[1];
};
/*---*/
-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);
+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);
/*---*/
@@ -445,25 +438,18 @@ 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(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(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(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_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 }
};
@@ -482,91 +468,91 @@ 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) | \
+#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) | \
+#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) | \
+#define SWAP16(x) (x) =\
+ ((((short)(x) & 0x00ff) << 8) |\
(((short)(x) & 0xff00) >> 8))
#ifdef CONV8
# undef CONV8
-#endif
+#endif /* ifdef CONV8 */
#ifdef CONV16
# undef CONV16
-#endif
+#endif /* ifdef CONV16 */
#ifdef CONV32
# undef CONV32
-#endif
+#endif /* ifdef CONV32 */
#ifdef CONV64
# undef CONV64
-#endif
+#endif /* ifdef CONV64 */
#define CONV8(x)
-#define CONV16(x) {if (_eet_data_words_bigendian) {SWAP16(x); }}
-#define CONV32(x) {if (_eet_data_words_bigendian) {SWAP32(x); }}
-#define CONV64(x) {if (_eet_data_words_bigendian) {SWAP64(x); }}
-
-#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; } \
+#define CONV16(x) {if (_eet_data_words_bigendian) {SWAP16(x); }}
+#define CONV32(x) {if (_eet_data_words_bigendian) {SWAP32(x); }}
+#define CONV64(x) {if (_eet_data_words_bigendian) {SWAP64(x); }}
+
+#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 STRUCT_TYPE_DECODE(Data_Ret, Context, Ed, Ede, Data, Size, Label) \
- do { \
- Data_Ret = _eet_data_descriptor_decode(Context, \
- Ed, \
- Ede, \
- Data, \
- Size); \
- if (!Data_Ret) { goto Label; } \
+#define STRUCT_TYPE_DECODE(Data_Ret, Context, Ed, Ede, Data, Size, Label)\
+ do {\
+ Data_Ret = _eet_data_descriptor_decode(Context,\
+ Ed,\
+ Ede,\
+ Data,\
+ Size);\
+ if (!Data_Ret) { goto Label; }\
} while (0)
-#define EET_I_STRING 1 << 4
-#define EET_I_INLINED_STRING 2 << 4
-#define EET_I_NULL 3 << 4
+#define EET_I_STRING 1 << 4
+#define EET_I_INLINED_STRING 2 << 4
+#define EET_I_NULL 3 << 4
-#define EET_MAGIC_VARIANT 0xF1234BC
+#define EET_MAGIC_VARIANT 0xF1234BC
/*---*/
/* CHAR TYPE */
static int
-eet_data_get_char(const Eet_Dictionary *ed __UNUSED__,
- const void *src,
- const void *src_end,
- void *dst)
+eet_data_get_char(const Eet_Dictionary * ed __UNUSED__,
+ const void * src,
+ const void * src_end,
+ void * dst)
{
- char *s, *d;
+ char * s, * d;
if (((char *)src + sizeof(char)) > (char *)src_end)
return -1;
@@ -576,12 +562,14 @@ eet_data_get_char(const Eet_Dictionary *ed __UNUSED__,
*d = *s;
CONV8(*d);
return sizeof(char);
-}
+} /* eet_data_get_char */
static void *
-eet_data_put_char(Eet_Dictionary *ed __UNUSED__, const void *src, int *size_ret)
+eet_data_put_char(Eet_Dictionary * ed __UNUSED__,
+ const void * src,
+ int * size_ret)
{
- char *s, *d;
+ char * s, * d;
d = (char *)malloc(sizeof(char));
if (!d)
@@ -592,16 +580,16 @@ eet_data_put_char(Eet_Dictionary *ed __UNUSED__, const void *src, int *size_ret)
CONV8(*d);
*size_ret = sizeof(char);
return d;
-}
+} /* eet_data_put_char */
/* SHORT TYPE */
static int
-eet_data_get_short(const Eet_Dictionary *ed __UNUSED__,
- const void *src,
- const void *src_end,
- void *dst)
+eet_data_get_short(const Eet_Dictionary * ed __UNUSED__,
+ const void * src,
+ const void * src_end,
+ void * dst)
{
- short *d;
+ short * d;
if (((char *)src + sizeof(short)) > (char *)src_end)
return -1;
@@ -610,14 +598,14 @@ eet_data_get_short(const Eet_Dictionary *ed __UNUSED__,
d = (short *)dst;
CONV16(*d);
return sizeof(short);
-}
+} /* eet_data_get_short */
static void *
-eet_data_put_short(Eet_Dictionary *ed __UNUSED__,
- const void *src,
- int *size_ret)
+eet_data_put_short(Eet_Dictionary * ed __UNUSED__,
+ const void * src,
+ int * size_ret)
{
- short *s, *d;
+ short * s, * d;
d = (short *)malloc(sizeof(short));
if (!d)
@@ -628,16 +616,16 @@ eet_data_put_short(Eet_Dictionary *ed __UNUSED__,
CONV16(*d);
*size_ret = sizeof(short);
return d;
-}
+} /* eet_data_put_short */
/* INT TYPE */
static inline int
-eet_data_get_int(const Eet_Dictionary *ed __UNUSED__,
- const void *src,
- const void *src_end,
- void *dst)
+eet_data_get_int(const Eet_Dictionary * ed __UNUSED__,
+ const void * src,
+ const void * src_end,
+ void * dst)
{
- int *d;
+ int * d;
if (((char *)src + sizeof(int)) > (char *)src_end)
return -1;
@@ -646,12 +634,14 @@ eet_data_get_int(const Eet_Dictionary *ed __UNUSED__,
d = (int *)dst;
CONV32(*d);
return sizeof(int);
-}
+} /* eet_data_get_int */
static void *
-eet_data_put_int(Eet_Dictionary *ed __UNUSED__, const void *src, int *size_ret)
+eet_data_put_int(Eet_Dictionary * ed __UNUSED__,
+ const void * src,
+ int * size_ret)
{
- int *s, *d;
+ int * s, * d;
d = (int *)malloc(sizeof(int));
if (!d)
@@ -662,16 +652,16 @@ eet_data_put_int(Eet_Dictionary *ed __UNUSED__, const void *src, int *size_ret)
CONV32(*d);
*size_ret = sizeof(int);
return d;
-}
+} /* eet_data_put_int */
/* LONG LONG TYPE */
static int
-eet_data_get_long_long(const Eet_Dictionary *ed __UNUSED__,
- const void *src,
- const void *src_end,
- void *dst)
+eet_data_get_long_long(const Eet_Dictionary * ed __UNUSED__,
+ const void * src,
+ const void * src_end,
+ void * dst)
{
- unsigned long long *d;
+ unsigned long long * d;
if (((char *)src + sizeof(unsigned long long)) > (char *)src_end)
return -1;
@@ -680,14 +670,14 @@ eet_data_get_long_long(const Eet_Dictionary *ed __UNUSED__,
d = (unsigned long long *)dst;
CONV64(*d);
return sizeof(unsigned long long);
-}
+} /* eet_data_get_long_long */
static void *
-eet_data_put_long_long(Eet_Dictionary *ed __UNUSED__,
- const void *src,
- int *size_ret)
+eet_data_put_long_long(Eet_Dictionary * ed __UNUSED__,
+ const void * src,
+ int * size_ret)
{
- unsigned long long *s, *d;
+ unsigned long long * s, * d;
d = (unsigned long long *)malloc(sizeof(unsigned long long));
if (!d)
@@ -698,13 +688,13 @@ eet_data_put_long_long(Eet_Dictionary *ed __UNUSED__,
CONV64(*d);
*size_ret = sizeof(unsigned long long);
return d;
-}
+} /* eet_data_put_long_long */
/* STRING TYPE */
static inline int
-eet_data_get_string_hash(const Eet_Dictionary *ed,
- const void *src,
- const void *src_end)
+eet_data_get_string_hash(const Eet_Dictionary * ed,
+ const void * src,
+ const void * src_end)
{
if (ed)
{
@@ -717,21 +707,21 @@ eet_data_get_string_hash(const Eet_Dictionary *ed,
}
return -1;
-}
+} /* eet_data_get_string_hash */
static inline int
-eet_data_get_string(const Eet_Dictionary *ed,
- const void *src,
- const void *src_end,
- void *dst)
+eet_data_get_string(const Eet_Dictionary * ed,
+ const void * src,
+ const void * src_end,
+ void * dst)
{
- char *s, **d;
+ char * s, ** d;
d = (char **)dst;
if (ed)
{
- const char *str;
+ const char * str;
int idx;
if (eet_data_get_int(ed, src, src_end, &idx) < 0)
@@ -754,17 +744,19 @@ eet_data_get_string(const Eet_Dictionary *ed,
*d = s;
return strlen(s) + 1;
-}
+} /* eet_data_get_string */
static void *
-eet_data_put_string(Eet_Dictionary *ed, const void *src, int *size_ret)
+eet_data_put_string(Eet_Dictionary * ed,
+ const void * src,
+ int * size_ret)
{
- char *s, *d;
+ char * s, * d;
int len;
if (ed)
{
- const char *str;
+ const char * str;
int idx;
str = *((const char **)src);
@@ -790,49 +782,49 @@ eet_data_put_string(Eet_Dictionary *ed, const void *src, int *size_ret)
memcpy(d, s, len + 1);
*size_ret = len + 1;
return d;
-}
+} /* eet_data_put_string */
/* ALWAYS INLINED STRING TYPE */
static int
-eet_data_get_istring(const Eet_Dictionary *ed __UNUSED__,
- const void *src,
- const void *src_end,
- void *dst)
+eet_data_get_istring(const Eet_Dictionary * ed __UNUSED__,
+ 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)
+eet_data_put_istring(Eet_Dictionary * ed __UNUSED__,
+ const void * src,
+ int * size_ret)
{
return eet_data_put_string(NULL, src, size_ret);
-}
+} /* eet_data_put_istring */
/* 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)
+eet_data_get_null(const Eet_Dictionary * ed __UNUSED__,
+ const void * src __UNUSED__,
+ const void * src_end __UNUSED__,
+ void * dst)
{
- char **d;
+ char ** d;
d = (char **)dst;
*d = NULL;
return 1;
-}
+} /* eet_data_get_null */
static void *
-eet_data_put_null(Eet_Dictionary *ed __UNUSED__,
- const void *src __UNUSED__,
- int *size_ret)
+eet_data_put_null(Eet_Dictionary * ed __UNUSED__,
+ const void * src __UNUSED__,
+ int * size_ret)
{
*size_ret = 0;
return NULL;
-}
+} /* eet_data_put_null */
/**
* Fast lookups of simple doubles/floats.
@@ -841,7 +833,9 @@ eet_data_put_null(Eet_Dictionary *ed __UNUSED__,
* values, but have a so simple math that is almost as fast.
*/
static inline int
-_eet_data_float_cache_get(const char *s, int len, float *d)
+_eet_data_float_cache_get(const char * s,
+ int len,
+ float * d)
{
/* fast handle of simple case 0xMp+E*/
if ((len == 6) && (s[0] == '0') && (s[1] == 'x') && (s[3] == 'p'))
@@ -858,10 +852,12 @@ _eet_data_float_cache_get(const char *s, int len, float *d)
}
return 0;
-}
+} /* _eet_data_float_cache_get */
static inline int
-_eet_data_double_cache_get(const char *s, int len, double *d)
+_eet_data_double_cache_get(const char * s,
+ int len,
+ double * d)
{
/* fast handle of simple case 0xMp+E*/
if ((len == 6) && (s[0] == '0') && (s[1] == 'x') && (s[3] == 'p'))
@@ -878,22 +874,22 @@ _eet_data_double_cache_get(const char *s, int len, double *d)
}
return 0;
-}
+} /* _eet_data_double_cache_get */
/* FLOAT TYPE */
static int
-eet_data_get_float(const Eet_Dictionary *ed,
- const void *src,
- const void *src_end,
- void *dst)
+eet_data_get_float(const Eet_Dictionary * ed,
+ const void * src,
+ const void * src_end,
+ void * dst)
{
- float *d;
+ float * d;
int idx;
d = (float *)dst;
if (!ed)
{
- const char *s, *p;
+ const char * s, * p;
long long mantisse;
long exponent;
int len;
@@ -921,10 +917,12 @@ eet_data_get_float(const Eet_Dictionary *ed,
return -1;
return 1;
-}
+} /* eet_data_get_float */
static void *
-eet_data_put_float(Eet_Dictionary *ed, const void *src, int *size_ret)
+eet_data_put_float(Eet_Dictionary * ed,
+ const void * src,
+ int * size_ret)
{
char buf[128];
int idx;
@@ -933,7 +931,7 @@ eet_data_put_float(Eet_Dictionary *ed, const void *src, int *size_ret)
if (!ed)
{
- char *d;
+ char * d;
int len;
len = strlen(buf);
@@ -951,23 +949,23 @@ eet_data_put_float(Eet_Dictionary *ed, const void *src, int *size_ret)
return NULL;
return eet_data_put_int(ed, &idx, size_ret);
-}
+} /* eet_data_put_float */
/* DOUBLE TYPE */
static int
-eet_data_get_double(const Eet_Dictionary *ed,
- const void *src,
- const void *src_end,
- void *dst)
+eet_data_get_double(const Eet_Dictionary * ed,
+ const void * src,
+ const void * src_end,
+ void * dst)
{
- double *d;
+ double * d;
int idx;
d = (double *)dst;
if (!ed)
{
- const char *s, *p;
+ const char * s, * p;
long long mantisse = 0;
long exponent = 0;
int len;
@@ -995,10 +993,12 @@ eet_data_get_double(const Eet_Dictionary *ed,
return -1;
return 1;
-}
+} /* eet_data_get_double */
static void *
-eet_data_put_double(Eet_Dictionary *ed, const void *src, int *size_ret)
+eet_data_put_double(Eet_Dictionary * ed,
+ const void * src,
+ int * size_ret)
{
char buf[128];
int idx;
@@ -1007,7 +1007,7 @@ eet_data_put_double(Eet_Dictionary *ed, const void *src, int *size_ret)
if (!ed)
{
- char *d;
+ char * d;
int len;
len = strlen(buf);
@@ -1026,22 +1026,22 @@ eet_data_put_double(Eet_Dictionary *ed, const void *src, int *size_ret)
return NULL;
return eet_data_put_int(ed, &idx, size_ret);
-}
+} /* eet_data_put_double */
static int
-eet_data_get_f32p32(const Eet_Dictionary *ed,
- const void *src,
- const void *src_end,
- void *dst)
+eet_data_get_f32p32(const Eet_Dictionary * ed,
+ const void * src,
+ const void * src_end,
+ void * dst)
{
- Eina_F32p32 *fp;
+ Eina_F32p32 * fp;
int idx;
fp = (Eina_F32p32 *)dst;
if (!ed)
{
- const char *s, *p;
+ const char * s, * p;
int len;
s = (const char *)src;
@@ -1062,10 +1062,12 @@ eet_data_get_f32p32(const Eet_Dictionary *ed,
return -1;
return 1;
-}
+} /* eet_data_get_f32p32 */
static void *
-eet_data_put_f32p32(Eet_Dictionary *ed, const void *src, int *size_ret)
+eet_data_put_f32p32(Eet_Dictionary * ed,
+ const void * src,
+ int * size_ret)
{
char buf[128];
int idx;
@@ -1074,7 +1076,7 @@ eet_data_put_f32p32(Eet_Dictionary *ed, const void *src, int *size_ret)
if (!ed)
{
- char *d;
+ char * d;
int len;
len = strlen(buf);
@@ -1093,16 +1095,16 @@ eet_data_put_f32p32(Eet_Dictionary *ed, const void *src, int *size_ret)
return NULL;
return eet_data_put_int(ed, &idx, size_ret);
-}
+} /* eet_data_put_f32p32 */
static int
-eet_data_get_f16p16(const Eet_Dictionary *ed,
- const void *src,
- const void *src_end,
- void *dst)
+eet_data_get_f16p16(const Eet_Dictionary * ed,
+ const void * src,
+ const void * src_end,
+ void * dst)
{
Eina_F32p32 tmp;
- Eina_F16p16 *fp;
+ Eina_F16p16 * fp;
fp = (Eina_F16p16 *)dst;
@@ -1111,25 +1113,27 @@ eet_data_get_f16p16(const Eet_Dictionary *ed,
*fp = eina_f32p32_to_f16p16(tmp);
return 1;
-}
+} /* eet_data_get_f16p16 */
static void *
-eet_data_put_f16p16(Eet_Dictionary *ed, const void *src, int *size_ret)
+eet_data_put_f16p16(Eet_Dictionary * ed,
+ const void * src,
+ int * size_ret)
{
Eina_F32p32 tmp;
tmp = eina_f16p16_to_f32p32((Eina_F16p16)(*(Eina_F16p16 *)src));
return eet_data_put_f32p32(ed, &tmp, size_ret);
-}
+} /* eet_data_put_f16p16 */
static int
-eet_data_get_f8p24(const Eet_Dictionary *ed,
- const void *src,
- const void *src_end,
- void *dst)
+eet_data_get_f8p24(const Eet_Dictionary * ed,
+ const void * src,
+ const void * src_end,
+ void * dst)
{
Eina_F32p32 tmp;
- Eina_F8p24 *fp;
+ Eina_F8p24 * fp;
fp = (Eina_F8p24 *)dst;
@@ -1138,41 +1142,47 @@ eet_data_get_f8p24(const Eet_Dictionary *ed,
*fp = eina_f32p32_to_f8p24(tmp);
return 1;
-}
+} /* eet_data_get_f8p24 */
static void *
-eet_data_put_f8p24(Eet_Dictionary *ed, const void *src, int *size_ret)
+eet_data_put_f8p24(Eet_Dictionary * ed,
+ const void * src,
+ int * size_ret)
{
Eina_F32p32 tmp;
tmp = eina_f8p24_to_f32p32((Eina_F8p24)(*(Eina_F8p24 *)src));
return eet_data_put_f32p32(ed, &tmp, size_ret);
-}
+} /* eet_data_put_f8p24 */
static inline int
-eet_data_get_type(const Eet_Dictionary *ed,
- int type,
- const void *src,
- const void *src_end,
- void *dest)
+eet_data_get_type(const Eet_Dictionary * ed,
+ int type,
+ const void * src,
+ const void * src_end,
+ void * dest)
{
int ret;
ret = eet_basic_codec[type - 1].get(ed, src, src_end, dest);
return ret;
-}
+} /* eet_data_get_type */
static inline void *
-eet_data_put_type(Eet_Dictionary *ed, int type, const void *src, int *size_ret)
+eet_data_put_type(Eet_Dictionary * ed,
+ int type,
+ const void * src,
+ int * size_ret)
{
- void *ret;
+ void * ret;
ret = eet_basic_codec[type - 1].put(ed, src, size_ret);
return ret;
-}
+} /* eet_data_put_type */
static inline Eina_Bool
-eet_data_type_match(int type1, int type2)
+eet_data_type_match(int type1,
+ int type2)
{
if (type1 == type2)
return EINA_TRUE;
@@ -1197,15 +1207,15 @@ eet_data_type_match(int type1, int type2)
default:
break;
- }
+ } /* switch */
break;
default:
break;
- }
+ } /* switch */
return EINA_FALSE;
-}
+} /* eet_data_type_match */
/* chunk format...
*
@@ -1221,10 +1231,12 @@ eet_data_type_match(int type1, int type2)
*/
static inline void
-eet_data_chunk_get(const Eet_Dictionary *ed, Eet_Data_Chunk *chnk,
- const void *src, int size)
+eet_data_chunk_get(const Eet_Dictionary * ed,
+ Eet_Data_Chunk * chnk,
+ const void * src,
+ int size)
{
- const char *s;
+ const char * s;
int ret1, ret2;
if (!src)
@@ -1249,7 +1261,7 @@ eet_data_chunk_get(const Eet_Dictionary *ed, Eet_Data_Chunk *chnk,
((chnk->type - EET_I_LIMIT) & 0xF) + EET_G_UNKNOWN;
switch ((chnk->type - EET_I_LIMIT) & 0xF0)
{
-#define EET_UNMATCH_TYPE(Type) \
+#define EET_UNMATCH_TYPE(Type)\
case EET_I_ ## Type: chnk->type = EET_T_ ## Type; break;
EET_UNMATCH_TYPE(STRING);
@@ -1258,7 +1270,7 @@ eet_data_chunk_get(const Eet_Dictionary *ed, Eet_Data_Chunk *chnk,
default:
return;
- }
+ } /* switch */
}
else if (chnk->type > EET_T_LAST)
{
@@ -1308,16 +1320,16 @@ eet_data_chunk_get(const Eet_Dictionary *ed, Eet_Data_Chunk *chnk,
}
return;
-}
+} /* eet_data_chunk_get */
static inline Eet_Data_Chunk *
-eet_data_chunk_new(void *data,
- int size,
- const char *name,
- int type,
- int group_type)
+eet_data_chunk_new(void * data,
+ int size,
+ const char * name,
+ int type,
+ int group_type)
{
- Eet_Data_Chunk *chnk;
+ Eet_Data_Chunk * chnk;
if (!name)
return NULL;
@@ -1340,48 +1352,50 @@ eet_data_chunk_new(void *data,
chnk->type = type;
chnk->group_type = group_type;
return chnk;
-}
+} /* eet_data_chunk_new */
static inline void
-eet_data_chunk_free(Eet_Data_Chunk *chnk)
+eet_data_chunk_free(Eet_Data_Chunk * chnk)
{
if (chnk->name)
free(chnk->name);
- free(chnk);
-}
+ free(chnk);
+} /* eet_data_chunk_free */
static inline Eet_Data_Stream *
eet_data_stream_new(void)
{
- Eet_Data_Stream *ds;
+ Eet_Data_Stream * ds;
ds = calloc(1, sizeof(Eet_Data_Stream));
if (!ds)
return NULL;
return ds;
-}
+} /* eet_data_stream_new */
static inline void
-eet_data_stream_free(Eet_Data_Stream *ds)
+eet_data_stream_free(Eet_Data_Stream * ds)
{
if (ds->data)
free(ds->data);
- free(ds);
-}
+ free(ds);
+} /* eet_data_stream_free */
static inline void
-eet_data_stream_flush(Eet_Data_Stream *ds)
+eet_data_stream_flush(Eet_Data_Stream * ds)
{
- free(ds);
-}
+ free(ds);
+} /* eet_data_stream_flush */
static inline void
-eet_data_stream_write(Eet_Data_Stream *ds, const void *data, int size)
+eet_data_stream_write(Eet_Data_Stream * ds,
+ const void * data,
+ int size)
{
- char *p;
+ char * p;
if ((ds->pos + size) > ds->size)
{
@@ -1399,15 +1413,15 @@ eet_data_stream_write(Eet_Data_Stream *ds, const void *data, int size)
p = ds->data;
memcpy(p + ds->pos, data, size);
ds->pos += size;
-}
+} /* eet_data_stream_write */
static void
-eet_data_chunk_put(Eet_Dictionary *ed,
- Eet_Data_Chunk *chnk,
- Eet_Data_Stream *ds)
+eet_data_chunk_put(Eet_Dictionary * ed,
+ Eet_Data_Chunk * chnk,
+ Eet_Data_Stream * ds)
{
- int *size;
- void *string;
+ int * size;
+ void * string;
int s;
int size_ret = 0;
int string_ret = 0;
@@ -1429,7 +1443,7 @@ eet_data_chunk_put(Eet_Dictionary *ed,
switch (chnk->type)
{
/* Only make sense with pointer type. */
-#define EET_MATCH_TYPE(Type) \
+#define EET_MATCH_TYPE(Type)\
case EET_T_ ## Type: type += EET_I_ ## Type; break;
EET_MATCH_TYPE(STRING);
@@ -1438,7 +1452,7 @@ eet_data_chunk_put(Eet_Dictionary *ed,
default:
return;
- }
+ } /* switch */
buf[3] = type;
}
@@ -1460,27 +1474,27 @@ eet_data_chunk_put(Eet_Dictionary *ed,
if (!size)
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);
+ 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);
+ free(string);
on_error:
- free(size);
-}
+ free(size);
+} /* eet_data_chunk_put */
/*---*/
static void
-_eet_descriptor_hash_new(Eet_Data_Descriptor *edd)
+_eet_descriptor_hash_new(Eet_Data_Descriptor * edd)
{
int i;
@@ -1491,7 +1505,7 @@ _eet_descriptor_hash_new(Eet_Data_Descriptor *edd)
edd->elements.hash.size);
for (i = 0; i < edd->elements.num; i++)
{
- Eet_Data_Element *ede;
+ Eet_Data_Element * ede;
int hash;
ede = &(edd->elements.set[i]);
@@ -1500,7 +1514,7 @@ _eet_descriptor_hash_new(Eet_Data_Descriptor *edd)
edd->elements.hash.buckets[hash].element = ede;
else
{
- Eet_Data_Descriptor_Hash *bucket;
+ Eet_Data_Descriptor_Hash * bucket;
bucket = calloc(1, sizeof(Eet_Data_Descriptor_Hash));
bucket->element = ede;
@@ -1508,16 +1522,16 @@ _eet_descriptor_hash_new(Eet_Data_Descriptor *edd)
edd->elements.hash.buckets[hash].next = bucket;
}
}
-}
+} /* _eet_descriptor_hash_new */
static void
-_eet_descriptor_hash_free(Eet_Data_Descriptor *edd)
+_eet_descriptor_hash_free(Eet_Data_Descriptor * edd)
{
int i;
for (i = 0; i < edd->elements.hash.size; i++)
{
- Eet_Data_Descriptor_Hash *bucket, *pbucket;
+ Eet_Data_Descriptor_Hash * bucket, * pbucket;
bucket = edd->elements.hash.buckets[i].next;
while (bucket)
@@ -1528,13 +1542,15 @@ _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 *
-_eet_descriptor_hash_find(Eet_Data_Descriptor *edd, char *name, int hash)
+_eet_descriptor_hash_find(Eet_Data_Descriptor * edd,
+ char * name,
+ int hash)
{
- Eet_Data_Descriptor_Hash *bucket;
+ Eet_Data_Descriptor_Hash * bucket;
if (hash < 0)
hash = _eet_hash_gen(name, 6);
@@ -1572,34 +1588,36 @@ _eet_descriptor_hash_find(Eet_Data_Descriptor *edd, char *name, int hash)
bucket = bucket->next;
}
return NULL;
-}
+} /* _eet_descriptor_hash_find */
static void *
_eet_mem_alloc(size_t size)
{
return calloc(1, size);
-}
+} /* _eet_mem_alloc */
static void
-_eet_mem_free(void *mem)
+_eet_mem_free(void * mem)
{
- free(mem);
-}
+ free(mem);
+} /* _eet_mem_free */
static char *
-_eet_str_alloc(const char *str)
+_eet_str_alloc(const char * str)
{
return strdup(str);
-}
+} /* _eet_str_alloc */
static void
-_eet_str_free(const char *str)
+_eet_str_free(const char * str)
{
- free((char *)str);
-}
+ free((char *)str);
+} /* _eet_str_free */
static Eina_Hash *
-_eet_eina_hash_add_alloc(Eina_Hash *hash, const char *key, void *data)
+_eet_eina_hash_add_alloc(Eina_Hash * hash,
+ const char * key,
+ void * data)
{
if (!hash)
hash = eina_hash_string_small_new(NULL);
@@ -1609,10 +1627,12 @@ _eet_eina_hash_add_alloc(Eina_Hash *hash, const char *key, void *data)
eina_hash_add(hash, key, data);
return hash;
-}
+} /* _eet_eina_hash_add_alloc */
static Eina_Hash *
-_eet_eina_hash_direct_add_alloc(Eina_Hash *hash, const char *key, void *data)
+_eet_eina_hash_direct_add_alloc(Eina_Hash * hash,
+ const char * key,
+ void * data)
{
if (!hash)
hash = eina_hash_string_small_new(NULL);
@@ -1622,38 +1642,40 @@ _eet_eina_hash_direct_add_alloc(Eina_Hash *hash, const char *key, void *data)
eina_hash_direct_add(hash, key, data);
return hash;
-}
+} /* _eet_eina_hash_direct_add_alloc */
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 __UNUSED__)
+_eet_str_direct_free(const char * str __UNUSED__)
{
-}
+} /* _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);
-}
+} /* _eet_eina_hash_foreach */
static void
-_eet_eina_hash_free(void *hash)
+_eet_eina_hash_free(void * hash)
{
if (hash)
eina_hash_free(hash);
-}
+} /* _eet_eina_hash_free */
/*---*/
EAPI Eina_Bool
-eet_eina_stream_data_descriptor_class_set(Eet_Data_Descriptor_Class *eddc,
- const char *name,
- int size)
+eet_eina_stream_data_descriptor_class_set(Eet_Data_Descriptor_Class * eddc,
+ const char * name,
+ int size)
{
if (!eddc || !name)
return EINA_FALSE;
@@ -1670,39 +1692,35 @@ eet_eina_stream_data_descriptor_class_set(Eet_Data_Descriptor_Class *eddc,
eddc->func.list_append = (void *(*)(void *, void *))eina_list_append;
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_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_free = (void (*)(void *))_eet_eina_hash_free;
return EINA_TRUE;
-}
+} /* eet_eina_stream_data_descriptor_class_set */
EAPI Eina_Bool
-eet_eina_file_data_descriptor_class_set(Eet_Data_Descriptor_Class *eddc,
- const char *name,
- int size)
+eet_eina_file_data_descriptor_class_set(Eet_Data_Descriptor_Class * eddc,
+ const char * name,
+ int size)
{
if (!eet_eina_stream_data_descriptor_class_set(eddc, name, size))
return EINA_FALSE;
eddc->version = 2;
- 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;
return EINA_TRUE;
-}
+} /* eet_eina_file_data_descriptor_class_set */
static Eet_Data_Descriptor *
-_eet_data_descriptor_new(const Eet_Data_Descriptor_Class *eddc, int version)
+_eet_data_descriptor_new(const Eet_Data_Descriptor_Class * eddc,
+ int version)
{
- Eet_Data_Descriptor *edd;
+ Eet_Data_Descriptor * edd;
if (!eddc)
return NULL;
@@ -1751,24 +1769,18 @@ _eet_data_descriptor_new(const Eet_Data_Descriptor_Class *eddc, int version)
}
return edd;
-}
+} /* _eet_data_descriptor_new */
EAPI Eet_Data_Descriptor *
-eet_data_descriptor_new(const char *name,
+eet_data_descriptor_new(const char * name,
int size,
- void *(*func_list_next)(void *l),
- void *(*func_list_append)(void *l, void *d),
- void *(*func_list_data)(void *l),
- void *(*func_list_free)(void *l),
- void (*func_hash_foreach)(void *h, int (*func)(
- void *h,
- const
- char *k,
- void *dt,
- void *
- fdt), void *fdt),
- void *(*func_hash_add)(void *h, const char *k, void *d),
- void (*func_hash_free)(void *h))
+ void *(*func_list_next)(void * l),
+ void *(*func_list_append)(void * l, void * d),
+ void *(*func_list_data)(void * l),
+ void *(*func_list_free)(void * l),
+ void (* func_hash_foreach)(void * h, int (* func)(void * h, const char * k, void * dt, void * fdt), void * fdt),
+ void *(*func_hash_add)(void * h, const char * k, void * d),
+ void (* func_hash_free)(void * h))
{
Eet_Data_Descriptor_Class eddc;
@@ -1790,34 +1802,34 @@ eet_data_descriptor_new(const char *name,
eddc.func.hash_free = func_hash_free;
return _eet_data_descriptor_new(&eddc, 0);
-}
+} /* eet_data_descriptor_new */
EAPI Eet_Data_Descriptor *
-eet_data_descriptor2_new(const Eet_Data_Descriptor_Class *eddc)
+eet_data_descriptor2_new(const Eet_Data_Descriptor_Class * eddc)
{
return _eet_data_descriptor_new(eddc, 1);
-}
+} /* eet_data_descriptor2_new */
EAPI Eet_Data_Descriptor *
-eet_data_descriptor3_new(const Eet_Data_Descriptor_Class *eddc)
+eet_data_descriptor3_new(const Eet_Data_Descriptor_Class * eddc)
{
return _eet_data_descriptor_new(eddc, 2);
-}
+} /* eet_data_descriptor3_new */
EAPI Eet_Data_Descriptor *
-eet_data_descriptor_stream_new(const Eet_Data_Descriptor_Class *eddc)
+eet_data_descriptor_stream_new(const Eet_Data_Descriptor_Class * eddc)
{
return _eet_data_descriptor_new(eddc, 1);
-}
+} /* eet_data_descriptor_stream_new */
EAPI Eet_Data_Descriptor *
-eet_data_descriptor_file_new(const Eet_Data_Descriptor_Class *eddc)
+eet_data_descriptor_file_new(const Eet_Data_Descriptor_Class * eddc)
{
return _eet_data_descriptor_new(eddc, 2);
-}
+} /* eet_data_descriptor_file_new */
EAPI void
-eet_data_descriptor_free(Eet_Data_Descriptor *edd)
+eet_data_descriptor_free(Eet_Data_Descriptor * edd)
{
if (!edd)
return;
@@ -1826,22 +1838,22 @@ eet_data_descriptor_free(Eet_Data_Descriptor *edd)
if (edd->elements.set)
free(edd->elements.set);
- free(edd);
-}
+ free(edd);
+} /* eet_data_descriptor_free */
EAPI void
-eet_data_descriptor_element_add(Eet_Data_Descriptor *edd,
- const char *name,
- int type,
- int group_type,
- int offset,
- int count,
+eet_data_descriptor_element_add(Eet_Data_Descriptor * edd,
+ const char * name,
+ int type,
+ int group_type,
+ int offset,
+ int count,
/* int counter_offset, */
- const char *counter_name /* FIXME: Useless should go on a major release */,
- Eet_Data_Descriptor *subtype)
+ const char * counter_name /* FIXME: Useless should go on a major release */,
+ Eet_Data_Descriptor * subtype)
{
- Eet_Data_Element *ede;
- Eet_Data_Element *tmp;
+ Eet_Data_Element * ede;
+ Eet_Data_Element * tmp;
/* UNION, VARIANT type would not work with simple type, we need a way to map the type. */
if ((group_type == EET_G_UNION
@@ -1889,11 +1901,11 @@ eet_data_descriptor_element_add(Eet_Data_Descriptor *edd,
* Instead of handling it in encode/decode/dump/undump, we create an
* implicit structure with only the simple type.
*/
- if (group_type > EET_G_UNKNOWN
- && group_type < EET_G_LAST
- && ((type > EET_T_UNKNOW && type < EET_T_STRING)
- || (type > EET_T_NULL && type < EET_T_LAST))
- && subtype == NULL)
+ if ((group_type > EET_G_UNKNOWN)
+ && (group_type < EET_G_LAST)
+ && (((type > EET_T_UNKNOW) && (type < EET_T_STRING))
+ || ((type > EET_T_NULL) && (type < EET_T_LAST)))
+ && (subtype == NULL))
{
subtype = calloc(1, sizeof (Eet_Data_Descriptor));
if (!subtype)
@@ -1924,17 +1936,17 @@ eet_data_descriptor_element_add(Eet_Data_Descriptor *edd,
ede->counter_name = counter_name;
ede->subtype = subtype;
-}
+} /* eet_data_descriptor_element_add */
EAPI void *
-eet_data_read_cipher(Eet_File *ef,
- Eet_Data_Descriptor *edd,
- const char *name,
- const char *cipher_key)
+eet_data_read_cipher(Eet_File * ef,
+ Eet_Data_Descriptor * edd,
+ const char * name,
+ const char * cipher_key)
{
- const Eet_Dictionary *ed = NULL;
- const void *data = NULL;
- void *data_dec;
+ const Eet_Dictionary * ed = NULL;
+ const void * data = NULL;
+ void * data_dec;
Eet_Free_Context context;
int required_free = 0;
int size;
@@ -1958,16 +1970,16 @@ eet_data_read_cipher(Eet_File *ef,
free((void *)data);
return data_dec;
-}
+} /* eet_data_read_cipher */
EAPI Eet_Node *
-eet_data_node_read_cipher(Eet_File *ef,
- const char *name,
- const char *cipher_key)
+eet_data_node_read_cipher(Eet_File * ef,
+ const char * name,
+ const char * cipher_key)
{
- const Eet_Dictionary *ed = NULL;
- const void *data = NULL;
- Eet_Node *result;
+ const Eet_Dictionary * ed = NULL;
+ const void * data = NULL;
+ Eet_Node * result;
Eet_Free_Context context;
int required_free = 0;
int size;
@@ -1988,27 +2000,29 @@ eet_data_node_read_cipher(Eet_File *ef,
memset(&context, 0, sizeof (context));
result = _eet_data_descriptor_decode(&context, ed, NULL, data, size);
if (required_free)
- free((void *)data);
+ free((void *)data);
return result;
-}
+} /* eet_data_node_read_cipher */
EAPI void *
-eet_data_read(Eet_File *ef, Eet_Data_Descriptor *edd, const char *name)
+eet_data_read(Eet_File * ef,
+ Eet_Data_Descriptor * edd,
+ const char * name)
{
return eet_data_read_cipher(ef, edd, name, NULL);
-}
+} /* eet_data_read */
EAPI int
-eet_data_write_cipher(Eet_File *ef,
- Eet_Data_Descriptor *edd,
- const char *name,
- const char *cipher_key,
- const void *data,
- int compress)
+eet_data_write_cipher(Eet_File * ef,
+ Eet_Data_Descriptor * edd,
+ const char * name,
+ const char * cipher_key,
+ const void * data,
+ int compress)
{
- Eet_Dictionary *ed;
- void *data_enc;
+ Eet_Dictionary * ed;
+ void * data_enc;
int size;
int val;
@@ -2019,28 +2033,28 @@ eet_data_write_cipher(Eet_File *ef,
return 0;
val = eet_write_cipher(ef, name, data_enc, size, compress, cipher_key);
- free(data_enc);
+ free(data_enc);
return val;
-}
+} /* eet_data_write_cipher */
EAPI int
-eet_data_write(Eet_File *ef,
- Eet_Data_Descriptor *edd,
- const char *name,
- const void *data,
- int compress)
+eet_data_write(Eet_File * ef,
+ Eet_Data_Descriptor * edd,
+ const char * name,
+ const void * data,
+ int compress)
{
return eet_data_write_cipher(ef, edd, name, NULL, data, compress);
-}
+} /* eet_data_write */
static int
-_eet_free_hash(void *data)
+_eet_free_hash(void * data)
{
#ifdef _WIN64
__int64 ptr = (UINT_PTR)data;
-#else
+#else /* ifdef _WIN64 */
unsigned long ptr = (unsigned long)(data);
-#endif
+#endif /* ifdef _WIN64 */
int hash;
hash = ptr;
@@ -2053,13 +2067,14 @@ _eet_free_hash(void *data)
hash ^= ptr >> 40;
hash ^= ptr >> 48;
hash ^= ptr >> 56;
-#endif
+#endif /* if defined (_WIN64) || ((!defined (_WIN32)) && (LONG_BIT != 32)) */
return hash & 0xFF;
-}
+} /* _eet_free_hash */
static void
-_eet_free_add(Eet_Free *ef, void *data)
+_eet_free_add(Eet_Free * ef,
+ void * data)
{
int hash;
int i;
@@ -2073,7 +2088,7 @@ _eet_free_add(Eet_Free *ef, void *data)
ef->num[hash]++;
if (ef->num[hash] > ef->len[hash])
{
- void **tmp;
+ void ** tmp;
tmp = realloc(ef->list[hash], (ef->len[hash] + 16) * sizeof(void *));
if (!tmp)
@@ -2084,9 +2099,10 @@ _eet_free_add(Eet_Free *ef, void *data)
}
ef->list[hash][ef->num[hash] - 1] = data;
-}
+} /* _eet_free_add */
+
static void
-_eet_free_reset(Eet_Free *ef)
+_eet_free_reset(Eet_Free * ef)
{
int i;
@@ -2098,29 +2114,32 @@ _eet_free_reset(Eet_Free *ef)
ef->len[i] = 0;
ef->num[i] = 0;
if (ef->list[i])
- free(ef->list[i]);
+ free(ef->list[i]);
ef->list[i] = NULL;
}
-}
+} /* _eet_free_reset */
+
static void
-_eet_free_ref(Eet_Free *ef)
+_eet_free_ref(Eet_Free * ef)
{
ef->ref++;
-}
+} /* _eet_free_ref */
+
static void
-_eet_free_unref(Eet_Free *ef)
+_eet_free_unref(Eet_Free * ef)
{
ef->ref--;
-}
+} /* _eet_free_unref */
-#define _eet_freelist_add(Ctx, Data) _eet_free_add(&Ctx->freelist, Data);
-#define _eet_freelist_reset(Ctx) _eet_free_reset(&Ctx->freelist);
-#define _eet_freelist_ref(Ctx) _eet_free_ref(&Ctx->freelist);
-#define _eet_freelist_unref(Ctx) _eet_free_unref(&Ctx->freelist);
+#define _eet_freelist_add(Ctx, Data) _eet_free_add(&Ctx->freelist, Data);
+#define _eet_freelist_reset(Ctx) _eet_free_reset(&Ctx->freelist);
+#define _eet_freelist_ref(Ctx) _eet_free_ref(&Ctx->freelist);
+#define _eet_freelist_unref(Ctx) _eet_free_unref(&Ctx->freelist);
static void
-_eet_freelist_free(Eet_Free_Context *context, Eet_Data_Descriptor *edd)
+_eet_freelist_free(Eet_Free_Context * context,
+ Eet_Data_Descriptor * edd)
{
int j;
int i;
@@ -2136,17 +2155,17 @@ _eet_freelist_free(Eet_Free_Context *context, Eet_Data_Descriptor *edd)
else
free(context->freelist.list[j][i]);
}
- _eet_free_reset(&context->freelist);
-}
+ _eet_free_reset(&context->freelist);
+} /* _eet_freelist_free */
-#define _eet_freelist_list_add(Ctx, Data) _eet_free_add(&Ctx->freelist_list, \
- Data);
-#define _eet_freelist_list_reset(Ctx) _eet_free_reset(&Ctx->freelist_list);
-#define _eet_freelist_list_ref(Ctx) _eet_free_ref(&Ctx->freelist_list);
-#define _eet_freelist_list_unref(Ctx) _eet_free_unref(&Ctx->freelist_list);
+#define _eet_freelist_list_add(Ctx, Data) _eet_free_add(&Ctx->freelist_list, Data);
+#define _eet_freelist_list_reset(Ctx) _eet_free_reset(&Ctx->freelist_list);
+#define _eet_freelist_list_ref(Ctx) _eet_free_ref(&Ctx->freelist_list);
+#define _eet_freelist_list_unref(Ctx) _eet_free_unref(&Ctx->freelist_list);
static void
-_eet_freelist_list_free(Eet_Free_Context *context, Eet_Data_Descriptor *edd)
+_eet_freelist_list_free(Eet_Free_Context * context,
+ Eet_Data_Descriptor * edd)
{
int j;
int i;
@@ -2160,17 +2179,16 @@ _eet_freelist_list_free(Eet_Free_Context *context, Eet_Data_Descriptor *edd)
if (edd)
edd->func.list_free(*((void **)(context->freelist_list.list[j][i])));
}
- _eet_free_reset(&context->freelist_list);
-}
+ _eet_free_reset(&context->freelist_list);
+} /* _eet_freelist_list_free */
-#define _eet_freelist_str_add(Ctx, Data) _eet_free_add(&Ctx->freelist_str, \
- Data);
-#define _eet_freelist_str_reset(Ctx) _eet_free_reset(&Ctx->freelist_str);
-#define _eet_freelist_str_ref(Ctx) _eet_free_ref(&Ctx->freelist_str);
-#define _eet_freelist_str_unref(Ctx) _eet_free_unref(&Ctx->freelist_str);
+#define _eet_freelist_str_add(Ctx, Data) _eet_free_add(&Ctx->freelist_str, Data);
+#define _eet_freelist_str_reset(Ctx) _eet_free_reset(&Ctx->freelist_str);
+#define _eet_freelist_str_ref(Ctx) _eet_free_ref(&Ctx->freelist_str);
+#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)
{
int j;
int i;
@@ -2187,21 +2205,16 @@ _eet_freelist_str_free(Eet_Free_Context *context, Eet_Data_Descriptor *edd)
free(context->freelist_str.list[j][i]);
}
_eet_free_reset(&context->freelist_str);
-}
-
-#define _eet_freelist_direct_str_add(Ctx, Data) _eet_free_add( \
- &Ctx->freelist_direct_str, \
- Data);
-#define _eet_freelist_direct_str_reset(Ctx) _eet_free_reset( \
- &Ctx->freelist_direct_str);
-#define _eet_freelist_direct_str_ref(Ctx) _eet_free_ref( \
- &Ctx->freelist_direct_str);
-#define _eet_freelist_direct_str_unref(Ctx) _eet_free_unref( \
- &Ctx->freelist_direct_str);
+} /* _eet_freelist_str_free */
+
+#define _eet_freelist_direct_str_add(Ctx, Data) _eet_free_add(&Ctx->freelist_direct_str, Data);
+#define _eet_freelist_direct_str_reset(Ctx) _eet_free_reset(&Ctx->freelist_direct_str);
+#define _eet_freelist_direct_str_ref(Ctx) _eet_free_ref(&Ctx->freelist_direct_str);
+#define _eet_freelist_direct_str_unref(Ctx) _eet_free_unref(&Ctx->freelist_direct_str);
static void
-_eet_freelist_direct_str_free(Eet_Free_Context *context,
- Eet_Data_Descriptor *edd)
+_eet_freelist_direct_str_free(Eet_Free_Context * context,
+ Eet_Data_Descriptor * edd)
{
int j;
int i;
@@ -2218,16 +2231,16 @@ _eet_freelist_direct_str_free(Eet_Free_Context *context,
free(context->freelist_direct_str.list[j][i]);
}
_eet_free_reset(&context->freelist_direct_str);
-}
+} /* _eet_freelist_direct_str_free */
-#define _eet_freelist_hash_add(Ctx, Data) _eet_free_add(&Ctx->freelist_hash, \
- Data);
+#define _eet_freelist_hash_add(Ctx, Data) _eet_free_add(&Ctx->freelist_hash, Data);
#define _eet_freelist_hash_reset(Ctx) _eet_free_reset(&Ctx->freelist_hash);
#define _eet_freelist_hash_ref(Ctx) _eet_free_ref(&Ctx->freelist_hash);
#define _eet_freelist_hash_unref(Ctx) _eet_free_unref(&Ctx->freelist_hash);
static void
-_eet_freelist_hash_free(Eet_Free_Context *context, Eet_Data_Descriptor *edd)
+_eet_freelist_hash_free(Eet_Free_Context * context,
+ Eet_Data_Descriptor * edd)
{
int j;
int i;
@@ -2244,40 +2257,40 @@ _eet_freelist_hash_free(Eet_Free_Context *context, Eet_Data_Descriptor *edd)
free(context->freelist_hash.list[j][i]);
}
_eet_free_reset(&context->freelist_hash);
-}
+} /* _eet_freelist_hash_free */
static void
-_eet_freelist_all_ref(Eet_Free_Context *freelist_context)
+_eet_freelist_all_ref(Eet_Free_Context * freelist_context)
{
_eet_freelist_ref(freelist_context);
_eet_freelist_str_ref(freelist_context);
_eet_freelist_list_ref(freelist_context);
_eet_freelist_hash_ref(freelist_context);
_eet_freelist_direct_str_ref(freelist_context);
-}
+} /* _eet_freelist_all_ref */
static void
-_eet_freelist_all_unref(Eet_Free_Context *freelist_context)
+_eet_freelist_all_unref(Eet_Free_Context * freelist_context)
{
_eet_freelist_unref(freelist_context);
_eet_freelist_str_unref(freelist_context);
_eet_freelist_list_unref(freelist_context);
_eet_freelist_hash_unref(freelist_context);
_eet_freelist_direct_str_unref(freelist_context);
-}
+} /* _eet_freelist_all_unref */
static int
-eet_data_descriptor_encode_hash_cb(void *hash __UNUSED__,
- const char *cipher_key,
- void *hdata,
- void *fdata)
+eet_data_descriptor_encode_hash_cb(void * hash __UNUSED__,
+ const char * cipher_key,
+ void * hdata,
+ void * fdata)
{
- Eet_Dictionary *ed;
- Eet_Data_Encode_Hash_Info *edehi;
- Eet_Data_Stream *ds;
- Eet_Data_Element *ede;
- Eet_Data_Chunk *echnk;
- void *data = NULL;
+ Eet_Dictionary * ed;
+ Eet_Data_Encode_Hash_Info * edehi;
+ Eet_Data_Stream * ds;
+ Eet_Data_Element * ede;
+ Eet_Data_Chunk * echnk;
+ void * data = NULL;
int size;
edehi = fdata;
@@ -2303,8 +2316,7 @@ eet_data_descriptor_encode_hash_cb(void *hash __UNUSED__,
data = NULL;
}
- EET_ASSERT(!((ede->type > EET_T_UNKNOW) && (ede->type < EET_T_STRING)),
- return );
+ EET_ASSERT(!((ede->type > EET_T_UNKNOW) && (ede->type < EET_T_STRING)), return );
/* Store data */
if (ede->type >= EET_T_STRING)
@@ -2332,26 +2344,27 @@ eet_data_descriptor_encode_hash_cb(void *hash __UNUSED__,
}
return 1;
-}
+} /* eet_data_descriptor_encode_hash_cb */
static char *
-_eet_data_dump_token_get(const char *src, int *len)
+_eet_data_dump_token_get(const char * src,
+ int * len)
{
- const char *p;
- char *tok = NULL;
+ const char * p;
+ char * tok = NULL;
int in_token = 0;
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; \
+#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)--)
@@ -2376,9 +2389,9 @@ _eet_data_dump_token_get(const char *src, int *len)
/* 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
{
@@ -2393,7 +2406,7 @@ _eet_data_dump_token_get(const char *src, int *len)
return tok;
}
else
- TOK_ADD(p[0]);
+ TOK_ADD(p[0]);
}
}
}
@@ -2406,7 +2419,7 @@ _eet_data_dump_token_get(const char *src, int *len)
}
if (in_token)
{
- TOK_ADD(0);
+ TOK_ADD(0);
return tok;
}
@@ -2414,18 +2427,18 @@ _eet_data_dump_token_get(const char *src, int *len)
free(tok);
return NULL;
-}
+} /* _eet_data_dump_token_get */
static void
-eet_data_encode(Eet_Dictionary *ed,
- Eet_Data_Stream *ds,
- void *data,
- const char *name,
- int size,
- int type,
- int group_type)
+eet_data_encode(Eet_Dictionary * ed,
+ Eet_Data_Stream * ds,
+ void * data,
+ const char * name,
+ int size,
+ int type,
+ int group_type)
{
- Eet_Data_Chunk *echnk;
+ Eet_Data_Chunk * echnk;
if (!data)
type = EET_T_NULL;
@@ -2438,21 +2451,21 @@ eet_data_encode(Eet_Dictionary *ed,
eet_data_chunk_put(ed, echnk, ds);
eet_data_chunk_free(echnk);
free(data);
-}
+} /* eet_data_encode */
static void *
-_eet_data_dump_encode(int parent_type,
- Eet_Dictionary *ed,
- Eet_Node *node,
- int *size_ret)
+_eet_data_dump_encode(int parent_type,
+ Eet_Dictionary * ed,
+ Eet_Node * node,
+ int * size_ret)
{
- Eet_Data_Chunk *chnk = NULL;
- Eet_Data_Stream *ds;
- void *cdata, *data;
+ Eet_Data_Chunk * chnk = NULL;
+ Eet_Data_Stream * ds;
+ void * cdata, * data;
int csize, size;
int count;
int child_type;
- Eet_Node *n;
+ Eet_Node * n;
if (_eet_data_words_bigendian == -1)
{
@@ -2501,7 +2514,7 @@ _eet_data_dump_encode(int parent_type,
EET_T_INT,
&node->count,
&size);
- eet_data_encode(ed,
+ eet_data_encode(ed,
ds,
data,
node->name,
@@ -2539,7 +2552,7 @@ _eet_data_dump_encode(int parent_type,
default:
data = _eet_data_dump_encode(n->type, ed, n, &size);
- eet_data_encode(ed,
+ eet_data_encode(ed,
ds,
data,
node->name,
@@ -2547,14 +2560,14 @@ _eet_data_dump_encode(int parent_type,
n->type,
node->type);
break;
- }
+ } /* switch */
if (ds->pos != pos)
count--;
}
for (; count; count--)
{
- eet_data_encode(ed,
+ eet_data_encode(ed,
ds,
NULL,
node->name,
@@ -2601,14 +2614,14 @@ _eet_data_dump_encode(int parent_type,
default:
data = _eet_data_dump_encode(node->type, ed, n, &size);
- eet_data_encode(ed,
+ eet_data_encode(ed,
ds,
data,
node->name,
size,
n->type,
node->type);
- }
+ } /* switch */
}
/* List is another somekind of special case, every chunk is embed inside a list chunk. */
@@ -2629,7 +2642,7 @@ _eet_data_dump_encode(int parent_type,
EET_T_STRING,
&node->key,
&size);
- eet_data_encode(ed,
+ eet_data_encode(ed,
ds,
data,
node->name,
@@ -2667,14 +2680,14 @@ _eet_data_dump_encode(int parent_type,
default:
data = _eet_data_dump_encode(node->type, ed, n, &size);
- eet_data_encode(ed,
+ 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. */
@@ -2688,23 +2701,23 @@ _eet_data_dump_encode(int parent_type,
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; \
- } \
+#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);
@@ -2751,41 +2764,41 @@ _eet_data_dump_encode(int parent_type,
eet_data_chunk_free(chnk);
return cdata;
-}
+} /* _eet_data_dump_encode */
static void *
-_eet_data_dump_parse(Eet_Dictionary *ed,
- int *size_ret,
- const char *src,
- int size)
+_eet_data_dump_parse(Eet_Dictionary * ed,
+ int * size_ret,
+ const char * src,
+ int size)
{
- void *cdata = NULL;
- const char *p = NULL;
-#define M_NONE 0
+ void * cdata = NULL;
+ const char * p = NULL;
+#define M_NONE 0
#define M_STRUCT 1
-#define M_ 2
+#define M_ 2
int left, jump;
- Eet_Node *node_base = NULL;
- Eet_Node *node = NULL;
- Eet_Node *n = NULL, *nn = NULL;
+ Eet_Node * node_base = NULL;
+ Eet_Node * node = NULL;
+ Eet_Node * n = NULL, * nn = NULL;
/* FIXME; handle parse errors */
-#define TOK_GET(t) \
+#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); )
{
- char *tok1, *tok2, *tok3, *tok4;
+ char * tok1, * tok2, * tok3, * tok4;
- TOK_GET(tok1);
+ TOK_GET(tok1);
if (tok1)
{
if (!strcmp(tok1, "group"))
{
- TOK_GET(tok2);
+ TOK_GET(tok2);
if (tok2)
{
- TOK_GET(tok3);
+ TOK_GET(tok3);
if (tok3)
{
TOK_GET(tok4);
@@ -2841,18 +2854,18 @@ _eet_data_dump_parse(Eet_Dictionary *ed,
free(tok4);
}
- free(tok3);
+ free(tok3);
}
- free(tok2);
+ free(tok2);
}
}
else if (!strcmp(tok1, "value"))
{
- TOK_GET(tok2);
+ TOK_GET(tok2);
if (tok2)
{
- TOK_GET(tok3);
+ TOK_GET(tok3);
if (tok3)
{
TOK_GET(tok4);
@@ -2967,10 +2980,10 @@ _eet_data_dump_parse(Eet_Dictionary *ed,
free(tok4);
}
- free(tok3);
+ free(tok3);
}
- free(tok2);
+ free(tok2);
}
}
else if (!strcmp(tok1, "key"))
@@ -3002,7 +3015,7 @@ _eet_data_dump_parse(Eet_Dictionary *ed,
if (node)
node = node->parent;
- free(tok1);
+ free(tok1);
}
}
@@ -3013,26 +3026,26 @@ _eet_data_dump_parse(Eet_Dictionary *ed,
}
return cdata;
-}
-
-#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); \
+} /* _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);\
}
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)
+_eet_data_descriptor_decode(Eet_Free_Context * context,
+ const Eet_Dictionary * ed,
+ Eet_Data_Descriptor * edd,
+ const void * data_in,
+ int size_in)
{
- Eet_Node *result = NULL;
- void *data = NULL;
- char *p;
+ Eet_Node * result = NULL;
+ void * data = NULL;
+ char * p;
int size, i;
Eet_Data_Chunk chnk;
@@ -3103,7 +3116,7 @@ _eet_data_descriptor_decode(Eet_Free_Context *context,
default:
result = eet_node_struct_new(chnk.name, NULL);
- }
+ } /* switch */
break;
case EET_G_VAR_ARRAY:
@@ -3116,14 +3129,14 @@ _eet_data_descriptor_decode(Eet_Free_Context *context,
case EET_G_VARIANT:
default:
goto error;
- }
+ } /* switch */
}
while (size > 0)
{
Eet_Data_Chunk echnk;
- Eet_Data_Element *ede = NULL;
- Eet_Node *child = NULL;
+ Eet_Data_Element * ede = NULL;
+ Eet_Node * child = NULL;
int group_type = EET_G_UNKNOWN, type = EET_T_UNKNOW;
int ret = 0;
@@ -3152,10 +3165,8 @@ _eet_data_descriptor_decode(Eet_Free_Context *context,
/* Needed when converting on the fly from FP to Float */
type = ede->type;
else if ((echnk.group_type > EET_G_UNKNOWN) &&
- (echnk.group_type <
- EET_G_LAST) &&
- (echnk.group_type ==
- ede->group_type))
+ (echnk.group_type < EET_G_LAST) &&
+ (echnk.group_type == ede->group_type))
group_type = echnk.group_type;
}
}
@@ -3245,24 +3256,24 @@ error:
/* FIXME: Warn that something goes wrong here. */
return NULL;
-}
+} /* _eet_data_descriptor_decode */
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 __UNUSED__,
- void *data,
- char **p,
- int *size)
+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 __UNUSED__,
+ void * data,
+ char ** p,
+ int * size)
{
- Eet_Data_Descriptor *subtype = NULL;
- void *list = NULL;
- void **ptr;
- void *data_ret;
+ Eet_Data_Descriptor * subtype = NULL;
+ void * list = NULL;
+ void ** ptr;
+ void * data_ret;
EET_ASSERT(!((type > EET_T_UNKNOW) && (type < EET_T_STRING)), return 0);
@@ -3311,24 +3322,24 @@ eet_data_get_list(Eet_Free_Context *context,
on_error:
return 0;
-}
+} /* eet_data_get_list */
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 __UNUSED__,
- void *data,
- char **p,
- int *size)
+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 __UNUSED__,
+ void * data,
+ char ** p,
+ int * size)
{
- void **ptr;
- void *hash = NULL;
- char *key = NULL;
- void *data_ret = NULL;
+ void ** ptr;
+ void * hash = NULL;
+ char * key = NULL;
+ void * data_ret = NULL;
int ret = 0;
EET_ASSERT(!((type > EET_T_UNKNOW) && (type < EET_T_STRING)), return 0);
@@ -3387,7 +3398,7 @@ eet_data_get_hash(Eet_Free_Context *context,
on_error:
return ret;
-}
+} /* eet_data_get_hash */
/* var arrays and fixed arrays have to
* get all chunks at once. for fixed arrays
@@ -3400,21 +3411,21 @@ on_error:
* each chunk is pointless.
*/
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)
+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)
{
- Eina_List *childs = NULL;
- const char *name;
- Eet_Node *tmp;
- void *ptr;
+ Eina_List * childs = NULL;
+ const char * name;
+ Eet_Node * tmp;
+ void * ptr;
int count;
int ret;
int subsize = 0;
@@ -3461,8 +3472,8 @@ eet_data_get_array(Eet_Free_Context *context,
/* get all array elements */
for (i = 0; i < count; i++)
{
- void *dst = NULL;
- void *data_ret = NULL;
+ void * dst = NULL;
+ void * data_ret = NULL;
/* Advance to next chunk */
NEXT_CHUNK((*p), (*size), (*echnk), ed);
@@ -3472,13 +3483,13 @@ eet_data_get_array(Eet_Free_Context *context,
if (!echnk->name || strcmp(echnk->name, name) != 0)
goto on_error; /* get the data */
- if (echnk->group_type != group_type
- || (echnk->type != type && echnk->type != EET_T_NULL))
+ if ((echnk->group_type != group_type)
+ || ((echnk->type != type) && (echnk->type != EET_T_NULL)))
goto on_error;
if (ede)
- if (ede->group_type != echnk->group_type
- || (echnk->type != ede->type && echnk->type != EET_T_NULL))
+ if ((ede->group_type != echnk->group_type)
+ || ((echnk->type != ede->type) && (echnk->type != EET_T_NULL)))
goto on_error;
/* get the destination pointer */
@@ -3530,8 +3541,8 @@ eet_data_get_array(Eet_Free_Context *context,
if (!edd)
{
- Eet_Node *parent = *((Eet_Node **)data);
- Eet_Node *array;
+ Eet_Node * parent = *((Eet_Node **)data);
+ Eet_Node * array;
if (group_type == EET_G_ARRAY)
array = eet_node_array_new(name, count, childs);
@@ -3551,14 +3562,16 @@ on_error:
eet_node_del(tmp);
return 0;
-}
+} /* eet_data_get_array */
static void
-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_put_union(Eet_Dictionary * ed,
+ Eet_Data_Descriptor * edd __UNUSED__,
+ Eet_Data_Element * ede,
+ Eet_Data_Stream * ds,
+ void * data_in)
{
- const char *union_type;
+ const char * union_type;
int i;
EET_ASSERT(!((ede->type != EET_T_UNKNOW) || (!ede->subtype)), return );
@@ -3574,8 +3587,8 @@ eet_data_put_union(Eet_Dictionary *ed,
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;
+ Eet_Data_Element * sede;
+ void * data;
int size;
/* Yeah we found it ! */
@@ -3606,17 +3619,22 @@ eet_data_put_union(Eet_Dictionary *ed,
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;
+ const char * union_type;
+ void * data_ret = NULL;
int ret = 0;
int i;
@@ -3640,15 +3658,15 @@ eet_data_get_union(Eet_Free_Context *context, const Eet_Dictionary *ed,
if (ede)
{
- EET_ASSERT(!(ede->group_type != group_type || ede->type != type),
+ EET_ASSERT(!(ede->group_type != group_type || ede->type != type),
goto on_error);
/* 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;
+ Eet_Data_Element * sede;
+ char * ut;
/* Yeah we found it ! */
sede = &(ede->subtype->elements.set[i]);
@@ -3703,15 +3721,17 @@ eet_data_get_union(Eet_Free_Context *context, const Eet_Dictionary *ed,
on_error:
return 0;
-}
+} /* eet_data_get_union */
static void
-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_put_variant(Eet_Dictionary * ed,
+ Eet_Data_Descriptor * edd __UNUSED__,
+ Eet_Data_Element * ede,
+ Eet_Data_Stream * ds,
+ void * data_in)
{
- const char *union_type;
- void *data;
+ const char * union_type;
+ void * data;
Eina_Bool unknow = EINA_FALSE;
int size;
int i;
@@ -3728,11 +3748,11 @@ eet_data_put_variant(Eet_Dictionary *ed,
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)
- eet_data_encode(ed,
+ eet_data_encode(ed,
ds,
data,
ede->name,
@@ -3742,7 +3762,7 @@ eet_data_put_variant(Eet_Dictionary *ed,
evu = (Eet_Variant_Unknow *)data_in;
if (evu && EINA_MAGIC_CHECK(evu, EET_MAGIC_VARIANT))
- eet_data_encode(ed,
+ eet_data_encode(ed,
ds,
evu->data,
ede->name,
@@ -3755,12 +3775,12 @@ eet_data_put_variant(Eet_Dictionary *ed,
for (i = 0; i < ede->subtype->elements.num; ++i)
if (strcmp(ede->subtype->elements.set[i].name, union_type) == 0)
{
- Eet_Data_Element *sede;
+ 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,
+ eet_data_encode(ed,
ds,
data,
ede->name,
@@ -3772,7 +3792,7 @@ eet_data_put_variant(Eet_Dictionary *ed,
if (sede->group_type != EET_G_UNKNOWN)
{
- Eet_Data_Stream *lds;
+ Eet_Data_Stream * lds;
lds = eet_data_stream_new();
eet_group_codec[sede->group_type - 100].put(ed,
@@ -3789,10 +3809,10 @@ eet_data_put_variant(Eet_Dictionary *ed,
lds->size = 0;
}
else
- eet_data_encode(ed, ds, NULL, ede->name, 0,
+ eet_data_encode(ed, ds, NULL, ede->name, 0,
EET_T_NULL, ede->group_type);
- eet_data_stream_free(lds);
+ eet_data_stream_free(lds);
}
else
{
@@ -3813,17 +3833,22 @@ eet_data_put_variant(Eet_Dictionary *ed,
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;
+ const char * union_type;
+ void * data_ret = NULL;
int ret = 0;
int i;
@@ -3847,7 +3872,7 @@ eet_data_get_variant(Eet_Free_Context *context, const Eet_Dictionary *ed,
if (ede)
{
- char *ut;
+ char * ut;
EET_ASSERT(ede->subtype, goto on_error);
@@ -3866,7 +3891,7 @@ eet_data_get_variant(Eet_Free_Context *context, const Eet_Dictionary *ed,
for (i = 0; i < ede->subtype->elements.num; ++i)
if (strcmp(ede->subtype->elements.set[i].name, union_type) == 0)
{
- Eet_Data_Element *sede;
+ Eet_Data_Element * sede;
/* Yeah we found it ! */
sede = &(ede->subtype->elements.set[i]);
@@ -3874,7 +3899,7 @@ eet_data_get_variant(Eet_Free_Context *context, const Eet_Dictionary *ed,
if (sede->group_type != EET_G_UNKNOWN)
{
Eet_Data_Chunk chnk;
- char *p2;
+ char * p2;
int size2;
int ret;
@@ -3891,18 +3916,9 @@ eet_data_get_variant(Eet_Free_Context *context, const Eet_Dictionary *ed,
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;
@@ -3915,10 +3931,8 @@ eet_data_get_variant(Eet_Free_Context *context, const Eet_Dictionary *ed,
data_ret = (void *)data;
/* Set variant type. */
- ede->subtype->func.type_set(
- ut,
- ((char *)data) + ede->count -
- ede->offset,
+ ede->subtype->func.type_set
+ (ut, ((char *)data) + ede->count - ede->offset,
EINA_FALSE);
break;
}
@@ -3935,17 +3949,14 @@ eet_data_get_variant(Eet_Free_Context *context, const Eet_Dictionary *ed,
*(void **)data = data_ret;
/* Set variant type. */
- ede->subtype->func.type_set(
- ut,
- ((char *)data) + ede->count -
- ede->offset,
- EINA_FALSE);
+ ede->subtype->func.type_set
+ (ut, ((char *)data) + ede->count - ede->offset, EINA_FALSE);
break;
}
if (!data_ret)
{
- Eet_Variant_Unknow *evu;
+ Eet_Variant_Unknow * evu;
evu = calloc(1, sizeof (Eet_Variant_Unknow) + echnk->size - 1);
if (!evu)
@@ -3959,11 +3970,8 @@ eet_data_get_variant(Eet_Free_Context *context, const Eet_Dictionary *ed,
*(void **)data = evu;
/* Set variant type. */
- ede->subtype->func.type_set(
- ut,
- ((char *)data) + ede->count -
- ede->offset,
- EINA_TRUE);
+ ede->subtype->func.type_set
+ (ut, ((char *)data) + ede->count - ede->offset, EINA_TRUE);
}
}
else
@@ -3979,18 +3987,18 @@ eet_data_get_variant(Eet_Free_Context *context, const Eet_Dictionary *ed,
on_error:
return 0;
-}
+} /* 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
+#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)
{
@@ -4013,23 +4021,23 @@ eet_data_node_simple_type(int type, const char *name, void *dd)
default:
ERR("Unknow type passed to eet_data_node_simple_type");
return NULL;
- }
-}
+ } /* switch */
+} /* eet_data_node_simple_type */
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 __UNUSED__,
- void *data,
- char **p __UNUSED__,
- int *size __UNUSED__)
+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 __UNUSED__,
+ void * data,
+ char ** p __UNUSED__,
+ int * size __UNUSED__)
{
int ret;
- void *data_ret;
+ void * data_ret;
if (IS_SIMPLE_TYPE(type))
{
@@ -4045,8 +4053,8 @@ eet_data_get_unknown(Eet_Free_Context *context,
if (!edd)
{
- Eet_Node **parent = data;
- Eet_Node *node;
+ Eet_Node ** parent = data;
+ Eet_Node * node;
node = eet_data_node_simple_type(type, echnk->name, dd);
@@ -4059,7 +4067,7 @@ eet_data_get_unknown(Eet_Free_Context *context,
{
if (type == EET_T_STRING)
{
- char **str;
+ char ** str;
str = (char **)(((char *)data));
if (*str)
@@ -4078,7 +4086,7 @@ eet_data_get_unknown(Eet_Free_Context *context,
}
else if (edd && type == EET_T_INLINED_STRING)
{
- char **str;
+ char ** str;
str = (char **)(((char *)data));
if (*str)
@@ -4091,14 +4099,14 @@ eet_data_get_unknown(Eet_Free_Context *context,
}
else
{
- Eet_Data_Descriptor *subtype;
+ Eet_Data_Descriptor * subtype;
subtype = ede ? ede->subtype : NULL;
if (subtype || !edd)
{
- Eet_Node **parent = data;
- void **ptr;
+ Eet_Node ** parent = data;
+ void ** ptr;
data_ret = _eet_data_descriptor_decode(context,
ed,
@@ -4115,7 +4123,7 @@ eet_data_get_unknown(Eet_Free_Context *context,
}
else
{
- Eet_Node *node = data_ret;
+ Eet_Node * node = data_ret;
if (*parent)
{
@@ -4129,16 +4137,16 @@ eet_data_get_unknown(Eet_Free_Context *context,
}
return 1;
-}
+} /* eet_data_get_unknown */
static void
-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_put_array(Eet_Dictionary * ed,
+ Eet_Data_Descriptor * edd __UNUSED__,
+ Eet_Data_Element * ede,
+ Eet_Data_Stream * ds,
+ void * data_in)
{
- void *data;
+ void * data;
int offset = 0;
int subsize;
int count;
@@ -4167,7 +4175,7 @@ eet_data_put_array(Eet_Dictionary *ed,
for (j = 0; j < count; j++)
{
- void *d;
+ void * d;
int pos = ds->pos;
if (ede->group_type == EET_G_ARRAY)
@@ -4195,7 +4203,7 @@ eet_data_put_array(Eet_Dictionary *ed,
if (pos == ds->pos)
/* Add a NULL element just to have the correct array layout. */
- eet_data_encode(ed,
+ eet_data_encode(ed,
ds,
NULL,
ede->name,
@@ -4205,16 +4213,16 @@ eet_data_put_array(Eet_Dictionary *ed,
offset += subsize;
}
-}
+} /* eet_data_put_array */
static void
-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_put_unknown(Eet_Dictionary * ed,
+ Eet_Data_Descriptor * edd __UNUSED__,
+ Eet_Data_Element * ede,
+ Eet_Data_Stream * ds,
+ void * data_in)
{
- void *data = NULL;
+ void * data = NULL;
int size;
if (IS_SIMPLE_TYPE(ede->type))
@@ -4227,24 +4235,24 @@ eet_data_put_unknown(Eet_Dictionary *ed,
&size);
if (data)
- eet_data_encode(ed,
+ eet_data_encode(ed,
ds,
data,
ede->name,
size,
ede->type,
ede->group_type);
-}
+} /* eet_data_put_unknown */
static void
-eet_data_put_list(Eet_Dictionary *ed,
- Eet_Data_Descriptor *edd,
- Eet_Data_Element *ede,
- Eet_Data_Stream *ds,
- void *data_in)
+eet_data_put_list(Eet_Dictionary * ed,
+ Eet_Data_Descriptor * edd,
+ Eet_Data_Element * ede,
+ Eet_Data_Stream * ds,
+ void * data_in)
{
- void *data;
- void *l;
+ void * data;
+ void * l;
int size;
EET_ASSERT(!(((ede->type > EET_T_UNKNOW) && (ede->type < EET_T_STRING))
@@ -4256,7 +4264,7 @@ eet_data_put_list(Eet_Dictionary *ed,
{
if (IS_POINTER_TYPE(ede->type))
{
- const void *str = edd->func.list_data(l);
+ const void * str = edd->func.list_data(l);
eet_data_put_unknown(ed, NULL, ede, ds, &str);
}
else
@@ -4275,34 +4283,35 @@ eet_data_put_list(Eet_Dictionary *ed,
ede->group_type);
}
}
-}
+} /* eet_data_put_list */
static void
-eet_data_put_hash(Eet_Dictionary *ed,
- Eet_Data_Descriptor *edd,
- Eet_Data_Element *ede,
- Eet_Data_Stream *ds,
- void *data_in)
+eet_data_put_hash(Eet_Dictionary * ed,
+ Eet_Data_Descriptor * edd,
+ Eet_Data_Element * ede,
+ Eet_Data_Stream * ds,
+ void * data_in)
{
Eet_Data_Encode_Hash_Info fdata;
- void *l;
+ void * l;
l = *((void **)(((char *)data_in)));
fdata.ds = ds;
fdata.ede = ede;
fdata.ed = ed;
edd->func.hash_foreach(l, eet_data_descriptor_encode_hash_cb, &fdata);
-}
+} /* eet_data_put_hash */
EAPI int
-eet_data_dump_cipher(Eet_File *ef,
- const char *name, const char *cipher_key,
- void (*dumpfunc)(void *data, const char *str),
- void *dumpdata)
+eet_data_dump_cipher(Eet_File * ef,
+ const char * name,
+ const char * cipher_key,
+ void (* dumpfunc)(void * data, const char * str),
+ void * dumpdata)
{
- const Eet_Dictionary *ed = NULL;
- const void *data = NULL;
- Eet_Node *result;
+ const Eet_Dictionary * ed = NULL;
+ const void * data = NULL;
+ Eet_Node * result;
Eet_Free_Context context;
int required_free = 0;
int size;
@@ -4331,26 +4340,26 @@ eet_data_dump_cipher(Eet_File *ef,
free((void *)data);
return result ? 1 : 0;
-}
+} /* eet_data_dump_cipher */
EAPI int
-eet_data_dump(Eet_File *ef,
- const char *name,
- void (*dumpfunc)(void *data, const char *str),
- void *dumpdata)
+eet_data_dump(Eet_File * ef,
+ const char * name,
+ void (* dumpfunc)(void * data, const char * str),
+ 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,
- void (*dumpfunc)(void *data, const char *str),
- void *dumpdata)
+eet_data_text_dump_cipher(const void * data_in,
+ const char * cipher_key,
+ int size_in,
+ void (* dumpfunc)(void * data, const char * str),
+ void * dumpdata)
{
- void *ret = NULL;
- Eet_Node *result;
+ void * ret = NULL;
+ Eet_Node * result;
Eet_Free_Context context;
unsigned int ret_len = 0;
@@ -4384,29 +4393,29 @@ eet_data_text_dump_cipher(const void *data_in,
free(ret);
return result ? 1 : 0;
-}
+} /* eet_data_text_dump_cipher */
EAPI int
-eet_data_text_dump(const void *data_in,
+eet_data_text_dump(const void * data_in,
int size_in,
- void (*dumpfunc)(void *data, const char *str),
- void *dumpdata)
+ void (* dumpfunc)(void * data, const char * str),
+ void * dumpdata)
{
return eet_data_text_dump_cipher(data_in, NULL, size_in, dumpfunc, dumpdata);
-}
+} /* eet_data_text_dump */
EAPI void *
-eet_data_text_undump_cipher(const char *text,
- const char *cipher_key,
- int textlen,
- int *size_ret)
+eet_data_text_undump_cipher(const char * text,
+ const char * cipher_key,
+ int textlen,
+ int * size_ret)
{
- void *ret = NULL;
+ void * ret = NULL;
ret = _eet_data_dump_parse(NULL, size_ret, text, textlen);
if (ret && cipher_key)
{
- void *ciphered = NULL;
+ void * ciphered = NULL;
unsigned int ciphered_len;
if (eet_cipher(ret, *size_ret, cipher_key,
@@ -4416,36 +4425,36 @@ eet_data_text_undump_cipher(const char *text,
free(ciphered);
size_ret = 0;
- free(ret);
+ free(ret);
return NULL;
}
- free(ret);
+ free(ret);
*size_ret = ciphered_len;
ret = ciphered;
}
return ret;
-}
+} /* eet_data_text_undump_cipher */
EAPI void *
-eet_data_text_undump(const char *text,
- int textlen,
- int *size_ret)
+eet_data_text_undump(const char * text,
+ int textlen,
+ int * size_ret)
{
return eet_data_text_undump_cipher(text, NULL, textlen, size_ret);
-}
+} /* eet_data_text_undump */
EAPI int
-eet_data_undump_cipher(Eet_File *ef,
- const char *name,
- const char *cipher_key,
- const char *text,
- int textlen,
- int compress)
+eet_data_undump_cipher(Eet_File * ef,
+ const char * name,
+ const char * cipher_key,
+ const char * text,
+ int textlen,
+ int compress)
{
- Eet_Dictionary *ed;
- void *data_enc;
+ Eet_Dictionary * ed;
+ void * data_enc;
int size;
int val;
@@ -4456,28 +4465,28 @@ eet_data_undump_cipher(Eet_File *ef,
return 0;
val = eet_write_cipher(ef, name, data_enc, size, compress, cipher_key);
- free(data_enc);
+ free(data_enc);
return val;
-}
+} /* eet_data_undump_cipher */
EAPI int
-eet_data_undump(Eet_File *ef,
- const char *name,
- const char *text,
- int textlen,
- int compress)
+eet_data_undump(Eet_File * ef,
+ const char * name,
+ const char * text,
+ int textlen,
+ int compress)
{
return eet_data_undump_cipher(ef, name, NULL, text, textlen, compress);
-}
+} /* eet_data_undump */
EAPI void *
-eet_data_descriptor_decode_cipher(Eet_Data_Descriptor *edd,
- const void *data_in,
- const char *cipher_key,
- int size_in)
+eet_data_descriptor_decode_cipher(Eet_Data_Descriptor * edd,
+ const void * data_in,
+ const char * cipher_key,
+ int size_in)
{
- void *deciphered = (void *)data_in;
- void *ret;
+ void * deciphered = (void *)data_in;
+ void * ret;
Eet_Free_Context context;
unsigned int deciphered_len = size_in;
@@ -4502,23 +4511,23 @@ eet_data_descriptor_decode_cipher(Eet_Data_Descriptor *edd,
free(deciphered);
return ret;
-}
+} /* eet_data_descriptor_decode_cipher */
EAPI void *
-eet_data_descriptor_decode(Eet_Data_Descriptor *edd,
- const void *data_in,
- int size_in)
+eet_data_descriptor_decode(Eet_Data_Descriptor * edd,
+ const void * data_in,
+ int size_in)
{
return eet_data_descriptor_decode_cipher(edd, data_in, NULL, size_in);
-}
+} /* eet_data_descriptor_decode */
EAPI Eet_Node *
-eet_data_node_decode_cipher(const void *data_in,
- const char *cipher_key,
- int size_in)
+eet_data_node_decode_cipher(const void * data_in,
+ const char * cipher_key,
+ int size_in)
{
- void *deciphered = (void *)data_in;
- Eet_Node *ret;
+ void * deciphered = (void *)data_in;
+ Eet_Node * ret;
Eet_Free_Context context;
unsigned int deciphered_len = size_in;
@@ -4543,17 +4552,17 @@ eet_data_node_decode_cipher(const void *data_in,
free(deciphered);
return ret;
-}
+} /* eet_data_node_decode_cipher */
static void *
-_eet_data_descriptor_encode(Eet_Dictionary *ed,
- Eet_Data_Descriptor *edd,
- const void *data_in,
- int *size_ret)
+_eet_data_descriptor_encode(Eet_Dictionary * ed,
+ Eet_Data_Descriptor * edd,
+ const void * data_in,
+ int * size_ret)
{
- Eet_Data_Stream *ds;
- Eet_Data_Chunk *chnk;
- void *cdata;
+ Eet_Data_Stream * ds;
+ Eet_Data_Chunk * chnk;
+ void * cdata;
int csize;
int i;
@@ -4571,7 +4580,7 @@ _eet_data_descriptor_encode(Eet_Dictionary *ed,
ds = eet_data_stream_new();
for (i = 0; i < edd->elements.num; i++)
{
- Eet_Data_Element *ede;
+ Eet_Data_Element * ede;
ede = &(edd->elements.set[i]);
eet_group_codec[ede->group_type - 100].put(
@@ -4605,17 +4614,17 @@ _eet_data_descriptor_encode(Eet_Dictionary *ed,
eet_data_chunk_free(chnk);
return cdata;
-}
+} /* _eet_data_descriptor_encode */
EAPI int
-eet_data_node_write_cipher(Eet_File *ef,
- const char *name,
- const char *cipher_key,
- Eet_Node *node,
- int compress)
+eet_data_node_write_cipher(Eet_File * ef,
+ const char * name,
+ const char * cipher_key,
+ Eet_Node * node,
+ int compress)
{
- Eet_Dictionary *ed;
- void *data_enc;
+ Eet_Dictionary * ed;
+ void * data_enc;
int size;
int val;
@@ -4628,15 +4637,15 @@ eet_data_node_write_cipher(Eet_File *ef,
val = eet_write_cipher(ef, name, data_enc, size, compress, cipher_key);
free(data_enc);
return val;
-}
+} /* eet_data_node_write_cipher */
EAPI void *
-eet_data_node_encode_cipher(Eet_Node *node,
- const char *cipher_key,
- int *size_ret)
+eet_data_node_encode_cipher(Eet_Node * node,
+ const char * cipher_key,
+ int * size_ret)
{
- void *ret = NULL;
- void *ciphered = NULL;
+ void * ret = NULL;
+ void * ciphered = NULL;
unsigned int ciphered_len = 0;
int size;
@@ -4652,11 +4661,11 @@ eet_data_node_encode_cipher(Eet_Node *node,
if (size_ret)
*size_ret = 0;
- free(ret);
+ free(ret);
return NULL;
}
- free(ret);
+ free(ret);
size = (int)ciphered_len;
ret = ciphered;
}
@@ -4665,16 +4674,16 @@ eet_data_node_encode_cipher(Eet_Node *node,
*size_ret = size;
return ret;
-}
+} /* eet_data_node_encode_cipher */
EAPI void *
-eet_data_descriptor_encode_cipher(Eet_Data_Descriptor *edd,
- const void *data_in,
- const char *cipher_key,
- int *size_ret)
+eet_data_descriptor_encode_cipher(Eet_Data_Descriptor * edd,
+ const void * data_in,
+ const char * cipher_key,
+ int * size_ret)
{
- void *ret = NULL;
- void *ciphered = NULL;
+ void * ret = NULL;
+ void * ciphered = NULL;
unsigned int ciphered_len = 0;
int size;
@@ -4690,11 +4699,11 @@ eet_data_descriptor_encode_cipher(Eet_Data_Descriptor *edd,
if (size_ret)
*size_ret = 0;
- free(ret);
+ free(ret);
return NULL;
}
- free(ret);
+ free(ret);
size = ciphered_len;
ret = ciphered;
}
@@ -4703,12 +4712,13 @@ eet_data_descriptor_encode_cipher(Eet_Data_Descriptor *edd,
*size_ret = size;
return ret;
-}
+} /* eet_data_descriptor_encode_cipher */
EAPI void *
-eet_data_descriptor_encode(Eet_Data_Descriptor *edd,
- const void *data_in,
- int *size_ret)
+eet_data_descriptor_encode(Eet_Data_Descriptor * edd,
+ const void * data_in,
+ int * size_ret)
{
return eet_data_descriptor_encode_cipher(edd, data_in, NULL, size_ret);
-}
+} /* eet_data_descriptor_encode */
+
diff --git a/src/lib/eet_dictionary.c b/src/lib/eet_dictionary.c
index 7b1a1af..d61093c 100644
--- a/src/lib/eet_dictionary.c
+++ b/src/lib/eet_dictionary.c
@@ -4,7 +4,7 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
-#endif
+#endif /* ifdef HAVE_CONFIG_H */
#include <stdio.h>
#include <string.h>
@@ -18,7 +18,7 @@
Eet_Dictionary *
eet_dictionary_add(void)
{
- Eet_Dictionary *new;
+ Eet_Dictionary * new;
new = calloc(1, sizeof (Eet_Dictionary));
if (!new)
@@ -27,10 +27,10 @@ eet_dictionary_add(void)
memset(new->hash, -1, sizeof (int) * 256);
return new;
-}
+} /* eet_dictionary_add */
void
-eet_dictionary_free(Eet_Dictionary *ed)
+eet_dictionary_free(Eet_Dictionary * ed)
{
if (ed)
{
@@ -41,14 +41,16 @@ eet_dictionary_free(Eet_Dictionary *ed)
free(ed->all[i].str);
if (ed->all)
- free(ed->all);
+ free(ed->all);
- free(ed);
+ free(ed);
}
-}
+} /* eet_dictionary_free */
static int
-_eet_dictionary_lookup(Eet_Dictionary *ed, const char *string, int hash)
+_eet_dictionary_lookup(Eet_Dictionary * ed,
+ const char * string,
+ int hash)
{
int prev = -1;
int current;
@@ -73,13 +75,14 @@ _eet_dictionary_lookup(Eet_Dictionary *ed, const char *string, int hash)
return prev;
return current;
-}
+} /* _eet_dictionary_lookup */
int
-eet_dictionary_string_add(Eet_Dictionary *ed, const char *string)
+eet_dictionary_string_add(Eet_Dictionary * ed,
+ const char * string)
{
- Eet_String *current;
- char *str;
+ Eet_String * current;
+ char * str;
int hash;
int idx;
int len;
@@ -105,7 +108,7 @@ eet_dictionary_string_add(Eet_Dictionary *ed, const char *string)
if (ed->total == ed->count)
{
- Eet_String *new;
+ Eet_String * new;
int total;
total = ed->total + 8;
@@ -154,10 +157,11 @@ eet_dictionary_string_add(Eet_Dictionary *ed, const char *string)
}
return ed->count++;
-}
+} /* eet_dictionary_string_add */
int
-eet_dictionary_string_get_size(const Eet_Dictionary *ed, int idx)
+eet_dictionary_string_get_size(const Eet_Dictionary * ed,
+ int idx)
{
if (!ed)
return 0;
@@ -169,10 +173,11 @@ eet_dictionary_string_get_size(const Eet_Dictionary *ed, int idx)
return ed->all[idx].len;
return 0;
-}
+} /* eet_dictionary_string_get_size */
int
-eet_dictionary_string_get_hash(const Eet_Dictionary *ed, int idx)
+eet_dictionary_string_get_hash(const Eet_Dictionary * ed,
+ int idx)
{
if (!ed)
return -1;
@@ -184,10 +189,11 @@ eet_dictionary_string_get_hash(const Eet_Dictionary *ed, int idx)
return ed->all[idx].hash;
return -1;
-}
+} /* eet_dictionary_string_get_hash */
const char *
-eet_dictionary_string_get_char(const Eet_Dictionary *ed, int idx)
+eet_dictionary_string_get_char(const Eet_Dictionary * ed,
+ int idx)
{
if (!ed)
return NULL;
@@ -205,22 +211,22 @@ eet_dictionary_string_get_char(const Eet_Dictionary *ed, int idx)
ed->all[idx].mmap = NULL;
}
-#else
+#else /* ifdef _WIN32 */
if (ed->all[idx].mmap)
return ed->all[idx].mmap;
-#endif
+#endif /* ifdef _WIN32 */
return ed->all[idx].str;
}
return NULL;
-}
+} /* eet_dictionary_string_get_char */
static inline Eina_Bool
-_eet_dictionary_string_get_me_cache(const char *s,
- int len,
- int *mantisse,
- int *exponent)
+_eet_dictionary_string_get_me_cache(const char * s,
+ int len,
+ int * mantisse,
+ int * exponent)
{
if ((len == 6) && (s[0] == '0') && (s[1] == 'x') && (s[3] == 'p'))
{
@@ -231,10 +237,12 @@ _eet_dictionary_string_get_me_cache(const char *s,
}
return EINA_FALSE;
-}
+} /* _eet_dictionary_string_get_me_cache */
static inline Eina_Bool
-_eet_dictionary_string_get_float_cache(const char *s, int len, float *result)
+_eet_dictionary_string_get_float_cache(const char * s,
+ int len,
+ float * result)
{
int mantisse;
int exponent;
@@ -250,10 +258,12 @@ _eet_dictionary_string_get_float_cache(const char *s, int len, float *result)
}
return EINA_FALSE;
-}
+} /* _eet_dictionary_string_get_float_cache */
static inline Eina_Bool
-_eet_dictionary_string_get_double_cache(const char *s, int len, double *result)
+_eet_dictionary_string_get_double_cache(const char * s,
+ int len,
+ double * result)
{
int mantisse;
int exponent;
@@ -269,10 +279,12 @@ _eet_dictionary_string_get_double_cache(const char *s, int len, double *result)
}
return EINA_FALSE;
-}
+} /* _eet_dictionary_string_get_double_cache */
static inline Eina_Bool
-_eet_dictionary_test(const Eet_Dictionary *ed, int idx, void *result)
+_eet_dictionary_test(const Eet_Dictionary * ed,
+ int idx,
+ void * result)
{
if (!result)
return EINA_FALSE;
@@ -287,19 +299,19 @@ _eet_dictionary_test(const Eet_Dictionary *ed, int idx, void *result)
return EINA_FALSE;
return EINA_TRUE;
-}
+} /* _eet_dictionary_test */
Eina_Bool
-eet_dictionary_string_get_float(const Eet_Dictionary *ed,
- int idx,
- float *result)
+eet_dictionary_string_get_float(const Eet_Dictionary * ed,
+ int idx,
+ float * result)
{
if (!_eet_dictionary_test(ed, idx, result))
return EINA_FALSE;
if (!(ed->all[idx].type & EET_D_FLOAT))
{
- const char *str;
+ const char * str;
str = ed->all[idx].str ? ed->all[idx].str : ed->all[idx].mmap;
@@ -321,19 +333,19 @@ eet_dictionary_string_get_float(const Eet_Dictionary *ed,
*result = ed->all[idx].f;
return EINA_TRUE;
-}
+} /* eet_dictionary_string_get_float */
Eina_Bool
-eet_dictionary_string_get_double(const Eet_Dictionary *ed,
- int idx,
- double *result)
+eet_dictionary_string_get_double(const Eet_Dictionary * ed,
+ int idx,
+ double * result)
{
if (!_eet_dictionary_test(ed, idx, result))
return EINA_FALSE;
if (!(ed->all[idx].type & EET_D_DOUBLE))
{
- const char *str;
+ const char * str;
str = ed->all[idx].str ? ed->all[idx].str : ed->all[idx].mmap;
@@ -355,19 +367,19 @@ eet_dictionary_string_get_double(const Eet_Dictionary *ed,
*result = ed->all[idx].d;
return EINA_TRUE;
-}
+} /* eet_dictionary_string_get_double */
Eina_Bool
-eet_dictionary_string_get_fp(const Eet_Dictionary *ed,
- int idx,
- Eina_F32p32 *result)
+eet_dictionary_string_get_fp(const Eet_Dictionary * ed,
+ int idx,
+ Eina_F32p32 * result)
{
if (!_eet_dictionary_test(ed, idx, result))
return EINA_FALSE;
if (!(ed->all[idx].type & EET_D_FIXED_POINT))
{
- const char *str;
+ const char * str;
Eina_F32p32 fp;
str = ed->all[idx].str ? ed->all[idx].str : ed->all[idx].mmap;
@@ -381,19 +393,18 @@ eet_dictionary_string_get_fp(const Eet_Dictionary *ed,
*result = ed->all[idx].fp;
return EINA_TRUE;
-}
+} /* eet_dictionary_string_get_fp */
EAPI int
-eet_dictionary_string_check(Eet_Dictionary *ed, const char *string)
+eet_dictionary_string_check(Eet_Dictionary * ed,
+ const char * string)
{
int i;
- if (ed == NULL
- || string == NULL)
+ if ((ed == NULL) || (string == NULL))
return 0;
- if (ed->start <= string
- && string < ed->end)
+ if ((ed->start <= string) && (string < ed->end))
return 1;
for (i = 0; i < ed->count; ++i)
@@ -401,4 +412,5 @@ eet_dictionary_string_check(Eet_Dictionary *ed, const char *string)
return 1;
return 0;
-}
+} /* eet_dictionary_string_check */
+
diff --git a/src/lib/eet_image.c b/src/lib/eet_image.c
index fb23102..a3d8c17 100644
--- a/src/lib/eet_image.c
+++ b/src/lib/eet_image.c
@@ -4,7 +4,7 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
-#endif
+#endif /* ifdef HAVE_CONFIG_H */
#ifdef HAVE_ALLOCA_H
# include <alloca.h>
@@ -15,24 +15,24 @@
#elif defined _MSC_VER
# include <malloc.h>
# define alloca _alloca
-#else
+#else /* ifdef HAVE_ALLOCA_H */
# include <stddef.h>
# ifdef __cplusplus
extern "C"
-# endif
-void *alloca (size_t);
-#endif
+# endif /* ifdef __cplusplus */
+void * alloca (size_t);
+#endif /* ifdef HAVE_ALLOCA_H */
#ifdef HAVE_NETINET_IN_H
# ifdef __OpenBSD__
# include <sys/types.h>
-# endif
+# endif /* ifdef __OpenBSD__ */
# include <netinet/in.h>
-#endif
+#endif /* ifdef HAVE_NETINET_IN_H */
#ifdef _WIN32
# include <winsock2.h>
-#endif
+#endif /* ifdef _WIN32 */
#include <stdio.h>
#include <string.h>
@@ -45,22 +45,22 @@ void *alloca (size_t);
/*---*/
-typedef struct _JPEG_error_mgr *emptr;
+typedef struct _JPEG_error_mgr * emptr;
/*---*/
struct _JPEG_error_mgr
{
struct jpeg_error_mgr pub;
- jmp_buf setjmp_buffer;
+ jmp_buf setjmp_buffer;
};
struct jpeg_membuf_src
{
struct jpeg_source_mgr pub;
- const unsigned char *buf;
- size_t len;
+ const unsigned char * buf;
+ size_t len;
};
static void
@@ -68,40 +68,43 @@ _eet_jpeg_membuf_src_init(j_decompress_ptr cinfo)
{
/* FIXME: Use attribute unused */
(void)cinfo;
-}
+} /* _eet_jpeg_membuf_src_init */
static boolean
_eet_jpeg_membuf_src_fill(j_decompress_ptr cinfo)
{
static const JOCTET jpeg_eoi[2] = { 0xFF, JPEG_EOI };
- struct jpeg_membuf_src *src = (struct jpeg_membuf_src *)cinfo->src;
+ struct jpeg_membuf_src * src = (struct jpeg_membuf_src *)cinfo->src;
src->pub.bytes_in_buffer = sizeof(jpeg_eoi);
src->pub.next_input_byte = jpeg_eoi;
return TRUE;
-}
+} /* _eet_jpeg_membuf_src_fill */
static void
-_eet_jpeg_membuf_src_skip(j_decompress_ptr cinfo, long num_bytes)
+_eet_jpeg_membuf_src_skip(j_decompress_ptr cinfo,
+ long num_bytes)
{
- struct jpeg_membuf_src *src = (struct jpeg_membuf_src *)cinfo->src;
+ struct jpeg_membuf_src * src = (struct jpeg_membuf_src *)cinfo->src;
src->pub.bytes_in_buffer -= num_bytes;
src->pub.next_input_byte += num_bytes;
-}
+} /* _eet_jpeg_membuf_src_skip */
static void
_eet_jpeg_membuf_src_term(j_decompress_ptr cinfo)
{
- free(cinfo->src);
+ free(cinfo->src);
cinfo->src = NULL;
-}
+} /* _eet_jpeg_membuf_src_term */
static int
-eet_jpeg_membuf_src(j_decompress_ptr cinfo, const void *buf, size_t len)
+eet_jpeg_membuf_src(j_decompress_ptr cinfo,
+ const void * buf,
+ size_t len)
{
- struct jpeg_membuf_src *src;
+ struct jpeg_membuf_src * src;
src = malloc(sizeof(*src));
if (!src)
@@ -119,18 +122,18 @@ eet_jpeg_membuf_src(j_decompress_ptr cinfo, const void *buf, size_t len)
src->pub.next_input_byte = src->buf;
return 0;
-}
+} /* eet_jpeg_membuf_src */
struct jpeg_membuf_dst
{
struct jpeg_destination_mgr pub;
- void **dst_buf;
- size_t *dst_len;
+ void ** dst_buf;
+ size_t * dst_len;
- unsigned char *buf;
- size_t len;
- int failed;
+ unsigned char * buf;
+ size_t len;
+ int failed;
};
static void
@@ -138,13 +141,13 @@ _eet_jpeg_membuf_dst_init(j_compress_ptr cinfo)
{
/* FIXME: Use eina attribute */
(void)cinfo;
-}
+} /* _eet_jpeg_membuf_dst_init */
static boolean
_eet_jpeg_membuf_dst_flush(j_compress_ptr cinfo)
{
- struct jpeg_membuf_dst *dst = (struct jpeg_membuf_dst *)cinfo->dest;
- unsigned char *buf;
+ struct jpeg_membuf_dst * dst = (struct jpeg_membuf_dst *)cinfo->dest;
+ unsigned char * buf;
if (dst->len >= 0x40000000 ||
(buf = realloc(dst->buf, dst->len * 2)) == NULL)
@@ -162,12 +165,12 @@ _eet_jpeg_membuf_dst_flush(j_compress_ptr cinfo)
dst->len *= 2;
return FALSE;
-}
+} /* _eet_jpeg_membuf_dst_flush */
static void
_eet_jpeg_membuf_dst_term(j_compress_ptr cinfo)
{
- struct jpeg_membuf_dst *dst = (struct jpeg_membuf_dst *)cinfo->dest;
+ struct jpeg_membuf_dst * dst = (struct jpeg_membuf_dst *)cinfo->dest;
if (dst->failed)
{
@@ -181,14 +184,16 @@ _eet_jpeg_membuf_dst_term(j_compress_ptr cinfo)
*dst->dst_len = (unsigned char *)dst->pub.next_output_byte - dst->buf;
}
- free(dst);
+ free(dst);
cinfo->dest = NULL;
-}
+} /* _eet_jpeg_membuf_dst_term */
static int
-eet_jpeg_membuf_dst(j_compress_ptr cinfo, void **buf, size_t *len)
+eet_jpeg_membuf_dst(j_compress_ptr cinfo,
+ void ** buf,
+ size_t * len)
{
- struct jpeg_membuf_dst *dst;
+ struct jpeg_membuf_dst * dst;
dst = malloc(sizeof(*dst));
if (!dst)
@@ -214,57 +219,58 @@ eet_jpeg_membuf_dst(j_compress_ptr cinfo, void **buf, size_t *len)
dst->failed = 0;
return 0;
-}
+} /* eet_jpeg_membuf_dst */
/*---*/
-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,
+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);
-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);
+ 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);
/*---*/
@@ -272,36 +278,36 @@ 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) | \
+#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) | \
+#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) | \
+#define SWAP16(x) (x) =\
+ ((((short)(x) & 0x00ff) << 8) |\
(((short)(x) & 0xff00) >> 8))
#ifdef CONV8
# undef CONV8
-#endif
+#endif /* ifdef CONV8 */
#ifdef CONV16
# undef CONV16
-#endif
+#endif /* ifdef CONV16 */
#ifdef CONV32
# undef CONV32
-#endif
+#endif /* ifdef CONV32 */
#ifdef CONV64
# undef CONV64
-#endif
+#endif /* ifdef CONV64 */
#define CONV8(x)
#define CONV16(x) {if (_eet_image_words_bigendian) {SWAP16(x); }}
@@ -319,7 +325,7 @@ _JPEGFatalErrorHandler(j_common_ptr cinfo)
/* cinfo->err->output_message(cinfo);*/
longjmp(errmgr->setjmp_buffer, 1);
return;
-}
+} /* _JPEGFatalErrorHandler */
static void
_JPEGErrorHandler(j_common_ptr cinfo __UNUSED__)
@@ -330,10 +336,11 @@ _JPEGErrorHandler(j_common_ptr cinfo __UNUSED__)
/* cinfo->err->output_message(cinfo);*/
/* longjmp(errmgr->setjmp_buffer, 1);*/
return;
-}
+} /* _JPEGErrorHandler */
static void
-_JPEGErrorHandler2(j_common_ptr cinfo __UNUSED__, int msg_level __UNUSED__)
+_JPEGErrorHandler2(j_common_ptr cinfo __UNUSED__,
+ int msg_level __UNUSED__)
{
/* emptr errmgr; */
@@ -341,13 +348,13 @@ _JPEGErrorHandler2(j_common_ptr cinfo __UNUSED__, int msg_level __UNUSED__)
/* cinfo->err->output_message(cinfo);*/
/* longjmp(errmgr->setjmp_buffer, 1);*/
return;
-}
+} /* _JPEGErrorHandler2 */
static int
-eet_data_image_jpeg_header_decode(const void *data,
- int size,
- unsigned int *w,
- unsigned int *h)
+eet_data_image_jpeg_header_decode(const void * data,
+ int size,
+ unsigned int * w,
+ unsigned int * h)
{
struct jpeg_decompress_struct cinfo;
struct _JPEG_error_mgr jerr;
@@ -387,22 +394,22 @@ eet_data_image_jpeg_header_decode(const void *data,
return 0;
return 1;
-}
+} /* eet_data_image_jpeg_header_decode */
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)
+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)
{
struct jpeg_decompress_struct cinfo;
struct _JPEG_error_mgr jerr;
- unsigned char *ptr, *line[16], *tdata = NULL;
- unsigned int *ptr2, *tmp;
+ unsigned char * ptr, * line[16], * tdata = NULL;
+ unsigned int * ptr2, * tmp;
unsigned int iw, ih;
unsigned int x, y, l, scans;
unsigned int i;
@@ -540,22 +547,22 @@ eet_data_image_jpeg_rgb_decode(const void *data,
jpeg_finish_decompress(&cinfo);
jpeg_destroy_decompress(&cinfo);
return 1;
-}
+} /* eet_data_image_jpeg_rgb_decode */
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)
+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)
{
struct jpeg_decompress_struct cinfo;
struct _JPEG_error_mgr jerr;
- unsigned char *ptr, *line[16], *tdata = NULL;
- unsigned int *ptr2, *tmp;
+ unsigned char * ptr, * line[16], * tdata = NULL;
+ unsigned int * ptr2, * tmp;
unsigned int x, y, l, scans;
unsigned int i, iw;
@@ -649,14 +656,14 @@ eet_data_image_jpeg_alpha_decode(const void *data,
jpeg_finish_decompress(&cinfo);
jpeg_destroy_decompress(&cinfo);
return d;
-}
+} /* eet_data_image_jpeg_alpha_decode */
static void *
-eet_data_image_lossless_convert(int *size,
- const void *data,
+eet_data_image_lossless_convert(int * size,
+ const void * data,
unsigned int w,
unsigned int h,
- int alpha)
+ int alpha)
{
if (_eet_image_words_bigendian == -1)
{
@@ -670,8 +677,8 @@ eet_data_image_lossless_convert(int *size,
}
{
- unsigned char *d;
- int *header;
+ unsigned char * d;
+ int * header;
d = malloc((w * h * 4) + (8 * 4));
if (!d)
@@ -697,15 +704,15 @@ eet_data_image_lossless_convert(int *size,
*size = ((w * h * 4) + (8 * 4));
return d;
}
-}
+} /* eet_data_image_lossless_convert */
static void *
-eet_data_image_lossless_compressed_convert(int *size,
- const void *data,
+eet_data_image_lossless_compressed_convert(int * size,
+ const void * data,
unsigned int w,
unsigned int h,
- int alpha,
- int compression)
+ int alpha,
+ int compression)
{
if (_eet_image_words_bigendian == -1)
{
@@ -719,9 +726,9 @@ eet_data_image_lossless_compressed_convert(int *size,
}
{
- unsigned char *d;
- unsigned char *comp;
- int *header;
+ unsigned char * d;
+ unsigned char * comp;
+ int * header;
int ret;
uLongf buflen;
@@ -771,23 +778,23 @@ eet_data_image_lossless_compressed_convert(int *size,
free(comp);
return d;
}
-}
+} /* eet_data_image_lossless_compressed_convert */
static void *
-eet_data_image_jpeg_convert(int *size,
- const void *data,
+eet_data_image_jpeg_convert(int * size,
+ const void * data,
unsigned int w,
unsigned int h,
- int alpha,
- int quality)
+ int alpha,
+ int quality)
{
struct jpeg_compress_struct cinfo;
struct _JPEG_error_mgr jerr;
- const int *ptr;
- void *d = NULL;
+ const int * ptr;
+ void * d = NULL;
size_t sz = 0;
- JSAMPROW *jbuf;
- unsigned char *buf;
+ JSAMPROW * jbuf;
+ unsigned char * buf;
(void)alpha; /* unused */
@@ -850,19 +857,19 @@ eet_data_image_jpeg_convert(int *size,
*size = sz;
return d;
-}
+} /* eet_data_image_jpeg_convert */
static void *
-eet_data_image_jpeg_alpha_convert(int *size,
- const void *data,
+eet_data_image_jpeg_alpha_convert(int * size,
+ const void * data,
unsigned int w,
unsigned int h,
- int alpha,
- int quality)
+ int alpha,
+ int quality)
{
- unsigned char *d1, *d2;
- unsigned char *d;
- int *header;
+ unsigned char * d1, * d2;
+ unsigned char * d;
+ int * header;
int sz1, sz2;
(void)alpha; /* unused */
@@ -879,13 +886,13 @@ eet_data_image_jpeg_alpha_convert(int *size,
}
{
- const int *ptr;
- void *dst = NULL;
+ const int * ptr;
+ void * dst = NULL;
size_t sz = 0;
struct _JPEG_error_mgr jerr;
- JSAMPROW *jbuf;
+ JSAMPROW * jbuf;
struct jpeg_compress_struct cinfo;
- unsigned char *buf;
+ unsigned char * buf;
buf = alloca(3 * w);
@@ -945,13 +952,13 @@ eet_data_image_jpeg_alpha_convert(int *size,
sz1 = sz;
}
{
- const int *ptr;
- void *dst = NULL;
+ const int * ptr;
+ void * dst = NULL;
size_t sz = 0;
struct _JPEG_error_mgr jerr;
- JSAMPROW *jbuf;
+ JSAMPROW * jbuf;
struct jpeg_compress_struct cinfo;
- unsigned char *buf;
+ unsigned char * buf;
buf = alloca(3 * w);
@@ -1031,28 +1038,28 @@ 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 + sz1, d2, sz2);
+ memcpy(d + 12, d1, sz1);
+ memcpy(d + 12 + sz1, d2, sz2);
- free(d1);
- free(d2);
+ free(d1);
+ free(d2);
*size = 12 + sz1 + sz2;
return d;
-}
+} /* eet_data_image_jpeg_alpha_convert */
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 comp,
- int quality,
- int lossy)
+ int alpha,
+ int comp,
+ int quality,
+ int lossy)
{
- void *d = NULL;
+ void * d = NULL;
int size = 0;
d = eet_data_image_encode(data, &size, w, h, alpha, comp, quality, lossy);
@@ -1061,23 +1068,23 @@ eet_data_image_write_cipher(Eet_File *ef,
int v;
v = eet_write_cipher(ef, name, d, size, 0, cipher_key);
- free(d);
+ free(d);
return v;
}
return 0;
-}
+} /* eet_data_image_write_cipher */
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 comp,
- int quality,
- int lossy)
+ int alpha,
+ int comp,
+ int quality,
+ int lossy)
{
return eet_data_image_write_cipher(ef,
name,
@@ -1089,22 +1096,21 @@ eet_data_image_write(Eet_File *ef,
comp,
quality,
lossy);
-}
-
+} /* eet_data_image_write */
EAPI void *
-eet_data_image_read_cipher(Eet_File *ef,
- const char *name,
- const char *cipher_key,
- unsigned int *w,
- unsigned int *h,
- int *alpha,
- int *comp,
- int *quality,
- int *lossy)
+eet_data_image_read_cipher(Eet_File * ef,
+ const char * name,
+ const char * cipher_key,
+ unsigned int * w,
+ unsigned int * h,
+ int * alpha,
+ int * comp,
+ int * quality,
+ int * lossy)
{
- unsigned int *d = NULL;
- void *data = NULL;
+ unsigned int * d = NULL;
+ void * data = NULL;
int free_data = 0;
int size;
@@ -1122,43 +1128,41 @@ eet_data_image_read_cipher(Eet_File *ef,
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 */
EAPI void *
-eet_data_image_read(Eet_File *ef, const char *name,
- unsigned int *w, unsigned int *h, int *alpha,
- int *comp, int *quality, int *lossy)
+eet_data_image_read(Eet_File * ef,
+ const char * name,
+ unsigned int * w,
+ unsigned int * h,
+ int * alpha,
+ int * comp,
+ int * quality,
+ int * lossy)
{
- return eet_data_image_read_cipher(ef,
- name,
- NULL,
- w,
- h,
- alpha,
- comp,
- quality,
- lossy);
-}
+ return eet_data_image_read_cipher(ef, name, NULL, w, h, alpha,
+ comp, quality, lossy);
+} /* eet_data_image_read */
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,
- unsigned int *d,
- unsigned int w,
- unsigned int h,
- unsigned int row_stride,
- int *alpha,
- int *comp,
- int *quality,
- int *lossy)
+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 * comp,
+ int * quality,
+ int * lossy)
{
- void *data = NULL;
+ void * data = NULL;
int free_data = 0;
int res = 1;
int size;
@@ -1174,66 +1178,49 @@ eet_data_image_read_to_surface_cipher(Eet_File *ef,
return 0;
}
- res = eet_data_image_decode_to_surface(data,
- size,
- src_x,
- src_y,
- d,
- w,
- h,
- row_stride,
- alpha,
- comp,
- quality,
- lossy);
+ res = eet_data_image_decode_to_surface(data, size, src_x, src_y, d,
+ w, h, row_stride, alpha,
+ comp, quality, lossy);
if (free_data)
- free(data);
+ free(data);
return res;
-}
+} /* eet_data_image_read_to_surface_cipher */
EAPI int
-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 *comp,
- int *quality,
- int *lossy)
+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 * comp,
+ int * quality,
+ int * lossy)
{
- return eet_data_image_read_to_surface_cipher(ef,
- name,
- NULL,
- src_x,
- src_y,
- d,
- w,
- h,
- row_stride,
- alpha,
- comp,
- quality,
+ return eet_data_image_read_to_surface_cipher(ef, name, NULL,
+ src_x, src_y, d,
+ w, h, row_stride,
+ alpha, comp, quality,
lossy);
-}
+} /* eet_data_image_read_to_surface */
EAPI int
-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 *comp,
- int *quality,
- int *lossy)
+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 * comp,
+ int * quality,
+ int * lossy)
{
- void *data = NULL;
+ void * data = NULL;
int size = 0;
int free_data = 0;
int d;
@@ -1249,62 +1236,50 @@ eet_data_image_header_read_cipher(Eet_File *ef,
return 0;
}
- d = eet_data_image_header_decode(data,
- size,
- w,
- h,
- alpha,
- comp,
- quality,
- lossy);
+ 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 */
EAPI int
-eet_data_image_header_read(Eet_File *ef, const char *name,
- unsigned int *w, unsigned int *h, int *alpha,
- int *comp, int *quality, int *lossy)
+eet_data_image_header_read(Eet_File * ef,
+ const char * name,
+ unsigned int * w,
+ unsigned int * h,
+ int * alpha,
+ int * comp,
+ int * quality,
+ int * lossy)
{
- return eet_data_image_header_read_cipher(ef,
- name,
- NULL,
- w,
- h,
- alpha,
- comp,
- quality,
- lossy);
-}
-
+ return eet_data_image_header_read_cipher(ef, name, NULL,
+ w, h, alpha,
+ comp, quality, lossy);
+} /* eet_data_image_header_read */
EAPI void *
-eet_data_image_encode_cipher(const void *data,
- const char *cipher_key,
+eet_data_image_encode_cipher(const void * data,
+ const char * cipher_key,
unsigned int w,
unsigned int h,
- int alpha,
- int comp,
- int quality,
- int lossy,
- int *size_ret)
+ int alpha,
+ int comp,
+ int quality,
+ int lossy,
+ int * size_ret)
{
- void *d = NULL;
- void *ciphered_d = NULL;
+ void * d = NULL;
+ void * ciphered_d = NULL;
unsigned int ciphered_sz = 0;
int size = 0;
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. */
@@ -1316,12 +1291,8 @@ eet_data_image_encode_cipher(const void *data,
if (!alpha)
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)
@@ -1337,49 +1308,42 @@ eet_data_image_encode_cipher(const void *data,
}
else
if (ciphered_d)
- free(ciphered_d);
+ free(ciphered_d);
}
if (size_ret)
*size_ret = size;
return d;
-}
+} /* eet_data_image_encode_cipher */
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 comp,
- int quality,
- int lossy)
+ int alpha,
+ int comp,
+ int quality,
+ int lossy)
{
- return eet_data_image_encode_cipher(data,
- NULL,
- w,
- h,
- alpha,
- comp,
- quality,
- lossy,
- size_ret);
-}
+ return eet_data_image_encode_cipher(data, NULL, w, h, alpha,
+ comp, quality, lossy, size_ret);
+} /* eet_data_image_encode */
EAPI int
-eet_data_image_header_decode_cipher(const void *data,
- const char *cipher_key,
- int size,
- unsigned int *w,
- unsigned int *h,
- int *alpha,
- int *comp,
- int *quality,
- int *lossy)
+eet_data_image_header_decode_cipher(const void * data,
+ const char * cipher_key,
+ int size,
+ unsigned int * w,
+ unsigned int * h,
+ int * alpha,
+ int * comp,
+ int * quality,
+ int * lossy)
{
int header[8];
- void *deciphered_d = NULL;
+ void * deciphered_d = NULL;
unsigned int deciphered_sz = 0;
if (cipher_key)
@@ -1392,7 +1356,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)
@@ -1409,7 +1373,7 @@ eet_data_image_header_decode_cipher(const void *data,
if (size < 32)
return 0;
- memcpy(header, data, 32);
+ memcpy(header, data, 32);
if (_eet_image_words_bigendian)
{
int i;
@@ -1454,7 +1418,7 @@ eet_data_image_header_decode_cipher(const void *data,
else if ((unsigned)header[0] == 0xbeeff00d)
{
unsigned int iw = 0, ih = 0;
- unsigned const char *dt;
+ unsigned const char * dt;
int sz1;
int ok;
@@ -1517,17 +1481,17 @@ eet_data_image_header_decode_cipher(const void *data,
}
return 0;
-}
+} /* eet_data_image_header_decode_cipher */
EAPI int
-eet_data_image_header_decode(const void *data,
- int size,
- unsigned int *w,
- unsigned int *h,
- int *alpha,
- int *comp,
- int *quality,
- int *lossy)
+eet_data_image_header_decode(const void * data,
+ int size,
+ unsigned int * w,
+ unsigned int * h,
+ int * alpha,
+ int * comp,
+ int * quality,
+ int * lossy)
{
return eet_data_image_header_decode_cipher(data,
NULL,
@@ -1538,63 +1502,56 @@ eet_data_image_header_decode(const void *data,
comp,
quality,
lossy);
-}
+} /* eet_data_image_header_decode */
static void
-_eet_data_image_copy_buffer(const unsigned int *src,
- unsigned int src_x,
- unsigned int src_y,
- unsigned int src_w,
- unsigned int *dst,
- unsigned int w,
- unsigned int h,
- unsigned int row_stride)
+_eet_data_image_copy_buffer(const unsigned int * src,
+ unsigned int src_x,
+ unsigned int src_y,
+ unsigned int src_w,
+ unsigned int * dst,
+ unsigned int w,
+ unsigned int h,
+ unsigned int row_stride)
{
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 * over = dst;
unsigned int y;
for (y = 0; y < h; ++y, src += src_w, over += row_stride)
memcpy(over, src, w * 4);
}
-}
-
+} /* _eet_data_image_copy_buffer */
static int
-_eet_data_image_decode_inside(const void *data,
- int size,
- unsigned int src_x,
- unsigned int src_y,
- unsigned int src_w,
- unsigned int src_h,
- unsigned int *d,
- unsigned int w,
- unsigned int h,
- unsigned int row_stride,
- int alpha,
- int comp,
- int quality,
- int lossy)
+_eet_data_image_decode_inside(const void * data,
+ int size,
+ unsigned int src_x,
+ unsigned int src_y,
+ unsigned int src_w,
+ unsigned int src_h,
+ unsigned int * d,
+ unsigned int w,
+ unsigned int h,
+ unsigned int row_stride,
+ int alpha,
+ int comp,
+ int quality,
+ int lossy)
{
if (lossy == 0 && quality == 100)
{
- unsigned int *body;
+ unsigned int * body;
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)
@@ -1607,7 +1564,7 @@ _eet_data_image_decode_inside(const void *data,
}
else
{
- Bytef *dtmp;
+ 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. */
@@ -1618,13 +1575,8 @@ _eet_data_image_decode_inside(const void *data,
uncompress(dtmp, &dlen, (Bytef *)body, (uLongf)(size - 32));
_eet_data_image_copy_buffer((unsigned int *)dtmp,
- src_x,
- src_y,
- src_w,
- d,
- w,
- h,
- row_stride);
+ src_x, src_y, src_w, d,
+ w, h, row_stride);
free(dtmp);
}
@@ -1642,7 +1594,7 @@ _eet_data_image_decode_inside(const void *data,
{
if (alpha)
{
- unsigned const char *dt;
+ unsigned const char * dt;
int header[8];
int sz1, sz2;
@@ -1676,23 +1628,23 @@ _eet_data_image_decode_inside(const void *data,
abort();
return 1;
-}
+} /* _eet_data_image_decode_inside */
EAPI void *
-eet_data_image_decode_cipher(const void *data,
- const char *cipher_key,
- int size,
- unsigned int *w,
- unsigned int *h,
- int *alpha,
- int *comp,
- int *quality,
- int *lossy)
+eet_data_image_decode_cipher(const void * data,
+ const char * cipher_key,
+ int size,
+ unsigned int * w,
+ unsigned int * h,
+ int * alpha,
+ int * comp,
+ int * quality,
+ int * lossy)
{
- unsigned int *d = NULL;
+ unsigned int * d = NULL;
unsigned int iw, ih;
int ialpha, icompress, iquality, ilossy;
- void *deciphered_d = NULL;
+ void * deciphered_d = NULL;
unsigned int deciphered_sz = 0;
if (cipher_key)
@@ -1720,7 +1672,7 @@ eet_data_image_decode_cipher(const void *data,
if (!_eet_data_image_decode_inside(data, size, 0, 0, iw, ih, d, iw, ih, iw *
4, ialpha, icompress, iquality, ilossy))
{
- free(d);
+ free(d);
return NULL;
}
@@ -1743,47 +1695,40 @@ eet_data_image_decode_cipher(const void *data,
*lossy = ilossy;
return d;
-}
+} /* eet_data_image_decode_cipher */
EAPI void *
-eet_data_image_decode(const void *data,
- int size,
- unsigned int *w,
- unsigned int *h,
- int *alpha,
- int *comp,
- int *quality,
- int *lossy)
+eet_data_image_decode(const void * data,
+ int size,
+ unsigned int * w,
+ unsigned int * h,
+ int * alpha,
+ int * comp,
+ int * quality,
+ int * lossy)
{
- return eet_data_image_decode_cipher(data,
- NULL,
- size,
- w,
- h,
- alpha,
- comp,
- quality,
- lossy);
-}
+ return eet_data_image_decode_cipher(data, NULL, size, w, h,
+ alpha, comp, quality, lossy);
+} /* eet_data_image_decode */
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,
- unsigned int *d,
- unsigned int w,
- unsigned int h,
- unsigned int row_stride,
- int *alpha,
- int *comp,
- int *quality,
- int *lossy)
+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 * comp,
+ int * quality,
+ int * lossy)
{
unsigned int iw, ih;
int ialpha, icompress, iquality, ilossy;
- void *deciphered_d = NULL;
+ void * deciphered_d = NULL;
unsigned int deciphered_sz = 0;
if (cipher_key)
@@ -1831,33 +1776,26 @@ eet_data_image_decode_to_surface_cipher(const void *data,
*lossy = ilossy;
return 1;
-}
+} /* eet_data_image_decode_to_surface_cipher */
EAPI int
-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 *comp,
- int *quality,
- int *lossy)
+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 * comp,
+ int * quality,
+ int * lossy)
{
- return eet_data_image_decode_to_surface_cipher(data,
- NULL,
- size,
- src_x,
- src_y,
- d,
- w,
- h,
- row_stride,
- alpha,
- comp,
- quality,
+ return eet_data_image_decode_to_surface_cipher(data, NULL, size,
+ 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 b528e50..17e7f76 100644
--- a/src/lib/eet_lib.c
+++ b/src/lib/eet_lib.c
@@ -4,7 +4,7 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
-#endif
+#endif /* ifdef HAVE_CONFIG_H */
#ifdef HAVE_ALLOCA_H
# include <alloca.h>
@@ -15,17 +15,17 @@
#elif defined _MSC_VER
# include <malloc.h>
# define alloca _alloca
-#else
+#else /* ifdef HAVE_ALLOCA_H */
# include <stddef.h>
# ifdef __cplusplus
extern "C"
-# endif
-void *alloca (size_t);
-#endif
+# endif /* ifdef __cplusplus */
+void * alloca (size_t);
+#endif /* ifdef HAVE_ALLOCA_H */
#ifdef _WIN32
# include <winsock2.h>
-#endif
+#endif /* ifdef _WIN32 */
#include <stdio.h>
#include <errno.h>
@@ -40,32 +40,32 @@ void *alloca (size_t);
#ifndef _MSC_VER
# include <unistd.h>
-#endif
+#endif /* ifndef _MSC_VER */
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
-#endif
+#endif /* ifdef HAVE_NETINET_IN_H */
#ifdef HAVE_EVIL
# include <Evil.h>
-#endif
+#endif /* ifdef HAVE_EVIL */
#ifdef HAVE_GNUTLS
# include <gnutls/gnutls.h>
# include <gcrypt.h>
-#endif
+#endif /* ifdef HAVE_GNUTLS */
#ifdef HAVE_OPENSSL
# include <openssl/err.h>
# include <openssl/evp.h>
-#endif
+#endif /* ifdef HAVE_OPENSSL */
#ifdef EFL_HAVE_POSIX_THREADS
# include <pthread.h>
# ifdef HAVE_GNUTLS
GCRY_THREAD_OPTION_PTHREAD_IMPL;
-# endif
-#endif
+# endif /* ifdef HAVE_GNUTLS */
+#endif /* ifdef EFL_HAVE_POSIX_THREADS */
#include <Eina.h>
@@ -73,87 +73,87 @@ GCRY_THREAD_OPTION_PTHREAD_IMPL;
#include "Eet_private.h"
static Eet_Version _version = { VMAJ, VMIN, VMIC, VREV };
-EAPI Eet_Version *eet_version = &_version;
+EAPI Eet_Version * eet_version = &_version;
#ifdef HAVE_REALPATH
# undef HAVE_REALPATH
-#endif
+#endif /* ifdef HAVE_REALPATH */
-#define EET_MAGIC_FILE 0x1ee7ff00
-#define EET_MAGIC_FILE_HEADER 0x1ee7ff01
+#define EET_MAGIC_FILE 0x1ee7ff00
+#define EET_MAGIC_FILE_HEADER 0x1ee7ff01
-#define EET_MAGIC_FILE2 0x1ee70f42
+#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
{
- char *path;
- FILE *readfp;
- Eet_File_Header *header;
- Eet_Dictionary *ed;
- Eet_Key *key;
- const unsigned char *data;
- const void *x509_der;
- const void *signature;
- void *sha1;
+ char * path;
+ FILE * readfp;
+ Eet_File_Header * header;
+ Eet_Dictionary * ed;
+ Eet_Key * key;
+ const unsigned char * data;
+ const void * x509_der;
+ const void * signature;
+ void * sha1;
- Eet_File_Mode mode;
+ Eet_File_Mode mode;
- int magic;
- int references;
+ int magic;
+ int references;
- int data_size;
- int x509_length;
- unsigned int signature_length;
- int sha1_length;
+ int data_size;
+ int x509_length;
+ unsigned int signature_length;
+ int sha1_length;
- time_t mtime;
+ time_t mtime;
#ifdef EFL_HAVE_THREADS
# ifdef EFL_HAVE_POSIX_THREADS
- pthread_mutex_t file_lock;
-# else
- HANDLE file_lock;
-# endif
-#endif
-
- unsigned char writes_pending : 1;
- unsigned char delete_me_now : 1;
+ pthread_mutex_t file_lock;
+# else /* ifdef EFL_HAVE_POSIX_THREADS */
+ HANDLE file_lock;
+# endif /* ifdef EFL_HAVE_POSIX_THREADS */
+#endif /* ifdef EFL_HAVE_THREADS */
+
+ unsigned char writes_pending : 1;
+ unsigned char delete_me_now : 1;
};
struct _Eet_File_Header
{
- int magic;
- Eet_File_Directory *directory;
+ int magic;
+ Eet_File_Directory * directory;
};
struct _Eet_File_Directory
{
- int size;
- Eet_File_Node **nodes;
+ int size;
+ Eet_File_Node ** nodes;
};
struct _Eet_File_Node
{
- char *name;
- void *data;
- Eet_File_Node *next; /* FIXME: make buckets linked lists */
-
- int offset;
- int dictionary_offset;
- int name_offset;
-
- int name_size;
- int size;
- 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 */
+
+ int offset;
+ int dictionary_offset;
+ int name_offset;
+
+ int name_size;
+ int size;
+ int data_size;
+
+ unsigned char free_name : 1;
+ unsigned char compression : 1;
+ unsigned char ciphered : 1;
+ unsigned char alias : 1;
};
#if 0
@@ -165,15 +165,15 @@ int num_directory_entries; /* number of directory entries to follow */
int bytes_directory_entries; /* bytes of directory entries to follow */
struct
{
- int offset; /* bytes offset into file for data chunk */
- int flags; /* flags - for now 0 = uncompressed and clear, 1 = compressed and clear, 2 = uncompressed and ciphered, 3 = compressed and ciphered */
- int size; /* size of the data chunk */
- int data_size; /* size of the (uncompressed) data chunk */
- int name_size; /* length in bytes of the name field */
+ int offset; /* bytes offset into file for data chunk */
+ int flags; /* flags - for now 0 = uncompressed and clear, 1 = compressed and clear, 2 = uncompressed and ciphered, 3 = compressed and ciphered */
+ int size; /* size of the data chunk */
+ int data_size; /* size of the (uncompressed) data chunk */
+ int name_size; /* length in bytes of the name field */
char name[name_size]; /* name string (variable length) and \0 terminated */
} directory[num_directory_entries];
/* and now startes the data stream... */
-#endif
+#endif /* if 0 */
#if 0
/* Version 3 */
@@ -210,43 +210,43 @@ int signature_length; /* Signature length. */
int x509_length; /* Public certificate that signed the file. */
char signature[signature_length]; /* The signature. */
char x509[x509_length]; /* The public certificate. */
-#endif
+#endif /* if 0 */
-#define EET_FILE2_HEADER_COUNT 3
-#define EET_FILE2_DIRECTORY_ENTRY_COUNT 6
-#define EET_FILE2_DICTIONARY_ENTRY_COUNT 5
+#define EET_FILE2_HEADER_COUNT 3
+#define EET_FILE2_DIRECTORY_ENTRY_COUNT 6
+#define EET_FILE2_DICTIONARY_ENTRY_COUNT 5
-#define EET_FILE2_HEADER_SIZE (sizeof(int) * \
- EET_FILE2_HEADER_COUNT)
-#define EET_FILE2_DIRECTORY_ENTRY_SIZE (sizeof(int) * \
- EET_FILE2_DIRECTORY_ENTRY_COUNT)
-#define EET_FILE2_DICTIONARY_ENTRY_SIZE (sizeof(int) * \
- EET_FILE2_DICTIONARY_ENTRY_COUNT)
+#define EET_FILE2_HEADER_SIZE (sizeof(int) *\
+ EET_FILE2_HEADER_COUNT)
+#define EET_FILE2_DIRECTORY_ENTRY_SIZE (sizeof(int) *\
+ EET_FILE2_DIRECTORY_ENTRY_COUNT)
+#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);
-#endif
-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_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_internal_close(Eet_File *ef, Eina_Bool locked);
+static Eet_Error eet_internal_close(Eet_File * ef, Eina_Bool locked);
#ifdef EFL_HAVE_THREADS
@@ -254,36 +254,36 @@ static Eet_Error eet_internal_close(Eet_File *ef, Eina_Bool locked);
static pthread_mutex_t eet_cache_lock = PTHREAD_MUTEX_INITIALIZER;
-# define LOCK_CACHE pthread_mutex_lock(&eet_cache_lock)
+# define LOCK_CACHE pthread_mutex_lock(&eet_cache_lock)
# define UNLOCK_CACHE pthread_mutex_unlock(&eet_cache_lock)
-# define INIT_FILE(File) pthread_mutex_init(&File->file_lock, NULL)
-# define LOCK_FILE(File) pthread_mutex_lock(&File->file_lock)
-# define UNLOCK_FILE(File) pthread_mutex_unlock(&File->file_lock)
+# define INIT_FILE(File) pthread_mutex_init(&File->file_lock, NULL)
+# define LOCK_FILE(File) pthread_mutex_lock(&File->file_lock)
+# define UNLOCK_FILE(File) pthread_mutex_unlock(&File->file_lock)
# define DESTROY_FILE(File) pthread_mutex_destroy(&File->file_lock)
# else /* EFL_HAVE_WIN32_THREADS */
static HANDLE eet_cache_lock = NULL;
-# define LOCK_CACHE WaitForSingleObject(eet_cache_lock, INFINITE)
+# define LOCK_CACHE WaitForSingleObject(eet_cache_lock, INFINITE)
# define UNLOCK_CACHE ReleaseMutex(eet_cache_lock)
-# define INIT_FILE(File) File->file_lock = CreateMutex(NULL, FALSE, NULL)
-# define LOCK_FILE(File) WaitForSingleObject(File->file_lock, INFINITE)
-# define UNLOCK_FILE(File) ReleaseMutex(File->file_lock)
+# define INIT_FILE(File) File->file_lock = CreateMutex(NULL, FALSE, NULL)
+# define LOCK_FILE(File) WaitForSingleObject(File->file_lock, INFINITE)
+# define UNLOCK_FILE(File) ReleaseMutex(File->file_lock)
# define DESTROY_FILE(File) CloseHandle(File->file_lock)
# endif /* EFL_HAVE_WIN32_THREADS */
-#else
+#else /* ifdef EFL_HAVE_THREADS */
-# define LOCK_CACHE do {} while (0)
+# define LOCK_CACHE do {} while (0)
# define UNLOCK_CACHE do {} while (0)
-# define INIT_FILE(File) do {} while (0)
-# define LOCK_FILE(File) do {} while (0)
-# define UNLOCK_FILE(File) do {} while (0)
+# define INIT_FILE(File) do {} while (0)
+# define LOCK_FILE(File) do {} while (0)
+# define UNLOCK_FILE(File) do {} while (0)
# define DESTROY_FILE(File) do {} while (0)
#endif /* EFL_HAVE_THREADS */
@@ -291,10 +291,10 @@ static HANDLE eet_cache_lock = NULL;
/* cache. i don't expect this to ever be large, so arrays will do */
static int eet_writers_num = 0;
static int eet_writers_alloc = 0;
-static Eet_File **eet_writers = NULL;
+static Eet_File ** eet_writers = NULL;
static int eet_readers_num = 0;
static int eet_readers_alloc = 0;
-static Eet_File **eet_readers = NULL;
+static Eet_File ** eet_readers = NULL;
static int eet_init_count = 0;
/* log domain variable */
@@ -302,16 +302,16 @@ int _eet_log_dom_global = -1;
/* Check to see its' an eet file pointer */
static inline int
-eet_check_pointer(const Eet_File *ef)
+eet_check_pointer(const Eet_File * ef)
{
if ((!ef) || (ef->magic != EET_MAGIC_FILE))
return 1;
return 0;
-}
+} /* eet_check_pointer */
static inline int
-eet_check_header(const Eet_File *ef)
+eet_check_header(const Eet_File * ef)
{
if (!ef->header)
return 1;
@@ -320,23 +320,26 @@ eet_check_header(const Eet_File *ef)
return 1;
return 0;
-}
+} /* eet_check_header */
static inline int
-eet_test_close(int test, Eet_File *ef)
+eet_test_close(int test,
+ Eet_File * ef)
{
if (test)
{
ef->delete_me_now = 1;
- eet_internal_close(ef, EINA_TRUE);
+ eet_internal_close(ef, EINA_TRUE);
}
return test;
-}
+} /* eet_test_close */
/* find an eet file in the currently in use cache */
static Eet_File *
-eet_cache_find(const char *path, Eet_File **cache, int cache_num)
+eet_cache_find(const char * path,
+ Eet_File ** cache,
+ int cache_num)
{
int i;
@@ -352,21 +355,24 @@ eet_cache_find(const char *path, Eet_File **cache, int cache_num)
/* not found */
return NULL;
-}
+} /* eet_cache_find */
/* add to end of cache */
/* this should only be called when the cache lock is already held */
static void
-eet_cache_add(Eet_File *ef, Eet_File ***cache, int *cache_num, int *cache_alloc)
+eet_cache_add(Eet_File * ef,
+ Eet_File *** cache,
+ int * cache_num,
+ int * cache_alloc)
{
- Eet_File **new_cache;
+ Eet_File ** new_cache;
int new_cache_num;
int new_cache_alloc;
new_cache_num = *cache_num;
if (new_cache_num >= 64) /* avoid fd overruns - limit to 128 (most recent) in the cache */
{
- Eet_File *del_ef = NULL;
+ Eet_File * del_ef = NULL;
int i;
new_cache = *cache;
@@ -405,14 +411,17 @@ eet_cache_add(Eet_File *ef, Eet_File ***cache, int *cache_num, int *cache_alloc)
*cache = new_cache;
*cache_num = new_cache_num;
*cache_alloc = new_cache_alloc;
-}
+} /* eet_cache_add */
/* delete from cache */
/* this should only be called when the cache lock is already held */
static void
-eet_cache_del(Eet_File *ef, Eet_File ***cache, int *cache_num, int *cache_alloc)
+eet_cache_del(Eet_File * ef,
+ Eet_File *** cache,
+ int * cache_num,
+ int * cache_alloc)
{
- Eet_File **new_cache;
+ Eet_File ** new_cache;
int new_cache_num, new_cache_alloc;
int i, j;
@@ -457,11 +466,12 @@ eet_cache_del(Eet_File *ef, Eet_File ***cache, int *cache_num, int *cache_alloc)
*cache = new_cache;
*cache_num = new_cache_num;
*cache_alloc = new_cache_alloc;
-}
+} /* eet_cache_del */
/* internal string match. null friendly, catches same ptr */
static int
-eet_string_match(const char *s1, const char *s2)
+eet_string_match(const char * s1,
+ const char * s2)
{
/* both null- no match */
if ((!s1) || (!s2))
@@ -471,14 +481,14 @@ eet_string_match(const char *s1, const char *s2)
return 1;
return (!strcmp(s1, s2));
-}
+} /* eet_string_match */
/* flush out writes to a v2 eet file */
static Eet_Error
-eet_flush2(Eet_File *ef)
+eet_flush2(Eet_File * ef)
{
- Eet_File_Node *efn;
- FILE *fp;
+ Eet_File_Node * efn;
+ FILE * fp;
Eet_Error error = EET_ERROR_NONE;
int head[EET_FILE2_HEADER_COUNT];
int num_directory_entries = 0;
@@ -564,9 +574,9 @@ eet_flush2(Eet_File *ef)
ef->ed->offset = strings_offset;
/* go thru and write the header */
- head[0] = (int)htonl ((unsigned int)EET_MAGIC_FILE2);
- head[1] = (int)htonl ((unsigned int)num_directory_entries);
- head[2] = (int)htonl ((unsigned int)num_dictionary_entries);
+ head[0] = (int)htonl((unsigned int)EET_MAGIC_FILE2);
+ head[1] = (int)htonl((unsigned int)num_directory_entries);
+ head[2] = (int)htonl((unsigned int)num_dictionary_entries);
fseek(fp, 0, SEEK_SET);
if (fwrite(head, sizeof (head), 1, fp) != 1)
@@ -582,12 +592,12 @@ eet_flush2(Eet_File *ef)
flag = (efn->alias << 2) | (efn->ciphered << 1) | efn->compression;
- ibuf[0] = (int)htonl ((unsigned int)efn->offset);
- ibuf[1] = (int)htonl ((unsigned int)efn->size);
- ibuf[2] = (int)htonl ((unsigned int)efn->data_size);
- ibuf[3] = (int)htonl ((unsigned int)efn->name_offset);
- ibuf[4] = (int)htonl ((unsigned int)efn->name_size);
- ibuf[5] = (int)htonl ((unsigned int)flag);
+ ibuf[0] = (int)htonl((unsigned int)efn->offset);
+ ibuf[1] = (int)htonl((unsigned int)efn->size);
+ ibuf[2] = (int)htonl((unsigned int)efn->data_size);
+ ibuf[3] = (int)htonl((unsigned int)efn->name_offset);
+ ibuf[4] = (int)htonl((unsigned int)efn->name_size);
+ ibuf[5] = (int)htonl((unsigned int)flag);
if (fwrite(ibuf, sizeof(ibuf), 1, fp) != 1)
goto write_error;
@@ -603,11 +613,11 @@ eet_flush2(Eet_File *ef)
{
int sbuf[EET_FILE2_DICTIONARY_ENTRY_COUNT];
- sbuf[0] = (int)htonl ((unsigned int)ef->ed->all[j].hash);
- sbuf[1] = (int)htonl ((unsigned int)offset);
- sbuf[2] = (int)htonl ((unsigned int)ef->ed->all[j].len);
- sbuf[3] = (int)htonl ((unsigned int)ef->ed->all[j].prev);
- sbuf[4] = (int)htonl ((unsigned int)ef->ed->all[j].next);
+ sbuf[0] = (int)htonl((unsigned int)ef->ed->all[j].hash);
+ sbuf[1] = (int)htonl((unsigned int)offset);
+ sbuf[2] = (int)htonl((unsigned int)ef->ed->all[j].len);
+ sbuf[3] = (int)htonl((unsigned int)ef->ed->all[j].prev);
+ sbuf[4] = (int)htonl((unsigned int)ef->ed->all[j].next);
offset += ef->ed->all[j].len;
@@ -689,13 +699,13 @@ write_error:
case EPIPE: error = EET_ERROR_WRITE_ERROR_FILE_CLOSED; break;
default: error = EET_ERROR_WRITE_ERROR; break;
- }
+ } /* switch */
}
sign_error:
fclose(fp);
return error;
-}
+} /* eet_flush2 */
EAPI int
eet_init(void)
@@ -724,7 +734,7 @@ eet_init(void)
#ifdef HAVE_GNUTLS
/* Before the library can be used, it must initialize itself if needed. */
- if (gcry_control (GCRYCTL_ANY_INITIALIZATION_P) == 0)
+ if (gcry_control(GCRYCTL_ANY_INITIALIZATION_P) == 0)
{
gcry_check_version(NULL);
/* Disable warning messages about problems with the secure memory subsystem.
@@ -744,18 +754,18 @@ eet_init(void)
#ifdef EFL_HAVE_POSIX_THREADS
if (gcry_control(GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread))
- WRN(
+ WRN(
"YOU ARE USING PTHREADS, BUT I CANNOT INITIALIZE THREADSAFE GCRYPT OPERATIONS!");
-#endif
+#endif /* ifdef EFL_HAVE_POSIX_THREADS */
if (gnutls_global_init())
goto shutdown_eet;
-#endif
+#endif /* ifdef HAVE_GNUTLS */
#ifdef HAVE_OPENSSL
ERR_load_crypto_strings();
OpenSSL_add_all_algorithms();
-#endif
+#endif /* ifdef HAVE_OPENSSL */
return eet_init_count;
@@ -767,7 +777,7 @@ unregister_log_domain:
shutdown_eina:
eina_shutdown();
return --eet_init_count;
-}
+} /* eet_init */
EAPI int
eet_shutdown(void)
@@ -779,20 +789,20 @@ eet_shutdown(void)
eet_node_shutdown();
#ifdef HAVE_GNUTLS
gnutls_global_deinit();
-#endif
+#endif /* ifdef HAVE_GNUTLS */
#ifdef HAVE_OPENSSL
EVP_cleanup();
ERR_free_strings();
-#endif
+#endif /* ifdef HAVE_OPENSSL */
eina_log_domain_unregister(_eet_log_dom_global);
_eet_log_dom_global = -1;
eina_shutdown();
return eet_init_count;
-}
+} /* eet_shutdown */
EAPI Eet_Error
-eet_sync(Eet_File *ef)
+eet_sync(Eet_File * ef)
{
Eet_Error ret;
@@ -812,7 +822,7 @@ eet_sync(Eet_File *ef)
UNLOCK_FILE(ef);
return ret;
-}
+} /* eet_sync */
EAPI void
eet_clearcache(void)
@@ -839,7 +849,7 @@ eet_clearcache(void)
if (num > 0)
{
- Eet_File **closelist = NULL;
+ Eet_File ** closelist = NULL;
closelist = alloca(num * sizeof(Eet_File *));
num = 0;
@@ -870,14 +880,14 @@ eet_clearcache(void)
}
UNLOCK_CACHE;
-}
+} /* eet_clearcache */
/* FIXME: MMAP race condition in READ_WRITE_MODE */
static Eet_File *
-eet_internal_read2(Eet_File *ef)
+eet_internal_read2(Eet_File * ef)
{
- const int *data = (const int *)ef->data;
- const char *start = (const char *)ef->data;
+ const int * data = (const int *)ef->data;
+ const char * start = (const char *)ef->data;
int idx = 0;
int num_directory_entries;
int bytes_directory_entries;
@@ -892,11 +902,11 @@ eet_internal_read2(Eet_File *ef)
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 */
@@ -943,8 +953,8 @@ eet_internal_read2(Eet_File *ef)
/* actually read the directory block - all of it, into ram */
for (i = 0; i < num_directory_entries; ++i)
{
- const char *name;
- Eet_File_Node *efn;
+ const char * name;
+ Eet_File_Node * efn;
int name_offset;
int name_size;
int hash;
@@ -968,11 +978,11 @@ eet_internal_read2(Eet_File *ef)
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 */
@@ -1019,7 +1029,7 @@ eet_internal_read2(Eet_File *ef)
if (num_dictionary_entries)
{
- const int *dico = (const int *)ef->data +
+ const int * dico = (const int *)ef->data +
EET_FILE2_DIRECTORY_ENTRY_COUNT * num_directory_entries +
EET_FILE2_HEADER_COUNT;
int j;
@@ -1099,7 +1109,7 @@ eet_internal_read2(Eet_File *ef)
if (signature_base_offset < ef->data_size)
{
#ifdef HAVE_SIGNATURE
- const unsigned char *buffer = ((const unsigned char *)ef->data) +
+ const unsigned char * buffer = ((const unsigned char *)ef->data) +
signature_base_offset;
ef->x509_der = eet_identity_check(ef->data,
signature_base_offset,
@@ -1114,21 +1124,21 @@ eet_internal_read2(Eet_File *ef)
if (eet_test_close(ef->x509_der == NULL, ef))
return NULL;
-#else
+#else /* ifdef HAVE_SIGNATURE */
ERR(
"This file could be signed but you didn't compile the necessary code to check the signature.");
-#endif
+#endif /* ifdef HAVE_SIGNATURE */
}
return ef;
-}
+} /* eet_internal_read2 */
#if EET_OLD_EET_FILE_FORMAT
static Eet_File *
-eet_internal_read1(Eet_File *ef)
+eet_internal_read1(Eet_File * ef)
{
- const unsigned char *dyn_buf = NULL;
- const unsigned char *p = NULL;
+ const unsigned char * dyn_buf = NULL;
+ const unsigned char * p = NULL;
int idx = 0;
int num_entries;
int byte_entries;
@@ -1144,12 +1154,12 @@ eet_internal_read1(Eet_File *ef)
if (eet_test_close((int)ntohl(*((int *)ef->data)) != EET_MAGIC_FILE, ef))
return NULL;
-#define EXTRACT_INT(Value, Pointer, Index) \
- { \
- int tmp; \
- memcpy(&tmp, Pointer + Index, sizeof(int)); \
- Value = ntohl(tmp); \
- 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 */
@@ -1197,8 +1207,8 @@ eet_internal_read1(Eet_File *ef)
for (i = 0; i < num_entries; i++)
{
- Eet_File_Node *efn;
- void *data = NULL;
+ Eet_File_Node * efn;
+ void * data = NULL;
int indexn = 0;
int name_size;
int hash;
@@ -1230,21 +1240,21 @@ eet_internal_read1(Eet_File *ef)
/* invalid size */
if (eet_test_close(efn->size <= 0, ef))
{
- free (efn);
+ free(efn);
return NULL;
}
/* invalid name_size */
if (eet_test_close(name_size <= 0, ef))
{
- free (efn);
+ free(efn);
return NULL;
}
/* reading name would mean falling off end of dyn_buf - invalid */
if (eet_test_close((p + 16 + name_size) > (dyn_buf + byte_entries), ef))
{
- free (efn);
+ free(efn);
return NULL;
}
@@ -1297,8 +1307,9 @@ eet_internal_read1(Eet_File *ef)
p += HEADER_SIZE + name_size;
}
return ef;
-}
-#endif
+} /* eet_internal_read1 */
+
+#endif /* if EET_OLD_EET_FILE_FORMAT */
/*
* this should only be called when the cache lock is already held
@@ -1307,9 +1318,9 @@ eet_internal_read1(Eet_File *ef)
* to just require that it is always held.)
*/
static Eet_File *
-eet_internal_read(Eet_File *ef)
+eet_internal_read(Eet_File * ef)
{
- const int *data = (const int *)ef->data;
+ const int * data = (const int *)ef->data;
if (eet_test_close((ef->data == (void *)-1) || (ef->data == NULL), ef))
return NULL;
@@ -1323,7 +1334,7 @@ eet_internal_read(Eet_File *ef)
case EET_MAGIC_FILE:
return eet_internal_read1(ef);
-#endif
+#endif /* if EET_OLD_EET_FILE_FORMAT */
case EET_MAGIC_FILE2:
return eet_internal_read2(ef);
@@ -1331,13 +1342,14 @@ eet_internal_read(Eet_File *ef)
ef->delete_me_now = 1;
eet_internal_close(ef, EINA_TRUE);
break;
- }
+ } /* switch */
return NULL;
-}
+} /* eet_internal_read */
static Eet_Error
-eet_internal_close(Eet_File *ef, Eina_Bool locked)
+eet_internal_close(Eet_File * ef,
+ Eina_Bool locked)
{
Eet_Error err;
@@ -1391,7 +1403,7 @@ eet_internal_close(Eet_File *ef, Eina_Bool locked)
num = (1 << ef->header->directory->size);
for (i = 0; i < num; i++)
{
- Eet_File_Node *efn;
+ Eet_File_Node * efn;
while ((efn = ef->header->directory->nodes[i]))
{
@@ -1403,19 +1415,19 @@ eet_internal_close(Eet_File *ef, Eina_Bool locked)
if (efn->free_name)
free(efn->name);
- free(efn);
+ free(efn);
}
}
- free(ef->header->directory->nodes);
+ free(ef->header->directory->nodes);
}
- free(ef->header->directory);
+ free(ef->header->directory);
}
- free(ef->header);
+ free(ef->header);
}
- eet_dictionary_free(ef->ed);
+ eet_dictionary_free(ef->ed);
if (ef->sha1)
free(ef->sha1);
@@ -1438,12 +1450,13 @@ on_error:
UNLOCK_CACHE;
return EET_ERROR_NONE;
-}
+} /* eet_internal_close */
EAPI Eet_File *
-eet_memopen_read(const void *data, size_t size)
+eet_memopen_read(const void * data,
+ size_t size)
{
- Eet_File *ef;
+ Eet_File * ef;
if (data == NULL || size == 0)
return NULL;
@@ -1473,13 +1486,14 @@ eet_memopen_read(const void *data, size_t size)
ef = eet_internal_read(ef);
UNLOCK_CACHE;
return ef;
-}
+} /* eet_memopen_read */
EAPI Eet_File *
-eet_open(const char *file, Eet_File_Mode mode)
+eet_open(const char * file,
+ Eet_File_Mode mode)
{
- FILE *fp;
- Eet_File *ef;
+ FILE * fp;
+ Eet_File * ef;
int file_len;
struct stat file_stat;
@@ -1647,20 +1661,21 @@ empty_file:
on_error:
UNLOCK_CACHE;
return NULL;
-}
+} /* eet_open */
EAPI Eet_File_Mode
-eet_mode_get(Eet_File *ef)
+eet_mode_get(Eet_File * ef)
{
/* check to see its' an eet file pointer */
if ((!ef) || (ef->magic != EET_MAGIC_FILE))
return EET_FILE_MODE_INVALID;
else
return ef->mode;
-}
+} /* eet_mode_get */
EAPI const void *
-eet_identity_x509(Eet_File *ef, int *der_length)
+eet_identity_x509(Eet_File * ef,
+ int * der_length)
{
if (!ef->x509_der)
return NULL;
@@ -1669,10 +1684,11 @@ eet_identity_x509(Eet_File *ef, int *der_length)
*der_length = ef->x509_length;
return ef->x509_der;
-}
+} /* eet_identity_x509 */
EAPI const void *
-eet_identity_signature(Eet_File *ef, int *signature_length)
+eet_identity_signature(Eet_File * ef,
+ int * signature_length)
{
if (!ef->signature)
return NULL;
@@ -1681,10 +1697,11 @@ eet_identity_signature(Eet_File *ef, int *signature_length)
*signature_length = ef->signature_length;
return ef->signature;
-}
+} /* eet_identity_signature */
EAPI const void *
-eet_identity_sha1(Eet_File *ef, int *sha1_length)
+eet_identity_sha1(Eet_File * ef,
+ int * sha1_length)
{
if (!ef->sha1)
ef->sha1 = eet_identity_compute_sha1(ef->data,
@@ -1695,12 +1712,13 @@ eet_identity_sha1(Eet_File *ef, int *sha1_length)
*sha1_length = ef->sha1_length;
return ef->sha1;
-}
+} /* eet_identity_sha1 */
EAPI Eet_Error
-eet_identity_set(Eet_File *ef, Eet_Key *key)
+eet_identity_set(Eet_File * ef,
+ Eet_Key * key)
{
- Eet_Key *tmp = ef->key;
+ Eet_Key * tmp = ef->key;
if (!ef)
return EET_ERROR_BAD_OBJECT;
@@ -1713,22 +1731,22 @@ eet_identity_set(Eet_File *ef, Eet_Key *key)
ef->writes_pending = 1;
return EET_ERROR_NONE;
-}
+} /* eet_identity_set */
EAPI Eet_Error
-eet_close(Eet_File *ef)
+eet_close(Eet_File * ef)
{
return eet_internal_close(ef, EINA_FALSE);
-}
+} /* eet_close */
EAPI void *
-eet_read_cipher(Eet_File *ef,
- const char *name,
- int *size_ret,
- const char *cipher_key)
+eet_read_cipher(Eet_File * ef,
+ const char * name,
+ int * size_ret,
+ const char * cipher_key)
{
- Eet_File_Node *efn;
- char *data = NULL;
+ Eet_File_Node * efn;
+ char * data = NULL;
int size = 0;
if (size_ret)
@@ -1767,7 +1785,7 @@ eet_read_cipher(Eet_File *ef,
/* uncompressed data */
if (efn->compression == 0)
{
- void *data_deciphered = NULL;
+ void * data_deciphered = NULL;
unsigned int data_deciphered_sz = 0;
/* if we alreayd have the data in ram... copy that */
@@ -1788,7 +1806,7 @@ eet_read_cipher(Eet_File *ef,
goto on_error;
}
- free(data);
+ free(data);
data = data_deciphered;
size = data_deciphered_sz;
}
@@ -1796,8 +1814,8 @@ eet_read_cipher(Eet_File *ef,
/* compressed data */
else
{
- void *tmp_data;
- void *data_deciphered = NULL;
+ void * tmp_data;
+ void * data_deciphered = NULL;
unsigned int data_deciphered_sz = 0;
int free_tmp = 0;
int compr_size = efn->size;
@@ -1816,7 +1834,7 @@ eet_read_cipher(Eet_File *ef,
if (!read_data_from_disk(ef, efn, tmp_data, compr_size))
{
- free(tmp_data);
+ free(tmp_data);
goto on_error;
}
}
@@ -1836,7 +1854,7 @@ eet_read_cipher(Eet_File *ef,
goto on_error;
}
- free(tmp_data);
+ free(tmp_data);
tmp_data = data_deciphered;
compr_size = data_deciphered_sz;
}
@@ -1848,15 +1866,15 @@ eet_read_cipher(Eet_File *ef,
goto on_error;
if (free_tmp)
- free(tmp_data);
+ free(tmp_data);
}
- UNLOCK_FILE(ef);
+ UNLOCK_FILE(ef);
/* handle alias */
if (efn->alias)
{
- void *tmp;
+ void * tmp;
if (data[size - 1] != '\0')
goto on_error;
@@ -1878,19 +1896,23 @@ on_error:
UNLOCK_FILE(ef);
free(data);
return NULL;
-}
+} /* eet_read_cipher */
EAPI void *
-eet_read(Eet_File *ef, const char *name, int *size_ret)
+eet_read(Eet_File * ef,
+ const char * name,
+ int * size_ret)
{
return eet_read_cipher(ef, name, size_ret, NULL);
-}
+} /* eet_read */
EAPI const void *
-eet_read_direct(Eet_File *ef, const char *name, int *size_ret)
+eet_read_direct(Eet_File * ef,
+ const char * name,
+ int * size_ret)
{
- Eet_File_Node *efn;
- const char *data = NULL;
+ Eet_File_Node * efn;
+ const char * data = NULL;
int size = 0;
if (size_ret)
@@ -1931,7 +1953,7 @@ eet_read_direct(Eet_File *ef, const char *name, int *size_ret)
/* handle alias case */
if (efn->compression)
{
- char *tmp;
+ char * tmp;
int compr_size = efn->size;
uLongf dlen;
@@ -1975,13 +1997,16 @@ eet_read_direct(Eet_File *ef, const char *name, int *size_ret)
on_error:
UNLOCK_FILE(ef);
return NULL;
-}
+} /* eet_read_direct */
EAPI Eina_Bool
-eet_alias(Eet_File *ef, const char *name, const char *destination, int comp)
+eet_alias(Eet_File * ef,
+ const char * name,
+ const char * destination,
+ int comp)
{
- Eet_File_Node *efn;
- void *data2;
+ Eet_File_Node * efn;
+ void * data2;
Eina_Bool exists_already = EINA_FALSE;
int data_size;
int hash;
@@ -2065,7 +2090,7 @@ eet_alias(Eet_File *ef, const char *name, const char *destination, int comp)
}
else
{
- void *data3;
+ void * data3;
data3 = realloc(data2, data_size);
if (data3)
@@ -2127,18 +2152,18 @@ eet_alias(Eet_File *ef, const char *name, const char *destination, int comp)
on_error:
UNLOCK_FILE(ef);
return EINA_FALSE;
-}
+} /* eet_alias */
EAPI int
-eet_write_cipher(Eet_File *ef,
- const char *name,
- const void *data,
- int size,
- int comp,
- const char *cipher_key)
+eet_write_cipher(Eet_File * ef,
+ const char * name,
+ const void * data,
+ int size,
+ int comp,
+ const char * cipher_key)
{
- Eet_File_Node *efn;
- void *data2 = NULL;
+ Eet_File_Node * efn;
+ void * data2 = NULL;
int exists_already = 0;
int data_size;
int hash;
@@ -2181,7 +2206,7 @@ eet_write_cipher(Eet_File *ef,
(1 << ef->header->directory->size));
if (!ef->header->directory->nodes)
{
- free(ef->header->directory);
+ free(ef->header->directory);
ef->header = NULL;
goto on_error;
}
@@ -2209,7 +2234,7 @@ eet_write_cipher(Eet_File *ef,
if (compress2((Bytef *)data2, &buflen, (Bytef *)data,
(uLong)size, Z_BEST_COMPRESSION) != Z_OK)
{
- free(data2);
+ free(data2);
goto on_error;
}
@@ -2222,7 +2247,7 @@ eet_write_cipher(Eet_File *ef,
}
else
{
- void *data3;
+ void * data3;
data3 = realloc(data2, data_size);
if (data3)
@@ -2232,9 +2257,9 @@ eet_write_cipher(Eet_File *ef,
if (cipher_key)
{
- void *data_ciphered = NULL;
+ void * data_ciphered = NULL;
unsigned int data_ciphered_sz = 0;
- const void *tmp;
+ const void * tmp;
tmp = data2 ? data2 : data;
if (!eet_cipher(tmp, data_size, cipher_key, strlen(cipher_key),
@@ -2309,19 +2334,24 @@ eet_write_cipher(Eet_File *ef,
on_error:
UNLOCK_FILE(ef);
return 0;
-}
+} /* eet_write_cipher */
EAPI int
-eet_write(Eet_File *ef, const char *name, const void *data, int size, int comp)
+eet_write(Eet_File * ef,
+ const char * name,
+ const void * data,
+ int size,
+ int comp)
{
return eet_write_cipher(ef, name, data, size, comp, NULL);
-}
+} /* eet_write */
EAPI int
-eet_delete(Eet_File *ef, const char *name)
+eet_delete(Eet_File * ef,
+ const char * name)
{
- Eet_File_Node *efn;
- Eet_File_Node *pefn;
+ Eet_File_Node * efn;
+ Eet_File_Node * pefn;
int hash;
int exists_already = 0;
@@ -2363,7 +2393,7 @@ eet_delete(Eet_File *ef, const char *name)
if (efn->free_name)
free(efn->name);
- free(efn);
+ free(efn);
exists_already = 1;
break;
}
@@ -2376,23 +2406,24 @@ eet_delete(Eet_File *ef, const char *name)
/* update access time */
return exists_already;
-}
+} /* eet_delete */
EAPI Eet_Dictionary *
-eet_dictionary_get(Eet_File *ef)
+eet_dictionary_get(Eet_File * ef)
{
if (eet_check_pointer(ef))
return NULL;
return ef->ed;
-}
-
+} /* eet_dictionary_get */
EAPI char **
-eet_list(Eet_File *ef, const char *glob, int *count_ret)
+eet_list(Eet_File * ef,
+ const char * glob,
+ int * count_ret)
{
- Eet_File_Node *efn;
- char **list_ret = NULL;
+ Eet_File_Node * efn;
+ char ** list_ret = NULL;
int list_count = 0;
int list_count_alloc = 0;
int i, num;
@@ -2432,7 +2463,7 @@ eet_list(Eet_File *ef, const char *glob, int *count_ret)
/* only realloc in 32 entry chunks */
if (list_count > list_count_alloc)
{
- char **new_list = NULL;
+ char ** new_list = NULL;
list_count_alloc += 64;
new_list =
@@ -2468,13 +2499,13 @@ on_error:
*count_ret = 0;
return NULL;
-}
+} /* eet_list */
EAPI int
-eet_num_entries(Eet_File *ef)
+eet_num_entries(Eet_File * ef)
{
int i, num, ret = 0;
- Eet_File_Node *efn;
+ Eet_File_Node * efn;
/* check to see its' an eet file pointer */
if (eet_check_pointer(ef) || eet_check_header(ef) ||
@@ -2495,12 +2526,13 @@ eet_num_entries(Eet_File *ef)
UNLOCK_FILE(ef);
return ret;
-}
+} /* eet_num_entries */
static Eet_File_Node *
-find_node_by_name(Eet_File *ef, const char *name)
+find_node_by_name(Eet_File * ef,
+ const char * name)
{
- Eet_File_Node *efn;
+ Eet_File_Node * efn;
int hash;
/* get hash bucket this should be in */
@@ -2513,10 +2545,13 @@ find_node_by_name(Eet_File *ef, const char *name)
}
return NULL;
-}
+} /* find_node_by_name */
static int
-read_data_from_disk(Eet_File *ef, Eet_File_Node *efn, void *buf, int len)
+read_data_from_disk(Eet_File * ef,
+ Eet_File_Node * efn,
+ void * buf,
+ int len)
{
if (efn->offset < 0)
return 0;
@@ -2542,4 +2577,5 @@ read_data_from_disk(Eet_File *ef, Eet_File_Node *efn, void *buf, int len)
}
return len;
-}
+} /* read_data_from_disk */
+
diff --git a/src/lib/eet_node.c b/src/lib/eet_node.c
index 06c2fdb..2588c27 100644
--- a/src/lib/eet_node.c
+++ b/src/lib/eet_node.c
@@ -4,26 +4,26 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
-#endif
+#endif /* ifdef HAVE_CONFIG_H */
#include <string.h>
#include <stdio.h>
#ifdef HAVE_EVIL
# include <Evil.h>
-#endif
+#endif /* ifdef HAVE_EVIL */
#include <Eina.h>
#include "Eet.h"
#include "Eet_private.h"
-static Eina_Mempool *_eet_node_mp = NULL;
+static Eina_Mempool * _eet_node_mp = NULL;
Eet_Node *
eet_node_new(void)
{
- Eet_Node *result;
+ Eet_Node * result;
result = eina_mempool_malloc(_eet_node_mp, sizeof (Eet_Node));
if (!result)
@@ -31,18 +31,19 @@ eet_node_new(void)
memset(result, 0, sizeof (Eet_Node));
return result;
-}
+} /* eet_node_new */
void
-eet_node_free(Eet_Node *node)
+eet_node_free(Eet_Node * node)
{
eina_mempool_free(_eet_node_mp, node);
-}
+} /* eet_node_free */
static Eet_Node *
-_eet_node_new(const char *name, int type)
+_eet_node_new(const char * name,
+ int type)
{
- Eet_Node *n;
+ Eet_Node * n;
n = eet_node_new();
if (!n)
@@ -52,47 +53,47 @@ _eet_node_new(const char *name, int type)
n->name = eina_stringshare_add(name);
return n;
-}
+} /* _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;
+ Eet_Node * value;
+ Eina_List * l;
EINA_LIST_REVERSE_FOREACH(nodes, l, value)
{
value->next = n->values;
n->values = value;
}
-}
-
-#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; \
+} /* _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; \
+#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)
@@ -109,9 +110,9 @@ 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 *
-eet_node_null_new(const char *name)
+eet_node_null_new(const char * name)
{
- Eet_Node *n;
+ Eet_Node * n;
n = _eet_node_new(name, EET_T_NULL);
if (!n)
@@ -123,9 +124,10 @@ eet_node_null_new(const char *name)
}
Eet_Node *
-eet_node_list_new(const char *name, Eina_List *nodes)
+eet_node_list_new(const char * name,
+ Eina_List * nodes)
{
- Eet_Node *n;
+ Eet_Node * n;
n = _eet_node_new(name, EET_G_LIST);
if (!n)
@@ -134,12 +136,14 @@ eet_node_list_new(const char *name, Eina_List *nodes)
_eet_node_append(n, nodes);
return n;
-}
+} /* eet_node_list_new */
Eet_Node *
-eet_node_array_new(const char *name, int count, Eina_List *nodes)
+eet_node_array_new(const char * name,
+ int count,
+ Eina_List * nodes)
{
- Eet_Node *n;
+ Eet_Node * n;
n = _eet_node_new(name, EET_G_ARRAY);
if (!n)
@@ -150,12 +154,13 @@ eet_node_array_new(const char *name, int count, Eina_List *nodes)
_eet_node_append(n, nodes);
return n;
-}
+} /* eet_node_array_new */
Eet_Node *
-eet_node_var_array_new(const char *name, Eina_List *nodes)
+eet_node_var_array_new(const char * name,
+ Eina_List * nodes)
{
- Eet_Node *n;
+ Eet_Node * n;
n = _eet_node_new(name, EET_G_VAR_ARRAY);
if (!n)
@@ -166,13 +171,15 @@ eet_node_var_array_new(const char *name, Eina_List *nodes)
_eet_node_append(n, nodes);
return n;
-}
+} /* eet_node_var_array_new */
Eet_Node *
-eet_node_hash_new(const char *name, const char *key, Eet_Node *node)
+eet_node_hash_new(const char * name,
+ const char * key,
+ Eet_Node * node)
{
- Eina_List *nodes;
- Eet_Node *n;
+ Eina_List * nodes;
+ Eet_Node * n;
if (!node)
return NULL;
@@ -187,12 +194,13 @@ eet_node_hash_new(const char *name, const char *key, Eet_Node *node)
_eet_node_append(n, nodes);
return n;
-}
+} /* eet_node_hash_new */
Eet_Node *
-eet_node_struct_new(const char *name, Eina_List *nodes)
+eet_node_struct_new(const char * name,
+ Eina_List * nodes)
{
- Eet_Node *n;
+ Eet_Node * n;
n = _eet_node_new(name, EET_G_UNKNOWN);
if (!n)
@@ -201,12 +209,13 @@ eet_node_struct_new(const char *name, Eina_List *nodes)
_eet_node_append(n, nodes);
return n;
-}
+} /* eet_node_struct_new */
Eet_Node *
-eet_node_struct_child_new(const char *parent, Eet_Node *child)
+eet_node_struct_child_new(const char * parent,
+ Eet_Node * child)
{
- Eet_Node *n;
+ Eet_Node * n;
if (child->type != EET_G_UNKNOWN)
return child;
@@ -218,20 +227,22 @@ eet_node_struct_child_new(const char *parent, Eet_Node *child)
_eet_node_append(n, eina_list_prepend(NULL, child));
return n;
-}
+} /* eet_node_struct_child_new */
void
-eet_node_list_append(Eet_Node *parent, const char *name, Eet_Node *child)
+eet_node_list_append(Eet_Node * parent,
+ const char * name,
+ Eet_Node * child)
{
- const char *tmp;
- Eet_Node *nn;
+ const char * tmp;
+ Eet_Node * nn;
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;
+ Eet_Node * n;
if (!nn->values)
nn->values = child;
@@ -256,22 +267,24 @@ eet_node_list_append(Eet_Node *parent, const char *name, Eet_Node *child)
nn->next = parent->values;
parent->values = nn;
- eina_stringshare_del(tmp);
-}
+ eina_stringshare_del(tmp);
+} /* eet_node_list_append */
void
-eet_node_struct_append(Eet_Node *parent, const char *name, Eet_Node *child)
+eet_node_struct_append(Eet_Node * parent,
+ const char * name,
+ Eet_Node * child)
{
- const char *tmp;
- Eet_Node *prev;
- Eet_Node *nn;
+ const char * tmp;
+ Eet_Node * prev;
+ Eet_Node * nn;
if (parent->type != EET_G_UNKNOWN)
{
ERR("[%s] is not a structure. Will not insert [%s] in it",
parent->name,
name);
- eet_node_del(child);
+ eet_node_del(child);
return;
}
@@ -302,16 +315,16 @@ eet_node_struct_append(Eet_Node *parent, const char *name, Eet_Node *child)
parent->values = child;
}
- eina_stringshare_del(tmp);
-}
+ eina_stringshare_del(tmp);
+} /* eet_node_struct_append */
void
-eet_node_hash_add(Eet_Node *parent,
- const char *name,
- const char *key,
- Eet_Node *child)
+eet_node_hash_add(Eet_Node * parent,
+ const char * name,
+ const char * key,
+ Eet_Node * child)
{
- Eet_Node *nn;
+ Eet_Node * nn;
/* No list found, so create it. */
nn = eet_node_hash_new(name, key, child);
@@ -319,13 +332,13 @@ eet_node_hash_add(Eet_Node *parent,
/* And add it to the parent. */
nn->next = parent->values;
parent->values = nn;
-}
+} /* eet_node_hash_add */
void
-eet_node_del(Eet_Node *n)
+eet_node_del(Eet_Node * n)
{
- Eet_Node *nn;
- Eet_Node *tmp;
+ Eet_Node * nn;
+ Eet_Node * tmp;
if (!n)
return;
@@ -362,13 +375,13 @@ eet_node_del(Eet_Node *n)
case EET_T_USHORT:
case EET_T_UINT:
break;
- }
+ } /* switch */
- eina_stringshare_del(n->name);
- eet_node_free(n);
-}
+ eina_stringshare_del(n->name);
+ eet_node_free(n);
+} /* eet_node_del */
-static const char *eet_node_dump_g_name[6] = {
+static const char * eet_node_dump_g_name[6] = {
"struct",
"array",
"var_array",
@@ -377,7 +390,7 @@ static const char *eet_node_dump_g_name[6] = {
"???"
};
-static const char *eet_node_dump_t_name[14][2] = {
+static const char * eet_node_dump_t_name[14][2] = {
{ "???: ", "???" },
{ "char: ", "%hhi" },
{ "short: ", "%hi" },
@@ -393,20 +406,20 @@ static const char *eet_node_dump_t_name[14][2] = {
};
static void
-eet_node_dump_level(int level, void (*dumpfunc)(void *data,
- const char *str),
- void *dumpdata)
+eet_node_dump_level(int level,
+ void (* dumpfunc)(void * data, const char * str),
+ void * dumpdata)
{
int i;
for (i = 0; i < level; i++) dumpfunc(dumpdata, " ");
-}
+} /* eet_node_dump_level */
static char *
-eet_node_string_escape(const char *str)
+eet_node_string_escape(const char * str)
{
- char *s, *sp;
- const char *strp;
+ char * s, * sp;
+ const char * strp;
int sz = 0;
for (strp = str; *strp; strp++)
@@ -441,14 +454,14 @@ eet_node_string_escape(const char *str)
}
*sp = 0;
return s;
-}
+} /* eet_node_string_escape */
static void
-eet_node_dump_string_escape(void *dumpdata, void dumpfunc(void *data,
- const char *str),
- const char *str)
+eet_node_dump_string_escape(void * dumpdata,
+ void dumpfunc(void * data, const char * str),
+ const char * str)
{
- char *s;
+ char * s;
s = eet_node_string_escape(str);
if (!s)
@@ -456,35 +469,35 @@ eet_node_dump_string_escape(void *dumpdata, void dumpfunc(void *data,
dumpfunc(dumpdata, s);
free(s);
-}
+} /* eet_node_dump_string_escape */
static void
-eet_node_dump_simple_type(Eet_Node *n, int level,
- void (*dumpfunc)(void *data,
- const char *str), void *dumpdata)
+eet_node_dump_simple_type(Eet_Node * n, int level,
+ void (* dumpfunc)(void * data, const char * str),
+ void * dumpdata)
{
- const char *type_name = NULL;
+ const char * type_name = NULL;
char tbuf[256];
eet_node_dump_level(level, dumpfunc, dumpdata);
dumpfunc(dumpdata, "value \"");
eet_node_dump_string_escape(dumpdata, dumpfunc, n->name);
- dumpfunc(dumpdata, "\" ");
+ dumpfunc(dumpdata, "\" ");
#ifdef EET_T_TYPE
# undef EET_T_TYPE
-#endif
-
-#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; \
+#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;\
}
switch (n->type)
@@ -519,16 +532,17 @@ eet_node_dump_simple_type(Eet_Node *n, int level,
default:
dumpfunc(dumpdata, "???: ???");
break;
- }
+ } /* switch */
- dumpfunc(dumpdata, ";\n");
-}
+ dumpfunc(dumpdata, ";\n");
+} /* eet_node_dump_simple_type */
static void
-eet_node_dump_group_start(int level, void (*dumpfunc)(void *data,
- const char *str),
- void *dumpdata,
- int group_type, const char *name)
+eet_node_dump_group_start(int level,
+ void (* dumpfunc)(void * data, const char * str),
+ void * dumpdata,
+ int group_type,
+ const char * name)
{
int chnk_type;
@@ -542,23 +556,24 @@ eet_node_dump_group_start(int level, void (*dumpfunc)(void *data,
dumpfunc(dumpdata, eet_node_dump_g_name[chnk_type - EET_G_UNKNOWN]);
dumpfunc(dumpdata, " {\n");
-}
+} /* eet_node_dump_group_start */
static void
-eet_node_dump_group_end(int level, void (*dumpfunc)(void *data,
- const char *str),
- void *dumpdata)
+eet_node_dump_group_end(int level,
+ void (* dumpfunc)(void * data, const char * str),
+ 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, void (*dumpfunc)(void *data,
- const char *str),
- void *dumpdata)
+eet_node_dump(Eet_Node * n,
+ int dumplevel,
+ void (* dumpfunc)(void * data, const char * str),
+ void * dumpdata)
{
- Eet_Node *it;
+ Eet_Node * it;
if (!n)
return;
@@ -615,18 +630,18 @@ eet_node_dump(Eet_Node *n, int dumplevel, void (*dumpfunc)(void *data,
case EET_T_ULONG_LONG:
eet_node_dump_simple_type(n, dumplevel, dumpfunc, dumpdata);
break;
- }
-}
+ } /* switch */
+} /* eet_node_dump */
void *
-eet_node_walk(void *parent,
- const char *name,
- Eet_Node *root,
- Eet_Node_Walk *cb,
- void *user_data)
+eet_node_walk(void * parent,
+ const char * name,
+ Eet_Node * root,
+ Eet_Node_Walk * cb,
+ void * user_data)
{
- Eet_Node *it;
- void *me = NULL;
+ Eet_Node * it;
+ void * me = NULL;
int i;
if (!root)
@@ -643,7 +658,7 @@ eet_node_walk(void *parent,
me = cb->struct_alloc(root->name, user_data);
for (it = root->values; it != NULL; it = it->next)
- eet_node_walk(me, it->name, it, cb, user_data);
+ eet_node_walk(me, it->name, it, cb, user_data);
break;
@@ -698,19 +713,19 @@ eet_node_walk(void *parent,
case EET_T_ULONG_LONG:
me = cb->simple(root->type, &root->data, user_data);
break;
- }
+ } /* switch */
if (parent)
cb->struct_add(parent, name, me, user_data);
return me;
-}
+} /* eet_node_walk */
int
eet_node_init(void)
{
- const char *choice;
- const char *tmp;
+ const char * choice;
+ const char * tmp;
choice = "chained_mempool";
tmp = getenv("EET_MEMPOOL");
@@ -721,11 +736,12 @@ eet_node_init(void)
eina_mempool_add(choice, "eet-node-alloc", NULL, sizeof(Eet_Node), 1024);
return _eet_node_mp ? 1 : 0;
-}
+} /* eet_node_init */
void
eet_node_shutdown(void)
{
eina_mempool_del(_eet_node_mp);
_eet_node_mp = NULL;
-}
+} /* eet_node_shutdown */
+
diff --git a/src/lib/eet_utils.c b/src/lib/eet_utils.c
index 4d7b9db..624bfae 100644
--- a/src/lib/eet_utils.c
+++ b/src/lib/eet_utils.c
@@ -4,7 +4,7 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
-#endif
+#endif /* ifdef HAVE_CONFIG_H */
#include <stdio.h>
#include <math.h>
@@ -13,12 +13,13 @@
#include "Eet_private.h"
int
-_eet_hash_gen(const char *key, int hash_size)
+_eet_hash_gen(const char * key,
+ int hash_size)
{
int hash_num = 0;
int value, i;
int mask;
- unsigned char *ptr;
+ unsigned char * ptr;
/* no string - index 0 */
if (!key)
@@ -35,5 +36,5 @@ _eet_hash_gen(const char *key, int hash_size)
hash_num &= mask;
/* return it */
return hash_num;
-}
+} /* _eet_hash_gen */
diff --git a/src/tests/eet_data_suite.c b/src/tests/eet_data_suite.c
index 65f08ba..5ec7e01 100644
--- a/src/tests/eet_data_suite.c
+++ b/src/tests/eet_data_suite.c
@@ -6,28 +6,28 @@
#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;
-}
+} /* _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);
-}
+} /* _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);
@@ -37,17 +37,17 @@ _eet_eina_hash_add(Eina_Hash *hash, const char *key, const void *data)
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);
-}
+} /* _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;
@@ -63,5 +63,5 @@ eet_test_setup_eddc(Eet_Data_Descriptor_Class *eddc)
eddc->func.hash_free = (void *)_eet_eina_hash_free;
eddc->func.str_direct_alloc = (void *)_eet_str_direct_alloc;
eddc->func.str_direct_free = (void *)_eet_str_direct_free;
-}
+} /* eet_test_setup_eddc */
diff --git a/src/tests/eet_suite.c b/src/tests/eet_suite.c
index 768fddf..f40a20c 100644
--- a/src/tests/eet_suite.c
+++ b/src/tests/eet_suite.c
@@ -1,7 +1,7 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
-#endif
+#endif /* ifdef HAVE_CONFIG_H */
#include <sys/types.h>
#include <sys/stat.h>
@@ -14,7 +14,7 @@
#ifdef EFL_HAVE_POSIX_THREADS
# include <pthread.h>
-#endif
+#endif /* ifdef EFL_HAVE_POSIX_THREADS */
#include <check.h>
@@ -27,57 +27,57 @@ START_TEST(eet_test_init)
int ret;
ret = eet_init();
- fail_if(ret != 1);
+ fail_if(ret != 1);
ret = eet_shutdown();
- fail_if(ret != 0);
+ fail_if(ret != 0);
}
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
-#define EET_TEST_SHORT 0x4224
-#define EET_TEST_INT 0x42211224
-#define EET_TEST_LONG_LONG 0x84CB42211224BC48
-#define EET_TEST_STRING "my little test with escape \\\""
-#define EET_TEST_KEY1 "key1"
-#define EET_TEST_KEY2 "key2"
-#define EET_TEST_FLOAT 123.45689
-#define EET_TEST_FLOAT2 1.0
-#define EET_TEST_FLOAT3 0.25
-#define EET_TEST_FLOAT4 0.0001234
-#define EET_TEST_DOUBLE 123456789.9876543210
-#define EET_TEST_DOUBLE2 1.0
-#define EET_TEST_DOUBLE3 0.25
-#define EET_TEST_FILE_KEY1 "keys/data/1"
-#define EET_TEST_FILE_KEY2 "keys/data/2"
+#define EET_TEST_CHAR 0x42
+#define EET_TEST_SHORT 0x4224
+#define EET_TEST_INT 0x42211224
+#define EET_TEST_LONG_LONG 0x84CB42211224BC48
+#define EET_TEST_STRING "my little test with escape \\\""
+#define EET_TEST_KEY1 "key1"
+#define EET_TEST_KEY2 "key2"
+#define EET_TEST_FLOAT 123.45689
+#define EET_TEST_FLOAT2 1.0
+#define EET_TEST_FLOAT3 0.25
+#define EET_TEST_FLOAT4 0.0001234
+#define EET_TEST_DOUBLE 123456789.9876543210
+#define EET_TEST_DOUBLE2 1.0
+#define EET_TEST_DOUBLE3 0.25
+#define EET_TEST_FILE_KEY1 "keys/data/1"
+#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;
unsigned int h;
- int alpha;
+ int alpha;
unsigned int color[64];
};
@@ -126,7 +126,7 @@ 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;
@@ -146,7 +146,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);
@@ -168,46 +168,46 @@ _eet_test_basic_set(Eet_Test_Basic_Type *res, int i)
tmp->empty = NULL;
tmp->with = NULL;
}
-}
+} /* _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;
- fail_if(result->c != EET_TEST_CHAR);
- fail_if(result->s != EET_TEST_SHORT);
- fail_if(result->i != EET_TEST_INT + i);
- fail_if(result->l != (long long)EET_TEST_LONG_LONG);
- fail_if(strcmp(result->str, EET_TEST_STRING) != 0);
- fail_if(strcmp(result->istr, EET_TEST_STRING) != 0);
- fail_if(result->uc != EET_TEST_CHAR);
- fail_if(result->us != EET_TEST_SHORT);
- fail_if(result->ui != EET_TEST_INT);
- fail_if(result->ul != EET_TEST_LONG_LONG);
+ fail_if(result->c != EET_TEST_CHAR);
+ fail_if(result->s != EET_TEST_SHORT);
+ fail_if(result->i != EET_TEST_INT + i);
+ fail_if(result->l != (long long)EET_TEST_LONG_LONG);
+ fail_if(strcmp(result->str, EET_TEST_STRING) != 0);
+ fail_if(strcmp(result->istr, EET_TEST_STRING) != 0);
+ fail_if(result->uc != EET_TEST_CHAR);
+ fail_if(result->us != EET_TEST_SHORT);
+ fail_if(result->ui != EET_TEST_INT);
+ fail_if(result->ul != EET_TEST_LONG_LONG);
tmp = (result->f1 + EET_TEST_FLOAT);
if (tmp < 0)
tmp = -tmp;
- fail_if(tmp > 0.005);
+ fail_if(tmp > 0.005);
tmp = (result->f2 - EET_TEST_FLOAT4);
if (tmp < 0)
tmp = -tmp;
- fail_if(tmp > 0.005);
+ fail_if(tmp > 0.005);
tmp = (result->d + EET_TEST_DOUBLE);
if (tmp < 0)
tmp = -tmp;
- fail_if(tmp > 0.00005);
+ fail_if(tmp > 0.00005);
- fail_if(result->empty != NULL);
+ 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);
@@ -224,11 +224,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,
@@ -298,15 +298,15 @@ _eet_build_basic_descriptor(Eet_Data_Descriptor *edd)
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_build_basic_descriptor */
- START_TEST(eet_test_basic_data_type_encoding_decoding)
+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();
@@ -339,52 +339,51 @@ _eet_build_basic_descriptor(Eet_Data_Descriptor *edd)
}
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";
@@ -521,10 +520,10 @@ _eet_build_ex_descriptor(Eet_Data_Descriptor *edd)
eet_data_descriptor_element_add(edd, "shash", EET_T_STRING, EET_G_HASH,
(char *)(&(etbt.shash)) - (char *)(&(etbt)),
0, /* 0, */ NULL, NULL);
-}
+} /* _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;
@@ -579,10 +578,10 @@ _eet_test_ex_set(Eet_Test_Ex_Type *res, int offset)
res->ul = EET_TEST_LONG_LONG + offset;
return res;
-}
+} /* _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;
@@ -669,12 +668,12 @@ _eet_test_ex_check(Eet_Test_Ex_Type *stuff, int offset)
}
return 0;
-}
+} /* _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)
@@ -684,16 +683,16 @@ func(__UNUSED__ const Eina_Hash *hash, const void *key, void *data, void *fdata)
*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)
@@ -703,13 +702,13 @@ func7(__UNUSED__ const Eina_Hash *hash,
*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;
@@ -772,9 +771,9 @@ 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)
@@ -784,18 +783,18 @@ append_string(void *data, const char *str)
*string = realloc(*string, strlen(str) + length + 1);
memcpy((*string) + length, str, strlen(str) + 1);
-}
+} /* append_string */
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;
@@ -876,10 +875,10 @@ 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();
@@ -938,17 +937,18 @@ START_TEST(eet_file_simple_write)
fail_if(unlink(file) != 0);
eet_shutdown();
-}
+} /* 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;
@@ -1053,18 +1053,18 @@ START_TEST(eet_file_data_test)
if (result->ihash)
eina_hash_foreach(result->ihash, func7, &test);
- fail_if(test != 0);
+ fail_if(test != 0);
list = eet_list(ef, "keys/*", &size);
- fail_if(eet_num_entries(ef) != 2);
- fail_if(size != 2);
- fail_if(!(strcmp(list[0],
+ fail_if(eet_num_entries(ef) != 2);
+ fail_if(size != 2);
+ fail_if(!(strcmp(list[0],
EET_TEST_FILE_KEY1) == 0 &&
- strcmp(list[1], EET_TEST_FILE_KEY2) == 0)
+ strcmp(list[1], EET_TEST_FILE_KEY2) == 0)
&& !(strcmp(list[0],
EET_TEST_FILE_KEY2) == 0 &&
strcmp(list[1], EET_TEST_FILE_KEY1) == 0));
- free(list);
+ free(list);
fail_if(eet_delete(ef, NULL) != 0);
fail_if(eet_delete(NULL, EET_TEST_FILE_KEY1) != 0);
@@ -1088,18 +1088,19 @@ START_TEST(eet_file_data_test)
fail_if(unlink(file) != 0);
eet_shutdown();
-}
+} /* 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();
@@ -1183,14 +1184,15 @@ START_TEST(eet_file_data_dump_test)
fail_if(unlink(file) != 0);
eet_shutdown();
-}
+} /* 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;
@@ -1540,7 +1542,8 @@ START_TEST(eet_image)
fail_if(unlink(file) != 0);
eet_shutdown();
-}
+} /* START_TEST */
+
END_TEST
#define IM0 0x00112233
@@ -1550,10 +1553,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;
@@ -1604,18 +1607,19 @@ START_TEST(eet_small_image)
free(data);
eet_shutdown();
-}
+} /* 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;
@@ -1680,49 +1684,52 @@ START_TEST(eet_identity_simple)
fail_if(unlink(file) != 0);
eet_shutdown();
-}
+} /* START_TEST */
+
END_TEST
START_TEST(eet_identity_open_simple)
{
- Eet_Key *k = NULL;
+ Eet_Key * k = NULL;
eet_init();
- fail_if(chdir("src/tests"));
+ fail_if(chdir("src/tests"));
k = eet_identity_open("cert.pem", "key.pem", NULL);
- fail_if(!k);
+ fail_if(!k);
if (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();
- fail_if(chdir("src/tests"));
+ fail_if(chdir("src/tests"));
k = eet_identity_open("cert.pem", "key_enc_none.pem", NULL);
- fail_if(!k);
+ fail_if(!k);
if (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);
@@ -1731,12 +1738,12 @@ static int pass_get(char *pass,
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);
@@ -1745,19 +1752,18 @@ static int badpass_get(char *pass,
snprintf(pass, size, "%s", "bad password");
return strlen(pass);
-}
-
+} /* badpass_get */
START_TEST(eet_identity_open_pkcs8_enc)
{
- Eet_Key *k = NULL;
+ Eet_Key * k = NULL;
eet_init();
- fail_if(chdir("src/tests"));
+ fail_if(chdir("src/tests"));
k = eet_identity_open("cert.pem", "key_enc.pem", NULL);
- fail_if(k);
+ fail_if(k);
if (k)
eet_identity_close(k);
@@ -1780,12 +1786,12 @@ 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();
@@ -1816,19 +1822,20 @@ START_TEST(eet_cipher_decipher_simple)
/* Decrypt an eet file. */
ef = eet_open(file, EET_FILE_MODE_READ);
- fail_if(!ef);
+ fail_if(!ef);
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);
- eet_close(ef);
+ eet_close(ef);
fail_if(unlink(file) != 0);
eet_shutdown();
-}
+} /* START_TEST */
+
END_TEST
#ifdef EFL_HAVE_THREADS
@@ -1838,13 +1845,13 @@ static Eina_Bool open_worker_stop;
# ifdef EFL_HAVE_POSIX_THREADS
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);
@@ -1853,19 +1860,19 @@ open_close_worker(void *path)
}
}
- pthread_exit(NULL);
-}
+ pthread_exit(NULL);
+} /* open_close_worker */
-# else
+# else /* ifdef EFL_HAVE_POSIX_THREADS */
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);
@@ -1874,25 +1881,25 @@ open_close_worker(void *path)
}
}
- _endthreadex(0);
-}
+ _endthreadex(0);
+} /* open_close_worker */
-# endif
+# endif /* ifdef EFL_HAVE_POSIX_THREADS */
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 EFL_HAVE_POSIX_THREADS
pthread_t thread;
-# else
+# else /* ifdef EFL_HAVE_POSIX_THREADS */
uintptr_t thread;
unsigned int thread_id;
DWORD ret;
-# endif
+# endif /* ifdef EFL_HAVE_POSIX_THREADS */
eet_init();
@@ -1906,9 +1913,9 @@ START_TEST(eet_cache_concurrency)
open_worker_stop = 0;
# ifdef EFL_HAVE_POSIX_THREADS
pthread_create(&thread, NULL, open_close_worker, file);
-# else
+# else /* ifdef EFL_HAVE_POSIX_THREADS */
thread = _beginthreadex(NULL, 0, open_close_worker, file, 0, &thread_id);
-# endif
+# endif /* ifdef EFL_HAVE_POSIX_THREADS */
/* clear the cache repeatedly in this thread */
for (n = 0; n < 50000; ++n)
{
@@ -1920,12 +1927,12 @@ START_TEST(eet_cache_concurrency)
# ifdef EFL_HAVE_POSIX_THREADS
fail_if(pthread_join(thread, &thread_ret) != 0);
fail_unless(thread_ret == NULL, (char const *)thread_ret);
-# else
+# else /* ifdef EFL_HAVE_POSIX_THREADS */
ret = WaitForSingleObject((HANDLE)thread, INFINITE);
fail_if(ret != WAIT_OBJECT_0);
fail_if(GetExitCodeThread((HANDLE)thread, &ret) == FALSE);
fail_if(ret != 0);
-# endif
+# endif /* ifdef EFL_HAVE_POSIX_THREADS */
fail_if(unlink(file) != 0);
eet_shutdown();
@@ -1934,20 +1941,20 @@ END_TEST
#endif /* EFL_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);
@@ -1973,7 +1980,7 @@ _eet_connection_read(const void *eet_data, size_t size, void *user_data)
if (result->ihash)
eina_hash_foreach(result->ihash, func7, &test);
- fail_if(test != 0);
+ fail_if(test != 0);
if (!dt->test)
{
@@ -1982,12 +1989,12 @@ _eet_connection_read(const void *eet_data, size_t size, void *user_data)
}
return EINA_TRUE;
-}
+} /* _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)
@@ -2005,12 +2012,12 @@ _eet_connection_write(const void *data, size_t size, void *user_data)
fail_if(still);
return EINA_TRUE;
-}
+} /* _eet_connection_write */
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;
@@ -2069,31 +2076,31 @@ struct _Eet_5FP
{
Eina_F32p32 fp32;
Eina_F16p16 fp16;
- Eina_F8p24 fp8;
+ Eina_F8p24 fp8;
Eina_F32p32 f1;
Eina_F32p32 f0;
};
-typedef struct _Eet_5FP Eet_5FP;
+typedef struct _Eet_5FP Eet_5FP;
struct _Eet_5DBL
{
double fp32;
double fp16;
- float fp8;
+ float fp8;
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();
@@ -2149,14 +2156,14 @@ 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();
@@ -2214,19 +2221,20 @@ START_TEST(eet_file_fp)
fail_if(unlink(file) != 0);
eet_shutdown();
-}
+} /* START_TEST */
+
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
{
@@ -2238,8 +2246,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" },
@@ -2250,13 +2258,13 @@ struct
struct _Eet_St1
{
double val1;
- int stuff;
- char *s1;
+ int stuff;
+ char * s1;
};
struct _Eet_St2
{
- Eina_Bool b1;
+ Eina_Bool b1;
unsigned long long v1;
};
@@ -2278,43 +2286,43 @@ 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
{
Eet_Union type;
- Eet_St1 st1;
+ Eet_St1 st1;
};
struct _Eet_Inherit_Test2
{
Eet_Union type;
- Eet_St2 st2;
+ Eet_St2 st2;
};
struct _Eet_Inherit_Test3
{
Eet_Union type;
- Eet_St3 st3;
+ Eet_St3 st3;
};
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)
@@ -2328,12 +2336,12 @@ _eet_union_type_get(const void *data, Eina_Bool *unknow)
*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)
@@ -2347,12 +2355,12 @@ _eet_union_type_set(const char *type, void *data, Eina_Bool unknow)
}
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)
@@ -2366,23 +2374,23 @@ _eet_variant_type_get(const void *data, Eina_Bool *unknow)
*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;
return EINA_TRUE;
-}
+} /* _eet_variant_type_set */
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);
@@ -2391,18 +2399,18 @@ _eet_st1_dd(void)
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;
st1->s1 = EET_TEST_STRING;
-}
+} /* _eet_st1_set */
static void
-_eet_st1_cmp(Eet_St1 *st1, int i)
+_eet_st1_cmp(Eet_St1 * st1, int i)
{
double tmp;
@@ -2415,13 +2423,13 @@ _eet_st1_cmp(Eet_St1 *st1, int i)
fail_if(tmp > 0.005);
fail_if(st1->stuff != EET_TEST_INT + i);
fail_if(strcmp(st1->s1, EET_TEST_STRING));
-}
+} /* _eet_st1_cmp */
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);
@@ -2429,56 +2437,56 @@ _eet_st2_dd(void)
EET_DATA_DESCRIPTOR_ADD_BASIC(res, Eet_St2, "v1", v1, EET_T_ULONG_LONG);
return res;
-}
+} /* _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);
-}
+} /* _eet_st2_cmp */
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);
EET_DATA_DESCRIPTOR_ADD_BASIC(res, Eet_St3, "boby", boby, EET_T_INT);
return res;
-}
+} /* _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;
@@ -2506,9 +2514,9 @@ 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; \
+#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)
@@ -2531,9 +2539,9 @@ 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); \
+#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)
@@ -2543,23 +2551,23 @@ START_TEST(eet_test_union)
EUT_CMP(3);
}
- eet_shutdown();
+ eet_shutdown();
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;
@@ -2603,11 +2611,11 @@ 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); \
+#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)
@@ -2634,9 +2642,9 @@ 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); \
+#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)
@@ -2653,16 +2661,17 @@ START_TEST(eet_test_variant)
EVT_CMP(3);
}
- eet_shutdown();
+ eet_shutdown();
eina_shutdown();
-}
+} /* START_TEST */
+
END_TEST
Suite *
eet_suite(void)
{
- Suite *s;
- TCase *tc;
+ Suite * s;
+ TCase * tc;
s = suite_create("Eet");
@@ -2698,32 +2707,32 @@ eet_suite(void)
tcase_add_test(tc, eet_identity_open_pkcs8);
tcase_add_test(tc, eet_identity_open_pkcs8_enc);
suite_add_tcase(s, tc);
-#endif
+#endif /* ifdef HAVE_SIGNATURE */
#ifdef HAVE_CIPHER
tc = tcase_create("Eet Cipher");
tcase_add_test(tc, eet_cipher_decipher_simple);
suite_add_tcase(s, tc);
-#endif
+#endif /* ifdef HAVE_CIPHER */
#ifdef EFL_HAVE_THREADS
tc = tcase_create("Eet Cache");
tcase_add_test(tc, eet_cache_concurrency);
suite_add_tcase(s, tc);
-#endif
+#endif /* ifdef EFL_HAVE_THREADS */
tc = tcase_create("Eet Connection");
tcase_add_test(tc, eet_connection_check);
suite_add_tcase(s, tc);
return s;
-}
+} /* eet_suite */
int
main(void)
{
- Suite *s;
- SRunner *sr;
+ Suite * s;
+ SRunner * sr;
int failed_count;
s = eet_suite();
@@ -2733,4 +2742,5 @@ main(void)
srunner_free(sr);
return (failed_count == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
-}
+} /* main */
+
diff --git a/src/tests/eet_suite.h b/src/tests/eet_suite.h
index 85b7542..a0f5ed3 100644
--- a/src/tests/eet_suite.h
+++ b/src/tests/eet_suite.h
@@ -3,7 +3,6 @@
#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 */