| Summary: | MSVC Static analysis: Incorrect alpha_value check in SDL_render.c | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Cameron Gutman <cameron.gutman> |
| Component: | render | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | sylvain.becker |
| Version: | HG 2.1 | ||
| Hardware: | x86 | ||
| OS: | Windows 10 | ||
Thanks good catch ! palette surface were then always promoted to alpha. https://hg.libsdl.org/SDL/rev/c66d1c7700bd (At the same time, I spotted another issue and re-open bug 4425) |
MSVC's static analysis found this one and it looks like a legitimate bug. "Incorrect operator: mutual exclusion over || is always a non-zero constant. Did you intend to use && instead?" /* If Palette contains alpha values, promotes to alpha format */ if (fmt->palette) { for (i = 0; i < fmt->palette->ncolors; i++) { Uint8 alpha_value = fmt->palette->colors[i].a; if (alpha_value != 0 || alpha_value != SDL_ALPHA_OPAQUE) { <---- HERE needAlpha = SDL_TRUE; break; } } } https://hg.libsdl.org/SDL/file/28fcb5ef7ff1/src/render/SDL_render.c#l1170