Wireshark-dev: Re: [Wireshark-dev] g_snprintf() and sizeof
From: Bill Meier <[email protected]>
Date: Thu, 19 Mar 2009 15:45:18 -0400
` Zawadzki wrote:
On Thu, Mar 19, 2009 at 11:12:03AM -0700, Guy Harris wrote:
On Mar 19, 2009, at 10:44 AM, [email protected] wrote:

-As suggested by Jakub Zawadzki: use sizeof(...) rather than a numeric constant in various places;
Warning: g_snprintf()'s function signature has an annoying botch in it - the size argument is a gulong, not a gsize.
Not a problem in the UN*X and Windows ILP32 environment and in the  
UN*X LP64 environment, but it causes the Microsoft compiler to  
(correctly) warn about a conversion from a 64-bit integer to a 32-bit  
integer in the Windows LLP64 environment. 
Cast sizeof - or any other size_t value - to (gulong) before passing it 
as the length argument to g_snprintf().
Uhm, it's my fault :(

Not at all your fault .... :)


What do you think about creating ws_snprintf() & ws_vsnprintf() macros,
which would care about casting size to (gulong) ?

All: Would the use of macros seem like the right way to go ?

Would they be defined in config.h (maybe under #if [whatever indicates we're using VC64] ?