mirror of
https://github.com/gryf/wmaker.git
synced 2026-01-03 12:24:17 +01:00
As pointed by Coverity, the shift operation performed for color-to-pixel transform may not behave as well as expected because of the types used (Coverity pointing suspicious sign extension because of int type being involved). The new code tries to leave no open interpretation to the compiler. Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
committed by
Carlos R. Mafra
parent
1cd354d796
commit
6505b2f81c
@@ -978,8 +978,9 @@ Bool RGetClosestXColor(RContext * context, const RColor * color, XColor * retCol
|
||||
gtable = computeTable(gmask);
|
||||
btable = computeTable(bmask);
|
||||
|
||||
retColor->pixel = (rtable[color->red] << roffs) |
|
||||
(gtable[color->green] << goffs) | (btable[color->blue] << boffs);
|
||||
retColor->pixel = (((unsigned long) rtable[color->red]) << roffs)
|
||||
| (((unsigned long) gtable[color->green]) << goffs)
|
||||
| (((unsigned long) btable[color->blue]) << boffs);
|
||||
|
||||
retColor->red = color->red << 8;
|
||||
retColor->green = color->green << 8;
|
||||
|
||||
Reference in New Issue
Block a user