From 655841008e75c19ad1407e01a12932944addddf9 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Sun, 26 Jul 2026 18:43:36 -0400 Subject: [PATCH] leansdr: Fix unsigned printf format specifiers Replace signed %ld format specifiers with unsigned %lu conversions when printing values stored as unsigned long. The previous format strings passed unsigned values to signed printf conversions, which could result in undefined behavior due to variadic argument type mismatches. These issues were identified by cppcheck invalidPrintfArgType_sint warnings. Use format specifiers matching the actual argument types to ensure correct and portable printf usage. Signed-off-by: Robin Getz --- plugins/channelrx/demoddatv/leansdr/framework.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/channelrx/demoddatv/leansdr/framework.h b/plugins/channelrx/demoddatv/leansdr/framework.h index 0ebb7bd90..0e479b528 100644 --- a/plugins/channelrx/demoddatv/leansdr/framework.h +++ b/plugins/channelrx/demoddatv/leansdr/framework.h @@ -193,7 +193,7 @@ struct scheduler pipes[i]->dump(&total_bufs); } - fprintf(stderr, "Total buffer memory: %ld KiB\n", + fprintf(stderr, "Total buffer memory: %lu KiB\n", (unsigned long)total_bufs / 1024); } }; @@ -287,23 +287,23 @@ struct pipebuf : pipebuf_common { if (total_written < 10000) { - fprintf(stderr, ".%-16s : %4ld/%4ld", name, total_read, + fprintf(stderr, ".%-16s : %4lu/%4lu", name, total_read, total_written); } else if (total_written < 1000000) { - fprintf(stderr, ".%-16s : %3ldk/%3ldk", name, total_read / 1000, + fprintf(stderr, ".%-16s : %3luk/%3luk", name, total_read / 1000, total_written / 1000); } else { - fprintf(stderr, ".%-16s : %3ldM/%3ldM", name, total_read / 1000000, + fprintf(stderr, ".%-16s : %3luM/%3luM", name, total_read / 1000000, total_written / 1000000); } *total_bufs += (end - buf) * sizeof(T); unsigned long nw = end - wr; - fprintf(stderr, " %6ld writable %c,", nw, (nw < min_write) ? '!' : ' '); + fprintf(stderr, " %6lu writable %c,", nw, (nw < min_write) ? '!' : ' '); T *rd = wr; for (int j = 0; j < nrd; ++j)