From: caro Date: Wed, 18 May 2011 16:11:31 +0000 (+0000) Subject: Edje: fix Windows printf format X-Git-Tag: submit/2.0alpha-wayland/20121127.221958~792 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0f3a5a6c335cf3492f413d6f595e60f66746bbb4;p=profile%2Fivi%2Fedje.git Edje: fix Windows printf format git-svn-id: http://svn.enlightenment.org/svn/e/trunk/edje@59511 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/src/bin/edje_cc_mem.c b/src/bin/edje_cc_mem.c index d01d12c..7c1a5c9 100644 --- a/src/bin/edje_cc_mem.c +++ b/src/bin/edje_cc_mem.c @@ -7,6 +7,12 @@ #include "edje_cc.h" +#ifdef _WIN32 +# define FMT_SIZE_T "%Iu" +#else +# define FMT_SIZE_T "%zu" +#endif + void * mem_alloc(size_t size) { @@ -14,7 +20,7 @@ mem_alloc(size_t size) mem = calloc(1, size); if (mem) return mem; - ERR("%s: Error. %s:%i memory allocation of %zi bytes failed. %s", + ERR("%s: Error. %s:%i memory allocation of " FMT_SIZE_T " bytes failed. %s", progname, file_in, line, size, strerror(errno)); exit(-1); return NULL; @@ -27,7 +33,7 @@ mem_strdup(const char *s) str = strdup(s); if (str) return str; - ERR("%s: Error. %s:%i memory allocation of %zi bytes failed. %s. string being duplicated: \"%s\"", + ERR("%s: Error. %s:%i memory allocation of " FMT_SIZE_T " bytes failed. %s. string being duplicated: \"%s\"", progname, file_in, line, strlen(s) + 1, strerror(errno), s); exit(-1); return NULL; diff --git a/src/bin/edje_inspector.c b/src/bin/edje_inspector.c index 1ab8fd9..f422eba 100644 --- a/src/bin/edje_inspector.c +++ b/src/bin/edje_inspector.c @@ -30,6 +30,12 @@ static int _log_dom; #define FLOAT_PRECISION 0.0001 #define FDIFF(a, b) (fabs((a) - (b)) > FLOAT_PRECISION) +#ifdef _WIN32 +# define FMT_UCHAR "%c" +#else +# define FMT_UCHAR "%hhu" +#endif + /* context */ static Eina_List *groups; static Ecore_Evas *ee; @@ -1572,8 +1578,8 @@ main(int argc, char **argv) file = argv[arg_index]; - DBG("mode=%s, detail=%d(%s), group=%s, part=%s, program=%s, api-only=%hhu, " - "api-fix=%hhu, machine=%hhu, file=%s", + DBG("mode=%s, detail=%d(%s), group=%s, part=%s, program=%s, api-only=" FMT_UCHAR + ", api-fix=" FMT_UCHAR ", machine=" FMT_UCHAR ", file=%s", mode, detail, detail_name, group ? group : "", part ? part : "", diff --git a/src/bin/edje_player.c b/src/bin/edje_player.c index f436ad8..1e861cc 100644 --- a/src/bin/edje_player.c +++ b/src/bin/edje_player.c @@ -20,6 +20,12 @@ #include #include +#ifdef _WIN32 +# define FMT_UCHAR "%c" +#else +# define FMT_UCHAR "%hhu" +#endif + struct opts { char *file; char *group; @@ -548,7 +554,7 @@ static unsigned char _parse_color(__UNUSED__ const Ecore_Getopt *parser, __UNUSE { unsigned char *color = (unsigned char *)storage->ptrp; - if (sscanf(str, "%hhu,%hhu,%hhu", color, color + 1, color + 2) != 3) + if (sscanf(str, FMT_UCHAR "," FMT_UCHAR "," FMT_UCHAR, color, color + 1, color + 2) != 3) { fprintf(stderr, "ERROR: incorrect color value '%s'\n", str); return 0; diff --git a/src/lib/edje_lua2.c b/src/lib/edje_lua2.c index 883bdb5..f82ec79 100644 --- a/src/lib/edje_lua2.c +++ b/src/lib/edje_lua2.c @@ -3,6 +3,12 @@ //--------------------------------------------------------------------------// #define MAX_LUA_MEM (4 * (1024 * 1024)) +#ifdef _WIN32 +# define FMT_SIZE_T "%Iu" +#else +# define FMT_SIZE_T "%zu" +#endif + //--------------------------------------------------------------------------// typedef struct _Edje_Lua_Alloc Edje_Lua_Alloc; @@ -250,7 +256,7 @@ _elua_alloc(void *ud, void *ptr, size_t osize, size_t nsize) ela->cur += nsize - osize; if (ela->cur > ela->max) { - ERR("Edje Lua memory limit of %zu bytes reached (%zu allocated)", + ERR("Edje Lua memory limit of " FMT_SIZE_T " bytes reached (" FMT_SIZE_T " allocated)", ela->max, ela->cur); return NULL; } @@ -262,7 +268,7 @@ _elua_alloc(void *ud, void *ptr, size_t osize, size_t nsize) ptr2 = realloc(ptr, nsize); if (ptr2) return ptr2; - ERR("Edje Lua cannot re-allocate %zu bytes", nsize); + ERR("Edje Lua cannot re-allocate " FMT_SIZE_T " bytes", nsize); return ptr2; }