[gthumb] use int instead of guchar to avoid possible overflows



commit 3dfcb4a2ffb73c7183fb23774e4f3d61bbbd49cf
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Sat Apr 4 21:05:33 2015 +0200

    use int instead of guchar to avoid possible overflows

 extensions/file_tools/cairo-effects.c              |   22 ++++++++++----------
 .../file_tools/gth-file-tool-adjust-colors.c       |    6 ++--
 extensions/file_tools/gth-file-tool-lomo.c         |    8 +++---
 gthumb/pixbuf-cache.c                              |    2 +-
 gthumb/pixbuf-cache.h                              |    2 +-
 5 files changed, 20 insertions(+), 20 deletions(-)
---
diff --git a/extensions/file_tools/cairo-effects.c b/extensions/file_tools/cairo-effects.c
index 209241a..1367ddf 100644
--- a/extensions/file_tools/cairo-effects.c
+++ b/extensions/file_tools/cairo-effects.c
@@ -105,10 +105,10 @@ cairo_image_surface_apply_vignette (cairo_surface_t  *source,
        gboolean         cancelled = FALSE;
        double           progress;
        unsigned char   *p_source;
-       unsigned char    image_red, image_green, image_blue, image_alpha;
-       unsigned char    red, green, blue, alpha;
+       int              image_red, image_green, image_blue, image_alpha;
+       int              red, green, blue, alpha;
        double           center_x, center_y,  d, min_d, max_d;
-       unsigned char    temp;
+       int              temp;
        GthPoint         f1, f2, p;
 
        gimp_op_init ();
@@ -235,10 +235,10 @@ cairo_image_surface_apply_bcs (cairo_surface_t  *source,
        gboolean         cancelled = FALSE;
        double           progress;
        unsigned char   *p_source;
-       unsigned char    image_red, image_green, image_blue, image_alpha;
+       int              image_red, image_green, image_blue, image_alpha;
        unsigned char    values[4];
-       unsigned char    red, green, blue, alpha;
-       unsigned char    temp, min, max, lightness, value;
+       int              red, green, blue, alpha;
+       int              temp, min, max, lightness, value;
 
        gimp_op_init ();
        cache = pixbuf_cache_new ();
@@ -345,9 +345,9 @@ cairo_image_surface_colorize (cairo_surface_t  *source,
        gboolean         cancelled = FALSE;
        double           progress;
        unsigned char   *p_source;
-       unsigned char    image_red, image_green, image_blue, image_alpha;
-       unsigned char    red, green, blue, alpha;
-       unsigned char    temp, min, max, lightness;
+       int              image_red, image_green, image_blue, image_alpha;
+       int              red, green, blue, alpha;
+       int              temp, min, max, lightness;
 
        gimp_op_init ();
        for (i = 0; i < 256; i++)
@@ -415,8 +415,8 @@ cairo_image_surface_add_color (cairo_surface_t  *source,
        gboolean         cancelled = FALSE;
        double           progress;
        unsigned char   *p_source;
-       unsigned char    image_red, image_green, image_blue, image_alpha;
-       unsigned char    temp, alpha;
+       int              image_red, image_green, image_blue, image_alpha;
+       int              temp, alpha;
 
        gimp_op_init ();
 
diff --git a/extensions/file_tools/gth-file-tool-adjust-colors.c 
b/extensions/file_tools/gth-file-tool-adjust-colors.c
index 9060f86..941ed35 100644
--- a/extensions/file_tools/gth-file-tool-adjust-colors.c
+++ b/extensions/file_tools/gth-file-tool-adjust-colors.c
@@ -80,7 +80,7 @@ adjust_colors_before (GthAsyncTask *task,
 
 
 static guchar
-gamma_correction (guchar original,
+gamma_correction (int    original,
                  double gamma)
 {
        double inten;
@@ -116,9 +116,9 @@ adjust_colors_exec (GthAsyncTask *task,
        gboolean         cancelled;
        double           progress;
        int              x, y, temp;
-       unsigned char    values[4];
+       int              values[4];
        int              channel;
-       unsigned char    value;
+       int              value;
        double           saturation;
        cairo_surface_t *destination;
 
diff --git a/extensions/file_tools/gth-file-tool-lomo.c b/extensions/file_tools/gth-file-tool-lomo.c
index 0620164..02b1b04 100644
--- a/extensions/file_tools/gth-file-tool-lomo.c
+++ b/extensions/file_tools/gth-file-tool-lomo.c
@@ -61,10 +61,10 @@ lomo_exec (GthAsyncTask *task,
        double           progress;
        int              x, y;
        double           center_x, center_y, radius, d;
-       unsigned char    red, green, blue, alpha;
-       unsigned char    image_red, image_green, image_blue, image_alpha;
-       unsigned char    layer_red, layer_green, layer_blue, layer_alpha;
-       unsigned char    temp;
+       int              red, green, blue, alpha;
+       int              image_red, image_green, image_blue, image_alpha;
+       int              layer_red, layer_green, layer_blue, layer_alpha;
+       int              temp;
        int              c;
 
        /* curves layer */
diff --git a/gthumb/pixbuf-cache.c b/gthumb/pixbuf-cache.c
index 4d9ca26..3c9d797 100644
--- a/gthumb/pixbuf-cache.c
+++ b/gthumb/pixbuf-cache.c
@@ -52,7 +52,7 @@ pixbuf_cache_free (PixbufCache *cache)
 gboolean
 pixbuf_cache_get (PixbufCache        *cache,
                  PixbufCacheChannel  channel,
-                 guchar             *value)
+                 int                *value)
 {
        if (((cache->channel[channel].mask[*value / 8] >> (*value % 8)) & 1) != 1)
                return FALSE;
diff --git a/gthumb/pixbuf-cache.h b/gthumb/pixbuf-cache.h
index 9619542..3c65387 100644
--- a/gthumb/pixbuf-cache.h
+++ b/gthumb/pixbuf-cache.h
@@ -40,7 +40,7 @@ PixbufCache * pixbuf_cache_new   (void);
 void          pixbuf_cache_free  (PixbufCache        *cache);
 gboolean      pixbuf_cache_get   (PixbufCache        *cache,
                                  PixbufCacheChannel  channel,
-                                 guchar             *value);
+                                 int                *value);
 void          pixbuf_cache_set   (PixbufCache        *cache,
                                  PixbufCacheChannel  channel,
                                  guchar              value,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]