diff options
author | rbuj <[email protected]> | 2022-01-04 13:37:30 +0100 |
---|---|---|
committer | raveit65 <[email protected]> | 2022-01-28 23:59:38 +0100 |
commit | a9e28f0248eab3dbf7fc89914fe599ff185872a8 (patch) | |
tree | a1ae7a04eabbe4fc0d628748764e8915feeb603b /src | |
parent | 48207c6cc678d75ec8211a2e479898c21aa80ab6 (diff) | |
download | caja-a9e28f0248eab3dbf7fc89914fe599ff185872a8.tar.bz2 caja-a9e28f0248eab3dbf7fc89914fe599ff185872a8.tar.xz |
caja-property-browser: Fix build warning -Wconstant-conversion
Diffstat (limited to 'src')
-rw-r--r-- | src/caja-property-browser.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/caja-property-browser.c b/src/caja-property-browser.c index 3351421e..1a5ceffa 100644 --- a/src/caja-property-browser.c +++ b/src/caja-property-browser.c @@ -29,6 +29,7 @@ */ #include <config.h> +#include <limits.h> #include <math.h> #include <libxml/parser.h> @@ -803,15 +804,16 @@ make_color_drag_image (CajaPropertyBrowser *property_browser, const char *color_ GdkPixbuf *color_square; GdkPixbuf *ret; int row, col, stride; - char *pixels; + guchar *pixels; GdkColor color; + guchar red, green, blue; color_square = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, COLOR_SQUARE_SIZE, COLOR_SQUARE_SIZE); gdk_color_parse (color_spec, &color); - color.red >>= 8; - color.green >>= 8; - color.blue >>= 8; + red = (guchar)(color.red >> 8); + green = (guchar)(color.green >> 8); + blue = (guchar)(color.blue >> 8); pixels = gdk_pixbuf_get_pixels (color_square); stride = gdk_pixbuf_get_rowstride (color_square); @@ -819,16 +821,16 @@ make_color_drag_image (CajaPropertyBrowser *property_browser, const char *color_ /* loop through and set each pixel */ for (row = 0; row < COLOR_SQUARE_SIZE; row++) { - char *row_pixels; + guchar *row_pixels; row_pixels = (pixels + (row * stride)); for (col = 0; col < COLOR_SQUARE_SIZE; col++) { - *row_pixels++ = color.red; - *row_pixels++ = color.green; - *row_pixels++ = color.blue; - *row_pixels++ = 255; + *row_pixels++ = red; + *row_pixels++ = green; + *row_pixels++ = blue; + *row_pixels++ = UCHAR_MAX; } } |