From: Christophe CURIS <christophe.cu...@free.fr> 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.cu...@free.fr> --- wrlib/convert.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/wrlib/convert.c b/wrlib/convert.c index 6dfe2e4..b0ab230 100644 --- a/wrlib/convert.c +++ b/wrlib/convert.c @@ -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; -- 1.9.2 -- To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.