summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Sharp <ken.sharp@artifex.com>2019-03-13 15:18:57 +0000
committerKen Sharp <ken.sharp@artifex.com>2019-03-13 15:18:57 +0000
commitc633d492cef7de24dafcecceb6efca982b1ad8be (patch)
treed105c6f61bfd538c3cb9b867d313801011613427
parent58e490fec4909b18151e25bd55c9e9f91512a007 (diff)
downloadghostpdl-c633d492cef7de24dafcecceb6efca982b1ad8be.tar.gz
Coverity IDs 279970 and 279971
Add some casts to prevent implicit casting promoting unsigned values to signed values. Moost places had already been handled, but three had been missed.
-rw-r--r--devices/gdevdsp.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/devices/gdevdsp.c b/devices/gdevdsp.c
index 754577af0..878220c86 100644
--- a/devices/gdevdsp.c
+++ b/devices/gdevdsp.c
@@ -600,7 +600,7 @@ display_map_rgb_color_rgb(gx_device * dev, const gx_color_value cv[])
return gx_default_rgb_map_rgb_color(dev, rgb); /* RGB */
}
else
- return (blue<<16) + (green<<8) + red; /* BGR */
+ return ((gx_color_index)blue<<16) + (green<<8) + red; /* BGR */
case DISPLAY_ALPHA_FIRST:
case DISPLAY_UNUSED_FIRST:
if ((ddev->nFormat & DISPLAY_ENDIAN_MASK) == DISPLAY_BIGENDIAN)
@@ -610,9 +610,9 @@ display_map_rgb_color_rgb(gx_device * dev, const gx_color_value cv[])
case DISPLAY_ALPHA_LAST:
case DISPLAY_UNUSED_LAST:
if ((ddev->nFormat & DISPLAY_ENDIAN_MASK) == DISPLAY_BIGENDIAN)
- return ((gx_color_index)red<<24) + (green<<16) + (blue<<8); /* RGBx */
+ return ((gx_color_index)red<<24) + ((gx_color_index)green<<16) + (blue<<8); /* RGBx */
else
- return ((gx_color_index)blue<<24) + (green<<16) + (red<<8); /* BGRx */
+ return ((gx_color_index)blue<<24) + ((gx_color_index)green<<16) + (red<<8); /* BGRx */
}
return 0;
}