From: tasn Date: Mon, 16 Aug 2010 10:46:56 +0000 (+0000) Subject: Evas: Fixed many compilation warnings. X-Git-Tag: accepted/2.0/20130306.225542~242^2~1668 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ef11476383ea301ef08ba77eb34765939aa9ca54;p=profile%2Fivi%2Fevas.git Evas: Fixed many compilation warnings. 1. Fixed evas_common_encoding_utf8 functions to get char * instead of unsigned char * and return Eina_Unicode instead of int. 2. Removed a couple of unused variables. 3. Removed deprecated evas_common_font_utf8* functions. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@51200 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/src/lib/canvas/evas_object_text.c b/src/lib/canvas/evas_object_text.c index a47b3ab..2ce8c8a 100644 --- a/src/lib/canvas/evas_object_text.c +++ b/src/lib/canvas/evas_object_text.c @@ -336,7 +336,7 @@ evas_object_text_text_set(Evas_Object *obj, const char *_text) return; MAGIC_CHECK_END(); - text = evas_common_encoding_utf8_to_unicode((unsigned char *) _text, NULL); + text = evas_common_encoding_utf8_to_unicode(_text, NULL); if (!text) text = eina_unicode_strdup(EINA_UNICODE_EMPTY_STRING); if ((o->cur.text) && (text) && (!eina_unicode_strcmp(o->cur.text, text))) @@ -1296,7 +1296,7 @@ evas_string_char_next_get(const char *str, int pos, int *decoded) if (decoded) *decoded = 0; if ((!str) || (pos < 0)) return 0; p = pos; - d = evas_common_encoding_utf8_get_next((unsigned char *)str, &p); + d = evas_common_encoding_utf8_get_next(str, &p); if (decoded) *decoded = d; return p; } @@ -1316,7 +1316,7 @@ evas_string_char_prev_get(const char *str, int pos, int *decoded) if (decoded) *decoded = 0; if ((!str) || (pos < 1)) return 0; p = pos; - d = evas_common_encoding_utf8_get_prev((unsigned char *)str, &p); + d = evas_common_encoding_utf8_get_prev(str, &p); if (decoded) *decoded = d; return p; } @@ -1331,7 +1331,7 @@ EAPI int evas_string_char_len_get(const char *str) { if (!str) return 0; - return evas_common_encoding_utf8_get_len((const unsigned char *) str); + return evas_common_encoding_utf8_get_len(str); } /** diff --git a/src/lib/canvas/evas_object_textblock.c b/src/lib/canvas/evas_object_textblock.c index 9a9375b..743582b 100644 --- a/src/lib/canvas/evas_object_textblock.c +++ b/src/lib/canvas/evas_object_textblock.c @@ -2424,8 +2424,7 @@ _layout_text_append(Ctxt *c, Evas_Object_Textblock_Format *fmt, Evas_Object_Text str = alloca((len + 1) * sizeof(Eina_Unicode)); tbase = str; ind = 0; - urepch = evas_common_encoding_utf8_get_next( - (const unsigned char *)repch, &ind); + urepch = evas_common_encoding_utf8_get_next(repch, &ind); for (i = 0, ptr = (Eina_Unicode *)tbase; i < len; ptr++, i++) *ptr = urepch; *ptr = 0; @@ -4132,7 +4131,7 @@ _evas_textblock_cursor_node_format_at_pos_get(const Evas_Textblock_Cursor *cur) { Evas_Object_Textblock_Node_Format *node; Evas_Object_Textblock_Node_Format *itr; - size_t position = 0; + int position = 0; if (!cur->node) return NULL; @@ -5493,7 +5492,7 @@ evas_textblock_cursor_text_append(Evas_Textblock_Cursor *cur, const char *_text) int len = 0; if (!cur) return 0; - text = evas_common_encoding_utf8_to_unicode((const unsigned char *) _text, &len); + text = evas_common_encoding_utf8_to_unicode(_text, &len); o = (Evas_Object_Textblock *)(cur->obj->object_data); /* Update all the cursors after our position. */ _evas_textblock_cursors_update_offset(cur, cur->node, cur->pos, len); diff --git a/src/lib/engines/common/evas_bidi_utils.c b/src/lib/engines/common/evas_bidi_utils.c index d8b4141..d358bcf 100644 --- a/src/lib/engines/common/evas_bidi_utils.c +++ b/src/lib/engines/common/evas_bidi_utils.c @@ -46,8 +46,6 @@ Eina_Bool evas_bidi_is_rtl_str(const Eina_Unicode *str) { - int i = 0; - int ch; EvasBiDiCharType type; if (!str) diff --git a/src/lib/engines/common/evas_encoding.c b/src/lib/engines/common/evas_encoding.c index d25c1f8..24989b1 100644 --- a/src/lib/engines/common/evas_encoding.c +++ b/src/lib/engines/common/evas_encoding.c @@ -1,8 +1,8 @@ #include "evas_common.h" #include "evas_encoding.h" -EAPI int -evas_common_encoding_utf8_get_next(const unsigned char *buf, int *iindex) +EAPI Eina_Unicode +evas_common_encoding_utf8_get_next(const char *buf, int *iindex) { /* Reads UTF8 bytes from @buf, starting at *@index and returns * the decoded code point at iindex offset, and advances iindex @@ -63,8 +63,8 @@ evas_common_encoding_utf8_get_next(const unsigned char *buf, int *iindex) return r; } -EAPI int -evas_common_encoding_utf8_get_prev(const unsigned char *buf, int *iindex) +EAPI Eina_Unicode +evas_common_encoding_utf8_get_prev(const char *buf, int *iindex) { /* Reads UTF8 bytes from @buf, starting at *@index and returns * the decoded code point at iindex offset, and advances iindex @@ -93,8 +93,8 @@ evas_common_encoding_utf8_get_prev(const unsigned char *buf, int *iindex) return r; } -EAPI int -evas_common_encoding_utf8_get_last(const unsigned char *buf, int buflen) +EAPI Eina_Unicode +evas_common_encoding_utf8_get_last(const char *buf, int buflen) { /* jumps to the nul byte at the buffer end and decodes backwards and * returns the offset index byte in the buffer where the last character @@ -124,7 +124,7 @@ evas_common_encoding_utf8_get_last(const unsigned char *buf, int buflen) } EAPI int -evas_common_encoding_utf8_get_len(const unsigned char *buf) +evas_common_encoding_utf8_get_len(const char *buf) { /* returns the number of utf8 characters (not bytes) in the string */ int index = 0, len = 0; @@ -140,7 +140,7 @@ evas_common_encoding_utf8_get_len(const unsigned char *buf) /* FIXME: Should optimize! */ EAPI Eina_Unicode * -evas_common_encoding_utf8_to_unicode(const unsigned char *utf, int *_len) +evas_common_encoding_utf8_to_unicode(const char *utf, int *_len) { int len, i; int index; diff --git a/src/lib/engines/common/evas_encoding.h b/src/lib/engines/common/evas_encoding.h index 4095b63..e278727 100644 --- a/src/lib/engines/common/evas_encoding.h +++ b/src/lib/engines/common/evas_encoding.h @@ -5,20 +5,20 @@ /* FIXME: An assumption that will probably break in the future */ #define EVAS_ENCODING_UTF8_BYTES_PER_CHAR 4 -EAPI int -evas_common_encoding_utf8_get_next(const unsigned char *buf, int *iindex); +EAPI Eina_Unicode +evas_common_encoding_utf8_get_next(const char *buf, int *iindex); -EAPI int -evas_common_encoding_utf8_get_prev(const unsigned char *buf, int *iindex); +EAPI Eina_Unicode +evas_common_encoding_utf8_get_prev(const char *buf, int *iindex); -EAPI int -evas_common_encoding_utf8_get_last(const unsigned char *buf, int buflen); +EAPI Eina_Unicode +evas_common_encoding_utf8_get_last(const char *buf, int buflen); EAPI int -evas_common_encoding_utf8_get_len(const unsigned char *buf); +evas_common_encoding_utf8_get_len(const char *buf); EAPI Eina_Unicode * -evas_common_encoding_utf8_to_unicode(const unsigned char *utf, int *_len) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_MALLOC; +evas_common_encoding_utf8_to_unicode(const char *utf, int *_len) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_MALLOC; EAPI char * evas_common_encoding_unicode_to_utf8(const Eina_Unicode *uni, int *_len) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_MALLOC; diff --git a/src/lib/engines/common/evas_font_draw.c b/src/lib/engines/common/evas_font_draw.c index a3ff820..a94a063 100644 --- a/src/lib/engines/common/evas_font_draw.c +++ b/src/lib/engines/common/evas_font_draw.c @@ -39,9 +39,11 @@ struct cinfo { }; +#if defined(METRIC_CACHE) || defined(WORD_CACHE) LK(lock_words); // for word cache call static Eina_Inlist *words = NULL; static struct prword *evas_font_word_prerender(RGBA_Draw_Context *dc, const Eina_Unicode *text, Evas_BiDi_Props *intl_props, int len, RGBA_Font *fn, RGBA_Font_Int *fi,int use_kerning); +#endif EAPI void evas_common_font_draw_init(void) @@ -399,14 +401,11 @@ evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font { int pen_x, pen_y; int last_adv; - int chr; const Eina_Unicode *text = in_text; - int len; FT_Face pface = NULL; FT_UInt prev_index; DATA32 *im; int c; - char *p; int char_index = 0; /* the index of the current char */ @@ -446,7 +445,7 @@ evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font } if (xrun < 1) return; -#ifdef WORD_CACHE +# ifdef WORD_CACHE if (word->im){ for (j = rowstart ; j < rowend ; j ++){ func(NULL, word->im + (word->roww * j) + xstart, dc->col.col, @@ -454,7 +453,7 @@ evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font } return; } -#elif defined(METRIC_CACHE) +# elif defined(METRIC_CACHE) int ind; y += word->baseline; for (ind = 0 ; ind < len ; ind ++){ @@ -480,7 +479,7 @@ evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font } } return; -#endif +# endif } } @@ -802,6 +801,8 @@ evas_common_font_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font *fn, int /* FIXME: Where is it freed at? */ +/* Only used if cache is on */ +#if defined(METRIC_CACHE) || defined(WORD_CACHE) struct prword * evas_font_word_prerender(RGBA_Draw_Context *dc, const Eina_Unicode *in_text, Evas_BiDi_Props *intl_props, int len, RGBA_Font *fn, RGBA_Font_Int *fi,int use_kerning){ int pen_x, pen_y; @@ -819,10 +820,10 @@ evas_font_word_prerender(RGBA_Draw_Context *dc, const Eina_Unicode *in_text, Eva struct prword *w; int gl; -#ifndef METRIC_CACHE +# ifndef METRIC_CACHE gl = dc->font_ext.func.gl_new ? 1: 0; if (gl) return NULL; -#endif +# endif LKL(lock_words); @@ -866,7 +867,7 @@ evas_font_word_prerender(RGBA_Draw_Context *dc, const Eina_Unicode *in_text, Eva (pface == fi->src->ft.face)) { int kern = 0; -#ifdef BIDI_SUPPORT +# ifdef BIDI_SUPPORT /* if it's rtl, the kerning matching should be reversed, i.e prev * index is now the index and the other way around. * There is a slight exception when there are compositing chars @@ -879,7 +880,7 @@ evas_font_word_prerender(RGBA_Draw_Context *dc, const Eina_Unicode *in_text, Eva ci->pos.x += kern; } else -#endif +# endif { if (evas_common_font_query_kerning(fi, prev_index, ci->index, &kern)) @@ -955,6 +956,7 @@ evas_font_word_prerender(RGBA_Draw_Context *dc, const Eina_Unicode *in_text, Eva return save; } +#endif diff --git a/src/lib/engines/common/evas_font_main.c b/src/lib/engines/common/evas_font_main.c index c4176d1..1dab2fe 100644 --- a/src/lib/engines/common/evas_font_main.c +++ b/src/lib/engines/common/evas_font_main.c @@ -57,8 +57,7 @@ evas_common_font_font_all_unload(void) EAPI int evas_common_font_ascent_get(RGBA_Font *fn) { - int val, dv; - int ret; + int val; RGBA_Font_Int *fi; // evas_common_font_size_use(fn); @@ -110,8 +109,7 @@ evas_common_font_ascent_get(RGBA_Font *fn) EAPI int evas_common_font_descent_get(RGBA_Font *fn) { - int val, dv; - int ret; + int val; RGBA_Font_Int *fi; // evas_common_font_size_use(fn); @@ -183,8 +181,7 @@ evas_common_font_max_descent_get(RGBA_Font *fn) EAPI int evas_common_font_get_line_advance(RGBA_Font *fn) { - int val, dv; - int ret; + int val; RGBA_Font_Int *fi; // evas_common_font_size_use(fn); @@ -205,27 +202,3 @@ evas_common_font_get_line_advance(RGBA_Font *fn) // return ret; } -/*DEPRECATED! Should use evas_common_encoding_* instead */ -EAPI int -evas_common_font_utf8_get_next(const unsigned char *buf, int *iindex) -{ - return evas_common_encoding_utf8_get_next(buf, iindex); -} - -EAPI int -evas_common_font_utf8_get_prev(const unsigned char *buf, int *iindex) -{ - return evas_common_encoding_utf8_get_prev(buf, iindex); -} - -EAPI int -evas_common_font_utf8_get_last(const unsigned char *buf, int buflen) -{ - return evas_common_encoding_utf8_get_last(buf, buflen); -} - -EAPI int -evas_common_font_utf8_get_len(const unsigned char *buf) -{ - return evas_common_encoding_utf8_get_len(buf); -} diff --git a/src/lib/engines/common/evas_scale_smooth_scaler.c b/src/lib/engines/common/evas_scale_smooth_scaler.c index 63fa4ab..d119411 100644 --- a/src/lib/engines/common/evas_scale_smooth_scaler.c +++ b/src/lib/engines/common/evas_scale_smooth_scaler.c @@ -7,7 +7,6 @@ SCALE_FUNC(RGBA_Image *src, RGBA_Image *dst, int dst_region_w, int dst_region_h) { DATA32 *dst_ptr; - int dst_jump; int dst_clip_x, dst_clip_y, dst_clip_w, dst_clip_h; int src_w, src_h, dst_w, dst_h;