[PATCH 1/1] include/basetsd.h: fix bad casting

Dmitry Timoshkov dmitry at baikal.ru
Fri Oct 12 20:49:49 CDT 2012


Max TenEyck Woodbury <max at mtew.isa-geek.net> wrote:

> >> -#define IntToPtr(i)             ((void *)(INT_PTR)((INT)i))
> >> -#define UIntToPtr(ui)           ((void *)(UINT_PTR)((UINT)ui))
> >> -#define LongToPtr(l)            ((void *)(LONG_PTR)((LONG)l))
> >> -#define ULongToPtr(ul)          ((void *)(ULONG_PTR)((ULONG)ul))
> >> +#define IntToPtr(i)             ((void *)(INT_PTR)(i))
> >> +#define UIntToPtr(ui)           ((void *)(UINT_PTR)(ui))
> >> +#define LongToPtr(l)            ((void *)(LONG_PTR)(l))
> >> +#define ULongToPtr(ul)          ((void *)(ULONG_PTR)(ul))
> > 
> > You forgot to explain what's bad with it.
> > 
> 
> The original applied the extra conversion to ONLY THE FIRST
> component of the expression, not to the WHOLE expression.  That
> can (although it's not likely to) cause hard to diagnose problems.

What 'the first component' are you talking about? This code is win32 only.

-- 
Dmitry.



More information about the wine-devel mailing list