From: Robert Kessl Date: Wed, 23 Jul 2014 14:11:52 +0000 (+0200) Subject: tableprinter: update of tests and size/timestamp parser X-Git-Tag: v6.1~3^2~58 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=8e737e3f24a1ab0edc2b29713b9d755e0b4c2452;p=libucw.git 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 --- 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); }