From 2457e50712c351d7b819ec1632d08d1828e8d335 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Wed, 24 Jul 2024 16:34:13 +0200 Subject: [PATCH] Use always base 10 integer formats with scanf() The %i printf variant tries to autodetect the base, so 010 becomes 8. --- src/emu/clkoff.c | 4 ++-- test/unit/prv.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/emu/clkoff.c b/src/emu/clkoff.c index 4da675c..324caee 100644 --- a/src/emu/clkoff.c +++ b/src/emu/clkoff.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC) +/* Copyright (c) 2021-2024 Barcelona Supercomputing Center (BSC) * SPDX-License-Identifier: GPL-3.0-or-later */ #include "clkoff.h" @@ -59,7 +59,7 @@ cparse(struct clkoff *table, FILE *file) if (buf[0] == '\n') continue; - int ret = sscanf(buf, "%" SCNi64 "%s %lf %lf %lf", + int ret = sscanf(buf, "%" SCNd64 "%s %lf %lf %lf", &e.index, e.name, &e.median, &e.mean, &e.stdev); diff --git a/test/unit/prv.c b/test/unit/prv.c index 5c10faf..7b04978 100644 --- a/test/unit/prv.c +++ b/test/unit/prv.c @@ -113,7 +113,7 @@ count_prv_lines(char *fpath, int64_t time, int row0, long type, long value) int64_t ftime; long frow1, ftype, fvalue; - int ret = sscanf(line, "2:0:1:1:%ld:%" SCNi64 ":%ld:%ld", + int ret = sscanf(line, "2:0:1:1:%ld:%" SCNd64 ":%ld:%ld", &frow1, &ftime, &ftype, &fvalue); if (ret != 4)