Commit 1ed91801 authored by Daniel Egger's avatar Daniel Egger Committed by Daniel Egger

Convert ugly comments into named structure fields. Much cleaner and less

2001-12-02  Daniel Egger  <degger@fhm.edu>

	* app/gimprc.c: Convert ugly comments into named structure fields.
	Much cleaner and less errorprone though may cause troubles on
	older compilers and then needs to be reverted. Please report!

	* app/base/base-types.h: Add FIXME reminder.

	* app/base/gimplut.c: Use CLAMP macro instead of if-cascade.

	* app/base/temp-buf.c: Remove duplicated calculations and simplify
	checks.

	* app/base/tile-manager.c:
	- (tile_manager_get_tile_num): Return success and take an additional
	  pointer for the tilenumber.
	- Simplify logic in the rest of the file as a result.
	- Remove rotten debugging cruft.

	* app/core/gimpbrushgenerated.c: Fix two stylistic nits.

	* app/app_procs.c: Include <stdlib.h> for exit () prototype.

	* app/core/gimpdrawable-blend.c: Include <stdlib.h> for abs ()
	prototype.

	* app/display/gimpdisplay.c: Include <string.h> for memcpy ()
	prototype.

	* app/core/gimpimage-convert.c: (HIST_RGB): First parameter is
	not const. Fixes a gcc warning for a wrong return value.

	* libgimpwidgets/gimpunitmenu.c
	* app/core/gimpunit.c: Add suggested (by gcc 3.1 cvs) parentheses
	to group correct logic tests together.

	* app/paint-funcs/paint-funcs-generic.h: Fix my HAS_ALPHA macro
	to avoid gcc 3.1 cvs warning.

	* app/gimprc.h
	* pathP.h
	* base-config.h
	* app/base/boundary.h
	* app/base/gimplut.[ch]
	* app/base/pixel-region.h
	* app/base/pixel-surround.[ch]
	* app/base/temp-buf.[ch]
	* app/base/tile-manager-private.h
	* app/base/tile-manager.c
	* app/base/tile-private.h
	* app/base/tile.[ch]
	* app/core/gimp.h
	* app/core/gimpbrushgenerated.h
	* app/core/gimpbrushpipe.h
	* app/core/gimpchannel.[ch]
	* app/core/gimpcontainer.h
	* app/core/gimpcoreconfig.h
	* app/core/gimpdata.h
	* app/core/gimpdatafactory.[ch]
	* app/core/gimpdrawable-blend.c
	* app/core/gimpdrawable.[ch]
	* app/core/gimpimage.h
	* app/core/gimpimagefile.h
	* app/core/gimplayer.h
	* app/core/gimplayermask.h
	* app/core/gimpmoduleinfo.h
	* app/core/gimppalette.h
	* app/core/gimpundo.h
	* app/display/gimpdisplay.h
	* app/display/gimpdisplayshell-selection.h
	* app/display/gimpdisplayshell.h
	* app/gui/brush-select.h
	* app/gui/gradient-editor.h
	* app/gui/gradient-select.h
	* app/gui/info-dialog.h
	* app/gui/resize-dialog.h
	* app/tools/gimpbezierselecttool.h
	* app/tools/gimpcolorbalancetool.h
	* app/tools/gimpcolorpickertool.h
	* app/tools/gimpcurvestool.h
	* app/tools/gimpdodgeburntool.c
	* app/tools/gimpfreeselecttool.h
	* app/tools/gimpfuzzyselecttool.h
	* app/tools/gimphuesaturationtool.h
	* app/tools/gimpinktool-blob.h
	* app/tools/gimpinktool.h
	* app/tools/gimpiscissorstool.h
	* app/tools/gimpmagnifytool.h
	* app/tools/gimpmeasuretool.h
	* app/tools/gimppainttool.h
	* app/tools/gimppathtool.h
	* app/tools/gimprectselecttool.h
	* app/tools/gimpthresholdtool.h
	* app/tools/gimptool.h
	* app/tools/gimptransformtool.h
	* app/tools/path_toolP.h
	* app/widgets/gimpbrushfactoryview.h
	* app/widgets/gimpconstrainedhwrapbox.h
	* app/widgets/gimpcontainermenu.h
	* app/widgets/gimpcontainerview.h
	* app/widgets/gimpdialogfactory.h
	* app/widgets/gimpimagedock.h
	* app/widgets/gimplistitem.h
	* app/widgets/gimpmenuitem.h
	* app/widgets/gimpnavigationpreview.h
	* app/widgets/gimppreview.h: Unsignify lots of variables and
	parameters and use bitfields in structs where possible. First
	part of a huge cleanup all over the code...
