formatting. <- uncrustify

SVN revision: 50698
This commit is contained in:
Carsten Haitzler 2010-07-31 01:54:48 +00:00
parent 55d0190185
commit f7019f134d
17 changed files with 3675 additions and 3639 deletions

View File

@ -4,47 +4,46 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#endif /* ifdef HAVE_CONFIG_H */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifndef _MSC_VER
# include <unistd.h>
#endif
#endif /* ifndef _MSC_VER */
#ifdef HAVE_EVIL
# include <Evil.h>
#endif
#endif /* ifdef HAVE_EVIL */
#include <Eet.h>
static int _eet_main_log_dom = -1;
#ifdef EET_DEFAULT_LOG_COLOR
#undef EET_DEFAULT_LOG_COLOR
#endif
#endif /* ifdef EET_DEFAULT_LOG_COLOR */
#define EET_DEFAULT_LOG_COLOR EINA_COLOR_CYAN
#ifdef ERR
#undef ERR
#endif
#endif /* ifdef ERR */
#define ERR(...) EINA_LOG_DOM_ERR(_eet_main_log_dom, __VA_ARGS__)
#ifdef DBG
#undef DBG
#endif
#endif /* ifdef DBG */
#define DBG(...) EINA_LOG_DOM_DBG(_eet_main_log_dom, __VA_ARGS__)
#ifdef INF
#undef INF
#endif
#endif /* ifdef INF */
#define INF(...) EINA_LOG_DOM_INFO(_eet_main_log_dom, __VA_ARGS__)
#ifdef WRN
#undef WRN
#endif
#endif /* ifdef WRN */
#define WRN(...) EINA_LOG_DOM_WARN(_eet_main_log_dom, __VA_ARGS__)
#ifdef CRIT
#undef CRIT
#endif
#endif /* ifdef CRIT */
#define CRIT(...) EINA_LOG_DOM_CRIT(_eet_main_log_dom, __VA_ARGS__)
static void
@ -70,7 +69,7 @@ do_eet_list(const char *file)
}
eet_close(ef);
}
} /* do_eet_list */
static void
do_eet_extract(const char * file,
@ -113,13 +112,13 @@ do_eet_extract(const char *file,
fclose(f);
free(data);
eet_close(ef);
}
} /* do_eet_extract */
static void
do_eet_decode_dump(void * data, const char * str)
{
fputs(str, (FILE *)data);
}
} /* do_eet_decode_dump */
static void
do_eet_decode(const char * file,
@ -152,7 +151,7 @@ do_eet_decode(const char *file,
fclose(f);
eet_close(ef);
}
} /* do_eet_decode */
static void
do_eet_insert(const char * file,
@ -203,7 +202,7 @@ do_eet_insert(const char *file,
eet_write_cipher(ef, key, data, size, compress, crypto_key);
free(data);
eet_close(ef);
}
} /* do_eet_insert */
static void
do_eet_encode(const char * file,
@ -260,7 +259,7 @@ do_eet_encode(const char *file,
free(text);
eet_close(ef);
}
} /* do_eet_encode */
static void
do_eet_remove(const char * file, const char * key)
@ -276,7 +275,7 @@ do_eet_remove(const char *file, const char *key)
eet_delete(ef, key);
eet_close(ef);
}
} /* do_eet_remove */
static void
do_eet_check(const char * file)
@ -302,7 +301,7 @@ do_eet_check(const char *file)
fprintf(stdout, "Signature length %i.\n", sign_length);
eet_close(ef);
}
} /* do_eet_check */
static void
do_eet_sign(const char * file, const char * private_key, const char * public_key)
@ -330,7 +329,7 @@ do_eet_sign(const char *file, const char *private_key, const char *public_key)
eet_identity_set(ef, key);
eet_close(ef);
}
} /* do_eet_sign */
int
main(int argc, char ** argv)
@ -408,4 +407,5 @@ help:
eina_log_domain_unregister(_eet_main_log_dom);
eet_shutdown();
return 0;
}
} /* main */

View File

@ -120,7 +120,7 @@ _my_cache_descriptor_init(void)
EET_DATA_DESCRIPTOR_ADD_LIST
(_my_cache_descriptor, My_Cache, "accounts", accounts,
_my_account_descriptor);
}
} /* _my_cache_descriptor_init */
static void
_my_cache_descriptor_shutdown(void)
@ -129,7 +129,7 @@ _my_cache_descriptor_shutdown(void)
eet_data_descriptor_free(_my_account_descriptor);
eet_data_descriptor_free(_my_message_descriptor);
eet_data_descriptor_free(_my_post_descriptor);
}
} /* _my_cache_descriptor_shutdown */
// need to check if the pointer came from mmaped area in eet_dictionary
// or it was allocated with eina_stringshare_add()
@ -143,7 +143,7 @@ _eet_string_free(const char *str)
return;
eina_stringshare_del(str);
}
} /* _eet_string_free */
static My_Message *
_my_message_new(const char * message)
@ -157,7 +157,7 @@ _my_message_new(const char *message)
msg->message = eina_stringshare_add(message);
return msg;
}
} /* _my_message_new */
static void
_my_message_free(My_Message * msg)
@ -166,7 +166,7 @@ _my_message_free(My_Message *msg)
_eet_string_free(msg->name);
_eet_string_free(msg->message);
free(msg);
}
} /* _my_message_free */
static My_Post *
_my_post_new(const char * message)
@ -180,7 +180,7 @@ _my_post_new(const char *message)
post->message = eina_stringshare_add(message);
return post;
}
} /* _my_post_new */
static void
_my_post_free(My_Post * post)
@ -188,7 +188,7 @@ _my_post_free(My_Post *post)
_eet_string_free(post->dm_to);
_eet_string_free(post->message);
free(post);
}
} /* _my_post_free */
static My_Account *
_my_account_new(const char * name)
@ -202,7 +202,7 @@ _my_account_new(const char *name)
acc->name = eina_stringshare_add(name);
return acc;
}
} /* _my_account_new */
static void
_my_account_free(My_Account * acc)
@ -219,7 +219,7 @@ _my_account_free(My_Account *acc)
_my_post_free(p);
free(acc);
}
} /* _my_account_free */
static My_Cache *
_my_cache_new(void)
@ -233,7 +233,7 @@ _my_cache_new(void)
my_cache->version = 1;
return my_cache;
}
} /* _my_cache_new */
static void
_my_cache_free(My_Cache * my_cache)
@ -242,7 +242,7 @@ _my_cache_free(My_Cache *my_cache)
EINA_LIST_FREE(my_cache->accounts, acc)
_my_account_free(acc);
free(my_cache);
}
} /* _my_cache_free */
static My_Account *
_my_cache_account_find(My_Cache * my_cache, const char * name)
@ -254,7 +254,7 @@ _my_cache_account_find(My_Cache *my_cache, const char *name)
return acc;
return NULL;
}
} /* _my_cache_account_find */
static My_Cache *
_my_cache_load(const char * filename)
@ -290,7 +290,7 @@ _my_cache_load(const char *filename)
_my_cache_dict = eet_dictionary_get(ef);
return my_cache;
}
} /* _my_cache_load */
static Eina_Bool
_my_cache_save(const My_Cache * my_cache, const char * filename)
@ -343,7 +343,7 @@ _my_cache_save(const My_Cache *my_cache, const char *filename)
}
return ret;
}
} /* _my_cache_save */
int main(int argc, char * argv[])
{
@ -502,4 +502,5 @@ end:
eina_shutdown();
return ret;
}
} /* main */

View File

@ -32,7 +32,6 @@ typedef struct
// different strings
static const char MY_CONF_FILE_ENTRY[] = "config";
// keep the descriptor static global, so it can be
// shared by different functions (load/save) of this and only this
// file.
@ -85,14 +84,14 @@ _my_conf_descriptor_init(void)
#undef MY_CONF_ADD_BASIC
#undef MY_CONF_SUB_ADD_BASIC
}
} /* _my_conf_descriptor_init */
static void
_my_conf_descriptor_shutdown(void)
{
eet_data_descriptor_free(_my_conf_sub_descriptor);
eet_data_descriptor_free(_my_conf_descriptor);
}
} /* _my_conf_descriptor_shutdown */
static My_Conf_Type *
_my_conf_new(void)
@ -117,7 +116,7 @@ _my_conf_new(void)
}
return my_conf;
}
} /* _my_conf_new */
static void
_my_conf_free(My_Conf_Type * my_conf)
@ -131,7 +130,7 @@ _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)
@ -161,7 +160,7 @@ _my_conf_load(const char *filename)
end:
eet_close(ef);
return my_conf;
}
} /* _my_conf_load */
static Eina_Bool
_my_conf_save(const My_Conf_Type * my_conf, const char * filename)
@ -205,7 +204,7 @@ _my_conf_save(const My_Conf_Type *my_conf, const char *filename)
}
return ret;
}
} /* _my_conf_save */
int main(int argc, char * argv[])
{
@ -263,4 +262,5 @@ end:
eina_shutdown();
return ret;
}
} /* main */

View File

@ -25,7 +25,6 @@ typedef struct
// different strings
static const char MY_CONF_FILE_ENTRY[] = "config";
// keep the descriptor static global, so it can be
// shared by different functions (load/save) of this and only this
// file.
@ -63,13 +62,13 @@ _my_conf_descriptor_init(void)
MY_CONF_ADD_BASIC(enabled, EET_T_UCHAR);
#undef MY_CONF_ADD_BASIC
}
} /* _my_conf_descriptor_init */
static void
_my_conf_descriptor_shutdown(void)
{
eet_data_descriptor_free(_my_conf_descriptor);
}
} /* _my_conf_descriptor_shutdown */
static My_Conf_Type *
_my_conf_new(void)
@ -84,14 +83,14 @@ _my_conf_new(void)
my_conf->version = 0x112233;
my_conf->enabled = EINA_TRUE;
return my_conf;
}
} /* _my_conf_new */
static void
_my_conf_free(My_Conf_Type * my_conf)
{
eina_stringshare_del(my_conf->name);
free(my_conf);
}
} /* _my_conf_free */
static My_Conf_Type *
_my_conf_load(const char * filename)
@ -121,7 +120,7 @@ _my_conf_load(const char *filename)
end:
eet_close(ef);
return my_conf;
}
} /* _my_conf_load */
static Eina_Bool
_my_conf_save(const My_Conf_Type * my_conf, const char * filename)
@ -165,7 +164,7 @@ _my_conf_save(const My_Conf_Type *my_conf, const char *filename)
}
return ret;
}
} /* _my_conf_save */
int main(int argc, char * argv[])
{
@ -215,4 +214,5 @@ end:
eina_shutdown();
return ret;
}
} /* main */

View File

