From 7c19f58e752309f384219e4868eb88b1130d4922 Mon Sep 17 00:00:00 2001 From: Andrew Wood Date: Sun, 10 May 2026 19:18:01 +0100 Subject: [PATCH] Mark pointers to constant buffers as const (cppcheck recommendation). --- src/include/pv-internal.h | 2 +- src/pv/display.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/include/pv-internal.h b/src/include/pv-internal.h index 3cc57be..edb9a05 100644 --- a/src/include/pv-internal.h +++ b/src/include/pv-internal.h @@ -580,7 +580,7 @@ void pv_calculate_transfer_rate(pvtransfercalc_t, readonly_pvtransferstate_t, re long pv_seconds_remaining(const off_t, const off_t, const long double); void pv_si_prefix(long double *, char *, const long double, pvtransfercount_t); -void pv_describe_amount(char *, size_t, char *, long double, char *, char *, pvtransfercount_t); +void pv_describe_amount(char *, size_t, const char *, long double, char *, char *, pvtransfercount_t); int8_t pv_display_barstyle_index(pvformatter_args_t, const char *); diff --git a/src/pv/display.c b/src/pv/display.c index 690003c..0d55319 100644 --- a/src/pv/display.c +++ b/src/pv/display.c @@ -287,9 +287,9 @@ void pv_si_prefix(long double *value, char *prefix, const long double ratio, pvt static char *pfx_024 = NULL; /* kibi, mibi, etc */ static char const *pfx_middle_000 = NULL; static char const *pfx_middle_024 = NULL; - char *pfx; - char const *pfx_middle; - char const *pfx_ptr; + const char *pfx; + const char *pfx_middle; + const char *pfx_ptr; long double cutoff; prefix[0] = ' '; /* Make the prefix start blank. */ @@ -440,7 +440,7 @@ void pv_si_prefix(long double *value, char *prefix, const long double ratio, pvt * The "format" string is in sprintf format and must contain exactly one % * parameter, a %s, which will expand to the string described above. */ -void pv_describe_amount(char *buffer, size_t bufsize, char *format, +void pv_describe_amount(char *buffer, size_t bufsize, const char *format, long double amount, char *suffix_basic, char *suffix_bytes, pvtransfercount_t count_type) { char sizestr_buffer[256]; /* flawfinder: ignore */