Fix "warning: cast from pointer to integer of different size"
dmitry at codeweavers.com
Tue Apr 22 23:14:40 CDT 2008
"Erik de Castro Lopo" <mle+win at mega-nerd.com> wrote:
>> > /* get pointer to object containing list element */
>> > #define LIST_ENTRY(elem, type, field) \
>> > - ((type *)((char *)(elem) - (unsigned int)(&((type *)0)->field)))
>> > + ((type *)((char *)(elem) - (unsigned long)(&((type *)0)->field)))
>> It should be replaced with FIELD_OFFSET instead.
> FIELD_OFFSET is defined in include/winnt.h.
> Now I could include winnt.h into include/wine/list.h but that doesn't
> seem right. I could also copy it,but having two difinitions of the
> same macro is also not right. I'm also sure that moving the definition
> from include/winnt.h to include/wine/list.h will break existing code.
> Any suggestions for dealing with this?
Replacing (unsigned int) cast by (unsigned long) doesn't guarantee
anything, long can be a 32-bit entity on a 64-bit platform.
More information about the wine-devel