forked from enlightenment/efl
parent
38aac01b6a
commit
5d1a9f4e0d
File diff suppressed because it is too large
Load Diff
|
@ -38,18 +38,18 @@ struct _Eet_String
|
||||||
};
|
};
|
||||||
struct _Eet_Dictionary
|
struct _Eet_Dictionary
|
||||||
{
|
{
|
||||||
Eet_String * all;
|
Eet_String *all;
|
||||||
|
|
||||||
int size;
|
int size;
|
||||||
int offset;
|
int offset;
|
||||||
|
|
||||||
int hash[256];
|
int hash[256];
|
||||||
|
|
||||||
int count;
|
int count;
|
||||||
int total;
|
int total;
|
||||||
|
|
||||||
const char * start;
|
const char *start;
|
||||||
const char * end;
|
const char *end;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _Eet_Node
|
struct _Eet_Node
|
||||||
|
@ -100,60 +100,60 @@ extern int _eet_log_dom_global;
|
||||||
#define CRIT(...) EINA_LOG_DOM_CRIT(_eet_log_dom_global, __VA_ARGS__)
|
#define CRIT(...) EINA_LOG_DOM_CRIT(_eet_log_dom_global, __VA_ARGS__)
|
||||||
|
|
||||||
Eet_Dictionary * eet_dictionary_add(void);
|
Eet_Dictionary * eet_dictionary_add(void);
|
||||||
void eet_dictionary_free(Eet_Dictionary * ed);
|
void eet_dictionary_free(Eet_Dictionary *ed);
|
||||||
int eet_dictionary_string_add(Eet_Dictionary * ed,
|
int eet_dictionary_string_add(Eet_Dictionary *ed,
|
||||||
const char * string);
|
const char * string);
|
||||||
int eet_dictionary_string_get_size(const Eet_Dictionary * ed,
|
int eet_dictionary_string_get_size(const Eet_Dictionary *ed,
|
||||||
int index);
|
int index);
|
||||||
const char * eet_dictionary_string_get_char(const Eet_Dictionary * ed,
|
const char * eet_dictionary_string_get_char(const Eet_Dictionary *ed,
|
||||||
int index);
|
int index);
|
||||||
Eina_Bool eet_dictionary_string_get_float(const Eet_Dictionary * ed,
|
Eina_Bool eet_dictionary_string_get_float(const Eet_Dictionary *ed,
|
||||||
int index,
|
int index,
|
||||||
float * result);
|
float * result);
|
||||||
Eina_Bool eet_dictionary_string_get_double(const Eet_Dictionary * ed,
|
Eina_Bool eet_dictionary_string_get_double(const Eet_Dictionary *ed,
|
||||||
int index,
|
int index,
|
||||||
double * result);
|
double * result);
|
||||||
Eina_Bool eet_dictionary_string_get_fp(const Eet_Dictionary * ed,
|
Eina_Bool eet_dictionary_string_get_fp(const Eet_Dictionary *ed,
|
||||||
int index,
|
int index,
|
||||||
Eina_F32p32 * result);
|
Eina_F32p32 * result);
|
||||||
int eet_dictionary_string_get_hash(const Eet_Dictionary * ed,
|
int eet_dictionary_string_get_hash(const Eet_Dictionary *ed,
|
||||||
int index);
|
int index);
|
||||||
|
|
||||||
int _eet_hash_gen(const char * key, int hash_size);
|
int _eet_hash_gen(const char *key, int hash_size);
|
||||||
|
|
||||||
const void * eet_identity_check(const void * data_base,
|
const void * eet_identity_check(const void * data_base,
|
||||||
unsigned int data_length,
|
unsigned int data_length,
|
||||||
void ** sha1,
|
void ** sha1,
|
||||||
int * sha1_length,
|
int * sha1_length,
|
||||||
const void * signature_base,
|
const void * signature_base,
|
||||||
unsigned int signature_length,
|
unsigned int signature_length,
|
||||||
const void ** raw_signature_base,
|
const void ** raw_signature_base,
|
||||||
unsigned int * raw_signature_length,
|
unsigned int *raw_signature_length,
|
||||||
int * x509_length);
|
int * x509_length);
|
||||||
void * eet_identity_compute_sha1(const void * data_base,
|
void * eet_identity_compute_sha1(const void * data_base,
|
||||||
unsigned int data_length,
|
unsigned int data_length,
|
||||||
int * sha1_length);
|
int * sha1_length);
|
||||||
Eet_Error eet_cipher(const void * data,
|
Eet_Error eet_cipher(const void * data,
|
||||||
unsigned int size,
|
unsigned int size,
|
||||||
const char * key,
|
const char * key,
|
||||||
unsigned int length,
|
unsigned int length,
|
||||||
void ** result,
|
void ** result,
|
||||||
unsigned int * result_length);
|
unsigned int *result_length);
|
||||||
Eet_Error eet_decipher(const void * data,
|
Eet_Error eet_decipher(const void * data,
|
||||||
unsigned int size,
|
unsigned int size,
|
||||||
const char * key,
|
const char * key,
|
||||||
unsigned int length,
|
unsigned int length,
|
||||||
void ** result,
|
void ** result,
|
||||||
unsigned int * result_length);
|
unsigned int *result_length);
|
||||||
Eet_Error eet_identity_sign(FILE * fp,
|
Eet_Error eet_identity_sign(FILE * fp,
|
||||||
Eet_Key * key);
|
Eet_Key *key);
|
||||||
void eet_identity_unref(Eet_Key * key);
|
void eet_identity_unref(Eet_Key *key);
|
||||||
void eet_identity_ref(Eet_Key * key);
|
void eet_identity_ref(Eet_Key *key);
|
||||||
|
|
||||||
void eet_node_shutdown(void);
|
void eet_node_shutdown(void);
|
||||||
int eet_node_init(void);
|
int eet_node_init(void);
|
||||||
Eet_Node * eet_node_new(void);
|
Eet_Node * eet_node_new(void);
|
||||||
void eet_node_free(Eet_Node * node);
|
void eet_node_free(Eet_Node *node);
|
||||||
|
|
||||||
#ifndef PATH_MAX
|
#ifndef PATH_MAX
|
||||||
# define PATH_MAX 4096
|
# define PATH_MAX 4096
|
||||||
|
|
|
@ -80,19 +80,19 @@ void * alloca (size_t);
|
||||||
|
|
||||||
#ifdef HAVE_CIPHER
|
#ifdef HAVE_CIPHER
|
||||||
# ifdef HAVE_GNUTLS
|
# ifdef HAVE_GNUTLS
|
||||||
static Eet_Error eet_hmac_sha1(const void * key,
|
static Eet_Error eet_hmac_sha1(const void * key,
|
||||||
size_t key_len,
|
size_t key_len,
|
||||||
const void * data,
|
const void * data,
|
||||||
size_t data_len,
|
size_t data_len,
|
||||||
unsigned char * res);
|
unsigned char *res);
|
||||||
# endif /* ifdef HAVE_GNUTLS */
|
# endif /* ifdef HAVE_GNUTLS */
|
||||||
static Eet_Error eet_pbkdf2_sha1(const char * key,
|
static Eet_Error eet_pbkdf2_sha1(const char * key,
|
||||||
int key_len,
|
int key_len,
|
||||||
const unsigned char * salt,
|
const unsigned char *salt,
|
||||||
unsigned int salt_len,
|
unsigned int salt_len,
|
||||||
int iter,
|
int iter,
|
||||||
unsigned char * res,
|
unsigned char * res,
|
||||||
int res_len);
|
int res_len);
|
||||||
#endif /* ifdef HAVE_CIPHER */
|
#endif /* ifdef HAVE_CIPHER */
|
||||||
|
|
||||||
struct _Eet_Key
|
struct _Eet_Key
|
||||||
|
@ -116,13 +116,13 @@ eet_identity_open(const char * certificate_file,
|
||||||
{
|
{
|
||||||
#ifdef HAVE_SIGNATURE
|
#ifdef HAVE_SIGNATURE
|
||||||
/* Signature declarations */
|
/* Signature declarations */
|
||||||
Eet_Key * key = NULL;
|
Eet_Key *key = NULL;
|
||||||
FILE * fp = NULL;
|
FILE *fp = NULL;
|
||||||
# ifdef HAVE_GNUTLS
|
# ifdef HAVE_GNUTLS
|
||||||
/* Gnutls private declarations */
|
/* Gnutls private declarations */
|
||||||
int fd = -1;
|
int fd = -1;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
void * data = NULL;
|
void *data = NULL;
|
||||||
gnutls_datum_t load_file = { NULL, 0 };
|
gnutls_datum_t load_file = { NULL, 0 };
|
||||||
char pass[1024];
|
char pass[1024];
|
||||||
|
|
||||||
|
@ -232,8 +232,8 @@ on_error:
|
||||||
|
|
||||||
# else /* ifdef HAVE_GNUTLS */
|
# else /* ifdef HAVE_GNUTLS */
|
||||||
/* Openssl private declarations */
|
/* Openssl private declarations */
|
||||||
EVP_PKEY * pkey = NULL;
|
EVP_PKEY *pkey = NULL;
|
||||||
X509 * cert = NULL;
|
X509 *cert = NULL;
|
||||||
|
|
||||||
/* Load the X509 certificate in memory. */
|
/* Load the X509 certificate in memory. */
|
||||||
fp = fopen(certificate_file, "r");
|
fp = fopen(certificate_file, "r");
|
||||||
|
@ -284,7 +284,7 @@ on_error:
|
||||||
} /* eet_identity_open */
|
} /* eet_identity_open */
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
eet_identity_close(Eet_Key * key)
|
eet_identity_close(Eet_Key *key)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_SIGNATURE
|
#ifdef HAVE_SIGNATURE
|
||||||
if (!key || (key->references > 0))
|
if (!key || (key->references > 0))
|
||||||
|
@ -302,12 +302,12 @@ eet_identity_close(Eet_Key * key)
|
||||||
} /* eet_identity_close */
|
} /* eet_identity_close */
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
eet_identity_print(Eet_Key * key,
|
eet_identity_print(Eet_Key *key,
|
||||||
FILE * out)
|
FILE * out)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_SIGNATURE
|
#ifdef HAVE_SIGNATURE
|
||||||
# ifdef HAVE_GNUTLS
|
# ifdef HAVE_GNUTLS
|
||||||
const char * names[6] = {
|
const char *names[6] = {
|
||||||
"Modulus",
|
"Modulus",
|
||||||
"Public exponent",
|
"Public exponent",
|
||||||
"Private exponent",
|
"Private exponent",
|
||||||
|
@ -319,7 +319,7 @@ eet_identity_print(Eet_Key * key,
|
||||||
gnutls_datum_t data = { NULL, 0 };
|
gnutls_datum_t data = { NULL, 0 };
|
||||||
gnutls_datum_t rsa_raw[6];
|
gnutls_datum_t rsa_raw[6];
|
||||||
size_t size = 128;
|
size_t size = 128;
|
||||||
char * res = NULL;
|
char *res = NULL;
|
||||||
char buf[33];
|
char buf[33];
|
||||||
unsigned int i, j;
|
unsigned int i, j;
|
||||||
|
|
||||||
|
@ -387,9 +387,9 @@ on_error:
|
||||||
|
|
||||||
return;
|
return;
|
||||||
# else /* ifdef HAVE_GNUTLS */
|
# else /* ifdef HAVE_GNUTLS */
|
||||||
RSA * rsa;
|
RSA *rsa;
|
||||||
DSA * dsa;
|
DSA *dsa;
|
||||||
DH * dh;
|
DH *dh;
|
||||||
|
|
||||||
if (!key)
|
if (!key)
|
||||||
return;
|
return;
|
||||||
|
@ -424,7 +424,7 @@ on_error:
|
||||||
} /* eet_identity_print */
|
} /* eet_identity_print */
|
||||||
|
|
||||||
void
|
void
|
||||||
eet_identity_ref(Eet_Key * key)
|
eet_identity_ref(Eet_Key *key)
|
||||||
{
|
{
|
||||||
if (key == NULL)
|
if (key == NULL)
|
||||||
return;
|
return;
|
||||||
|
@ -433,7 +433,7 @@ eet_identity_ref(Eet_Key * key)
|
||||||
} /* eet_identity_ref */
|
} /* eet_identity_ref */
|
||||||
|
|
||||||
void
|
void
|
||||||
eet_identity_unref(Eet_Key * key)
|
eet_identity_unref(Eet_Key *key)
|
||||||
{
|
{
|
||||||
if (key == NULL)
|
if (key == NULL)
|
||||||
return;
|
return;
|
||||||
|
@ -447,7 +447,7 @@ eet_identity_compute_sha1(const void * data_base,
|
||||||
unsigned int data_length,
|
unsigned int data_length,
|
||||||
int * sha1_length)
|
int * sha1_length)
|
||||||
{
|
{
|
||||||
void * result;
|
void *result;
|
||||||
|
|
||||||
#ifdef HAVE_SIGNATURE
|
#ifdef HAVE_SIGNATURE
|
||||||
# ifdef HAVE_GNUTLS
|
# ifdef HAVE_GNUTLS
|
||||||
|
@ -481,17 +481,17 @@ eet_identity_compute_sha1(const void * data_base,
|
||||||
} /* eet_identity_compute_sha1 */
|
} /* eet_identity_compute_sha1 */
|
||||||
|
|
||||||
Eet_Error
|
Eet_Error
|
||||||
eet_identity_sign(FILE * fp,
|
eet_identity_sign(FILE * fp,
|
||||||
Eet_Key * key)
|
Eet_Key *key)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_SIGNATURE
|
#ifdef HAVE_SIGNATURE
|
||||||
Eet_Error err = EET_ERROR_NONE;
|
Eet_Error err = EET_ERROR_NONE;
|
||||||
struct stat st_buf;
|
struct stat st_buf;
|
||||||
void * data;
|
void *data;
|
||||||
int fd;
|
int fd;
|
||||||
int head[3];
|
int head[3];
|
||||||
unsigned char * sign = NULL;
|
unsigned char *sign = NULL;
|
||||||
unsigned char * cert = NULL;
|
unsigned char *cert = NULL;
|
||||||
# ifdef HAVE_GNUTLS
|
# ifdef HAVE_GNUTLS
|
||||||
gnutls_datum_t datum = { NULL, 0 };
|
gnutls_datum_t datum = { NULL, 0 };
|
||||||
size_t sign_len = 0;
|
size_t sign_len = 0;
|
||||||
|
@ -647,20 +647,20 @@ on_error:
|
||||||
} /* eet_identity_sign */
|
} /* eet_identity_sign */
|
||||||
|
|
||||||
const void *
|
const void *
|
||||||
eet_identity_check(const void * data_base,
|
eet_identity_check(const void * data_base,
|
||||||
unsigned int data_length,
|
unsigned int data_length,
|
||||||
void ** sha1,
|
void ** sha1,
|
||||||
int * sha1_length,
|
int * sha1_length,
|
||||||
const void * signature_base,
|
const void * signature_base,
|
||||||
unsigned int signature_length,
|
unsigned int signature_length,
|
||||||
const void ** raw_signature_base,
|
const void ** raw_signature_base,
|
||||||
unsigned int * raw_signature_length,
|
unsigned int *raw_signature_length,
|
||||||
int * x509_length)
|
int * x509_length)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_SIGNATURE
|
#ifdef HAVE_SIGNATURE
|
||||||
const int * header = signature_base;
|
const int *header = signature_base;
|
||||||
const unsigned char * sign;
|
const unsigned char *sign;
|
||||||
const unsigned char * cert_der;
|
const unsigned char *cert_der;
|
||||||
int sign_len;
|
int sign_len;
|
||||||
int cert_len;
|
int cert_len;
|
||||||
int magic;
|
int magic;
|
||||||
|
@ -690,7 +690,7 @@ eet_identity_check(const void * data_base,
|
||||||
gnutls_datum_t datum;
|
gnutls_datum_t datum;
|
||||||
gnutls_datum_t signature;
|
gnutls_datum_t signature;
|
||||||
# if EET_USE_NEW_GNUTLS_API
|
# if EET_USE_NEW_GNUTLS_API
|
||||||
unsigned char * hash;
|
unsigned char *hash;
|
||||||
gcry_md_hd_t md;
|
gcry_md_hd_t md;
|
||||||
int err;
|
int err;
|
||||||
# endif /* if EET_USE_NEW_GNUTLS_API */
|
# endif /* if EET_USE_NEW_GNUTLS_API */
|
||||||
|
@ -763,9 +763,9 @@ eet_identity_check(const void * data_base,
|
||||||
gnutls_x509_crt_deinit(cert);
|
gnutls_x509_crt_deinit(cert);
|
||||||
|
|
||||||
# else /* ifdef HAVE_GNUTLS */
|
# else /* ifdef HAVE_GNUTLS */
|
||||||
const unsigned char * tmp;
|
const unsigned char *tmp;
|
||||||
EVP_PKEY * pkey;
|
EVP_PKEY *pkey;
|
||||||
X509 * x509;
|
X509 *x509;
|
||||||
EVP_MD_CTX md_ctx;
|
EVP_MD_CTX md_ctx;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
@ -818,9 +818,9 @@ eet_identity_check(const void * data_base,
|
||||||
} /* eet_identity_check */
|
} /* eet_identity_check */
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
eet_identity_certificate_print(const unsigned char * certificate,
|
eet_identity_certificate_print(const unsigned char *certificate,
|
||||||
int der_length,
|
int der_length,
|
||||||
FILE * out)
|
FILE * out)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_SIGNATURE
|
#ifdef HAVE_SIGNATURE
|
||||||
if (!certificate || !out || der_length <= 0)
|
if (!certificate || !out || der_length <= 0)
|
||||||
|
@ -857,8 +857,8 @@ on_error:
|
||||||
|
|
||||||
gnutls_x509_crt_deinit(cert);
|
gnutls_x509_crt_deinit(cert);
|
||||||
# else /* ifdef HAVE_GNUTLS */
|
# else /* ifdef HAVE_GNUTLS */
|
||||||
const unsigned char * tmp;
|
const unsigned char *tmp;
|
||||||
X509 * x509;
|
X509 *x509;
|
||||||
|
|
||||||
/* Strange but d2i_X509 seems to put 0 all over the place. */
|
/* Strange but d2i_X509 seems to put 0 all over the place. */
|
||||||
tmp = alloca(der_length);
|
tmp = alloca(der_length);
|
||||||
|
@ -881,16 +881,16 @@ on_error:
|
||||||
} /* eet_identity_certificate_print */
|
} /* eet_identity_certificate_print */
|
||||||
|
|
||||||
Eet_Error
|
Eet_Error
|
||||||
eet_cipher(const void * data,
|
eet_cipher(const void * data,
|
||||||
unsigned int size,
|
unsigned int size,
|
||||||
const char * key,
|
const char * key,
|
||||||
unsigned int length,
|
unsigned int length,
|
||||||
void ** result,
|
void ** result,
|
||||||
unsigned int * result_length)
|
unsigned int *result_length)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_CIPHER
|
#ifdef HAVE_CIPHER
|
||||||
/* Cipher declarations */
|
/* Cipher declarations */
|
||||||
unsigned int * ret = NULL;
|
unsigned int *ret = NULL;
|
||||||
unsigned char iv[MAX_IV_LEN];
|
unsigned char iv[MAX_IV_LEN];
|
||||||
unsigned char ik[MAX_KEY_LEN];
|
unsigned char ik[MAX_KEY_LEN];
|
||||||
unsigned char key_material[MAX_IV_LEN + MAX_KEY_LEN];
|
unsigned char key_material[MAX_IV_LEN + MAX_KEY_LEN];
|
||||||
|
@ -905,7 +905,7 @@ eet_cipher(const void * data,
|
||||||
# else /* ifdef HAVE_GNUTLS */
|
# else /* ifdef HAVE_GNUTLS */
|
||||||
/* Openssl declarations*/
|
/* Openssl declarations*/
|
||||||
EVP_CIPHER_CTX ctx;
|
EVP_CIPHER_CTX ctx;
|
||||||
unsigned int * buffer;
|
unsigned int *buffer;
|
||||||
int tmp_len;
|
int tmp_len;
|
||||||
# endif /* ifdef HAVE_GNUTLS */
|
# endif /* ifdef HAVE_GNUTLS */
|
||||||
|
|
||||||
|
@ -1058,16 +1058,16 @@ on_error:
|
||||||
} /* eet_cipher */
|
} /* eet_cipher */
|
||||||
|
|
||||||
Eet_Error
|
Eet_Error
|
||||||
eet_decipher(const void * data,
|
eet_decipher(const void * data,
|
||||||
unsigned int size,
|
unsigned int size,
|
||||||
const char * key,
|
const char * key,
|
||||||
unsigned int length,
|
unsigned int length,
|
||||||
void ** result,
|
void ** result,
|
||||||
unsigned int * result_length)
|
unsigned int *result_length)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_CIPHER
|
#ifdef HAVE_CIPHER
|
||||||
const unsigned int * over = data;
|
const unsigned int *over = data;
|
||||||
unsigned int * ret = NULL;
|
unsigned int *ret = NULL;
|
||||||
unsigned char ik[MAX_KEY_LEN];
|
unsigned char ik[MAX_KEY_LEN];
|
||||||
unsigned char iv[MAX_IV_LEN];
|
unsigned char iv[MAX_IV_LEN];
|
||||||
unsigned char key_material[MAX_KEY_LEN + MAX_IV_LEN];
|
unsigned char key_material[MAX_KEY_LEN + MAX_IV_LEN];
|
||||||
|
@ -1211,15 +1211,15 @@ on_error:
|
||||||
#ifdef HAVE_CIPHER
|
#ifdef HAVE_CIPHER
|
||||||
# ifdef HAVE_GNUTLS
|
# ifdef HAVE_GNUTLS
|
||||||
static Eet_Error
|
static Eet_Error
|
||||||
eet_hmac_sha1(const void * key,
|
eet_hmac_sha1(const void * key,
|
||||||
size_t key_len,
|
size_t key_len,
|
||||||
const void * data,
|
const void * data,
|
||||||
size_t data_len,
|
size_t data_len,
|
||||||
unsigned char * res)
|
unsigned char *res)
|
||||||
{
|
{
|
||||||
size_t hlen = gcry_md_get_algo_dlen (GCRY_MD_SHA1);
|
size_t hlen = gcry_md_get_algo_dlen (GCRY_MD_SHA1);
|
||||||
gcry_md_hd_t mdh;
|
gcry_md_hd_t mdh;
|
||||||
unsigned char * hash;
|
unsigned char *hash;
|
||||||
gpg_error_t err;
|
gpg_error_t err;
|
||||||
|
|
||||||
err = gcry_md_open(&mdh, GCRY_MD_SHA1, GCRY_MD_FLAG_HMAC);
|
err = gcry_md_open(&mdh, GCRY_MD_SHA1, GCRY_MD_FLAG_HMAC);
|
||||||
|
@ -1252,18 +1252,18 @@ eet_hmac_sha1(const void * key,
|
||||||
# endif /* ifdef HAVE_GNUTLS */
|
# endif /* ifdef HAVE_GNUTLS */
|
||||||
|
|
||||||
static Eet_Error
|
static Eet_Error
|
||||||
eet_pbkdf2_sha1(const char * key,
|
eet_pbkdf2_sha1(const char * key,
|
||||||
int key_len,
|
int key_len,
|
||||||
const unsigned char * salt,
|
const unsigned char *salt,
|
||||||
unsigned int salt_len,
|
unsigned int salt_len,
|
||||||
int iter,
|
int iter,
|
||||||
unsigned char * res,
|
unsigned char * res,
|
||||||
int res_len)
|
int res_len)
|
||||||
{
|
{
|
||||||
unsigned char digest[20];
|
unsigned char digest[20];
|
||||||
unsigned char tab[4];
|
unsigned char tab[4];
|
||||||
unsigned char * p = res;
|
unsigned char *p = res;
|
||||||
unsigned char * buf;
|
unsigned char *buf;
|
||||||
unsigned long i;
|
unsigned long i;
|
||||||
int digest_len = 20;
|
int digest_len = 20;
|
||||||
int len = res_len;
|
int len = res_len;
|
||||||
|
|
|
@ -50,23 +50,23 @@ struct _Eet_Message
|
||||||
|
|
||||||
struct _Eet_Connection
|
struct _Eet_Connection
|
||||||
{
|
{
|
||||||
Eet_Read_Cb * eet_read_cb;
|
Eet_Read_Cb * eet_read_cb;
|
||||||
Eet_Write_Cb * eet_write_cb;
|
Eet_Write_Cb *eet_write_cb;
|
||||||
void * user_data;
|
void * user_data;
|
||||||
|
|
||||||
size_t allocated;
|
size_t allocated;
|
||||||
size_t size;
|
size_t size;
|
||||||
size_t received;
|
size_t received;
|
||||||
|
|
||||||
void * buffer;
|
void * buffer;
|
||||||
};
|
};
|
||||||
|
|
||||||
EAPI Eet_Connection *
|
EAPI Eet_Connection *
|
||||||
eet_connection_new(Eet_Read_Cb * eet_read_cb,
|
eet_connection_new(Eet_Read_Cb * eet_read_cb,
|
||||||
Eet_Write_Cb * eet_write_cb,
|
Eet_Write_Cb *eet_write_cb,
|
||||||
const void * user_data)
|
const void * user_data)
|
||||||
{
|
{
|
||||||
Eet_Connection * conn;
|
Eet_Connection *conn;
|
||||||
|
|
||||||
if (!eet_read_cb || !eet_write_cb)
|
if (!eet_read_cb || !eet_write_cb)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -83,9 +83,9 @@ eet_connection_new(Eet_Read_Cb * eet_read_cb,
|
||||||
} /* eet_connection_new */
|
} /* eet_connection_new */
|
||||||
|
|
||||||
EAPI int
|
EAPI int
|
||||||
eet_connection_received(Eet_Connection * conn,
|
eet_connection_received(Eet_Connection *conn,
|
||||||
const void * data,
|
const void * data,
|
||||||
size_t size)
|
size_t size)
|
||||||
{
|
{
|
||||||
if ((!conn) || (!data) || (!size))
|
if ((!conn) || (!data) || (!size))
|
||||||
return size;
|
return size;
|
||||||
|
@ -95,7 +95,7 @@ eet_connection_received(Eet_Connection * conn,
|
||||||
|
|
||||||
if (conn->size == 0)
|
if (conn->size == 0)
|
||||||
{
|
{
|
||||||
const Eet_Message * msg;
|
const Eet_Message *msg;
|
||||||
size_t packet_size;
|
size_t packet_size;
|
||||||
|
|
||||||
if (size < sizeof (Eet_Message))
|
if (size < sizeof (Eet_Message))
|
||||||
|
@ -129,7 +129,7 @@ eet_connection_received(Eet_Connection * conn,
|
||||||
conn->size = packet_size;
|
conn->size = packet_size;
|
||||||
if (conn->allocated < conn->size)
|
if (conn->allocated < conn->size)
|
||||||
{
|
{
|
||||||
void * tmp;
|
void *tmp;
|
||||||
|
|
||||||
tmp = realloc(conn->buffer, conn->size);
|
tmp = realloc(conn->buffer, conn->size);
|
||||||
if (!tmp)
|
if (!tmp)
|
||||||
|
@ -172,11 +172,11 @@ eet_connection_received(Eet_Connection * conn,
|
||||||
} /* eet_connection_received */
|
} /* eet_connection_received */
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
_eet_connection_raw_send(Eet_Connection * conn,
|
_eet_connection_raw_send(Eet_Connection *conn,
|
||||||
void * data,
|
void * data,
|
||||||
int data_size)
|
int data_size)
|
||||||
{
|
{
|
||||||
Eet_Message * message;
|
Eet_Message *message;
|
||||||
|
|
||||||
/* Message should never be above 64K */
|
/* Message should never be above 64K */
|
||||||
if (data_size > 64 * 1024)
|
if (data_size > 64 * 1024)
|
||||||
|
@ -195,12 +195,12 @@ _eet_connection_raw_send(Eet_Connection * conn,
|
||||||
} /* _eet_connection_raw_send */
|
} /* _eet_connection_raw_send */
|
||||||
|
|
||||||
EAPI Eina_Bool
|
EAPI Eina_Bool
|
||||||
eet_connection_send(Eet_Connection * conn,
|
eet_connection_send(Eet_Connection * conn,
|
||||||
Eet_Data_Descriptor * edd,
|
Eet_Data_Descriptor *edd,
|
||||||
const void * data_in,
|
const void * data_in,
|
||||||
const char * cipher_key)
|
const char * cipher_key)
|
||||||
{
|
{
|
||||||
void * flat_data;
|
void *flat_data;
|
||||||
int data_size;
|
int data_size;
|
||||||
Eina_Bool ret = EINA_FALSE;
|
Eina_Bool ret = EINA_FALSE;
|
||||||
|
|
||||||
|
@ -219,11 +219,11 @@ eet_connection_send(Eet_Connection * conn,
|
||||||
} /* eet_connection_send */
|
} /* eet_connection_send */
|
||||||
|
|
||||||
EAPI Eina_Bool
|
EAPI Eina_Bool
|
||||||
eet_connection_node_send(Eet_Connection * conn,
|
eet_connection_node_send(Eet_Connection *conn,
|
||||||
Eet_Node * node,
|
Eet_Node * node,
|
||||||
const char * cipher_key)
|
const char * cipher_key)
|
||||||
{
|
{
|
||||||
void * data;
|
void *data;
|
||||||
int data_size;
|
int data_size;
|
||||||
Eina_Bool ret = EINA_FALSE;
|
Eina_Bool ret = EINA_FALSE;
|
||||||
|
|
||||||
|
@ -239,10 +239,10 @@ eet_connection_node_send(Eet_Connection * conn,
|
||||||
} /* eet_connection_node_send */
|
} /* eet_connection_node_send */
|
||||||
|
|
||||||
EAPI void *
|
EAPI void *
|
||||||
eet_connection_close(Eet_Connection * conn,
|
eet_connection_close(Eet_Connection *conn,
|
||||||
Eina_Bool * on_going)
|
Eina_Bool * on_going)
|
||||||
{
|
{
|
||||||
void * user_data;
|
void *user_data;
|
||||||
|
|
||||||
if (!conn)
|
if (!conn)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -18,7 +18,7 @@
|
||||||
Eet_Dictionary *
|
Eet_Dictionary *
|
||||||
eet_dictionary_add(void)
|
eet_dictionary_add(void)
|
||||||
{
|
{
|
||||||
Eet_Dictionary * new;
|
Eet_Dictionary *new;
|
||||||
|
|
||||||
new = calloc(1, sizeof (Eet_Dictionary));
|
new = calloc(1, sizeof (Eet_Dictionary));
|
||||||
if (!new)
|
if (!new)
|
||||||
|
@ -30,7 +30,7 @@ eet_dictionary_add(void)
|
||||||
} /* eet_dictionary_add */
|
} /* eet_dictionary_add */
|
||||||
|
|
||||||
void
|
void
|
||||||
eet_dictionary_free(Eet_Dictionary * ed)
|
eet_dictionary_free(Eet_Dictionary *ed)
|
||||||
{
|
{
|
||||||
if (ed)
|
if (ed)
|
||||||
{
|
{
|
||||||
|
@ -48,9 +48,9 @@ eet_dictionary_free(Eet_Dictionary * ed)
|
||||||
} /* eet_dictionary_free */
|
} /* eet_dictionary_free */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_eet_dictionary_lookup(Eet_Dictionary * ed,
|
_eet_dictionary_lookup(Eet_Dictionary *ed,
|
||||||
const char * string,
|
const char * string,
|
||||||
int hash)
|
int hash)
|
||||||
{
|
{
|
||||||
int prev = -1;
|
int prev = -1;
|
||||||
int current;
|
int current;
|
||||||
|
@ -78,11 +78,11 @@ _eet_dictionary_lookup(Eet_Dictionary * ed,
|
||||||
} /* _eet_dictionary_lookup */
|
} /* _eet_dictionary_lookup */
|
||||||
|
|
||||||
int
|
int
|
||||||
eet_dictionary_string_add(Eet_Dictionary * ed,
|
eet_dictionary_string_add(Eet_Dictionary *ed,
|
||||||
const char * string)
|
const char * string)
|
||||||
{
|
{
|
||||||
Eet_String * current;
|
Eet_String *current;
|
||||||
char * str;
|
char *str;
|
||||||
int hash;
|
int hash;
|
||||||
int idx;
|
int idx;
|
||||||
int len;
|
int len;
|
||||||
|
@ -108,7 +108,7 @@ eet_dictionary_string_add(Eet_Dictionary * ed,
|
||||||
|
|
||||||
if (ed->total == ed->count)
|
if (ed->total == ed->count)
|
||||||
{
|
{
|
||||||
Eet_String * new;
|
Eet_String *new;
|
||||||
int total;
|
int total;
|
||||||
|
|
||||||
total = ed->total + 8;
|
total = ed->total + 8;
|
||||||
|
@ -160,8 +160,8 @@ eet_dictionary_string_add(Eet_Dictionary * ed,
|
||||||
} /* eet_dictionary_string_add */
|
} /* eet_dictionary_string_add */
|
||||||
|
|
||||||
int
|
int
|
||||||
eet_dictionary_string_get_size(const Eet_Dictionary * ed,
|
eet_dictionary_string_get_size(const Eet_Dictionary *ed,
|
||||||
int idx)
|
int idx)
|
||||||
{
|
{
|
||||||
if (!ed)
|
if (!ed)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -176,8 +176,8 @@ eet_dictionary_string_get_size(const Eet_Dictionary * ed,
|
||||||
} /* eet_dictionary_string_get_size */
|
} /* eet_dictionary_string_get_size */
|
||||||
|
|
||||||
int
|
int
|
||||||
eet_dictionary_string_get_hash(const Eet_Dictionary * ed,
|
eet_dictionary_string_get_hash(const Eet_Dictionary *ed,
|
||||||
int idx)
|
int idx)
|
||||||
{
|
{
|
||||||
if (!ed)
|
if (!ed)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -192,8 +192,8 @@ eet_dictionary_string_get_hash(const Eet_Dictionary * ed,
|
||||||
} /* eet_dictionary_string_get_hash */
|
} /* eet_dictionary_string_get_hash */
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
eet_dictionary_string_get_char(const Eet_Dictionary * ed,
|
eet_dictionary_string_get_char(const Eet_Dictionary *ed,
|
||||||
int idx)
|
int idx)
|
||||||
{
|
{
|
||||||
if (!ed)
|
if (!ed)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -223,10 +223,10 @@ eet_dictionary_string_get_char(const Eet_Dictionary * ed,
|
||||||
} /* eet_dictionary_string_get_char */
|
} /* eet_dictionary_string_get_char */
|
||||||
|
|
||||||
static inline Eina_Bool
|
static inline Eina_Bool
|
||||||
_eet_dictionary_string_get_me_cache(const char * s,
|
_eet_dictionary_string_get_me_cache(const char *s,
|
||||||
int len,
|
int len,
|
||||||
int * mantisse,
|
int * mantisse,
|
||||||
int * exponent)
|
int * exponent)
|
||||||
{
|
{
|
||||||
if ((len == 6) && (s[0] == '0') && (s[1] == 'x') && (s[3] == 'p'))
|
if ((len == 6) && (s[0] == '0') && (s[1] == 'x') && (s[3] == 'p'))
|
||||||
{
|
{
|
||||||
|
@ -240,9 +240,9 @@ _eet_dictionary_string_get_me_cache(const char * s,
|
||||||
} /* _eet_dictionary_string_get_me_cache */
|
} /* _eet_dictionary_string_get_me_cache */
|
||||||
|
|
||||||
static inline Eina_Bool
|
static inline Eina_Bool
|
||||||
_eet_dictionary_string_get_float_cache(const char * s,
|
_eet_dictionary_string_get_float_cache(const char *s,
|
||||||
int len,
|
int len,
|
||||||
float * result)
|
float * result)
|
||||||
{
|
{
|
||||||
int mantisse;
|
int mantisse;
|
||||||
int exponent;
|
int exponent;
|
||||||
|
@ -261,9 +261,9 @@ _eet_dictionary_string_get_float_cache(const char * s,
|
||||||
} /* _eet_dictionary_string_get_float_cache */
|
} /* _eet_dictionary_string_get_float_cache */
|
||||||
|
|
||||||
static inline Eina_Bool
|
static inline Eina_Bool
|
||||||
_eet_dictionary_string_get_double_cache(const char * s,
|
_eet_dictionary_string_get_double_cache(const char *s,
|
||||||
int len,
|
int len,
|
||||||
double * result)
|
double * result)
|
||||||
{
|
{
|
||||||
int mantisse;
|
int mantisse;
|
||||||
int exponent;
|
int exponent;
|
||||||
|
@ -282,9 +282,9 @@ _eet_dictionary_string_get_double_cache(const char * s,
|
||||||
} /* _eet_dictionary_string_get_double_cache */
|
} /* _eet_dictionary_string_get_double_cache */
|
||||||
|
|
||||||
static inline Eina_Bool
|
static inline Eina_Bool
|
||||||
_eet_dictionary_test(const Eet_Dictionary * ed,
|
_eet_dictionary_test(const Eet_Dictionary *ed,
|
||||||
int idx,
|
int idx,
|
||||||
void * result)
|
void * result)
|
||||||
{
|
{
|
||||||
if (!result)
|
if (!result)
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
|
@ -302,16 +302,16 @@ _eet_dictionary_test(const Eet_Dictionary * ed,
|
||||||
} /* _eet_dictionary_test */
|
} /* _eet_dictionary_test */
|
||||||
|
|
||||||
Eina_Bool
|
Eina_Bool
|
||||||
eet_dictionary_string_get_float(const Eet_Dictionary * ed,
|
eet_dictionary_string_get_float(const Eet_Dictionary *ed,
|
||||||
int idx,
|
int idx,
|
||||||
float * result)
|
float * result)
|
||||||
{
|
{
|
||||||
if (!_eet_dictionary_test(ed, idx, result))
|
if (!_eet_dictionary_test(ed, idx, result))
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
|
|
||||||
if (!(ed->all[idx].type & EET_D_FLOAT))
|
if (!(ed->all[idx].type & EET_D_FLOAT))
|
||||||
{
|
{
|
||||||
const char * str;
|
const char *str;
|
||||||
|
|
||||||
str = ed->all[idx].str ? ed->all[idx].str : ed->all[idx].mmap;
|
str = ed->all[idx].str ? ed->all[idx].str : ed->all[idx].mmap;
|
||||||
|
|
||||||
|
@ -336,16 +336,16 @@ eet_dictionary_string_get_float(const Eet_Dictionary * ed,
|
||||||
} /* eet_dictionary_string_get_float */
|
} /* eet_dictionary_string_get_float */
|
||||||
|
|
||||||
Eina_Bool
|
Eina_Bool
|
||||||
eet_dictionary_string_get_double(const Eet_Dictionary * ed,
|
eet_dictionary_string_get_double(const Eet_Dictionary *ed,
|
||||||
int idx,
|
int idx,
|
||||||
double * result)
|
double * result)
|
||||||
{
|
{
|
||||||
if (!_eet_dictionary_test(ed, idx, result))
|
if (!_eet_dictionary_test(ed, idx, result))
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
|
|
||||||
if (!(ed->all[idx].type & EET_D_DOUBLE))
|
if (!(ed->all[idx].type & EET_D_DOUBLE))
|
||||||
{
|
{
|
||||||
const char * str;
|
const char *str;
|
||||||
|
|
||||||
str = ed->all[idx].str ? ed->all[idx].str : ed->all[idx].mmap;
|
str = ed->all[idx].str ? ed->all[idx].str : ed->all[idx].mmap;
|
||||||
|
|
||||||
|
@ -370,16 +370,16 @@ eet_dictionary_string_get_double(const Eet_Dictionary * ed,
|
||||||
} /* eet_dictionary_string_get_double */
|
} /* eet_dictionary_string_get_double */
|
||||||
|
|
||||||
Eina_Bool
|
Eina_Bool
|
||||||
eet_dictionary_string_get_fp(const Eet_Dictionary * ed,
|
eet_dictionary_string_get_fp(const Eet_Dictionary *ed,
|
||||||
int idx,
|
int idx,
|
||||||
Eina_F32p32 * result)
|
Eina_F32p32 * result)
|
||||||
{
|
{
|
||||||
if (!_eet_dictionary_test(ed, idx, result))
|
if (!_eet_dictionary_test(ed, idx, result))
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
|
|
||||||
if (!(ed->all[idx].type & EET_D_FIXED_POINT))
|
if (!(ed->all[idx].type & EET_D_FIXED_POINT))
|
||||||
{
|
{
|
||||||
const char * str;
|
const char *str;
|
||||||
Eina_F32p32 fp;
|
Eina_F32p32 fp;
|
||||||
|
|
||||||
str = ed->all[idx].str ? ed->all[idx].str : ed->all[idx].mmap;
|
str = ed->all[idx].str ? ed->all[idx].str : ed->all[idx].mmap;
|
||||||
|
@ -396,8 +396,8 @@ eet_dictionary_string_get_fp(const Eet_Dictionary * ed,
|
||||||
} /* eet_dictionary_string_get_fp */
|
} /* eet_dictionary_string_get_fp */
|
||||||
|
|
||||||
EAPI int
|
EAPI int
|
||||||
eet_dictionary_string_check(Eet_Dictionary * ed,
|
eet_dictionary_string_check(Eet_Dictionary *ed,
|
||||||
const char * string)
|
const char * string)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ static boolean
|
||||||
_eet_jpeg_membuf_src_fill(j_decompress_ptr cinfo)
|
_eet_jpeg_membuf_src_fill(j_decompress_ptr cinfo)
|
||||||
{
|
{
|
||||||
static const JOCTET jpeg_eoi[2] = { 0xFF, JPEG_EOI };
|
static const JOCTET jpeg_eoi[2] = { 0xFF, JPEG_EOI };
|
||||||
struct jpeg_membuf_src * src = (struct jpeg_membuf_src *)cinfo->src;
|
struct jpeg_membuf_src *src = (struct jpeg_membuf_src *)cinfo->src;
|
||||||
|
|
||||||
src->pub.bytes_in_buffer = sizeof(jpeg_eoi);
|
src->pub.bytes_in_buffer = sizeof(jpeg_eoi);
|
||||||
src->pub.next_input_byte = jpeg_eoi;
|
src->pub.next_input_byte = jpeg_eoi;
|
||||||
|
@ -86,7 +86,7 @@ static void
|
||||||
_eet_jpeg_membuf_src_skip(j_decompress_ptr cinfo,
|
_eet_jpeg_membuf_src_skip(j_decompress_ptr cinfo,
|
||||||
long num_bytes)
|
long num_bytes)
|
||||||
{
|
{
|
||||||
struct jpeg_membuf_src * src = (struct jpeg_membuf_src *)cinfo->src;
|
struct jpeg_membuf_src *src = (struct jpeg_membuf_src *)cinfo->src;
|
||||||
|
|
||||||
src->pub.bytes_in_buffer -= num_bytes;
|
src->pub.bytes_in_buffer -= num_bytes;
|
||||||
src->pub.next_input_byte += num_bytes;
|
src->pub.next_input_byte += num_bytes;
|
||||||
|
@ -104,7 +104,7 @@ eet_jpeg_membuf_src(j_decompress_ptr cinfo,
|
||||||
const void * buf,
|
const void * buf,
|
||||||
size_t len)
|
size_t len)
|
||||||
{
|
{
|
||||||
struct jpeg_membuf_src * src;
|
struct jpeg_membuf_src *src;
|
||||||
|
|
||||||
src = malloc(sizeof(*src));
|
src = malloc(sizeof(*src));
|
||||||
if (!src)
|
if (!src)
|
||||||
|
@ -146,8 +146,8 @@ _eet_jpeg_membuf_dst_init(j_compress_ptr cinfo)
|
||||||
static boolean
|
static boolean
|
||||||
_eet_jpeg_membuf_dst_flush(j_compress_ptr cinfo)
|
_eet_jpeg_membuf_dst_flush(j_compress_ptr cinfo)
|
||||||
{
|
{
|
||||||
struct jpeg_membuf_dst * dst = (struct jpeg_membuf_dst *)cinfo->dest;
|
struct jpeg_membuf_dst *dst = (struct jpeg_membuf_dst *)cinfo->dest;
|
||||||
unsigned char * buf;
|
unsigned char *buf;
|
||||||
|
|
||||||
if (dst->len >= 0x40000000 ||
|
if (dst->len >= 0x40000000 ||
|
||||||
(buf = realloc(dst->buf, dst->len * 2)) == NULL)
|
(buf = realloc(dst->buf, dst->len * 2)) == NULL)
|
||||||
|
@ -170,7 +170,7 @@ _eet_jpeg_membuf_dst_flush(j_compress_ptr cinfo)
|
||||||
static void
|
static void
|
||||||
_eet_jpeg_membuf_dst_term(j_compress_ptr cinfo)
|
_eet_jpeg_membuf_dst_term(j_compress_ptr cinfo)
|
||||||
{
|
{
|
||||||
struct jpeg_membuf_dst * dst = (struct jpeg_membuf_dst *)cinfo->dest;
|
struct jpeg_membuf_dst *dst = (struct jpeg_membuf_dst *)cinfo->dest;
|
||||||
|
|
||||||
if (dst->failed)
|
if (dst->failed)
|
||||||
{
|
{
|
||||||
|
@ -193,7 +193,7 @@ eet_jpeg_membuf_dst(j_compress_ptr cinfo,
|
||||||
void ** buf,
|
void ** buf,
|
||||||
size_t * len)
|
size_t * len)
|
||||||
{
|
{
|
||||||
struct jpeg_membuf_dst * dst;
|
struct jpeg_membuf_dst *dst;
|
||||||
|
|
||||||
dst = malloc(sizeof(*dst));
|
dst = malloc(sizeof(*dst));
|
||||||
if (!dst)
|
if (!dst)
|
||||||
|
@ -228,26 +228,26 @@ static void _JPEGErrorHandler(j_common_ptr cinfo);
|
||||||
static void _JPEGErrorHandler2(j_common_ptr cinfo,
|
static void _JPEGErrorHandler2(j_common_ptr cinfo,
|
||||||
int msg_level);
|
int msg_level);
|
||||||
|
|
||||||
static int eet_data_image_jpeg_header_decode(const void * data,
|
static int eet_data_image_jpeg_header_decode(const void * data,
|
||||||
int size,
|
int size,
|
||||||
unsigned int * w,
|
unsigned int *w,
|
||||||
unsigned int * h);
|
unsigned int *h);
|
||||||
static int eet_data_image_jpeg_rgb_decode(const void * data,
|
static int eet_data_image_jpeg_rgb_decode(const void * data,
|
||||||
int size,
|
int size,
|
||||||
unsigned int src_x,
|
unsigned int src_x,
|
||||||
unsigned int src_y,
|
unsigned int src_y,
|
||||||
unsigned int * d,
|
unsigned int *d,
|
||||||
unsigned int w,
|
unsigned int w,
|
||||||
unsigned int h,
|
unsigned int h,
|
||||||
unsigned int row_stride);
|
unsigned int row_stride);
|
||||||
static void * eet_data_image_jpeg_alpha_decode(const void * data,
|
static void * eet_data_image_jpeg_alpha_decode(const void * data,
|
||||||
int size,
|
int size,
|
||||||
unsigned int src_x,
|
unsigned int src_x,
|
||||||
unsigned int src_y,
|
unsigned int src_y,
|
||||||
unsigned int * d,
|
unsigned int *d,
|
||||||
unsigned int w,
|
unsigned int w,
|
||||||
unsigned int h,
|
unsigned int h,
|
||||||
unsigned int row_stride);
|
unsigned int row_stride);
|
||||||
static void * eet_data_image_lossless_convert(int * size,
|
static void * eet_data_image_lossless_convert(int * size,
|
||||||
const void * data,
|
const void * data,
|
||||||
unsigned int w,
|
unsigned int w,
|
||||||
|
@ -351,10 +351,10 @@ _JPEGErrorHandler2(j_common_ptr cinfo __UNUSED__,
|
||||||
} /* _JPEGErrorHandler2 */
|
} /* _JPEGErrorHandler2 */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
eet_data_image_jpeg_header_decode(const void * data,
|
eet_data_image_jpeg_header_decode(const void * data,
|
||||||
int size,
|
int size,
|
||||||
unsigned int * w,
|
unsigned int *w,
|
||||||
unsigned int * h)
|
unsigned int *h)
|
||||||
{
|
{
|
||||||
struct jpeg_decompress_struct cinfo;
|
struct jpeg_decompress_struct cinfo;
|
||||||
struct _JPEG_error_mgr jerr;
|
struct _JPEG_error_mgr jerr;
|
||||||
|
@ -397,19 +397,19 @@ eet_data_image_jpeg_header_decode(const void * data,
|
||||||
} /* eet_data_image_jpeg_header_decode */
|
} /* eet_data_image_jpeg_header_decode */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
eet_data_image_jpeg_rgb_decode(const void * data,
|
eet_data_image_jpeg_rgb_decode(const void * data,
|
||||||
int size,
|
int size,
|
||||||
unsigned int src_x,
|
unsigned int src_x,
|
||||||
unsigned int src_y,
|
unsigned int src_y,
|
||||||
unsigned int * d,
|
unsigned int *d,
|
||||||
unsigned int w,
|
unsigned int w,
|
||||||
unsigned int h,
|
unsigned int h,
|
||||||
unsigned int row_stride)
|
unsigned int row_stride)
|
||||||
{
|
{
|
||||||
struct jpeg_decompress_struct cinfo;
|
struct jpeg_decompress_struct cinfo;
|
||||||
struct _JPEG_error_mgr jerr;
|
struct _JPEG_error_mgr jerr;
|
||||||
unsigned char * ptr, * line[16], * tdata = NULL;
|
unsigned char *ptr, *line[16], *tdata = NULL;
|
||||||
unsigned int * ptr2, * tmp;
|
unsigned int *ptr2, *tmp;
|
||||||
unsigned int iw, ih;
|
unsigned int iw, ih;
|
||||||
unsigned int x, y, l, scans;
|
unsigned int x, y, l, scans;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
@ -550,19 +550,19 @@ eet_data_image_jpeg_rgb_decode(const void * data,
|
||||||
} /* eet_data_image_jpeg_rgb_decode */
|
} /* eet_data_image_jpeg_rgb_decode */
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
eet_data_image_jpeg_alpha_decode(const void * data,
|
eet_data_image_jpeg_alpha_decode(const void * data,
|
||||||
int size,
|
int size,
|
||||||
unsigned int src_x,
|
unsigned int src_x,
|
||||||
unsigned int src_y,
|
unsigned int src_y,
|
||||||
unsigned int * d,
|
unsigned int *d,
|
||||||
unsigned int w,
|
unsigned int w,
|
||||||
unsigned int h,
|
unsigned int h,
|
||||||
unsigned int row_stride)
|
unsigned int row_stride)
|
||||||
{
|
{
|
||||||
struct jpeg_decompress_struct cinfo;
|
struct jpeg_decompress_struct cinfo;
|
||||||
struct _JPEG_error_mgr jerr;
|
struct _JPEG_error_mgr jerr;
|
||||||
unsigned char * ptr, * line[16], * tdata = NULL;
|
unsigned char *ptr, *line[16], *tdata = NULL;
|
||||||
unsigned int * ptr2, * tmp;
|
unsigned int *ptr2, *tmp;
|
||||||
unsigned int x, y, l, scans;
|
unsigned int x, y, l, scans;
|
||||||
unsigned int i, iw;
|
unsigned int i, iw;
|
||||||
|
|
||||||
|
@ -677,8 +677,8 @@ eet_data_image_lossless_convert(int * size,
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
unsigned char * d;
|
unsigned char *d;
|
||||||
int * header;
|
int *header;
|
||||||
|
|
||||||
d = malloc((w * h * 4) + (8 * 4));
|
d = malloc((w * h * 4) + (8 * 4));
|
||||||
if (!d)
|
if (!d)
|
||||||
|
@ -726,9 +726,9 @@ eet_data_image_lossless_compressed_convert(int * size,
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
unsigned char * d;
|
unsigned char *d;
|
||||||
unsigned char * comp;
|
unsigned char *comp;
|
||||||
int * header;
|
int *header;
|
||||||
int ret;
|
int ret;
|
||||||
uLongf buflen;
|
uLongf buflen;
|
||||||
|
|
||||||
|
@ -790,11 +790,11 @@ eet_data_image_jpeg_convert(int * size,
|
||||||
{
|
{
|
||||||
struct jpeg_compress_struct cinfo;
|
struct jpeg_compress_struct cinfo;
|
||||||
struct _JPEG_error_mgr jerr;
|
struct _JPEG_error_mgr jerr;
|
||||||
const int * ptr;
|
const int *ptr;
|
||||||
void * d = NULL;
|
void *d = NULL;
|
||||||
size_t sz = 0;
|
size_t sz = 0;
|
||||||
JSAMPROW * jbuf;
|
JSAMPROW *jbuf;
|
||||||
unsigned char * buf;
|
unsigned char *buf;
|
||||||
|
|
||||||
(void)alpha; /* unused */
|
(void)alpha; /* unused */
|
||||||
|
|
||||||
|
@ -867,9 +867,9 @@ eet_data_image_jpeg_alpha_convert(int * size,
|
||||||
int alpha,
|
int alpha,
|
||||||
int quality)
|
int quality)
|
||||||
{
|
{
|
||||||
unsigned char * d1, * d2;
|
unsigned char *d1, *d2;
|
||||||
unsigned char * d;
|
unsigned char *d;
|
||||||
int * header;
|
int *header;
|
||||||
int sz1, sz2;
|
int sz1, sz2;
|
||||||
|
|
||||||
(void)alpha; /* unused */
|
(void)alpha; /* unused */
|
||||||
|
@ -886,13 +886,13 @@ eet_data_image_jpeg_alpha_convert(int * size,
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
const int * ptr;
|
const int *ptr;
|
||||||
void * dst = NULL;
|
void *dst = NULL;
|
||||||
size_t sz = 0;
|
size_t sz = 0;
|
||||||
struct _JPEG_error_mgr jerr;
|
struct _JPEG_error_mgr jerr;
|
||||||
JSAMPROW * jbuf;
|
JSAMPROW *jbuf;
|
||||||
struct jpeg_compress_struct cinfo;
|
struct jpeg_compress_struct cinfo;
|
||||||
unsigned char * buf;
|
unsigned char *buf;
|
||||||
|
|
||||||
buf = alloca(3 * w);
|
buf = alloca(3 * w);
|
||||||
|
|
||||||
|
@ -952,13 +952,13 @@ eet_data_image_jpeg_alpha_convert(int * size,
|
||||||
sz1 = sz;
|
sz1 = sz;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
const int * ptr;
|
const int *ptr;
|
||||||
void * dst = NULL;
|
void *dst = NULL;
|
||||||
size_t sz = 0;
|
size_t sz = 0;
|
||||||
struct _JPEG_error_mgr jerr;
|
struct _JPEG_error_mgr jerr;
|
||||||
JSAMPROW * jbuf;
|
JSAMPROW *jbuf;
|
||||||
struct jpeg_compress_struct cinfo;
|
struct jpeg_compress_struct cinfo;
|
||||||
unsigned char * buf;
|
unsigned char *buf;
|
||||||
|
|
||||||
buf = alloca(3 * w);
|
buf = alloca(3 * w);
|
||||||
|
|
||||||
|
@ -1059,7 +1059,7 @@ eet_data_image_write_cipher(Eet_File * ef,
|
||||||
int quality,
|
int quality,
|
||||||
int lossy)
|
int lossy)
|
||||||
{
|
{
|
||||||
void * d = NULL;
|
void *d = NULL;
|
||||||
int size = 0;
|
int size = 0;
|
||||||
|
|
||||||
d = eet_data_image_encode(data, &size, w, h, alpha, comp, quality, lossy);
|
d = eet_data_image_encode(data, &size, w, h, alpha, comp, quality, lossy);
|
||||||
|
@ -1099,18 +1099,18 @@ eet_data_image_write(Eet_File * ef,
|
||||||
} /* eet_data_image_write */
|
} /* eet_data_image_write */
|
||||||
|
|
||||||
EAPI void *
|
EAPI void *
|
||||||
eet_data_image_read_cipher(Eet_File * ef,
|
eet_data_image_read_cipher(Eet_File * ef,
|
||||||
const char * name,
|
const char * name,
|
||||||
const char * cipher_key,
|
const char * cipher_key,
|
||||||
unsigned int * w,
|
unsigned int *w,
|
||||||
unsigned int * h,
|
unsigned int *h,
|
||||||
int * alpha,
|
int * alpha,
|
||||||
int * comp,
|
int * comp,
|
||||||
int * quality,
|
int * quality,
|
||||||
int * lossy)
|
int * lossy)
|
||||||
{
|
{
|
||||||
unsigned int * d = NULL;
|
unsigned int *d = NULL;
|
||||||
void * data = NULL;
|
void *data = NULL;
|
||||||
int free_data = 0;
|
int free_data = 0;
|
||||||
int size;
|
int size;
|
||||||
|
|
||||||
|
@ -1134,35 +1134,35 @@ eet_data_image_read_cipher(Eet_File * ef,
|
||||||
} /* eet_data_image_read_cipher */
|
} /* eet_data_image_read_cipher */
|
||||||
|
|
||||||
EAPI void *
|
EAPI void *
|
||||||
eet_data_image_read(Eet_File * ef,
|
eet_data_image_read(Eet_File * ef,
|
||||||
const char * name,
|
const char * name,
|
||||||
unsigned int * w,
|
unsigned int *w,
|
||||||
unsigned int * h,
|
unsigned int *h,
|
||||||
int * alpha,
|
int * alpha,
|
||||||
int * comp,
|
int * comp,
|
||||||
int * quality,
|
int * quality,
|
||||||
int * lossy)
|
int * lossy)
|
||||||
{
|
{
|
||||||
return eet_data_image_read_cipher(ef, name, NULL, w, h, alpha,
|
return eet_data_image_read_cipher(ef, name, NULL, w, h, alpha,
|
||||||
comp, quality, lossy);
|
comp, quality, lossy);
|
||||||
} /* eet_data_image_read */
|
} /* eet_data_image_read */
|
||||||
|
|
||||||
EAPI int
|
EAPI int
|
||||||
eet_data_image_read_to_surface_cipher(Eet_File * ef,
|
eet_data_image_read_to_surface_cipher(Eet_File * ef,
|
||||||
const char * name,
|
const char * name,
|
||||||
const char * cipher_key,
|
const char * cipher_key,
|
||||||
unsigned int src_x,
|
unsigned int src_x,
|
||||||
unsigned int src_y,
|
unsigned int src_y,
|
||||||
unsigned int * d,
|
unsigned int *d,
|
||||||
unsigned int w,
|
unsigned int w,
|
||||||
unsigned int h,
|
unsigned int h,
|
||||||
unsigned int row_stride,
|
unsigned int row_stride,
|
||||||
int * alpha,
|
int * alpha,
|
||||||
int * comp,
|
int * comp,
|
||||||
int * quality,
|
int * quality,
|
||||||
int * lossy)
|
int * lossy)
|
||||||
{
|
{
|
||||||
void * data = NULL;
|
void *data = NULL;
|
||||||
int free_data = 0;
|
int free_data = 0;
|
||||||
int res = 1;
|
int res = 1;
|
||||||
int size;
|
int size;
|
||||||
|
@ -1189,18 +1189,18 @@ eet_data_image_read_to_surface_cipher(Eet_File * ef,
|
||||||
} /* eet_data_image_read_to_surface_cipher */
|
} /* eet_data_image_read_to_surface_cipher */
|
||||||
|
|
||||||
EAPI int
|
EAPI int
|
||||||
eet_data_image_read_to_surface(Eet_File * ef,
|
eet_data_image_read_to_surface(Eet_File * ef,
|
||||||
const char * name,
|
const char * name,
|
||||||
unsigned int src_x,
|
unsigned int src_x,
|
||||||
unsigned int src_y,
|
unsigned int src_y,
|
||||||
unsigned int * d,
|
unsigned int *d,
|
||||||
unsigned int w,
|
unsigned int w,
|
||||||
unsigned int h,
|
unsigned int h,
|
||||||
unsigned int row_stride,
|
unsigned int row_stride,
|
||||||
int * alpha,
|
int * alpha,
|
||||||
int * comp,
|
int * comp,
|
||||||
int * quality,
|
int * quality,
|
||||||
int * lossy)
|
int * lossy)
|
||||||
{
|
{
|
||||||
return eet_data_image_read_to_surface_cipher(ef, name, NULL,
|
return eet_data_image_read_to_surface_cipher(ef, name, NULL,
|
||||||
src_x, src_y, d,
|
src_x, src_y, d,
|
||||||
|
@ -1210,17 +1210,17 @@ eet_data_image_read_to_surface(Eet_File * ef,
|
||||||
} /* eet_data_image_read_to_surface */
|
} /* eet_data_image_read_to_surface */
|
||||||
|
|
||||||
EAPI int
|
EAPI int
|
||||||
eet_data_image_header_read_cipher(Eet_File * ef,
|
eet_data_image_header_read_cipher(Eet_File * ef,
|
||||||
const char * name,
|
const char * name,
|
||||||
const char * cipher_key,
|
const char * cipher_key,
|
||||||
unsigned int * w,
|
unsigned int *w,
|
||||||
unsigned int * h,
|
unsigned int *h,
|
||||||
int * alpha,
|
int * alpha,
|
||||||
int * comp,
|
int * comp,
|
||||||
int * quality,
|
int * quality,
|
||||||
int * lossy)
|
int * lossy)
|
||||||
{
|
{
|
||||||
void * data = NULL;
|
void *data = NULL;
|
||||||
int size = 0;
|
int size = 0;
|
||||||
int free_data = 0;
|
int free_data = 0;
|
||||||
int d;
|
int d;
|
||||||
|
@ -1245,14 +1245,14 @@ eet_data_image_header_read_cipher(Eet_File * ef,
|
||||||
} /* eet_data_image_header_read_cipher */
|
} /* eet_data_image_header_read_cipher */
|
||||||
|
|
||||||
EAPI int
|
EAPI int
|
||||||
eet_data_image_header_read(Eet_File * ef,
|
eet_data_image_header_read(Eet_File * ef,
|
||||||
const char * name,
|
const char * name,
|
||||||
unsigned int * w,
|
unsigned int *w,
|
||||||
unsigned int * h,
|
unsigned int *h,
|
||||||
int * alpha,
|
int * alpha,
|
||||||
int * comp,
|
int * comp,
|
||||||
int * quality,
|
int * quality,
|
||||||
int * lossy)
|
int * lossy)
|
||||||
{
|
{
|
||||||
return eet_data_image_header_read_cipher(ef, name, NULL,
|
return eet_data_image_header_read_cipher(ef, name, NULL,
|
||||||
w, h, alpha,
|
w, h, alpha,
|
||||||
|
@ -1270,8 +1270,8 @@ eet_data_image_encode_cipher(const void * data,
|
||||||
int lossy,
|
int lossy,
|
||||||
int * size_ret)
|
int * size_ret)
|
||||||
{
|
{
|
||||||
void * d = NULL;
|
void *d = NULL;
|
||||||
void * ciphered_d = NULL;
|
void *ciphered_d = NULL;
|
||||||
unsigned int ciphered_sz = 0;
|
unsigned int ciphered_sz = 0;
|
||||||
int size = 0;
|
int size = 0;
|
||||||
|
|
||||||
|
@ -1332,18 +1332,18 @@ eet_data_image_encode(const void * data,
|
||||||
} /* eet_data_image_encode */
|
} /* eet_data_image_encode */
|
||||||
|
|
||||||
EAPI int
|
EAPI int
|
||||||
eet_data_image_header_decode_cipher(const void * data,
|
eet_data_image_header_decode_cipher(const void * data,
|
||||||
const char * cipher_key,
|
const char * cipher_key,
|
||||||
int size,
|
int size,
|
||||||
unsigned int * w,
|
unsigned int *w,
|
||||||
unsigned int * h,
|
unsigned int *h,
|
||||||
int * alpha,
|
int * alpha,
|
||||||
int * comp,
|
int * comp,
|
||||||
int * quality,
|
int * quality,
|
||||||
int * lossy)
|
int * lossy)
|
||||||
{
|
{
|
||||||
int header[8];
|
int header[8];
|
||||||
void * deciphered_d = NULL;
|
void *deciphered_d = NULL;
|
||||||
unsigned int deciphered_sz = 0;
|
unsigned int deciphered_sz = 0;
|
||||||
|
|
||||||
if (cipher_key)
|
if (cipher_key)
|
||||||
|
@ -1418,7 +1418,7 @@ eet_data_image_header_decode_cipher(const void * data,
|
||||||
else if ((unsigned)header[0] == 0xbeeff00d)
|
else if ((unsigned)header[0] == 0xbeeff00d)
|
||||||
{
|
{
|
||||||
unsigned int iw = 0, ih = 0;
|
unsigned int iw = 0, ih = 0;
|
||||||
unsigned const char * dt;
|
unsigned const char *dt;
|
||||||
int sz1;
|
int sz1;
|
||||||
int ok;
|
int ok;
|
||||||
|
|
||||||
|
@ -1484,14 +1484,14 @@ eet_data_image_header_decode_cipher(const void * data,
|
||||||
} /* eet_data_image_header_decode_cipher */
|
} /* eet_data_image_header_decode_cipher */
|
||||||
|
|
||||||
EAPI int
|
EAPI int
|
||||||
eet_data_image_header_decode(const void * data,
|
eet_data_image_header_decode(const void * data,
|
||||||
int size,
|
int size,
|
||||||
unsigned int * w,
|
unsigned int *w,
|
||||||
unsigned int * h,
|
unsigned int *h,
|
||||||
int * alpha,
|
int * alpha,
|
||||||
int * comp,
|
int * comp,
|
||||||
int * quality,
|
int * quality,
|
||||||
int * lossy)
|
int * lossy)
|
||||||
{
|
{
|
||||||
return eet_data_image_header_decode_cipher(data,
|
return eet_data_image_header_decode_cipher(data,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -1505,14 +1505,14 @@ eet_data_image_header_decode(const void * data,
|
||||||
} /* eet_data_image_header_decode */
|
} /* eet_data_image_header_decode */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_eet_data_image_copy_buffer(const unsigned int * src,
|
_eet_data_image_copy_buffer(const unsigned int *src,
|
||||||
unsigned int src_x,
|
unsigned int src_x,
|
||||||
unsigned int src_y,
|
unsigned int src_y,
|
||||||
unsigned int src_w,
|
unsigned int src_w,
|
||||||
unsigned int * dst,
|
unsigned int * dst,
|
||||||
unsigned int w,
|
unsigned int w,
|
||||||
unsigned int h,
|
unsigned int h,
|
||||||
unsigned int row_stride)
|
unsigned int row_stride)
|
||||||
{
|
{
|
||||||
src += src_x + src_y * src_w;
|
src += src_x + src_y * src_w;
|
||||||
|
|
||||||
|
@ -1520,7 +1520,7 @@ _eet_data_image_copy_buffer(const unsigned int * src,
|
||||||
memcpy(dst, src, row_stride * h);
|
memcpy(dst, src, row_stride * h);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
unsigned int * over = dst;
|
unsigned int *over = dst;
|
||||||
unsigned int y;
|
unsigned int y;
|
||||||
|
|
||||||
for (y = 0; y < h; ++y, src += src_w, over += row_stride)
|
for (y = 0; y < h; ++y, src += src_w, over += row_stride)
|
||||||
|
@ -1529,24 +1529,24 @@ _eet_data_image_copy_buffer(const unsigned int * src,
|
||||||
} /* _eet_data_image_copy_buffer */
|
} /* _eet_data_image_copy_buffer */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_eet_data_image_decode_inside(const void * data,
|
_eet_data_image_decode_inside(const void * data,
|
||||||
int size,
|
int size,
|
||||||
unsigned int src_x,
|
unsigned int src_x,
|
||||||
unsigned int src_y,
|
unsigned int src_y,
|
||||||
unsigned int src_w,
|
unsigned int src_w,
|
||||||
unsigned int src_h,
|
unsigned int src_h,
|
||||||
unsigned int * d,
|
unsigned int *d,
|
||||||
unsigned int w,
|
unsigned int w,
|
||||||
unsigned int h,
|
unsigned int h,
|
||||||
unsigned int row_stride,
|
unsigned int row_stride,
|
||||||
int alpha,
|
int alpha,
|
||||||
int comp,
|
int comp,
|
||||||
int quality,
|
int quality,
|
||||||
int lossy)
|
int lossy)
|
||||||
{
|
{
|
||||||
if (lossy == 0 && quality == 100)
|
if (lossy == 0 && quality == 100)
|
||||||
{
|
{
|
||||||
unsigned int * body;
|
unsigned int *body;
|
||||||
|
|
||||||
body = ((unsigned int *)data) + 8;
|
body = ((unsigned int *)data) + 8;
|
||||||
if (!comp)
|
if (!comp)
|
||||||
|
@ -1564,7 +1564,7 @@ _eet_data_image_decode_inside(const void * data,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Bytef * dtmp;
|
Bytef *dtmp;
|
||||||
uLongf dlen = src_w * src_h * 4;
|
uLongf dlen = src_w * src_h * 4;
|
||||||
|
|
||||||
/* FIXME: This could create a huge alloc. So compressed data and tile could not always work. */
|
/* FIXME: This could create a huge alloc. So compressed data and tile could not always work. */
|
||||||
|
@ -1594,7 +1594,7 @@ _eet_data_image_decode_inside(const void * data,
|
||||||
{
|
{
|
||||||
if (alpha)
|
if (alpha)
|
||||||
{
|
{
|
||||||
unsigned const char * dt;
|
unsigned const char *dt;
|
||||||
int header[8];
|
int header[8];
|
||||||
int sz1, sz2;
|
int sz1, sz2;
|
||||||
|
|
||||||
|
@ -1631,20 +1631,20 @@ _eet_data_image_decode_inside(const void * data,
|
||||||
} /* _eet_data_image_decode_inside */
|
} /* _eet_data_image_decode_inside */
|
||||||
|
|
||||||
EAPI void *
|
EAPI void *
|
||||||
eet_data_image_decode_cipher(const void * data,
|
eet_data_image_decode_cipher(const void * data,
|
||||||
const char * cipher_key,
|
const char * cipher_key,
|
||||||
int size,
|
int size,
|
||||||
unsigned int * w,
|
unsigned int *w,
|
||||||
unsigned int * h,
|
unsigned int *h,
|
||||||
int * alpha,
|
int * alpha,
|
||||||
int * comp,
|
int * comp,
|
||||||
int * quality,
|
int * quality,
|
||||||
int * lossy)
|
int * lossy)
|
||||||
{
|
{
|
||||||
unsigned int * d = NULL;
|
unsigned int *d = NULL;
|
||||||
unsigned int iw, ih;
|
unsigned int iw, ih;
|
||||||
int ialpha, icompress, iquality, ilossy;
|
int ialpha, icompress, iquality, ilossy;
|
||||||
void * deciphered_d = NULL;
|
void *deciphered_d = NULL;
|
||||||
unsigned int deciphered_sz = 0;
|
unsigned int deciphered_sz = 0;
|
||||||
|
|
||||||
if (cipher_key)
|
if (cipher_key)
|
||||||
|
@ -1698,37 +1698,37 @@ eet_data_image_decode_cipher(const void * data,
|
||||||
} /* eet_data_image_decode_cipher */
|
} /* eet_data_image_decode_cipher */
|
||||||
|
|
||||||
EAPI void *
|
EAPI void *
|
||||||
eet_data_image_decode(const void * data,
|
eet_data_image_decode(const void * data,
|
||||||
int size,
|
int size,
|
||||||
unsigned int * w,
|
unsigned int *w,
|
||||||
unsigned int * h,
|
unsigned int *h,
|
||||||
int * alpha,
|
int * alpha,
|
||||||
int * comp,
|
int * comp,
|
||||||
int * quality,
|
int * quality,
|
||||||
int * lossy)
|
int * lossy)
|
||||||
{
|
{
|
||||||
return eet_data_image_decode_cipher(data, NULL, size, w, h,
|
return eet_data_image_decode_cipher(data, NULL, size, w, h,
|
||||||
alpha, comp, quality, lossy);
|
alpha, comp, quality, lossy);
|
||||||
} /* eet_data_image_decode */
|
} /* eet_data_image_decode */
|
||||||
|
|
||||||
EAPI int
|
EAPI int
|
||||||
eet_data_image_decode_to_surface_cipher(const void * data,
|
eet_data_image_decode_to_surface_cipher(const void * data,
|
||||||
const char * cipher_key,
|
const char * cipher_key,
|
||||||
int size,
|
int size,
|
||||||
unsigned int src_x,
|
unsigned int src_x,
|
||||||
unsigned int src_y,
|
unsigned int src_y,
|
||||||
unsigned int * d,
|
unsigned int *d,
|
||||||
unsigned int w,
|
unsigned int w,
|
||||||
unsigned int h,
|
unsigned int h,
|
||||||
unsigned int row_stride,
|
unsigned int row_stride,
|
||||||
int * alpha,
|
int * alpha,
|
||||||
int * comp,
|
int * comp,
|
||||||
int * quality,
|
int * quality,
|
||||||
int * lossy)
|
int * lossy)
|
||||||
{
|
{
|
||||||
unsigned int iw, ih;
|
unsigned int iw, ih;
|
||||||
int ialpha, icompress, iquality, ilossy;
|
int ialpha, icompress, iquality, ilossy;
|
||||||
void * deciphered_d = NULL;
|
void *deciphered_d = NULL;
|
||||||
unsigned int deciphered_sz = 0;
|
unsigned int deciphered_sz = 0;
|
||||||
|
|
||||||
if (cipher_key)
|
if (cipher_key)
|
||||||
|
@ -1779,18 +1779,18 @@ eet_data_image_decode_to_surface_cipher(const void * data,
|
||||||
} /* eet_data_image_decode_to_surface_cipher */
|
} /* eet_data_image_decode_to_surface_cipher */
|
||||||
|
|
||||||
EAPI int
|
EAPI int
|
||||||
eet_data_image_decode_to_surface(const void * data,
|
eet_data_image_decode_to_surface(const void * data,
|
||||||
int size,
|
int size,
|
||||||
unsigned int src_x,
|
unsigned int src_x,
|
||||||
unsigned int src_y,
|
unsigned int src_y,
|
||||||
unsigned int * d,
|
unsigned int *d,
|
||||||
unsigned int w,
|
unsigned int w,
|
||||||
unsigned int h,
|
unsigned int h,
|
||||||
unsigned int row_stride,
|
unsigned int row_stride,
|
||||||
int * alpha,
|
int * alpha,
|
||||||
int * comp,
|
int * comp,
|
||||||
int * quality,
|
int * quality,
|
||||||
int * lossy)
|
int * lossy)
|
||||||
{
|
{
|
||||||
return eet_data_image_decode_to_surface_cipher(data, NULL, size,
|
return eet_data_image_decode_to_surface_cipher(data, NULL, size,
|
||||||
src_x, src_y, d,
|
src_x, src_y, d,
|
||||||
|
|
|
@ -73,7 +73,7 @@ GCRY_THREAD_OPTION_PTHREAD_IMPL;
|
||||||
#include "Eet_private.h"
|
#include "Eet_private.h"
|
||||||
|
|
||||||
static Eet_Version _version = { VMAJ, VMIN, VMIC, VREV };
|
static Eet_Version _version = { VMAJ, VMIN, VMIC, VREV };
|
||||||
EAPI Eet_Version * eet_version = &_version;
|
EAPI Eet_Version *eet_version = &_version;
|
||||||
|
|
||||||
#ifdef HAVE_REALPATH
|
#ifdef HAVE_REALPATH
|
||||||
# undef HAVE_REALPATH
|
# undef HAVE_REALPATH
|
||||||
|
@ -90,70 +90,70 @@ typedef struct _Eet_File_Directory Eet_File_Directory;
|
||||||
|
|
||||||
struct _Eet_File
|
struct _Eet_File
|
||||||
{
|
{
|
||||||
char * path;
|
char * path;
|
||||||
FILE * readfp;
|
FILE * readfp;
|
||||||
Eet_File_Header * header;
|
Eet_File_Header * header;
|
||||||
Eet_Dictionary * ed;
|
Eet_Dictionary * ed;
|
||||||
Eet_Key * key;
|
Eet_Key * key;
|
||||||
const unsigned char * data;
|
const unsigned char *data;
|
||||||
const void * x509_der;
|
const void * x509_der;
|
||||||
const void * signature;
|
const void * signature;
|
||||||
void * sha1;
|
void * sha1;
|
||||||
|
|
||||||
Eet_File_Mode mode;
|
Eet_File_Mode mode;
|
||||||
|
|
||||||
int magic;
|
int magic;
|
||||||
int references;
|
int references;
|
||||||
|
|
||||||
int data_size;
|
int data_size;
|
||||||
int x509_length;
|
int x509_length;
|
||||||
unsigned int signature_length;
|
unsigned int signature_length;
|
||||||
int sha1_length;
|
int sha1_length;
|
||||||
|
|
||||||
time_t mtime;
|
time_t mtime;
|
||||||
|
|
||||||
#ifdef EFL_HAVE_THREADS
|
#ifdef EFL_HAVE_THREADS
|
||||||
# ifdef EFL_HAVE_POSIX_THREADS
|
# ifdef EFL_HAVE_POSIX_THREADS
|
||||||
pthread_mutex_t file_lock;
|
pthread_mutex_t file_lock;
|
||||||
# else /* ifdef EFL_HAVE_POSIX_THREADS */
|
# else /* ifdef EFL_HAVE_POSIX_THREADS */
|
||||||
HANDLE file_lock;
|
HANDLE file_lock;
|
||||||
# endif /* ifdef EFL_HAVE_POSIX_THREADS */
|
# endif /* ifdef EFL_HAVE_POSIX_THREADS */
|
||||||
#endif /* ifdef EFL_HAVE_THREADS */
|
#endif /* ifdef EFL_HAVE_THREADS */
|
||||||
|
|
||||||
unsigned char writes_pending : 1;
|
unsigned char writes_pending : 1;
|
||||||
unsigned char delete_me_now : 1;
|
unsigned char delete_me_now : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _Eet_File_Header
|
struct _Eet_File_Header
|
||||||
{
|
{
|
||||||
int magic;
|
int magic;
|
||||||
Eet_File_Directory * directory;
|
Eet_File_Directory *directory;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _Eet_File_Directory
|
struct _Eet_File_Directory
|
||||||
{
|
{
|
||||||
int size;
|
int size;
|
||||||
Eet_File_Node ** nodes;
|
Eet_File_Node **nodes;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _Eet_File_Node
|
struct _Eet_File_Node
|
||||||
{
|
{
|
||||||
char * name;
|
char * name;
|
||||||
void * data;
|
void * data;
|
||||||
Eet_File_Node * next; /* FIXME: make buckets linked lists */
|
Eet_File_Node *next; /* FIXME: make buckets linked lists */
|
||||||
|
|
||||||
int offset;
|
int offset;
|
||||||
int dictionary_offset;
|
int dictionary_offset;
|
||||||
int name_offset;
|
int name_offset;
|
||||||
|
|
||||||
int name_size;
|
int name_size;
|
||||||
int size;
|
int size;
|
||||||
int data_size;
|
int data_size;
|
||||||
|
|
||||||
unsigned char free_name : 1;
|
unsigned char free_name : 1;
|
||||||
unsigned char compression : 1;
|
unsigned char compression : 1;
|
||||||
unsigned char ciphered : 1;
|
unsigned char ciphered : 1;
|
||||||
unsigned char alias : 1;
|
unsigned char alias : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -224,29 +224,29 @@ char x509[x509_length]; /* The public certificate. */
|
||||||
EET_FILE2_DICTIONARY_ENTRY_COUNT)
|
EET_FILE2_DICTIONARY_ENTRY_COUNT)
|
||||||
|
|
||||||
/* prototypes of internal calls */
|
/* prototypes of internal calls */
|
||||||
static Eet_File * eet_cache_find(const char * path,
|
static Eet_File * eet_cache_find(const char *path,
|
||||||
Eet_File ** cache,
|
Eet_File ** cache,
|
||||||
int cache_num);
|
int cache_num);
|
||||||
static void eet_cache_add(Eet_File * ef,
|
static void eet_cache_add(Eet_File * ef,
|
||||||
Eet_File *** cache,
|
Eet_File ***cache,
|
||||||
int * cache_num,
|
int * cache_num,
|
||||||
int * cache_alloc);
|
int * cache_alloc);
|
||||||
static void eet_cache_del(Eet_File * ef,
|
static void eet_cache_del(Eet_File * ef,
|
||||||
Eet_File *** cache,
|
Eet_File ***cache,
|
||||||
int * cache_num,
|
int * cache_num,
|
||||||
int * cache_alloc);
|
int * cache_alloc);
|
||||||
static int eet_string_match(const char * s1, const char * s2);
|
static int eet_string_match(const char *s1, const char *s2);
|
||||||
#if 0 /* Unused */
|
#if 0 /* Unused */
|
||||||
static Eet_Error eet_flush(Eet_File * ef);
|
static Eet_Error eet_flush(Eet_File *ef);
|
||||||
#endif /* if 0 */
|
#endif /* if 0 */
|
||||||
static Eet_Error eet_flush2(Eet_File * ef);
|
static Eet_Error eet_flush2(Eet_File *ef);
|
||||||
static Eet_File_Node * find_node_by_name(Eet_File * ef, const char * name);
|
static Eet_File_Node * find_node_by_name(Eet_File *ef, const char *name);
|
||||||
static int read_data_from_disk(Eet_File * ef,
|
static int read_data_from_disk(Eet_File * ef,
|
||||||
Eet_File_Node * efn,
|
Eet_File_Node *efn,
|
||||||
void * buf,
|
void * buf,
|
||||||
int len);
|
int len);
|
||||||
|
|
||||||
static Eet_Error eet_internal_close(Eet_File * ef, Eina_Bool locked);
|
static Eet_Error eet_internal_close(Eet_File *ef, Eina_Bool locked);
|
||||||
|
|
||||||
#ifdef EFL_HAVE_THREADS
|
#ifdef EFL_HAVE_THREADS
|
||||||
|
|
||||||
|
@ -291,10 +291,10 @@ static HANDLE eet_cache_lock = NULL;
|
||||||
/* cache. i don't expect this to ever be large, so arrays will do */
|
/* cache. i don't expect this to ever be large, so arrays will do */
|
||||||
static int eet_writers_num = 0;
|
static int eet_writers_num = 0;
|
||||||
static int eet_writers_alloc = 0;
|
static int eet_writers_alloc = 0;
|
||||||
static Eet_File ** eet_writers = NULL;
|
static Eet_File **eet_writers = NULL;
|
||||||
static int eet_readers_num = 0;
|
static int eet_readers_num = 0;
|
||||||
static int eet_readers_alloc = 0;
|
static int eet_readers_alloc = 0;
|
||||||
static Eet_File ** eet_readers = NULL;
|
static Eet_File **eet_readers = NULL;
|
||||||
static int eet_init_count = 0;
|
static int eet_init_count = 0;
|
||||||
|
|
||||||
/* log domain variable */
|
/* log domain variable */
|
||||||
|
@ -302,7 +302,7 @@ int _eet_log_dom_global = -1;
|
||||||
|
|
||||||
/* Check to see its' an eet file pointer */
|
/* Check to see its' an eet file pointer */
|
||||||
static inline int
|
static inline int
|
||||||
eet_check_pointer(const Eet_File * ef)
|
eet_check_pointer(const Eet_File *ef)
|
||||||
{
|
{
|
||||||
if ((!ef) || (ef->magic != EET_MAGIC_FILE))
|
if ((!ef) || (ef->magic != EET_MAGIC_FILE))
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -311,7 +311,7 @@ eet_check_pointer(const Eet_File * ef)
|
||||||
} /* eet_check_pointer */
|
} /* eet_check_pointer */
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
eet_check_header(const Eet_File * ef)
|
eet_check_header(const Eet_File *ef)
|
||||||
{
|
{
|
||||||
if (!ef->header)
|
if (!ef->header)
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -323,8 +323,8 @@ eet_check_header(const Eet_File * ef)
|
||||||
} /* eet_check_header */
|
} /* eet_check_header */
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
eet_test_close(int test,
|
eet_test_close(int test,
|
||||||
Eet_File * ef)
|
Eet_File *ef)
|
||||||
{
|
{
|
||||||
if (test)
|
if (test)
|
||||||
{
|
{
|
||||||
|
@ -337,9 +337,9 @@ eet_test_close(int test,
|
||||||
|
|
||||||
/* find an eet file in the currently in use cache */
|
/* find an eet file in the currently in use cache */
|
||||||
static Eet_File *
|
static Eet_File *
|
||||||
eet_cache_find(const char * path,
|
eet_cache_find(const char *path,
|
||||||
Eet_File ** cache,
|
Eet_File ** cache,
|
||||||
int cache_num)
|
int cache_num)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -360,19 +360,19 @@ eet_cache_find(const char * path,
|
||||||
/* add to end of cache */
|
/* add to end of cache */
|
||||||
/* this should only be called when the cache lock is already held */
|
/* this should only be called when the cache lock is already held */
|
||||||
static void
|
static void
|
||||||
eet_cache_add(Eet_File * ef,
|
eet_cache_add(Eet_File * ef,
|
||||||
Eet_File *** cache,
|
Eet_File ***cache,
|
||||||
int * cache_num,
|
int * cache_num,
|
||||||
int * cache_alloc)
|
int * cache_alloc)
|
||||||
{
|
{
|
||||||
Eet_File ** new_cache;
|
Eet_File **new_cache;
|
||||||
int new_cache_num;
|
int new_cache_num;
|
||||||
int new_cache_alloc;
|
int new_cache_alloc;
|
||||||
|
|
||||||
new_cache_num = *cache_num;
|
new_cache_num = *cache_num;
|
||||||
if (new_cache_num >= 64) /* avoid fd overruns - limit to 128 (most recent) in the cache */
|
if (new_cache_num >= 64) /* avoid fd overruns - limit to 128 (most recent) in the cache */
|
||||||
{
|
{
|
||||||
Eet_File * del_ef = NULL;
|
Eet_File *del_ef = NULL;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
new_cache = *cache;
|
new_cache = *cache;
|
||||||
|
@ -416,12 +416,12 @@ eet_cache_add(Eet_File * ef,
|
||||||
/* delete from cache */
|
/* delete from cache */
|
||||||
/* this should only be called when the cache lock is already held */
|
/* this should only be called when the cache lock is already held */
|
||||||
static void
|
static void
|
||||||
eet_cache_del(Eet_File * ef,
|
eet_cache_del(Eet_File * ef,
|
||||||
Eet_File *** cache,
|
Eet_File ***cache,
|
||||||
int * cache_num,
|
int * cache_num,
|
||||||
int * cache_alloc)
|
int * cache_alloc)
|
||||||
{
|
{
|
||||||
Eet_File ** new_cache;
|
Eet_File **new_cache;
|
||||||
int new_cache_num, new_cache_alloc;
|
int new_cache_num, new_cache_alloc;
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
|
@ -470,8 +470,8 @@ eet_cache_del(Eet_File * ef,
|
||||||
|
|
||||||
/* internal string match. null friendly, catches same ptr */
|
/* internal string match. null friendly, catches same ptr */
|
||||||
static int
|
static int
|
||||||
eet_string_match(const char * s1,
|
eet_string_match(const char *s1,
|
||||||
const char * s2)
|
const char *s2)
|
||||||
{
|
{
|
||||||
/* both null- no match */
|
/* both null- no match */
|
||||||
if ((!s1) || (!s2))
|
if ((!s1) || (!s2))
|
||||||
|
@ -485,10 +485,10 @@ eet_string_match(const char * s1,
|
||||||
|
|
||||||
/* flush out writes to a v2 eet file */
|
/* flush out writes to a v2 eet file */
|
||||||
static Eet_Error
|
static Eet_Error
|
||||||
eet_flush2(Eet_File * ef)
|
eet_flush2(Eet_File *ef)
|
||||||
{
|
{
|
||||||
Eet_File_Node * efn;
|
Eet_File_Node *efn;
|
||||||
FILE * fp;
|
FILE *fp;
|
||||||
Eet_Error error = EET_ERROR_NONE;
|
Eet_Error error = EET_ERROR_NONE;
|
||||||
int head[EET_FILE2_HEADER_COUNT];
|
int head[EET_FILE2_HEADER_COUNT];
|
||||||
int num_directory_entries = 0;
|
int num_directory_entries = 0;
|
||||||
|
@ -802,7 +802,7 @@ eet_shutdown(void)
|
||||||
} /* eet_shutdown */
|
} /* eet_shutdown */
|
||||||
|
|
||||||
EAPI Eet_Error
|
EAPI Eet_Error
|
||||||
eet_sync(Eet_File * ef)
|
eet_sync(Eet_File *ef)
|
||||||
{
|
{
|
||||||
Eet_Error ret;
|
Eet_Error ret;
|
||||||
|
|
||||||
|
@ -849,7 +849,7 @@ eet_clearcache(void)
|
||||||
|
|
||||||
if (num > 0)
|
if (num > 0)
|
||||||
{
|
{
|
||||||
Eet_File ** closelist = NULL;
|
Eet_File **closelist = NULL;
|
||||||
|
|
||||||
closelist = alloca(num * sizeof(Eet_File *));
|
closelist = alloca(num * sizeof(Eet_File *));
|
||||||
num = 0;
|
num = 0;
|
||||||
|
@ -884,10 +884,10 @@ eet_clearcache(void)
|
||||||
|
|
||||||
/* FIXME: MMAP race condition in READ_WRITE_MODE */
|
/* FIXME: MMAP race condition in READ_WRITE_MODE */
|
||||||
static Eet_File *
|
static Eet_File *
|
||||||
eet_internal_read2(Eet_File * ef)
|
eet_internal_read2(Eet_File *ef)
|
||||||
{
|
{
|
||||||
const int * data = (const int *)ef->data;
|
const int *data = (const int *)ef->data;
|
||||||
const char * start = (const char *)ef->data;
|
const char *start = (const char *)ef->data;
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
int num_directory_entries;
|
int num_directory_entries;
|
||||||
int bytes_directory_entries;
|
int bytes_directory_entries;
|
||||||
|
@ -953,8 +953,8 @@ eet_internal_read2(Eet_File * ef)
|
||||||
/* actually read the directory block - all of it, into ram */
|
/* actually read the directory block - all of it, into ram */
|
||||||
for (i = 0; i < num_directory_entries; ++i)
|
for (i = 0; i < num_directory_entries; ++i)
|
||||||
{
|
{
|
||||||
const char * name;
|
const char *name;
|
||||||
Eet_File_Node * efn;
|
Eet_File_Node *efn;
|
||||||
int name_offset;
|
int name_offset;
|
||||||
int name_size;
|
int name_size;
|
||||||
int hash;
|
int hash;
|
||||||
|
@ -1029,7 +1029,7 @@ eet_internal_read2(Eet_File * ef)
|
||||||
|
|
||||||
if (num_dictionary_entries)
|
if (num_dictionary_entries)
|
||||||
{
|
{
|
||||||
const int * dico = (const int *)ef->data +
|
const int *dico = (const int *)ef->data +
|
||||||
EET_FILE2_DIRECTORY_ENTRY_COUNT * num_directory_entries +
|
EET_FILE2_DIRECTORY_ENTRY_COUNT * num_directory_entries +
|
||||||
EET_FILE2_HEADER_COUNT;
|
EET_FILE2_HEADER_COUNT;
|
||||||
int j;
|
int j;
|
||||||
|
@ -1109,7 +1109,7 @@ eet_internal_read2(Eet_File * ef)
|
||||||
if (signature_base_offset < ef->data_size)
|
if (signature_base_offset < ef->data_size)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_SIGNATURE
|
#ifdef HAVE_SIGNATURE
|
||||||
const unsigned char * buffer = ((const unsigned char *)ef->data) +
|
const unsigned char *buffer = ((const unsigned char *)ef->data) +
|
||||||
signature_base_offset;
|
signature_base_offset;
|
||||||
ef->x509_der = eet_identity_check(ef->data,
|
ef->x509_der = eet_identity_check(ef->data,
|
||||||
signature_base_offset,
|
signature_base_offset,
|
||||||
|
@ -1135,10 +1135,10 @@ eet_internal_read2(Eet_File * ef)
|
||||||
|
|
||||||
#if EET_OLD_EET_FILE_FORMAT
|
#if EET_OLD_EET_FILE_FORMAT
|
||||||
static Eet_File *
|
static Eet_File *
|
||||||
eet_internal_read1(Eet_File * ef)
|
eet_internal_read1(Eet_File *ef)
|
||||||
{
|
{
|
||||||
const unsigned char * dyn_buf = NULL;
|
const unsigned char *dyn_buf = NULL;
|
||||||
const unsigned char * p = NULL;
|
const unsigned char *p = NULL;
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
int num_entries;
|
int num_entries;
|
||||||
int byte_entries;
|
int byte_entries;
|
||||||
|
@ -1207,8 +1207,8 @@ eet_internal_read1(Eet_File * ef)
|
||||||
|
|
||||||
for (i = 0; i < num_entries; i++)
|
for (i = 0; i < num_entries; i++)
|
||||||
{
|
{
|
||||||
Eet_File_Node * efn;
|
Eet_File_Node *efn;
|
||||||
void * data = NULL;
|
void *data = NULL;
|
||||||
int indexn = 0;
|
int indexn = 0;
|
||||||
int name_size;
|
int name_size;
|
||||||
int hash;
|
int hash;
|
||||||
|
@ -1318,9 +1318,9 @@ eet_internal_read1(Eet_File * ef)
|
||||||
* to just require that it is always held.)
|
* to just require that it is always held.)
|
||||||
*/
|
*/
|
||||||
static Eet_File *
|
static Eet_File *
|
||||||
eet_internal_read(Eet_File * ef)
|
eet_internal_read(Eet_File *ef)
|
||||||
{
|
{
|
||||||
const int * data = (const int *)ef->data;
|
const int *data = (const int *)ef->data;
|
||||||
|
|
||||||
if (eet_test_close((ef->data == (void *)-1) || (ef->data == NULL), ef))
|
if (eet_test_close((ef->data == (void *)-1) || (ef->data == NULL), ef))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -1348,8 +1348,8 @@ eet_internal_read(Eet_File * ef)
|
||||||
} /* eet_internal_read */
|
} /* eet_internal_read */
|
||||||
|
|
||||||
static Eet_Error
|
static Eet_Error
|
||||||
eet_internal_close(Eet_File * ef,
|
eet_internal_close(Eet_File *ef,
|
||||||
Eina_Bool locked)
|
Eina_Bool locked)
|
||||||
{
|
{
|
||||||
Eet_Error err;
|
Eet_Error err;
|
||||||
|
|
||||||
|
@ -1403,7 +1403,7 @@ eet_internal_close(Eet_File * ef,
|
||||||
num = (1 << ef->header->directory->size);
|
num = (1 << ef->header->directory->size);
|
||||||
for (i = 0; i < num; i++)
|
for (i = 0; i < num; i++)
|
||||||
{
|
{
|
||||||
Eet_File_Node * efn;
|
Eet_File_Node *efn;
|
||||||
|
|
||||||
while ((efn = ef->header->directory->nodes[i]))
|
while ((efn = ef->header->directory->nodes[i]))
|
||||||
{
|
{
|
||||||
|
@ -1453,10 +1453,10 @@ on_error:
|
||||||
} /* eet_internal_close */
|
} /* eet_internal_close */
|
||||||
|
|
||||||
EAPI Eet_File *
|
EAPI Eet_File *
|
||||||
eet_memopen_read(const void * data,
|
eet_memopen_read(const void *data,
|
||||||
size_t size)
|
size_t size)
|
||||||
{
|
{
|
||||||
Eet_File * ef;
|
Eet_File *ef;
|
||||||
|
|
||||||
if (data == NULL || size == 0)
|
if (data == NULL || size == 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -1492,8 +1492,8 @@ EAPI Eet_File *
|
||||||
eet_open(const char * file,
|
eet_open(const char * file,
|
||||||
Eet_File_Mode mode)
|
Eet_File_Mode mode)
|
||||||
{
|
{
|
||||||
FILE * fp;
|
FILE *fp;
|
||||||
Eet_File * ef;
|
Eet_File *ef;
|
||||||
int file_len;
|
int file_len;
|
||||||
struct stat file_stat;
|
struct stat file_stat;
|
||||||
|
|
||||||
|
@ -1664,7 +1664,7 @@ on_error:
|
||||||
} /* eet_open */
|
} /* eet_open */
|
||||||
|
|
||||||
EAPI Eet_File_Mode
|
EAPI Eet_File_Mode
|
||||||
eet_mode_get(Eet_File * ef)
|
eet_mode_get(Eet_File *ef)
|
||||||
{
|
{
|
||||||
/* check to see its' an eet file pointer */
|
/* check to see its' an eet file pointer */
|
||||||
if ((!ef) || (ef->magic != EET_MAGIC_FILE))
|
if ((!ef) || (ef->magic != EET_MAGIC_FILE))
|
||||||
|
@ -1674,8 +1674,8 @@ eet_mode_get(Eet_File * ef)
|
||||||
} /* eet_mode_get */
|
} /* eet_mode_get */
|
||||||
|
|
||||||
EAPI const void *
|
EAPI const void *
|
||||||
eet_identity_x509(Eet_File * ef,
|
eet_identity_x509(Eet_File *ef,
|
||||||
int * der_length)
|
int * der_length)
|
||||||
{
|
{
|
||||||
if (!ef->x509_der)
|
if (!ef->x509_der)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -1687,8 +1687,8 @@ eet_identity_x509(Eet_File * ef,
|
||||||
} /* eet_identity_x509 */
|
} /* eet_identity_x509 */
|
||||||
|
|
||||||
EAPI const void *
|
EAPI const void *
|
||||||
eet_identity_signature(Eet_File * ef,
|
eet_identity_signature(Eet_File *ef,
|
||||||
int * signature_length)
|
int * signature_length)
|
||||||
{
|
{
|
||||||
if (!ef->signature)
|
if (!ef->signature)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -1700,8 +1700,8 @@ eet_identity_signature(Eet_File * ef,
|
||||||
} /* eet_identity_signature */
|
} /* eet_identity_signature */
|
||||||
|
|
||||||
EAPI const void *
|
EAPI const void *
|
||||||
eet_identity_sha1(Eet_File * ef,
|
eet_identity_sha1(Eet_File *ef,
|
||||||
int * sha1_length)
|
int * sha1_length)
|
||||||
{
|
{
|
||||||
if (!ef->sha1)
|
if (!ef->sha1)
|
||||||
ef->sha1 = eet_identity_compute_sha1(ef->data,
|
ef->sha1 = eet_identity_compute_sha1(ef->data,
|
||||||
|
@ -1715,10 +1715,10 @@ eet_identity_sha1(Eet_File * ef,
|
||||||
} /* eet_identity_sha1 */
|
} /* eet_identity_sha1 */
|
||||||
|
|
||||||
EAPI Eet_Error
|
EAPI Eet_Error
|
||||||
eet_identity_set(Eet_File * ef,
|
eet_identity_set(Eet_File *ef,
|
||||||
Eet_Key * key)
|
Eet_Key * key)
|
||||||
{
|
{
|
||||||
Eet_Key * tmp = ef->key;
|
Eet_Key *tmp = ef->key;
|
||||||
|
|
||||||
if (!ef)
|
if (!ef)
|
||||||
return EET_ERROR_BAD_OBJECT;
|
return EET_ERROR_BAD_OBJECT;
|
||||||
|
@ -1734,19 +1734,19 @@ eet_identity_set(Eet_File * ef,
|
||||||
} /* eet_identity_set */
|
} /* eet_identity_set */
|
||||||
|
|
||||||
EAPI Eet_Error
|
EAPI Eet_Error
|
||||||
eet_close(Eet_File * ef)
|
eet_close(Eet_File *ef)
|
||||||
{
|
{
|
||||||
return eet_internal_close(ef, EINA_FALSE);
|
return eet_internal_close(ef, EINA_FALSE);
|
||||||
} /* eet_close */
|
} /* eet_close */
|
||||||
|
|
||||||
EAPI void *
|
EAPI void *
|
||||||
eet_read_cipher(Eet_File * ef,
|
eet_read_cipher(Eet_File * ef,
|
||||||
const char * name,
|
const char *name,
|
||||||
int * size_ret,
|
int * size_ret,
|
||||||
const char * cipher_key)
|
const char *cipher_key)
|
||||||
{
|
{
|
||||||
Eet_File_Node * efn;
|
Eet_File_Node *efn;
|
||||||
char * data = NULL;
|
char *data = NULL;
|
||||||
int size = 0;
|
int size = 0;
|
||||||
|
|
||||||
if (size_ret)
|
if (size_ret)
|
||||||
|
@ -1785,7 +1785,7 @@ eet_read_cipher(Eet_File * ef,
|
||||||
/* uncompressed data */
|
/* uncompressed data */
|
||||||
if (efn->compression == 0)
|
if (efn->compression == 0)
|
||||||
{
|
{
|
||||||
void * data_deciphered = NULL;
|
void *data_deciphered = NULL;
|
||||||
unsigned int data_deciphered_sz = 0;
|
unsigned int data_deciphered_sz = 0;
|
||||||
/* if we alreayd have the data in ram... copy that */
|
/* if we alreayd have the data in ram... copy that */
|
||||||
|
|
||||||
|
@ -1814,8 +1814,8 @@ eet_read_cipher(Eet_File * ef,
|
||||||
/* compressed data */
|
/* compressed data */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
void * tmp_data;
|
void *tmp_data;
|
||||||
void * data_deciphered = NULL;
|
void *data_deciphered = NULL;
|
||||||
unsigned int data_deciphered_sz = 0;
|
unsigned int data_deciphered_sz = 0;
|
||||||
int free_tmp = 0;
|
int free_tmp = 0;
|
||||||
int compr_size = efn->size;
|
int compr_size = efn->size;
|
||||||
|
@ -1874,7 +1874,7 @@ eet_read_cipher(Eet_File * ef,
|
||||||
/* handle alias */
|
/* handle alias */
|
||||||
if (efn->alias)
|
if (efn->alias)
|
||||||
{
|
{
|
||||||
void * tmp;
|
void *tmp;
|
||||||
|
|
||||||
if (data[size - 1] != '\0')
|
if (data[size - 1] != '\0')
|
||||||
goto on_error;
|
goto on_error;
|
||||||
|
@ -1899,20 +1899,20 @@ on_error:
|
||||||
} /* eet_read_cipher */
|
} /* eet_read_cipher */
|
||||||
|
|
||||||
EAPI void *
|
EAPI void *
|
||||||
eet_read(Eet_File * ef,
|
eet_read(Eet_File * ef,
|
||||||
const char * name,
|
const char *name,
|
||||||
int * size_ret)
|
int * size_ret)
|
||||||
{
|
{
|
||||||
return eet_read_cipher(ef, name, size_ret, NULL);
|
return eet_read_cipher(ef, name, size_ret, NULL);
|
||||||
} /* eet_read */
|
} /* eet_read */
|
||||||
|
|
||||||
EAPI const void *
|
EAPI const void *
|
||||||
eet_read_direct(Eet_File * ef,
|
eet_read_direct(Eet_File * ef,
|
||||||
const char * name,
|
const char *name,
|
||||||
int * size_ret)
|
int * size_ret)
|
||||||
{
|
{
|
||||||
Eet_File_Node * efn;
|
Eet_File_Node *efn;
|
||||||
const char * data = NULL;
|
const char *data = NULL;
|
||||||
int size = 0;
|
int size = 0;
|
||||||
|
|
||||||
if (size_ret)
|
if (size_ret)
|
||||||
|
@ -1953,7 +1953,7 @@ eet_read_direct(Eet_File * ef,
|
||||||
/* handle alias case */
|
/* handle alias case */
|
||||||
if (efn->compression)
|
if (efn->compression)
|
||||||
{
|
{
|
||||||
char * tmp;
|
char *tmp;
|
||||||
int compr_size = efn->size;
|
int compr_size = efn->size;
|
||||||
uLongf dlen;
|
uLongf dlen;
|
||||||
|
|
||||||
|
@ -2000,13 +2000,13 @@ on_error:
|
||||||
} /* eet_read_direct */
|
} /* eet_read_direct */
|
||||||
|
|
||||||
EAPI Eina_Bool
|
EAPI Eina_Bool
|
||||||
eet_alias(Eet_File * ef,
|
eet_alias(Eet_File * ef,
|
||||||
const char * name,
|
const char *name,
|
||||||
const char * destination,
|
const char *destination,
|
||||||
int comp)
|
int comp)
|
||||||
{
|
{
|
||||||
Eet_File_Node * efn;
|
Eet_File_Node *efn;
|
||||||
void * data2;
|
void *data2;
|
||||||
Eina_Bool exists_already = EINA_FALSE;
|
Eina_Bool exists_already = EINA_FALSE;
|
||||||
int data_size;
|
int data_size;
|
||||||
int hash;
|
int hash;
|
||||||
|
@ -2090,7 +2090,7 @@ eet_alias(Eet_File * ef,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
void * data3;
|
void *data3;
|
||||||
|
|
||||||
data3 = realloc(data2, data_size);
|
data3 = realloc(data2, data_size);
|
||||||
if (data3)
|
if (data3)
|
||||||
|
@ -2155,15 +2155,15 @@ on_error:
|
||||||
} /* eet_alias */
|
} /* eet_alias */
|
||||||
|
|
||||||
EAPI int
|
EAPI int
|
||||||
eet_write_cipher(Eet_File * ef,
|
eet_write_cipher(Eet_File * ef,
|
||||||
const char * name,
|
const char *name,
|
||||||
const void * data,
|
const void *data,
|
||||||
int size,
|
int size,
|
||||||
int comp,
|
int comp,
|
||||||
const char * cipher_key)
|
const char *cipher_key)
|
||||||
{
|
{
|
||||||
Eet_File_Node * efn;
|
Eet_File_Node *efn;
|
||||||
void * data2 = NULL;
|
void *data2 = NULL;
|
||||||
int exists_already = 0;
|
int exists_already = 0;
|
||||||
int data_size;
|
int data_size;
|
||||||
int hash;
|
int hash;
|
||||||
|
@ -2247,7 +2247,7 @@ eet_write_cipher(Eet_File * ef,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
void * data3;
|
void *data3;
|
||||||
|
|
||||||
data3 = realloc(data2, data_size);
|
data3 = realloc(data2, data_size);
|
||||||
if (data3)
|
if (data3)
|
||||||
|
@ -2257,9 +2257,9 @@ eet_write_cipher(Eet_File * ef,
|
||||||
|
|
||||||
if (cipher_key)
|
if (cipher_key)
|
||||||
{
|
{
|
||||||
void * data_ciphered = NULL;
|
void *data_ciphered = NULL;
|
||||||
unsigned int data_ciphered_sz = 0;
|
unsigned int data_ciphered_sz = 0;
|
||||||
const void * tmp;
|
const void *tmp;
|
||||||
|
|
||||||
tmp = data2 ? data2 : data;
|
tmp = data2 ? data2 : data;
|
||||||
if (!eet_cipher(tmp, data_size, cipher_key, strlen(cipher_key),
|
if (!eet_cipher(tmp, data_size, cipher_key, strlen(cipher_key),
|
||||||
|
@ -2337,21 +2337,21 @@ on_error:
|
||||||
} /* eet_write_cipher */
|
} /* eet_write_cipher */
|
||||||
|
|
||||||
EAPI int
|
EAPI int
|
||||||
eet_write(Eet_File * ef,
|
eet_write(Eet_File * ef,
|
||||||
const char * name,
|
const char *name,
|
||||||
const void * data,
|
const void *data,
|
||||||
int size,
|
int size,
|
||||||
int comp)
|
int comp)
|
||||||
{
|
{
|
||||||
return eet_write_cipher(ef, name, data, size, comp, NULL);
|
return eet_write_cipher(ef, name, data, size, comp, NULL);
|
||||||
} /* eet_write */
|
} /* eet_write */
|
||||||
|
|
||||||
EAPI int
|
EAPI int
|
||||||
eet_delete(Eet_File * ef,
|
eet_delete(Eet_File * ef,
|
||||||
const char * name)
|
const char *name)
|
||||||
{
|
{
|
||||||
Eet_File_Node * efn;
|
Eet_File_Node *efn;
|
||||||
Eet_File_Node * pefn;
|
Eet_File_Node *pefn;
|
||||||
int hash;
|
int hash;
|
||||||
int exists_already = 0;
|
int exists_already = 0;
|
||||||
|
|
||||||
|
@ -2409,7 +2409,7 @@ eet_delete(Eet_File * ef,
|
||||||
} /* eet_delete */
|
} /* eet_delete */
|
||||||
|
|
||||||
EAPI Eet_Dictionary *
|
EAPI Eet_Dictionary *
|
||||||
eet_dictionary_get(Eet_File * ef)
|
eet_dictionary_get(Eet_File *ef)
|
||||||
{
|
{
|
||||||
if (eet_check_pointer(ef))
|
if (eet_check_pointer(ef))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -2418,12 +2418,12 @@ eet_dictionary_get(Eet_File * ef)
|
||||||
} /* eet_dictionary_get */
|
} /* eet_dictionary_get */
|
||||||
|
|
||||||
EAPI char **
|
EAPI char **
|
||||||
eet_list(Eet_File * ef,
|
eet_list(Eet_File * ef,
|
||||||
const char * glob,
|
const char *glob,
|
||||||
int * count_ret)
|
int * count_ret)
|
||||||
{
|
{
|
||||||
Eet_File_Node * efn;
|
Eet_File_Node *efn;
|
||||||
char ** list_ret = NULL;
|
char **list_ret = NULL;
|
||||||
int list_count = 0;
|
int list_count = 0;
|
||||||
int list_count_alloc = 0;
|
int list_count_alloc = 0;
|
||||||
int i, num;
|
int i, num;
|
||||||
|
@ -2463,7 +2463,7 @@ eet_list(Eet_File * ef,
|
||||||
/* only realloc in 32 entry chunks */
|
/* only realloc in 32 entry chunks */
|
||||||
if (list_count > list_count_alloc)
|
if (list_count > list_count_alloc)
|
||||||
{
|
{
|
||||||
char ** new_list = NULL;
|
char **new_list = NULL;
|
||||||
|
|
||||||
list_count_alloc += 64;
|
list_count_alloc += 64;
|
||||||
new_list =
|
new_list =
|
||||||
|
@ -2502,10 +2502,10 @@ on_error:
|
||||||
} /* eet_list */
|
} /* eet_list */
|
||||||
|
|
||||||
EAPI int
|
EAPI int
|
||||||
eet_num_entries(Eet_File * ef)
|
eet_num_entries(Eet_File *ef)
|
||||||
{
|
{
|
||||||
int i, num, ret = 0;
|
int i, num, ret = 0;
|
||||||
Eet_File_Node * efn;
|
Eet_File_Node *efn;
|
||||||
|
|
||||||
/* check to see its' an eet file pointer */
|
/* check to see its' an eet file pointer */
|
||||||
if (eet_check_pointer(ef) || eet_check_header(ef) ||
|
if (eet_check_pointer(ef) || eet_check_header(ef) ||
|
||||||
|
@ -2529,10 +2529,10 @@ eet_num_entries(Eet_File * ef)
|
||||||
} /* eet_num_entries */
|
} /* eet_num_entries */
|
||||||
|
|
||||||
static Eet_File_Node *
|
static Eet_File_Node *
|
||||||
find_node_by_name(Eet_File * ef,
|
find_node_by_name(Eet_File * ef,
|
||||||
const char * name)
|
const char *name)
|
||||||
{
|
{
|
||||||
Eet_File_Node * efn;
|
Eet_File_Node *efn;
|
||||||
int hash;
|
int hash;
|
||||||
|
|
||||||
/* get hash bucket this should be in */
|
/* get hash bucket this should be in */
|
||||||
|
@ -2548,10 +2548,10 @@ find_node_by_name(Eet_File * ef,
|
||||||
} /* find_node_by_name */
|
} /* find_node_by_name */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
read_data_from_disk(Eet_File * ef,
|
read_data_from_disk(Eet_File * ef,
|
||||||
Eet_File_Node * efn,
|
Eet_File_Node *efn,
|
||||||
void * buf,
|
void * buf,
|
||||||
int len)
|
int len)
|
||||||
{
|
{
|
||||||
if (efn->offset < 0)
|
if (efn->offset < 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -18,12 +18,12 @@
|
||||||
#include "Eet.h"
|
#include "Eet.h"
|
||||||
#include "Eet_private.h"
|
#include "Eet_private.h"
|
||||||
|
|
||||||
static Eina_Mempool * _eet_node_mp = NULL;
|
static Eina_Mempool *_eet_node_mp = NULL;
|
||||||
|
|
||||||
Eet_Node *
|
Eet_Node *
|
||||||
eet_node_new(void)
|
eet_node_new(void)
|
||||||
{
|
{
|
||||||
Eet_Node * result;
|
Eet_Node *result;
|
||||||
|
|
||||||
result = eina_mempool_malloc(_eet_node_mp, sizeof (Eet_Node));
|
result = eina_mempool_malloc(_eet_node_mp, sizeof (Eet_Node));
|
||||||
if (!result)
|
if (!result)
|
||||||
|
@ -34,16 +34,16 @@ eet_node_new(void)
|
||||||
} /* eet_node_new */
|
} /* eet_node_new */
|
||||||
|
|
||||||
void
|
void
|
||||||
eet_node_free(Eet_Node * node)
|
eet_node_free(Eet_Node *node)
|
||||||
{
|
{
|
||||||
eina_mempool_free(_eet_node_mp, node);
|
eina_mempool_free(_eet_node_mp, node);
|
||||||
} /* eet_node_free */
|
} /* eet_node_free */
|
||||||
|
|
||||||
static Eet_Node *
|
static Eet_Node *
|
||||||
_eet_node_new(const char * name,
|
_eet_node_new(const char *name,
|
||||||
int type)
|
int type)
|
||||||
{
|
{
|
||||||
Eet_Node * n;
|
Eet_Node *n;
|
||||||
|
|
||||||
n = eet_node_new();
|
n = eet_node_new();
|
||||||
if (!n)
|
if (!n)
|
||||||
|
@ -56,10 +56,10 @@ _eet_node_new(const char * name,
|
||||||
} /* _eet_node_new */
|
} /* _eet_node_new */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_eet_node_append(Eet_Node * n, Eina_List * nodes)
|
_eet_node_append(Eet_Node *n, Eina_List *nodes)
|
||||||
{
|
{
|
||||||
Eet_Node * value;
|
Eet_Node *value;
|
||||||
Eina_List * l;
|
Eina_List *l;
|
||||||
|
|
||||||
EINA_LIST_REVERSE_FOREACH(nodes, l, value)
|
EINA_LIST_REVERSE_FOREACH(nodes, l, value)
|
||||||
{
|
{
|
||||||
|
@ -70,9 +70,9 @@ _eet_node_append(Eet_Node * n, Eina_List * nodes)
|
||||||
|
|
||||||
#define EET_NODE_NEW(Eet_type, Name, Value, Type)\
|
#define EET_NODE_NEW(Eet_type, Name, Value, Type)\
|
||||||
EAPI Eet_Node *\
|
EAPI Eet_Node *\
|
||||||
eet_node_ ## Name ## _new(const char * name, Type Value)\
|
eet_node_ ## Name ## _new(const char *name, Type Value)\
|
||||||
{\
|
{\
|
||||||
Eet_Node * n;\
|
Eet_Node *n;\
|
||||||
\
|
\
|
||||||
n = _eet_node_new(name, Eet_type);\
|
n = _eet_node_new(name, Eet_type);\
|
||||||
if (!n) { return NULL; }\
|
if (!n) { return NULL; }\
|
||||||
|
@ -84,9 +84,9 @@ _eet_node_append(Eet_Node * n, Eina_List * nodes)
|
||||||
|
|
||||||
#define EET_NODE_STR_NEW(Eet_type, Name, Value, Type)\
|
#define EET_NODE_STR_NEW(Eet_type, Name, Value, Type)\
|
||||||
EAPI Eet_Node *\
|
EAPI Eet_Node *\
|
||||||
eet_node_ ## Name ## _new(const char * name, Type Value)\
|
eet_node_ ## Name ## _new(const char *name, Type Value)\
|
||||||
{\
|
{\
|
||||||
Eet_Node * n;\
|
Eet_Node *n;\
|
||||||
\
|
\
|
||||||
n = _eet_node_new(name, Eet_type);\
|
n = _eet_node_new(name, Eet_type);\
|
||||||
if (!n) { return NULL; }\
|
if (!n) { return NULL; }\
|
||||||
|
@ -110,9 +110,9 @@ EET_NODE_STR_NEW(EET_T_STRING, string, str, const char *)
|
||||||
EET_NODE_STR_NEW(EET_T_INLINED_STRING, inlined_string, str, const char *)
|
EET_NODE_STR_NEW(EET_T_INLINED_STRING, inlined_string, str, const char *)
|
||||||
|
|
||||||
Eet_Node *
|
Eet_Node *
|
||||||
eet_node_null_new(const char * name)
|
eet_node_null_new(const char *name)
|
||||||
{
|
{
|
||||||
Eet_Node * n;
|
Eet_Node *n;
|
||||||
|
|
||||||
n = _eet_node_new(name, EET_T_NULL);
|
n = _eet_node_new(name, EET_T_NULL);
|
||||||
if (!n)
|
if (!n)
|
||||||
|
@ -124,10 +124,10 @@ eet_node_null_new(const char * name)
|
||||||
}
|
}
|
||||||
|
|
||||||
Eet_Node *
|
Eet_Node *
|
||||||
eet_node_list_new(const char * name,
|
eet_node_list_new(const char *name,
|
||||||
Eina_List * nodes)
|
Eina_List * nodes)
|
||||||
{
|
{
|
||||||
Eet_Node * n;
|
Eet_Node *n;
|
||||||
|
|
||||||
n = _eet_node_new(name, EET_G_LIST);
|
n = _eet_node_new(name, EET_G_LIST);
|
||||||
if (!n)
|
if (!n)
|
||||||
|
@ -139,11 +139,11 @@ eet_node_list_new(const char * name,
|
||||||
} /* eet_node_list_new */
|
} /* eet_node_list_new */
|
||||||
|
|
||||||
Eet_Node *
|
Eet_Node *
|
||||||
eet_node_array_new(const char * name,
|
eet_node_array_new(const char *name,
|
||||||
int count,
|
int count,
|
||||||
Eina_List * nodes)
|
Eina_List * nodes)
|
||||||
{
|
{
|
||||||
Eet_Node * n;
|
Eet_Node *n;
|
||||||
|
|
||||||
n = _eet_node_new(name, EET_G_ARRAY);
|
n = _eet_node_new(name, EET_G_ARRAY);
|
||||||
if (!n)
|
if (!n)
|
||||||
|
@ -157,10 +157,10 @@ eet_node_array_new(const char * name,
|
||||||
} /* eet_node_array_new */
|
} /* eet_node_array_new */
|
||||||
|
|
||||||
Eet_Node *
|
Eet_Node *
|
||||||
eet_node_var_array_new(const char * name,
|
eet_node_var_array_new(const char *name,
|
||||||
Eina_List * nodes)
|
Eina_List * nodes)
|
||||||
{
|
{
|
||||||
Eet_Node * n;
|
Eet_Node *n;
|
||||||
|
|
||||||
n = _eet_node_new(name, EET_G_VAR_ARRAY);
|
n = _eet_node_new(name, EET_G_VAR_ARRAY);
|
||||||
if (!n)
|
if (!n)
|
||||||
|
@ -174,12 +174,12 @@ eet_node_var_array_new(const char * name,
|
||||||
} /* eet_node_var_array_new */
|
} /* eet_node_var_array_new */
|
||||||
|
|
||||||
Eet_Node *
|
Eet_Node *
|
||||||
eet_node_hash_new(const char * name,
|
eet_node_hash_new(const char *name,
|
||||||
const char * key,
|
const char *key,
|
||||||
Eet_Node * node)
|
Eet_Node * node)
|
||||||
{
|
{
|
||||||
Eina_List * nodes;
|
Eina_List *nodes;
|
||||||
Eet_Node * n;
|
Eet_Node *n;
|
||||||
|
|
||||||
if (!node)
|
if (!node)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -197,10 +197,10 @@ eet_node_hash_new(const char * name,
|
||||||
} /* eet_node_hash_new */
|
} /* eet_node_hash_new */
|
||||||
|
|
||||||
Eet_Node *
|
Eet_Node *
|
||||||
eet_node_struct_new(const char * name,
|
eet_node_struct_new(const char *name,
|
||||||
Eina_List * nodes)
|
Eina_List * nodes)
|
||||||
{
|
{
|
||||||
Eet_Node * n;
|
Eet_Node *n;
|
||||||
|
|
||||||
n = _eet_node_new(name, EET_G_UNKNOWN);
|
n = _eet_node_new(name, EET_G_UNKNOWN);
|
||||||
if (!n)
|
if (!n)
|
||||||
|
@ -212,10 +212,10 @@ eet_node_struct_new(const char * name,
|
||||||
} /* eet_node_struct_new */
|
} /* eet_node_struct_new */
|
||||||
|
|
||||||
Eet_Node *
|
Eet_Node *
|
||||||
eet_node_struct_child_new(const char * parent,
|
eet_node_struct_child_new(const char *parent,
|
||||||
Eet_Node * child)
|
Eet_Node * child)
|
||||||
{
|
{
|
||||||
Eet_Node * n;
|
Eet_Node *n;
|
||||||
|
|
||||||
if (child->type != EET_G_UNKNOWN)
|
if (child->type != EET_G_UNKNOWN)
|
||||||
return child;
|
return child;
|
||||||
|
@ -230,19 +230,19 @@ eet_node_struct_child_new(const char * parent,
|
||||||
} /* eet_node_struct_child_new */
|
} /* eet_node_struct_child_new */
|
||||||
|
|
||||||
void
|
void
|
||||||
eet_node_list_append(Eet_Node * parent,
|
eet_node_list_append(Eet_Node * parent,
|
||||||
const char * name,
|
const char *name,
|
||||||
Eet_Node * child)
|
Eet_Node * child)
|
||||||
{
|
{
|
||||||
const char * tmp;
|
const char *tmp;
|
||||||
Eet_Node * nn;
|
Eet_Node *nn;
|
||||||
|
|
||||||
tmp = eina_stringshare_add(name);
|
tmp = eina_stringshare_add(name);
|
||||||
|
|
||||||
for (nn = parent->values; nn; nn = nn->next)
|
for (nn = parent->values; nn; nn = nn->next)
|
||||||
if (nn->name == tmp && nn->type == EET_G_LIST)
|
if (nn->name == tmp && nn->type == EET_G_LIST)
|
||||||
{
|
{
|
||||||
Eet_Node * n;
|
Eet_Node *n;
|
||||||
|
|
||||||
if (!nn->values)
|
if (!nn->values)
|
||||||
nn->values = child;
|
nn->values = child;
|
||||||
|
@ -271,13 +271,13 @@ eet_node_list_append(Eet_Node * parent,
|
||||||
} /* eet_node_list_append */
|
} /* eet_node_list_append */
|
||||||
|
|
||||||
void
|
void
|
||||||
eet_node_struct_append(Eet_Node * parent,
|
eet_node_struct_append(Eet_Node * parent,
|
||||||
const char * name,
|
const char *name,
|
||||||
Eet_Node * child)
|
Eet_Node * child)
|
||||||
{
|
{
|
||||||
const char * tmp;
|
const char *tmp;
|
||||||
Eet_Node * prev;
|
Eet_Node *prev;
|
||||||
Eet_Node * nn;
|
Eet_Node *nn;
|
||||||
|
|
||||||
if (parent->type != EET_G_UNKNOWN)
|
if (parent->type != EET_G_UNKNOWN)
|
||||||
{
|
{
|
||||||
|
@ -319,12 +319,12 @@ eet_node_struct_append(Eet_Node * parent,
|
||||||
} /* eet_node_struct_append */
|
} /* eet_node_struct_append */
|
||||||
|
|
||||||
void
|
void
|
||||||
eet_node_hash_add(Eet_Node * parent,
|
eet_node_hash_add(Eet_Node * parent,
|
||||||
const char * name,
|
const char *name,
|
||||||
const char * key,
|
const char *key,
|
||||||
Eet_Node * child)
|
Eet_Node * child)
|
||||||
{
|
{
|
||||||
Eet_Node * nn;
|
Eet_Node *nn;
|
||||||
|
|
||||||
/* No list found, so create it. */
|
/* No list found, so create it. */
|
||||||
nn = eet_node_hash_new(name, key, child);
|
nn = eet_node_hash_new(name, key, child);
|
||||||
|
@ -335,10 +335,10 @@ eet_node_hash_add(Eet_Node * parent,
|
||||||
} /* eet_node_hash_add */
|
} /* eet_node_hash_add */
|
||||||
|
|
||||||
void
|
void
|
||||||
eet_node_del(Eet_Node * n)
|
eet_node_del(Eet_Node *n)
|
||||||
{
|
{
|
||||||
Eet_Node * nn;
|
Eet_Node *nn;
|
||||||
Eet_Node * tmp;
|
Eet_Node *tmp;
|
||||||
|
|
||||||
if (!n)
|
if (!n)
|
||||||
return;
|
return;
|
||||||
|
@ -381,7 +381,7 @@ eet_node_del(Eet_Node * n)
|
||||||
eet_node_free(n);
|
eet_node_free(n);
|
||||||
} /* eet_node_del */
|
} /* eet_node_del */
|
||||||
|
|
||||||
static const char * eet_node_dump_g_name[6] = {
|
static const char *eet_node_dump_g_name[6] = {
|
||||||
"struct",
|
"struct",
|
||||||
"array",
|
"array",
|
||||||
"var_array",
|
"var_array",
|
||||||
|
@ -390,7 +390,7 @@ static const char * eet_node_dump_g_name[6] = {
|
||||||
"???"
|
"???"
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char * eet_node_dump_t_name[14][2] = {
|
static const char *eet_node_dump_t_name[14][2] = {
|
||||||
{ "???: ", "???" },
|
{ "???: ", "???" },
|
||||||
{ "char: ", "%hhi" },
|
{ "char: ", "%hhi" },
|
||||||
{ "short: ", "%hi" },
|
{ "short: ", "%hi" },
|
||||||
|
@ -407,8 +407,8 @@ static const char * eet_node_dump_t_name[14][2] = {
|
||||||
|
|
||||||
static void
|
static void
|
||||||
eet_node_dump_level(int level,
|
eet_node_dump_level(int level,
|
||||||
void (* dumpfunc)(void * data, const char * str),
|
void (*dumpfunc)(void *data, const char *str),
|
||||||
void * dumpdata)
|
void *dumpdata)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -416,10 +416,10 @@ eet_node_dump_level(int level,
|
||||||
} /* eet_node_dump_level */
|
} /* eet_node_dump_level */
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
eet_node_string_escape(const char * str)
|
eet_node_string_escape(const char *str)
|
||||||
{
|
{
|
||||||
char * s, * sp;
|
char *s, *sp;
|
||||||
const char * strp;
|
const char *strp;
|
||||||
int sz = 0;
|
int sz = 0;
|
||||||
|
|
||||||
for (strp = str; *strp; strp++)
|
for (strp = str; *strp; strp++)
|
||||||
|
@ -457,11 +457,11 @@ eet_node_string_escape(const char * str)
|
||||||
} /* eet_node_string_escape */
|
} /* eet_node_string_escape */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
eet_node_dump_string_escape(void * dumpdata,
|
eet_node_dump_string_escape(void *dumpdata,
|
||||||
void dumpfunc(void * data, const char * str),
|
void dumpfunc(void *data, const char *str),
|
||||||
const char * str)
|
const char *str)
|
||||||
{
|
{
|
||||||
char * s;
|
char *s;
|
||||||
|
|
||||||
s = eet_node_string_escape(str);
|
s = eet_node_string_escape(str);
|
||||||
if (!s)
|
if (!s)
|
||||||
|
@ -472,11 +472,11 @@ eet_node_dump_string_escape(void * dumpdata,
|
||||||
} /* eet_node_dump_string_escape */
|
} /* eet_node_dump_string_escape */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
eet_node_dump_simple_type(Eet_Node * n, int level,
|
eet_node_dump_simple_type(Eet_Node *n, int level,
|
||||||
void (* dumpfunc)(void * data, const char * str),
|
void (*dumpfunc)(void *data, const char *str),
|
||||||
void * dumpdata)
|
void *dumpdata)
|
||||||
{
|
{
|
||||||
const char * type_name = NULL;
|
const char *type_name = NULL;
|
||||||
char tbuf[256];
|
char tbuf[256];
|
||||||
|
|
||||||
eet_node_dump_level(level, dumpfunc, dumpdata);
|
eet_node_dump_level(level, dumpfunc, dumpdata);
|
||||||
|
@ -539,10 +539,10 @@ eet_node_dump_simple_type(Eet_Node * n, int level,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
eet_node_dump_group_start(int level,
|
eet_node_dump_group_start(int level,
|
||||||
void (* dumpfunc)(void * data, const char * str),
|
void (*dumpfunc)(void *data, const char *str),
|
||||||
void * dumpdata,
|
void *dumpdata,
|
||||||
int group_type,
|
int group_type,
|
||||||
const char * name)
|
const char *name)
|
||||||
{
|
{
|
||||||
int chnk_type;
|
int chnk_type;
|
||||||
|
|
||||||
|
@ -560,20 +560,20 @@ eet_node_dump_group_start(int level,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
eet_node_dump_group_end(int level,
|
eet_node_dump_group_end(int level,
|
||||||
void (* dumpfunc)(void * data, const char * str),
|
void (*dumpfunc)(void *data, const char *str),
|
||||||
void * dumpdata)
|
void *dumpdata)
|
||||||
{
|
{
|
||||||
eet_node_dump_level(level, dumpfunc, dumpdata);
|
eet_node_dump_level(level, dumpfunc, dumpdata);
|
||||||
dumpfunc(dumpdata, "}\n");
|
dumpfunc(dumpdata, "}\n");
|
||||||
} /* eet_node_dump_group_end */
|
} /* eet_node_dump_group_end */
|
||||||
|
|
||||||
void
|
void
|
||||||
eet_node_dump(Eet_Node * n,
|
eet_node_dump(Eet_Node *n,
|
||||||
int dumplevel,
|
int dumplevel,
|
||||||
void (* dumpfunc)(void * data, const char * str),
|
void (*dumpfunc)(void *data, const char *str),
|
||||||
void * dumpdata)
|
void *dumpdata)
|
||||||
{
|
{
|
||||||
Eet_Node * it;
|
Eet_Node *it;
|
||||||
|
|
||||||
if (!n)
|
if (!n)
|
||||||
return;
|
return;
|
||||||
|
@ -634,14 +634,14 @@ eet_node_dump(Eet_Node * n,
|
||||||
} /* eet_node_dump */
|
} /* eet_node_dump */
|
||||||
|
|
||||||
void *
|
void *
|
||||||
eet_node_walk(void * parent,
|
eet_node_walk(void * parent,
|
||||||
const char * name,
|
const char * name,
|
||||||
Eet_Node * root,
|
Eet_Node * root,
|
||||||
Eet_Node_Walk * cb,
|
Eet_Node_Walk *cb,
|
||||||
void * user_data)
|
void * user_data)
|
||||||
{
|
{
|
||||||
Eet_Node * it;
|
Eet_Node *it;
|
||||||
void * me = NULL;
|
void *me = NULL;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!root)
|
if (!root)
|
||||||
|
@ -724,8 +724,8 @@ eet_node_walk(void * parent,
|
||||||
int
|
int
|
||||||
eet_node_init(void)
|
eet_node_init(void)
|
||||||
{
|
{
|
||||||
const char * choice;
|
const char *choice;
|
||||||
const char * tmp;
|
const char *tmp;
|
||||||
|
|
||||||
choice = "chained_mempool";
|
choice = "chained_mempool";
|
||||||
tmp = getenv("EET_MEMPOOL");
|
tmp = getenv("EET_MEMPOOL");
|
||||||
|
|
|
@ -13,13 +13,13 @@
|
||||||
#include "Eet_private.h"
|
#include "Eet_private.h"
|
||||||
|
|
||||||
int
|
int
|
||||||
_eet_hash_gen(const char * key,
|
_eet_hash_gen(const char *key,
|
||||||
int hash_size)
|
int hash_size)
|
||||||
{
|
{
|
||||||
int hash_num = 0;
|
int hash_num = 0;
|
||||||
int value, i;
|
int value, i;
|
||||||
int mask;
|
int mask;
|
||||||
unsigned char * ptr;
|
unsigned char *ptr;
|
||||||
|
|
||||||
/* no string - index 0 */
|
/* no string - index 0 */
|
||||||
if (!key)
|
if (!key)
|
||||||
|
|
Loading…
Reference in New Issue