Edje: fix Windows printf format
authorcaro <caro@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 18 May 2011 16:11:31 +0000 (16:11 +0000)
committercaro <caro@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 18 May 2011 16:11:31 +0000 (16:11 +0000)
git-svn-id: http://svn.enlightenment.org/svn/e/trunk/edje@59511 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/bin/edje_cc_mem.c
src/bin/edje_inspector.c
src/bin/edje_player.c
src/lib/edje_lua2.c

index d01d12c..7c1a5c9 100644 (file)
@@ -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;
index 1ab8fd9..f422eba 100644 (file)
@@ -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 : "",
index f436ad8..1e861cc 100644 (file)
 #include <Ecore_Evas.h>
 #include <Edje.h>
 
+#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;
index 883bdb5..f82ec79 100644 (file)
@@ -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;
 }