From 28c2090f37f0b230ce786b85f281648afcceb8f5 Mon Sep 17 00:00:00 2001 From: Leandro Pereira Date: Fri, 18 May 2018 08:13:53 -0700 Subject: Fix compiler warnings generated with GCC 8 --- hardinfo/dt_util.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'hardinfo/dt_util.c') diff --git a/hardinfo/dt_util.c b/hardinfo/dt_util.c index 9678042d..62213efd 100644 --- a/hardinfo/dt_util.c +++ b/hardinfo/dt_util.c @@ -571,8 +571,7 @@ char *dtr_list_byte(uint8_t *bytes, unsigned long count) { dest = ret + 1; for (i = 0; i < count; i++) { v = bytes[i]; - sprintf(buff, "%s%02x", (i) ? " " : "", v); - l = strlen(buff); + l = sprintf(buff, "%s%02x", (i) ? " " : "", v); strncpy(dest, buff, l); dest += l; } @@ -588,8 +587,7 @@ char *dtr_list_hex(dt_uint *list, unsigned long count) { dest = ret = malloc(l); memset(ret, 0, l); for (i = 0; i < count; i++) { - sprintf(buff, "%s0x%x", (i) ? " " : "", be32toh(list[i])); - l = strlen(buff); + l = sprintf(buff, "%s0x%x", (i) ? " " : "", be32toh(list[i])); strncpy(dest, buff, l); dest += l; } -- cgit v1.2.3