mirror of https://github.com/GNOME/gimp.git
Fixed usage of uninitialized memory found by valgrind, plus some cleanup:
2002-08-22 Michael Natterer <mitch@gimp.org> Fixed usage of uninitialized memory found by valgrind, plus some cleanup: * app/base/pixel-region.[ch]: allocate PixelRegionIterators and PixelRegionHolders with g_new0(). Changed return values of pixel_regions_register() and pixel_regions_process() from gpointer to PixelRegionIterator* * app/base/pixel-processor.c: no need to cast the above return values. * app/base/temp-buf.[ch]: initialize PixelRegions with { 0 } before using them for TempBufs. * app/gui/device-status-dialog.c: initialize colors before passing them to gimp_color_area_new().
This commit is contained in:
parent
ca8b830162
commit
06aa1afdde
18
ChangeLog
18
ChangeLog
|
@ -1,3 +1,21 @@
|
|||
2002-08-22 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
Fixed usage of uninitialized memory found by valgrind,
|
||||
plus some cleanup:
|
||||
|
||||
* app/base/pixel-region.[ch]: allocate PixelRegionIterators and
|
||||
PixelRegionHolders with g_new0(). Changed return values of
|
||||
pixel_regions_register() and pixel_regions_process() from gpointer
|
||||
to PixelRegionIterator*
|
||||
|
||||
* app/base/pixel-processor.c: no need to cast the above return values.
|
||||
|
||||
* app/base/temp-buf.[ch]: initialize PixelRegions with { 0 }
|
||||
before using them for TempBufs.
|
||||
|
||||
* app/gui/device-status-dialog.c: initialize colors before
|
||||
passing them to gimp_color_area_new().
|
||||
|
||||
2002-08-21 Maurits Rijk <lpeek.mrijk@consunet.nl>
|
||||
|
||||
* plug-ins/imagemap/imap_cmd_guides.c (make_guides_dialog)
|
||||
|
|
|
@ -83,7 +83,7 @@ do_parallel_regions (PixelProcessor *p_s)
|
|||
pthread_mutex_lock (&p_s->mutex);
|
||||
|
||||
if (p_s->nthreads != 0 && p_s->PRI)
|
||||
p_s->PRI = (PixelRegionIterator*)pixel_regions_process(p_s->PRI);
|
||||
p_s->PRI = pixel_regions_process (p_s->PRI);
|
||||
|
||||
if (p_s->PRI == NULL)
|
||||
{
|
||||
|
@ -156,7 +156,7 @@ do_parallel_regions (PixelProcessor *p_s)
|
|||
|
||||
}
|
||||
while (cont && p_s->PRI &&
|
||||
(p_s->PRI = (PixelRegionIterator*)pixel_regions_process(p_s->PRI)));
|
||||
(p_s->PRI = pixel_regions_process (p_s->PRI)));
|
||||
|
||||
p_s->nthreads--;
|
||||
|
||||
|
@ -221,7 +221,7 @@ do_parallel_regions_single (PixelProcessor *p_s)
|
|||
cont = 0;
|
||||
}
|
||||
while (cont && p_s->PRI &&
|
||||
(p_s->PRI = (PixelRegionIterator*)pixel_regions_process(p_s->PRI)));
|
||||
(p_s->PRI = pixel_regions_process (p_s->PRI)));
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -291,34 +291,34 @@ pixel_regions_real_process_parallel (p_func f,
|
|||
switch(num_regions)
|
||||
{
|
||||
case 1:
|
||||
p_s->PRI = (PixelRegionIterator *) pixel_regions_register (num_regions,
|
||||
p_s->r[0]);
|
||||
p_s->PRI = pixel_regions_register (num_regions,
|
||||
p_s->r[0]);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
p_s->PRI = (PixelRegionIterator *) pixel_regions_register (num_regions,
|
||||
p_s->r[0],
|
||||
p_s->r[1]);
|
||||
break;
|
||||
p_s->PRI = pixel_regions_register (num_regions,
|
||||
p_s->r[0],
|
||||
p_s->r[1]);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
p_s->PRI = (PixelRegionIterator *) pixel_regions_register (num_regions,
|
||||
p_s->r[0],
|
||||
p_s->r[1],
|
||||
p_s->r[2]);
|
||||
break;
|
||||
case 3:
|
||||
p_s->PRI = pixel_regions_register (num_regions,
|
||||
p_s->r[0],
|
||||
p_s->r[1],
|
||||
p_s->r[2]);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
p_s->PRI = (PixelRegionIterator *) pixel_regions_register (num_regions,
|
||||
p_s->r[0],
|
||||
p_s->r[1],
|
||||
p_s->r[2],
|
||||
p_s->r[3]);
|
||||
break;
|
||||
case 4:
|
||||
p_s->PRI = pixel_regions_register (num_regions,
|
||||
p_s->r[0],
|
||||
p_s->r[1],
|
||||
p_s->r[2],
|
||||
p_s->r[3]);
|
||||
break;
|
||||
|
||||
default:
|
||||
g_message ("pixel_regions_real_process_parallel: Bad number of regions %d\n",
|
||||
p_s->n_regions);
|
||||
default:
|
||||
g_message ("pixel_regions_real_process_parallel: Bad number of regions %d\n",
|
||||
p_s->n_regions);
|
||||
}
|
||||
|
||||
if (!p_s->PRI)
|
||||
|
|
|
@ -33,11 +33,11 @@
|
|||
/*********************/
|
||||
/* Local Functions */
|
||||
|
||||
static gint get_portion_width (PixelRegionIterator *PRI);
|
||||
static gint get_portion_height (PixelRegionIterator *PRI);
|
||||
static gpointer pixel_regions_configure (PixelRegionIterator *PRI);
|
||||
static void pixel_region_configure (PixelRegionHolder *PRH,
|
||||
PixelRegionIterator *PRI);
|
||||
static gint get_portion_width (PixelRegionIterator *PRI);
|
||||
static gint get_portion_height (PixelRegionIterator *PRI);
|
||||
static PixelRegionIterator * pixel_regions_configure (PixelRegionIterator *PRI);
|
||||
static void pixel_region_configure (PixelRegionHolder *PRH,
|
||||
PixelRegionIterator *PRI);
|
||||
|
||||
|
||||
/**************************/
|
||||
|
@ -247,7 +247,7 @@ pixel_region_has_alpha (PixelRegion *PR)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
gpointer
|
||||
PixelRegionIterator *
|
||||
pixel_regions_register (gint num_regions,
|
||||
...)
|
||||
{
|
||||
|
@ -257,10 +257,8 @@ pixel_regions_register (gint num_regions,
|
|||
gboolean found;
|
||||
va_list ap;
|
||||
|
||||
PRI = g_new (PixelRegionIterator, 1);
|
||||
PRI->pixel_regions = NULL;
|
||||
PRI->process_count = 0;
|
||||
PRI->dirty_tiles = 1;
|
||||
PRI = g_new0 (PixelRegionIterator, 1);
|
||||
PRI->dirty_tiles = 1;
|
||||
|
||||
if (num_regions < 1)
|
||||
return NULL;
|
||||
|
@ -271,7 +269,8 @@ pixel_regions_register (gint num_regions,
|
|||
while (num_regions --)
|
||||
{
|
||||
PR = va_arg (ap, PixelRegion *);
|
||||
PRH = g_new (PixelRegionHolder, 1);
|
||||
|
||||
PRH = g_new0 (PixelRegionHolder, 1);
|
||||
PRH->PR = PR;
|
||||
|
||||
if (PR != NULL)
|
||||
|
@ -303,7 +302,7 @@ pixel_regions_register (gint num_regions,
|
|||
}
|
||||
|
||||
|
||||
gpointer
|
||||
PixelRegionIterator *
|
||||
pixel_regions_process (PixelRegionIterator *PRI)
|
||||
{
|
||||
GSList *list;
|
||||
|
@ -476,14 +475,14 @@ get_portion_width (PixelRegionIterator *PRI)
|
|||
}
|
||||
|
||||
|
||||
static gpointer
|
||||
static PixelRegionIterator *
|
||||
pixel_regions_configure (PixelRegionIterator *PRI)
|
||||
{
|
||||
PixelRegionHolder *PRH;
|
||||
GSList *list;
|
||||
|
||||
/* Determine the portion width and height */
|
||||
PRI->portion_width = get_portion_width (PRI);
|
||||
PRI->portion_width = get_portion_width (PRI);
|
||||
PRI->portion_height = get_portion_height (PRI);
|
||||
|
||||
if (PRI->portion_width == 0 || PRI->portion_height == 0)
|
||||
|
|
|
@ -101,10 +101,10 @@ void pixel_region_set_col (PixelRegion *PR,
|
|||
guchar *data);
|
||||
gboolean pixel_region_has_alpha (PixelRegion *PR);
|
||||
|
||||
gpointer pixel_regions_register (gint num_regions,
|
||||
...);
|
||||
gpointer pixel_regions_process (PixelRegionIterator *PRI);
|
||||
void pixel_regions_process_stop (PixelRegionIterator *PRI);
|
||||
PixelRegionIterator * pixel_regions_register (gint num_regions,
|
||||
...);
|
||||
PixelRegionIterator * pixel_regions_process (PixelRegionIterator *PRI);
|
||||
void pixel_regions_process_stop (PixelRegionIterator *PRI);
|
||||
|
||||
|
||||
#endif /* __PIXEL_REGION_H__ */
|
||||
|
|
|
@ -431,7 +431,8 @@ temp_buf_copy_area (TempBuf *src,
|
|||
gint dest_y)
|
||||
{
|
||||
TempBuf *new;
|
||||
PixelRegion srcR, destR;
|
||||
PixelRegion srcPR = { 0 };
|
||||
PixelRegion destPR = { 0 };
|
||||
guchar empty[MAX_CHANNELS] = { 0, 0, 0, 0 };
|
||||
gint x1, y1, x2, y2;
|
||||
|
||||
|
@ -470,21 +471,21 @@ temp_buf_copy_area (TempBuf *src,
|
|||
}
|
||||
|
||||
/* Copy the region */
|
||||
srcR.bytes = src->bytes;
|
||||
srcR.w = width;
|
||||
srcR.h = height;
|
||||
srcR.rowstride = src->bytes * src->width;
|
||||
srcR.data = (temp_buf_data (src) +
|
||||
y1 * srcR.rowstride +
|
||||
x1 * srcR.bytes);
|
||||
srcPR.bytes = src->bytes;
|
||||
srcPR.w = width;
|
||||
srcPR.h = height;
|
||||
srcPR.rowstride = src->bytes * src->width;
|
||||
srcPR.data = (temp_buf_data (src) +
|
||||
y1 * srcPR.rowstride +
|
||||
x1 * srcPR.bytes);
|
||||
|
||||
destR.bytes = dest->bytes;
|
||||
destR.rowstride = new->bytes * new->width;
|
||||
destR.data = (temp_buf_data (new) +
|
||||
dest_y * destR.rowstride +
|
||||
dest_x * destR.bytes);
|
||||
destPR.bytes = dest->bytes;
|
||||
destPR.rowstride = new->bytes * new->width;
|
||||
destPR.data = (temp_buf_data (new) +
|
||||
dest_y * destPR.rowstride +
|
||||
dest_x * destPR.bytes);
|
||||
|
||||
copy_region (&srcR, &destR);
|
||||
copy_region (&srcPR, &destPR);
|
||||
|
||||
return new;
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@ device_status_dialog_create (Gimp *gimp)
|
|||
GimpContext *context;
|
||||
GtkWidget *label;
|
||||
GimpRGB color;
|
||||
GList *list;
|
||||
GList *list;
|
||||
gint i;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
||||
|
@ -120,7 +120,7 @@ device_status_dialog_create (Gimp *gimp)
|
|||
if (deviceD)
|
||||
return deviceD->shell;
|
||||
|
||||
deviceD = g_new (DeviceStatusDialog, 1);
|
||||
deviceD = g_new0 (DeviceStatusDialog, 1);
|
||||
|
||||
deviceD->shell = gimp_dialog_new (_("Device Status"), "device_status",
|
||||
gimp_standard_help_func,
|
||||
|
@ -155,6 +155,8 @@ device_status_dialog_create (Gimp *gimp)
|
|||
deviceD->patterns = g_new (GtkWidget *, deviceD->num_devices);
|
||||
deviceD->gradients = g_new (GtkWidget *, deviceD->num_devices);
|
||||
|
||||
gimp_rgba_set (&color, 0.0, 0.0, 0.0, 1.0);
|
||||
|
||||
for (list = gdk_devices_list (), i = 0;
|
||||
list;
|
||||
list = g_list_next (list), i++)
|
||||
|
|
Loading…
Reference in New Issue