[Geany-Devel] [geany/geany] 0c7cf8: Fix gcc warning 'cast to pointer from integer of different size'

Thomas Martitz thomas.martitz at xxxxx
Mon Aug 12 14:43:21 UTC 2013



Nick Treleaven <nick.treleaven at btinternet.com> schrieb:
>On 12/08/2013 01:03, Lex Trotman wrote:
>> On 11 August 2013 23:31, Nick Treleaven <git-noreply at geany.org>
>wrote:
>>
>>> -               return g_direct_hash (GUINT_TO_POINTER
>(file_stat.st_ino));
>>> +               return g_direct_hash (GUINT_TO_POINTER
>>> ((guint)file_stat.st_ino));
>>>
>>
>> Hi Nick,
>>
>> On 64 bit Linux ino_t is 64 bits, but guint is 32 bits so this has
>the
>> potential to truncate inode numbers, you should cast to gulong.
>
>Thanks, fixed.
>
>> Note from the Glib docs on GUINT_TO_POINTER "#define
>GUINT_TO_POINTER(u)
>> ((gpointer) (gulong) (u))"
>
>On my Windows system that macro doesn't cast to gulong, otherwise there
>
>wouldn't be a gcc warning. Matt pointed out it may be a GLib bug.
>



What does it cast to? Long is only 32bit on windows anyway.

Best regards


More information about the Devel mailing list