From a9e28f0248eab3dbf7fc89914fe599ff185872a8 Mon Sep 17 00:00:00 2001 From: rbuj Date: Tue, 4 Jan 2022 13:37:30 +0100 Subject: caja-property-browser: Fix build warning -Wconstant-conversion --- src/caja-property-browser.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'src') 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 +#include #include #include @@ -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; } } -- cgit v1.2.1