Wireshark-dev: Re: [Wireshark-dev] Except.c build errors
From: Kovarththanan Rajaratnam <[email protected]>
Date: Mon, 17 Aug 2009 21:38:42 +0200
Guy Harris wrote:
On Aug 16, 2009, at 9:32 PM, Kovarththanan Rajaratnam wrote:

 > I'm not sure that casting a pointer to g_malloc() to a pointer to a
function taking a size_t as an argument would work on platforms where sizeof(size_t) != sizeof(gulong); Win64 is, as far as I know, one such platform, as it's LLP64, so "gulong" is 32 bits and "size_t" is 64 bits, and we do support Win64.
I really wish the GLib people had used gsize in a bunch of their APIs;  
gulong and size_t are the same size in ILP32 and LP64 platforms, so  
the only place where fixing that would cause problems would be LLP64  
platforms such as Win64.  Whether they *will* fix it is another  
I would vote either for using Martin's patch or for writing a wrapper  
around g_malloc() that takes a size_t as an argument.
I actually added the cast because I thought it would be safe for the 
same reasons you've already mentioned: gsize is only an issue on Win64 
and on this platform we bundle the newest version of GLib where the 
gsize/gulong mismatch has already been fixed:

Is it ok to keep r29451?

Best regards,
Kovarththanan Rajaratnam