From 3e59d344415701fc64e5d77da66bee0ec9bd6fe4 Mon Sep 17 00:00:00 2001 From: Cedric BAIL Date: Mon, 1 Mar 2010 11:03:35 +0000 Subject: [PATCH] * eet: Fix override of global symbols. Patch from Albin "Lutin" Tonnerre SVN revision: 46682 --- legacy/eet/AUTHORS | 1 + legacy/eet/ChangeLog | 5 +- legacy/eet/src/lib/eet_data.c | 66 ++++++++-------- legacy/eet/src/lib/eet_dictionary.c | 116 ++++++++++++++-------------- legacy/eet/src/lib/eet_image.c | 90 ++++++++++----------- legacy/eet/src/lib/eet_lib.c | 62 +++++++-------- legacy/eet/src/lib/eet_node.c | 4 +- 7 files changed, 173 insertions(+), 171 deletions(-) diff --git a/legacy/eet/AUTHORS b/legacy/eet/AUTHORS index b0d25b1d22..cd5fc41184 100644 --- a/legacy/eet/AUTHORS +++ b/legacy/eet/AUTHORS @@ -8,3 +8,4 @@ Vincent Torri Gustavo Sverzut Barbieri Raphael Kubo da Costa Mathieu Taillefumier +Albin "Lutin" Tonnerre diff --git a/legacy/eet/ChangeLog b/legacy/eet/ChangeLog index 9c09b10af6..f71ff865c8 100644 --- a/legacy/eet/ChangeLog +++ b/legacy/eet/ChangeLog @@ -299,7 +299,7 @@ 2010-01-04 Carsten Haitzler (The Rasterman) * Fix another thread deadlock in mutex handling even in a single-threaded app. - + 2010-01-12 Cedric BAIL * Rewrite Eet_Data. Now you can do list/hash/array of strings and all @@ -334,3 +334,6 @@ * Improve security by zeroying cipher material as soon as possible. +2010-03-01 Albin Tonnerre + + * Fix override of global symbols. diff --git a/legacy/eet/src/lib/eet_data.c b/legacy/eet/src/lib/eet_data.c index 34a3b2bde7..284c57fb07 100644 --- a/legacy/eet/src/lib/eet_data.c +++ b/legacy/eet/src/lib/eet_data.c @@ -448,11 +448,11 @@ eet_data_get_string_hash(const Eet_Dictionary *ed, const void *src, const void * { if (ed) { - int index; + int idx; - if (eet_data_get_int(ed, src, src_end, &index) < 0) return -1; + if (eet_data_get_int(ed, src, src_end, &idx) < 0) return -1; - return eet_dictionary_string_get_hash(ed, index); + return eet_dictionary_string_get_hash(ed, idx); } return -1; @@ -468,16 +468,16 @@ eet_data_get_string(const Eet_Dictionary *ed, const void *src, const void *src_e if (ed) { const char *str; - int index; + int idx; - if (eet_data_get_int(ed, src, src_end, &index) < 0) return -1; + if (eet_data_get_int(ed, src, src_end, &idx) < 0) return -1; - str = eet_dictionary_string_get_char(ed, index); + str = eet_dictionary_string_get_char(ed, idx); if (str == NULL) return -1; *d = (char *) str; - return eet_dictionary_string_get_size(ed, index); + return eet_dictionary_string_get_size(ed, idx); } s = (char *)src; @@ -500,15 +500,15 @@ eet_data_put_string(Eet_Dictionary *ed, const void *src, int *size_ret) if (ed) { const char *str; - int index; + int idx; str = *((const char **) src); if (!str) return NULL; - index = eet_dictionary_string_add(ed, str); - if (index == -1) return NULL; + idx = eet_dictionary_string_add(ed, str); + if (idx == -1) return NULL; - return eet_data_put_int(ed, &index, size_ret); + return eet_data_put_int(ed, &idx, size_ret); } s = (char *)(*((char **)src)); @@ -598,7 +598,7 @@ static int eet_data_get_float(const Eet_Dictionary *ed, const void *src, const void *src_end, void *dst) { float *d; - int index; + int idx; d = (float *) dst; if (!ed) @@ -621,9 +621,9 @@ eet_data_get_float(const Eet_Dictionary *ed, const void *src, const void *src_en return len + 1; } - if (eet_data_get_int(ed, src, src_end, &index) < 0) return -1; + if (eet_data_get_int(ed, src, src_end, &idx) < 0) return -1; - if (!eet_dictionary_string_get_float(ed, index, d)) + if (!eet_dictionary_string_get_float(ed, idx, d)) return -1; return 1; } @@ -632,7 +632,7 @@ static void * eet_data_put_float(Eet_Dictionary *ed, const void *src, int *size_ret) { char buf[128]; - int index; + int idx; eina_convert_dtoa((double)(*(float *)src), buf); @@ -649,10 +649,10 @@ eet_data_put_float(Eet_Dictionary *ed, const void *src, int *size_ret) return d; } - index = eet_dictionary_string_add(ed, buf); - if (index == -1) return NULL; + idx = eet_dictionary_string_add(ed, buf); + if (idx == -1) return NULL; - return eet_data_put_int(ed, &index, size_ret); + return eet_data_put_int(ed, &idx, size_ret); } /* DOUBLE TYPE */ @@ -660,7 +660,7 @@ static int eet_data_get_double(const Eet_Dictionary *ed, const void *src, const void *src_end, void *dst) { double *d; - int index; + int idx; d = (double *) dst; @@ -684,9 +684,9 @@ eet_data_get_double(const Eet_Dictionary *ed, const void *src, const void *src_e return len + 1; } - if (eet_data_get_int(ed, src, src_end, &index) < 0) return -1; + if (eet_data_get_int(ed, src, src_end, &idx) < 0) return -1; - if (!eet_dictionary_string_get_double(ed, index, d)) + if (!eet_dictionary_string_get_double(ed, idx, d)) return -1; return 1; } @@ -695,7 +695,7 @@ static void * eet_data_put_double(Eet_Dictionary *ed, const void *src, int *size_ret) { char buf[128]; - int index; + int idx; eina_convert_dtoa((double)(*(double *)src), buf); @@ -713,25 +713,25 @@ eet_data_put_double(Eet_Dictionary *ed, const void *src, int *size_ret) return d; } - index = eet_dictionary_string_add(ed, buf); - if (index == -1) return NULL; + idx = eet_dictionary_string_add(ed, buf); + if (idx == -1) return NULL; - return eet_data_put_int(ed, &index, size_ret); + return eet_data_put_int(ed, &idx, size_ret); } static int eet_data_get_f32p32(const Eet_Dictionary *ed, const void *src, const void *src_end, void *dst) { Eina_F32p32 *fp; - int index; + int idx; fp = (Eina_F32p32*) dst; if (!ed) return -1; - if (eet_data_get_int(ed, src, src_end, &index) < 0) return -1; + if (eet_data_get_int(ed, src, src_end, &idx) < 0) return -1; - if (!eet_dictionary_string_get_fp(ed, index, fp)) + if (!eet_dictionary_string_get_fp(ed, idx, fp)) return -1; return 1; } @@ -740,16 +740,16 @@ static void * eet_data_put_f32p32(Eet_Dictionary *ed, const void *src, int *size_ret) { char buf[128]; - int index; + int idx; if (!ed) return NULL; eina_convert_fptoa((Eina_F32p32)(*(Eina_F32p32 *)src), buf); - index = eet_dictionary_string_add(ed, buf); - if (index == -1) return NULL; + idx = eet_dictionary_string_add(ed, buf); + if (idx == -1) return NULL; - return eet_data_put_int(ed, &index, size_ret); + return eet_data_put_int(ed, &idx, size_ret); } static int @@ -2744,8 +2744,6 @@ eet_data_get_array(Eet_Free_Context *context, const Eet_Dictionary *ed, Eet_Data if (IS_POINTER_TYPE(echnk->type)) { - int ret; - ret = eet_data_get_unknown(context, ed, edd, ede, echnk, echnk->type, EET_G_UNKNOWN, &data_ret, p, size); if (!ret) goto on_error; diff --git a/legacy/eet/src/lib/eet_dictionary.c b/legacy/eet/src/lib/eet_dictionary.c index 14db95faf6..42dbd1ba18 100644 --- a/legacy/eet/src/lib/eet_dictionary.c +++ b/legacy/eet/src/lib/eet_dictionary.c @@ -81,7 +81,7 @@ eet_dictionary_string_add(Eet_Dictionary *ed, const char *string) Eet_String *current; char *str; int hash; - int index; + int idx; int len; if (!ed) @@ -89,19 +89,19 @@ eet_dictionary_string_add(Eet_Dictionary *ed, const char *string) hash = _eet_hash_gen(string, 8); - index = _eet_dictionary_lookup(ed, string, hash); + idx = _eet_dictionary_lookup(ed, string, hash); - if (index != -1) + if (idx != -1) { - if (ed->all[index].str) + if (ed->all[idx].str) { - if (strcmp(ed->all[index].str, string) == 0) - return index; + if (strcmp(ed->all[idx].str, string) == 0) + return idx; } - if (ed->all[index].mmap) + if (ed->all[idx].mmap) { - if (strcmp(ed->all[index].mmap, string) == 0) - return index; + if (strcmp(ed->all[idx].mmap, string) == 0) + return idx; } } @@ -135,7 +135,7 @@ eet_dictionary_string_add(Eet_Dictionary *ed, const char *string) current->len = len; current->mmap = NULL; - if (index == -1) + if (idx == -1) { current->next = ed->hash[hash]; current->prev = -1; @@ -143,8 +143,8 @@ eet_dictionary_string_add(Eet_Dictionary *ed, const char *string) } else { - current->next = index; - current->prev = ed->all[index].prev; + current->next = idx; + current->prev = ed->all[idx].prev; if (current->next != -1) ed->all[current->next].prev = ed->count; @@ -158,44 +158,44 @@ eet_dictionary_string_add(Eet_Dictionary *ed, const char *string) } int -eet_dictionary_string_get_size(const Eet_Dictionary *ed, int index) +eet_dictionary_string_get_size(const Eet_Dictionary *ed, int idx) { if (!ed) return 0; - if (index < 0) return 0; - if (index < ed->count) - return ed->all[index].len; + if (idx < 0) return 0; + if (idx < ed->count) + return ed->all[idx].len; return 0; } int -eet_dictionary_string_get_hash(const Eet_Dictionary *ed, int index) +eet_dictionary_string_get_hash(const Eet_Dictionary *ed, int idx) { if (!ed) return -1; - if (index < 0) return -1; - if (index < ed->count) - return ed->all[index].hash; + if (idx < 0) return -1; + if (idx < ed->count) + return ed->all[idx].hash; return -1; } const char * -eet_dictionary_string_get_char(const Eet_Dictionary *ed, int index) +eet_dictionary_string_get_char(const Eet_Dictionary *ed, int idx) { if (!ed) return NULL; - if (index < 0) return NULL; - if (index < ed->count) + if (idx < 0) return NULL; + if (idx < ed->count) { #ifdef _WIN32 /* Windows file system could change the mmaped file when replacing a file. So we need to copy all string in memory to avoid bugs. */ - if (ed->all[index].str == NULL) + if (ed->all[idx].str == NULL) { - ed->all[index].str = strdup(ed->all[index].mmap); - ed->all[index].mmap = NULL; + ed->all[idx].str = strdup(ed->all[idx].mmap); + ed->all[idx].mmap = NULL; } #else - if (ed->all[index].mmap) - return ed->all[index].mmap; + if (ed->all[idx].mmap) + return ed->all[idx].mmap; #endif - return ed->all[index].str; + return ed->all[idx].str; } return NULL; } @@ -246,93 +246,93 @@ _eet_dictionary_string_get_double_cache(const char *s, int len, double *result) } static inline Eina_Bool -_eet_dictionary_test(const Eet_Dictionary *ed, int index, void *result) +_eet_dictionary_test(const Eet_Dictionary *ed, int idx, void *result) { if (!result) return EINA_FALSE; if (!ed) return EINA_FALSE; - if (index < 0) return EINA_FALSE; - if (!(index < ed->count)) return EINA_FALSE; + if (idx < 0) return EINA_FALSE; + if (!(idx < ed->count)) return EINA_FALSE; return EINA_TRUE; } Eina_Bool -eet_dictionary_string_get_float(const Eet_Dictionary *ed, int index, float *result) +eet_dictionary_string_get_float(const Eet_Dictionary *ed, int idx, float *result) { - if (!_eet_dictionary_test(ed, index, result)) return EINA_FALSE; + if (!_eet_dictionary_test(ed, idx, result)) return EINA_FALSE; - if (!(ed->all[index].type & EET_D_FLOAT)) + if (!(ed->all[idx].type & EET_D_FLOAT)) { const char *str; - str = ed->all[index].str ? ed->all[index].str : ed->all[index].mmap; + str = ed->all[idx].str ? ed->all[idx].str : ed->all[idx].mmap; - if (!_eet_dictionary_string_get_float_cache(str, ed->all[index].len, &ed->all[index].f)) + if (!_eet_dictionary_string_get_float_cache(str, ed->all[idx].len, &ed->all[idx].f)) { long long mantisse = 0; long exponent = 0; - if (eina_convert_atod(str, ed->all[index].len, &mantisse, &exponent) == EINA_FALSE) + if (eina_convert_atod(str, ed->all[idx].len, &mantisse, &exponent) == EINA_FALSE) return EINA_FALSE; - ed->all[index].f = ldexpf((float) mantisse, exponent); + ed->all[idx].f = ldexpf((float) mantisse, exponent); } - ed->all[index].type |= EET_D_FLOAT; + ed->all[idx].type |= EET_D_FLOAT; } - *result = ed->all[index].f; + *result = ed->all[idx].f; return EINA_TRUE; } Eina_Bool -eet_dictionary_string_get_double(const Eet_Dictionary *ed, int index, double *result) +eet_dictionary_string_get_double(const Eet_Dictionary *ed, int idx, double *result) { - if (!_eet_dictionary_test(ed, index, result)) return EINA_FALSE; + if (!_eet_dictionary_test(ed, idx, result)) return EINA_FALSE; - if (!(ed->all[index].type & EET_D_DOUBLE)) + if (!(ed->all[idx].type & EET_D_DOUBLE)) { const char *str; - str = ed->all[index].str ? ed->all[index].str : ed->all[index].mmap; + str = ed->all[idx].str ? ed->all[idx].str : ed->all[idx].mmap; - if (!_eet_dictionary_string_get_double_cache(str, ed->all[index].len, &ed->all[index].d)) + if (!_eet_dictionary_string_get_double_cache(str, ed->all[idx].len, &ed->all[idx].d)) { long long mantisse = 0; long exponent = 0; - if (eina_convert_atod(str, ed->all[index].len, &mantisse, &exponent) == EINA_FALSE) + if (eina_convert_atod(str, ed->all[idx].len, &mantisse, &exponent) == EINA_FALSE) return EINA_FALSE; - ed->all[index].d = ldexp((double) mantisse, exponent); + ed->all[idx].d = ldexp((double) mantisse, exponent); } - ed->all[index].type |= EET_D_DOUBLE; + ed->all[idx].type |= EET_D_DOUBLE; } - *result = ed->all[index].d; + *result = ed->all[idx].d; return EINA_TRUE; } Eina_Bool -eet_dictionary_string_get_fp(const Eet_Dictionary *ed, int index, Eina_F32p32 *result) +eet_dictionary_string_get_fp(const Eet_Dictionary *ed, int idx, Eina_F32p32 *result) { - if (!_eet_dictionary_test(ed, index, result)) return EINA_FALSE; + if (!_eet_dictionary_test(ed, idx, result)) return EINA_FALSE; - if (!(ed->all[index].type & EET_D_FIXED_POINT)) + if (!(ed->all[idx].type & EET_D_FIXED_POINT)) { const char *str; Eina_F32p32 fp; - str = ed->all[index].str ? ed->all[index].str : ed->all[index].mmap; + str = ed->all[idx].str ? ed->all[idx].str : ed->all[idx].mmap; - if (!eina_convert_atofp(str, ed->all[index].len, &fp)) + if (!eina_convert_atofp(str, ed->all[idx].len, &fp)) return EINA_FALSE; - ed->all[index].fp = fp; - ed->all[index].type |= EET_D_FIXED_POINT; + ed->all[idx].fp = fp; + ed->all[idx].type |= EET_D_FIXED_POINT; } - *result = ed->all[index].fp; + *result = ed->all[idx].fp; return EINA_TRUE; } diff --git a/legacy/eet/src/lib/eet_image.c b/legacy/eet/src/lib/eet_image.c index cfc3a8b7f2..48618d0fcf 100644 --- a/legacy/eet/src/lib/eet_image.c +++ b/legacy/eet/src/lib/eet_image.c @@ -753,7 +753,7 @@ eet_data_image_jpeg_alpha_convert(int *size, const void *data, unsigned int w, u { const int *ptr; - void *d = NULL; + void *dst = NULL; size_t sz = 0; struct _JPEG_error_mgr jerr; JSAMPROW *jbuf; @@ -769,7 +769,7 @@ eet_data_image_jpeg_alpha_convert(int *size, const void *data, unsigned int w, u if (setjmp(jerr.setjmp_buffer)) return NULL; jpeg_create_compress(&cinfo); - if (eet_jpeg_membuf_dst(&cinfo, &d, &sz)) + if (eet_jpeg_membuf_dst(&cinfo, &dst, &sz)) { jpeg_destroy_compress(&cinfo); return NULL; @@ -812,12 +812,12 @@ eet_data_image_jpeg_alpha_convert(int *size, const void *data, unsigned int w, u jpeg_finish_compress(&cinfo); jpeg_destroy_compress(&cinfo); - d1 = d; + d1 = dst; sz1 = sz; } { const int *ptr; - void *d = NULL; + void *dst = NULL; size_t sz = 0; struct _JPEG_error_mgr jerr; JSAMPROW *jbuf; @@ -837,7 +837,7 @@ eet_data_image_jpeg_alpha_convert(int *size, const void *data, unsigned int w, u } jpeg_create_compress(&cinfo); - if (eet_jpeg_membuf_dst(&cinfo, &d, &sz)) + if (eet_jpeg_membuf_dst(&cinfo, &dst, &sz)) { jpeg_destroy_compress(&cinfo); free(d1); @@ -879,7 +879,7 @@ eet_data_image_jpeg_alpha_convert(int *size, const void *data, unsigned int w, u jpeg_finish_compress(&cinfo); jpeg_destroy_compress(&cinfo); - d2 = d; + d2 = dst; sz2 = sz; } d = malloc(12 + sz1 + sz2); @@ -911,12 +911,12 @@ eet_data_image_jpeg_alpha_convert(int *size, const void *data, unsigned int w, u EAPI int eet_data_image_write_cipher(Eet_File *ef, const char *name, const char *key, const void *data, unsigned int w, unsigned int h, int alpha, - int compress, int quality, int lossy) + int comp, int quality, int lossy) { void *d = NULL; int size = 0; - d = eet_data_image_encode(data, &size, w, h, alpha, compress, quality, lossy); + d = eet_data_image_encode(data, &size, w, h, alpha, comp, quality, lossy); if (d) { int v; @@ -931,16 +931,16 @@ eet_data_image_write_cipher(Eet_File *ef, const char *name, const char *key, EAPI int eet_data_image_write(Eet_File *ef, const char *name, const void *data, unsigned int w, unsigned int h, int alpha, - int compress, int quality, int lossy) + int comp, int quality, int lossy) { - return eet_data_image_write_cipher(ef, name, NULL, data, w, h, alpha, compress, quality, lossy); + return eet_data_image_write_cipher(ef, name, NULL, data, w, h, alpha, comp, quality, lossy); } EAPI void * eet_data_image_read_cipher(Eet_File *ef, const char *name, const char *key, unsigned int *w, unsigned int *h, int *alpha, - int *compress, int *quality, int *lossy) + int *comp, int *quality, int *lossy) { unsigned int *d = NULL; void *data = NULL; @@ -956,7 +956,7 @@ eet_data_image_read_cipher(Eet_File *ef, const char *name, const char *key, if (!data) return NULL; } - d = eet_data_image_decode(data, size, w, h, alpha, compress, quality, lossy); + d = eet_data_image_decode(data, size, w, h, alpha, comp, quality, lossy); if (free_data) free(data); @@ -967,15 +967,15 @@ eet_data_image_read_cipher(Eet_File *ef, const char *name, const char *key, EAPI void * eet_data_image_read(Eet_File *ef, const char *name, unsigned int *w, unsigned int *h, int *alpha, - int *compress, int *quality, int *lossy) + int *comp, int *quality, int *lossy) { - return eet_data_image_read_cipher(ef, name, NULL, w, h, alpha, compress, quality, lossy); + return eet_data_image_read_cipher(ef, name, NULL, w, h, alpha, comp, quality, lossy); } EAPI int eet_data_image_read_to_surface_cipher(Eet_File *ef, const char *name, const char *key, unsigned int src_x, unsigned int src_y, unsigned int *d, unsigned int w, unsigned int h, unsigned int row_stride, - int *alpha, int *compress, int *quality, int *lossy) + int *alpha, int *comp, int *quality, int *lossy) { void *data = NULL; int free_data = 0; @@ -991,7 +991,7 @@ eet_data_image_read_to_surface_cipher(Eet_File *ef, const char *name, const char if (!data) return 0; } - res = eet_data_image_decode_to_surface(data, size, src_x, src_y, d, w, h, row_stride, alpha, compress, quality, lossy); + res = eet_data_image_decode_to_surface(data, size, src_x, src_y, d, w, h, row_stride, alpha, comp, quality, lossy); if (free_data) free(data); @@ -1002,15 +1002,15 @@ eet_data_image_read_to_surface_cipher(Eet_File *ef, const char *name, const char EAPI int eet_data_image_read_to_surface(Eet_File *ef, const char *name, unsigned int src_x, unsigned int src_y, unsigned int *d, unsigned int w, unsigned int h, unsigned int row_stride, - int *alpha, int *compress, int *quality, int *lossy) + int *alpha, int *comp, int *quality, int *lossy) { - return eet_data_image_read_to_surface_cipher(ef, name, NULL, src_x, src_y, d, w, h, row_stride, alpha, compress, quality, lossy); + return eet_data_image_read_to_surface_cipher(ef, name, NULL, src_x, src_y, d, w, h, row_stride, alpha, comp, quality, lossy); } EAPI int eet_data_image_header_read_cipher(Eet_File *ef, const char *name, const char *key, unsigned int *w, unsigned int *h, int *alpha, - int *compress, int *quality, int *lossy) + int *comp, int *quality, int *lossy) { void *data = NULL; int size = 0; @@ -1026,7 +1026,7 @@ eet_data_image_header_read_cipher(Eet_File *ef, const char *name, const char *ke if (!data) return 0; } - d = eet_data_image_header_decode(data, size, w, h, alpha, compress, quality, lossy); + d = eet_data_image_header_decode(data, size, w, h, alpha, comp, quality, lossy); if (free_data) free(data); @@ -1036,14 +1036,14 @@ eet_data_image_header_read_cipher(Eet_File *ef, const char *name, const char *ke EAPI int eet_data_image_header_read(Eet_File *ef, const char *name, unsigned int *w, unsigned int *h, int *alpha, - int *compress, int *quality, int *lossy) + int *comp, int *quality, int *lossy) { - return eet_data_image_header_read_cipher(ef, name, NULL, w, h, alpha, compress, quality, lossy); + return eet_data_image_header_read_cipher(ef, name, NULL, w, h, alpha, comp, quality, lossy); } EAPI void * -eet_data_image_encode_cipher(const void *data, const char *key, unsigned int w, unsigned int h, int alpha, int compress, int quality, int lossy, int *size_ret) +eet_data_image_encode_cipher(const void *data, const char *key, unsigned int w, unsigned int h, int alpha, int comp, int quality, int lossy, int *size_ret) { void *d = NULL; void *ciphered_d = NULL; @@ -1052,12 +1052,12 @@ eet_data_image_encode_cipher(const void *data, const char *key, unsigned int w, if (lossy == 0) { - if (compress > 0) - d = eet_data_image_lossless_compressed_convert(&size, data, w, h, alpha, compress); + if (comp > 0) + d = eet_data_image_lossless_compressed_convert(&size, data, w, h, alpha, comp); /* eet_data_image_lossless_compressed_convert will refuse to compress something if the result is bigger than the entry. */ - if (compress <= 0 || d == NULL) + if (comp <= 0 || d == NULL) d = eet_data_image_lossless_convert(&size, data, w, h, alpha); } else @@ -1084,13 +1084,13 @@ eet_data_image_encode_cipher(const void *data, const char *key, unsigned int w, } EAPI void * -eet_data_image_encode(const void *data, int *size_ret, unsigned int w, unsigned int h, int alpha, int compress, int quality, int lossy) +eet_data_image_encode(const void *data, int *size_ret, unsigned int w, unsigned int h, int alpha, int comp, int quality, int lossy) { - return eet_data_image_encode_cipher(data, NULL, w, h, alpha, compress, quality, lossy, size_ret); + return eet_data_image_encode_cipher(data, NULL, w, h, alpha, comp, quality, lossy, size_ret); } EAPI int -eet_data_image_header_decode_cipher(const void *data, const char *key, int size, unsigned int *w, unsigned int *h, int *alpha, int *compress, int *quality, int *lossy) +eet_data_image_header_decode_cipher(const void *data, const char *key, int size, unsigned int *w, unsigned int *h, int *alpha, int *comp, int *quality, int *lossy) { int header[8]; void *deciphered_d = NULL; @@ -1138,7 +1138,7 @@ eet_data_image_header_decode_cipher(const void *data, const char *key, int size, if (w) *w = iw; if (h) *h = ih; if (alpha) *alpha = al ? 1 : 0; - if (compress) *compress = cp; + if (comp) *comp = cp; if (lossy) *lossy = 0; if (quality) *quality = 100; return 1; @@ -1160,7 +1160,7 @@ eet_data_image_header_decode_cipher(const void *data, const char *key, int size, if (w) *w = iw; if (h) *h = ih; if (alpha) *alpha = 1; - if (compress) *compress = 0; + if (comp) *comp = 0; if (lossy) *lossy = 1; if (quality) *quality = 75; return 1; @@ -1177,7 +1177,7 @@ eet_data_image_header_decode_cipher(const void *data, const char *key, int size, if (w) *w = iw; if (h) *h = ih; if (alpha) *alpha = 0; - if (compress) *compress = 0; + if (comp) *comp = 0; if (lossy) *lossy = 1; if (quality) *quality = 75; return 1; @@ -1187,9 +1187,9 @@ eet_data_image_header_decode_cipher(const void *data, const char *key, int size, } EAPI int -eet_data_image_header_decode(const void *data, int size, unsigned int *w, unsigned int *h, int *alpha, int *compress, int *quality, int *lossy) +eet_data_image_header_decode(const void *data, int size, unsigned int *w, unsigned int *h, int *alpha, int *comp, int *quality, int *lossy) { - return eet_data_image_header_decode_cipher(data, NULL, size, w, h, alpha, compress, quality, lossy); + return eet_data_image_header_decode_cipher(data, NULL, size, w, h, alpha, comp, quality, lossy); } static void @@ -1217,14 +1217,14 @@ static int _eet_data_image_decode_inside(const void *data, int size, unsigned int src_x, unsigned int src_y, unsigned int src_w, unsigned int src_h, unsigned int *d, unsigned int w, unsigned int h, unsigned int row_stride, - int alpha, int compress, int quality, int lossy) + int alpha, int comp, int quality, int lossy) { if (lossy == 0 && quality == 100) { unsigned int *body; body = ((unsigned int *)data) + 8; - if (!compress) + if (!comp) { _eet_data_image_copy_buffer(body, src_x, src_y, src_w, d, w, h, row_stride); } @@ -1263,7 +1263,7 @@ _eet_data_image_decode_inside(const void *data, int size, unsigned int src_x, un for (x = 0; x < (w * h); x++) SWAP32(d[x]); } } - else if (compress == 0 && lossy == 1) + else if (comp == 0 && lossy == 1) { if (alpha) { @@ -1306,7 +1306,7 @@ _eet_data_image_decode_inside(const void *data, int size, unsigned int src_x, un } EAPI void * -eet_data_image_decode_cipher(const void *data, const char *key, int size, unsigned int *w, unsigned int *h, int *alpha, int *compress, int *quality, int *lossy) +eet_data_image_decode_cipher(const void *data, const char *key, int size, unsigned int *w, unsigned int *h, int *alpha, int *comp, int *quality, int *lossy) { unsigned int *d = NULL; unsigned int iw, ih; @@ -1341,7 +1341,7 @@ eet_data_image_decode_cipher(const void *data, const char *key, int size, unsign if (w) *w = iw; if (h) *h = ih; if (alpha) *alpha = ialpha; - if (compress) *compress = icompress; + if (comp) *comp = icompress; if (quality) *quality = iquality; if (lossy) *lossy = ilossy; @@ -1349,15 +1349,15 @@ eet_data_image_decode_cipher(const void *data, const char *key, int size, unsign } EAPI void * -eet_data_image_decode(const void *data, int size, unsigned int *w, unsigned int *h, int *alpha, int *compress, int *quality, int *lossy) +eet_data_image_decode(const void *data, int size, unsigned int *w, unsigned int *h, int *alpha, int *comp, int *quality, int *lossy) { - return eet_data_image_decode_cipher(data, NULL, size, w, h, alpha, compress, quality, lossy); + return eet_data_image_decode_cipher(data, NULL, size, w, h, alpha, comp, quality, lossy); } EAPI int eet_data_image_decode_to_surface_cipher(const void *data, const char *key, int size, unsigned int src_x, unsigned int src_y, unsigned int *d, unsigned int w, unsigned int h, unsigned int row_stride, - int *alpha, int *compress, int *quality, int *lossy) + int *alpha, int *comp, int *quality, int *lossy) { unsigned int iw, ih; int ialpha, icompress, iquality, ilossy; @@ -1387,7 +1387,7 @@ eet_data_image_decode_to_surface_cipher(const void *data, const char *key, int s return 0; if (alpha) *alpha = ialpha; - if (compress) *compress = icompress; + if (comp) *comp = icompress; if (quality) *quality = iquality; if (lossy) *lossy = ilossy; @@ -1397,7 +1397,7 @@ eet_data_image_decode_to_surface_cipher(const void *data, const char *key, int s EAPI int eet_data_image_decode_to_surface(const void *data, int size, unsigned int src_x, unsigned int src_y, unsigned int *d, unsigned int w, unsigned int h, unsigned int row_stride, - int *alpha, int *compress, int *quality, int *lossy) + int *alpha, int *comp, int *quality, int *lossy) { - return eet_data_image_decode_to_surface_cipher(data, NULL, size, src_x, src_y, d, w, h, row_stride, alpha, compress, quality, lossy); + return eet_data_image_decode_to_surface_cipher(data, NULL, size, src_x, src_y, d, w, h, row_stride, alpha, comp, quality, lossy); } diff --git a/legacy/eet/src/lib/eet_lib.c b/legacy/eet/src/lib/eet_lib.c index c9f8574b79..9554963362 100644 --- a/legacy/eet/src/lib/eet_lib.c +++ b/legacy/eet/src/lib/eet_lib.c @@ -898,7 +898,7 @@ eet_internal_read2(Eet_File *ef) { const int *data = (const int*) ef->data; const char *start = (const char*) ef->data; - int index = 0; + int idx = 0; int num_directory_entries; int bytes_directory_entries; int num_dictionary_entries; @@ -906,7 +906,7 @@ eet_internal_read2(Eet_File *ef) int signature_base_offset; int i; - index += sizeof(int); + idx += sizeof(int); if (eet_test_close((int) ntohl(*data) != EET_MAGIC_FILE2, ef)) return NULL; data++; @@ -919,9 +919,9 @@ eet_internal_read2(Eet_File *ef) } /* get entries count and byte count */ - GET_INT(num_directory_entries, data, index); + GET_INT(num_directory_entries, data, idx); /* get dictionary count and byte count */ - GET_INT(num_dictionary_entries, data, index); + GET_INT(num_dictionary_entries, data, idx); bytes_directory_entries = EET_FILE2_DIRECTORY_ENTRY_SIZE * num_directory_entries + EET_FILE2_HEADER_SIZE; bytes_dictionary_entries = EET_FILE2_DICTIONARY_ENTRY_SIZE * num_dictionary_entries; @@ -972,12 +972,12 @@ eet_internal_read2(Eet_File *ef) return NULL; /* get entrie header */ - GET_INT(efn->offset, data, index); - GET_INT(efn->size, data, index); - GET_INT(efn->data_size, data, index); - GET_INT(name_offset, data, index); - GET_INT(name_size, data, index); - GET_INT(flag, data, index); + GET_INT(efn->offset, data, idx); + GET_INT(efn->size, data, idx); + GET_INT(efn->data_size, data, idx); + GET_INT(name_offset, data, idx); + GET_INT(name_size, data, idx); + GET_INT(flag, data, idx); efn->compression = flag & 0x1 ? 1 : 0; efn->ciphered = flag & 0x2 ? 1 : 0; @@ -1035,7 +1035,7 @@ eet_internal_read2(Eet_File *ef) const int *dico = (const int*) ef->data + EET_FILE2_DIRECTORY_ENTRY_COUNT * num_directory_entries + EET_FILE2_HEADER_COUNT; int j; - if (eet_test_close((num_dictionary_entries * (int) EET_FILE2_DICTIONARY_ENTRY_SIZE + index) > (bytes_dictionary_entries + bytes_directory_entries), ef)) + if (eet_test_close((num_dictionary_entries * (int) EET_FILE2_DICTIONARY_ENTRY_SIZE + idx) > (bytes_dictionary_entries + bytes_directory_entries), ef)) return NULL; ef->ed = calloc(1, sizeof (Eet_Dictionary)); @@ -1054,11 +1054,11 @@ eet_internal_read2(Eet_File *ef) int hash; int offset; - GET_INT(hash, dico, index); - GET_INT(offset, dico, index); - GET_INT(ef->ed->all[j].len, dico, index); - GET_INT(ef->ed->all[j].prev, dico, index); - GET_INT(ef->ed->all[j].next, dico, index); + GET_INT(hash, dico, idx); + GET_INT(offset, dico, idx); + GET_INT(ef->ed->all[j].len, dico, idx); + GET_INT(ef->ed->all[j].prev, dico, idx); + GET_INT(ef->ed->all[j].next, dico, idx); /* Hash value could be stored on 8bits data, but this will break alignment of all the others data. So stick to int and check the value. */ @@ -1120,7 +1120,7 @@ eet_internal_read1(Eet_File *ef) { const unsigned char *dyn_buf = NULL; const unsigned char *p = NULL; - int index = 0; + int idx = 0; int num_entries; int byte_entries; int i; @@ -1129,7 +1129,7 @@ eet_internal_read1(Eet_File *ef) /* build header table if read mode */ /* geat header */ - index += sizeof(int); + idx += sizeof(int); if (eet_test_close((int)ntohl(*((int *)ef->data)) != EET_MAGIC_FILE, ef)) return NULL; @@ -1142,8 +1142,8 @@ eet_internal_read1(Eet_File *ef) } /* get entries count and byte count */ - EXTRACT_INT(num_entries, ef->data, index); - EXTRACT_INT(byte_entries, ef->data, index); + EXTRACT_INT(num_entries, ef->data, idx); + EXTRACT_INT(byte_entries, ef->data, idx); /* we cant have <= 0 values here - invalid */ if (eet_test_close((num_entries <= 0) || (byte_entries <= 0), ef)) @@ -1177,7 +1177,7 @@ eet_internal_read1(Eet_File *ef) return NULL; /* actually read the directory block - all of it, into ram */ - dyn_buf = ef->data + index; + dyn_buf = ef->data + idx; /* parse directory block */ p = dyn_buf; @@ -1844,7 +1844,7 @@ eet_read_direct(Eet_File *ef, const char *name, int *size_ret) } EAPI int -eet_write_cipher(Eet_File *ef, const char *name, const void *data, int size, int compress, const char *cipher_key) +eet_write_cipher(Eet_File *ef, const char *name, const void *data, int size, int comp, const char *cipher_key) { Eet_File_Node *efn; void *data2 = NULL; @@ -1895,16 +1895,16 @@ eet_write_cipher(Eet_File *ef, const char *name, const void *data, int size, int /* figure hash bucket */ hash = _eet_hash_gen(name, ef->header->directory->size); - data_size = compress ? 12 + ((size * 101) / 100) : size; + data_size = comp ? 12 + ((size * 101) / 100) : size; - if (compress || !cipher_key) + if (comp || !cipher_key) { data2 = malloc(data_size); if (!data2) goto on_error; } /* if we want to compress */ - if (compress) + if (comp) { uLongf buflen; @@ -1920,7 +1920,7 @@ eet_write_cipher(Eet_File *ef, const char *name, const void *data, int size, int data_size = (int)buflen; if (data_size < 0 || data_size >= size) { - compress = 0; + comp = 0; data_size = size; } else @@ -1954,7 +1954,7 @@ eet_write_cipher(Eet_File *ef, const char *name, const void *data, int size, int } } else - if (!compress) + if (!comp) memcpy(data2, data, size); /* Does this node already exist? */ @@ -1965,7 +1965,7 @@ eet_write_cipher(Eet_File *ef, const char *name, const void *data, int size, int { free(efn->data); efn->ciphered = cipher_key ? 1 : 0; - efn->compression = !!compress; + efn->compression = !!comp; efn->size = data_size; efn->data_size = size; efn->data = data2; @@ -1990,7 +1990,7 @@ eet_write_cipher(Eet_File *ef, const char *name, const void *data, int size, int ef->header->directory->nodes[hash] = efn; efn->offset = -1; efn->ciphered = cipher_key ? 1 : 0; - efn->compression = !!compress; + efn->compression = !!comp; efn->size = data_size; efn->data_size = size; efn->data = data2; @@ -2007,9 +2007,9 @@ eet_write_cipher(Eet_File *ef, const char *name, const void *data, int size, int } EAPI int -eet_write(Eet_File *ef, const char *name, const void *data, int size, int compress) +eet_write(Eet_File *ef, const char *name, const void *data, int size, int comp) { - return eet_write_cipher(ef, name, data, size, compress, NULL); + return eet_write_cipher(ef, name, data, size, comp, NULL); } EAPI int diff --git a/legacy/eet/src/lib/eet_node.c b/legacy/eet/src/lib/eet_node.c index 6905090a8f..6f33dda0a6 100644 --- a/legacy/eet/src/lib/eet_node.c +++ b/legacy/eet/src/lib/eet_node.c @@ -626,8 +626,8 @@ eet_node_walk(void *parent, const char *name, Eet_Node *root, Eet_Node_Walk *cb, int eet_node_init(void) { - char *choice; - char *tmp; + const char *choice; + const char *tmp; choice = "chained_mempool"; tmp = getenv("EET_MEMPOOL");