forked from enlightenment/efl
ran ecrustify on eet. this seems to do a good job of eet. comments?
SVN revision: 64237
This commit is contained in:
parent
a331fe3bca
commit
8893a9ff35
|
@ -44,11 +44,11 @@ static int _eet_main_log_dom = -1;
|
|||
#define CRIT(...) EINA_LOG_DOM_CRIT(_eet_main_log_dom, __VA_ARGS__)
|
||||
|
||||
static void
|
||||
do_eet_list(const char * file)
|
||||
do_eet_list(const char *file)
|
||||
{
|
||||
int i, num;
|
||||
char ** list;
|
||||
Eet_File * ef;
|
||||
char **list;
|
||||
Eet_File *ef;
|
||||
|
||||
ef = eet_open(file, EET_FILE_MODE_READ);
|
||||
if (!ef)
|
||||
|
@ -61,7 +61,7 @@ do_eet_list(const char * file)
|
|||
if (list)
|
||||
{
|
||||
for (i = 0; i < num; i++)
|
||||
printf("%s\n",list[i]);
|
||||
printf("%s\n", list[i]);
|
||||
free(list);
|
||||
}
|
||||
|
||||
|
@ -69,15 +69,15 @@ do_eet_list(const char * file)
|
|||
} /* do_eet_list */
|
||||
|
||||
static void
|
||||
do_eet_extract(const char * file,
|
||||
const char * key,
|
||||
const char * out,
|
||||
const char * crypto_key)
|
||||
do_eet_extract(const char *file,
|
||||
const char *key,
|
||||
const char *out,
|
||||
const char *crypto_key)
|
||||
{
|
||||
Eet_File * ef;
|
||||
void * data;
|
||||
Eet_File *ef;
|
||||
void *data;
|
||||
int size = 0;
|
||||
FILE * f;
|
||||
FILE *f;
|
||||
|
||||
ef = eet_open(file, EET_FILE_MODE_READ);
|
||||
if (!ef)
|
||||
|
@ -112,19 +112,20 @@ do_eet_extract(const char * file,
|
|||
} /* do_eet_extract */
|
||||
|
||||
static void
|
||||
do_eet_decode_dump(void * data, const char * str)
|
||||
do_eet_decode_dump(void *data,
|
||||
const char *str)
|
||||
{
|
||||
fputs(str, (FILE *)data);
|
||||
} /* do_eet_decode_dump */
|
||||
|
||||
static void
|
||||
do_eet_decode(const char * file,
|
||||
const char * key,
|
||||
const char * out,
|
||||
const char * crypto_key)
|
||||
do_eet_decode(const char *file,
|
||||
const char *key,
|
||||
const char *out,
|
||||
const char *crypto_key)
|
||||
{
|
||||
Eet_File * ef;
|
||||
FILE * f;
|
||||
Eet_File *ef;
|
||||
FILE *f;
|
||||
|
||||
ef = eet_open(file, EET_FILE_MODE_READ);
|
||||
if (!ef)
|
||||
|
@ -151,16 +152,16 @@ do_eet_decode(const char * file,
|
|||
} /* do_eet_decode */
|
||||
|
||||
static void
|
||||
do_eet_insert(const char * file,
|
||||
const char * key,
|
||||
const char * out,
|
||||
do_eet_insert(const char *file,
|
||||
const char *key,
|
||||
const char *out,
|
||||
int compress,
|
||||
const char * crypto_key)
|
||||
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)
|
||||
|
@ -202,17 +203,17 @@ do_eet_insert(const char * file,
|
|||
} /* do_eet_insert */
|
||||
|
||||
static void
|
||||
do_eet_encode(const char * file,
|
||||
const char * key,
|
||||
const char * out,
|
||||
do_eet_encode(const char *file,
|
||||
const char *key,
|
||||
const char *out,
|
||||
int compress,
|
||||
const char * crypto_key)
|
||||
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)
|
||||
|
@ -259,9 +260,10 @@ do_eet_encode(const char * file,
|
|||
} /* do_eet_encode */
|
||||
|
||||
static void
|
||||
do_eet_remove(const char * file, const char * key)
|
||||
do_eet_remove(const char *file,
|
||||
const char *key)
|
||||
{
|
||||
Eet_File * ef;
|
||||
Eet_File *ef;
|
||||
|
||||
ef = eet_open(file, EET_FILE_MODE_READ_WRITE);
|
||||
if (!ef)
|
||||
|
@ -275,10 +277,10 @@ do_eet_remove(const char * file, const char * key)
|
|||
} /* do_eet_remove */
|
||||
|
||||
static void
|
||||
do_eet_check(const char * file)
|
||||
do_eet_check(const char *file)
|
||||
{
|
||||
Eet_File * ef;
|
||||
const void * der;
|
||||
Eet_File *ef;
|
||||
const void *der;
|
||||
int der_length;
|
||||
int sign_length;
|
||||
|
||||
|
@ -301,10 +303,12 @@ do_eet_check(const char * file)
|
|||
} /* do_eet_check */
|
||||
|
||||
static void
|
||||
do_eet_sign(const char * file, const char * private_key, const char * public_key)
|
||||
do_eet_sign(const char *file,
|
||||
const char *private_key,
|
||||
const char *public_key)
|
||||
{
|
||||
Eet_File * ef;
|
||||
Eet_Key * key;
|
||||
Eet_File *ef;
|
||||
Eet_Key *key;
|
||||
|
||||
ef = eet_open(file, EET_FILE_MODE_READ_WRITE);
|
||||
if (!ef)
|
||||
|
@ -329,7 +333,8 @@ do_eet_sign(const char * file, const char * private_key, const char * public_key
|
|||
} /* do_eet_sign */
|
||||
|
||||
int
|
||||
main(int argc, char ** argv)
|
||||
main(int argc,
|
||||
char **argv)
|
||||
{
|
||||
if (!eet_init())
|
||||
return -1;
|
||||
|
@ -339,7 +344,7 @@ main(int argc, char ** argv)
|
|||
{
|
||||
EINA_LOG_ERR("Impossible to create a log domain for eet_main.");
|
||||
eet_shutdown();
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (argc < 2)
|
||||
|
|
|
@ -37,3 +37,4 @@ main(void)
|
|||
|
||||
eet_shutdown();
|
||||
}
|
||||
|
||||
|
|
|
@ -106,14 +106,14 @@ main(void)
|
|||
|
||||
eet_close(ef);
|
||||
|
||||
error:
|
||||
error:
|
||||
if (unlink(file) != 0)
|
||||
{
|
||||
fprintf(
|
||||
stderr, "ERROR: could not unlink file (%s).\n", file);
|
||||
}
|
||||
|
||||
panic:
|
||||
panic:
|
||||
eet_shutdown();
|
||||
}
|
||||
|
||||
|
|
|
@ -82,8 +82,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);
|
||||
|
@ -94,15 +94,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);
|
||||
|
@ -115,8 +115,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
|
||||
|
@ -138,7 +138,7 @@ _my_cache_descriptor_shutdown(void)
|
|||
// need to check if the pointer came from mmaped area in eet_dictionary
|
||||
// or it was allocated with eina_stringshare_add()
|
||||
static void
|
||||
_eet_string_free(const char * str)
|
||||
_eet_string_free(const char *str)
|
||||
{
|
||||
if (!str)
|
||||
return;
|
||||
|
@ -150,9 +150,9 @@ _eet_string_free(const char * str)
|
|||
} /* _eet_string_free */
|
||||
|
||||
static My_Message *
|
||||
_my_message_new(const char * message)
|
||||
_my_message_new(const char *message)
|
||||
{
|
||||
My_Message * msg = calloc(1, sizeof(My_Message));
|
||||
My_Message *msg = calloc(1, sizeof(My_Message));
|
||||
if (!msg)
|
||||
{
|
||||
fprintf(stderr, "ERROR: could not calloc My_Message\n");
|
||||
|
@ -164,7 +164,7 @@ _my_message_new(const char * message)
|
|||
} /* _my_message_new */
|
||||
|
||||
static void
|
||||
_my_message_free(My_Message * msg)
|
||||
_my_message_free(My_Message *msg)
|
||||
{
|
||||
_eet_string_free(msg->screen_name);
|
||||
_eet_string_free(msg->name);
|
||||
|
@ -173,7 +173,8 @@ _my_message_free(My_Message * msg)
|
|||
} /* _my_message_free */
|
||||
|
||||
static Eina_Bool
|
||||
_my_post_add(My_Account *acc, const char * message)
|
||||
_my_post_add(My_Account *acc,
|
||||
const char *message)
|
||||
{
|
||||
int new_count = acc->posts_count + 1;
|
||||
My_Post *post = realloc(acc->posts, new_count * sizeof(My_Post));
|
||||
|
@ -187,20 +188,20 @@ _my_post_add(My_Account *acc, const char * message)
|
|||
post[acc->posts_count].dm_to = NULL;
|
||||
acc->posts_count = new_count;
|
||||
acc->posts = post;
|
||||
return EINA_TRUE;;
|
||||
return EINA_TRUE;
|
||||
} /* _my_post_new */
|
||||
|
||||
static void
|
||||
_my_post_free(My_Post * post)
|
||||
_my_post_free(My_Post *post)
|
||||
{
|
||||
_eet_string_free(post->dm_to);
|
||||
_eet_string_free(post->message);
|
||||
} /* _my_post_free */
|
||||
|
||||
static My_Account *
|
||||
_my_account_new(const char * name)
|
||||
_my_account_new(const char *name)
|
||||
{
|
||||
My_Account * acc = calloc(1, sizeof(My_Account));
|
||||
My_Account *acc = calloc(1, sizeof(My_Account));
|
||||
if (!acc)
|
||||
{
|
||||
fprintf(stderr, "ERROR: could not calloc My_Account\n");
|
||||
|
@ -212,9 +213,9 @@ _my_account_new(const char * name)
|
|||
} /* _my_account_new */
|
||||
|
||||
static void
|
||||
_my_account_free(My_Account * acc)
|
||||
_my_account_free(My_Account *acc)
|
||||
{
|
||||
My_Message * m;
|
||||
My_Message *m;
|
||||
int i;
|
||||
|
||||
_eet_string_free(acc->name);
|
||||
|
@ -232,7 +233,7 @@ _my_account_free(My_Account * acc)
|
|||
static My_Cache *
|
||||
_my_cache_new(void)
|
||||
{
|
||||
My_Cache * my_cache = calloc(1, sizeof(My_Cache));
|
||||
My_Cache *my_cache = calloc(1, sizeof(My_Cache));
|
||||
if (!my_cache)
|
||||
{
|
||||
fprintf(stderr, "ERROR: could not calloc My_Cache\n");
|
||||
|
@ -246,32 +247,36 @@ _my_cache_new(void)
|
|||
} /* _my_cache_new */
|
||||
|
||||
static Eina_Bool
|
||||
_my_cache_account_free_cb(const Eina_Hash *hash, const void *key, void *data, void *fdata)
|
||||
_my_cache_account_free_cb(const Eina_Hash *hash,
|
||||
const void *key,
|
||||
void *data,
|
||||
void *fdata)
|
||||
{
|
||||
_my_account_free(data);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
_my_cache_free(My_Cache * my_cache)
|
||||
_my_cache_free(My_Cache *my_cache)
|
||||
{
|
||||
My_Account * acc;
|
||||
My_Account *acc;
|
||||
eina_hash_foreach(my_cache->accounts, _my_cache_account_free_cb, NULL);
|
||||
eina_hash_free(my_cache->accounts);
|
||||
free(my_cache);
|
||||
} /* _my_cache_free */
|
||||
|
||||
static My_Account *
|
||||
_my_cache_account_find(My_Cache * my_cache, const char * name)
|
||||
_my_cache_account_find(My_Cache *my_cache,
|
||||
const char *name)
|
||||
{
|
||||
return eina_hash_find(my_cache->accounts, name);
|
||||
} /* _my_cache_account_find */
|
||||
|
||||
static My_Cache *
|
||||
_my_cache_load(const char * filename)
|
||||
_my_cache_load(const char *filename)
|
||||
{
|
||||
My_Cache * my_cache;
|
||||
Eet_File * ef = eet_open(filename, EET_FILE_MODE_READ);
|
||||
My_Cache *my_cache;
|
||||
Eet_File *ef = eet_open(filename, EET_FILE_MODE_READ);
|
||||
if (!ef)
|
||||
{
|
||||
fprintf(stderr, "ERROR: could not open '%s' for read\n", filename);
|
||||
|
@ -304,10 +309,11 @@ _my_cache_load(const char * filename)
|
|||
} /* _my_cache_load */
|
||||
|
||||
static Eina_Bool
|
||||
_my_cache_save(const My_Cache * my_cache, const char * filename)
|
||||
_my_cache_save(const My_Cache *my_cache,
|
||||
const char *filename)
|
||||
{
|
||||
char tmp[PATH_MAX];
|
||||
Eet_File * ef;
|
||||
Eet_File *ef;
|
||||
Eina_Bool ret;
|
||||
unsigned int i, len;
|
||||
struct stat st;
|
||||
|
@ -356,12 +362,14 @@ _my_cache_save(const My_Cache * my_cache, const char * filename)
|
|||
return ret;
|
||||
} /* _my_cache_save */
|
||||
|
||||
int main(int argc, char * argv[])
|
||||
int
|
||||
main(int argc,
|
||||
char *argv[])
|
||||
{
|
||||
My_Cache * my_cache;
|
||||
const Eina_List * l_acc;
|
||||
My_Cache *my_cache;
|
||||
const Eina_List *l_acc;
|
||||
Eina_Iterator *it;
|
||||
My_Account * acc;
|
||||
My_Account *acc;
|
||||
int ret = 0;
|
||||
|
||||
if (argc < 3)
|
||||
|
@ -399,7 +407,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]);
|
||||
|
@ -418,7 +426,7 @@ 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_add(acc, argv[5]);
|
||||
|
@ -435,10 +443,10 @@ 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
|
||||
|
@ -461,7 +469,7 @@ int main(int argc, char * argv[])
|
|||
it = eina_hash_iterator_data_new(my_cache->accounts);
|
||||
EINA_ITERATOR_FOREACH(it, 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 : "",
|
||||
|
@ -470,8 +478,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)
|
||||
|
@ -486,7 +494,7 @@ int main(int argc, char * argv[])
|
|||
|
||||
if (acc->posts_count)
|
||||
{
|
||||
const My_Post * post;
|
||||
const My_Post *post;
|
||||
int i;
|
||||
printf("\t |posts:\n");
|
||||
|
||||
|
|
|
@ -115,7 +115,9 @@ _st3_set(Example_Struct3 *st3,
|
|||
st3->body = v1;
|
||||
} /* _st3_set */
|
||||
|
||||
static const char * /* union type_get() */
|
||||
static const char *
|
||||
/* union
|
||||
type_get() */
|
||||
_union_type_get(const void *data,
|
||||
Eina_Bool *unknow)
|
||||
{
|
||||
|
@ -259,7 +261,8 @@ static Eet_Data_Descriptor *_variant_unified_descriptor;
|
|||
static Eet_File *_cache_file = NULL;
|
||||
static Eet_Dictionary *_cache_dict = NULL;
|
||||
|
||||
static void /* declaring types */
|
||||
static void
|
||||
/* declaring types */
|
||||
_data_descriptors_init(void)
|
||||
{
|
||||
Eet_Data_Descriptor_Class eddc;
|
||||
|
|
|
@ -17,16 +17,16 @@
|
|||
typedef struct
|
||||
{
|
||||
unsigned int version; // it is recommended to use versioned configuration!
|
||||
const char * name;
|
||||
const char *name;
|
||||
int id;
|
||||
int not_saved_value; // example of not saved data inside!
|
||||
Eina_Bool enabled;
|
||||
Eina_List * subs;
|
||||
Eina_List *subs;
|
||||
} My_Conf_Type;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char * server;
|
||||
const char *server;
|
||||
int port;
|
||||
} My_Conf_Subtype;
|
||||
|
||||
|
@ -38,8 +38,8 @@ static const char MY_CONF_FILE_ENTRY[] = "config";
|
|||
// keep the descriptor static global, so it can be
|
||||
// shared by different functions (load/save) of this and only this
|
||||
// file.
|
||||
static Eet_Data_Descriptor * _my_conf_descriptor;
|
||||
static Eet_Data_Descriptor * _my_conf_sub_descriptor;
|
||||
static Eet_Data_Descriptor *_my_conf_descriptor;
|
||||
static Eet_Data_Descriptor *_my_conf_sub_descriptor;
|
||||
|
||||
static void
|
||||
_my_conf_descriptor_init(void)
|
||||
|
@ -66,11 +66,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);
|
||||
|
@ -99,8 +99,8 @@ _my_conf_descriptor_shutdown(void)
|
|||
static My_Conf_Type *
|
||||
_my_conf_new(void)
|
||||
{
|
||||
My_Conf_Type * my_conf = calloc(1, sizeof(My_Conf_Type));
|
||||
My_Conf_Subtype * sub;
|
||||
My_Conf_Type *my_conf = calloc(1, sizeof(My_Conf_Type));
|
||||
My_Conf_Subtype *sub;
|
||||
if (!my_conf)
|
||||
{
|
||||
fprintf(stderr, "ERROR: could not calloc My_Conf_Type\n");
|
||||
|
@ -122,9 +122,9 @@ _my_conf_new(void)
|
|||
} /* _my_conf_new */
|
||||
|
||||
static void
|
||||
_my_conf_free(My_Conf_Type * my_conf)
|
||||
_my_conf_free(My_Conf_Type *my_conf)
|
||||
{
|
||||
My_Conf_Subtype * sub;
|
||||
My_Conf_Subtype *sub;
|
||||
EINA_LIST_FREE(my_conf->subs, sub)
|
||||
{
|
||||
eina_stringshare_del(sub->server);
|
||||
|
@ -136,10 +136,10 @@ _my_conf_free(My_Conf_Type * 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);
|
||||
|
@ -166,10 +166,11 @@ end:
|
|||
} /* _my_conf_load */
|
||||
|
||||
static Eina_Bool
|
||||
_my_conf_save(const My_Conf_Type * my_conf, const char * filename)
|
||||
_my_conf_save(const My_Conf_Type *my_conf,
|
||||
const char *filename)
|
||||
{
|
||||
char tmp[PATH_MAX];
|
||||
Eet_File * ef;
|
||||
Eet_File *ef;
|
||||
Eina_Bool ret;
|
||||
unsigned int i, len;
|
||||
struct stat st;
|
||||
|
@ -209,11 +210,13 @@ _my_conf_save(const My_Conf_Type * my_conf, const char * filename)
|
|||
return ret;
|
||||
} /* _my_conf_save */
|
||||
|
||||
int main(int argc, char * argv[])
|
||||
int
|
||||
main(int argc,
|
||||
char *argv[])
|
||||
{
|
||||
My_Conf_Type * my_conf;
|
||||
const My_Conf_Subtype * sub;
|
||||
const Eina_List * l;
|
||||
My_Conf_Type *my_conf;
|
||||
const My_Conf_Subtype *sub;
|
||||
const Eina_List *l;
|
||||
int ret = 0;
|
||||
|
||||
if (argc != 3)
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
typedef struct
|
||||
{
|
||||
unsigned int version; // it is recommended to use versioned configuration!
|
||||
const char * name;
|
||||
const char *name;
|
||||
int id;
|
||||
int not_saved_value; // example of not saved data inside!
|
||||
Eina_Bool enabled;
|
||||
|
@ -31,7 +31,7 @@ static const char MY_CONF_FILE_ENTRY[] = "config";
|
|||
// keep the descriptor static global, so it can be
|
||||
// shared by different functions (load/save) of this and only this
|
||||
// file.
|
||||
static Eet_Data_Descriptor * _my_conf_descriptor;
|
||||
static Eet_Data_Descriptor *_my_conf_descriptor;
|
||||
|
||||
static void
|
||||
_my_conf_descriptor_init(void)
|
||||
|
@ -55,8 +55,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);
|
||||
|
@ -76,7 +76,7 @@ _my_conf_descriptor_shutdown(void)
|
|||
static My_Conf_Type *
|
||||
_my_conf_new(void)
|
||||
{
|
||||
My_Conf_Type * my_conf = calloc(1, sizeof(My_Conf_Type));
|
||||
My_Conf_Type *my_conf = calloc(1, sizeof(My_Conf_Type));
|
||||
if (!my_conf)
|
||||
{
|
||||
fprintf(stderr, "ERROR: could not calloc My_Conf_Type\n");
|
||||
|
@ -89,17 +89,17 @@ _my_conf_new(void)
|
|||
} /* _my_conf_new */
|
||||
|
||||
static void
|
||||
_my_conf_free(My_Conf_Type * my_conf)
|
||||
_my_conf_free(My_Conf_Type *my_conf)
|
||||
{
|
||||
eina_stringshare_del(my_conf->name);
|
||||
free(my_conf);
|
||||
} /* _my_conf_free */
|
||||
|
||||
static My_Conf_Type *
|
||||
_my_conf_load(const char * filename)
|
||||
_my_conf_load(const char *filename)
|
||||
{
|
||||
My_Conf_Type * my_conf;
|
||||
Eet_File * ef = eet_open(filename, EET_FILE_MODE_READ);
|
||||
My_Conf_Type *my_conf;
|
||||
Eet_File *ef = eet_open(filename, EET_FILE_MODE_READ);
|
||||
if (!ef)
|
||||
{
|
||||
fprintf(stderr, "ERROR: could not open '%s' for read\n", filename);
|
||||
|
@ -126,10 +126,11 @@ end:
|
|||
} /* _my_conf_load */
|
||||
|
||||
static Eina_Bool
|
||||
_my_conf_save(const My_Conf_Type * my_conf, const char * filename)
|
||||
_my_conf_save(const My_Conf_Type *my_conf,
|
||||
const char *filename)
|
||||
{
|
||||
char tmp[PATH_MAX];
|
||||
Eet_File * ef;
|
||||
Eet_File *ef;
|
||||
Eina_Bool ret;
|
||||
unsigned int i, len;
|
||||
struct stat st;
|
||||
|
@ -169,9 +170,11 @@ _my_conf_save(const My_Conf_Type * my_conf, const char * filename)
|
|||
return ret;
|
||||
} /* _my_conf_save */
|
||||
|
||||
int main(int argc, char * argv[])
|
||||
int
|
||||
main(int argc,
|
||||
char *argv[])
|
||||
{
|
||||
My_Conf_Type * my_conf;
|
||||
My_Conf_Type *my_conf;
|
||||
int ret = 0;
|
||||
|
||||
if (argc != 3)
|
||||
|
|
|
@ -60,7 +60,7 @@ create_eet_file(void)
|
|||
|
||||
eet_delete(ef, "/several/strings");
|
||||
|
||||
return (eet_close(ef) == EET_ERROR_NONE);
|
||||
return eet_close(ef) == EET_ERROR_NONE;
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -124,3 +124,4 @@ main(void)
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,145 +1,146 @@
|
|||
/**
|
||||
@brief Eet Data Handling Library Public API Calls
|
||||
@brief Eet Data Handling Library Public API Calls
|
||||
|
||||
These routines are used for Eet Library interaction
|
||||
These routines are used for Eet Library interaction
|
||||
|
||||
@mainpage Eet Library Documentation
|
||||
@mainpage Eet Library Documentation
|
||||
|
||||
@version 1.5.0
|
||||
@date 2000-2011
|
||||
@version 1.5.0
|
||||
@date 2000-2011
|
||||
|
||||
Please see the @ref authors page for contact details.
|
||||
Please see the @ref authors page for contact details.
|
||||
|
||||
@section toc Table of Contents
|
||||
@section toc Table of Contents
|
||||
|
||||
@li @ref intro
|
||||
@li @ref example
|
||||
@li @ref compiling
|
||||
@li @ref install
|
||||
@li @ref next_steps
|
||||
@li @ref intro_example
|
||||
@li @ref intro
|
||||
@li @ref example
|
||||
@li @ref compiling
|
||||
@li @ref install
|
||||
@li @ref next_steps
|
||||
@li @ref intro_example
|
||||
|
||||
@section intro What is Eet?
|
||||
@section intro What is Eet?
|
||||
|
||||
It is a tiny library designed to write an arbitrary set of chunks of data
|
||||
to a file and optionally compress each chunk (very much like a zip file)
|
||||
and allow fast random-access reading of the file later on. It does not
|
||||
do zip as a zip itself has more complexity than is needed, and it was much
|
||||
simpler to implement this once here.
|
||||
It is a tiny library designed to write an arbitrary set of chunks of data
|
||||
to a file and optionally compress each chunk (very much like a zip file)
|
||||
and allow fast random-access reading of the file later on. It does not
|
||||
do zip as a zip itself has more complexity than is needed, and it was much
|
||||
simpler to implement this once here.
|
||||
|
||||
Eet is extremely fast, small and simple. Eet files can be very small and
|
||||
highly compressed, making them very optimal for just sending across the
|
||||
internet without having to archive, compress or decompress and install them.
|
||||
They allow for lightning-fast random-acess reads once created, making them
|
||||
perfect for storing data that is written once (or rarely) and read many
|
||||
times, but the program does not want to have to read it all in at once.
|
||||
Eet is extremely fast, small and simple. Eet files can be very small and
|
||||
highly compressed, making them very optimal for just sending across the
|
||||
internet without having to archive, compress or decompress and install them.
|
||||
They allow for lightning-fast random-acess reads once created, making them
|
||||
perfect for storing data that is written once (or rarely) and read many
|
||||
times, but the program does not want to have to read it all in at once.
|
||||
|
||||
It also can encode and decode data structures in memory, as well as image
|
||||
data for saving to Eet files or sending across the network to other
|
||||
machines, or just writing to arbitrary files on the system. All data is
|
||||
encoded in a platform independent way and can be written and read by any
|
||||
architecture.
|
||||
It also can encode and decode data structures in memory, as well as image
|
||||
data for saving to Eet files or sending across the network to other
|
||||
machines, or just writing to arbitrary files on the system. All data is
|
||||
encoded in a platform independent way and can be written and read by any
|
||||
architecture.
|
||||
|
||||
@section example A simple example on using Eet
|
||||
@section example A simple example on using Eet
|
||||
|
||||
Here is a simple example on how to use Eet to save a series of strings to a
|
||||
file and load them again. The advantage of using Eet over just fprintf() and
|
||||
fscanf() is that not only can these entries be strings, they need no special
|
||||
parsing to handle delimiter characters or escaping, they can be binary data,
|
||||
image data, data structures containing integers, strings, other data
|
||||
structures, linked lists and much more, without the programmer having to
|
||||
worry about parsing, and best of all, Eet is very fast.
|
||||
Here is a simple example on how to use Eet to save a series of strings to a
|
||||
file and load them again. The advantage of using Eet over just
|
||||
fprintf() and
|
||||
fscanf() is that not only can these entries be strings, they need no special
|
||||
parsing to handle delimiter characters or escaping, they can be binary data,
|
||||
image data, data structures containing integers, strings, other data
|
||||
structures, linked lists and much more, without the programmer having to
|
||||
worry about parsing, and best of all, Eet is very fast.
|
||||
|
||||
This is just a very simple example that doesn't show all of the capabilities
|
||||
of Eet, but it serves to illustrate its simplicity.
|
||||
This is just a very simple example that doesn't show all of the capabilities
|
||||
of Eet, but it serves to illustrate its simplicity.
|
||||
|
||||
@include eet-basic.c
|
||||
@include eet-basic.c
|
||||
|
||||
@section compiling How to compile using Eet ?
|
||||
@section compiling How to compile using Eet ?
|
||||
|
||||
Eet is a library your application links to. The procedure for this is very
|
||||
simple. You simply have to compile your application with the appropriate
|
||||
compiler flags that the @p pkg-config script outputs. For example:
|
||||
Eet is a library your application links to. The procedure for this is very
|
||||
simple. You simply have to compile your application with the appropriate
|
||||
compiler flags that the @p pkg-config script outputs. For example:
|
||||
|
||||
Compiling C or C++ files into object files:
|
||||
Compiling C or C++ files into object files:
|
||||
|
||||
@verbatim
|
||||
gcc -c -o main.o main.c `pkg-config --cflags eet`
|
||||
@endverbatim
|
||||
@verbatim
|
||||
gcc -c -o main.o main.c `pkg-config --cflags eet`
|
||||
@endverbatim
|
||||
|
||||
Linking object files into a binary executable:
|
||||
Linking object files into a binary executable:
|
||||
|
||||
@verbatim
|
||||
gcc -o my_application main.o `pkg-config --libs eet`
|
||||
@endverbatim
|
||||
@verbatim
|
||||
gcc -o my_application main.o `pkg-config --libs eet`
|
||||
@endverbatim
|
||||
|
||||
You simply have to make sure that pkg-config is in your shell's PATH (see
|
||||
the manual page for your appropriate shell) and eet.pc in /usr/lib/pkgconfig
|
||||
or its path is in the PKG_CONFIG_PATH environment variable. It's that simple
|
||||
to link and use Eet once you have written your code to use it.
|
||||
You simply have to make sure that pkg-config is in your shell's PATH (see
|
||||
the manual page for your appropriate shell) and eet.pc in /usr/lib/pkgconfig
|
||||
or its path is in the PKG_CONFIG_PATH environment variable. It's that simple
|
||||
to link and use Eet once you have written your code to use it.
|
||||
|
||||
Since the program is linked to Eet, it is now able to use any advertised
|
||||
API calls to serialize your data.
|
||||
Since the program is linked to Eet, it is now able to use any advertised
|
||||
API calls to serialize your data.
|
||||
|
||||
You should make sure you add any extra compile and link flags to your
|
||||
compile commands that your application may need as well. The above example
|
||||
is only guaranteed to make Eet add it's own requirements.
|
||||
You should make sure you add any extra compile and link flags to your
|
||||
compile commands that your application may need as well. The above example
|
||||
is only guaranteed to make Eet add it's own requirements.
|
||||
|
||||
|
||||
@section install How is it installed?
|
||||
@section install How is it installed?
|
||||
|
||||
Simple:
|
||||
Simple:
|
||||
|
||||
@verbatim
|
||||
./configure
|
||||
make
|
||||
su -
|
||||
...
|
||||
make install
|
||||
@endverbatim
|
||||
@verbatim
|
||||
./configure
|
||||
make
|
||||
su -
|
||||
...
|
||||
make install
|
||||
@endverbatim
|
||||
|
||||
@section next_steps Next Steps
|
||||
@section next_steps Next Steps
|
||||
|
||||
After you understood what Eet is and installed it in your system you
|
||||
should proceed understanding the programming interface. We'd recommend
|
||||
you to take a while to learn Eina
|
||||
(http://docs.enlightenment.org/auto/eina/) as it is very convenient
|
||||
and optimized, and Eet provides integration with it.
|
||||
After you understood what Eet is and installed it in your system you
|
||||
should proceed understanding the programming interface. We'd recommend
|
||||
you to take a while to learn Eina
|
||||
(http://docs.enlightenment.org/auto/eina/) as it is very convenient
|
||||
and optimized, and Eet provides integration with it.
|
||||
|
||||
Recommended reading:
|
||||
Recommended reading:
|
||||
|
||||
@li @ref Eet_File_Group to know the basics to open and save files.
|
||||
@li @ref Eet_Data_Group to know the convenient way to serialize and
|
||||
@li @ref Eet_File_Group to know the basics to open and save files.
|
||||
@li @ref Eet_Data_Group to know the convenient way to serialize and
|
||||
parse your data structures automatically. Just create your
|
||||
descriptors and let Eet do the work for you.
|
||||
|
||||
@section intro_example Introductory Examples
|
||||
@section intro_example Introductory Examples
|
||||
|
||||
@ref Examples
|
||||
@ref Examples
|
||||
|
||||
@todo Document data format for images and data structures.
|
||||
@todo Document data format for images and data structures.
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
/**
|
||||
@page authors Authors
|
||||
@author Carsten Haitzler <raster@@rasterman.com>
|
||||
@author David Goodlad <dgoodlad@@gmail.com>
|
||||
@author Cedric Bail <cedric.bail@@free.fr>
|
||||
@author Arnaud de Turckheim <quarium@@gmail.com>
|
||||
@author Luis Felipe Strano Moraes <lfelipe@@profusion.mobi>
|
||||
@author Chidambar Zinnoury <illogict@@online.fr>
|
||||
@author Vincent Torri <vtorri@@univ-evry.fr>
|
||||
@author Gustavo Sverzut Barbieri <barbieri@@profusion.mobi>
|
||||
@author Raphael Kubo da Costa <kubo@@profusion.mobi>
|
||||
@author Mathieu Taillefumier <mathieu.taillefumier@@free.fr>
|
||||
@author Albin "Lutin" Tonnerre <albin.tonnerre@@gmail.com>
|
||||
@author Adam Simpkins <adam@@adamsimpkins.net>
|
||||
@author Mike Blumenkrantz <mike@zentific.com>
|
||||
@page authors Authors
|
||||
@author Carsten Haitzler <raster@@rasterman.com>
|
||||
@author David Goodlad <dgoodlad@@gmail.com>
|
||||
@author Cedric Bail <cedric.bail@@free.fr>
|
||||
@author Arnaud de Turckheim <quarium@@gmail.com>
|
||||
@author Luis Felipe Strano Moraes <lfelipe@@profusion.mobi>
|
||||
@author Chidambar Zinnoury <illogict@@online.fr>
|
||||
@author Vincent Torri <vtorri@@univ-evry.fr>
|
||||
@author Gustavo Sverzut Barbieri <barbieri@@profusion.mobi>
|
||||
@author Raphael Kubo da Costa <kubo@@profusion.mobi>
|
||||
@author Mathieu Taillefumier <mathieu.taillefumier@@free.fr>
|
||||
@author Albin "Lutin" Tonnerre <albin.tonnerre@@gmail.com>
|
||||
@author Adam Simpkins <adam@@adamsimpkins.net>
|
||||
@author Mike Blumenkrantz <mike@zentific.com>
|
||||
|
||||
Please contact <enlightenment-devel@lists.sourceforge.net> to get in
|
||||
contact with the developers and maintainers.
|
||||
*/
|
||||
Please contact <enlightenment-devel@lists.sourceforge.net> to get in
|
||||
contact with the developers and maintainers.
|
||||
*/
|
||||
|
||||
#ifndef _EET_H
|
||||
#define _EET_H
|
||||
|
@ -1737,7 +1738,7 @@ typedef struct _Eet_Key Eet_Key;
|
|||
* @since 1.2.0
|
||||
* @ingroup Eet_Cipher_Group
|
||||
*/
|
||||
typedef int (*Eet_Key_Password_Callback) (char *buffer, int size, int rwflag, void *data);
|
||||
typedef int (*Eet_Key_Password_Callback)(char *buffer, int size, int rwflag, void *data);
|
||||
|
||||
/**
|
||||
* Create an Eet_Key needed for signing an eet file.
|
||||
|
@ -2353,22 +2354,22 @@ typedef struct _Eet_Data_Descriptor_Class Eet_Data_Descriptor_Class;
|
|||
|
||||
typedef int (*Eet_Descriptor_Hash_Foreach_Callback_Callback)(void *h, const char *k, void *dt, void *fdt);
|
||||
|
||||
typedef void *(*Eet_Descriptor_Mem_Alloc_Callback)(size_t size);
|
||||
typedef void * (*Eet_Descriptor_Mem_Alloc_Callback)(size_t size);
|
||||
typedef void (*Eet_Descriptor_Mem_Free_Callback)(void *mem);
|
||||
typedef char *(*Eet_Descriptor_Str_Alloc_Callback)(const char *str);
|
||||
typedef char * (*Eet_Descriptor_Str_Alloc_Callback)(const char *str);
|
||||
typedef void (*Eet_Descriptor_Str_Free_Callback)(const char *str);
|
||||
typedef void *(*Eet_Descriptor_List_Next_Callback)(void *l);
|
||||
typedef void *(*Eet_Descriptor_List_Append_Callback)(void *l, void *d);
|
||||
typedef void *(*Eet_Descriptor_List_Data_Callback)(void *l);
|
||||
typedef void *(*Eet_Descriptor_List_Free_Callback)(void *l);
|
||||
typedef void * (*Eet_Descriptor_List_Next_Callback)(void *l);
|
||||
typedef void * (*Eet_Descriptor_List_Append_Callback)(void *l, void *d);
|
||||
typedef void * (*Eet_Descriptor_List_Data_Callback)(void *l);
|
||||
typedef void * (*Eet_Descriptor_List_Free_Callback)(void *l);
|
||||
typedef void (*Eet_Descriptor_Hash_Foreach_Callback)(void *h, Eet_Descriptor_Hash_Foreach_Callback_Callback func, void *fdt);
|
||||
typedef void *(*Eet_Descriptor_Hash_Add_Callback)(void *h, const char *k, void *d);
|
||||
typedef void * (*Eet_Descriptor_Hash_Add_Callback)(void *h, const char *k, void *d);
|
||||
typedef void (*Eet_Descriptor_Hash_Free_Callback)(void *h);
|
||||
typedef char *(*Eet_Descriptor_Str_Direct_Alloc_Callback)(const char *str);
|
||||
typedef char * (*Eet_Descriptor_Str_Direct_Alloc_Callback)(const char *str);
|
||||
typedef void (*Eet_Descriptor_Str_Direct_Free_Callback)(const char *str);
|
||||
typedef const char *(*Eet_Descriptor_Type_Get_Callback)(const void *data, Eina_Bool *unknow);
|
||||
typedef const char * (*Eet_Descriptor_Type_Get_Callback)(const void *data, Eina_Bool *unknow);
|
||||
typedef Eina_Bool (*Eet_Descriptor_Type_Set_Callback)(const char *type, void *data, Eina_Bool unknow);
|
||||
typedef void *(*Eet_Descriptor_Array_Alloc_Callback)(size_t size);
|
||||
typedef void * (*Eet_Descriptor_Array_Alloc_Callback)(size_t size);
|
||||
typedef void (*Eet_Descriptor_Array_Free_Callback)(void *mem);
|
||||
/**
|
||||
* @struct _Eet_Data_Descriptor_Class
|
||||
|
@ -2389,7 +2390,8 @@ struct _Eet_Data_Descriptor_Class
|
|||
int version; /**< ABI version. Should always be set to #EET_DATA_DESCRIPTOR_CLASS_VERSION */
|
||||
const char *name; /**< Name of the user data type to be serialized */
|
||||
int size; /**< Size in bytes of the user data type to be serialized */
|
||||
struct {
|
||||
struct
|
||||
{
|
||||
Eet_Descriptor_Mem_Alloc_Callback mem_alloc; /**< how to allocate memory (usually malloc()) */
|
||||
Eet_Descriptor_Mem_Free_Callback mem_free; /**< how to free memory (usually free()) */
|
||||
Eet_Descriptor_Str_Alloc_Callback str_alloc; /**< how to allocate a string */
|
||||
|
@ -2414,7 +2416,6 @@ struct _Eet_Data_Descriptor_Class
|
|||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Create a new empty data structure descriptor.
|
||||
* @param name The string name of this data structure (most be a
|
||||
|
@ -2470,9 +2471,9 @@ eet_data_descriptor_new(const char *name,
|
|||
* move happens - but be warned
|
||||
*/
|
||||
EINA_DEPRECATED EAPI Eet_Data_Descriptor *
|
||||
eet_data_descriptor2_new(const Eet_Data_Descriptor_Class *eddc);
|
||||
eet_data_descriptor2_new(const Eet_Data_Descriptor_Class *eddc);
|
||||
EINA_DEPRECATED EAPI Eet_Data_Descriptor *
|
||||
eet_data_descriptor3_new(const Eet_Data_Descriptor_Class *eddc);
|
||||
eet_data_descriptor3_new(const Eet_Data_Descriptor_Class *eddc);
|
||||
|
||||
/**
|
||||
* This function creates a new data descriptor and returns a handle to the
|
||||
|
@ -2588,7 +2589,7 @@ eet_eina_stream_data_descriptor_class_set(Eet_Data_Descriptor_Class *eddc,
|
|||
* @since 1.2.3
|
||||
* @ingroup Eet_Data_Group
|
||||
*/
|
||||
#define EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(clas, type)\
|
||||
#define EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(clas, type) \
|
||||
(eet_eina_stream_data_descriptor_class_set(clas, sizeof (*(clas)), # type, sizeof(type)))
|
||||
|
||||
/**
|
||||
|
@ -2629,7 +2630,7 @@ eet_eina_file_data_descriptor_class_set(Eet_Data_Descriptor_Class *eddc,
|
|||
* @since 1.2.3
|
||||
* @ingroup Eet_Data_Group
|
||||
*/
|
||||
#define EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(clas, type)\
|
||||
#define EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(clas, type) \
|
||||
(eet_eina_file_data_descriptor_class_set(clas, sizeof (*(clas)), # type, sizeof(type)))
|
||||
|
||||
/**
|
||||
|
@ -3673,7 +3674,7 @@ struct _Eet_Node_Data
|
|||
* @ingroup Eet_Node_Group
|
||||
*/
|
||||
EAPI Eet_Node *
|
||||
eet_node_char_new(const char *name,
|
||||
eet_node_char_new(const char *name,
|
||||
char c);
|
||||
|
||||
/**
|
||||
|
@ -3959,14 +3960,14 @@ eet_data_node_write_cipher(Eet_File *ef,
|
|||
*/
|
||||
typedef struct _Eet_Node_Walk Eet_Node_Walk;
|
||||
|
||||
typedef void *(*Eet_Node_Walk_Struct_Alloc_Callback)(const char *type, void *user_data);
|
||||
typedef void * (*Eet_Node_Walk_Struct_Alloc_Callback)(const char *type, void *user_data);
|
||||
typedef void (*Eet_Node_Walk_Struct_Add_Callback)(void *parent, const char *name, void *child, void *user_data);
|
||||
typedef void *(*Eet_Node_Walk_Array_Callback)(Eina_Bool variable, const char *name, int count, void *user_data);
|
||||
typedef void * (*Eet_Node_Walk_Array_Callback)(Eina_Bool variable, const char *name, int count, void *user_data);
|
||||
typedef void (*Eet_Node_Walk_Insert_Callback)(void *array, int index, void *child, void *user_data);
|
||||
typedef void *(*Eet_Node_Walk_List_Callback)(const char *name, void *user_data);
|
||||
typedef void * (*Eet_Node_Walk_List_Callback)(const char *name, void *user_data);
|
||||
typedef void (*Eet_Node_Walk_Append_Callback)(void *list, void *child, void *user_data);
|
||||
typedef void *(*Eet_Node_Walk_Hash_Callback)(void *parent, const char *name, const char *key, void *value, void *user_data);
|
||||
typedef void *(*Eet_Node_Walk_Simple_Callback)(int type, Eet_Node_Data *data, void *user_data);
|
||||
typedef void * (*Eet_Node_Walk_Hash_Callback)(void *parent, const char *name, const char *key, void *value, void *user_data);
|
||||
typedef void * (*Eet_Node_Walk_Simple_Callback)(int type, Eet_Node_Data *data, void *user_data);
|
||||
|
||||
/**
|
||||
* @struct _Eet_Node_Walk
|
||||
|
|
|
@ -101,29 +101,40 @@ extern int _eet_log_dom_global;
|
|||
#endif /* ifdef CRIT */
|
||||
#define CRIT(...) EINA_LOG_DOM_CRIT(_eet_log_dom_global, __VA_ARGS__)
|
||||
|
||||
Eet_Dictionary * eet_dictionary_add(void);
|
||||
void eet_dictionary_free(Eet_Dictionary *ed);
|
||||
int eet_dictionary_string_add(Eet_Dictionary *ed,
|
||||
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
|
||||
eet_dictionary_string_get_size(const Eet_Dictionary *ed,
|
||||
int index);
|
||||
const char * eet_dictionary_string_get_char(const Eet_Dictionary *ed,
|
||||
const char *
|
||||
eet_dictionary_string_get_char(const Eet_Dictionary *ed,
|
||||
int index);
|
||||
Eina_Bool eet_dictionary_string_get_float(const Eet_Dictionary *ed,
|
||||
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,
|
||||
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,
|
||||
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
|
||||
eet_dictionary_string_get_hash(const Eet_Dictionary *ed,
|
||||
int index);
|
||||
|
||||
int _eet_hash_gen(const char *key, int hash_size);
|
||||
int _eet_hash_gen(const char *key,
|
||||
int hash_size);
|
||||
|
||||
const void * eet_identity_check(const void *data_base,
|
||||
const void *
|
||||
eet_identity_check(const void *data_base,
|
||||
unsigned int data_length,
|
||||
void **sha1,
|
||||
int *sha1_length,
|
||||
|
@ -132,30 +143,40 @@ const void * eet_identity_check(const void *data_base,
|
|||
const void **raw_signature_base,
|
||||
unsigned int *raw_signature_length,
|
||||
int *x509_length);
|
||||
void * eet_identity_compute_sha1(const void *data_base,
|
||||
void *
|
||||
eet_identity_compute_sha1(const void *data_base,
|
||||
unsigned int data_length,
|
||||
int *sha1_length);
|
||||
Eet_Error eet_cipher(const void *data,
|
||||
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,
|
||||
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_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_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);
|
||||
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
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
# ifdef __cplusplus
|
||||
extern "C"
|
||||
# endif /* ifdef __cplusplus */
|
||||
void * alloca (size_t);
|
||||
void *alloca(size_t);
|
||||
#endif /* ifdef HAVE_ALLOCA_H */
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -80,13 +80,15 @@ void * alloca (size_t);
|
|||
|
||||
#ifdef HAVE_CIPHER
|
||||
# ifdef HAVE_GNUTLS
|
||||
static Eet_Error eet_hmac_sha1(const void *key,
|
||||
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,
|
||||
static Eet_Error
|
||||
eet_pbkdf2_sha1(const char *key,
|
||||
int key_len,
|
||||
const unsigned char *salt,
|
||||
unsigned int salt_len,
|
||||
|
@ -149,7 +151,7 @@ eet_identity_open(const char *certificate_file,
|
|||
|
||||
/* Import the certificate in Eet_Key structure */
|
||||
load_file.data = data;
|
||||
load_file.size = eina_file_size_get(f);;
|
||||
load_file.size = eina_file_size_get(f);
|
||||
if (gnutls_x509_crt_import(key->certificate, &load_file,
|
||||
GNUTLS_X509_FMT_PEM) < 0)
|
||||
goto on_error;
|
||||
|
@ -177,7 +179,7 @@ eet_identity_open(const char *certificate_file,
|
|||
|
||||
/* Import the private key in Eet_Key structure */
|
||||
load_file.data = data;
|
||||
load_file.size = eina_file_size_get(f);;
|
||||
load_file.size = eina_file_size_get(f);
|
||||
/* Try to directly import the PEM encoded private key */
|
||||
if (gnutls_x509_privkey_import(key->private_key, &load_file,
|
||||
GNUTLS_X509_FMT_PEM) < 0)
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
# ifdef __cplusplus
|
||||
extern "C"
|
||||
# endif /* ifdef __cplusplus */
|
||||
void * alloca (size_t);
|
||||
void *alloca(size_t);
|
||||
#endif /* ifdef HAVE_ALLOCA_H */
|
||||
|
||||
#include <string.h>
|
||||
|
|
|
@ -94,14 +94,30 @@ struct _Eet_Data_Basic_Type_Codec
|
|||
{
|
||||
int size;
|
||||
const char *name;
|
||||
int (*get)(const Eet_Dictionary *ed, const void *src, const void *src_end, void *dest);
|
||||
int (*get)(const Eet_Dictionary *ed,
|
||||
const void *src,
|
||||
const void *src_end,
|
||||
void *dest);
|
||||
void * (*put)(Eet_Dictionary *ed, const void *src, int *size_ret);
|
||||
};
|
||||
|
||||
struct _Eet_Data_Group_Type_Codec
|
||||
{
|
||||
int (*get)(Eet_Free_Context *context, const Eet_Dictionary *ed, Eet_Data_Descriptor *edd, Eet_Data_Element *ede, Eet_Data_Chunk *echnk, int type, int group_type, void *data_in, char **p, int *size);
|
||||
void (*put)(Eet_Dictionary *ed, Eet_Data_Descriptor *edd, Eet_Data_Element *ede, Eet_Data_Stream *ds, void *data_in);
|
||||
int (*get)(Eet_Free_Context *context,
|
||||
const Eet_Dictionary *ed,
|
||||
Eet_Data_Descriptor *edd,
|
||||
Eet_Data_Element *ede,
|
||||
Eet_Data_Chunk *echnk,
|
||||
int type,
|
||||
int group_type,
|
||||
void *data_in,
|
||||
char **p,
|
||||
int *size);
|
||||
void (*put)(Eet_Dictionary *ed,
|
||||
Eet_Data_Descriptor *edd,
|
||||
Eet_Data_Element *ede,
|
||||
Eet_Data_Stream *ds,
|
||||
void *data_in);
|
||||
};
|
||||
|
||||
struct _Eet_Data_Chunk
|
||||
|
@ -145,11 +161,18 @@ struct _Eet_Data_Descriptor
|
|||
void * (*list_append)(void *l, void *d);
|
||||
void * (*list_data)(void *l);
|
||||
void * (*list_free)(void *l);
|
||||
void (*hash_foreach)(void *h, int (*func)(void *h, const char *k, void *dt, void *fdt), void *fdt);
|
||||
void (*hash_foreach)(void *h,
|
||||
int (*func)(void *h,
|
||||
const char *k,
|
||||
void *dt,
|
||||
void *fdt),
|
||||
void *fdt);
|
||||
void * (*hash_add)(void *h, const char *k, void *d);
|
||||
void (*hash_free)(void *h);
|
||||
const char *(*type_get)(const void *data, Eina_Bool *unknow);
|
||||
Eina_Bool (*type_set)(const char *type, void *data, Eina_Bool unknow);
|
||||
Eina_Bool (*type_set)(const char *type,
|
||||
void *data,
|
||||
Eina_Bool unknow);
|
||||
void * (*array_alloc)(size_t size);
|
||||
void (*array_free)(void *mem);
|
||||
} func;
|
||||
|
@ -216,109 +239,139 @@ struct _Eet_Variant_Unknow
|
|||
|
||||
/*---*/
|
||||
|
||||
static void eet_free_context_init(Eet_Free_Context *context);
|
||||
static void eet_free_context_shutdown(Eet_Free_Context *context);
|
||||
static void
|
||||
eet_free_context_init(Eet_Free_Context *context);
|
||||
static void
|
||||
eet_free_context_shutdown(Eet_Free_Context *context);
|
||||
|
||||
static int eet_data_get_char(const Eet_Dictionary *ed,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
static int
|
||||
eet_data_get_unknown(Eet_Free_Context *context,
|
||||
const Eet_Dictionary *ed,
|
||||
Eet_Data_Descriptor *edd,
|
||||
Eet_Data_Element *ede,
|
||||
|
@ -328,17 +381,20 @@ static int eet_data_get_unknown(Eet_Free_Context *context,
|
|||
void *data_in,
|
||||
char **p,
|
||||
int *size);
|
||||
static void eet_data_put_unknown(Eet_Dictionary *ed,
|
||||
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,
|
||||
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,
|
||||
static int
|
||||
eet_data_get_array(Eet_Free_Context *context,
|
||||
const Eet_Dictionary *ed,
|
||||
Eet_Data_Descriptor *edd,
|
||||
Eet_Data_Element *ede,
|
||||
|
@ -348,7 +404,8 @@ static int eet_data_get_array(Eet_Free_Context *context,
|
|||
void *data,
|
||||
char **p,
|
||||
int *size);
|
||||
static int eet_data_get_list(Eet_Free_Context *context,
|
||||
static int
|
||||
eet_data_get_list(Eet_Free_Context *context,
|
||||
const Eet_Dictionary *ed,
|
||||
Eet_Data_Descriptor *edd,
|
||||
Eet_Data_Element *ede,
|
||||
|
@ -358,17 +415,20 @@ static int eet_data_get_list(Eet_Free_Context *context,
|
|||
void *data_in,
|
||||
char **p,
|
||||
int *size);
|
||||
static void eet_data_put_list(Eet_Dictionary *ed,
|
||||
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,
|
||||
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,
|
||||
static int
|
||||
eet_data_get_hash(Eet_Free_Context *context,
|
||||
const Eet_Dictionary *ed,
|
||||
Eet_Data_Descriptor *edd,
|
||||
Eet_Data_Element *ede,
|
||||
|
@ -378,12 +438,14 @@ static int eet_data_get_hash(Eet_Free_Context *context,
|
|||
void *data,
|
||||
char **p,
|
||||
int *size);
|
||||
static void eet_data_put_union(Eet_Dictionary *ed,
|
||||
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,
|
||||
static int
|
||||
eet_data_get_union(Eet_Free_Context *context,
|
||||
const Eet_Dictionary *ed,
|
||||
Eet_Data_Descriptor *edd,
|
||||
Eet_Data_Element *ede,
|
||||
|
@ -393,12 +455,14 @@ static int eet_data_get_union(Eet_Free_Context *context,
|
|||
void *data,
|
||||
char **p,
|
||||
int *size);
|
||||
static void eet_data_put_variant(Eet_Dictionary *ed,
|
||||
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,
|
||||
static int
|
||||
eet_data_get_variant(Eet_Free_Context *context,
|
||||
const Eet_Dictionary *ed,
|
||||
Eet_Data_Descriptor *edd,
|
||||
Eet_Data_Element *ede,
|
||||
|
@ -409,36 +473,44 @@ static int eet_data_get_variant(Eet_Free_Context *context,
|
|||
char **p,
|
||||
int *size);
|
||||
|
||||
static void eet_data_chunk_get(const Eet_Dictionary *ed,
|
||||
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,
|
||||
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 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,
|
||||
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_stream_free(Eet_Data_Stream *ds);
|
||||
|
||||
static void eet_data_chunk_put(Eet_Dictionary *ed,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
static void *_eet_data_descriptor_decode(Eet_Free_Context *context,
|
||||
const Eet_Dictionary *ed,
|
||||
Eet_Data_Descriptor *edd,
|
||||
const void *data_in,
|
||||
|
@ -463,9 +535,9 @@ static const Eet_Data_Basic_Type_Codec eet_basic_codec[] =
|
|||
{sizeof(char *), "string", eet_data_get_string, eet_data_put_string },
|
||||
{sizeof(char *), "inlined", eet_data_get_istring, eet_data_put_istring },
|
||||
{sizeof(void *), "NULL", eet_data_get_null, eet_data_put_null },
|
||||
{sizeof(Eina_F32p32),"f32p32", eet_data_get_f32p32, eet_data_put_f32p32 },
|
||||
{sizeof(Eina_F16p16),"f16p16", eet_data_get_f16p16, eet_data_put_f16p16 },
|
||||
{sizeof(Eina_F8p24),"f8p24", eet_data_get_f8p24, eet_data_put_f8p24 }
|
||||
{sizeof(Eina_F32p32), "f32p32", eet_data_get_f32p32, eet_data_put_f32p32 },
|
||||
{sizeof(Eina_F16p16), "f16p16", eet_data_get_f16p16, eet_data_put_f16p16 },
|
||||
{sizeof(Eina_F8p24), "f8p24", eet_data_get_f8p24, eet_data_put_f8p24 }
|
||||
};
|
||||
|
||||
static const Eet_Data_Group_Type_Codec eet_group_codec[] =
|
||||
|
@ -483,22 +555,22 @@ 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
|
||||
|
@ -522,37 +594,37 @@ static int _eet_data_words_bigendian = -1;
|
|||
#define IS_SIMPLE_TYPE(Type) (Type > EET_T_UNKNOW && Type < EET_T_LAST)
|
||||
#define IS_POINTER_TYPE(Type) (Type >= EET_T_STRING && Type <= EET_T_NULL)
|
||||
|
||||
#define POINTER_TYPE_DECODE(Context,\
|
||||
Ed,\
|
||||
Edd,\
|
||||
Ede,\
|
||||
Echnk,\
|
||||
Type,\
|
||||
Data,\
|
||||
P,\
|
||||
Size,\
|
||||
Label)\
|
||||
do {\
|
||||
int ___r;\
|
||||
___r = eet_data_get_unknown(Context,\
|
||||
Ed,\
|
||||
Edd, Ede,\
|
||||
Echnk,\
|
||||
Type, EET_G_UNKNOWN,\
|
||||
Data, P, Size);\
|
||||
if (!___r) { goto Label; }\
|
||||
#define POINTER_TYPE_DECODE(Context, \
|
||||
Ed, \
|
||||
Edd, \
|
||||
Ede, \
|
||||
Echnk, \
|
||||
Type, \
|
||||
Data, \
|
||||
P, \
|
||||
Size, \
|
||||
Label) \
|
||||
do { \
|
||||
int ___r; \
|
||||
___r = eet_data_get_unknown(Context, \
|
||||
Ed, \
|
||||
Edd, Ede, \
|
||||
Echnk, \
|
||||
Type, EET_G_UNKNOWN, \
|
||||
Data, P, Size); \
|
||||
if (!___r) { goto Label; } \
|
||||
} while (0)
|
||||
|
||||
#define STRUCT_TYPE_DECODE(Data_Ret, Context, Ed, Ede, Data, Size, SubSize, Label) \
|
||||
do {\
|
||||
Data_Ret = _eet_data_descriptor_decode(Context,\
|
||||
Ed,\
|
||||
Ede,\
|
||||
Data,\
|
||||
Size,\
|
||||
SubSize > 0 ? Data_Ret : NULL,\
|
||||
do { \
|
||||
Data_Ret = _eet_data_descriptor_decode(Context, \
|
||||
Ed, \
|
||||
Ede, \
|
||||
Data, \
|
||||
Size, \
|
||||
SubSize > 0 ? Data_Ret : NULL, \
|
||||
SubSize); \
|
||||
if (!Data_Ret) { goto Label; }\
|
||||
if (!Data_Ret) { goto Label; } \
|
||||
} while (0)
|
||||
|
||||
#define EET_I_STRING 1 << 4
|
||||
|
@ -1278,8 +1350,8 @@ eet_data_chunk_get(const Eet_Dictionary *ed,
|
|||
((chnk->type - EET_I_LIMIT) & 0xF) + EET_G_UNKNOWN;
|
||||
switch ((chnk->type - EET_I_LIMIT) & 0xF0)
|
||||
{
|
||||
#define EET_UNMATCH_TYPE(Type)\
|
||||
case EET_I_ ## Type: chnk->type = EET_T_ ## Type; break;
|
||||
#define EET_UNMATCH_TYPE(Type) \
|
||||
case EET_I_ ## Type: chnk->type = EET_T_ ## Type; break;
|
||||
|
||||
EET_UNMATCH_TYPE(STRING);
|
||||
EET_UNMATCH_TYPE(INLINED_STRING);
|
||||
|
@ -1460,8 +1532,8 @@ eet_data_chunk_put(Eet_Dictionary *ed,
|
|||
switch (chnk->type)
|
||||
{
|
||||
/* Only make sense with pointer type. */
|
||||
#define EET_MATCH_TYPE(Type)\
|
||||
case EET_T_ ## Type: type += EET_I_ ## Type; break;
|
||||
#define EET_MATCH_TYPE(Type) \
|
||||
case EET_T_ ## Type: type += EET_I_ ## Type; break;
|
||||
|
||||
EET_MATCH_TYPE(STRING);
|
||||
EET_MATCH_TYPE(INLINED_STRING);
|
||||
|
@ -1712,7 +1784,7 @@ eet_eina_stream_data_descriptor_class_set(Eet_Data_Descriptor_Class *eddc,
|
|||
eddc->func.list_data = (void *(*)(void *))eina_list_data_get;
|
||||
eddc->func.list_free = (void *(*)(void *))eina_list_free;
|
||||
eddc->func.hash_foreach = (void (*)(void *, int (*)(void *, const char *, void *, void *), void *))_eet_eina_hash_foreach;
|
||||
eddc->func.hash_add = (void * (*)(void *, const char *, void *))_eet_eina_hash_add_alloc;
|
||||
eddc->func.hash_add = (void *(*)(void *, const char *, void *))_eet_eina_hash_add_alloc;
|
||||
eddc->func.hash_free = (void (*)(void *))_eet_eina_hash_free;
|
||||
|
||||
/* This will cause an ABI incompatibility */
|
||||
|
@ -1734,7 +1806,7 @@ eet_eina_file_data_descriptor_class_set(Eet_Data_Descriptor_Class *eddc,
|
|||
|
||||
eddc->version = EET_DATA_DESCRIPTOR_CLASS_VERSION;
|
||||
|
||||
eddc->func.hash_add = (void * (*)(void *, const char *, void *))_eet_eina_hash_direct_add_alloc;
|
||||
eddc->func.hash_add = (void *(*)(void *, const char *, void *))_eet_eina_hash_direct_add_alloc;
|
||||
eddc->func.str_direct_alloc = _eet_str_direct_alloc;
|
||||
eddc->func.str_direct_free = _eet_str_direct_free;
|
||||
|
||||
|
@ -2189,6 +2261,7 @@ _eet_free_del(Eet_Free *ef,
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static void
|
||||
|
@ -2315,7 +2388,8 @@ _eet_freelist_list_free(Eet_Free_Context *context,
|
|||
#define _eet_freelist_str_unref(Ctx) _eet_free_unref(&Ctx->freelist_str);
|
||||
|
||||
static void
|
||||
_eet_freelist_str_free(Eet_Free_Context *context, Eet_Data_Descriptor *edd)
|
||||
_eet_freelist_str_free(Eet_Free_Context *context,
|
||||
Eet_Data_Descriptor *edd)
|
||||
{
|
||||
void *track;
|
||||
Eina_Array_Iterator it;
|
||||
|
@ -2494,15 +2568,15 @@ _eet_data_dump_token_get(const char *src,
|
|||
int in_quote = 0;
|
||||
int tlen = 0, tsize = 0;
|
||||
|
||||
#define TOK_ADD(x)\
|
||||
do {\
|
||||
tlen++;\
|
||||
if (tlen >= tsize)\
|
||||
{\
|
||||
tsize += 32;\
|
||||
tok = realloc(tok, tsize);\
|
||||
}\
|
||||
tok[tlen - 1] = x;\
|
||||
#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)--)
|
||||
|
@ -2839,23 +2913,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;\
|
||||
} /* switch */\
|
||||
#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);
|
||||
|
@ -2921,7 +2995,7 @@ _eet_data_dump_parse(Eet_Dictionary *ed,
|
|||
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); )
|
||||
|
@ -3166,12 +3240,12 @@ _eet_data_dump_parse(Eet_Dictionary *ed,
|
|||
return cdata;
|
||||
} /* _eet_data_dump_parse */
|
||||
|
||||
#define NEXT_CHUNK(P, Size, Echnk, Ed)\
|
||||
{\
|
||||
int __tmp;\
|
||||
__tmp = Ed ? (int)(sizeof(int) * 2) : Echnk.len + 4;\
|
||||
P += (4 + Echnk.size + __tmp);\
|
||||
Size -= (4 + Echnk.size + __tmp);\
|
||||
#define NEXT_CHUNK(P, Size, Echnk, Ed) \
|
||||
{ \
|
||||
int __tmp; \
|
||||
__tmp = Ed ? (int)(sizeof(int) * 2) : Echnk.len + 4; \
|
||||
P += (4 + Echnk.size + __tmp); \
|
||||
Size -= (4 + Echnk.size + __tmp); \
|
||||
}
|
||||
|
||||
static void *
|
||||
|
@ -3353,7 +3427,7 @@ _eet_data_descriptor_decode(Eet_Free_Context *context,
|
|||
&echnk,
|
||||
type,
|
||||
group_type,
|
||||
ede ? (void *)(((char*) data) + ede->offset) : (void **)&result,
|
||||
ede ? (void *)(((char *)data) + ede->offset) : (void **)&result,
|
||||
&p,
|
||||
&size);
|
||||
|
||||
|
@ -3616,9 +3690,9 @@ eet_data_get_array(Eet_Free_Context *context,
|
|||
*(int *)(((char *)data) + ede->count - ede->offset) = count;
|
||||
/* allocate space for the array of elements */
|
||||
if (edd->func.array_alloc)
|
||||
*(void **) ptr = edd->func.array_alloc(count * subsize);
|
||||
*(void **)ptr = edd->func.array_alloc(count * subsize);
|
||||
else
|
||||
*(void **) ptr = edd->func.mem_alloc(count * subsize);
|
||||
*(void **)ptr = edd->func.mem_alloc(count * subsize);
|
||||
|
||||
if (!*(void **)ptr)
|
||||
return 0;
|
||||
|
@ -3775,7 +3849,6 @@ eet_data_put_union(Eet_Dictionary *ed,
|
|||
|
||||
break;
|
||||
}
|
||||
|
||||
} /* eet_data_put_union */
|
||||
|
||||
static int
|
||||
|
@ -3859,7 +3932,6 @@ eet_data_get_union(Eet_Free_Context *context,
|
|||
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3986,7 +4058,6 @@ eet_data_put_variant(Eet_Dictionary *ed,
|
|||
|
||||
break;
|
||||
}
|
||||
|
||||
} /* eet_data_put_variant */
|
||||
|
||||
static int
|
||||
|
@ -4145,15 +4216,17 @@ on_error:
|
|||
} /* eet_data_get_variant */
|
||||
|
||||
static Eet_Node *
|
||||
eet_data_node_simple_type(int type, const char *name, void *dd)
|
||||
eet_data_node_simple_type(int type,
|
||||
const char *name,
|
||||
void *dd)
|
||||
{
|
||||
#ifdef EET_T_TYPE
|
||||
# undef EET_T_TYPE
|
||||
#endif /* ifdef EET_T_TYPE */
|
||||
|
||||
#define EET_T_TYPE(Eet_Type, Eet_Node_Type, Type)\
|
||||
case Eet_Type:\
|
||||
return eet_node_ ## Eet_Node_Type ## _new(name, *((Type *)dd));\
|
||||
#define EET_T_TYPE(Eet_Type, Eet_Node_Type, Type) \
|
||||
case Eet_Type: \
|
||||
return eet_node_ ## Eet_Node_Type ## _new(name, *((Type *)dd)); \
|
||||
|
||||
switch (type)
|
||||
{
|
||||
|
|
|
@ -302,7 +302,7 @@ eet_dictionary_convert_get(const Eet_Dictionary *ed,
|
|||
|
||||
if (!ed->converts)
|
||||
{
|
||||
((Eet_Dictionary*)ed)->converts = eina_hash_int32_new(free);
|
||||
((Eet_Dictionary *)ed)->converts = eina_hash_int32_new(free);
|
||||
|
||||
goto add_convert;
|
||||
}
|
||||
|
@ -310,7 +310,7 @@ eet_dictionary_convert_get(const Eet_Dictionary *ed,
|
|||
result = eina_hash_find(ed->converts, &idx);
|
||||
if (result) return result;
|
||||
|
||||
add_convert:
|
||||
add_convert:
|
||||
result = calloc(1, sizeof (Eet_Convert));
|
||||
|
||||
eina_hash_add(ed->converts, &idx, result);
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
# ifdef __cplusplus
|
||||
extern "C"
|
||||
# endif /* ifdef __cplusplus */
|
||||
void * alloca (size_t);
|
||||
void *alloca(size_t);
|
||||
#endif /* ifdef HAVE_ALLOCA_H */
|
||||
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
|
@ -42,7 +42,7 @@ void * alloca (size_t);
|
|||
|
||||
/*---*/
|
||||
|
||||
typedef struct _JPEG_error_mgr * emptr;
|
||||
typedef struct _JPEG_error_mgr *emptr;
|
||||
|
||||
/*---*/
|
||||
|
||||
|
@ -232,11 +232,13 @@ 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,
|
||||
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,
|
||||
static int
|
||||
eet_data_image_jpeg_rgb_decode(const void *data,
|
||||
int size,
|
||||
unsigned int src_x,
|
||||
unsigned int src_y,
|
||||
|
@ -244,7 +246,8 @@ static int eet_data_image_jpeg_rgb_decode(const void *data,
|
|||
unsigned int w,
|
||||
unsigned int h,
|
||||
unsigned int row_stride);
|
||||
static void * eet_data_image_jpeg_alpha_decode(const void *data,
|
||||
static void *
|
||||
eet_data_image_jpeg_alpha_decode(const void *data,
|
||||
int size,
|
||||
unsigned int src_x,
|
||||
unsigned int src_y,
|
||||
|
@ -252,24 +255,28 @@ static void * eet_data_image_jpeg_alpha_decode(const void *data,
|
|||
unsigned int w,
|
||||
unsigned int h,
|
||||
unsigned int row_stride);
|
||||
static void * eet_data_image_lossless_convert(int *size,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
static void *
|
||||
eet_data_image_jpeg_alpha_convert(int *size,
|
||||
const void *data,
|
||||
unsigned int w,
|
||||
unsigned int h,
|
||||
|
@ -282,22 +289,22 @@ 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
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
# ifdef __cplusplus
|
||||
extern "C"
|
||||
# endif /* ifdef __cplusplus */
|
||||
void * alloca (size_t);
|
||||
void *alloca(size_t);
|
||||
#endif /* ifdef HAVE_ALLOCA_H */
|
||||
|
||||
#ifdef _WIN32
|
||||
|
@ -66,7 +66,6 @@ GCRY_THREAD_OPTION_PTHREAD_IMPL;
|
|||
#include "Eet.h"
|
||||
#include "Eet_private.h"
|
||||
|
||||
|
||||
#ifndef O_BINARY
|
||||
# define O_BINARY 0
|
||||
#endif
|
||||
|
@ -207,37 +206,49 @@ char x509[x509_length]; /* The public certificate. */
|
|||
#define EET_FILE2_DIRECTORY_ENTRY_COUNT 6
|
||||
#define EET_FILE2_DICTIONARY_ENTRY_COUNT 5
|
||||
|
||||
#define EET_FILE2_HEADER_SIZE (sizeof(int) *\
|
||||
#define EET_FILE2_HEADER_SIZE (sizeof(int) * \
|
||||
EET_FILE2_HEADER_COUNT)
|
||||
#define EET_FILE2_DIRECTORY_ENTRY_SIZE (sizeof(int) *\
|
||||
#define EET_FILE2_DIRECTORY_ENTRY_SIZE (sizeof(int) * \
|
||||
EET_FILE2_DIRECTORY_ENTRY_COUNT)
|
||||
#define EET_FILE2_DICTIONARY_ENTRY_SIZE (sizeof(int) *\
|
||||
#define EET_FILE2_DICTIONARY_ENTRY_SIZE (sizeof(int) * \
|
||||
EET_FILE2_DICTIONARY_ENTRY_COUNT)
|
||||
|
||||
/* prototypes of internal calls */
|
||||
static Eet_File * eet_cache_find(const char *path,
|
||||
static Eet_File *
|
||||
eet_cache_find(const char *path,
|
||||
Eet_File **cache,
|
||||
int cache_num);
|
||||
static void eet_cache_add(Eet_File *ef,
|
||||
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,
|
||||
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 int
|
||||
eet_string_match(const char *s1,
|
||||
const char *s2);
|
||||
#if 0 /* Unused */
|
||||
static Eet_Error eet_flush(Eet_File *ef);
|
||||
static Eet_Error
|
||||
eet_flush(Eet_File *ef);
|
||||
#endif /* if 0 */
|
||||
static Eet_Error eet_flush2(Eet_File *ef);
|
||||
static Eet_File_Node * find_node_by_name(Eet_File *ef, const char *name);
|
||||
static int read_data_from_disk(Eet_File *ef,
|
||||
static Eet_Error
|
||||
eet_flush2(Eet_File *ef);
|
||||
static Eet_File_Node *
|
||||
find_node_by_name(Eet_File *ef,
|
||||
const char *name);
|
||||
static int
|
||||
read_data_from_disk(Eet_File *ef,
|
||||
Eet_File_Node *efn,
|
||||
void *buf,
|
||||
int len);
|
||||
|
||||
static Eet_Error eet_internal_close(Eet_File *ef, Eina_Bool locked);
|
||||
static Eet_Error
|
||||
eet_internal_close(Eet_File *ef,
|
||||
Eina_Bool locked);
|
||||
|
||||
static Eina_Lock eet_cache_lock;
|
||||
|
||||
|
@ -311,7 +322,6 @@ eet_cache_find(const char *path,
|
|||
if (eet_string_match(cache[i]->path, path))
|
||||
if (!cache[i]->delete_me_now)
|
||||
return cache[i];
|
||||
|
||||
}
|
||||
|
||||
/* not found */
|
||||
|
@ -441,7 +451,7 @@ eet_string_match(const char *s1,
|
|||
if (s1 == s2)
|
||||
return 1;
|
||||
|
||||
return (!strcmp(s1, s2));
|
||||
return !strcmp(s1, s2);
|
||||
} /* eet_string_match */
|
||||
|
||||
/* flush out writes to a v2 eet file */
|
||||
|
@ -865,11 +875,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 */
|
||||
|
@ -950,11 +960,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 */
|
||||
|
@ -1125,12 +1135,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 */
|
||||
|
@ -1415,7 +1425,7 @@ eet_internal_close(Eet_File *ef,
|
|||
if (ef->readfp)
|
||||
{
|
||||
if (ef->data)
|
||||
eina_file_map_free(ef->readfp, (void *) ef->data);
|
||||
eina_file_map_free(ef->readfp, (void *)ef->data);
|
||||
|
||||
eina_file_close(ef->readfp);
|
||||
}
|
||||
|
|
|
@ -52,7 +52,8 @@ _eet_node_new(const char *name,
|
|||
} /* _eet_node_new */
|
||||
|
||||
static void
|
||||
_eet_node_append(Eet_Node *n, Eina_List *nodes)
|
||||
_eet_node_append(Eet_Node *n,
|
||||
Eina_List *nodes)
|
||||
{
|
||||
Eet_Node *value;
|
||||
Eina_List *l;
|
||||
|
@ -64,32 +65,32 @@ _eet_node_append(Eet_Node *n, Eina_List *nodes)
|
|||
}
|
||||
} /* _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_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)
|
||||
|
@ -357,7 +358,6 @@ eet_node_hash_add(Eet_Node *parent,
|
|||
parent->values = nn;
|
||||
} /* eet_node_hash_add */
|
||||
|
||||
|
||||
int
|
||||
eet_node_type_get(Eet_Node *node)
|
||||
{
|
||||
|
@ -517,7 +517,8 @@ eet_node_dump_string_escape(void *dumpdata,
|
|||
} /* eet_node_dump_string_escape */
|
||||
|
||||
static void
|
||||
eet_node_dump_simple_type(Eet_Node *n, int level,
|
||||
eet_node_dump_simple_type(Eet_Node *n,
|
||||
int level,
|
||||
Eet_Dump_Callback dumpfunc,
|
||||
void *dumpdata)
|
||||
{
|
||||
|
@ -533,17 +534,17 @@ eet_node_dump_simple_type(Eet_Node *n, int level,
|
|||
# undef EET_T_TYPE
|
||||
#endif /* ifdef EET_T_TYPE */
|
||||
|
||||
#define EET_T_TYPE(Eet_Type, Type)\
|
||||
case Eet_Type:\
|
||||
{\
|
||||
dumpfunc(dumpdata, eet_node_dump_t_name[Eet_Type][0]);\
|
||||
snprintf(tbuf,\
|
||||
sizeof (tbuf),\
|
||||
eet_node_dump_t_name[Eet_Type][1],\
|
||||
n->data.value.Type);\
|
||||
dumpfunc(dumpdata, tbuf);\
|
||||
break;\
|
||||
}
|
||||
#define EET_T_TYPE(Eet_Type, Type) \
|
||||
case Eet_Type: \
|
||||
{ \
|
||||
dumpfunc(dumpdata, eet_node_dump_t_name[Eet_Type][0]); \
|
||||
snprintf(tbuf, \
|
||||
sizeof (tbuf), \
|
||||
eet_node_dump_t_name[Eet_Type][1], \
|
||||
n->data.value.Type); \
|
||||
dumpfunc(dumpdata, tbuf); \
|
||||
break; \
|
||||
}
|
||||
|
||||
switch (n->type)
|
||||
{
|
||||
|
|
|
@ -6,20 +6,22 @@
|
|||
#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);
|
||||
|
@ -27,7 +29,9 @@ _eet_eina_hash_foreach(void * hash, Eina_Hash_Foreach cb, void * fdata)
|
|||
|
||||
/* 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);
|
||||
|
@ -40,14 +44,14 @@ _eet_eina_hash_add(Eina_Hash * hash, const char * key, const void * data)
|
|||
} /* _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;
|
||||
|
|
|
@ -43,8 +43,8 @@ struct _Eet_Test_Basic_Type
|
|||
short s;
|
||||
int i;
|
||||
long long l;
|
||||
char * str;
|
||||
char * istr;
|
||||
char *str;
|
||||
char *istr;
|
||||
float f1;
|
||||
float f2;
|
||||
double d;
|
||||
|
@ -52,8 +52,8 @@ struct _Eet_Test_Basic_Type
|
|||
unsigned short us;
|
||||
unsigned int ui;
|
||||
unsigned long long ul;
|
||||
Eet_Test_Basic_Type * empty;
|
||||
Eet_Test_Basic_Type * with;
|
||||
Eet_Test_Basic_Type *empty;
|
||||
Eet_Test_Basic_Type *with;
|
||||
};
|
||||
|
||||
#define EET_TEST_CHAR 0x42
|
||||
|
@ -128,7 +128,8 @@ static const Eet_Test_Image test_alpha = {
|
|||
};
|
||||
|
||||
static void
|
||||
_eet_test_basic_set(Eet_Test_Basic_Type * res, int i)
|
||||
_eet_test_basic_set(Eet_Test_Basic_Type *res,
|
||||
int i)
|
||||
{
|
||||
res->c = EET_TEST_CHAR;
|
||||
res->s = EET_TEST_SHORT;
|
||||
|
@ -148,7 +149,7 @@ _eet_test_basic_set(Eet_Test_Basic_Type * res, int i)
|
|||
|
||||
if (i == 0)
|
||||
{
|
||||
Eet_Test_Basic_Type * tmp;
|
||||
Eet_Test_Basic_Type *tmp;
|
||||
|
||||
tmp = malloc(sizeof (Eet_Test_Basic_Type));
|
||||
fail_if(!tmp);
|
||||
|
@ -173,7 +174,8 @@ _eet_test_basic_set(Eet_Test_Basic_Type * res, int i)
|
|||
} /* _eet_test_basic_set */
|
||||
|
||||
static void
|
||||
_eet_test_basic_check(Eet_Test_Basic_Type * result, int i)
|
||||
_eet_test_basic_check(Eet_Test_Basic_Type *result,
|
||||
int i)
|
||||
{
|
||||
float tmp;
|
||||
|
||||
|
@ -209,7 +211,7 @@ _eet_test_basic_check(Eet_Test_Basic_Type * result, int i)
|
|||
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);
|
||||
|
@ -230,7 +232,7 @@ _eet_test_basic_check(Eet_Test_Basic_Type * result, int i)
|
|||
} /* _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,
|
||||
|
@ -304,11 +306,11 @@ _eet_build_basic_descriptor(Eet_Data_Descriptor * edd)
|
|||
|
||||
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();
|
||||
|
@ -348,8 +350,8 @@ struct _Eet_Test_Ex_Type
|
|||
short s;
|
||||
int i;
|
||||
unsigned long long l;
|
||||
char * str;
|
||||
char * istr;
|
||||
char *str;
|
||||
char *istr;
|
||||
float f1;
|
||||
float f2;
|
||||
float f3;
|
||||
|
@ -358,34 +360,34 @@ struct _Eet_Test_Ex_Type
|
|||
double d2;
|
||||
double d3;
|
||||
double d4;
|
||||
Eina_List * list;
|
||||
Eina_Hash * hash;
|
||||
Eina_List * ilist;
|
||||
Eina_List * slist;
|
||||
Eina_Hash * ihash;
|
||||
Eina_Hash * shash;
|
||||
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 *varray1;
|
||||
unsigned int varray2_count;
|
||||
Eet_Test_Basic_Type * varray2;
|
||||
Eet_Test_Basic_Type *varray2;
|
||||
unsigned char uc;
|
||||
unsigned short us;
|
||||
unsigned int ui;
|
||||
unsigned long long ul;
|
||||
char * charray[10];
|
||||
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";
|
||||
|
@ -525,12 +527,13 @@ _eet_build_ex_descriptor(Eet_Data_Descriptor * edd)
|
|||
} /* _eet_build_ex_descriptor */
|
||||
|
||||
static Eet_Test_Ex_Type *
|
||||
_eet_test_ex_set(Eet_Test_Ex_Type * res, int offset)
|
||||
_eet_test_ex_set(Eet_Test_Ex_Type *res,
|
||||
int offset)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
if (!res)
|
||||
res = malloc( sizeof(Eet_Test_Ex_Type));
|
||||
res = malloc(sizeof(Eet_Test_Ex_Type));
|
||||
|
||||
if (!res)
|
||||
return NULL;
|
||||
|
@ -583,7 +586,8 @@ _eet_test_ex_set(Eet_Test_Ex_Type * res, int offset)
|
|||
} /* _eet_test_ex_set */
|
||||
|
||||
static int
|
||||
_eet_test_ex_check(Eet_Test_Ex_Type * stuff, int offset)
|
||||
_eet_test_ex_check(Eet_Test_Ex_Type *stuff,
|
||||
int offset)
|
||||
{
|
||||
double tmp;
|
||||
unsigned int i;
|
||||
|
@ -673,9 +677,12 @@ _eet_test_ex_check(Eet_Test_Ex_Type * stuff, int offset)
|
|||
} /* _eet_test_ex_check */
|
||||
|
||||
static Eina_Bool
|
||||
func(__UNUSED__ const Eina_Hash * hash, const void * key, void * data, void * fdata)
|
||||
func(__UNUSED__ const Eina_Hash *hash,
|
||||
const void *key,
|
||||
void *data,
|
||||
void *fdata)
|
||||
{
|
||||
int * res = fdata;
|
||||
int *res = fdata;
|
||||
|
||||
if (strcmp(key, EET_TEST_KEY1) != 0
|
||||
&& strcmp(key, EET_TEST_KEY2) != 0)
|
||||
|
@ -688,13 +695,13 @@ func(__UNUSED__ const Eina_Hash * hash, const void * key, void * data, void * fd
|
|||
} /* 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)
|
||||
|
@ -708,9 +715,9 @@ func7(__UNUSED__ const Eina_Hash * hash,
|
|||
|
||||
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;
|
||||
|
@ -773,9 +780,10 @@ 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)
|
||||
|
@ -789,14 +797,14 @@ append_string(void * data, const char * str)
|
|||
|
||||
START_TEST(eet_test_data_type_dump_undump)
|
||||
{
|
||||
Eet_Data_Descriptor * edd;
|
||||
Eet_Test_Ex_Type * result;
|
||||
Eet_Data_Descriptor *edd;
|
||||
Eet_Test_Ex_Type *result;
|
||||
Eet_Data_Descriptor_Class eddc;
|
||||
Eet_Test_Ex_Type etbt;
|
||||
char * transfert1;
|
||||
char * transfert2;
|
||||
char * string1;
|
||||
char * string2;
|
||||
char *transfert1;
|
||||
char *transfert2;
|
||||
char *string1;
|
||||
char *string2;
|
||||
int size1;
|
||||
int size2;
|
||||
int test;
|
||||
|
@ -874,13 +882,12 @@ START_TEST(eet_test_data_type_dump_undump)
|
|||
eet_shutdown();
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST(eet_file_simple_write)
|
||||
{
|
||||
const char * buffer = "Here is a string of data to save !";
|
||||
Eet_File * ef;
|
||||
char * test;
|
||||
char * file = strdup("/tmp/eet_suite_testXXXXXX");
|
||||
const char *buffer = "Here is a string of data to save !";
|
||||
Eet_File *ef;
|
||||
char *test;
|
||||
char *file = strdup("/tmp/eet_suite_testXXXXXX");
|
||||
int size;
|
||||
|
||||
eet_init();
|
||||
|
@ -942,15 +949,14 @@ START_TEST(eet_file_simple_write)
|
|||
} /* START_TEST */
|
||||
|
||||
END_TEST
|
||||
|
||||
START_TEST(eet_file_data_test)
|
||||
{
|
||||
Eet_Data_Descriptor * edd;
|
||||
Eet_Test_Ex_Type * result;
|
||||
Eet_Dictionary * ed;
|
||||
Eet_File * ef;
|
||||
char ** list;
|
||||
char * file = strdup("/tmp/eet_suite_testXXXXXX");
|
||||
Eet_Data_Descriptor *edd;
|
||||
Eet_Test_Ex_Type *result;
|
||||
Eet_Dictionary *ed;
|
||||
Eet_File *ef;
|
||||
char **list;
|
||||
char *file = strdup("/tmp/eet_suite_testXXXXXX");
|
||||
Eet_Data_Descriptor_Class eddc;
|
||||
Eet_Test_Ex_Type etbt;
|
||||
int size;
|
||||
|
@ -1099,16 +1105,15 @@ START_TEST(eet_file_data_test)
|
|||
} /* START_TEST */
|
||||
|
||||
END_TEST
|
||||
|
||||
START_TEST(eet_file_data_dump_test)
|
||||
{
|
||||
Eet_Data_Descriptor * edd;
|
||||
Eet_Test_Ex_Type * result;
|
||||
Eet_Data_Descriptor *edd;
|
||||
Eet_Test_Ex_Type *result;
|
||||
Eet_Data_Descriptor_Class eddc;
|
||||
Eet_Test_Ex_Type etbt;
|
||||
Eet_File * ef;
|
||||
char * string1;
|
||||
char * file = strdup("/tmp/eet_suite_testXXXXXX");
|
||||
Eet_File *ef;
|
||||
char *string1;
|
||||
char *file = strdup("/tmp/eet_suite_testXXXXXX");
|
||||
int test;
|
||||
|
||||
eet_init();
|
||||
|
@ -1196,12 +1201,11 @@ START_TEST(eet_file_data_dump_test)
|
|||
} /* START_TEST */
|
||||
|
||||
END_TEST
|
||||
|
||||
START_TEST(eet_image)
|
||||
{
|
||||
Eet_File * ef;
|
||||
char * file = strdup("/tmp/eet_suite_testXXXXXX");
|
||||
unsigned int * data;
|
||||
Eet_File *ef;
|
||||
char *file = strdup("/tmp/eet_suite_testXXXXXX");
|
||||
unsigned int *data;
|
||||
int compress;
|
||||
int quality;
|
||||
int result;
|
||||
|
@ -1564,10 +1568,10 @@ END_TEST
|
|||
|
||||
START_TEST(eet_small_image)
|
||||
{
|
||||
char * file = strdup("/tmp/eet_suite_testXXXXXX");
|
||||
char *file = strdup("/tmp/eet_suite_testXXXXXX");
|
||||
unsigned int image[4];
|
||||
unsigned int * data;
|
||||
Eet_File * ef;
|
||||
unsigned int *data;
|
||||
Eet_File *ef;
|
||||
unsigned int w;
|
||||
unsigned int h;
|
||||
int alpha;
|
||||
|
@ -1621,16 +1625,15 @@ START_TEST(eet_small_image)
|
|||
} /* START_TEST */
|
||||
|
||||
END_TEST
|
||||
|
||||
START_TEST(eet_identity_simple)
|
||||
{
|
||||
const char * buffer = "Here is a string of data to save !";
|
||||
const void * tmp;
|
||||
Eet_File * ef;
|
||||
Eet_Key * k;
|
||||
FILE * noread;
|
||||
char * test;
|
||||
char * file = strdup("/tmp/eet_suite_testXXXXXX");
|
||||
const char *buffer = "Here is a string of data to save !";
|
||||
const void *tmp;
|
||||
Eet_File *ef;
|
||||
Eet_Key *k;
|
||||
FILE *noread;
|
||||
char *test;
|
||||
char *file = strdup("/tmp/eet_suite_testXXXXXX");
|
||||
int size;
|
||||
int fd;
|
||||
|
||||
|
@ -1698,10 +1701,9 @@ START_TEST(eet_identity_simple)
|
|||
} /* START_TEST */
|
||||
|
||||
END_TEST
|
||||
|
||||
START_TEST(eet_identity_open_simple)
|
||||
{
|
||||
Eet_Key * k = NULL;
|
||||
Eet_Key *k = NULL;
|
||||
|
||||
eet_init();
|
||||
|
||||
|
@ -1717,10 +1719,9 @@ START_TEST(eet_identity_open_simple)
|
|||
} /* START_TEST */
|
||||
|
||||
END_TEST
|
||||
|
||||
START_TEST(eet_identity_open_pkcs8)
|
||||
{
|
||||
Eet_Key * k = NULL;
|
||||
Eet_Key *k = NULL;
|
||||
|
||||
eet_init();
|
||||
|
||||
|
@ -1737,10 +1738,11 @@ START_TEST(eet_identity_open_pkcs8)
|
|||
|
||||
END_TEST
|
||||
|
||||
static int pass_get(char * pass,
|
||||
static int
|
||||
pass_get(char *pass,
|
||||
int size,
|
||||
__UNUSED__ int rwflags,
|
||||
__UNUSED__ void * u)
|
||||
__UNUSED__ void *u)
|
||||
{
|
||||
memset(pass, 0, size);
|
||||
|
||||
|
@ -1751,10 +1753,11 @@ static int pass_get(char * pass,
|
|||
return strlen(pass);
|
||||
} /* pass_get */
|
||||
|
||||
static int badpass_get(char * pass,
|
||||
static int
|
||||
badpass_get(char *pass,
|
||||
int size,
|
||||
__UNUSED__ int rwflags,
|
||||
__UNUSED__ void * u)
|
||||
__UNUSED__ void *u)
|
||||
{
|
||||
memset(pass, 0, size);
|
||||
|
||||
|
@ -1767,7 +1770,7 @@ static int badpass_get(char * pass,
|
|||
|
||||
START_TEST(eet_identity_open_pkcs8_enc)
|
||||
{
|
||||
Eet_Key * k = NULL;
|
||||
Eet_Key *k = NULL;
|
||||
|
||||
eet_init();
|
||||
|
||||
|
@ -1794,15 +1797,14 @@ START_TEST(eet_identity_open_pkcs8_enc)
|
|||
eet_shutdown();
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST(eet_cipher_decipher_simple)
|
||||
{
|
||||
const char * buffer = "Here is a string of data to save !";
|
||||
const char * key = "This is a crypto key";
|
||||
const char * key_bad = "This is another crypto key";
|
||||
Eet_File * ef;
|
||||
char * test;
|
||||
char * file = strdup("/tmp/eet_suite_testXXXXXX");
|
||||
const char *buffer = "Here is a string of data to save !";
|
||||
const char *key = "This is a crypto key";
|
||||
const char *key_bad = "This is another crypto key";
|
||||
Eet_File *ef;
|
||||
char *test;
|
||||
char *file = strdup("/tmp/eet_suite_testXXXXXX");
|
||||
int size;
|
||||
|
||||
eet_init();
|
||||
|
@ -1856,11 +1858,11 @@ static Eina_Bool open_worker_stop;
|
|||
# ifdef _EET_INCLUDED_PTHREAD
|
||||
|
||||
static void *
|
||||
open_close_worker(void * path)
|
||||
open_close_worker(void *path)
|
||||
{
|
||||
while (!open_worker_stop)
|
||||
{
|
||||
Eet_File * ef = eet_open((char const *)path, EET_FILE_MODE_READ);
|
||||
Eet_File *ef = eet_open((char const *)path, EET_FILE_MODE_READ);
|
||||
if (ef == NULL)
|
||||
pthread_exit("eet_open() failed");
|
||||
else
|
||||
|
@ -1877,11 +1879,11 @@ open_close_worker(void * path)
|
|||
# else /* ifdef _EET_INCLUDED_PTHREAD */
|
||||
|
||||
static unsigned int __stdcall
|
||||
open_close_worker(void * path)
|
||||
open_close_worker(void *path)
|
||||
{
|
||||
while (!open_worker_stop)
|
||||
{
|
||||
Eet_File * ef = eet_open((char const *)path, EET_FILE_MODE_READ);
|
||||
Eet_File *ef = eet_open((char const *)path, EET_FILE_MODE_READ);
|
||||
if (ef == NULL)
|
||||
_endthreadex(-1);
|
||||
else
|
||||
|
@ -1899,10 +1901,10 @@ open_close_worker(void * path)
|
|||
|
||||
START_TEST(eet_cache_concurrency)
|
||||
{
|
||||
char * file = strdup("/tmp/eet_suite_testXXXXXX");
|
||||
const char * buffer = "test data";
|
||||
Eet_File * ef;
|
||||
void * thread_ret;
|
||||
char *file = strdup("/tmp/eet_suite_testXXXXXX");
|
||||
const char *buffer = "test data";
|
||||
Eet_File *ef;
|
||||
void *thread_ret;
|
||||
unsigned int n;
|
||||
# ifdef _EET_INCLUDED_PTHREAD
|
||||
pthread_t thread;
|
||||
|
@ -1958,17 +1960,19 @@ END_TEST
|
|||
typedef struct _Eet_Connection_Data Eet_Connection_Data;
|
||||
struct _Eet_Connection_Data
|
||||
{
|
||||
Eet_Connection * conn;
|
||||
Eet_Data_Descriptor * edd;
|
||||
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);
|
||||
|
@ -2006,9 +2010,11 @@ _eet_connection_read(const void * eet_data, size_t size, void * user_data)
|
|||
} /* _eet_connection_read */
|
||||
|
||||
static Eina_Bool
|
||||
_eet_connection_write(const void * data, size_t size, void * user_data)
|
||||
_eet_connection_write(const void *data,
|
||||
size_t size,
|
||||
void *user_data)
|
||||
{
|
||||
Eet_Connection_Data * dt = user_data;
|
||||
Eet_Connection_Data *dt = user_data;
|
||||
int still;
|
||||
|
||||
if (!dt->test)
|
||||
|
@ -2030,8 +2036,8 @@ _eet_connection_write(const void * data, size_t size, void * user_data)
|
|||
|
||||
START_TEST(eet_connection_check)
|
||||
{
|
||||
Eet_Connection * conn;
|
||||
Eet_Data_Descriptor * edd;
|
||||
Eet_Connection *conn;
|
||||
Eet_Data_Descriptor *edd;
|
||||
Eet_Data_Descriptor_Class eddc;
|
||||
Eet_Connection_Data ecd;
|
||||
Eet_Test_Ex_Type etbt;
|
||||
|
@ -2110,12 +2116,12 @@ 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();
|
||||
|
@ -2168,17 +2174,16 @@ START_TEST(eet_fp)
|
|||
eet_shutdown();
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST(eet_file_fp)
|
||||
{
|
||||
char * file = strdup("/tmp/eet_suite_testXXXXXX");
|
||||
char *file = strdup("/tmp/eet_suite_testXXXXXX");
|
||||
Eet_Data_Descriptor_Class eddc;
|
||||
Eet_Data_Descriptor * edd_5FP;
|
||||
Eet_Data_Descriptor * edd_5DBL;
|
||||
Eet_File * ef;
|
||||
Eet_Data_Descriptor *edd_5FP;
|
||||
Eet_Data_Descriptor *edd_5DBL;
|
||||
Eet_File *ef;
|
||||
Eet_5FP origin;
|
||||
Eet_5DBL * convert;
|
||||
Eet_5FP * build;
|
||||
Eet_5DBL *convert;
|
||||
Eet_5FP *build;
|
||||
|
||||
eet_init();
|
||||
|
||||
|
@ -2262,7 +2267,7 @@ typedef enum _Eet_Union
|
|||
struct
|
||||
{
|
||||
Eet_Union u;
|
||||
const char * name;
|
||||
const char *name;
|
||||
} eet_mapping[] = {
|
||||
{ EET_ST1, "ST1" },
|
||||
{ EET_ST2, "ST2" },
|
||||
|
@ -2274,7 +2279,7 @@ struct _Eet_St1
|
|||
{
|
||||
double val1;
|
||||
int stuff;
|
||||
char * s1;
|
||||
char *s1;
|
||||
};
|
||||
|
||||
struct _Eet_St2
|
||||
|
@ -2301,7 +2306,7 @@ struct _Eet_Union_Test
|
|||
|
||||
struct _Eet_Variant_Type
|
||||
{
|
||||
const char * type;
|
||||
const char *type;
|
||||
Eina_Bool unknow : 1;
|
||||
};
|
||||
|
||||
|
@ -2309,8 +2314,8 @@ struct _Eet_Variant_Test
|
|||
{
|
||||
Eet_Variant_Type t;
|
||||
|
||||
void * data;
|
||||
Eina_List * data_list;
|
||||
void *data;
|
||||
Eina_List *data_list;
|
||||
};
|
||||
|
||||
struct _Eet_Inherit_Test1
|
||||
|
@ -2331,13 +2336,14 @@ struct _Eet_Inherit_Test3
|
|||
|
||||
struct _Eet_List
|
||||
{
|
||||
Eina_List * list;
|
||||
Eina_List *list;
|
||||
};
|
||||
|
||||
static const char *
|
||||
_eet_union_type_get(const void * data, Eina_Bool * unknow)
|
||||
_eet_union_type_get(const void *data,
|
||||
Eina_Bool *unknow)
|
||||
{
|
||||
const Eet_Union * u = data;
|
||||
const Eet_Union *u = data;
|
||||
int i;
|
||||
|
||||
if (unknow)
|
||||
|
@ -2354,9 +2360,11 @@ _eet_union_type_get(const void * data, Eina_Bool * unknow)
|
|||
} /* _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)
|
||||
|
@ -2373,9 +2381,10 @@ _eet_union_type_set(const char * type, void * data, Eina_Bool unknow)
|
|||
} /* _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)
|
||||
|
@ -2392,9 +2401,11 @@ _eet_variant_type_get(const void * data, Eina_Bool * unknow)
|
|||
} /* _eet_variant_type_get */
|
||||
|
||||
static Eina_Bool
|
||||
_eet_variant_type_set(const char * type, void * data, Eina_Bool unknow)
|
||||
_eet_variant_type_set(const char *type,
|
||||
void *data,
|
||||
Eina_Bool unknow)
|
||||
{
|
||||
Eet_Variant_Type * vt = data;
|
||||
Eet_Variant_Type *vt = data;
|
||||
|
||||
vt->type = type;
|
||||
vt->unknow = unknow;
|
||||
|
@ -2405,7 +2416,7 @@ 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);
|
||||
|
@ -2417,7 +2428,8 @@ _eet_st1_dd(void)
|
|||
} /* _eet_st1_dd */
|
||||
|
||||
static void
|
||||
_eet_st1_set(Eet_St1 * st1, int i)
|
||||
_eet_st1_set(Eet_St1 *st1,
|
||||
int i)
|
||||
{
|
||||
st1->val1 = EET_TEST_DOUBLE;
|
||||
st1->stuff = EET_TEST_INT + i;
|
||||
|
@ -2425,7 +2437,8 @@ _eet_st1_set(Eet_St1 * st1, int i)
|
|||
} /* _eet_st1_set */
|
||||
|
||||
static void
|
||||
_eet_st1_cmp(Eet_St1 * st1, int i)
|
||||
_eet_st1_cmp(Eet_St1 *st1,
|
||||
int i)
|
||||
{
|
||||
double tmp;
|
||||
|
||||
|
@ -2444,7 +2457,7 @@ static Eet_Data_Descriptor *
|
|||
_eet_st2_dd(void)
|
||||
{
|
||||
Eet_Data_Descriptor_Class eddc;
|
||||
Eet_Data_Descriptor * res;
|
||||
Eet_Data_Descriptor *res;
|
||||
|
||||
EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, Eet_St2);
|
||||
res = eet_data_descriptor_stream_new(&eddc);
|
||||
|
@ -2455,14 +2468,16 @@ _eet_st2_dd(void)
|
|||
} /* _eet_st2_dd */
|
||||
|
||||
static void
|
||||
_eet_st2_set(Eet_St2 * st2, int i)
|
||||
_eet_st2_set(Eet_St2 *st2,
|
||||
int i)
|
||||
{
|
||||
st2->b1 = EINA_TRUE;
|
||||
st2->v1 = EET_TEST_LONG_LONG + i;
|
||||
} /* _eet_st2_set */
|
||||
|
||||
static void
|
||||
_eet_st2_cmp(Eet_St2 * st2, int i)
|
||||
_eet_st2_cmp(Eet_St2 *st2,
|
||||
int i)
|
||||
{
|
||||
fail_if(!st2->b1);
|
||||
fail_if(st2->v1 != EET_TEST_LONG_LONG + i);
|
||||
|
@ -2472,7 +2487,7 @@ static Eet_Data_Descriptor *
|
|||
_eet_st3_dd(void)
|
||||
{
|
||||
Eet_Data_Descriptor_Class eddc;
|
||||
Eet_Data_Descriptor * res;
|
||||
Eet_Data_Descriptor *res;
|
||||
|
||||
EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, Eet_St3);
|
||||
res = eet_data_descriptor_stream_new(&eddc);
|
||||
|
@ -2482,26 +2497,28 @@ _eet_st3_dd(void)
|
|||
} /* _eet_st3_dd */
|
||||
|
||||
static void
|
||||
_eet_st3_set(Eet_St3 * st3, int i)
|
||||
_eet_st3_set(Eet_St3 *st3,
|
||||
int i)
|
||||
{
|
||||
st3->boby = EET_TEST_INT + i;
|
||||
} /* _eet_st3_set */
|
||||
|
||||
static void
|
||||
_eet_st3_cmp(Eet_St3 * st3, int i)
|
||||
_eet_st3_cmp(Eet_St3 *st3,
|
||||
int i)
|
||||
{
|
||||
fail_if(st3->boby != EET_TEST_INT + i);
|
||||
} /* _eet_st3_cmp */
|
||||
|
||||
START_TEST(eet_test_union)
|
||||
{
|
||||
Eet_Union_Test * eut;
|
||||
Eet_List * l;
|
||||
Eet_Union_Test *eut;
|
||||
Eet_List *l;
|
||||
Eet_Data_Descriptor_Class eddc;
|
||||
Eet_Data_Descriptor * edd;
|
||||
Eet_Data_Descriptor * unified;
|
||||
Eet_Data_Descriptor * m;
|
||||
void * blob;
|
||||
Eet_Data_Descriptor *edd;
|
||||
Eet_Data_Descriptor *unified;
|
||||
Eet_Data_Descriptor *m;
|
||||
void *blob;
|
||||
int size;
|
||||
int i;
|
||||
|
||||
|
@ -2529,9 +2546,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)
|
||||
|
@ -2554,9 +2571,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)
|
||||
|
@ -2570,19 +2587,18 @@ START_TEST(eet_test_union)
|
|||
eina_shutdown();
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST(eet_test_variant)
|
||||
{
|
||||
Eet_Variant_Test * evt;
|
||||
Eet_List * l;
|
||||
Eet_St1 * st1;
|
||||
Eet_St2 * st2;
|
||||
Eet_St3 * st3;
|
||||
Eet_Variant_Test *evt;
|
||||
Eet_List *l;
|
||||
Eet_St1 *st1;
|
||||
Eet_St2 *st2;
|
||||
Eet_St3 *st3;
|
||||
Eet_Data_Descriptor_Class eddc;
|
||||
Eet_Data_Descriptor * edd;
|
||||
Eet_Data_Descriptor * unified;
|
||||
Eet_Data_Descriptor * m;
|
||||
void * blob;
|
||||
Eet_Data_Descriptor *edd;
|
||||
Eet_Data_Descriptor *unified;
|
||||
Eet_Data_Descriptor *m;
|
||||
void *blob;
|
||||
int size;
|
||||
int i;
|
||||
|
||||
|
@ -2626,11 +2642,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)
|
||||
|
@ -2657,9 +2673,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)
|
||||
|
@ -2685,8 +2701,8 @@ END_TEST
|
|||
Suite *
|
||||
eet_suite(void)
|
||||
{
|
||||
Suite * s;
|
||||
TCase * tc;
|
||||
Suite *s;
|
||||
TCase *tc;
|
||||
|
||||
s = suite_create("Eet");
|
||||
|
||||
|
@ -2746,8 +2762,8 @@ eet_suite(void)
|
|||
int
|
||||
main(void)
|
||||
{
|
||||
Suite * s;
|
||||
SRunner * sr;
|
||||
Suite *s;
|
||||
SRunner *sr;
|
||||
int failed_count;
|
||||
|
||||
s = eet_suite();
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include "Eet.h"
|
||||
|
||||
void eet_test_setup_eddc(Eet_Data_Descriptor_Class * eddc);
|
||||
void
|
||||
eet_test_setup_eddc(Eet_Data_Descriptor_Class *eddc);
|
||||
|
||||
#endif /* _EET_SUITE_H */
|
||||
|
|
Loading…
Reference in New Issue