@ -7,33 +7,33 @@
#ifdef EAPI
# undef EAPI
#endif
#endif /* ifdef EAPI */
#ifdef _WIN32
# ifdef EFL_EET_BUILD
# ifdef DLL_EXPORT
# define EAPI __declspec(dllexport)
# else
# else /* ifdef DLL_EXPORT */
# define EAPI
# endif /* ! DLL_EXPORT */
# else
# else /* ifdef EFL_EET_BUILD */
# define EAPI __declspec(dllimport)
# endif /* ! EFL_EET_BUILD */
#else
#else /* ifdef _WIN32 */
# ifdef __GNUC__
# if __GNUC__ >= 4
# define EAPI __attribute__ ((visibility("default")))
# else
# else /* if __GNUC__ >= 4 */
# define EAPI
# endif
# else
# endif /* if __GNUC__ >= 4 */
# else /* ifdef __GNUC__ */
# define EAPI
# endif
# endif /* ifdef __GNUC__ */
#endif /* ! _WIN32 */
#ifdef __cplusplus
extern "C" {
#endif
#endif /* ifdef __cplusplus */
/**
* @file Eet.h
@ -149,7 +149,6 @@ EAPI int eet_shutdown(void);
*/
EAPI void eet_clearcache(void);
/**
* @defgroup Eet_File_Group Eet File Main Functions
*
@ -187,7 +186,6 @@ typedef struct _Eet_File Eet_File;
*/
typedef struct _Eet_Dictionary Eet_Dictionary;
/**
* @}
*/
@ -262,7 +260,8 @@ typedef struct _Eet_Dictionary Eet_Dictionary;
*
* @since 1.0.0
*/
EAPI Eet_File * eet_open(const char *file, Eet_File_Mode mode);
EAPI Eet_File * eet_open(const char * file,
Eet_File_Mode mode);
/**
* Open an eet file directly from a memory location. The data are not copied,
@ -273,7 +272,8 @@ EAPI Eet_File * eet_open(const char *file, Eet_File_Mode mode);
* @since 1.1.0
* @ingroup Eet_File_Group
*/
EAPI Eet_File * eet_memopen_read(const void *data, size_t size);
EAPI Eet_File * eet_memopen_read(const void * data,
size_t size);
/**
* Get the mode an Eet_File was opened with.
@ -371,7 +371,9 @@ EAPI int eet_dictionary_string_check(Eet_Dictionary *ed,
* @since 1.0.0
* @ingroup Eet_File_Group
*/
EAPI void * eet_read(Eet_File *ef, const char *name, int *size_ret);
EAPI void * eet_read(Eet_File * ef,
const char * name,
int * size_ret);
/**
* Read a specified entry from an eet file and return data
@ -449,7 +451,8 @@ EAPI int eet_write(Eet_File *ef,
* @since 1.0.0
* @ingroup Eet_File_Group
*/
EAPI int eet_delete(Eet_File *ef, const char *name);
EAPI int eet_delete(Eet_File * ef,
const char * name);
/**
* Alias a specific section to another one. Destination may exist or not,
@ -470,7 +473,6 @@ EAPI Eina_Bool eet_alias(Eet_File *ef,
const char * destination,
int compress);
/**
* List all entries in eet file matching shell glob.
* @param ef A valid eet file handle.
@ -501,7 +503,9 @@ EAPI Eina_Bool eet_alias(Eet_File *ef,
* @since 1.0.0
* @ingroup Eet_File_Group
*/
EAPI char **eet_list(Eet_File *ef, const char *glob, int *count_ret);
EAPI char ** eet_list(Eet_File * ef,
const char * glob,
int * count_ret);
/**
* Return the number of entries in the specified eet file.
@ -589,7 +593,6 @@ EAPI int eet_write_cipher(Eet_File *ef,
int compress,
const char * cipher_key);
/**
* @defgroup Eet_File_Image_Group Image Store and Load
*
@ -1184,7 +1187,6 @@ EAPI int eet_data_image_write_cipher(Eet_File *ef,
int quality,
int lossy);
/**
* Decode Image data header only to get information using a cipher.
* @param data The encoded pixel data.
@ -1381,7 +1383,6 @@ EAPI void *eet_data_image_encode_cipher(const void *data,
int lossy,
int * size_ret);
/**
* @defgroup Eet_Cipher_Group Cipher, Identity and Protection Mechanisms
*
@ -1406,7 +1407,6 @@ typedef struct _Eet_Key Eet_Key;
* @}
*/
/**
* Callback used to request if needed the password of a private key.
*
@ -1419,8 +1419,7 @@ typedef struct _Eet_Key Eet_Key;
* @since 1.2.0
* @ingroup Eet_Cipher_Group
*/
typedef int (*Eet_Key_Password_Callback)(char *buffer, int size, int rwflag,
void *data);
typedef int (* Eet_Key_Password_Callback)(char * buffer, int size, int rwflag, void * data);
/**
* Create an Eet_Key needed for signing an eet file.
@ -1466,7 +1465,8 @@ EAPI void eet_identity_close(Eet_Key *key);
* @since 1.2.0
* @ingroup Eet_Cipher_Group
*/
EAPI Eet_Error eet_identity_set(Eet_File *ef, Eet_Key *key);
EAPI Eet_Error eet_identity_set(Eet_File * ef,
Eet_Key * key);
/**
* Display both private and public key of an Eet_Key.
@ -1477,7 +1477,8 @@ EAPI Eet_Error eet_identity_set(Eet_File *ef, Eet_Key *key);
* @since 1.2.0
* @ingroup Eet_Cipher_Group
*/
EAPI void eet_identity_print(Eet_Key *key, FILE *out);
EAPI void eet_identity_print(Eet_Key * key,
FILE * out);
/**
* Get the x509 der certificate associated with an Eet_File. Will return NULL
@ -1490,7 +1491,8 @@ EAPI void eet_identity_print(Eet_Key *key, FILE *out);
* @since 1.2.0
* @ingroup Eet_Cipher_Group
*/
EAPI const void *eet_identity_x509(Eet_File *ef, int *der_length);
EAPI const void * eet_identity_x509(Eet_File * ef,
int * der_length);
/**
* Get the raw signature associated with an Eet_File. Will return NULL
@ -1502,7 +1504,8 @@ EAPI const void *eet_identity_x509(Eet_File *ef, int *der_length);
*
* @ingroup Eet_Cipher_Group
*/
EAPI const void *eet_identity_signature(Eet_File *ef, int *signature_length);
EAPI const void * eet_identity_signature(Eet_File * ef,
int * signature_length);
/**
* Get the SHA1 associated with a file. Could be the one used to
@ -1516,7 +1519,8 @@ EAPI const void *eet_identity_signature(Eet_File *ef, int *signature_length);
* @since 1.2.0
* @ingroup Eet_Cipher_Group
*/
EAPI const void *eet_identity_sha1(Eet_File *ef, int *sha1_length);
EAPI const void * eet_identity_sha1(Eet_File * ef,
int * sha1_length);
/**
* Display the x509 der certificate to out.
@ -1528,12 +1532,10 @@ EAPI const void *eet_identity_sha1(Eet_File *ef, int *sha1_length);
* @since 1.2.0
* @ingroup Eet_Cipher_Group
*/
EAPI void eet_identity_certificate_print(
const unsigned char *certificate,
EAPI void eet_identity_certificate_print(const unsigned char * certificate,
int der_length,
FILE * out);
/**
* @defgroup Eet_Data_Group Eet Data Serialization
*
@ -1769,14 +1771,11 @@ struct _Eet_Data_Descriptor_Class
void * (* list_append)(void * l, void * d); /**< how to append data @p d to list which head node is @p l */
void * (* list_data)(void * l); /**< retrieves the data from node @p l */
void * (* list_free)(void * l); /**< free all the nodes from the list which head node is @p l */
void (*hash_foreach)(void *h,
int (*func)(void *h, const char *k, void *dt,
void *fdt), void *fdt); /**< iterates over all elements in the hash @p h in no specific order */
void (* hash_foreach)(void * h, int (* func)(void * h, const char * k, void * dt, void * fdt), void * fdt); /**< iterates over all elements in the hash @p h in no specific order */
void * (* hash_add)(void * h, const char * k, void * d); /**< add a new data @p d as key @p k in hash @p h */
void (* hash_free)(void * h); /**< free all entries from the hash @p h */
char * (* str_direct_alloc)(const char * str); /**< how to allocate a string directly from file backed/mmaped region pointed by @p str */
void (* str_direct_free)(const char * str); /**< how to free a string returned by str_direct_alloc */
const char *(* type_get)(const void * data, Eina_Bool * unknow); /**< convert any kind of data type to a name that define an Eet_Data_Element. */
Eina_Bool (* type_set)(const char * type, void * data, Eina_Bool unknow); /**< set the type at a particular adress */
} func;
@ -1824,8 +1823,7 @@ struct _Eet_Data_Descriptor_Class
* @deprecated use eet_data_descriptor_stream_new() or
* eet_data_descriptor_file_new()
*/
EINA_DEPRECATED EAPI Eet_Data_Descriptor *eet_data_descriptor_new(
const char *name,
EINA_DEPRECATED EAPI Eet_Data_Descriptor * eet_data_descriptor_new(const char * name,
int size,
void *(*func_list_next)(void * l),
void *(*func_list_append)(void * l, void * d),
@ -1843,10 +1841,8 @@ EINA_DEPRECATED EAPI Eet_Data_Descriptor *eet_data_descriptor_new(
* moving to this api from the old above. this will break things when the
* move happens - but be warned
*/
EINA_DEPRECATED EAPI Eet_Data_Descriptor *eet_data_descriptor2_new(
const Eet_Data_Descriptor_Class *eddc);
EINA_DEPRECATED EAPI Eet_Data_Descriptor *eet_data_descriptor3_new(
const Eet_Data_Descriptor_Class *eddc);
EINA_DEPRECATED EAPI Eet_Data_Descriptor * eet_data_descriptor2_new(const Eet_Data_Descriptor_Class * eddc);
EINA_DEPRECATED EAPI Eet_Data_Descriptor * eet_data_descriptor3_new(const Eet_Data_Descriptor_Class * eddc);
/**
* This function creates a new data descriptore and returns a handle to the
@ -1872,8 +1868,7 @@ EINA_DEPRECATED EAPI Eet_Data_Descriptor *eet_data_descriptor3_new(
* @since 1.2.3
* @ingroup Eet_Data_Group
*/
EAPI Eet_Data_Descriptor * eet_data_descriptor_stream_new(
const Eet_Data_Descriptor_Class *eddc);
EAPI Eet_Data_Descriptor * eet_data_descriptor_stream_new(const Eet_Data_Descriptor_Class * eddc);
/**
* This function creates a new data descriptore and returns a handle to the
@ -1902,8 +1897,7 @@ EAPI Eet_Data_Descriptor * eet_data_descriptor_stream_new(
* @since 1.2.3
* @ingroup Eet_Data_Group
*/
EAPI Eet_Data_Descriptor * eet_data_descriptor_file_new(
const Eet_Data_Descriptor_Class *eddc);
EAPI Eet_Data_Descriptor * eet_data_descriptor_file_new(const Eet_Data_Descriptor_Class * eddc);
/**
* This function is an helper that set all the parameter of an
@ -1919,9 +1913,7 @@ EAPI Eet_Data_Descriptor * eet_data_descriptor_file_new(
* @since 1.2.3
* @ingroup Eet_Data_Group
*/
EAPI Eina_Bool
eet_eina_stream_data_descriptor_class_set(
Eet_Data_Descriptor_Class *eddc,
EAPI Eina_Bool eet_eina_stream_data_descriptor_class_set(Eet_Data_Descriptor_Class * eddc,
const char * name,
int size);
@ -1938,9 +1930,8 @@ EAPI Eina_Bool
* @since 1.2.3
* @ingroup Eet_Data_Group
*/
#define EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(Clas, \
Type) ( \
eet_eina_stream_data_descriptor_class_set(Clas, # Type, sizeof (Type)))
#define EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(clas, type)\
(eet_eina_stream_data_descriptor_class_set(clas, # type, sizeof(type)))
/**
* This function is an helper that set all the parameter of an
@ -1956,8 +1947,7 @@ EAPI Eina_Bool
* @since 1.2.3
* @ingroup Eet_Data_Group
*/
EAPI Eina_Bool eet_eina_file_data_descriptor_class_set(
Eet_Data_Descriptor_Class *eddc,
EAPI Eina_Bool eet_eina_file_data_descriptor_class_set(Eet_Data_Descriptor_Class * eddc,
const char * name,
int size);
@ -1974,9 +1964,8 @@ EAPI Eina_Bool eet_eina_file_data_descriptor_class_set(
* @since 1.2.3
* @ingroup Eet_Data_Group
*/
#define EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(Clas, \
Type) ( \
eet_eina_file_data_descriptor_class_set(Clas, # Type, sizeof (Type)))
#define EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(clas, type) (\
eet_eina_file_data_descriptor_class_set(clas, # type, sizeof(type)))
/**
* This function frees a data descriptor when it is not needed anymore.
@ -2022,7 +2011,8 @@ EAPI void eet_data_descriptor_element_add(Eet_Data_Descriptor *edd,
int type,
int group_type,
int offset,
/* int count_offset, */ int count,
/* int count_offset, */
int count,
const char * counter_name,
Eet_Data_Descriptor * subtype);
@ -2127,9 +2117,10 @@ EAPI int eet_data_write(Eet_File *ef,
* @since 1.0.0
* @ingroup Eet_Data_Group
*/
EAPI int eet_data_text_dump(const void *data_in, int size_in, void (*dumpfunc)(
void *data,
const char *str), void *dumpdata);
EAPI int eet_data_text_dump(const void * data_in,
int size_in,
void (* dumpfunc)(void * data, const char * str),
void * dumpdata);
/**
* Take an ascii encoding from eet_data_text_dump() and re-encode in binary.
@ -2150,7 +2141,9 @@ EAPI int eet_data_text_dump(const void *data_in, int size_in, void (*dumpfunc)
* @since 1.0.0
* @ingroup Eet_Data_Group
*/
EAPI void *eet_data_text_undump(const char *text, int textlen, int *size_ret);
EAPI void * eet_data_text_undump(const char * text,
int textlen,
int * size_ret);
/**
* Dump an eet encoded data structure from an eet file into ascii text
@ -2175,9 +2168,10 @@ EAPI void *eet_data_text_undump(const char *text, int textlen, int *size_ret);
* @since 1.0.0
* @ingroup Eet_Data_Group
*/
EAPI int eet_data_dump(Eet_File *ef, const char *name, void (*dumpfunc)(
void *data,
const char *str), void *dumpdata);
EAPI int eet_data_dump(Eet_File * ef,
const char * name,
void (* dumpfunc)(void * data, const char * str),
void * dumpdata);
/**
* Take an ascii encoding from eet_data_dump() and re-encode in binary.
@ -2296,14 +2290,13 @@ EAPI void *eet_data_descriptor_encode(Eet_Data_Descriptor *edd,
* @ingroup Eet_Data_Group
*/
#define EET_DATA_DESCRIPTOR_ADD_BASIC(edd, struct_type, name, member, type)\
{ \
do {\
struct_type ___ett;\
\
eet_data_descriptor_element_add(edd, name, type, EET_G_UNKNOWN,\
(char *)(& (___ett.member)) -\
(char *)(& (___ett)),\
0, /* 0, */ NULL, NULL);\
}
} while(0)
/**
* Add a sub-element type to a data descriptor
@ -2324,14 +2317,14 @@ EAPI void *eet_data_descriptor_encode(Eet_Data_Descriptor *edd,
* @ingroup Eet_Data_Group
*/
#define EET_DATA_DESCRIPTOR_ADD_SUB(edd, struct_type, name, member, subtype)\
{ \
do {\
struct_type ___ett;\
\
eet_data_descriptor_element_add(edd, name, EET_T_UNKNOW, EET_G_UNKNOWN,\
(char *)(& (___ett.member)) -\
(char *)(& (___ett)),\
0, /* 0, */ NULL, subtype);\
}
} while (0)
/**
* Add a linked list type to a data descriptor
@ -2351,14 +2344,14 @@ EAPI void *eet_data_descriptor_encode(Eet_Data_Descriptor *edd,
* @ingroup Eet_Data_Group
*/
#define EET_DATA_DESCRIPTOR_ADD_LIST(edd, struct_type, name, member, subtype)\
{ \
do {\
struct_type ___ett;\
\
eet_data_descriptor_element_add(edd, name, EET_T_UNKNOW, EET_G_LIST,\
(char *)(& (___ett.member)) -\
(char *)(& (___ett)),\
0, /* 0, */ NULL, subtype);\
}
} while (0)
/**
* Add a hash type to a data descriptor
@ -2378,14 +2371,14 @@ EAPI void *eet_data_descriptor_encode(Eet_Data_Descriptor *edd,
* @ingroup Eet_Data_Group
*/
#define EET_DATA_DESCRIPTOR_ADD_HASH(edd, struct_type, name, member, subtype)\
{ \
do {\
struct_type ___ett;\
\
eet_data_descriptor_element_add(edd, name, EET_T_UNKNOW, EET_G_HASH,\
(char *)(& (___ett.member)) -\
(char *)(& (___ett)),\
0, /* 0, */ NULL, subtype);\
}
} while (0)
/**
* Add a fixed size array type to a data descriptor
@ -2406,7 +2399,7 @@ EAPI void *eet_data_descriptor_encode(Eet_Data_Descriptor *edd,
* @ingroup Eet_Data_Group
*/
#define EET_DATA_DESCRIPTOR_ADD_ARRAY(edd, struct_type, name, member, subtype)\
{ \
do {\
struct_type ___ett;\
\
eet_data_descriptor_element_add(edd, name, EET_T_UNKNOW, EET_G_ARRAY,\
@ -2414,7 +2407,7 @@ EAPI void *eet_data_descriptor_encode(Eet_Data_Descriptor *edd,
(char *)(& (___ett)),\
/* 0, */ sizeof(___ett.member) /\
sizeof(___ett.member[0]), NULL, subtype);\
}
} while (0)
/**
* Add a variable size array type to a data descriptor
@ -2439,7 +2432,7 @@ EAPI void *eet_data_descriptor_encode(Eet_Data_Descriptor *edd,
name,\
member,\
subtype)\
{ \
do {\
struct_type ___ett;\
\
eet_data_descriptor_element_add(edd,\
@ -2452,7 +2445,7 @@ EAPI void *eet_data_descriptor_encode(Eet_Data_Descriptor *edd,
(char *)(& (___ett)),\
/* 0, */ NULL,\
subtype);\
}
} while (0)
/**
* Add an union type to a data descriptor
@ -2479,7 +2472,7 @@ EAPI void *eet_data_descriptor_encode(Eet_Data_Descriptor *edd,
member,\
type_member,\
unified_type)\
{ \
do {\
struct_type ___ett;\
\
eet_data_descriptor_element_add(edd, name, EET_T_UNKNOW, EET_G_UNION,\
@ -2488,7 +2481,7 @@ EAPI void *eet_data_descriptor_encode(Eet_Data_Descriptor *edd,
(char *)(& (___ett.type_member)) -\
(char *)(& (___ett)),\
NULL, unified_type);\
}
} while (0)
/**
* Add a automatically selectable type to a data descriptor
@ -2517,7 +2510,7 @@ EAPI void *eet_data_descriptor_encode(Eet_Data_Descriptor *edd,
member,\
type_member,\
unified_type)\
{ \
do {\
struct_type ___ett;\
\
eet_data_descriptor_element_add(edd, name, EET_T_UNKNOW, EET_G_VARIANT,\
@ -2526,7 +2519,7 @@ EAPI void *eet_data_descriptor_encode(Eet_Data_Descriptor *edd,
(char *)(& (___ett.type_member)) -\
(char *)(& (___ett)),\
NULL, unified_type);\
}
} while (0)
/**
* Add a mapping to a data descriptor that will be used by union, variant or inherited type
@ -2546,7 +2539,7 @@ EAPI void *eet_data_descriptor_encode(Eet_Data_Descriptor *edd,
0,\
0,\
NULL,\
subtype);
subtype)
/**
* @defgroup Eet_Data_Cipher_Group Eet Data Serialization using A Ciphers
@ -2880,55 +2873,64 @@ struct _Eet_Node_Data
* TODO FIX ME
* @ingroup Eet_Node_Group
*/
EAPI Eet_Node *eet_node_char_new(const char *name, char c);
EAPI Eet_Node * eet_node_char_new(const char * name,
char c);
/**
* TODO FIX ME
* @ingroup Eet_Node_Group
*/
EAPI Eet_Node *eet_node_short_new(const char *name, short s);
EAPI Eet_Node * eet_node_short_new(const char * name,
short s);
/**
* TODO FIX ME
* @ingroup Eet_Node_Group
*/
EAPI Eet_Node *eet_node_int_new(const char *name, int i);
EAPI Eet_Node * eet_node_int_new(const char * name,
int i);
/**
* TODO FIX ME
* @ingroup Eet_Node_Group
*/
EAPI Eet_Node *eet_node_long_long_new(const char *name, long long l);
EAPI Eet_Node * eet_node_long_long_new(const char * name,
long long l);
/**
* TODO FIX ME
* @ingroup Eet_Node_Group
*/
EAPI Eet_Node *eet_node_float_new(const char *name, float f);
EAPI Eet_Node * eet_node_float_new(const char * name,
float f);
/**
* TODO FIX ME
* @ingroup Eet_Node_Group
*/
EAPI Eet_Node *eet_node_double_new(const char *name, double d);
EAPI Eet_Node * eet_node_double_new(const char * name,
double d);
/**
* TODO FIX ME
* @ingroup Eet_Node_Group
*/
EAPI Eet_Node *eet_node_unsigned_char_new(const char *name, unsigned char uc);
EAPI Eet_Node * eet_node_unsigned_char_new(const char * name,
unsigned char uc);
/**
* TODO FIX ME
* @ingroup Eet_Node_Group
*/
EAPI Eet_Node *eet_node_unsigned_short_new(const char *name, unsigned short us);
EAPI Eet_Node * eet_node_unsigned_short_new(const char * name,
unsigned short us);
/**
* TODO FIX ME
* @ingroup Eet_Node_Group
*/
EAPI Eet_Node *eet_node_unsigned_int_new(const char *name, unsigned int ui);
EAPI Eet_Node * eet_node_unsigned_int_new(const char * name,
unsigned int ui);
/**
* TODO FIX ME
@ -2941,13 +2943,15 @@ EAPI Eet_Node *eet_node_unsigned_long_long_new(const char *name,
* TODO FIX ME
* @ingroup Eet_Node_Group
*/
EAPI Eet_Node *eet_node_string_new(const char *name, const char *str);
EAPI Eet_Node * eet_node_string_new(const char * name,
const char * str);
/**
* TODO FIX ME
* @ingroup Eet_Node_Group
*/
EAPI Eet_Node *eet_node_inlined_string_new(const char *name, const char *str);
EAPI Eet_Node * eet_node_inlined_string_new(const char * name,
const char * str);
/**
* TODO FIX ME
@ -2959,19 +2963,23 @@ EAPI Eet_Node *eet_node_null_new(const char *name);
* TODO FIX ME
* @ingroup Eet_Node_Group
*/
EAPI Eet_Node *eet_node_list_new(const char *name, Eina_List *nodes);
EAPI Eet_Node * eet_node_list_new(const char * name,
Eina_List * nodes);
/**
* TODO FIX ME
* @ingroup Eet_Node_Group
*/
EAPI Eet_Node *eet_node_array_new(const char *name, int count, Eina_List *nodes);
EAPI Eet_Node * eet_node_array_new(const char * name,
int count,
Eina_List * nodes);
/**
* TODO FIX ME
* @ingroup Eet_Node_Group
*/
EAPI Eet_Node *eet_node_var_array_new(const char *name, Eina_List *nodes);
EAPI Eet_Node * eet_node_var_array_new(const char * name,
Eina_List * nodes);
/**
* TODO FIX ME
@ -2985,14 +2993,15 @@ EAPI Eet_Node *eet_node_hash_new(const char *name,
* TODO FIX ME
* @ingroup Eet_Node_Group
*/
EAPI Eet_Node *eet_node_struct_new(const char *name, Eina_List *nodes);
EAPI Eet_Node * eet_node_struct_new(const char * name,
Eina_List * nodes);
/**
* TODO FIX ME
* @ingroup Eet_Node_Group
*/
EAPI Eet_Node *eet_node_struct_child_new(const char *parent, Eet_Node *child);
EAPI Eet_Node * eet_node_struct_child_new(const char * parent,
Eet_Node * child);
/**
* TODO FIX ME
@ -3019,14 +3028,14 @@ EAPI void eet_node_hash_add(Eet_Node *parent,
const char * key,
Eet_Node * child);
/**
* TODO FIX ME
* @ingroup Eet_Node_Group
*/
EAPI void eet_node_dump(Eet_Node *n, int dumplevel, void (*dumpfunc)(
void *data,
const char *str), void *dumpdata);
EAPI void eet_node_dump(Eet_Node * n,
int dumplevel,
void (* dumpfunc)(void * data, const char * str),
void * dumpdata);
/**
* TODO FIX ME
@ -3083,15 +3092,12 @@ typedef struct _Eet_Node_Walk Eet_Node_Walk;
struct _Eet_Node_Walk
{
void *(* struct_alloc)(const char * type, void * user_data);
void (*struct_add)(void *parent, const char *name, void *child,
void *user_data);
void *(*array)(Eina_Bool variable, const char *name, int count,
void *user_data);
void (* struct_add)(void * parent, const char * name, void * child, void * user_data);
void *(* array)(Eina_Bool variable, const char * name, int count, void * user_data);
void (* insert)(void * array, int index, void * child, void * user_data);
void *(* list)(const char * name, void * user_data);
void (* append)(void * list, void * child, void * user_data);
void *(*hash)(void *parent, const char *name, const char *key, void *value,
void *user_data);
void *(* hash)(void * parent, const char * name, const char * key, void * value, void * user_data);
void *(* simple)(int type, Eet_Node_Data * data, void * user_data);
};
@ -3124,8 +3130,7 @@ typedef struct _Eet_Connection Eet_Connection;
*
* @ingroup Eet_Connection_Group
*/
typedef Eina_Bool Eet_Read_Cb (const void *eet_data, size_t size,
void *user_data);
typedef Eina_Bool Eet_Read_Cb (const void * eet_data, size_t size, void * user_data);
/**
* @typedef Eet_Write_Cb
@ -3227,6 +3232,6 @@ EAPI void * eet_connection_close(Eet_Connection *conn,
#ifdef __cplusplus
}
#endif
#endif /* ifdef __cplusplus */
#endif
#endif /* ifndef _EET_H */

View File

@ -76,27 +76,27 @@ extern int _eet_log_dom_global;
*/
#ifdef EET_DEFAULT_LOG_COLOR
# undef EET_DEFAULT_LOG_COLOR
#endif
#endif /* ifdef EET_DEFAULT_LOG_COLOR */
#define EET_DEFAULT_LOG_COLOR EINA_COLOR_CYAN
#ifdef ERR
# undef ERR
#endif
#endif /* ifdef ERR */
#define ERR(...) EINA_LOG_DOM_ERR(_eet_log_dom_global, __VA_ARGS__)
#ifdef DBG
# undef DBG
#endif
#endif /* ifdef DBG */
#define DBG(...) EINA_LOG_DOM_DBG(_eet_log_dom_global, __VA_ARGS__)
#ifdef INF
# undef INF
#endif
#endif /* ifdef INF */
#define INF(...) EINA_LOG_DOM_INFO(_eet_log_dom_global, __VA_ARGS__)
#ifdef WRN
# undef WRN
#endif
#endif /* ifdef WRN */
#define WRN(...) EINA_LOG_DOM_WARN(_eet_log_dom_global, __VA_ARGS__)
#ifdef CRIT
# undef CRIT
#endif
#endif /* ifdef CRIT */
#define CRIT(...) EINA_LOG_DOM_CRIT(_eet_log_dom_global, __VA_ARGS__)
Eet_Dictionary * eet_dictionary_add(void);
@ -145,7 +145,8 @@ Eet_Error eet_decipher(const void *data,
unsigned int length,
void ** result,
unsigned int * result_length);
Eet_Error eet_identity_sign(FILE *fp, Eet_Key *key);
Eet_Error eet_identity_sign(FILE * fp,
Eet_Key * key);
void eet_identity_unref(Eet_Key * key);
void eet_identity_ref(Eet_Key * key);
@ -156,12 +157,12 @@ void eet_node_free(Eet_Node *node);
#ifndef PATH_MAX
# define PATH_MAX 4096
#endif
#endif /* ifndef PATH_MAX */
#ifdef DNDEBUG
# define EET_ASSERT(Test, Do) if (Test == 0) {Do; }
#else
#else /* ifdef DNDEBUG */
# define EET_ASSERT(Test, Do) if (Test == 0) {abort(); }
#endif
#endif /* ifdef DNDEBUG */
#endif
#endif /* ifndef _EET_PRIVATE_H */

View File

@ -1,6 +1,6 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#endif /* ifdef HAVE_CONFIG_H */
#ifdef HAVE_ALLOCA_H
# include <alloca.h>
@ -11,13 +11,13 @@
#elif defined _MSC_VER
# include <malloc.h>
# define alloca _alloca
#else
#else /* ifdef HAVE_ALLOCA_H */
# include <stddef.h>
# ifdef __cplusplus
extern "C"
# endif
# endif /* ifdef __cplusplus */
void * alloca (size_t);
#endif
#endif /* ifdef HAVE_ALLOCA_H */
#include <stdio.h>
#include <string.h>
@ -27,17 +27,17 @@ void *alloca (size_t);
#ifndef _MSC_VER
# include <unistd.h>
#endif
#endif /* ifndef _MSC_VER */
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
#endif /* ifdef HAVE_NETINET_IN_H */
#ifdef HAVE_SIGNATURE
# ifdef HAVE_GNUTLS
# include <gnutls/gnutls.h>
# include <gnutls/x509.h>
# else
# else /* ifdef HAVE_GNUTLS */
# include <openssl/rsa.h>
# include <openssl/objects.h>
# include <openssl/err.h>
@ -47,23 +47,23 @@ void *alloca (size_t);
# include <openssl/evp.h>
# include <openssl/x509.h>
# include <openssl/pem.h>
# endif
#endif
# endif /* ifdef HAVE_GNUTLS */
#endif /* ifdef HAVE_SIGNATURE */
#ifdef HAVE_OPENSSL
# include <openssl/sha.h>
#endif
#endif /* ifdef HAVE_OPENSSL */
#ifdef HAVE_CIPHER
# ifdef HAVE_GNUTLS
# include <gnutls/x509.h>
# include <gcrypt.h>
# else
# else /* ifdef HAVE_GNUTLS */
# include <openssl/evp.h>
# include <openssl/hmac.h>
# include <openssl/rand.h>
# endif
#endif
# endif /* ifdef HAVE_GNUTLS */
#endif /* ifdef HAVE_CIPHER */
#include "Eet.h"
#include "Eet_private.h"
@ -73,10 +73,10 @@ void *alloca (size_t);
#ifdef HAVE_GNUTLS
# define MAX_KEY_LEN 32
# define MAX_IV_LEN 16
#else
#else /* ifdef HAVE_GNUTLS */
# define MAX_KEY_LEN EVP_MAX_KEY_LENGTH
# define MAX_IV_LEN EVP_MAX_IV_LENGTH
#endif
#endif /* ifdef HAVE_GNUTLS */
#ifdef HAVE_CIPHER
# ifdef HAVE_GNUTLS
@ -85,7 +85,7 @@ static Eet_Error eet_hmac_sha1(const void *key,
const void * data,
size_t data_len,
unsigned char * res);
# endif
# endif /* ifdef HAVE_GNUTLS */
static Eet_Error eet_pbkdf2_sha1(const char * key,
int key_len,
const unsigned char * salt,
@ -93,7 +93,7 @@ static Eet_Error eet_pbkdf2_sha1(const char *key,
int iter,
unsigned char * res,
int res_len);
#endif
#endif /* ifdef HAVE_CIPHER */
struct _Eet_Key
{
@ -102,11 +102,11 @@ struct _Eet_Key
# ifdef HAVE_GNUTLS
gnutls_x509_crt_t certificate;
gnutls_x509_privkey_t private_key;
# else
# else /* ifdef HAVE_GNUTLS */
X509 * certificate;
EVP_PKEY * private_key;
# endif
#endif
# endif /* ifdef HAVE_GNUTLS */
#endif /* ifdef HAVE_SIGNATURE */
};
EAPI Eet_Key *
@ -230,7 +230,7 @@ on_error:
if (data)
munmap(data, st.st_size);
# else
# else /* ifdef HAVE_GNUTLS */
/* Openssl private declarations */
EVP_PKEY * pkey = NULL;
X509 * cert = NULL;
@ -278,10 +278,10 @@ on_error:
if (pkey)
EVP_PKEY_free(pkey);
# endif
#endif
# endif /* ifdef HAVE_GNUTLS */
#endif /* ifdef HAVE_SIGNATURE */
return NULL;
}
} /* eet_identity_open */
EAPI void
eet_identity_close(Eet_Key * key)
@ -293,16 +293,17 @@ eet_identity_close(Eet_Key *key)
# ifdef HAVE_GNUTLS
gnutls_x509_crt_deinit(key->certificate);
gnutls_x509_privkey_deinit(key->private_key);
# else
# else /* ifdef HAVE_GNUTLS */
X509_free(key->certificate);
EVP_PKEY_free(key->private_key);
# endif
# endif /* ifdef HAVE_GNUTLS */
free(key);
#endif
}
#endif /* ifdef HAVE_SIGNATURE */
} /* eet_identity_close */
EAPI void
eet_identity_print(Eet_Key *key, FILE *out)
eet_identity_print(Eet_Key * key,
FILE * out)
{
#ifdef HAVE_SIGNATURE
# ifdef HAVE_GNUTLS
@ -344,9 +345,7 @@ eet_identity_print(Eet_Key *key, FILE *out)
for (i = 0; i < 6; i++)
{
while ((err =
gnutls_hex_encode(rsa_raw + i, res,
&size)) ==
while ((err = gnutls_hex_encode(rsa_raw + i, res, &size)) ==
GNUTLS_E_SHORT_MEMORY_BUFFER)
{
size += 128;
@ -370,7 +369,8 @@ eet_identity_print(Eet_Key *key, FILE *out)
if (key->certificate)
{
fprintf(out, "Public certificate:\n");
if (gnutls_x509_crt_print(key->certificate, GNUTLS_X509_CRT_FULL, &data))
if (gnutls_x509_crt_print(key->certificate, GNUTLS_X509_CRT_FULL,
&data))
goto on_error;
fprintf(out, "%s\n", data.data);
@ -386,7 +386,7 @@ on_error:
gnutls_free(data.data);
return;
# else
# else /* ifdef HAVE_GNUTLS */
RSA * rsa;
DSA * dsa;
DH * dh;
@ -417,11 +417,11 @@ on_error:
fprintf(out, "Public certificate:\n");
X509_print_fp(out, key->certificate);
# endif
#else
# endif /* ifdef HAVE_GNUTLS */
#else /* ifdef HAVE_SIGNATURE */
ERR("You need to compile signature support in EET.");
#endif
}
#endif /* ifdef HAVE_SIGNATURE */
} /* eet_identity_print */
void
eet_identity_ref(Eet_Key * key)
@ -430,7 +430,7 @@ eet_identity_ref(Eet_Key *key)
return;
key->references++;
}
} /* eet_identity_ref */
void
eet_identity_unref(Eet_Key * key)
@ -440,10 +440,11 @@ eet_identity_unref(Eet_Key *key)
key->references--;
eet_identity_close(key);
}
} /* eet_identity_unref */
void *
eet_identity_compute_sha1(const void *data_base, unsigned int data_length,
eet_identity_compute_sha1(const void * data_base,
unsigned int data_length,
int * sha1_length)
{
void * result;
@ -458,7 +459,7 @@ eet_identity_compute_sha1(const void *data_base, unsigned int data_length,
if (sha1_length)
*sha1_length = gcry_md_get_algo_dlen(GCRY_MD_SHA1);
# else
# else /* ifdef HAVE_GNUTLS */
# ifdef HAVE_OPENSSL
result = malloc(SHA_DIGEST_LENGTH);
if (!result)
@ -468,19 +469,20 @@ eet_identity_compute_sha1(const void *data_base, unsigned int data_length,
if (sha1_length)
*sha1_length = SHA_DIGEST_LENGTH;
# else
# else /* ifdef HAVE_OPENSSL */
result = NULL;
# endif
# endif
#else
# endif /* ifdef HAVE_OPENSSL */
# endif /* ifdef HAVE_GNUTLS */
#else /* ifdef HAVE_SIGNATURE */
result = NULL;
#endif
#endif /* ifdef HAVE_SIGNATURE */
return result;
}
} /* eet_identity_compute_sha1 */
Eet_Error
eet_identity_sign(FILE *fp, Eet_Key *key)
eet_identity_sign(FILE * fp,
Eet_Key * key)
{
#ifdef HAVE_SIGNATURE
Eet_Error err = EET_ERROR_NONE;
@ -494,11 +496,11 @@ eet_identity_sign(FILE *fp, Eet_Key *key)
gnutls_datum_t datum = { NULL, 0 };
size_t sign_len = 0;
size_t cert_len = 0;
# else
# else /* ifdef HAVE_GNUTLS */
EVP_MD_CTX md_ctx;
unsigned int sign_len = 0;
int cert_len = 0;
# endif
# endif /* ifdef HAVE_GNUTLS */
/* A few check and flush pending write. */
if (!fp || !key || !key->certificate || !key->private_key)
@ -568,7 +570,7 @@ eet_identity_sign(FILE *fp, Eet_Key *key)
goto on_error;
}
# else
# else /* ifdef HAVE_GNUTLS */
sign_len = EVP_PKEY_size(key->private_key);
sign = malloc(sign_len);
if (sign == NULL)
@ -600,7 +602,7 @@ eet_identity_sign(FILE *fp, Eet_Key *key)
goto on_error;
}
# endif
# endif /* ifdef HAVE_GNUTLS */
/* Append the signature at the end of the file. */
head[0] = (int)htonl ((unsigned int)EET_MAGIC_SIGN);
head[1] = (int)htonl ((unsigned int)sign_len);
@ -629,20 +631,20 @@ on_error:
if (cert)
free(cert);
# else
# else /* ifdef HAVE_GNUTLS */
if (cert)
OPENSSL_free(cert);
# endif
# endif /* ifdef HAVE_GNUTLS */
if (sign)
free(sign);
munmap(data, st_buf.st_size);
return err;
#else
#else /* ifdef HAVE_SIGNATURE */
return EET_ERROR_NOT_IMPLEMENTED;
#endif
}
#endif /* ifdef HAVE_SIGNATURE */
} /* eet_identity_sign */
const void *
eet_identity_check(const void * data_base,
@ -691,7 +693,7 @@ eet_identity_check(const void *data_base,
unsigned char * hash;
gcry_md_hd_t md;
int err;
# endif
# endif /* if EET_USE_NEW_GNUTLS_API */
/* Create an understanding certificate structure for gnutls */
datum.data = (void *)cert_der;
@ -744,7 +746,7 @@ eet_identity_check(const void *data_base,
}
gcry_md_close(md);
# else
# else /* if EET_USE_NEW_GNUTLS_API */
datum.data = (void *)data_base;
datum.size = data_length;
@ -757,10 +759,10 @@ eet_identity_check(const void *data_base,
*sha1_length = -1;
}
# endif
# endif /* if EET_USE_NEW_GNUTLS_API */
gnutls_x509_crt_deinit(cert);
# else
# else /* ifdef HAVE_GNUTLS */
const unsigned char * tmp;
EVP_PKEY * pkey;
X509 * x509;
@ -799,7 +801,7 @@ eet_identity_check(const void *data_base,
if (err != 1)
return NULL;
# endif
# endif /* ifdef HAVE_GNUTLS */
if (x509_length)
*x509_length = cert_len;
@ -810,10 +812,10 @@ eet_identity_check(const void *data_base,
*raw_signature_length = sign_len;
return cert_der;
#else
#else /* ifdef HAVE_SIGNATURE */
return NULL;
#endif
}
#endif /* ifdef HAVE_SIGNATURE */
} /* eet_identity_check */
EAPI void
eet_identity_certificate_print(const unsigned char * certificate,
@ -854,7 +856,7 @@ on_error:
gnutls_free(datum.data);
gnutls_x509_crt_deinit(cert);
# else
# else /* ifdef HAVE_GNUTLS */
const unsigned char * tmp;
X509 * x509;
@ -872,11 +874,11 @@ on_error:
X509_print_fp(out, x509);
X509_free(x509);
# endif
#else
# endif /* ifdef HAVE_GNUTLS */
#else /* ifdef HAVE_SIGNATURE */
ERR("You need to compile signature support in EET.");
#endif
}
#endif /* ifdef HAVE_SIGNATURE */
} /* eet_identity_certificate_print */
Eet_Error
eet_cipher(const void * data,
@ -900,22 +902,22 @@ eet_cipher(const void *data,
/* Gcrypt declarations */
gcry_error_t err = 0;
gcry_cipher_hd_t cipher;
# else
# else /* ifdef HAVE_GNUTLS */
/* Openssl declarations*/
EVP_CIPHER_CTX ctx;
unsigned int * buffer;
int tmp_len;
# endif
# endif /* ifdef HAVE_GNUTLS */
# ifdef HAVE_GNUTLS
/* Gcrypt salt generation */
gcry_create_nonce((unsigned char *)&salt, sizeof(salt));
# else
# else /* ifdef HAVE_GNUTLS */
/* Openssl salt generation */
if (!RAND_bytes((unsigned char *)&salt, sizeof (unsigned int)))
return EET_ERROR_PRNG_NOT_SEEDED;
#endif
# endif /* ifdef HAVE_GNUTLS */
eet_pbkdf2_sha1(key,
length,
@ -977,7 +979,7 @@ eet_cipher(const void *data,
/* Gcrypt close the cipher */
gcry_cipher_close(cipher);
# else
# else /* ifdef HAVE_GNUTLS */
buffer = alloca(crypted_length);
*buffer = tmp;
@ -996,7 +998,8 @@ eet_cipher(const void *data,
/* Openssl encrypt */
if (!EVP_EncryptUpdate(&ctx, (unsigned char *)(ret + 1), &tmp_len,
(unsigned char *)buffer, size + sizeof (unsigned int)))
(unsigned char *)buffer,
size + sizeof(unsigned int)))
goto on_error;
/* Openssl close the cipher */
@ -1005,7 +1008,7 @@ eet_cipher(const void *data,
goto on_error;
EVP_CIPHER_CTX_cleanup(&ctx);
# endif
# endif /* ifdef HAVE_GNUTLS */
/* Set return values */
if (result_length)
@ -1027,12 +1030,12 @@ on_error:
if (opened)
gcry_cipher_close(cipher);
# else
# else /* ifdef HAVE_GNUTLS */
/* Openssl error */
if (opened)
EVP_CIPHER_CTX_cleanup(&ctx);
# endif
# endif /* ifdef HAVE_GNUTLS */
/* General error */
free(ret);
if (result)
@ -1042,7 +1045,7 @@ on_error:
*result_length = 0;
return EET_ERROR_ENCRYPT_FAILED;
#else
#else /* ifdef HAVE_CIPHER */
/* Cipher not supported */
(void)data;
(void)size;
@ -1051,8 +1054,8 @@ on_error:
(void)result;
(void)result_length;
return EET_ERROR_NOT_IMPLEMENTED;
#endif
}
#endif /* ifdef HAVE_CIPHER */
} /* eet_cipher */
Eet_Error
eet_decipher(const void * data,
@ -1080,12 +1083,8 @@ eet_decipher(const void *data,
salt = *over;
/* Generate the iv and the key with the salt */
eet_pbkdf2_sha1(key,
length,
(unsigned char *)&salt,
sizeof(unsigned int),
2048,
key_material,
eet_pbkdf2_sha1(key, length, (unsigned char *)&salt,
sizeof(unsigned int), 2048, key_material,
MAX_KEY_LEN + MAX_IV_LEN);
memcpy(iv, key_material, MAX_IV_LEN);
@ -1124,18 +1123,15 @@ eet_decipher(const void *data,
memset(ik, 0, sizeof (ik));
/* Gcrypt decrypt */
err = gcry_cipher_decrypt(cipher,
ret,
tmp_len,
((unsigned int *)data) + 1,
tmp_len);
err = gcry_cipher_decrypt(cipher, ret, tmp_len,
((unsigned int *)data) + 1, tmp_len);
if (err)
goto on_error;
/* Gcrypt close the cipher */
gcry_cipher_close(cipher);
# else
# else /* ifdef HAVE_GNUTLS */
EVP_CIPHER_CTX ctx;
int opened = 0;
@ -1156,7 +1152,7 @@ eet_decipher(const void *data,
/* Openssl close the cipher*/
EVP_CIPHER_CTX_cleanup(&ctx);
# endif
# endif /* ifdef HAVE_GNUTLS */
/* Get the decrypted data size */
tmp = *ret;
tmp = ntohl(tmp);
@ -1190,7 +1186,7 @@ on_error:
if (opened)
EVP_CIPHER_CTX_cleanup(&ctx);
# endif
# endif /* ifdef HAVE_GNUTLS */
if (result)
*result = NULL;
@ -1201,7 +1197,7 @@ on_error:
free(ret);
return EET_ERROR_DECRYPT_FAILED;
#else
#else /* ifdef HAVE_CIPHER */
(void)data;
(void)size;
(void)key;
@ -1209,14 +1205,17 @@ on_error:
(void)result;
(void)result_length;
return EET_ERROR_NOT_IMPLEMENTED;
#endif
}
#endif /* ifdef HAVE_CIPHER */
} /* eet_decipher */
#ifdef HAVE_CIPHER
# ifdef HAVE_GNUTLS
static Eet_Error
eet_hmac_sha1(const void *key, size_t key_len,
const void *data, size_t data_len, unsigned char *res)
eet_hmac_sha1(const void * key,
size_t key_len,
const void * data,
size_t data_len,
unsigned char * res)
{
size_t hlen = gcry_md_get_algo_dlen (GCRY_MD_SHA1);
gcry_md_hd_t mdh;
@ -1248,8 +1247,9 @@ eet_hmac_sha1(const void *key, size_t key_len,
gcry_md_close(mdh);
return 0;
}
# endif
} /* eet_hmac_sha1 */
# endif /* ifdef HAVE_GNUTLS */
static Eet_Error
eet_pbkdf2_sha1(const char * key,
@ -1272,7 +1272,7 @@ eet_pbkdf2_sha1(const char *key,
# ifdef HAVE_GNUTLS
# else
HMAC_CTX hctx;
# endif
# endif /* ifdef HAVE_GNUTLS */
buf = alloca(salt_len + 4);
if (!buf)
@ -1294,21 +1294,21 @@ eet_pbkdf2_sha1(const char *key,
memcpy(buf, salt, salt_len);
memcpy(buf + salt_len, tab, 4);
eet_hmac_sha1(key, key_len, buf, salt_len + 4, digest);
# else
# else /* ifdef HAVE_GNUTLS */
HMAC_Init(&hctx, key, key_len, EVP_sha1());
HMAC_Update(&hctx, salt, salt_len);
HMAC_Update(&hctx, tab, 4);
HMAC_Final(&hctx, digest, NULL);
# endif
# endif /* ifdef HAVE_GNUTLS */
memcpy(p, digest, tmp_len);
for (j = 1; j < iter; j++)
{
# ifdef HAVE_GNUTLS
eet_hmac_sha1(key, key_len, digest, 20, digest);
# else
# else /* ifdef HAVE_GNUTLS */
HMAC(EVP_sha1(), key, key_len, digest, 20, digest, NULL);
# endif
# endif /* ifdef HAVE_GNUTLS */
for (k = 0; k < tmp_len; k++)
p[k] ^= digest[k];
}
@ -1317,7 +1317,8 @@ eet_pbkdf2_sha1(const char *key,
# ifdef HAVE_GNUTLS
# else
HMAC_cleanup(&hctx);
# endif
# endif /* ifdef HAVE_GNUTLS */
return 0;
}
#endif
} /* eet_pbkdf2_sha1 */
#endif /* ifdef HAVE_CIPHER */

View File

@ -4,7 +4,7 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#endif /* ifdef HAVE_CONFIG_H */
#ifdef HAVE_ALLOCA_H
# include <alloca.h>
@ -15,24 +15,24 @@
#elif defined _MSC_VER
# include <malloc.h>
# define alloca _alloca
#else
#else /* ifdef HAVE_ALLOCA_H */
# include <stddef.h>
# ifdef __cplusplus
extern "C"
# endif
# endif /* ifdef __cplusplus */
void * alloca (size_t);
#endif
#endif /* ifdef HAVE_ALLOCA_H */
#include <string.h>
#include <stdlib.h>
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
#endif /* ifdef HAVE_NETINET_IN_H */
#ifdef _WIN32
# include <winsock2.h>
#endif
#endif /* ifdef _WIN32 */
#include <Eina.h>
@ -80,12 +80,14 @@ eet_connection_new(Eet_Read_Cb *eet_read_cb,
conn->user_data = (void *)user_data;
return conn;
}
} /* eet_connection_new */
EAPI int
eet_connection_received(Eet_Connection *conn, const void *data, size_t size)
eet_connection_received(Eet_Connection * conn,
const void * data,
size_t size)
{
if (!conn || !data || !size)
if ((!conn) || (!data) || (!size))
return size;
do {
@ -167,10 +169,12 @@ eet_connection_received(Eet_Connection *conn, const void *data, size_t size)
} while (size > 0);
return size;
}
} /* eet_connection_received */
static Eina_Bool
_eet_connection_raw_send(Eet_Connection *conn, void *data, int data_size)
_eet_connection_raw_send(Eet_Connection * conn,
void * data,
int data_size)
{
Eet_Message * message;
@ -188,7 +192,7 @@ _eet_connection_raw_send(Eet_Connection *conn, void *data, int data_size)
data_size + sizeof (Eet_Message),
conn->user_data);
return EINA_TRUE;
}
} /* _eet_connection_raw_send */
EAPI Eina_Bool
eet_connection_send(Eet_Connection * conn,
@ -212,7 +216,7 @@ eet_connection_send(Eet_Connection *conn,
free(flat_data);
return ret;
}
} /* eet_connection_send */
EAPI Eina_Bool
eet_connection_node_send(Eet_Connection * conn,
@ -232,10 +236,11 @@ eet_connection_node_send(Eet_Connection *conn,
free(data);
return ret;
}
} /* eet_connection_node_send */
EAPI void *
eet_connection_close(Eet_Connection *conn, Eina_Bool *on_going)
eet_connection_close(Eet_Connection * conn,
Eina_Bool * on_going)
{
void * user_data;
@ -251,4 +256,5 @@ eet_connection_close(Eet_Connection *conn, Eina_Bool *on_going)
free(conn);
return user_data;
}
} /* eet_connection_close */

File diff suppressed because it is too large Load Diff

View File

@ -4,7 +4,7 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#endif /* ifdef HAVE_CONFIG_H */
#include <stdio.h>
#include <string.h>
@ -27,7 +27,7 @@ eet_dictionary_add(void)
memset(new->hash, -1, sizeof (int) * 256);
return new;
}
} /* eet_dictionary_add */
void
eet_dictionary_free(Eet_Dictionary * ed)
@ -45,10 +45,12 @@ eet_dictionary_free(Eet_Dictionary *ed)
free(ed);
}
}
} /* eet_dictionary_free */
static int
_eet_dictionary_lookup(Eet_Dictionary *ed, const char *string, int hash)
_eet_dictionary_lookup(Eet_Dictionary * ed,
const char * string,
int hash)
{
int prev = -1;
int current;
@ -73,10 +75,11 @@ _eet_dictionary_lookup(Eet_Dictionary *ed, const char *string, int hash)
return prev;
return current;
}
} /* _eet_dictionary_lookup */
int
eet_dictionary_string_add(Eet_Dictionary *ed, const char *string)
eet_dictionary_string_add(Eet_Dictionary * ed,
const char * string)
{
Eet_String * current;
char * str;
@ -154,10 +157,11 @@ eet_dictionary_string_add(Eet_Dictionary *ed, const char *string)
}
return ed->count++;
}
} /* eet_dictionary_string_add */
int
eet_dictionary_string_get_size(const Eet_Dictionary *ed, int idx)
eet_dictionary_string_get_size(const Eet_Dictionary * ed,
int idx)
{
if (!ed)
return 0;
@ -169,10 +173,11 @@ eet_dictionary_string_get_size(const Eet_Dictionary *ed, int idx)
return ed->all[idx].len;
return 0;
}
} /* eet_dictionary_string_get_size */
int
eet_dictionary_string_get_hash(const Eet_Dictionary *ed, int idx)
eet_dictionary_string_get_hash(const Eet_Dictionary * ed,
int idx)
{
if (!ed)
return -1;
@ -184,10 +189,11 @@ eet_dictionary_string_get_hash(const Eet_Dictionary *ed, int idx)
return ed->all[idx].hash;
return -1;
}
} /* eet_dictionary_string_get_hash */
const char *
eet_dictionary_string_get_char(const Eet_Dictionary *ed, int idx)
eet_dictionary_string_get_char(const Eet_Dictionary * ed,
int idx)
{
if (!ed)
return NULL;
@ -205,16 +211,16 @@ eet_dictionary_string_get_char(const Eet_Dictionary *ed, int idx)
ed->all[idx].mmap = NULL;
}
#else
#else /* ifdef _WIN32 */
if (ed->all[idx].mmap)
return ed->all[idx].mmap;
#endif
#endif /* ifdef _WIN32 */
return ed->all[idx].str;
}
return NULL;
}
} /* eet_dictionary_string_get_char */
static inline Eina_Bool
_eet_dictionary_string_get_me_cache(const char * s,
@ -231,10 +237,12 @@ _eet_dictionary_string_get_me_cache(const char *s,
}
return EINA_FALSE;
}
} /* _eet_dictionary_string_get_me_cache */
static inline Eina_Bool
_eet_dictionary_string_get_float_cache(const char *s, int len, float *result)
_eet_dictionary_string_get_float_cache(const char * s,
int len,
float * result)
{
int mantisse;
int exponent;
@ -250,10 +258,12 @@ _eet_dictionary_string_get_float_cache(const char *s, int len, float *result)
}
return EINA_FALSE;
}
} /* _eet_dictionary_string_get_float_cache */
static inline Eina_Bool
_eet_dictionary_string_get_double_cache(const char *s, int len, double *result)
_eet_dictionary_string_get_double_cache(const char * s,
int len,
double * result)
{
int mantisse;
int exponent;
@ -269,10 +279,12 @@ _eet_dictionary_string_get_double_cache(const char *s, int len, double *result)
}
return EINA_FALSE;
}
} /* _eet_dictionary_string_get_double_cache */
static inline Eina_Bool
_eet_dictionary_test(const Eet_Dictionary *ed, int idx, void *result)
_eet_dictionary_test(const Eet_Dictionary * ed,
int idx,
void * result)
{
if (!result)
return EINA_FALSE;
@ -287,7 +299,7 @@ _eet_dictionary_test(const Eet_Dictionary *ed, int idx, void *result)
return EINA_FALSE;
return EINA_TRUE;
}
} /* _eet_dictionary_test */
Eina_Bool
eet_dictionary_string_get_float(const Eet_Dictionary * ed,
@ -321,7 +333,7 @@ eet_dictionary_string_get_float(const Eet_Dictionary *ed,
*result = ed->all[idx].f;
return EINA_TRUE;
}
} /* eet_dictionary_string_get_float */
Eina_Bool
eet_dictionary_string_get_double(const Eet_Dictionary * ed,
@ -355,7 +367,7 @@ eet_dictionary_string_get_double(const Eet_Dictionary *ed,
*result = ed->all[idx].d;
return EINA_TRUE;
}
} /* eet_dictionary_string_get_double */
Eina_Bool
eet_dictionary_string_get_fp(const Eet_Dictionary * ed,
@ -381,19 +393,18 @@ eet_dictionary_string_get_fp(const Eet_Dictionary *ed,
*result = ed->all[idx].fp;
return EINA_TRUE;
}
} /* eet_dictionary_string_get_fp */
EAPI int
eet_dictionary_string_check(Eet_Dictionary *ed, const char *string)
eet_dictionary_string_check(Eet_Dictionary * ed,
const char * string)
{
int i;
if (ed == NULL
|| string == NULL)
if ((ed == NULL) || (string == NULL))
return 0;
if (ed->start <= string
&& string < ed->end)
if ((ed->start <= string) && (string < ed->end))
return 1;
for (i = 0; i < ed->count; ++i)
@ -401,4 +412,5 @@ eet_dictionary_string_check(Eet_Dictionary *ed, const char *string)
return 1;
return 0;
}
} /* eet_dictionary_string_check */