parent 6d0e5c34
2001-12-02 Daniel Egger <degger@fhm.edu>
* app/gimprc.c: Convert ugly comments into named structure fields.
Much cleaner and less errorprone though may cause troubles on
older compilers and then needs to be reverted. Please report!
* app/base/base-types.h: Add FIXME reminder.
* app/base/gimplut.c: Use CLAMP macro instead of if-cascade.
* app/base/temp-buf.c: Remove duplicated calculations and simplify
checks.
* app/base/tile-manager.c:
- (tile_manager_get_tile_num): Return success and take an additional
pointer for the tilenumber.
- Simplify logic in the rest of the file as a result.
- Remove rotten debugging cruft.
* app/core/gimpbrushgenerated.c: Fix two stylistic nits.
* app/app_procs.c: Include <stdlib.h> for exit () prototype.
* app/core/gimpdrawable-blend.c: Include <stdlib.h> for abs ()
prototype.
* app/display/gimpdisplay.c: Include <string.h> for memcpy ()
prototype.
* app/core/gimpimage-convert.c: (HIST_RGB): First parameter is
not const. Fixes a gcc warning for a wrong return value.
* libgimpwidgets/gimpunitmenu.c
* app/core/gimpunit.c: Add suggested (by gcc 3.1 cvs) parentheses
to group correct logic tests together.
* app/paint-funcs/paint-funcs-generic.h: Fix my HAS_ALPHA macro
to avoid gcc 3.1 cvs warning.
* app/gimprc.h
* pathP.h
* base-config.h
* app/base/boundary.h
* app/base/gimplut.[ch]
* app/base/pixel-region.h
* app/base/pixel-surround.[ch]
* app/base/temp-buf.[ch]
* app/base/tile-manager-private.h
* app/base/tile-manager.c
* app/base/tile-private.h
* app/base/tile.[ch]
* app/core/gimp.h
* app/core/gimpbrushgenerated.h
* app/core/gimpbrushpipe.h
* app/core/gimpchannel.[ch]
* app/core/gimpcontainer.h
* app/core/gimpcoreconfig.h
* app/core/gimpdata.h
* app/core/gimpdatafactory.[ch]
* app/core/gimpdrawable-blend.c
* app/core/gimpdrawable.[ch]
* app/core/gimpimage.h
* app/core/gimpimagefile.h
* app/core/gimplayer.h
* app/core/gimplayermask.h
* app/core/gimpmoduleinfo.h
* app/core/gimppalette.h
* app/core/gimpundo.h
* app/display/gimpdisplay.h
* app/display/gimpdisplayshell-selection.h
* app/display/gimpdisplayshell.h
* app/gui/brush-select.h
* app/gui/gradient-editor.h
* app/gui/gradient-select.h
* app/gui/info-dialog.h
* app/gui/resize-dialog.h
* app/tools/gimpbezierselecttool.h
* app/tools/gimpcolorbalancetool.h
* app/tools/gimpcolorpickertool.h
* app/tools/gimpcurvestool.h
* app/tools/gimpdodgeburntool.c
* app/tools/gimpfreeselecttool.h
* app/tools/gimpfuzzyselecttool.h
* app/tools/gimphuesaturationtool.h
* app/tools/gimpinktool-blob.h
* app/tools/gimpinktool.h
* app/tools/gimpiscissorstool.h
* app/tools/gimpmagnifytool.h
* app/tools/gimpmeasuretool.h
* app/tools/gimppainttool.h
* app/tools/gimppathtool.h
* app/tools/gimprectselecttool.h
* app/tools/gimpthresholdtool.h
* app/tools/gimptool.h
* app/tools/gimptransformtool.h
* app/tools/path_toolP.h
* app/widgets/gimpbrushfactoryview.h
* app/widgets/gimpconstrainedhwrapbox.h
* app/widgets/gimpcontainermenu.h
* app/widgets/gimpcontainerview.h
* app/widgets/gimpdialogfactory.h
* app/widgets/gimpimagedock.h
* app/widgets/gimplistitem.h
* app/widgets/gimpmenuitem.h
* app/widgets/gimpnavigationpreview.h
* app/widgets/gimppreview.h: Unsignify lots of variables and
parameters and use bitfields in structs where possible. First
part of a huge cleanup all over the code...
2001-12-01 Michael Natterer <mitch@gimp.org> 2001-12-01 Michael Natterer <mitch@gimp.org>
* app/errors.c: forgot a "return". * app/errors.c: forgot a "return".
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <stdlib.h>
#ifdef HAVE_SYS_PARAM_H #ifdef HAVE_SYS_PARAM_H
#include <sys/param.h> #include <sys/param.h>
#endif #endif
......
...@@ -29,7 +29,7 @@ struct _GimpBaseConfig ...@@ -29,7 +29,7 @@ struct _GimpBaseConfig
guint tile_cache_size; guint tile_cache_size;
gboolean stingy_memory_use; gboolean stingy_memory_use;
InterpolationType interpolation_type; InterpolationType interpolation_type;
gint num_processors; guint num_processors;
}; };
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
/* magic constants */ /* magic constants */
/* FIXME: Remove magic constants! */
#define MAX_CHANNELS 4 #define MAX_CHANNELS 4
#define GRAY_PIX 0 #define GRAY_PIX 0
......
...@@ -33,8 +33,8 @@ struct _BoundSeg ...@@ -33,8 +33,8 @@ struct _BoundSeg
gint y1; gint y1;
gint x2; gint x2;
gint y2; gint y2;
gboolean open; guint open : 1;
gboolean visited; guint visited : 1;
}; };
......
...@@ -67,8 +67,8 @@ struct _ColorBalanceDialog ...@@ -67,8 +67,8 @@ struct _ColorBalanceDialog
guchar g_lookup[256]; guchar g_lookup[256];
guchar b_lookup[256]; guchar b_lookup[256];
gboolean preserve_luminosity; guint preserve_luminosity : 1;
gboolean preview; guint preview : 1;
GimpTransferMode application_mode; GimpTransferMode application_mode;
}; };
......
...@@ -70,7 +70,7 @@ struct _CurvesDialog ...@@ -70,7 +70,7 @@ struct _CurvesDialog
gint color; gint color;
gint channel; gint channel;
gboolean preview; guint preview : 1;
gint grab_point; gint grab_point;
gint last; gint last;
......
...@@ -58,9 +58,9 @@ void ...@@ -58,9 +58,9 @@ void
gimp_lut_setup (GimpLut *lut, gimp_lut_setup (GimpLut *lut,
GimpLutFunc func, GimpLutFunc func,
void *user_data, void *user_data,
gint nchannels) guint nchannels)
{ {
gint i, v; guint i, v;
gdouble val; gdouble val;
if (lut->luts) if (lut->luts)
...@@ -83,12 +83,7 @@ gimp_lut_setup (GimpLut *lut, ...@@ -83,12 +83,7 @@ gimp_lut_setup (GimpLut *lut,
/* to add gamma correction use func(v ^ g) ^ 1/g instead. */ /* to add gamma correction use func(v ^ g) ^ 1/g instead. */
val = 255.0 * func (user_data, lut->nchannels, i, v/255.0) + 0.5; val = 255.0 * func (user_data, lut->nchannels, i, v/255.0) + 0.5;
if (val < 0.0) lut->luts[i][v] = CLAMP (val, 0, 255);
lut->luts[i][v] = 0;
else if (val >= 255.0)
lut->luts[i][v] = 255;
else
lut->luts[i][v] = val;
} }
} }
} }
...@@ -97,7 +92,7 @@ void ...@@ -97,7 +92,7 @@ void
gimp_lut_setup_exact (GimpLut *lut, gimp_lut_setup_exact (GimpLut *lut,
GimpLutFunc func, GimpLutFunc func,
void *user_data, void *user_data,
gint nchannels) guint nchannels)
{ {
gimp_lut_setup (lut, func, user_data, nchannels); gimp_lut_setup (lut, func, user_data, nchannels);
} }
...@@ -107,7 +102,7 @@ gimp_lut_process (GimpLut *lut, ...@@ -107,7 +102,7 @@ gimp_lut_process (GimpLut *lut,
PixelRegion *srcPR, PixelRegion *srcPR,
PixelRegion *destPR) PixelRegion *destPR)
{ {
gint h, width, src_r_i, dest_r_i; guint h, width, src_r_i, dest_r_i;
guchar *src, *dest; guchar *src, *dest;
guchar *lut0 = NULL, *lut1 = NULL, *lut2 = NULL, *lut3 = NULL; guchar *lut0 = NULL, *lut1 = NULL, *lut2 = NULL, *lut3 = NULL;
...@@ -189,7 +184,7 @@ void ...@@ -189,7 +184,7 @@ void
gimp_lut_process_inline (GimpLut *lut, gimp_lut_process_inline (GimpLut *lut,
PixelRegion *srcPR) PixelRegion *srcPR)
{ {
gint h, width, src_r_i; guint h, width, src_r_i;
guchar *src; guchar *src;
guchar *lut0 = NULL, *lut1 = NULL, *lut2 = NULL, *lut3 = NULL; guchar *lut0 = NULL, *lut1 = NULL, *lut2 = NULL, *lut3 = NULL;
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
struct _GimpLut struct _GimpLut
{ {
guchar **luts; guchar **luts;
gint nchannels; guint nchannels;
}; };
/* TODO: the GimpLutFunc should really be passed the ColorModel of the region, /* TODO: the GimpLutFunc should really be passed the ColorModel of the region,
...@@ -36,18 +36,17 @@ struct _GimpLut ...@@ -36,18 +36,17 @@ struct _GimpLut
* and do no correction as this will be handled by gimp_lut_setup * and do no correction as this will be handled by gimp_lut_setup
*/ */
typedef gfloat (*GimpLutFunc) (gpointer user_data, typedef gfloat (*GimpLutFunc) (gpointer user_data,
gint nchannels, guint nchannels,
gint channel, guint channel,
gfloat value); gfloat value);
GimpLut * gimp_lut_new (void); GimpLut * gimp_lut_new (void);
void gimp_lut_free (GimpLut *lut); void gimp_lut_free (GimpLut *lut);
void gimp_lut_setup (GimpLut *lut, void gimp_lut_setup (GimpLut *lut,
GimpLutFunc func, GimpLutFunc func,
gpointer user_data, gpointer user_data,
gint nchannels); guint nchannels);
/* gimp_lut_setup_exact is currently identical to gimp_lut_setup. It /* gimp_lut_setup_exact is currently identical to gimp_lut_setup. It
* however is guaranteed to never perform any interpolation or gamma * however is guaranteed to never perform any interpolation or gamma
...@@ -56,7 +55,7 @@ void gimp_lut_setup (GimpLut *lut, ...@@ -56,7 +55,7 @@ void gimp_lut_setup (GimpLut *lut,
void gimp_lut_setup_exact (GimpLut *lut, void gimp_lut_setup_exact (GimpLut *lut,
GimpLutFunc func, GimpLutFunc func,
gpointer user_data, gpointer user_data,
gint nchannels); guint nchannels);
void gimp_lut_process (GimpLut *lut, void gimp_lut_process (GimpLut *lut,
PixelRegion *srcPR, PixelRegion *srcPR,
...@@ -78,5 +77,4 @@ void gimp_lut_process_2 (PixelRegion *srcPR, ...@@ -78,5 +77,4 @@ void gimp_lut_process_2 (PixelRegion *srcPR,
PixelRegion *destPR, PixelRegion *destPR,
GimpLut *lut); GimpLut *lut);
#endif /* __GIMP_LUT_H__ */ #endif /* __GIMP_LUT_H__ */
...@@ -77,7 +77,7 @@ struct _HueSaturationDialog ...@@ -77,7 +77,7 @@ struct _HueSaturationDialog
gdouble saturation[7]; gdouble saturation[7];
HueRange hue_partition; HueRange hue_partition;
gboolean preview; guint preview : 1;
}; };
......
...@@ -27,14 +27,14 @@ struct _PixelRegion ...@@ -27,14 +27,14 @@ struct _PixelRegion
Tile *curtile; /* current tile */ Tile *curtile; /* current tile */
gint offx; /* tile offsets */ gint offx; /* tile offsets */
gint offy; /* tile offsets */ gint offy; /* tile offsets */
gint rowstride; /* bytes per pixel row */ guint rowstride; /* bytes per pixel row */
gint x; /* origin */ gint x; /* origin */
gint y; /* origin */ gint y; /* origin */
gint w; /* width of region */ guint w; /* width of region */
gint h; /* height of region */ guint h; /* height of region */
gint bytes; /* bytes per pixel */ guint bytes; /* bytes per pixel */
gboolean dirty; /* will this region be dirtied? */ guint dirty : 1; /* will this region be dirtied? */
gint process_count; /* used internally */ guint process_count; /* used internally */
}; };
struct _PixelRegionHolder struct _PixelRegionHolder
...@@ -43,18 +43,18 @@ struct _PixelRegionHolder ...@@ -43,18 +43,18 @@ struct _PixelRegionHolder
guchar *original_data; guchar *original_data;
gint startx; gint startx;
gint starty; gint starty;
gint count; guint count;
}; };
struct _PixelRegionIterator struct _PixelRegionIterator
{ {
GSList *pixel_regions; GSList *pixel_regions;
gint dirty_tiles; guint dirty_tiles;
gint region_width; guint region_width;
gint region_height; guint region_height;
gint portion_width; guint portion_width;
gint portion_height; guint portion_height;
gint process_count; guint process_count;
}; };
......
...@@ -31,11 +31,11 @@ ...@@ -31,11 +31,11 @@
void void
pixel_surround_init (PixelSurround *ps, pixel_surround_init (PixelSurround *ps,
TileManager *tm, TileManager *tm,
gint w, guint w,
gint h, guint h,
guchar bg[MAX_CHANNELS]) guchar bg[MAX_CHANNELS])
{ {
gint i; guint i;
for (i = 0; i < MAX_CHANNELS; ++i) for (i = 0; i < MAX_CHANNELS; ++i)
{ {
...@@ -55,10 +55,10 @@ pixel_surround_init (PixelSurround *ps, ...@@ -55,10 +55,10 @@ pixel_surround_init (PixelSurround *ps,
guchar * guchar *
pixel_surround_lock (PixelSurround *ps, pixel_surround_lock (PixelSurround *ps,
gint x, guint x,
gint y) guint y)
{ {
gint i, j; guint i, j;
guchar *k; guchar *k;
guchar *ptr; guchar *ptr;
...@@ -119,7 +119,7 @@ pixel_surround_lock (PixelSurround *ps, ...@@ -119,7 +119,7 @@ pixel_surround_lock (PixelSurround *ps,
return ps->buff; return ps->buff;
} }
gint guint
pixel_surround_rowstride (PixelSurround *ps) pixel_surround_rowstride (PixelSurround *ps)
{ {
return ps->row_stride; return ps->row_stride;
......
...@@ -29,19 +29,19 @@ typedef struct _PixelSurround ...@@ -29,19 +29,19 @@ typedef struct _PixelSurround
Tile *tile; Tile *tile;
TileManager *mgr; TileManager *mgr;
guchar *buff; guchar *buff;
gint buff_size; guint buff_size;
gint bpp; guint bpp;
gint w; guint w;
gint h; guint h;
guchar bg[MAX_CHANNELS]; guchar bg[MAX_CHANNELS];
gint row_stride; guint row_stride;
} PixelSurround; } PixelSurround;
void pixel_surround_init (PixelSurround *ps, void pixel_surround_init (PixelSurround *ps,
TileManager *tm, TileManager *tm,
gint w, guint w,
gint h, guint h,
guchar bg[MAX_CHANNELS]); guchar bg[MAX_CHANNELS]);
/* return a pointer to a buffer which contains all the surrounding pixels /* return a pointer to a buffer which contains all the surrounding pixels
...@@ -49,10 +49,10 @@ void pixel_surround_init (PixelSurround *ps, ...@@ -49,10 +49,10 @@ void pixel_surround_init (PixelSurround *ps,
* otherwise just copy into our own malloced buffer and return that * otherwise just copy into our own malloced buffer and return that
*/ */
guchar * pixel_surround_lock (PixelSurround *ps, guchar * pixel_surround_lock (PixelSurround *ps,
gint x, guint x,
gint y); guint y);
gint pixel_surround_rowstride (PixelSurround *ps); guint pixel_surround_rowstride (PixelSurround *ps);
void pixel_surround_release (PixelSurround *ps); void pixel_surround_release (PixelSurround *ps);
......
...@@ -54,7 +54,7 @@ static void temp_buf_to_gray (TempBuf *src_buf, ...@@ -54,7 +54,7 @@ static void temp_buf_to_gray (TempBuf *src_buf,
/* Memory management */ /* Memory management */
static guchar * static inline guchar *
temp_buf_allocate (guint size) temp_buf_allocate (guint size)
{ {
guchar *data; guchar *data;
...@@ -73,7 +73,7 @@ temp_buf_to_color (TempBuf *src_buf, ...@@ -73,7 +73,7 @@ temp_buf_to_color (TempBuf *src_buf,
{ {
guchar *src; guchar *src;
guchar *dest; guchar *dest;
glong num_bytes; gulong num_bytes;
src = temp_buf_data (src_buf); src = temp_buf_data (src_buf);
dest = temp_buf_data (dest_buf); dest = temp_buf_data (dest_buf);
...@@ -97,7 +97,7 @@ temp_buf_to_gray (TempBuf *src_buf, ...@@ -97,7 +97,7 @@ temp_buf_to_gray (TempBuf *src_buf,
{ {
guchar *src; guchar *src;
guchar *dest; guchar *dest;
glong num_bytes; gulong num_bytes;
gfloat pix; gfloat pix;
src = temp_buf_data (src_buf); src = temp_buf_data (src_buf);
...@@ -117,19 +117,20 @@ temp_buf_to_gray (TempBuf *src_buf, ...@@ -117,19 +117,20 @@ temp_buf_to_gray (TempBuf *src_buf,
} }
TempBuf * TempBuf *
temp_buf_new (gint width, temp_buf_new (guint width,
gint height, guint height,
gint bytes, guint bytes,
gint x, gint x,
gint y, gint y,
guchar *col) guchar *col)
{ {
glong i; const gulong size = width * height * bytes;
gint j; glong i;
guchar *data; gint j;
TempBuf *temp; guchar *data;
TempBuf *temp;
g_return_val_if_fail (width > 0 && height > 0, NULL); g_return_val_if_fail (size > 0, NULL);
temp = g_new (TempBuf, 1); temp = g_new (TempBuf, 1);
...@@ -141,7 +142,7 @@ temp_buf_new (gint width, ...@@ -141,7 +142,7 @@ temp_buf_new (gint width,
temp->swapped = FALSE; temp->swapped = FALSE;
temp->filename = NULL; temp->filename = NULL;
temp->data = data = temp_buf_allocate (width * height * bytes); temp->data = data = temp_buf_allocate (size);
/* initialize the data */ /* initialize the data */
if (col) if (col)
...@@ -197,8 +198,8 @@ temp_buf_new (gint width, ...@@ -197,8 +198,8 @@ temp_buf_new (gint width,
parameters into a newly allocated tempbuf */ parameters into a newly allocated tempbuf */
TempBuf * TempBuf *
temp_buf_new_check (gint width, temp_buf_new_check (guint width,
gint height, guint height,
GimpCheckType check_type, GimpCheckType check_type,
GimpCheckSize check_size) GimpCheckSize check_size)
{ {
...@@ -207,7 +208,7 @@ temp_buf_new_check (gint width, ...@@ -207,7 +208,7 @@ temp_buf_new_check (gint width,
guchar check_shift = 0; guchar check_shift = 0;
guchar fg_color = 0; guchar fg_color = 0;
guchar bg_color = 0; guchar bg_color = 0;
gint i, j; guint i, j;
g_return_val_if_fail (width > 0 && height > 0, NULL); g_return_val_if_fail (width > 0 && height > 0, NULL);
...@@ -308,18 +309,16 @@ temp_buf_copy (TempBuf *src, ...@@ -308,18 +309,16 @@ temp_buf_copy (TempBuf *src,
TempBuf * TempBuf *
temp_buf_resize (TempBuf *buf, temp_buf_resize (TempBuf *buf,
gint bytes, guint bytes,
gint x, gint x,
gint y, gint y,
gint width, guint width,
gint height) guint height)
{ {
gint size;
g_return_val_if_fail (width > 0 && height > 0, NULL);
/* calculate the requested size */ /* calculate the requested size */
size = width * height * bytes; const gulong size = width * height * bytes;
g_return_val_if_fail (size > 0, NULL);
/* First, configure the canvas buffer */ /* First, configure the canvas buffer */
if (!buf) if (!buf)
...@@ -350,11 +349,11 @@ temp_buf_resize (TempBuf *buf, ...@@ -350,11 +349,11 @@ temp_buf_resize (TempBuf *buf,
TempBuf * TempBuf *
temp_buf_scale (TempBuf *src, temp_buf_scale (TempBuf *src,
gint new_width, guint new_width,
gint new_height) guint new_height)
{ {
gint loop1; guint loop1;
gint loop2; guint loop2;
gdouble x_ratio; gdouble x_ratio;
gdouble y_ratio; gdouble y_ratio;
guchar *src_data; guchar *src_data;
...@@ -403,8 +402,8 @@ temp_buf_copy_area (TempBuf *src, ...@@ -403,8 +402,8 @@ temp_buf_copy_area (TempBuf *src,
TempBuf *dest, TempBuf *dest,
gint x, gint x,
gint y, gint y,
gint width, guint width,
gint height, guint height,
gint dest_x, gint dest_x,
gint dest_y) gint dest_y)
{ {
...@@ -508,8 +507,8 @@ temp_buf_data_clear (TempBuf *temp_buf) ...@@ -508,8 +507,8 @@ temp_buf_data_clear (TempBuf *temp_buf)
MaskBuf *