[PATCH] d3dx9: Don't check for negative enum value.

Matteo Bruni matteo.mystral at gmail.com
Tue Mar 24 08:14:30 CDT 2020


On Tue, Mar 24, 2020 at 2:23 AM Jacek Caban <jacek at codeweavers.com> wrote:
>
> On 24.03.2020 01:53, Chip Davis wrote:
> > Don't some compilers pick 'int' instead of 'unsigned int' for enums?
>
>
> Compiler has some freedom to do that, yes, but in this case we always
> pass values from an internal table and we know that it's never negative.
> In fact, I'm not sure why the check is there in the first place. It
> could be an assert() or just skipped, unless I'm missing something.
>
>
> Thanks,
>
> Jacek

Well, that table is used for different states and, in particular, the
relevant field is "overloaded" to store enum SHADER_CONSTANT_TYPE
values only for the shader constant entries. Leaving a more serious
rework of the whole thing aside for the moment, it would be nice to
keep some sort of validation for the table.
I assume replacing "op < 0" with an explicit "op < SCT_VSFLOAT"
doesn't avoid the warning. Does replacing the if with an assert do the
trick, by any chance?



More information about the wine-devel mailing list