From: cedric Date: Mon, 20 Oct 2008 09:11:19 +0000 (+0000) Subject: Use common eina convertion code. X-Git-Tag: 2.0_alpha~163^2~1022 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a4c2e83021d4b8455623cdd4ed5d7859c80ab61a;p=framework%2Fuifw%2Fedje.git Use common eina convertion code. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/edje@36841 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/src/lib/edje_calc.c b/src/lib/edje_calc.c index 6183cdc..aa183f4 100644 --- a/src/lib/edje_calc.c +++ b/src/lib/edje_calc.c @@ -2,6 +2,8 @@ * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 */ +#include + #include "edje_private.h" #define FLAG_NONE 0 @@ -1183,65 +1185,9 @@ _edje_gradient_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3, } } -static int -_edje_nitoa_rec(char *string, int len, unsigned int value) -{ - const char *array = "0123456789"; - int length; - int quotient; - int modulo; - - if (len <= 0) return 0; - if (value == 0) return 0; - - quotient = value / 10; - modulo = value % 10; - - length = _edje_nitoa_rec(string, len - 1, quotient); - - if (length + 1 > len) return length; - - string[length] = array[modulo]; - - return length + 1; -} - -static int -_edje_nitoa(char *string, int len, int value) -{ - int length; - - if (len <= 0) return 0; - if (len == 1) - { - *string = '\0'; - return 1; - } - - if (value < 0) - { - *string = '-'; - - ++string; - --len; - } - - if (value == 0) - { - strncpy(string, "0", len); - return 1; - } - - length = _edje_nitoa_rec(string, len, value); - string[length] = '\0'; - - return length; -} - static void _edje_image_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3, Edje_Part_Description *chosen_desc, double pos) { - char buf[4096]; int image_id; int image_count, image_num; @@ -1297,10 +1243,12 @@ _edje_image_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3, Edj } else { + char buf[1024]; + /* Replace snprint("images/%i") == memcpy + itoa */ #define IMAGES "images/" memcpy(buf, IMAGES, strlen(IMAGES)); - _edje_nitoa(buf + strlen(IMAGES), sizeof(buf) - strlen(IMAGES), image_id); + eina_convert_itoa(image_id, buf + strlen(IMAGES)); /* No need to check length as 2³² need only 10 characteres. */ evas_object_image_file_set(ep->object, ed->file->path, buf); if (evas_object_image_load_error_get(ep->object) != EVAS_LOAD_ERROR_NONE)