[gimp/gimp-2-10] plug-ins: merge some more warning fixes from master
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-10] plug-ins: merge some more warning fixes from master
- Date: Sat, 6 Jul 2019 13:27:21 +0000 (UTC)
commit bcf6859b01e5a28557ccd619a9aad4fba32be7b1
Author: Michael Natterer <mitch gimp org>
Date: Sat Jul 6 15:26:33 2019 +0200
plug-ins: merge some more warning fixes from master
plug-ins/gradient-flare/gradient-flare.c | 34 +++++++++++++++++++-------------
1 file changed, 20 insertions(+), 14 deletions(-)
---
diff --git a/plug-ins/gradient-flare/gradient-flare.c b/plug-ins/gradient-flare/gradient-flare.c
index 49cd0978e9..bd6873a4ac 100644
--- a/plug-ins/gradient-flare/gradient-flare.c
+++ b/plug-ins/gradient-flare/gradient-flare.c
@@ -1576,8 +1576,8 @@ static void
gflare_name_copy (gchar *dest,
const gchar *src)
{
- strncpy (dest, src, GFLARE_NAME_MAX);
- dest[GFLARE_NAME_MAX-1] = '\0';
+ strncpy (dest, src, GFLARE_NAME_MAX - 1);
+ dest[GFLARE_NAME_MAX - 1] = '\0';
}
/*************************************************************************/
@@ -1915,19 +1915,24 @@ calc_sample_one_gradient (void)
{
for (j = 0; j < GRADIENT_RESOLUTION; j++)
{
- gint r, g, b;
+ GimpRGB rgb;
+ GimpHSV hsv;
- r = gradient[j*4];
- g = gradient[j*4+1];
- b = gradient[j*4+2];
+ rgb.r = (gdouble) gradient[j*4] / 255.0;
+ rgb.g = (gdouble) gradient[j*4+1] / 255.0;
+ rgb.b = (gdouble) gradient[j*4+2] / 255.0;
- gimp_rgb_to_hsv_int (&r, &g, &b);
- r = (r + hue) % 256;
- gimp_hsv_to_rgb_int (&r, &g, &b);
+ gimp_rgb_to_hsv (&rgb, &hsv);
- gradient[j*4] = r;
- gradient[j*4+1] = g;
- gradient[j*4+2] = b;
+ hsv.h = (hsv.h + ((gdouble) hue / 255.0));
+ if (hsv.h > 1.0)
+ hsv.h -= 1.0;
+
+ gimp_hsv_to_rgb (&hsv, &rgb);
+
+ gradient[j*4] = ROUND (rgb.r * 255.0);
+ gradient[j*4+1] = ROUND (rgb.g * 255.0);
+ gradient[j*4+2] = ROUND (rgb.b * 255.0);
}
}
}
@@ -4715,8 +4720,8 @@ static void
gradient_name_copy (gchar *dest,
const gchar *src)
{
- strncpy (dest, src, GRADIENT_NAME_MAX);
- dest[GRADIENT_NAME_MAX-1] = '\0';
+ strncpy (dest, src, GRADIENT_NAME_MAX - 1);
+ dest[GRADIENT_NAME_MAX - 1] = '\0';
}
/*
@@ -5071,6 +5076,7 @@ gradient_cache_lookup (const gchar *name,
gradient_cache_zorch();
ci = g_new (GradientCacheItem, 1);
strncpy (ci->name, name, GRADIENT_NAME_MAX - 1);
+ ci->name[GRADIENT_NAME_MAX - 1] = '\0';
ci->next = gradient_cache_head;
ci->prev = NULL;
if (gradient_cache_head)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]