Re: [PATCH 3/3] convert: use size_t for buffer sizes
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Oct 21, 2026, 11:24 UTC
- Message-ID
- <atig-5kJzKHZS4jj@pks.im>
- In-Reply-To
- <20261021101640.329990-4-gitter.spiros@gmail.com>
On Wed, Oct 21, 2026 at 12:16:39PM +0200, Elia Pinto wrote:
Show 16 quoted lines
> diff --git a/convert.c b/convert.c
> index 036506842c..ca5594cab0 100644
> --- a/convert.c
> +++ b/convert.c
> @@ -42,9 +42,9 @@ struct text_stat {
> unsigned printable, nonprintable;
> };
>
> -static void gather_stats(const char *buf, unsigned long size, struct text_stat *stats)
> +static void gather_stats(const char *buf, size_t size, struct text_stat *stats)
> {
> - unsigned long i;
> + size_t i;
>
> memset(stats, 0, sizeof(*stats));
> One thing to note here is that `struct text_stat` still uses `unsigned` counters. Is this something we should fix, as well?
Show 9 quoted lines
> @@ -1077,7 +1077,7 @@ static int read_convert_config(const char *var, const char *value,
> return 0;
> }
>
> -static int count_ident(const char *cp, unsigned long size)
> +static int count_ident(const char *cp, size_t size)
> {
> /*
> * "$Id: 0000000000000000000000000000000000000000 $" <=> "$Id$"This function is counting `$Id$` markers, so it's rather unlikely that it ever overflows. Theoretically it's possible though.
Patrick