From 0bf6297a32666e551870146acd1984377162a179 Mon Sep 17 00:00:00 2001 From: Christophe CURIS Date: Wed, 1 May 2013 20:26:34 +0200 Subject: [PATCH] Added 'const' attribute on non-modified arguments for color handling functions These functions have both an input and an output color, marked the input color as const to help distinguish. --- wrlib/color.c | 4 ++-- wrlib/convert.c | 2 +- wrlib/wraster.h | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/wrlib/color.c b/wrlib/color.c index c0c77195..085c461d 100644 --- a/wrlib/color.c +++ b/wrlib/color.c @@ -37,7 +37,7 @@ #define MIN3(a,b,c) MIN(MIN(a,b), c) #define MAX3(a,b,c) MAX(MAX(a,b), c) -void RHSVtoRGB(RHSVColor * hsv, RColor * rgb) +void RHSVtoRGB(const RHSVColor * hsv, RColor * rgb) { int h = hsv->hue % 360; int s = hsv->saturation; @@ -89,7 +89,7 @@ void RHSVtoRGB(RHSVColor * hsv, RColor * rgb) } } -void RRGBtoHSV(RColor * rgb, RHSVColor * hsv) +void RRGBtoHSV(const RColor * rgb, RHSVColor * hsv) { int h, s, v; int max = MAX3(rgb->red, rgb->green, rgb->blue); diff --git a/wrlib/convert.c b/wrlib/convert.c index 2b0d4156..f690e1f7 100644 --- a/wrlib/convert.c +++ b/wrlib/convert.c @@ -921,7 +921,7 @@ int RConvertImageMask(RContext * context, RImage * image, Pixmap * pixmap, Pixma return True; } -Bool RGetClosestXColor(RContext * context, RColor * color, XColor * retColor) +Bool RGetClosestXColor(RContext * context, const RColor * color, XColor * retColor) { if (context->vclass == TrueColor) { unsigned short rmask, gmask, bmask; diff --git a/wrlib/wraster.h b/wrlib/wraster.h index f01f33d9..30dfe92b 100644 --- a/wrlib/wraster.h +++ b/wrlib/wraster.h @@ -308,7 +308,7 @@ RContext *RCreateContext(Display *dpy, int screen_number, void RDestroyContext(RContext *context); -Bool RGetClosestXColor(RContext *context, RColor *color, XColor *retColor); +Bool RGetClosestXColor(RContext *context, const RColor *color, XColor *retColor); /* * RImage creation @@ -407,8 +407,8 @@ void ROperateSegments(RImage *image, int operation, const RSegment *segs, int ns /* * Color convertion */ -void RRGBtoHSV(RColor *color, RHSVColor *hsv); -void RHSVtoRGB(RHSVColor *hsv, RColor *rgb); +void RRGBtoHSV(const RColor *color, RHSVColor *hsv); +void RHSVtoRGB(const RHSVColor *hsv, RColor *rgb); /* * Painting -- 2.11.4.GIT