include: Avoid overflow (warning) in RGBA_MAKE.

Gerald Pfeifer gerald at pfeifer.com
Sun Feb 26 08:22:58 CST 2017


Hi guys,

On Tue, 6 Sep 2016, Henri Verbeet wrote:
> On 6 September 2016 at 08:41, Dmitry Timoshkov <dmitry at baikal.ru> wrote:
>>> --- a/include/d3dtypes.h
>>> +++ b/include/d3dtypes.h
>>> @@ -53,7 +53,7 @@ typedef LONG D3DFIXED;
>>>  #define RGBA_GETRED(rgb)        (((rgb) >> 16) & 0xff)
>>>  #define RGBA_GETGREEN(rgb)      (((rgb) >> 8) & 0xff)
>>>  #define RGBA_GETBLUE(rgb)       ((rgb) & 0xff)
>>> -#define RGBA_MAKE(r, g, b, a)   ((D3DCOLOR) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b)))
>>> +#define RGBA_MAKE(r, g, b, a)   ((D3DCOLOR) (((unsigned)(a) << 24) | ((r) << 16) | ((g) << 8) | (b)))
>>
>> This is a public header, probably you need to fix the callers of this 
>> macro instead.
> Signed overflow is undefined, so this change is compatible. It's also
> unlikely to be an issue in practice on any architecture we support. I
> might have preferred something similar to D3DCOLOR_ARGB though.
> 
> That's not to say the users of the macro don't have room for improvement.

I noticed this has not been committed (nor rejected apparently).
but after reverting it locally, I do not see the warnings that
triggered this any longer.

Did one of you commit and alternative fix?

Gerald



More information about the wine-devel mailing list