From: Robert Kessl Date: Mon, 14 Jul 2014 09:16:01 +0000 (+0200) Subject: xtypes: bugfixes in printf format and incorrect use of errno X-Git-Tag: v6.1~3^2~98 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=4da6397d634376e2c9fb9a758070a7b395a08e59;p=libucw.git xtypes: bugfixes in printf format and incorrect use of errno --- diff --git a/ucw/xtypes-basic.c b/ucw/xtypes-basic.c index 87fa2104..04380457 100644 --- a/ucw/xtypes-basic.c +++ b/ucw/xtypes-basic.c @@ -36,10 +36,10 @@ XTYPE_NUM_STRUCT(_type, _typename) XTYPE_NUM_DEF(int, "%d", int) -XTYPE_NUM_DEF(s64, "%ld", s64) +XTYPE_NUM_DEF(s64, PRId64, s64) XTYPE_NUM_DEF(intmax_t, "%jd", intmax) XTYPE_NUM_DEF(uint, "%u", uint) -XTYPE_NUM_DEF(u64, "%lu", u64) +XTYPE_NUM_DEF(u64, PRIu64, u64) XTYPE_NUM_DEF(uintmax_t, "%ju", uintmax) /* double */ @@ -61,9 +61,9 @@ static const char *xt_double_format(void *src, u32 fmt, struct mempool *pool) static const char *xt_double_parse(const char *str, void *dest, struct mempool *pool UNUSED) { char *endptr = NULL; + size_t sz = strlen(str); errno = 0; double result = strtod(str, &endptr); - size_t sz = strlen(str); if(endptr != str + sz) return "Could not parse double."; if(errno == ERANGE) return "Could not parse double: overflow happend during parsing";