View File

@ -4,7 +4,7 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#endif /* ifdef HAVE_CONFIG_H */
#ifdef HAVE_ALLOCA_H
# include <alloca.h>
@ -15,24 +15,24 @@
#elif defined _MSC_VER
# include <malloc.h>
# define alloca _alloca
#else
#else /* ifdef HAVE_ALLOCA_H */
# include <stddef.h>
# ifdef __cplusplus
extern "C"
# endif
# endif /* ifdef __cplusplus */
void * alloca (size_t);
#endif
#endif /* ifdef HAVE_ALLOCA_H */
#ifdef HAVE_NETINET_IN_H
# ifdef __OpenBSD__
# include <sys/types.h>
# endif
# endif /* ifdef __OpenBSD__ */
# include <netinet/in.h>
#endif
#endif /* ifdef HAVE_NETINET_IN_H */
#ifdef _WIN32
# include <winsock2.h>
#endif
#endif /* ifdef _WIN32 */
#include <stdio.h>
#include <string.h>
@ -68,7 +68,7 @@ _eet_jpeg_membuf_src_init(j_decompress_ptr cinfo)
{
/* FIXME: Use attribute unused */
(void)cinfo;
}
} /* _eet_jpeg_membuf_src_init */
static boolean
_eet_jpeg_membuf_src_fill(j_decompress_ptr cinfo)
@ -80,26 +80,29 @@ _eet_jpeg_membuf_src_fill(j_decompress_ptr cinfo)
src->pub.next_input_byte = jpeg_eoi;
return TRUE;
}
} /* _eet_jpeg_membuf_src_fill */
static void
_eet_jpeg_membuf_src_skip(j_decompress_ptr cinfo, long num_bytes)
_eet_jpeg_membuf_src_skip(j_decompress_ptr cinfo,
long num_bytes)
{
struct jpeg_membuf_src * src = (struct jpeg_membuf_src *)cinfo->src;
src->pub.bytes_in_buffer -= num_bytes;
src->pub.next_input_byte += num_bytes;
}
} /* _eet_jpeg_membuf_src_skip */
static void
_eet_jpeg_membuf_src_term(j_decompress_ptr cinfo)
{
free(cinfo->src);
cinfo->src = NULL;
}
} /* _eet_jpeg_membuf_src_term */
static int
eet_jpeg_membuf_src(j_decompress_ptr cinfo, const void *buf, size_t len)
eet_jpeg_membuf_src(j_decompress_ptr cinfo,
const void * buf,
size_t len)
{
struct jpeg_membuf_src * src;
@ -119,7 +122,7 @@ eet_jpeg_membuf_src(j_decompress_ptr cinfo, const void *buf, size_t len)
src->pub.next_input_byte = src->buf;
return 0;
}
} /* eet_jpeg_membuf_src */
struct jpeg_membuf_dst
{
@ -138,7 +141,7 @@ _eet_jpeg_membuf_dst_init(j_compress_ptr cinfo)
{
/* FIXME: Use eina attribute */
(void)cinfo;
}
} /* _eet_jpeg_membuf_dst_init */
static boolean
_eet_jpeg_membuf_dst_flush(j_compress_ptr cinfo)
@ -162,7 +165,7 @@ _eet_jpeg_membuf_dst_flush(j_compress_ptr cinfo)
dst->len *= 2;
return FALSE;
}
} /* _eet_jpeg_membuf_dst_flush */
static void
_eet_jpeg_membuf_dst_term(j_compress_ptr cinfo)
@ -183,10 +186,12 @@ _eet_jpeg_membuf_dst_term(j_compress_ptr cinfo)
free(dst);
cinfo->dest = NULL;
}
} /* _eet_jpeg_membuf_dst_term */
static int
eet_jpeg_membuf_dst(j_compress_ptr cinfo, void **buf, size_t *len)
eet_jpeg_membuf_dst(j_compress_ptr cinfo,
void ** buf,
size_t * len)
{
struct jpeg_membuf_dst * dst;
@ -214,13 +219,14 @@ eet_jpeg_membuf_dst(j_compress_ptr cinfo, void **buf, size_t *len)
dst->failed = 0;
return 0;
}
} /* eet_jpeg_membuf_dst */
/*---*/
static void _JPEGFatalErrorHandler(j_common_ptr cinfo);
static void _JPEGErrorHandler(j_common_ptr cinfo);
static void _JPEGErrorHandler2(j_common_ptr cinfo, int msg_level);
static void _JPEGErrorHandler2(j_common_ptr cinfo,
int msg_level);
static int eet_data_image_jpeg_header_decode(const void * data,
int size,
@ -292,16 +298,16 @@ static int _eet_image_words_bigendian = -1;
#ifdef CONV8
# undef CONV8
#endif
#endif /* ifdef CONV8 */
#ifdef CONV16
# undef CONV16
#endif
#endif /* ifdef CONV16 */
#ifdef CONV32
# undef CONV32
#endif
#endif /* ifdef CONV32 */
#ifdef CONV64
# undef CONV64
#endif
#endif /* ifdef CONV64 */
#define CONV8(x)
#define CONV16(x) {if (_eet_image_words_bigendian) {SWAP16(x); }}
@ -319,7 +325,7 @@ _JPEGFatalErrorHandler(j_common_ptr cinfo)
/* cinfo->err->output_message(cinfo);*/
longjmp(errmgr->setjmp_buffer, 1);
return;
}
} /* _JPEGFatalErrorHandler */
static void
_JPEGErrorHandler(j_common_ptr cinfo __UNUSED__)
@ -330,10 +336,11 @@ _JPEGErrorHandler(j_common_ptr cinfo __UNUSED__)
/* cinfo->err->output_message(cinfo);*/
/* longjmp(errmgr->setjmp_buffer, 1);*/
return;
}
} /* _JPEGErrorHandler */
static void
_JPEGErrorHandler2(j_common_ptr cinfo __UNUSED__, int msg_level __UNUSED__)
_JPEGErrorHandler2(j_common_ptr cinfo __UNUSED__,
int msg_level __UNUSED__)
{
/* emptr errmgr; */
@ -341,7 +348,7 @@ _JPEGErrorHandler2(j_common_ptr cinfo __UNUSED__, int msg_level __UNUSED__)
/* cinfo->err->output_message(cinfo);*/
/* longjmp(errmgr->setjmp_buffer, 1);*/
return;
}
} /* _JPEGErrorHandler2 */
static int
eet_data_image_jpeg_header_decode(const void * data,
@ -387,7 +394,7 @@ eet_data_image_jpeg_header_decode(const void *data,
return 0;
return 1;
}
} /* eet_data_image_jpeg_header_decode */
static int
eet_data_image_jpeg_rgb_decode(const void * data,
@ -540,7 +547,7 @@ eet_data_image_jpeg_rgb_decode(const void *data,
jpeg_finish_decompress(&cinfo);
jpeg_destroy_decompress(&cinfo);
return 1;
}
} /* eet_data_image_jpeg_rgb_decode */
static void *
eet_data_image_jpeg_alpha_decode(const void * data,
@ -649,7 +656,7 @@ eet_data_image_jpeg_alpha_decode(const void *data,
jpeg_finish_decompress(&cinfo);
jpeg_destroy_decompress(&cinfo);
return d;
}
} /* eet_data_image_jpeg_alpha_decode */
static void *
eet_data_image_lossless_convert(int * size,
@ -697,7 +704,7 @@ eet_data_image_lossless_convert(int *size,
*size = ((w * h * 4) + (8 * 4));
return d;
}
}
} /* eet_data_image_lossless_convert */
static void *
eet_data_image_lossless_compressed_convert(int * size,
@ -771,7 +778,7 @@ eet_data_image_lossless_compressed_convert(int *size,
free(comp);
return d;
}
}
} /* eet_data_image_lossless_compressed_convert */
static void *
eet_data_image_jpeg_convert(int * size,
@ -850,7 +857,7 @@ eet_data_image_jpeg_convert(int *size,
*size = sz;
return d;
}
} /* eet_data_image_jpeg_convert */
static void *
eet_data_image_jpeg_alpha_convert(int * size,
@ -1038,7 +1045,7 @@ eet_data_image_jpeg_alpha_convert(int *size,
free(d2);
*size = 12 + sz1 + sz2;
return d;
}
} /* eet_data_image_jpeg_alpha_convert */
EAPI int
eet_data_image_write_cipher(Eet_File * ef,
@ -1066,7 +1073,7 @@ eet_data_image_write_cipher(Eet_File *ef,
}
return 0;
}
} /* eet_data_image_write_cipher */
EAPI int
eet_data_image_write(Eet_File * ef,
@ -1089,8 +1096,7 @@ eet_data_image_write(Eet_File *ef,
comp,
quality,
lossy);
}
} /* eet_data_image_write */
EAPI void *
eet_data_image_read_cipher(Eet_File * ef,
@ -1125,23 +1131,21 @@ eet_data_image_read_cipher(Eet_File *ef,
free(data);
return d;
}
} /* eet_data_image_read_cipher */
EAPI void *
eet_data_image_read(Eet_File *ef, const char *name,
unsigned int *w, unsigned int *h, int *alpha,
int *comp, int *quality, int *lossy)
eet_data_image_read(Eet_File * ef,
const char * name,
unsigned int * w,
unsigned int * h,
int * alpha,
int * comp,
int * quality,
int * lossy)
{
return eet_data_image_read_cipher(ef,
name,
NULL,
w,
h,
alpha,
comp,
quality,
lossy);
}
return eet_data_image_read_cipher(ef, name, NULL, w, h, alpha,
comp, quality, lossy);
} /* eet_data_image_read */
EAPI int
eet_data_image_read_to_surface_cipher(Eet_File * ef,
@ -1174,24 +1178,15 @@ eet_data_image_read_to_surface_cipher(Eet_File *ef,
return 0;
}
res = eet_data_image_decode_to_surface(data,
size,
src_x,
src_y,
d,
w,
h,
row_stride,
alpha,
comp,
quality,
lossy);
res = eet_data_image_decode_to_surface(data, size, src_x, src_y, d,
w, h, row_stride, alpha,
comp, quality, lossy);
if (free_data)
free(data);
return res;
}
} /* eet_data_image_read_to_surface_cipher */
EAPI int
eet_data_image_read_to_surface(Eet_File * ef,
@ -1207,20 +1202,12 @@ eet_data_image_read_to_surface(Eet_File *ef,
int * quality,
int * lossy)
{
return eet_data_image_read_to_surface_cipher(ef,
name,
NULL,
src_x,
src_y,
d,
w,
h,
row_stride,
alpha,
comp,
quality,
return eet_data_image_read_to_surface_cipher(ef, name, NULL,
src_x, src_y, d,
w, h, row_stride,
alpha, comp, quality,
lossy);
}
} /* eet_data_image_read_to_surface */
EAPI int
eet_data_image_header_read_cipher(Eet_File * ef,
@ -1249,36 +1236,28 @@ eet_data_image_header_read_cipher(Eet_File *ef,
return 0;
}
d = eet_data_image_header_decode(data,
size,
w,
h,
alpha,
comp,
quality,
lossy);
d = eet_data_image_header_decode(data, size, w, h, alpha,
comp, quality, lossy);
if (free_data)
free(data);
return d;
}
} /* eet_data_image_header_read_cipher */
EAPI int
eet_data_image_header_read(Eet_File *ef, const char *name,
unsigned int *w, unsigned int *h, int *alpha,
int *comp, int *quality, int *lossy)
eet_data_image_header_read(Eet_File * ef,
const char * name,
unsigned int * w,
unsigned int * h,
int * alpha,
int * comp,
int * quality,
int * lossy)
{
return eet_data_image_header_read_cipher(ef,
name,
NULL,
w,
h,
alpha,
comp,
quality,
lossy);
}
return eet_data_image_header_read_cipher(ef, name, NULL,
w, h, alpha,
comp, quality, lossy);
} /* eet_data_image_header_read */
EAPI void *
eet_data_image_encode_cipher(const void * data,
@ -1299,12 +1278,8 @@ eet_data_image_encode_cipher(const void *data,
if (lossy == 0)
{
if (comp > 0)
d = eet_data_image_lossless_compressed_convert(&size,
data,
w,
h,
alpha,
comp);
d = eet_data_image_lossless_compressed_convert(&size, data,
w, h, alpha, comp);
/* eet_data_image_lossless_compressed_convert will refuse to compress something
if the result is bigger than the entry. */
@ -1316,12 +1291,8 @@ eet_data_image_encode_cipher(const void *data,
if (!alpha)
d = eet_data_image_jpeg_convert(&size, data, w, h, alpha, quality);
else
d = eet_data_image_jpeg_alpha_convert(&size,
data,
w,
h,
alpha,
quality);
d = eet_data_image_jpeg_alpha_convert(&size, data,
w, h, alpha, quality);
}
if (cipher_key)
@ -1344,7 +1315,7 @@ eet_data_image_encode_cipher(const void *data,
*size_ret = size;
return d;
}
} /* eet_data_image_encode_cipher */
EAPI void *
eet_data_image_encode(const void * data,
@ -1356,16 +1327,9 @@ eet_data_image_encode(const void *data,
int quality,
int lossy)
{
return eet_data_image_encode_cipher(data,
NULL,
w,
h,
alpha,
comp,
quality,
lossy,
size_ret);
}
return eet_data_image_encode_cipher(data, NULL, w, h, alpha,
comp, quality, lossy, size_ret);
} /* eet_data_image_encode */
EAPI int
eet_data_image_header_decode_cipher(const void * data,
@ -1517,7 +1481,7 @@ eet_data_image_header_decode_cipher(const void *data,
}
return 0;
}
} /* eet_data_image_header_decode_cipher */
EAPI int
eet_data_image_header_decode(const void * data,
@ -1538,7 +1502,7 @@ eet_data_image_header_decode(const void *data,
comp,
quality,
lossy);
}
} /* eet_data_image_header_decode */
static void
_eet_data_image_copy_buffer(const unsigned int * src,
@ -1562,8 +1526,7 @@ _eet_data_image_copy_buffer(const unsigned int *src,
for (y = 0; y < h; ++y, src += src_w, over += row_stride)
memcpy(over, src, w * 4);
}
}
} /* _eet_data_image_copy_buffer */
static int
_eet_data_image_decode_inside(const void * data,
@ -1587,14 +1550,8 @@ _eet_data_image_decode_inside(const void *data,
body = ((unsigned int *)data) + 8;
if (!comp)
_eet_data_image_copy_buffer(body,
src_x,
src_y,
src_w,
d,
w,
h,
row_stride);
_eet_data_image_copy_buffer(body, src_x, src_y, src_w, d,
w, h, row_stride);
else
{
if (src_h == h && src_w == w && row_stride == src_w * 4)
@ -1618,13 +1575,8 @@ _eet_data_image_decode_inside(const void *data,
uncompress(dtmp, &dlen, (Bytef *)body, (uLongf)(size - 32));
_eet_data_image_copy_buffer((unsigned int *)dtmp,
src_x,
src_y,
src_w,
d,
w,
h,
row_stride);
src_x, src_y, src_w, d,
w, h, row_stride);
free(dtmp);
}
@ -1676,7 +1628,7 @@ _eet_data_image_decode_inside(const void *data,
abort();
return 1;
}
} /* _eet_data_image_decode_inside */
EAPI void *
eet_data_image_decode_cipher(const void * data,
@ -1743,7 +1695,7 @@ eet_data_image_decode_cipher(const void *data,
*lossy = ilossy;
return d;
}
} /* eet_data_image_decode_cipher */
EAPI void *
eet_data_image_decode(const void * data,
@ -1755,16 +1707,9 @@ eet_data_image_decode(const void *data,
int * quality,
int * lossy)
{
return eet_data_image_decode_cipher(data,
NULL,
size,
w,
h,
alpha,
comp,
quality,
lossy);
}
return eet_data_image_decode_cipher(data, NULL, size, w, h,
alpha, comp, quality, lossy);
} /* eet_data_image_decode */
EAPI int
eet_data_image_decode_to_surface_cipher(const void * data,
@ -1831,7 +1776,7 @@ eet_data_image_decode_to_surface_cipher(const void *data,
*lossy = ilossy;
return 1;
}
} /* eet_data_image_decode_to_surface_cipher */
EAPI int
eet_data_image_decode_to_surface(const void * data,
@ -1847,17 +1792,10 @@ eet_data_image_decode_to_surface(const void *data,
int * quality,
int * lossy)
{
return eet_data_image_decode_to_surface_cipher(data,
NULL,
size,
src_x,
src_y,
d,
w,
h,
row_stride,
alpha,
comp,
quality,
return eet_data_image_decode_to_surface_cipher(data, NULL, size,
src_x, src_y, d,
w, h, row_stride,
alpha, comp, quality,
lossy);
}
} /* eet_data_image_decode_to_surface */

View File

@ -4,7 +4,7 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#endif /* ifdef HAVE_CONFIG_H */
#ifdef HAVE_ALLOCA_H
# include <alloca.h>
@ -15,17 +15,17 @@
#elif defined _MSC_VER
# include <malloc.h>
# define alloca _alloca
#else
#else /* ifdef HAVE_ALLOCA_H */
# include <stddef.h>
# ifdef __cplusplus
extern "C"
# endif
# endif /* ifdef __cplusplus */
void * alloca (size_t);
#endif
#endif /* ifdef HAVE_ALLOCA_H */
#ifdef _WIN32
# include <winsock2.h>
#endif
#endif /* ifdef _WIN32 */
#include <stdio.h>
#include <errno.h>
@ -40,32 +40,32 @@ void *alloca (size_t);
#ifndef _MSC_VER
# include <unistd.h>
#endif
#endif /* ifndef _MSC_VER */
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
#endif /* ifdef HAVE_NETINET_IN_H */
#ifdef HAVE_EVIL
# include <Evil.h>
#endif
#endif /* ifdef HAVE_EVIL */
#ifdef HAVE_GNUTLS
# include <gnutls/gnutls.h>
# include <gcrypt.h>
#endif
#endif /* ifdef HAVE_GNUTLS */
#ifdef HAVE_OPENSSL
# include <openssl/err.h>
# include <openssl/evp.h>
#endif
#endif /* ifdef HAVE_OPENSSL */
#ifdef EFL_HAVE_POSIX_THREADS
# include <pthread.h>
# ifdef HAVE_GNUTLS
GCRY_THREAD_OPTION_PTHREAD_IMPL;
# endif
#endif
# endif /* ifdef HAVE_GNUTLS */
#endif /* ifdef EFL_HAVE_POSIX_THREADS */
#include <Eina.h>
@ -77,7 +77,7 @@ EAPI Eet_Version *eet_version = &_version;
#ifdef HAVE_REALPATH
# undef HAVE_REALPATH
#endif
#endif /* ifdef HAVE_REALPATH */
#define EET_MAGIC_FILE 0x1ee7ff00
#define EET_MAGIC_FILE_HEADER 0x1ee7ff01
@ -115,10 +115,10 @@ struct _Eet_File
#ifdef EFL_HAVE_THREADS
# ifdef EFL_HAVE_POSIX_THREADS
pthread_mutex_t file_lock;
# else
# else /* ifdef EFL_HAVE_POSIX_THREADS */
HANDLE file_lock;
# endif
#endif
# endif /* ifdef EFL_HAVE_POSIX_THREADS */
#endif /* ifdef EFL_HAVE_THREADS */
unsigned char writes_pending : 1;
unsigned char delete_me_now : 1;
@ -173,7 +173,7 @@ struct
char name[name_size]; /* name string (variable length) and \0 terminated */
} directory[num_directory_entries];
/* and now startes the data stream... */
#endif
#endif /* if 0 */
#if 0
/* Version 3 */
@ -210,7 +210,7 @@ int signature_length; /* Signature length. */
int x509_length; /* Public certificate that signed the file. */
char signature[signature_length]; /* The signature. */
char x509[x509_length]; /* The public certificate. */
#endif
#endif /* if 0 */
#define EET_FILE2_HEADER_COUNT 3
#define EET_FILE2_DIRECTORY_ENTRY_COUNT 6
@ -238,7 +238,7 @@ static void eet_cache_del(Eet_File *ef,
static int eet_string_match(const char * s1, const char * s2);
#if 0 /* Unused */
static Eet_Error eet_flush(Eet_File * ef);
#endif
#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,
@ -276,7 +276,7 @@ static HANDLE eet_cache_lock = NULL;
# endif /* EFL_HAVE_WIN32_THREADS */
#else
#else /* ifdef EFL_HAVE_THREADS */
# define LOCK_CACHE do {} while (0)
# define UNLOCK_CACHE do {} while (0)
@ -308,7 +308,7 @@ eet_check_pointer(const Eet_File *ef)
return 1;
return 0;
}
} /* eet_check_pointer */
static inline int
eet_check_header(const Eet_File * ef)
@ -320,10 +320,11 @@ eet_check_header(const Eet_File *ef)
return 1;
return 0;
}
} /* eet_check_header */
static inline int
eet_test_close(int test, Eet_File *ef)
eet_test_close(int test,
Eet_File * ef)
{
if (test)
{
@ -332,11 +333,13 @@ eet_test_close(int test, Eet_File *ef)
}
return test;
}
} /* eet_test_close */
/* find an eet file in the currently in use cache */
static Eet_File *
eet_cache_find(const char *path, Eet_File **cache, int cache_num)
eet_cache_find(const char * path,
Eet_File ** cache,
int cache_num)
{
int i;
@ -352,12 +355,15 @@ eet_cache_find(const char *path, Eet_File **cache, int cache_num)
/* not found */
return NULL;
}
} /* eet_cache_find */
/* add to end of cache */
/* this should only be called when the cache lock is already held */
static void
eet_cache_add(Eet_File *ef, Eet_File ***cache, int *cache_num, int *cache_alloc)
eet_cache_add(Eet_File * ef,
Eet_File *** cache,
int * cache_num,
int * cache_alloc)
{
Eet_File ** new_cache;
int new_cache_num;
@ -405,12 +411,15 @@ eet_cache_add(Eet_File *ef, Eet_File ***cache, int *cache_num, int *cache_alloc)
*cache = new_cache;
*cache_num = new_cache_num;
*cache_alloc = new_cache_alloc;
}
} /* eet_cache_add */
/* delete from cache */
/* this should only be called when the cache lock is already held */
static void
eet_cache_del(Eet_File *ef, Eet_File ***cache, int *cache_num, int *cache_alloc)
eet_cache_del(Eet_File * ef,
Eet_File *** cache,
int * cache_num,
int * cache_alloc)
{
Eet_File ** new_cache;
int new_cache_num, new_cache_alloc;
@ -457,11 +466,12 @@ eet_cache_del(Eet_File *ef, Eet_File ***cache, int *cache_num, int *cache_alloc)
*cache = new_cache;
*cache_num = new_cache_num;
*cache_alloc = new_cache_alloc;
}
} /* eet_cache_del */
/* internal string match. null friendly, catches same ptr */
static int
eet_string_match(const char *s1, const char *s2)
eet_string_match(const char * s1,
const char * s2)
{
/* both null- no match */
if ((!s1) || (!s2))
@ -471,7 +481,7 @@ eet_string_match(const char *s1, const char *s2)
return 1;
return (!strcmp(s1, s2));
}
} /* eet_string_match */
/* flush out writes to a v2 eet file */
static Eet_Error
@ -689,13 +699,13 @@ write_error:
case EPIPE: error = EET_ERROR_WRITE_ERROR_FILE_CLOSED; break;
default: error = EET_ERROR_WRITE_ERROR; break;
}
} /* switch */
}
sign_error:
fclose(fp);
return error;
}
} /* eet_flush2 */
EAPI int
eet_init(void)
@ -747,15 +757,15 @@ eet_init(void)
WRN(
"YOU ARE USING PTHREADS, BUT I CANNOT INITIALIZE THREADSAFE GCRYPT OPERATIONS!");
#endif
#endif /* ifdef EFL_HAVE_POSIX_THREADS */
if (gnutls_global_init())
goto shutdown_eet;
#endif
#endif /* ifdef HAVE_GNUTLS */
#ifdef HAVE_OPENSSL
ERR_load_crypto_strings();
OpenSSL_add_all_algorithms();
#endif
#endif /* ifdef HAVE_OPENSSL */
return eet_init_count;
@ -767,7 +777,7 @@ unregister_log_domain:
shutdown_eina:
eina_shutdown();
return --eet_init_count;
}
} /* eet_init */
EAPI int
eet_shutdown(void)
@ -779,17 +789,17 @@ eet_shutdown(void)
eet_node_shutdown();
#ifdef HAVE_GNUTLS
gnutls_global_deinit();
#endif
#endif /* ifdef HAVE_GNUTLS */
#ifdef HAVE_OPENSSL
EVP_cleanup();
ERR_free_strings();
#endif
#endif /* ifdef HAVE_OPENSSL */
eina_log_domain_unregister(_eet_log_dom_global);
_eet_log_dom_global = -1;
eina_shutdown();
return eet_init_count;
}
} /* eet_shutdown */
EAPI Eet_Error
eet_sync(Eet_File * ef)
@ -812,7 +822,7 @@ eet_sync(Eet_File *ef)
UNLOCK_FILE(ef);
return ret;
}
} /* eet_sync */
EAPI void
eet_clearcache(void)
@ -870,7 +880,7 @@ eet_clearcache(void)
}
UNLOCK_CACHE;
}
} /* eet_clearcache */
/* FIXME: MMAP race condition in READ_WRITE_MODE */
static Eet_File *
@ -1114,14 +1124,14 @@ eet_internal_read2(Eet_File *ef)
if (eet_test_close(ef->x509_der == NULL, ef))
return NULL;
#else
#else /* ifdef HAVE_SIGNATURE */
ERR(
"This file could be signed but you didn't compile the necessary code to check the signature.");
#endif
#endif /* ifdef HAVE_SIGNATURE */
}
return ef;
}
} /* eet_internal_read2 */
#if EET_OLD_EET_FILE_FORMAT
static Eet_File *
@ -1297,8 +1307,9 @@ eet_internal_read1(Eet_File *ef)
p += HEADER_SIZE + name_size;
}
return ef;
}
#endif
} /* eet_internal_read1 */
#endif /* if EET_OLD_EET_FILE_FORMAT */
/*
* this should only be called when the cache lock is already held
@ -1323,7 +1334,7 @@ eet_internal_read(Eet_File *ef)
case EET_MAGIC_FILE:
return eet_internal_read1(ef);
#endif
#endif /* if EET_OLD_EET_FILE_FORMAT */
case EET_MAGIC_FILE2:
return eet_internal_read2(ef);
@ -1331,13 +1342,14 @@ eet_internal_read(Eet_File *ef)
ef->delete_me_now = 1;
eet_internal_close(ef, EINA_TRUE);
break;
}
} /* switch */
return NULL;
}
} /* eet_internal_read */
static Eet_Error
eet_internal_close(Eet_File *ef, Eina_Bool locked)
eet_internal_close(Eet_File * ef,
Eina_Bool locked)
{
Eet_Error err;
@ -1438,10 +1450,11 @@ on_error:
UNLOCK_CACHE;
return EET_ERROR_NONE;
}
} /* eet_internal_close */
EAPI Eet_File *
eet_memopen_read(const void *data, size_t size)
eet_memopen_read(const void * data,
size_t size)
{
Eet_File * ef;
@ -1473,10 +1486,11 @@ eet_memopen_read(const void *data, size_t size)
ef = eet_internal_read(ef);
UNLOCK_CACHE;
return ef;
}
} /* eet_memopen_read */
EAPI Eet_File *
eet_open(const char *file, Eet_File_Mode mode)
eet_open(const char * file,
Eet_File_Mode mode)
{
FILE * fp;
Eet_File * ef;
@ -1647,7 +1661,7 @@ empty_file:
on_error:
UNLOCK_CACHE;
return NULL;
}
} /* eet_open */
EAPI Eet_File_Mode
eet_mode_get(Eet_File * ef)
@ -1657,10 +1671,11 @@ eet_mode_get(Eet_File *ef)
return EET_FILE_MODE_INVALID;
else
return ef->mode;
}
} /* eet_mode_get */
EAPI const void *
eet_identity_x509(Eet_File *ef, int *der_length)
eet_identity_x509(Eet_File * ef,
int * der_length)
{
if (!ef->x509_der)
return NULL;
@ -1669,10 +1684,11 @@ eet_identity_x509(Eet_File *ef, int *der_length)
*der_length = ef->x509_length;
return ef->x509_der;
}
} /* eet_identity_x509 */
EAPI const void *
eet_identity_signature(Eet_File *ef, int *signature_length)
eet_identity_signature(Eet_File * ef,
int * signature_length)
{
if (!ef->signature)
return NULL;
@ -1681,10 +1697,11 @@ eet_identity_signature(Eet_File *ef, int *signature_length)
*signature_length = ef->signature_length;
return ef->signature;
}
} /* eet_identity_signature */
EAPI const void *
eet_identity_sha1(Eet_File *ef, int *sha1_length)
eet_identity_sha1(Eet_File * ef,
int * sha1_length)
{
if (!ef->sha1)
ef->sha1 = eet_identity_compute_sha1(ef->data,
@ -1695,10 +1712,11 @@ eet_identity_sha1(Eet_File *ef, int *sha1_length)
*sha1_length = ef->sha1_length;
return ef->sha1;
}
} /* eet_identity_sha1 */
EAPI Eet_Error
eet_identity_set(Eet_File *ef, Eet_Key *key)
eet_identity_set(Eet_File * ef,
Eet_Key * key)
{
Eet_Key * tmp = ef->key;
@ -1713,13 +1731,13 @@ eet_identity_set(Eet_File *ef, Eet_Key *key)
ef->writes_pending = 1;
return EET_ERROR_NONE;
}
} /* eet_identity_set */
EAPI Eet_Error
eet_close(Eet_File * ef)
{
return eet_internal_close(ef, EINA_FALSE);
}
} /* eet_close */
EAPI void *
eet_read_cipher(Eet_File * ef,
@ -1878,16 +1896,20 @@ on_error:
UNLOCK_FILE(ef);
free(data);
return NULL;
}
} /* eet_read_cipher */
EAPI void *
eet_read(Eet_File *ef, const char *name, int *size_ret)
eet_read(Eet_File * ef,
const char * name,
int * size_ret)
{
return eet_read_cipher(ef, name, size_ret, NULL);
}
} /* eet_read */
EAPI const void *
eet_read_direct(Eet_File *ef, const char *name, int *size_ret)
eet_read_direct(Eet_File * ef,
const char * name,
int * size_ret)
{
Eet_File_Node * efn;
const char * data = NULL;
@ -1975,10 +1997,13 @@ eet_read_direct(Eet_File *ef, const char *name, int *size_ret)
on_error:
UNLOCK_FILE(ef);
return NULL;
}
} /* eet_read_direct */
EAPI Eina_Bool
eet_alias(Eet_File *ef, const char *name, const char *destination, int comp)
eet_alias(Eet_File * ef,
const char * name,
const char * destination,
int comp)
{
Eet_File_Node * efn;
void * data2;
@ -2127,7 +2152,7 @@ eet_alias(Eet_File *ef, const char *name, const char *destination, int comp)
on_error:
UNLOCK_FILE(ef);
return EINA_FALSE;
}
} /* eet_alias */
EAPI int
eet_write_cipher(Eet_File * ef,
@ -2309,16 +2334,21 @@ eet_write_cipher(Eet_File *ef,
on_error:
UNLOCK_FILE(ef);
return 0;
}
} /* eet_write_cipher */
EAPI int
eet_write(Eet_File *ef, const char *name, const void *data, int size, int comp)
eet_write(Eet_File * ef,
const char * name,
const void * data,
int size,
int comp)
{
return eet_write_cipher(ef, name, data, size, comp, NULL);
}
} /* eet_write */
EAPI int
eet_delete(Eet_File *ef, const char *name)
eet_delete(Eet_File * ef,
const char * name)
{
Eet_File_Node * efn;
Eet_File_Node * pefn;
@ -2376,7 +2406,7 @@ eet_delete(Eet_File *ef, const char *name)
/* update access time */
return exists_already;
}
} /* eet_delete */
EAPI Eet_Dictionary *
eet_dictionary_get(Eet_File * ef)
@ -2385,11 +2415,12 @@ eet_dictionary_get(Eet_File *ef)
return NULL;
return ef->ed;
}
} /* eet_dictionary_get */
EAPI char **
eet_list(Eet_File *ef, const char *glob, int *count_ret)
eet_list(Eet_File * ef,
const char * glob,
int * count_ret)
{
Eet_File_Node * efn;
char ** list_ret = NULL;
@ -2468,7 +2499,7 @@ on_error:
*count_ret = 0;
return NULL;
}
} /* eet_list */
EAPI int
eet_num_entries(Eet_File * ef)
@ -2495,10 +2526,11 @@ eet_num_entries(Eet_File *ef)
UNLOCK_FILE(ef);
return ret;
}
} /* eet_num_entries */
static Eet_File_Node *
find_node_by_name(Eet_File *ef, const char *name)
find_node_by_name(Eet_File * ef,
const char * name)
{
Eet_File_Node * efn;
int hash;
@ -2513,10 +2545,13 @@ find_node_by_name(Eet_File *ef, const char *name)
}
return NULL;
}
} /* find_node_by_name */
static int
read_data_from_disk(Eet_File *ef, Eet_File_Node *efn, void *buf, int len)
read_data_from_disk(Eet_File * ef,
Eet_File_Node * efn,
void * buf,
int len)
{
if (efn->offset < 0)
return 0;
@ -2542,4 +2577,5 @@ read_data_from_disk(Eet_File *ef, Eet_File_Node *efn, void *buf, int len)
}
return len;
}
} /* read_data_from_disk */

