Edje: fix Windows printf format

SVN revision: 59511
This commit is contained in:
Vincent Torri 2011-05-18 16:11:31 +00:00
parent 4903fe8e2d
commit 105a261d5b
4 changed files with 31 additions and 7 deletions

View 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;

View 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 : "",

View File

@ -20,6 +20,12 @@
#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;

View 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;
}