Some FOURCC values such as 0xdeadbeef will en up being negative when cast to the enum type, and may cause a random crash later on. This happens randomly in the ddraw tests, depending on the compiler being used.
From: Rémi Bernon rbernon@codeweavers.com
Some FOURCC values such as 0xdeadbeef will en up being negative when cast to the enum type, and may cause a random crash later on. This happens randomly in the ddraw tests, depending on the compiler being used. --- dlls/wined3d/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index 30572bc0ded..181914986f6 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -1933,7 +1933,7 @@ static inline int get_format_idx(enum wined3d_format_id format_id) { unsigned int i;
- if (format_id < WINED3D_FORMAT_FOURCC_BASE) + if (format_id >= 0 && format_id < WINED3D_FORMAT_FOURCC_BASE) return format_id;
for (i = 0; i < ARRAY_SIZE(format_index_remap); ++i)
This merge request was approved by Elizabeth Figura.
This merge request was approved by Jan Sikorski.
This causes a warning with clang:
``` dlls/wined3d/utils.c:1936:19: warning: result of comparison of unsigned enum expression >= 0 is always true [-Wtautological-unsigned-enum-zero-compare] ```
On Wed Nov 6 01:33:33 2024 +0000, Alexandre Julliard wrote:
This causes a warning with clang:
dlls/wined3d/utils.c:1936:19: warning: result of comparison of unsigned enum expression >= 0 is always true [-Wtautological-unsigned-enum-zero-compare]
Considering the enum behavior is fairly compiler-specific, maybe casting the `format_id` variable in the original `if` statement to unsigned would work for this issue too?