View File

@ -4,14 +4,14 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#endif /* ifdef HAVE_CONFIG_H */
#include <string.h>
#include <stdio.h>
#ifdef HAVE_EVIL
# include <Evil.h>
#endif
#endif /* ifdef HAVE_EVIL */
#include <Eina.h>
@ -31,16 +31,17 @@ eet_node_new(void)
memset(result, 0, sizeof (Eet_Node));
return result;
}
} /* eet_node_new */
void
eet_node_free(Eet_Node * node)
{
eina_mempool_free(_eet_node_mp, node);
}
} /* eet_node_free */
static Eet_Node *
_eet_node_new(const char *name, int type)
_eet_node_new(const char * name,
int type)
{
Eet_Node * n;
@ -52,7 +53,7 @@ _eet_node_new(const char *name, int type)
n->name = eina_stringshare_add(name);
return n;
}
} /* _eet_node_new */
static void
_eet_node_append(Eet_Node * n, Eina_List * nodes)
@ -65,7 +66,7 @@ _eet_node_append(Eet_Node *n, Eina_List *nodes)
value->next = n->values;
n->values = value;
}
}
} /* _eet_node_append */
#define EET_NODE_NEW(Eet_type, Name, Value, Type)\
EAPI Eet_Node *\
@ -123,7 +124,8 @@ eet_node_null_new(const char *name)
}
Eet_Node *
eet_node_list_new(const char *name, Eina_List *nodes)
eet_node_list_new(const char * name,
Eina_List * nodes)
{
Eet_Node * n;
@ -134,10 +136,12 @@ eet_node_list_new(const char *name, Eina_List *nodes)
_eet_node_append(n, nodes);
return n;
}
} /* eet_node_list_new */
Eet_Node *
eet_node_array_new(const char *name, int count, Eina_List *nodes)
eet_node_array_new(const char * name,
int count,
Eina_List * nodes)
{
Eet_Node * n;
@ -150,10 +154,11 @@ eet_node_array_new(const char *name, int count, Eina_List *nodes)
_eet_node_append(n, nodes);
return n;
}
} /* eet_node_array_new */
Eet_Node *
eet_node_var_array_new(const char *name, Eina_List *nodes)
eet_node_var_array_new(const char * name,
Eina_List * nodes)
{
Eet_Node * n;
@ -166,10 +171,12 @@ eet_node_var_array_new(const char *name, Eina_List *nodes)
_eet_node_append(n, nodes);
return n;
}
} /* eet_node_var_array_new */
Eet_Node *
eet_node_hash_new(const char *name, const char *key, Eet_Node *node)
eet_node_hash_new(const char * name,
const char * key,
Eet_Node * node)
{
Eina_List * nodes;
Eet_Node * n;
@ -187,10 +194,11 @@ eet_node_hash_new(const char *name, const char *key, Eet_Node *node)
_eet_node_append(n, nodes);
return n;
}
} /* eet_node_hash_new */
Eet_Node *
eet_node_struct_new(const char *name, Eina_List *nodes)
eet_node_struct_new(const char * name,
Eina_List * nodes)
{
Eet_Node * n;
@ -201,10 +209,11 @@ eet_node_struct_new(const char *name, Eina_List *nodes)
_eet_node_append(n, nodes);
return n;
}
} /* eet_node_struct_new */
Eet_Node *
eet_node_struct_child_new(const char *parent, Eet_Node *child)
eet_node_struct_child_new(const char * parent,
Eet_Node * child)
{
Eet_Node * n;
@ -218,10 +227,12 @@ eet_node_struct_child_new(const char *parent, Eet_Node *child)
_eet_node_append(n, eina_list_prepend(NULL, child));
return n;
}
} /* eet_node_struct_child_new */
void
eet_node_list_append(Eet_Node *parent, const char *name, Eet_Node *child)
eet_node_list_append(Eet_Node * parent,
const char * name,
Eet_Node * child)
{
const char * tmp;
Eet_Node * nn;
@ -257,10 +268,12 @@ eet_node_list_append(Eet_Node *parent, const char *name, Eet_Node *child)
parent->values = nn;
eina_stringshare_del(tmp);
}
} /* eet_node_list_append */
void
eet_node_struct_append(Eet_Node *parent, const char *name, Eet_Node *child)
eet_node_struct_append(Eet_Node * parent,
const char * name,
Eet_Node * child)
{
const char * tmp;
Eet_Node * prev;
@ -303,7 +316,7 @@ eet_node_struct_append(Eet_Node *parent, const char *name, Eet_Node *child)
}
eina_stringshare_del(tmp);
}
} /* eet_node_struct_append */
void
eet_node_hash_add(Eet_Node * parent,
@ -319,7 +332,7 @@ eet_node_hash_add(Eet_Node *parent,
/* And add it to the parent. */
nn->next = parent->values;
parent->values = nn;
}
} /* eet_node_hash_add */
void
eet_node_del(Eet_Node * n)
@ -362,11 +375,11 @@ eet_node_del(Eet_Node *n)
case EET_T_USHORT:
case EET_T_UINT:
break;
}
} /* switch */
eina_stringshare_del(n->name);
eet_node_free(n);
}
} /* eet_node_del */
static const char * eet_node_dump_g_name[6] = {
"struct",
@ -393,14 +406,14 @@ static const char *eet_node_dump_t_name[14][2] = {
};
static void
eet_node_dump_level(int level, void (*dumpfunc)(void *data,
const char *str),
eet_node_dump_level(int level,
void (* dumpfunc)(void * data, const char * str),
void * dumpdata)
{
int i;
for (i = 0; i < level; i++) dumpfunc(dumpdata, " ");
}
} /* eet_node_dump_level */
static char *
eet_node_string_escape(const char * str)
@ -441,11 +454,11 @@ eet_node_string_escape(const char *str)
}
*sp = 0;
return s;
}
} /* eet_node_string_escape */
static void
eet_node_dump_string_escape(void *dumpdata, void dumpfunc(void *data,
const char *str),
eet_node_dump_string_escape(void * dumpdata,
void dumpfunc(void * data, const char * str),
const char * str)
{
char * s;
@ -456,12 +469,12 @@ eet_node_dump_string_escape(void *dumpdata, void dumpfunc(void *data,
dumpfunc(dumpdata, s);
free(s);
}
} /* eet_node_dump_string_escape */
static void
eet_node_dump_simple_type(Eet_Node * n, int level,
void (*dumpfunc)(void *data,
const char *str), void *dumpdata)
void (* dumpfunc)(void * data, const char * str),
void * dumpdata)
{
const char * type_name = NULL;
char tbuf[256];
@ -473,7 +486,7 @@ eet_node_dump_simple_type(Eet_Node *n, int level,
#ifdef EET_T_TYPE
# undef EET_T_TYPE
#endif
#endif /* ifdef EET_T_TYPE */
#define EET_T_TYPE(Eet_Type, Type)\
case Eet_Type:\
@ -519,16 +532,17 @@ eet_node_dump_simple_type(Eet_Node *n, int level,
default:
dumpfunc(dumpdata, "???: ???");
break;
}
} /* switch */
dumpfunc(dumpdata, ";\n");
}
} /* eet_node_dump_simple_type */
static void
eet_node_dump_group_start(int level, void (*dumpfunc)(void *data,
const char *str),
eet_node_dump_group_start(int level,
void (* dumpfunc)(void * data, const char * str),
void * dumpdata,
int group_type, const char *name)
int group_type,
const char * name)
{
int chnk_type;
@ -542,20 +556,21 @@ eet_node_dump_group_start(int level, void (*dumpfunc)(void *data,
dumpfunc(dumpdata, eet_node_dump_g_name[chnk_type - EET_G_UNKNOWN]);
dumpfunc(dumpdata, " {\n");
}
} /* eet_node_dump_group_start */
static void
eet_node_dump_group_end(int level, void (*dumpfunc)(void *data,
const char *str),
eet_node_dump_group_end(int level,
void (* dumpfunc)(void * data, const char * str),
void * dumpdata)
{
eet_node_dump_level(level, dumpfunc, dumpdata);
dumpfunc(dumpdata, "}\n");
}
} /* eet_node_dump_group_end */
void
eet_node_dump(Eet_Node *n, int dumplevel, void (*dumpfunc)(void *data,
const char *str),
eet_node_dump(Eet_Node * n,
int dumplevel,
void (* dumpfunc)(void * data, const char * str),
void * dumpdata)
{
Eet_Node * it;
@ -615,8 +630,8 @@ eet_node_dump(Eet_Node *n, int dumplevel, void (*dumpfunc)(void *data,
case EET_T_ULONG_LONG:
eet_node_dump_simple_type(n, dumplevel, dumpfunc, dumpdata);
break;
}
}
} /* switch */
} /* eet_node_dump */
void *
eet_node_walk(void * parent,
@ -698,13 +713,13 @@ eet_node_walk(void *parent,
case EET_T_ULONG_LONG:
me = cb->simple(root->type, &root->data, user_data);
break;
}
} /* switch */
if (parent)
cb->struct_add(parent, name, me, user_data);
return me;
}
} /* eet_node_walk */
int
eet_node_init(void)
@ -721,11 +736,12 @@ eet_node_init(void)
eina_mempool_add(choice, "eet-node-alloc", NULL, sizeof(Eet_Node), 1024);
return _eet_node_mp ? 1 : 0;
}
} /* eet_node_init */
void
eet_node_shutdown(void)
{
eina_mempool_del(_eet_node_mp);
_eet_node_mp = NULL;
}
} /* eet_node_shutdown */

