From 4da6397d634376e2c9fb9a758070a7b395a08e59 Mon Sep 17 00:00:00 2001 From: Robert Kessl Date: Mon, 14 Jul 2014 11:16:01 +0200 Subject: [PATCH] xtypes: bugfixes in printf format and incorrect use of errno --- ucw/xtypes-basic.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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"; -- 2.39.5