ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-dev: Re: [Wireshark-dev] size_t vs int

From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Fri, 4 Sep 2015 10:22:36 -0700
On Sep 4, 2015, at 6:46 AM, Dario Lombardo <dario.lombardo.ml@xxxxxxxxx> wrote:

> The first possibility is to change the "lowest" function, to keep the current prototype but with some integer checks and casts.
> 
> The second possibility is to "sanitize" the lowest function (in the example above, AFAIK, there is no reason to have int as input/output, better have size_t), but this, like a domino effect, requires to change the calling function (in the example, change the codec_decode_fn typedef) that propagates the change to other functions and so on. 
> 
> The first has less impact, but is more dirty. The second has great impact, but is more correct/elegant.
> 
> What do you think?

I vote for the second change.  Object sizes in C code should be represented as size_t.