View File

@ -4,7 +4,7 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#endif /* ifdef HAVE_CONFIG_H */
#include <stdio.h>
#include <math.h>
@ -13,7 +13,8 @@
#include "Eet_private.h"
int
_eet_hash_gen(const char *key, int hash_size)
_eet_hash_gen(const char * key,
int hash_size)
{
int hash_num = 0;
int value, i;
@ -35,5 +36,5 @@ _eet_hash_gen(const char *key, int hash_size)
hash_num &= mask;
/* return it */
return hash_num;
}
} /* _eet_hash_gen */

View File

@ -9,21 +9,21 @@ static char *
_eet_str_direct_alloc(const char * str)
{
return (char *)str;
}
} /* _eet_str_direct_alloc */
static void
_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)
{
if (hash)
eina_hash_foreach(hash, cb, fdata);
}
} /* _eet_eina_hash_foreach */
/* Internal wrapper for eina_hash */
static Eina_Hash *
@ -37,14 +37,14 @@ _eet_eina_hash_add(Eina_Hash *hash, const char *key, const void *data)
eina_hash_add(hash, key, data);
return hash;
}
} /* _eet_eina_hash_add */
static void
_eet_eina_hash_free(Eina_Hash * hash)
{
if (hash)
eina_hash_free(hash);
}
} /* _eet_eina_hash_free */
void
eet_test_setup_eddc(Eet_Data_Descriptor_Class * eddc)
@ -63,5 +63,5 @@ eet_test_setup_eddc(Eet_Data_Descriptor_Class *eddc)
eddc->func.hash_free = (void *)_eet_eina_hash_free;
eddc->func.str_direct_alloc = (void *)_eet_str_direct_alloc;
eddc->func.str_direct_free = (void *)_eet_str_direct_free;
}
} /* eet_test_setup_eddc */

