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

Max TenEyck Woodbury max at mtew.isa-geek.net
Fri Oct 12 20:16:03 CDT 2012


On 10/12/2012 01:46 PM, Dmitry Timoshkov wrote:
> 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.



More information about the wine-devel mailing list