From 8e737e3f24a1ab0edc2b29713b9d755e0b4c2452 Mon Sep 17 00:00:00 2001 From: Robert Kessl Date: Wed, 23 Jul 2014 16:11:52 +0200 Subject: [PATCH] tableprinter: update of tests and size/timestamp parser - update of error messages for size/timestamp - strtol changed to strtoul (we should are using u64) - update of tests --- ucw/table-types.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ucw/table-types.c b/ucw/table-types.c index b1443148..85f123cb 100644 --- a/ucw/table-types.c +++ b/ucw/table-types.c @@ -73,7 +73,7 @@ static const char *xt_size_parse(const char *str, void *dest, struct mempool *po { errno = 0; char *units_start = NULL; - u64 parsed = strtol(str, &units_start, 10); + u64 parsed = strtoul(str, &units_start, 10); if(str == units_start) { return mp_printf(pool, "Invalid value of size: '%s'.", str); } @@ -92,7 +92,7 @@ static const char *xt_size_parse(const char *str, void *dest, struct mempool *po int unit_idx = xtype_unit_parser(units_start, xtype_units_size); if(unit_idx == -1) { - return mp_printf(pool, "Invalid format of size: '%s'.", str); + return mp_printf(pool, "Invalid units: '%s'.", units_start); } *(u64*) dest = parsed * xtype_units_size[unit_idx].num; @@ -157,7 +157,7 @@ static const char *xt_timestamp_parse(const char *str, void *dest, struct mempoo { errno = 0; char *parse_end = NULL; - u64 parsed = strtol(str, &parse_end, 10); + u64 parsed = strtoul(str, &parse_end, 10); if(str == parse_end) { return mp_printf(pool, "Invalid value of timestamp: '%s'.", str); } -- 2.39.2