Use always base 10 integer formats with scanf()

The %i printf variant tries to autodetect the base, so 010 becomes 8.
This commit is contained in:
Rodrigo Arias 2024-07-24 16:34:13 +02:00
parent 92c36502bc
commit 2457e50712
2 changed files with 3 additions and 3 deletions

View File

@ -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 */ * SPDX-License-Identifier: GPL-3.0-or-later */
#include "clkoff.h" #include "clkoff.h"
@ -59,7 +59,7 @@ cparse(struct clkoff *table, FILE *file)
if (buf[0] == '\n') if (buf[0] == '\n')
continue; continue;
int ret = sscanf(buf, "%" SCNi64 "%s %lf %lf %lf", int ret = sscanf(buf, "%" SCNd64 "%s %lf %lf %lf",
&e.index, e.name, &e.index, e.name,
&e.median, &e.mean, &e.stdev); &e.median, &e.mean, &e.stdev);

View File

@ -113,7 +113,7 @@ count_prv_lines(char *fpath, int64_t time, int row0, long type, long value)
int64_t ftime; int64_t ftime;
long frow1, ftype, fvalue; 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); &frow1, &ftime, &ftype, &fvalue);
if (ret != 4) if (ret != 4)