View File

@ -1,7 +1,7 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#endif /* ifdef HAVE_CONFIG_H */
#include <sys/types.h>
#include <sys/stat.h>
@ -14,7 +14,7 @@
#ifdef EFL_HAVE_POSIX_THREADS
# include <pthread.h>
#endif
#endif /* ifdef EFL_HAVE_POSIX_THREADS */
#include <check.h>
@ -168,7 +168,7 @@ _eet_test_basic_set(Eet_Test_Basic_Type *res, int i)
tmp->empty = NULL;
tmp->with = NULL;
}
}
} /* _eet_test_basic_set */
static void
_eet_test_basic_check(Eet_Test_Basic_Type * result, int i)
@ -225,7 +225,7 @@ _eet_test_basic_check(Eet_Test_Basic_Type *result, int i)
}
else
fail_if(result->with != NULL);
}
} /* _eet_test_basic_check */
static void
_eet_build_basic_descriptor(Eet_Data_Descriptor * edd)
@ -298,7 +298,7 @@ _eet_build_basic_descriptor(Eet_Data_Descriptor *edd)
EET_DATA_DESCRIPTOR_ADD_SUB(edd, Eet_Test_Basic_Type, "empty", empty, edd);
EET_DATA_DESCRIPTOR_ADD_SUB(edd, Eet_Test_Basic_Type, "with", with, edd);
}
} /* _eet_build_basic_descriptor */
START_TEST(eet_test_basic_data_type_encoding_decoding)
{
@ -378,7 +378,6 @@ struct _Eet_Test_Ex_Type
static int i42 = 42;
static int i7 = 7;
static void
_eet_build_ex_descriptor(Eet_Data_Descriptor * edd)
{
@ -521,7 +520,7 @@ _eet_build_ex_descriptor(Eet_Data_Descriptor *edd)
eet_data_descriptor_element_add(edd, "shash", EET_T_STRING, EET_G_HASH,
(char *)(&(etbt.shash)) - (char *)(&(etbt)),
0, /* 0, */ NULL, NULL);
}
} /* _eet_build_ex_descriptor */
static Eet_Test_Ex_Type *
_eet_test_ex_set(Eet_Test_Ex_Type * res, int offset)
@ -579,7 +578,7 @@ _eet_test_ex_set(Eet_Test_Ex_Type *res, int offset)
res->ul = EET_TEST_LONG_LONG + offset;
return res;
}
} /* _eet_test_ex_set */
static int
_eet_test_ex_check(Eet_Test_Ex_Type * stuff, int offset)
@ -669,7 +668,7 @@ _eet_test_ex_check(Eet_Test_Ex_Type *stuff, int offset)
}
return 0;
}
} /* _eet_test_ex_check */
static Eina_Bool
func(__UNUSED__ const Eina_Hash * hash, const void * key, void * data, void * fdata)
@ -684,7 +683,7 @@ func(__UNUSED__ const Eina_Hash *hash, const void *key, void *data, void *fdata)
*res = 1;
return EINA_TRUE;
}
} /* func */
static Eina_Bool
func7(__UNUSED__ const Eina_Hash * hash,
@ -703,7 +702,7 @@ func7(__UNUSED__ const Eina_Hash *hash,
*res = 1;
return EINA_TRUE;
}
} /* func7 */
START_TEST(eet_test_data_type_encoding_decoding)
{
@ -784,7 +783,7 @@ append_string(void *data, const char *str)
*string = realloc(*string, strlen(str) + length + 1);
memcpy((*string) + length, str, strlen(str) + 1);
}
} /* append_string */
START_TEST(eet_test_data_type_dump_undump)
{
@ -938,7 +937,8 @@ START_TEST(eet_file_simple_write)
fail_if(unlink(file) != 0);
eet_shutdown();
}
} /* START_TEST */
END_TEST
START_TEST(eet_file_data_test)
@ -1088,7 +1088,8 @@ START_TEST(eet_file_data_test)
fail_if(unlink(file) != 0);
eet_shutdown();
}
} /* START_TEST */
END_TEST
START_TEST(eet_file_data_dump_test)
@ -1183,7 +1184,8 @@ START_TEST(eet_file_data_dump_test)
fail_if(unlink(file) != 0);
eet_shutdown();
}
} /* START_TEST */
END_TEST
START_TEST(eet_image)
@ -1540,7 +1542,8 @@ START_TEST(eet_image)
fail_if(unlink(file) != 0);
eet_shutdown();
}
} /* START_TEST */
END_TEST
#define IM0 0x00112233
@ -1604,7 +1607,8 @@ START_TEST(eet_small_image)
free(data);
eet_shutdown();
}
} /* START_TEST */
END_TEST
START_TEST(eet_identity_simple)
@ -1680,7 +1684,8 @@ START_TEST(eet_identity_simple)
fail_if(unlink(file) != 0);
eet_shutdown();
}
} /* START_TEST */
END_TEST
START_TEST(eet_identity_open_simple)
@ -1698,7 +1703,8 @@ START_TEST(eet_identity_open_simple)
eet_identity_close(k);
eet_shutdown();
}
} /* START_TEST */
END_TEST
START_TEST(eet_identity_open_pkcs8)
@ -1716,7 +1722,8 @@ START_TEST(eet_identity_open_pkcs8)
eet_identity_close(k);
eet_shutdown();
}
} /* START_TEST */
END_TEST
static int pass_get(char * pass,
@ -1731,7 +1738,7 @@ static int pass_get(char *pass,
snprintf(pass, size, "%s", "password");
return strlen(pass);
}
} /* pass_get */
static int badpass_get(char * pass,
int size,
@ -1745,8 +1752,7 @@ static int badpass_get(char *pass,
snprintf(pass, size, "%s", "bad password");
return strlen(pass);
}
} /* badpass_get */
START_TEST(eet_identity_open_pkcs8_enc)
{
@ -1828,7 +1834,8 @@ START_TEST(eet_cipher_decipher_simple)
fail_if(unlink(file) != 0);
eet_shutdown();
}
} /* START_TEST */
END_TEST
#ifdef EFL_HAVE_THREADS
@ -1854,9 +1861,9 @@ open_close_worker(void *path)
}
pthread_exit(NULL);
}
} /* open_close_worker */
# else
# else /* ifdef EFL_HAVE_POSIX_THREADS */
static unsigned int __stdcall
open_close_worker(void * path)
@ -1875,9 +1882,9 @@ open_close_worker(void *path)
}
_endthreadex(0);
}
} /* open_close_worker */
# endif
# endif /* ifdef EFL_HAVE_POSIX_THREADS */
START_TEST(eet_cache_concurrency)
{
@ -1888,11 +1895,11 @@ START_TEST(eet_cache_concurrency)
unsigned int n;
# ifdef EFL_HAVE_POSIX_THREADS
pthread_t thread;
# else
# else /* ifdef EFL_HAVE_POSIX_THREADS */
uintptr_t thread;
unsigned int thread_id;
DWORD ret;
# endif
# endif /* ifdef EFL_HAVE_POSIX_THREADS */
eet_init();
@ -1906,9 +1913,9 @@ START_TEST(eet_cache_concurrency)
open_worker_stop = 0;
# ifdef EFL_HAVE_POSIX_THREADS
pthread_create(&thread, NULL, open_close_worker, file);
# else
# else /* ifdef EFL_HAVE_POSIX_THREADS */
thread = _beginthreadex(NULL, 0, open_close_worker, file, 0, &thread_id);
# endif
# endif /* ifdef EFL_HAVE_POSIX_THREADS */
/* clear the cache repeatedly in this thread */
for (n = 0; n < 50000; ++n)
{
@ -1920,12 +1927,12 @@ START_TEST(eet_cache_concurrency)
# ifdef EFL_HAVE_POSIX_THREADS
fail_if(pthread_join(thread, &thread_ret) != 0);
fail_unless(thread_ret == NULL, (char const *)thread_ret);
# else
# else /* ifdef EFL_HAVE_POSIX_THREADS */
ret = WaitForSingleObject((HANDLE)thread, INFINITE);
fail_if(ret != WAIT_OBJECT_0);
fail_if(GetExitCodeThread((HANDLE)thread, &ret) == FALSE);
fail_if(ret != 0);
# endif
# endif /* ifdef EFL_HAVE_POSIX_THREADS */
fail_if(unlink(file) != 0);
eet_shutdown();
@ -1982,7 +1989,7 @@ _eet_connection_read(const void *eet_data, size_t size, void *user_data)
}
return EINA_TRUE;
}
} /* _eet_connection_read */
static Eina_Bool
_eet_connection_write(const void * data, size_t size, void * user_data)
@ -2005,7 +2012,7 @@ _eet_connection_write(const void *data, size_t size, void *user_data)
fail_if(still);
return EINA_TRUE;
}
} /* _eet_connection_write */
START_TEST(eet_connection_check)
{
@ -2214,7 +2221,8 @@ START_TEST(eet_file_fp)
fail_if(unlink(file) != 0);
eet_shutdown();
}
} /* START_TEST */
END_TEST
typedef struct _Eet_Union_Test Eet_Union_Test;
@ -2328,7 +2336,7 @@ _eet_union_type_get(const void *data, Eina_Bool *unknow)
*unknow = EINA_TRUE;
return NULL;
}
} /* _eet_union_type_get */
static Eina_Bool
_eet_union_type_set(const char * type, void * data, Eina_Bool unknow)
@ -2347,7 +2355,7 @@ _eet_union_type_set(const char *type, void *data, Eina_Bool unknow)
}
return EINA_FALSE;
}
} /* _eet_union_type_set */
static const char *
_eet_variant_type_get(const void * data, Eina_Bool * unknow)
@ -2366,7 +2374,7 @@ _eet_variant_type_get(const void *data, Eina_Bool *unknow)
*unknow = EINA_FALSE;
return type->type;
}
} /* _eet_variant_type_get */
static Eina_Bool
_eet_variant_type_set(const char * type, void * data, Eina_Bool unknow)
@ -2376,7 +2384,7 @@ _eet_variant_type_set(const char *type, void *data, Eina_Bool unknow)
vt->type = type;
vt->unknow = unknow;
return EINA_TRUE;
}
} /* _eet_variant_type_set */
static Eet_Data_Descriptor *
_eet_st1_dd(void)
@ -2391,7 +2399,7 @@ _eet_st1_dd(void)
EET_DATA_DESCRIPTOR_ADD_BASIC(res, Eet_St1, "s1", s1, EET_T_STRING);
return res;
}
} /* _eet_st1_dd */
static void
_eet_st1_set(Eet_St1 * st1, int i)
@ -2399,7 +2407,7 @@ _eet_st1_set(Eet_St1 *st1, int i)
st1->val1 = EET_TEST_DOUBLE;
st1->stuff = EET_TEST_INT + i;
st1->s1 = EET_TEST_STRING;
}
} /* _eet_st1_set */
static void
_eet_st1_cmp(Eet_St1 * st1, int i)
@ -2415,7 +2423,7 @@ _eet_st1_cmp(Eet_St1 *st1, int i)
fail_if(tmp > 0.005);
fail_if(st1->stuff != EET_TEST_INT + i);
fail_if(strcmp(st1->s1, EET_TEST_STRING));
}
} /* _eet_st1_cmp */
static Eet_Data_Descriptor *
_eet_st2_dd(void)
@ -2429,21 +2437,21 @@ _eet_st2_dd(void)
EET_DATA_DESCRIPTOR_ADD_BASIC(res, Eet_St2, "v1", v1, EET_T_ULONG_LONG);
return res;
}
} /* _eet_st2_dd */
static void
_eet_st2_set(Eet_St2 * st2, int i)
{
st2->b1 = EINA_TRUE;
st2->v1 = EET_TEST_LONG_LONG + i;
}
} /* _eet_st2_set */
static void
_eet_st2_cmp(Eet_St2 * st2, int i)
{
fail_if(!st2->b1);
fail_if(st2->v1 != EET_TEST_LONG_LONG + i);
}
} /* _eet_st2_cmp */
static Eet_Data_Descriptor *
_eet_st3_dd(void)
@ -2456,19 +2464,19 @@ _eet_st3_dd(void)
EET_DATA_DESCRIPTOR_ADD_BASIC(res, Eet_St3, "boby", boby, EET_T_INT);
return res;
}
} /* _eet_st3_dd */
static void
_eet_st3_set(Eet_St3 * st3, int i)
{
st3->boby = EET_TEST_INT + i;
}
} /* _eet_st3_set */
static void
_eet_st3_cmp(Eet_St3 * st3, int i)
{
fail_if(st3->boby != EET_TEST_INT + i);
}
} /* _eet_st3_cmp */
START_TEST(eet_test_union)
{
@ -2655,7 +2663,8 @@ START_TEST(eet_test_variant)
eet_shutdown();
eina_shutdown();
}
} /* START_TEST */
END_TEST
Suite *
@ -2698,26 +2707,26 @@ eet_suite(void)
tcase_add_test(tc, eet_identity_open_pkcs8);
tcase_add_test(tc, eet_identity_open_pkcs8_enc);
suite_add_tcase(s, tc);
#endif
#endif /* ifdef HAVE_SIGNATURE */
#ifdef HAVE_CIPHER
tc = tcase_create("Eet Cipher");
tcase_add_test(tc, eet_cipher_decipher_simple);
suite_add_tcase(s, tc);
#endif
#endif /* ifdef HAVE_CIPHER */
#ifdef EFL_HAVE_THREADS
tc = tcase_create("Eet Cache");
tcase_add_test(tc, eet_cache_concurrency);
suite_add_tcase(s, tc);
#endif
#endif /* ifdef EFL_HAVE_THREADS */
tc = tcase_create("Eet Connection");
tcase_add_test(tc, eet_connection_check);
suite_add_tcase(s, tc);
return s;
}
} /* eet_suite */
int
main(void)
@ -2733,4 +2742,5 @@ main(void)
srunner_free(sr);
return (failed_count == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}
} /* main */

View File

@ -5,5 +5,4 @@
void eet_test_setup_eddc(Eet_Data_Descriptor_Class * eddc);
#endif /* _EET_SUITE_H */