app, libgimp*, pdb, plug-ins: use g_memdup2() instead of g_memdup()

Since it appeared with GLib 2.68.0, we could not change this until we
bumped the dependency which has only become possible a few days ago
(since Debian testing is our baseline for dependency bumps). Cf.
previous commit.

As this is a drop-in replacement (just a guint parameter changed to
gsize to avoid integer overflow), search-and-replace with:

> sed -i 's/g_memdup\>/g_memdup2/g' `grep -rIl 'g_memdup\>' *`

… followed by a few manual alignment tweaks when necessary.

This gets rid of the many deprecation warnings which we had lately when
building with a recent GLib version.
This commit is contained in:
Jehan 2021-08-26 17:18:32 +02:00
parent d707e4cb1a
commit 49e534247a
69 changed files with 141 additions and 141 deletions

View File

@ -176,7 +176,7 @@ gimp_bezier_desc_copy (const GimpBezierDesc *desc)
{ {
g_return_val_if_fail (desc != NULL, NULL); g_return_val_if_fail (desc != NULL, NULL);
return gimp_bezier_desc_new (g_memdup (desc->data, return gimp_bezier_desc_new (g_memdup2 (desc->data,
desc->num_data * sizeof (cairo_path_data_t)), desc->num_data * sizeof (cairo_path_data_t)),
desc->num_data); desc->num_data);
} }

View File

@ -178,19 +178,19 @@ gimp_brush_pipe_copy (GimpData *data,
pipe->dimension = src_pipe->dimension; pipe->dimension = src_pipe->dimension;
g_clear_pointer (&pipe->rank, g_free); g_clear_pointer (&pipe->rank, g_free);
pipe->rank = g_memdup (src_pipe->rank, pipe->rank = g_memdup2 (src_pipe->rank,
pipe->dimension * sizeof (gint)); pipe->dimension * sizeof (gint));
g_clear_pointer (&pipe->stride, g_free); g_clear_pointer (&pipe->stride, g_free);
pipe->stride = g_memdup (src_pipe->stride, pipe->stride = g_memdup2 (src_pipe->stride,
pipe->dimension * sizeof (gint)); pipe->dimension * sizeof (gint));
g_clear_pointer (&pipe->select, g_free); g_clear_pointer (&pipe->select, g_free);
pipe->select = g_memdup (src_pipe->select, pipe->select = g_memdup2 (src_pipe->select,
pipe->dimension * sizeof (PipeSelectModes)); pipe->dimension * sizeof (PipeSelectModes));
g_clear_pointer (&pipe->index, g_free); g_clear_pointer (&pipe->index, g_free);
pipe->index = g_memdup (src_pipe->index, pipe->index = g_memdup2 (src_pipe->index,
pipe->dimension * sizeof (gint)); pipe->dimension * sizeof (gint));
for (i = 0; i < pipe->n_brushes; i++) for (i = 0; i < pipe->n_brushes; i++)

View File

@ -263,7 +263,7 @@ gimp_histogram_duplicate (GimpHistogram *histogram)
dup->priv->n_channels = histogram->priv->n_channels; dup->priv->n_channels = histogram->priv->n_channels;
dup->priv->n_bins = histogram->priv->n_bins; dup->priv->n_bins = histogram->priv->n_bins;
dup->priv->values = g_memdup (histogram->priv->values, dup->priv->values = g_memdup2 (histogram->priv->values,
sizeof (gdouble) * sizeof (gdouble) *
dup->priv->n_channels * dup->priv->n_channels *
dup->priv->n_bins); dup->priv->n_bins);

View File

@ -909,7 +909,7 @@ gimp_image_convert_profile_colormap (GimpImage *image,
gint n_colors; gint n_colors;
n_colors = gimp_image_get_colormap_size (image); n_colors = gimp_image_get_colormap_size (image);
cmap = g_memdup (gimp_image_get_colormap (image), n_colors * 3); cmap = g_memdup2 (gimp_image_get_colormap (image), n_colors * 3);
if (bpc) if (bpc)
flags |= GIMP_COLOR_TRANSFORM_FLAGS_BLACK_POINT_COMPENSATION; flags |= GIMP_COLOR_TRANSFORM_FLAGS_BLACK_POINT_COMPENSATION;

View File

@ -183,7 +183,7 @@ gimp_image_undo_constructed (GObject *object)
case GIMP_UNDO_IMAGE_COLORMAP: case GIMP_UNDO_IMAGE_COLORMAP:
image_undo->num_colors = gimp_image_get_colormap_size (image); image_undo->num_colors = gimp_image_get_colormap_size (image);
image_undo->colormap = g_memdup (gimp_image_get_colormap (image), image_undo->colormap = g_memdup2 (gimp_image_get_colormap (image),
GIMP_IMAGE_COLORMAP_SIZE); GIMP_IMAGE_COLORMAP_SIZE);
break; break;
@ -454,7 +454,7 @@ gimp_image_undo_pop (GimpUndo *undo,
gint num_colors; gint num_colors;
num_colors = gimp_image_get_colormap_size (image); num_colors = gimp_image_get_colormap_size (image);
colormap = g_memdup (gimp_image_get_colormap (image), colormap = g_memdup2 (gimp_image_get_colormap (image),
GIMP_IMAGE_COLORMAP_SIZE); GIMP_IMAGE_COLORMAP_SIZE);
if (image_undo->colormap) if (image_undo->colormap)

View File

@ -471,7 +471,7 @@ gimp_mandala_update_strokes (GimpSymmetry *sym,
g_list_free_full (sym->strokes, g_free); g_list_free_full (sym->strokes, g_free);
sym->strokes = NULL; sym->strokes = NULL;
coords = g_memdup (sym->origin, sizeof (GimpCoords)); coords = g_memdup2 (sym->origin, sizeof (GimpCoords));
sym->strokes = g_list_prepend (sym->strokes, coords); sym->strokes = g_list_prepend (sym->strokes, coords);
/* The angle of each slice, in radians. */ /* The angle of each slice, in radians. */
@ -492,7 +492,7 @@ gimp_mandala_update_strokes (GimpSymmetry *sym,
{ {
gdouble new_x, new_y; gdouble new_x, new_y;
coords = g_memdup (sym->origin, sizeof (GimpCoords)); coords = g_memdup2 (sym->origin, sizeof (GimpCoords));
gimp_matrix3_identity (&matrix); gimp_matrix3_identity (&matrix);
gimp_matrix3_translate (&matrix, gimp_matrix3_translate (&matrix,
-center_x, -center_x,

View File

@ -336,25 +336,25 @@ gimp_mirror_update_strokes (GimpSymmetry *sym,
g_list_free_full (sym->strokes, g_free); g_list_free_full (sym->strokes, g_free);
strokes = g_list_prepend (strokes, strokes = g_list_prepend (strokes,
g_memdup (origin, sizeof (GimpCoords))); g_memdup2 (origin, sizeof (GimpCoords)));
if (mirror->horizontal_mirror) if (mirror->horizontal_mirror)
{ {
coords = g_memdup (origin, sizeof (GimpCoords)); coords = g_memdup2 (origin, sizeof (GimpCoords));
coords->y = 2.0 * mirror_position_y - origin->y; coords->y = 2.0 * mirror_position_y - origin->y;
strokes = g_list_prepend (strokes, coords); strokes = g_list_prepend (strokes, coords);
} }
if (mirror->vertical_mirror) if (mirror->vertical_mirror)
{ {
coords = g_memdup (origin, sizeof (GimpCoords)); coords = g_memdup2 (origin, sizeof (GimpCoords));
coords->x = 2.0 * mirror_position_x - origin->x; coords->x = 2.0 * mirror_position_x - origin->x;
strokes = g_list_prepend (strokes, coords); strokes = g_list_prepend (strokes, coords);
} }
if (mirror->point_symmetry) if (mirror->point_symmetry)
{ {
coords = g_memdup (origin, sizeof (GimpCoords)); coords = g_memdup2 (origin, sizeof (GimpCoords));
coords->x = 2.0 * mirror_position_x - origin->x; coords->x = 2.0 * mirror_position_x - origin->x;
coords->y = 2.0 * mirror_position_y - origin->y; coords->y = 2.0 * mirror_position_y - origin->y;
strokes = g_list_prepend (strokes, coords); strokes = g_list_prepend (strokes, coords);

View File

@ -368,7 +368,7 @@ gimp_tiling_update_strokes (GimpSymmetry *sym,
{ {
for (j = 0, y = starty; j < y_count; j++) for (j = 0, y = starty; j < y_count; j++)
{ {
coords = g_memdup (origin, sizeof (GimpCoords)); coords = g_memdup2 (origin, sizeof (GimpCoords));
coords->x = x; coords->x = x;
coords->y = y; coords->y = y;
strokes = g_list_prepend (strokes, coords); strokes = g_list_prepend (strokes, coords);
@ -403,7 +403,7 @@ gimp_tiling_update_strokes (GimpSymmetry *sym,
if (tiling->max_x && x_count >= tiling->max_x) if (tiling->max_x && x_count >= tiling->max_x)
break; break;
coords = g_memdup (origin, sizeof (GimpCoords)); coords = g_memdup2 (origin, sizeof (GimpCoords));
coords->x = x; coords->x = x;
coords->y = y; coords->y = y;
strokes = g_list_prepend (strokes, coords); strokes = g_list_prepend (strokes, coords);

View File

@ -235,7 +235,7 @@ gimp_symmetry_real_update_strokes (GimpSymmetry *sym,
{ {
/* The basic symmetry just uses the origin as is. */ /* The basic symmetry just uses the origin as is. */
sym->strokes = g_list_prepend (sym->strokes, sym->strokes = g_list_prepend (sym->strokes,
g_memdup (origin, sizeof (GimpCoords))); g_memdup2 (origin, sizeof (GimpCoords)));
} }
static void static void
@ -323,7 +323,7 @@ gimp_symmetry_set_origin (GimpSymmetry *sym,
if (origin != sym->origin) if (origin != sym->origin)
{ {
g_free (sym->origin); g_free (sym->origin);
sym->origin = g_memdup (origin, sizeof (GimpCoords)); sym->origin = g_memdup2 (origin, sizeof (GimpCoords));
} }
g_list_free_full (sym->strokes, g_free); g_list_free_full (sym->strokes, g_free);

View File

@ -157,7 +157,7 @@ gimp_canvas_boundary_set_property (GObject *object,
if (private->transform) if (private->transform)
g_free (private->transform); g_free (private->transform);
if (transform) if (transform)
private->transform = g_memdup (transform, sizeof (GimpMatrix3)); private->transform = g_memdup2 (transform, sizeof (GimpMatrix3));
else else
private->transform = NULL; private->transform = NULL;
} }
@ -377,7 +377,7 @@ gimp_canvas_boundary_new (GimpDisplayShell *shell,
private = GET_PRIVATE (item); private = GET_PRIVATE (item);
/* puke */ /* puke */
private->segs = g_memdup (segs, n_segs * sizeof (GimpBoundSeg)); private->segs = g_memdup2 (segs, n_segs * sizeof (GimpBoundSeg));
private->n_segs = n_segs; private->n_segs = n_segs;
return item; return item;

View File

@ -148,7 +148,7 @@ gimp_canvas_polygon_set_property (GObject *object,
if (array) if (array)
{ {
private->points = g_memdup (array->data, array->length); private->points = g_memdup2 (array->data, array->length);
private->n_points = array->length / sizeof (GimpVector2); private->n_points = array->length / sizeof (GimpVector2);
} }
} }
@ -160,7 +160,7 @@ gimp_canvas_polygon_set_property (GObject *object,
if (private->transform) if (private->transform)
g_free (private->transform); g_free (private->transform);
if (transform) if (transform)
private->transform = g_memdup (transform, sizeof (GimpMatrix3)); private->transform = g_memdup2 (transform, sizeof (GimpMatrix3));
else else
private->transform = NULL; private->transform = NULL;
} }

View File

@ -463,7 +463,7 @@ gimp_blob_duplicate (GimpBlob *b)
{ {
g_return_val_if_fail (b != NULL, NULL); g_return_val_if_fail (b != NULL, NULL);
return g_memdup (b, sizeof (GimpBlob) + sizeof (GimpBlobSpan) * (b->height - 1)); return g_memdup2 (b, sizeof (GimpBlob) + sizeof (GimpBlobSpan) * (b->height - 1));
} }
#if 0 #if 0

View File

@ -361,7 +361,7 @@ brush_get_pixels_invoker (GimpProcedure *procedure,
mask_bpp = babl_format_get_bytes_per_pixel (format); mask_bpp = babl_format_get_bytes_per_pixel (format);
num_mask_bytes = gimp_temp_buf_get_height (mask) * num_mask_bytes = gimp_temp_buf_get_height (mask) *
gimp_temp_buf_get_width (mask) * mask_bpp; gimp_temp_buf_get_width (mask) * mask_bpp;
mask_bytes = g_memdup (data, num_mask_bytes); mask_bytes = g_memdup2 (data, num_mask_bytes);
gimp_temp_buf_unlock (mask, data); gimp_temp_buf_unlock (mask, data);
@ -375,7 +375,7 @@ brush_get_pixels_invoker (GimpProcedure *procedure,
num_color_bytes = gimp_temp_buf_get_height (pixmap) * num_color_bytes = gimp_temp_buf_get_height (pixmap) *
gimp_temp_buf_get_width (pixmap) * gimp_temp_buf_get_width (pixmap) *
color_bpp; color_bpp;
color_bytes = g_memdup (data, num_color_bytes); color_bytes = g_memdup2 (data, num_color_bytes);
gimp_temp_buf_unlock (pixmap, data); gimp_temp_buf_unlock (pixmap, data);
} }

View File

@ -807,7 +807,7 @@ drawable_thumbnail_invoker (GimpProcedure *procedure,
actual_height = gimp_temp_buf_get_height (buf); actual_height = gimp_temp_buf_get_height (buf);
bpp = babl_format_get_bytes_per_pixel (gimp_temp_buf_get_format (buf)); bpp = babl_format_get_bytes_per_pixel (gimp_temp_buf_get_format (buf));
thumbnail_data_count = gimp_temp_buf_get_data_size (buf); thumbnail_data_count = gimp_temp_buf_get_data_size (buf);
thumbnail_data = g_memdup (gimp_temp_buf_get_data (buf), thumbnail_data = g_memdup2 (gimp_temp_buf_get_data (buf),
thumbnail_data_count); thumbnail_data_count);
gimp_temp_buf_unref (buf); gimp_temp_buf_unref (buf);
@ -886,7 +886,7 @@ drawable_sub_thumbnail_invoker (GimpProcedure *procedure,
height = gimp_temp_buf_get_height (buf); height = gimp_temp_buf_get_height (buf);
bpp = babl_format_get_bytes_per_pixel (gimp_temp_buf_get_format (buf)); bpp = babl_format_get_bytes_per_pixel (gimp_temp_buf_get_format (buf));
thumbnail_data_count = gimp_temp_buf_get_data_size (buf); thumbnail_data_count = gimp_temp_buf_get_data_size (buf);
thumbnail_data = g_memdup (gimp_temp_buf_get_data (buf), thumbnail_data = g_memdup2 (gimp_temp_buf_get_data (buf),
thumbnail_data_count); thumbnail_data_count);
gimp_temp_buf_unref (buf); gimp_temp_buf_unref (buf);

View File

@ -304,7 +304,7 @@ file_load_thumbnail_invoker (GimpProcedure *procedure,
width = gdk_pixbuf_get_width (pixbuf); width = gdk_pixbuf_get_width (pixbuf);
height = gdk_pixbuf_get_height (pixbuf); height = gdk_pixbuf_get_height (pixbuf);
thumb_data_count = 3 * width * height; thumb_data_count = 3 * width * height;
thumb_data = g_memdup (gdk_pixbuf_get_pixels (pixbuf), thumb_data = g_memdup2 (gdk_pixbuf_get_pixels (pixbuf),
thumb_data_count); thumb_data_count);
g_object_unref (pixbuf); g_object_unref (pixbuf);

View File

@ -1557,7 +1557,7 @@ image_get_colormap_invoker (GimpProcedure *procedure,
if (success) if (success)
{ {
num_bytes = 3 * gimp_image_get_colormap_size (image); num_bytes = 3 * gimp_image_get_colormap_size (image);
colormap = g_memdup (gimp_image_get_colormap (image), num_bytes); colormap = g_memdup2 (gimp_image_get_colormap (image), num_bytes);
} }
return_vals = gimp_procedure_get_return_values (procedure, success, return_vals = gimp_procedure_get_return_values (procedure, success,
@ -1760,7 +1760,7 @@ image_thumbnail_invoker (GimpProcedure *procedure,
actual_height = gimp_temp_buf_get_height (buf); actual_height = gimp_temp_buf_get_height (buf);
bpp = babl_format_get_bytes_per_pixel (gimp_temp_buf_get_format (buf)); bpp = babl_format_get_bytes_per_pixel (gimp_temp_buf_get_format (buf));
thumbnail_data_count = gimp_temp_buf_get_data_size (buf); thumbnail_data_count = gimp_temp_buf_get_data_size (buf);
thumbnail_data = g_memdup (gimp_temp_buf_get_data (buf), thumbnail_data = g_memdup2 (gimp_temp_buf_get_data (buf),
thumbnail_data_count); thumbnail_data_count);
gimp_temp_buf_unref (buf); gimp_temp_buf_unref (buf);

View File

@ -71,7 +71,7 @@ image_get_color_profile_invoker (GimpProcedure *procedure,
data = gimp_color_profile_get_icc_profile (profile, &length); data = gimp_color_profile_get_icc_profile (profile, &length);
profile_data = g_memdup (data, length); profile_data = g_memdup2 (data, length);
num_bytes = length; num_bytes = length;
} }
} }
@ -117,7 +117,7 @@ image_get_effective_color_profile_invoker (GimpProcedure *procedure,
data = gimp_color_profile_get_icc_profile (profile, &length); data = gimp_color_profile_get_icc_profile (profile, &length);
profile_data = g_memdup (data, length); profile_data = g_memdup2 (data, length);
num_bytes = length; num_bytes = length;
} }
} }

View File

@ -127,7 +127,7 @@ pattern_get_pixels_invoker (GimpProcedure *procedure,
height = gimp_temp_buf_get_height (pattern->mask); height = gimp_temp_buf_get_height (pattern->mask);
bpp = babl_format_get_bytes_per_pixel (format); bpp = babl_format_get_bytes_per_pixel (format);
num_color_bytes = gimp_temp_buf_get_data_size (pattern->mask); num_color_bytes = gimp_temp_buf_get_data_size (pattern->mask);
color_bytes = g_memdup (data, num_color_bytes); color_bytes = g_memdup2 (data, num_color_bytes);
gimp_temp_buf_unlock (pattern->mask, data); gimp_temp_buf_unlock (pattern->mask, data);
} }

View File

@ -1112,7 +1112,7 @@ pdb_get_data_invoker (GimpProcedure *procedure,
identifier, &bytes); identifier, &bytes);
if (orig_data) if (orig_data)
data = g_memdup (orig_data, bytes); data = g_memdup2 (orig_data, bytes);
else else
success = FALSE; success = FALSE;
} }

View File

@ -511,8 +511,8 @@ gimp_interpreter_db_add_magic (GimpInterpreterDB *db,
interp_magic = g_slice_new (GimpInterpreterMagic); interp_magic = g_slice_new (GimpInterpreterMagic);
interp_magic->offset = offset; interp_magic->offset = offset;
interp_magic->magic = g_memdup (magic, size); interp_magic->magic = g_memdup2 (magic, size);
interp_magic->mask = g_memdup (mask, size); interp_magic->mask = g_memdup2 (mask, size);
interp_magic->size = size; interp_magic->size = size;
interp_magic->program = g_strdup (program); interp_magic->program = g_strdup (program);

View File

@ -102,7 +102,7 @@ gimp_plug_in_manager_set_data (GimpPlugInManager *manager,
} }
plug_in_data->bytes = bytes; plug_in_data->bytes = bytes;
plug_in_data->data = g_memdup (data, bytes); plug_in_data->data = g_memdup2 (data, bytes);
} }
const guint8 * const guint8 *

View File

@ -819,7 +819,7 @@ gimp_plug_in_procedure_set_icon (GimpPlugInProcedure *proc,
GError **error) GError **error)
{ {
return gimp_plug_in_procedure_take_icon (proc, icon_type, return gimp_plug_in_procedure_take_icon (proc, icon_type,
g_memdup (icon_data, icon_data_length), g_memdup2 (icon_data, icon_data_length),
icon_data_length, error); icon_data_length, error);
} }

View File

@ -66,7 +66,7 @@ focus_callback (GObject *config,
gdouble midpoint) gdouble midpoint)
{ {
g_object_set_data_full (G_OBJECT (config), "area", g_object_set_data_full (G_OBJECT (config), "area",
g_memdup (area, sizeof (GeglRectangle)), g_memdup2 (area, sizeof (GeglRectangle)),
(GDestroyNotify) g_free); (GDestroyNotify) g_free);
g_object_set (config, g_object_set (config,
@ -231,7 +231,7 @@ _gimp_prop_gui_new_focus_blur (GObject *config,
g_object_set_data (G_OBJECT (config), "set-func", set_func); g_object_set_data (G_OBJECT (config), "set-func", set_func);
g_object_set_data_full (G_OBJECT (config), "area", g_object_set_data_full (G_OBJECT (config), "area",
g_memdup (area, sizeof (GeglRectangle)), g_memdup2 (area, sizeof (GeglRectangle)),
(GDestroyNotify) g_free); (GDestroyNotify) g_free);
config_notify (config, NULL, set_data); config_notify (config, NULL, set_data);

View File

@ -48,7 +48,7 @@ line_callback (GObject *config,
gdouble angle; gdouble angle;
g_object_set_data_full (G_OBJECT (config), "area", g_object_set_data_full (G_OBJECT (config), "area",
g_memdup (area, sizeof (GeglRectangle)), g_memdup2 (area, sizeof (GeglRectangle)),
(GDestroyNotify) g_free); (GDestroyNotify) g_free);
x = x1 / area->width; x = x1 / area->width;
@ -137,7 +137,7 @@ _gimp_prop_gui_new_motion_blur_circular (GObject *config,
g_object_set_data (G_OBJECT (config), "set-func", set_func); g_object_set_data (G_OBJECT (config), "set-func", set_func);
g_object_set_data_full (G_OBJECT (config), "area", g_object_set_data_full (G_OBJECT (config), "area",
g_memdup (area, sizeof (GeglRectangle)), g_memdup2 (area, sizeof (GeglRectangle)),
(GDestroyNotify) g_free); (GDestroyNotify) g_free);
config_notify (config, NULL, set_data); config_notify (config, NULL, set_data);

View File

@ -48,7 +48,7 @@ line_callback (GObject *config,
gdouble angle; gdouble angle;
g_object_set_data_full (G_OBJECT (config), "area", g_object_set_data_full (G_OBJECT (config), "area",
g_memdup (area, sizeof (GeglRectangle)), g_memdup2 (area, sizeof (GeglRectangle)),
(GDestroyNotify) g_free); (GDestroyNotify) g_free);
length = sqrt (SQR (x2 - x1) + SQR (y2 - y1)); length = sqrt (SQR (x2 - x1) + SQR (y2 - y1));
@ -131,7 +131,7 @@ _gimp_prop_gui_new_motion_blur_linear (GObject *config,
g_object_set_data (G_OBJECT (config), "set-func", set_func); g_object_set_data (G_OBJECT (config), "set-func", set_func);
g_object_set_data_full (G_OBJECT (config), "area", g_object_set_data_full (G_OBJECT (config), "area",
g_memdup (area, sizeof (GeglRectangle)), g_memdup2 (area, sizeof (GeglRectangle)),
(GDestroyNotify) g_free); (GDestroyNotify) g_free);
config_notify (config, NULL, set_data); config_notify (config, NULL, set_data);

View File

@ -48,7 +48,7 @@ line_callback (GObject *config,
gdouble radius; gdouble radius;
g_object_set_data_full (G_OBJECT (config), "area", g_object_set_data_full (G_OBJECT (config), "area",
g_memdup (area, sizeof (GeglRectangle)), g_memdup2 (area, sizeof (GeglRectangle)),
(GDestroyNotify) g_free); (GDestroyNotify) g_free);
x = x1 / area->width; x = x1 / area->width;
@ -132,7 +132,7 @@ _gimp_prop_gui_new_motion_blur_zoom (GObject *config,
g_object_set_data (G_OBJECT (config), "set-func", set_func); g_object_set_data (G_OBJECT (config), "set-func", set_func);
g_object_set_data_full (G_OBJECT (config), "area", g_object_set_data_full (G_OBJECT (config), "area",
g_memdup (area, sizeof (GeglRectangle)), g_memdup2 (area, sizeof (GeglRectangle)),
(GDestroyNotify) g_free); (GDestroyNotify) g_free);
config_notify (config, NULL, set_data); config_notify (config, NULL, set_data);

View File

@ -47,7 +47,7 @@ gyroscope_callback (GObject *config,
gboolean invert) gboolean invert)
{ {
g_object_set_data_full (G_OBJECT (config), "area", g_object_set_data_full (G_OBJECT (config), "area",
g_memdup (area, sizeof (GeglRectangle)), g_memdup2 (area, sizeof (GeglRectangle)),
(GDestroyNotify) g_free); (GDestroyNotify) g_free);
g_object_set (config, g_object_set (config,
@ -130,7 +130,7 @@ _gimp_prop_gui_new_panorama_projection (GObject *config,
g_object_set_data (G_OBJECT (config), "set-func", set_func); g_object_set_data (G_OBJECT (config), "set-func", set_func);
g_object_set_data_full (G_OBJECT (config), "area", g_object_set_data_full (G_OBJECT (config), "area",
g_memdup (area, sizeof (GeglRectangle)), g_memdup2 (area, sizeof (GeglRectangle)),
(GDestroyNotify) g_free); (GDestroyNotify) g_free);
config_notify (config, NULL, set_data); config_notify (config, NULL, set_data);

View File

@ -127,7 +127,7 @@ transform_grids_callback (GObject *config,
gint i; gint i;
g_object_set_data_full (G_OBJECT (config), "area", g_object_set_data_full (G_OBJECT (config), "area",
g_memdup (area, sizeof (GeglRectangle)), g_memdup2 (area, sizeof (GeglRectangle)),
(GDestroyNotify) g_free); (GDestroyNotify) g_free);
for (i = 0; i < n_transforms; i++) for (i = 0; i < n_transforms; i++)
@ -320,7 +320,7 @@ _gimp_prop_gui_new_recursive_transform (GObject *config,
g_object_set_data (G_OBJECT (config), "set-func", set_func); g_object_set_data (G_OBJECT (config), "set-func", set_func);
g_object_set_data_full (G_OBJECT (config), "area", g_object_set_data_full (G_OBJECT (config), "area",
g_memdup (area, sizeof (GeglRectangle)), g_memdup2 (area, sizeof (GeglRectangle)),
(GDestroyNotify) g_free); (GDestroyNotify) g_free);
config_notify (config, NULL, set_data); config_notify (config, NULL, set_data);

View File

@ -62,7 +62,7 @@ slider_line_callback (GObject *config,
gdouble balance; gdouble balance;
g_object_set_data_full (G_OBJECT (config), "area", g_object_set_data_full (G_OBJECT (config), "area",
g_memdup (area, sizeof (GeglRectangle)), g_memdup2 (area, sizeof (GeglRectangle)),
(GDestroyNotify) g_free); (GDestroyNotify) g_free);
g_object_get (config, g_object_get (config,
@ -225,7 +225,7 @@ _gimp_prop_gui_new_spiral (GObject *config,
g_object_set_data (G_OBJECT (config), "set-func", set_func); g_object_set_data (G_OBJECT (config), "set-func", set_func);
g_object_set_data_full (G_OBJECT (config), "area", g_object_set_data_full (G_OBJECT (config), "area",
g_memdup (area, sizeof (GeglRectangle)), g_memdup2 (area, sizeof (GeglRectangle)),
(GDestroyNotify) g_free); (GDestroyNotify) g_free);
config_notify (config, NULL, set_data); config_notify (config, NULL, set_data);

View File

@ -48,7 +48,7 @@ line_callback (GObject *config,
gint radius; gint radius;
g_object_set_data_full (G_OBJECT (config), "area", g_object_set_data_full (G_OBJECT (config), "area",
g_memdup (area, sizeof (GeglRectangle)), g_memdup2 (area, sizeof (GeglRectangle)),
(GDestroyNotify) g_free); (GDestroyNotify) g_free);
x = x1 / area->width; x = x1 / area->width;
@ -130,7 +130,7 @@ _gimp_prop_gui_new_supernova (GObject *config,
g_object_set_data (G_OBJECT (config), "set-func", set_func); g_object_set_data (G_OBJECT (config), "set-func", set_func);
g_object_set_data_full (G_OBJECT (config), "area", g_object_set_data_full (G_OBJECT (config), "area",
g_memdup (area, sizeof (GeglRectangle)), g_memdup2 (area, sizeof (GeglRectangle)),
(GDestroyNotify) g_free); (GDestroyNotify) g_free);
config_notify (config, NULL, set_data); config_notify (config, NULL, set_data);

View File

@ -57,7 +57,7 @@ focus_callback (GObject *config,
gdouble scale; gdouble scale;
g_object_set_data_full (G_OBJECT (config), "area", g_object_set_data_full (G_OBJECT (config), "area",
g_memdup (area, sizeof (GeglRectangle)), g_memdup2 (area, sizeof (GeglRectangle)),
(GDestroyNotify) g_free); (GDestroyNotify) g_free);
g_object_get (config, g_object_get (config,
@ -188,7 +188,7 @@ _gimp_prop_gui_new_vignette (GObject *config,
g_object_set_data (G_OBJECT (config), "set-func", set_func); g_object_set_data (G_OBJECT (config), "set-func", set_func);
g_object_set_data_full (G_OBJECT (config), "area", g_object_set_data_full (G_OBJECT (config), "area",
g_memdup (area, sizeof (GeglRectangle)), g_memdup2 (area, sizeof (GeglRectangle)),
(GDestroyNotify) g_free); (GDestroyNotify) g_free);
config_notify (config, NULL, set_data); config_notify (config, NULL, set_data);

View File

@ -285,11 +285,11 @@ gimp_edit_selection_tool_start (GimpTool *parent_tool,
&edit_select->num_segs_out, &edit_select->num_segs_out,
0, 0, 0, 0); 0, 0, 0, 0);
edit_select->segs_in = g_memdup (segs_in, edit_select->segs_in = g_memdup2 (segs_in,
edit_select->num_segs_in * edit_select->num_segs_in *
sizeof (GimpBoundSeg)); sizeof (GimpBoundSeg));
edit_select->segs_out = g_memdup (segs_out, edit_select->segs_out = g_memdup2 (segs_out,
edit_select->num_segs_out * edit_select->num_segs_out *
sizeof (GimpBoundSeg)); sizeof (GimpBoundSeg));

View File

@ -493,7 +493,7 @@ gimp_clipboard_get_svg (Gimp *gimp,
stream = gimp_selection_data_get_stream (data, svg_length); stream = gimp_selection_data_get_stream (data, svg_length);
if (stream) if (stream)
svg = g_memdup (stream, *svg_length); svg = g_memdup2 (stream, *svg_length);
gtk_selection_data_free (data); gtk_selection_data_free (data);
} }

View File

@ -1314,7 +1314,7 @@ gimp_curve_view_set_curve (GimpCurveView *view,
g_free (view->curve_color); g_free (view->curve_color);
if (color) if (color)
view->curve_color = g_memdup (color, sizeof (GimpRGB)); view->curve_color = g_memdup2 (color, sizeof (GimpRGB));
else else
view->curve_color = NULL; view->curve_color = NULL;

View File

@ -1366,7 +1366,7 @@ gimp_dnd_get_color_icon (GtkWidget *widget,
GIMP_LOG (DND, "called"); GIMP_LOG (DND, "called");
g_object_set_data_full (G_OBJECT (context), g_object_set_data_full (G_OBJECT (context),
"gimp-dnd-color", g_memdup (&color, sizeof (GimpRGB)), "gimp-dnd-color", g_memdup2 (&color, sizeof (GimpRGB)),
(GDestroyNotify) g_free); (GDestroyNotify) g_free);
color_area = gimp_color_area_new (&color, GIMP_COLOR_AREA_SMALL_CHECKS, 0); color_area = gimp_color_area_new (&color, GIMP_COLOR_AREA_SMALL_CHECKS, 0);

View File

@ -138,7 +138,7 @@ gimp_plug_in_view_new (GSList *procedures)
g_hash_table_insert (GIMP_PLUG_IN_VIEW (view)->plug_in_hash, g_hash_table_insert (GIMP_PLUG_IN_VIEW (view)->plug_in_hash,
g_object_ref (file), g_object_ref (file),
g_memdup (&iter, sizeof (GtkTreeIter))); g_memdup2 (&iter, sizeof (GtkTreeIter)));
} }
} }

View File

@ -509,7 +509,7 @@ gimp_get_mod_string (GdkModifierType modifiers)
g_type_class_unref (accel_label_class); g_type_class_unref (accel_label_class);
g_hash_table_insert (mod_labels, g_hash_table_insert (mod_labels,
g_memdup (&modifiers, sizeof (GdkModifierType)), g_memdup2 (&modifiers, sizeof (GdkModifierType)),
label); label);
} }

View File

@ -577,7 +577,7 @@ gimp_brush_select_button_callback (const gchar *name,
button->priv->brush_name = g_strdup (name); button->priv->brush_name = g_strdup (name);
button->priv->width = width; button->priv->width = width;
button->priv->height = height; button->priv->height = height;
button->priv->mask_data = g_memdup (mask_data, width * height); button->priv->mask_data = g_memdup2 (mask_data, width * height);
button->priv->opacity = opacity; button->priv->opacity = opacity;
button->priv->spacing = spacing; button->priv->spacing = spacing;
button->priv->paint_mode = paint_mode; button->priv->paint_mode = paint_mode;

View File

@ -218,7 +218,7 @@ gimp_edit_paste (GimpDrawable *drawable,
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS) if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
{ {
*num_layers = GIMP_VALUES_GET_INT (return_vals, 1); *num_layers = GIMP_VALUES_GET_INT (return_vals, 1);
{ GimpObjectArray *a = g_value_get_boxed (gimp_value_array_index (return_vals, 2)); if (a) layers = g_memdup (a->data, a->length * sizeof (gpointer)); }; { GimpObjectArray *a = g_value_get_boxed (gimp_value_array_index (return_vals, 2)); if (a) layers = g_memdup2 (a->data, a->length * sizeof (gpointer)); };
} }
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);

View File

@ -164,7 +164,7 @@ gimp_file_load_layers (GimpRunMode run_mode,
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS) if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
{ {
*num_layers = GIMP_VALUES_GET_INT (return_vals, 1); *num_layers = GIMP_VALUES_GET_INT (return_vals, 1);
{ GimpObjectArray *a = g_value_get_boxed (gimp_value_array_index (return_vals, 2)); if (a) layers = g_memdup (a->data, a->length * sizeof (gpointer)); }; { GimpObjectArray *a = g_value_get_boxed (gimp_value_array_index (return_vals, 2)); if (a) layers = g_memdup2 (a->data, a->length * sizeof (gpointer)); };
} }
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);

View File

@ -786,7 +786,7 @@ gimp_value_to_gp_param (const GValue *value,
param->data.d_array.size = array->length; param->data.d_array.size = array->length;
if (full_copy) if (full_copy)
param->data.d_array.data = g_memdup (array->data, param->data.d_array.data = g_memdup2 (array->data,
array->length); array->length);
else else
param->data.d_array.data = array->data; param->data.d_array.data = array->data;

View File

@ -390,7 +390,7 @@ gimp_gradient_select_button_callback (const gchar *gradient_name,
button->priv->gradient_name = g_strdup (gradient_name); button->priv->gradient_name = g_strdup (gradient_name);
button->priv->n_samples = n_samples; button->priv->n_samples = n_samples;
button->priv->gradient_data = g_memdup (gradient_data, button->priv->gradient_data = g_memdup2 (gradient_data,
n_samples * sizeof (gdouble)); n_samples * sizeof (gdouble));
gtk_widget_queue_draw (button->priv->preview); gtk_widget_queue_draw (button->priv->preview);

View File

@ -104,7 +104,7 @@ gimp_get_images (gint *num_images)
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS) if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
{ {
*num_images = GIMP_VALUES_GET_INT (return_vals, 1); *num_images = GIMP_VALUES_GET_INT (return_vals, 1);
{ GimpObjectArray *a = g_value_get_boxed (gimp_value_array_index (return_vals, 2)); if (a) images = g_memdup (a->data, a->length * sizeof (gpointer)); }; { GimpObjectArray *a = g_value_get_boxed (gimp_value_array_index (return_vals, 2)); if (a) images = g_memdup2 (a->data, a->length * sizeof (gpointer)); };
} }
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);
@ -502,7 +502,7 @@ gimp_image_get_layers (GimpImage *image,
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS) if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
{ {
*num_layers = GIMP_VALUES_GET_INT (return_vals, 1); *num_layers = GIMP_VALUES_GET_INT (return_vals, 1);
{ GimpObjectArray *a = g_value_get_boxed (gimp_value_array_index (return_vals, 2)); if (a) layers = g_memdup (a->data, a->length * sizeof (gpointer)); }; { GimpObjectArray *a = g_value_get_boxed (gimp_value_array_index (return_vals, 2)); if (a) layers = g_memdup2 (a->data, a->length * sizeof (gpointer)); };
} }
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);
@ -549,7 +549,7 @@ gimp_image_get_channels (GimpImage *image,
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS) if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
{ {
*num_channels = GIMP_VALUES_GET_INT (return_vals, 1); *num_channels = GIMP_VALUES_GET_INT (return_vals, 1);
{ GimpObjectArray *a = g_value_get_boxed (gimp_value_array_index (return_vals, 2)); if (a) channels = g_memdup (a->data, a->length * sizeof (gpointer)); }; { GimpObjectArray *a = g_value_get_boxed (gimp_value_array_index (return_vals, 2)); if (a) channels = g_memdup2 (a->data, a->length * sizeof (gpointer)); };
} }
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);
@ -595,7 +595,7 @@ gimp_image_get_vectors (GimpImage *image,
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS) if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
{ {
*num_vectors = GIMP_VALUES_GET_INT (return_vals, 1); *num_vectors = GIMP_VALUES_GET_INT (return_vals, 1);
{ GimpObjectArray *a = g_value_get_boxed (gimp_value_array_index (return_vals, 2)); if (a) vectors = g_memdup (a->data, a->length * sizeof (gpointer)); }; { GimpObjectArray *a = g_value_get_boxed (gimp_value_array_index (return_vals, 2)); if (a) vectors = g_memdup2 (a->data, a->length * sizeof (gpointer)); };
} }
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);
@ -2341,7 +2341,7 @@ gimp_image_get_selected_layers (GimpImage *image,
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS) if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
{ {
*num_layers = GIMP_VALUES_GET_INT (return_vals, 1); *num_layers = GIMP_VALUES_GET_INT (return_vals, 1);
{ GimpObjectArray *a = g_value_get_boxed (gimp_value_array_index (return_vals, 2)); if (a) layers = g_memdup (a->data, a->length * sizeof (gpointer)); }; { GimpObjectArray *a = g_value_get_boxed (gimp_value_array_index (return_vals, 2)); if (a) layers = g_memdup2 (a->data, a->length * sizeof (gpointer)); };
} }
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);

View File

@ -511,7 +511,7 @@ gimp_item_get_children (GimpItem *item,
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS) if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
{ {
*num_children = GIMP_VALUES_GET_INT (return_vals, 1); *num_children = GIMP_VALUES_GET_INT (return_vals, 1);
{ GimpObjectArray *a = g_value_get_boxed (gimp_value_array_index (return_vals, 2)); if (a) children = g_memdup (a->data, a->length * sizeof (gpointer)); }; { GimpObjectArray *a = g_value_get_boxed (gimp_value_array_index (return_vals, 2)); if (a) children = g_memdup2 (a->data, a->length * sizeof (gpointer)); };
} }
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);

View File

@ -561,7 +561,7 @@ gimp_item_combo_box_remove_items (GtkTreeModel *model,
-1); -1);
if (item_ID > 0) if (item_ID > 0)
*remove = g_list_prepend (*remove, g_memdup (iter, sizeof (GtkTreeIter))); *remove = g_list_prepend (*remove, g_memdup2 (iter, sizeof (GtkTreeIter)));
return FALSE; return FALSE;
} }

View File

@ -418,7 +418,7 @@ gimp_pattern_select_button_callback (const gchar *pattern_name,
button->priv->width = width; button->priv->width = width;
button->priv->height = height; button->priv->height = height;
button->priv->bytes = bytes; button->priv->bytes = bytes;
button->priv->mask_data = g_memdup (mask_data, width * height * bytes); button->priv->mask_data = g_memdup2 (mask_data, width * height * bytes);
gimp_pattern_select_preview_update (button->priv->preview, gimp_pattern_select_preview_update (button->priv->preview,
width, height, bytes, mask_data); width, height, bytes, mask_data);

View File

@ -383,7 +383,7 @@ gimp_tile_get (GimpTileBackendPlugin *backend_plugin,
if (tile_data->use_shm) if (tile_data->use_shm)
{ {
tile->data = g_memdup (_gimp_shm_addr (), tile->data = g_memdup2 (_gimp_shm_addr (),
tile->ewidth * tile->eheight * priv->bpp); tile->ewidth * tile->eheight * priv->bpp);
} }
else else

View File

@ -1115,7 +1115,7 @@ gimp_vectors_import_from_file (GimpImage *image,
if (success) if (success)
{ {
*num_vectors = GIMP_VALUES_GET_INT (return_vals, 1); *num_vectors = GIMP_VALUES_GET_INT (return_vals, 1);
{ GimpObjectArray *a = g_value_get_boxed (gimp_value_array_index (return_vals, 2)); if (a) *vectors = g_memdup (a->data, a->length * sizeof (gpointer)); }; { GimpObjectArray *a = g_value_get_boxed (gimp_value_array_index (return_vals, 2)); if (a) *vectors = g_memdup2 (a->data, a->length * sizeof (gpointer)); };
} }
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);
@ -1177,7 +1177,7 @@ gimp_vectors_import_from_string (GimpImage *image,
if (success) if (success)
{ {
*num_vectors = GIMP_VALUES_GET_INT (return_vals, 1); *num_vectors = GIMP_VALUES_GET_INT (return_vals, 1);
{ GimpObjectArray *a = g_value_get_boxed (gimp_value_array_index (return_vals, 2)); if (a) *vectors = g_memdup (a->data, a->length * sizeof (gpointer)); }; { GimpObjectArray *a = g_value_get_boxed (gimp_value_array_index (return_vals, 2)); if (a) *vectors = g_memdup2 (a->data, a->length * sizeof (gpointer)); };
} }
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);

View File

@ -47,7 +47,7 @@ gimp_array_new (const guint8 *data,
array = g_slice_new0 (GimpArray); array = g_slice_new0 (GimpArray);
array->data = static_data ? (guint8 *) data : g_memdup (data, length); array->data = static_data ? (guint8 *) data : g_memdup2 (data, length);
array->length = length; array->length = length;
array->static_data = static_data; array->static_data = static_data;
@ -216,7 +216,7 @@ gimp_value_dup_array (const GValue *value)
GimpArray *array = value->data[0].v_pointer; GimpArray *array = value->data[0].v_pointer;
if (array) if (array)
return g_memdup (array->data, array->length); return g_memdup2 (array->data, array->length);
return NULL; return NULL;
} }
@ -1015,7 +1015,7 @@ gimp_value_dup_string_array (const GValue *value)
if (array) if (array)
{ {
gchar **ret = g_memdup (array->data, (array->length + 1) * sizeof (gchar *)); gchar **ret = g_memdup2 (array->data, (array->length + 1) * sizeof (gchar *));
gsize i; gsize i;
for (i = 0; i < array->length; i++) for (i = 0; i < array->length; i++)
@ -1552,7 +1552,7 @@ gimp_value_dup_object_array (const GValue *value)
if (array) if (array)
{ {
GObject **ret = g_memdup (array->data, (array->length) * sizeof (GObject *)); GObject **ret = g_memdup2 (array->data, (array->length) * sizeof (GObject *));
gsize i; gsize i;
for (i = 0; i < array->length; i++) for (i = 0; i < array->length; i++)

View File

@ -239,7 +239,7 @@ gimp_parasite_new (const gchar *name,
parasite->size = size; parasite->size = size;
if (size) if (size)
parasite->data = g_memdup (data, size); parasite->data = g_memdup2 (data, size);
else else
parasite->data = NULL; parasite->data = NULL;

View File

@ -48,7 +48,7 @@ G_DEFINE_BOXED_TYPE (GimpCMYK, gimp_cmyk, gimp_cmyk_copy, g_free)
static GimpCMYK * static GimpCMYK *
gimp_cmyk_copy (const GimpCMYK *cmyk) gimp_cmyk_copy (const GimpCMYK *cmyk)
{ {
return g_memdup (cmyk, sizeof (GimpCMYK)); return g_memdup2 (cmyk, sizeof (GimpCMYK));
} }

View File

@ -198,7 +198,7 @@ gimp_color_profile_new_from_file (GFile *file,
return NULL; return NULL;
length = g_mapped_file_get_length (mapped); length = g_mapped_file_get_length (mapped);
data = g_memdup (g_mapped_file_get_contents (mapped), length); data = g_memdup2 (g_mapped_file_get_contents (mapped), length);
lcms_profile = cmsOpenProfileFromMem (data, length); lcms_profile = cmsOpenProfileFromMem (data, length);
@ -295,7 +295,7 @@ gimp_color_profile_new_from_icc_profile (const guint8 *data,
profile = g_object_new (GIMP_TYPE_COLOR_PROFILE, NULL); profile = g_object_new (GIMP_TYPE_COLOR_PROFILE, NULL);
profile->priv->lcms_profile = lcms_profile; profile->priv->lcms_profile = lcms_profile;
profile->priv->data = g_memdup (data, length); profile->priv->data = g_memdup2 (data, length);
profile->priv->length = length; profile->priv->length = length;
} }
else else

View File

@ -37,7 +37,7 @@ G_DEFINE_BOXED_TYPE (GimpHSL, gimp_hsl, gimp_hsl_copy, g_free)
static GimpHSL * static GimpHSL *
gimp_hsl_copy (const GimpHSL *hsl) gimp_hsl_copy (const GimpHSL *hsl)
{ {
return g_memdup (hsl, sizeof (GimpHSL)); return g_memdup2 (hsl, sizeof (GimpHSL));
} }

View File

@ -46,7 +46,7 @@ G_DEFINE_BOXED_TYPE (GimpHSV, gimp_hsv, gimp_hsv_copy, g_free)
static GimpHSV * static GimpHSV *
gimp_hsv_copy (const GimpHSV *hsv) gimp_hsv_copy (const GimpHSV *hsv)
{ {
return g_memdup (hsv, sizeof (GimpHSV)); return g_memdup2 (hsv, sizeof (GimpHSV));
} }

View File

@ -71,7 +71,7 @@ gimp_value_set_rgb (GValue *value,
static GimpRGB * static GimpRGB *
gimp_rgb_copy (const GimpRGB *rgb) gimp_rgb_copy (const GimpRGB *rgb)
{ {
return g_memdup (rgb, sizeof (GimpRGB)); return g_memdup2 (rgb, sizeof (GimpRGB));
} }

View File

@ -482,7 +482,7 @@ gimp_scanner_parse_data (GimpScanner *scanner,
g_scanner_get_next_token (scanner); g_scanner_get_next_token (scanner);
if (scanner->value.v_string) if (scanner->value.v_string)
*dest = g_memdup (scanner->value.v_string, length); *dest = g_memdup2 (scanner->value.v_string, length);
else else
*dest = NULL; *dest = NULL;

View File

@ -200,7 +200,7 @@ gimp_param_spec_matrix2 (const gchar *name,
static GimpMatrix2 * static GimpMatrix2 *
matrix2_copy (const GimpMatrix2 *matrix) matrix2_copy (const GimpMatrix2 *matrix)
{ {
return (GimpMatrix2 *) g_memdup (matrix, sizeof (GimpMatrix2)); return (GimpMatrix2 *) g_memdup2 (matrix, sizeof (GimpMatrix2));
} }
@ -463,7 +463,7 @@ gimp_param_spec_matrix3 (const gchar *name,
static GimpMatrix3 * static GimpMatrix3 *
matrix3_copy (const GimpMatrix3 *matrix) matrix3_copy (const GimpMatrix3 *matrix)
{ {
return (GimpMatrix3 *) g_memdup (matrix, sizeof (GimpMatrix3)); return (GimpMatrix3 *) g_memdup2 (matrix, sizeof (GimpMatrix3));
} }

View File

@ -320,7 +320,7 @@ HELP
mask_bpp = babl_format_get_bytes_per_pixel (format); mask_bpp = babl_format_get_bytes_per_pixel (format);
num_mask_bytes = gimp_temp_buf_get_height (mask) * num_mask_bytes = gimp_temp_buf_get_height (mask) *
gimp_temp_buf_get_width (mask) * mask_bpp; gimp_temp_buf_get_width (mask) * mask_bpp;
mask_bytes = g_memdup (data, num_mask_bytes); mask_bytes = g_memdup2 (data, num_mask_bytes);
gimp_temp_buf_unlock (mask, data); gimp_temp_buf_unlock (mask, data);
@ -334,7 +334,7 @@ HELP
num_color_bytes = gimp_temp_buf_get_height (pixmap) * num_color_bytes = gimp_temp_buf_get_height (pixmap) *
gimp_temp_buf_get_width (pixmap) * gimp_temp_buf_get_width (pixmap) *
color_bpp; color_bpp;
color_bytes = g_memdup (data, num_color_bytes); color_bytes = g_memdup2 (data, num_color_bytes);
gimp_temp_buf_unlock (pixmap, data); gimp_temp_buf_unlock (pixmap, data);
} }

View File

@ -797,7 +797,7 @@ HELP
actual_height = gimp_temp_buf_get_height (buf); actual_height = gimp_temp_buf_get_height (buf);
bpp = babl_format_get_bytes_per_pixel (gimp_temp_buf_get_format (buf)); bpp = babl_format_get_bytes_per_pixel (gimp_temp_buf_get_format (buf));
thumbnail_data_count = gimp_temp_buf_get_data_size (buf); thumbnail_data_count = gimp_temp_buf_get_data_size (buf);
thumbnail_data = g_memdup (gimp_temp_buf_get_data (buf), thumbnail_data = g_memdup2 (gimp_temp_buf_get_data (buf),
thumbnail_data_count); thumbnail_data_count);
gimp_temp_buf_unref (buf); gimp_temp_buf_unref (buf);
@ -879,7 +879,7 @@ HELP
height = gimp_temp_buf_get_height (buf); height = gimp_temp_buf_get_height (buf);
bpp = babl_format_get_bytes_per_pixel (gimp_temp_buf_get_format (buf)); bpp = babl_format_get_bytes_per_pixel (gimp_temp_buf_get_format (buf));
thumbnail_data_count = gimp_temp_buf_get_data_size (buf); thumbnail_data_count = gimp_temp_buf_get_data_size (buf);
thumbnail_data = g_memdup (gimp_temp_buf_get_data (buf), thumbnail_data = g_memdup2 (gimp_temp_buf_get_data (buf),
thumbnail_data_count); thumbnail_data_count);
gimp_temp_buf_unref (buf); gimp_temp_buf_unref (buf);

View File

@ -341,7 +341,7 @@ HELP
width = gdk_pixbuf_get_width (pixbuf); width = gdk_pixbuf_get_width (pixbuf);
height = gdk_pixbuf_get_height (pixbuf); height = gdk_pixbuf_get_height (pixbuf);
thumb_data_count = 3 * width * height; thumb_data_count = 3 * width * height;
thumb_data = g_memdup (gdk_pixbuf_get_pixels (pixbuf), thumb_data = g_memdup2 (gdk_pixbuf_get_pixels (pixbuf),
thumb_data_count); thumb_data_count);
g_object_unref (pixbuf); g_object_unref (pixbuf);

View File

@ -1546,7 +1546,7 @@ HELP
code => <<'CODE' code => <<'CODE'
{ {
num_bytes = 3 * gimp_image_get_colormap_size (image); num_bytes = 3 * gimp_image_get_colormap_size (image);
colormap = g_memdup (gimp_image_get_colormap (image), num_bytes); colormap = g_memdup2 (gimp_image_get_colormap (image), num_bytes);
} }
CODE CODE
); );
@ -3017,7 +3017,7 @@ HELP
actual_height = gimp_temp_buf_get_height (buf); actual_height = gimp_temp_buf_get_height (buf);
bpp = babl_format_get_bytes_per_pixel (gimp_temp_buf_get_format (buf)); bpp = babl_format_get_bytes_per_pixel (gimp_temp_buf_get_format (buf));
thumbnail_data_count = gimp_temp_buf_get_data_size (buf); thumbnail_data_count = gimp_temp_buf_get_data_size (buf);
thumbnail_data = g_memdup (gimp_temp_buf_get_data (buf), thumbnail_data = g_memdup2 (gimp_temp_buf_get_data (buf),
thumbnail_data_count); thumbnail_data_count);
gimp_temp_buf_unref (buf); gimp_temp_buf_unref (buf);

View File

@ -54,7 +54,7 @@ HELP
data = gimp_color_profile_get_icc_profile (profile, &length); data = gimp_color_profile_get_icc_profile (profile, &length);
profile_data = g_memdup (data, length); profile_data = g_memdup2 (data, length);
num_bytes = length; num_bytes = length;
} }
} }
@ -102,7 +102,7 @@ HELP
data = gimp_color_profile_get_icc_profile (profile, &length); data = gimp_color_profile_get_icc_profile (profile, &length);
profile_data = g_memdup (data, length); profile_data = g_memdup2 (data, length);
num_bytes = length; num_bytes = length;
} }
} }

View File

@ -111,7 +111,7 @@ HELP
height = gimp_temp_buf_get_height (pattern->mask); height = gimp_temp_buf_get_height (pattern->mask);
bpp = babl_format_get_bytes_per_pixel (format); bpp = babl_format_get_bytes_per_pixel (format);
num_color_bytes = gimp_temp_buf_get_data_size (pattern->mask); num_color_bytes = gimp_temp_buf_get_data_size (pattern->mask);
color_bytes = g_memdup (data, num_color_bytes); color_bytes = g_memdup2 (data, num_color_bytes);
gimp_temp_buf_unlock (pattern->mask, data); gimp_temp_buf_unlock (pattern->mask, data);
} }

View File

@ -1196,7 +1196,7 @@ HELP
identifier, &bytes); identifier, &bytes);
if (orig_data) if (orig_data)
data = g_memdup (orig_data, bytes); data = g_memdup2 (orig_data, bytes);
else else
success = FALSE; success = FALSE;
} }

View File

@ -132,7 +132,7 @@ package Gimp::CodeGen::pdb;
in_annotate => '(element-type GimpImage)', in_annotate => '(element-type GimpImage)',
out_annotate => '(element-type GimpImage) (transfer container)', out_annotate => '(element-type GimpImage) (transfer container)',
get_value_func => '$var = (const GimpImage **) gimp_value_get_object_array ($value)', get_value_func => '$var = (const GimpImage **) gimp_value_get_object_array ($value)',
dup_value_func => '{ GimpObjectArray *a = g_value_get_boxed (gimp_value_array_index ($value)); if (a) $var = g_memdup (a->data, a->length * sizeof (gpointer)); }', dup_value_func => '{ GimpObjectArray *a = g_value_get_boxed (gimp_value_array_index ($value)); if (a) $var = g_memdup2 (a->data, a->length * sizeof (gpointer)); }',
set_value_func => 'gimp_value_set_object_array ($value, GIMP_TYPE_IMAGE, (GObject **) $var, $var_len)', set_value_func => 'gimp_value_set_object_array ($value, GIMP_TYPE_IMAGE, (GObject **) $var, $var_len)',
take_value_func => 'gimp_value_take_object_array ($value, GIMP_TYPE_IMAGE, (GObject **) $var, $var_len)' }, take_value_func => 'gimp_value_take_object_array ($value, GIMP_TYPE_IMAGE, (GObject **) $var, $var_len)' },
@ -145,7 +145,7 @@ package Gimp::CodeGen::pdb;
in_annotate => '(element-type GimpItem)', in_annotate => '(element-type GimpItem)',
out_annotate => '(element-type GimpItem) (transfer container)', out_annotate => '(element-type GimpItem) (transfer container)',
get_value_func => '$var = (const GimpItem **) gimp_value_get_object_array ($value)', get_value_func => '$var = (const GimpItem **) gimp_value_get_object_array ($value)',
dup_value_func => '{ GimpObjectArray *a = g_value_get_boxed (gimp_value_array_index ($value)); if (a) $var = g_memdup (a->data, a->length * sizeof (gpointer)); }', dup_value_func => '{ GimpObjectArray *a = g_value_get_boxed (gimp_value_array_index ($value)); if (a) $var = g_memdup2 (a->data, a->length * sizeof (gpointer)); }',
set_value_func => 'gimp_value_set_object_array ($value, GIMP_TYPE_ITEM, (GObject **) $var, $var_len)', set_value_func => 'gimp_value_set_object_array ($value, GIMP_TYPE_ITEM, (GObject **) $var, $var_len)',
take_value_func => 'gimp_value_take_object_array ($value, GIMP_TYPE_ITEM, (GObject **) $var, $var_len)' }, take_value_func => 'gimp_value_take_object_array ($value, GIMP_TYPE_ITEM, (GObject **) $var, $var_len)' },
@ -158,7 +158,7 @@ package Gimp::CodeGen::pdb;
in_annotate => '(element-type GimpLayer)', in_annotate => '(element-type GimpLayer)',
out_annotate => '(element-type GimpLayer) (transfer container)', out_annotate => '(element-type GimpLayer) (transfer container)',
get_value_func => '$var = (const GimpLayer **) gimp_value_get_object_array ($value)', get_value_func => '$var = (const GimpLayer **) gimp_value_get_object_array ($value)',
dup_value_func => '{ GimpObjectArray *a = g_value_get_boxed (gimp_value_array_index ($value)); if (a) $var = g_memdup (a->data, a->length * sizeof (gpointer)); }', dup_value_func => '{ GimpObjectArray *a = g_value_get_boxed (gimp_value_array_index ($value)); if (a) $var = g_memdup2 (a->data, a->length * sizeof (gpointer)); }',
set_value_func => 'gimp_value_set_object_array ($value, GIMP_TYPE_LAYER, (GObject **) $var, $var_len)', set_value_func => 'gimp_value_set_object_array ($value, GIMP_TYPE_LAYER, (GObject **) $var, $var_len)',
take_value_func => 'gimp_value_take_object_array ($value, GIMP_TYPE_LAYER, (GObject **) $var, $var_len)' }, take_value_func => 'gimp_value_take_object_array ($value, GIMP_TYPE_LAYER, (GObject **) $var, $var_len)' },
@ -171,7 +171,7 @@ package Gimp::CodeGen::pdb;
in_annotate => '(element-type GimpChannel)', in_annotate => '(element-type GimpChannel)',
out_annotate => '(element-type GimpChannel) (transfer container)', out_annotate => '(element-type GimpChannel) (transfer container)',
get_value_func => '$var = gimp_value_get_object_array ($value)', get_value_func => '$var = gimp_value_get_object_array ($value)',
dup_value_func => '{ GimpObjectArray *a = g_value_get_boxed (gimp_value_array_index ($value)); if (a) $var = g_memdup (a->data, a->length * sizeof (gpointer)); }', dup_value_func => '{ GimpObjectArray *a = g_value_get_boxed (gimp_value_array_index ($value)); if (a) $var = g_memdup2 (a->data, a->length * sizeof (gpointer)); }',
set_value_func => 'gimp_value_set_object_array ($value, GIMP_TYPE_CHANNEL, (GObject **) $var, $var_len)', set_value_func => 'gimp_value_set_object_array ($value, GIMP_TYPE_CHANNEL, (GObject **) $var, $var_len)',
take_value_func => 'gimp_value_take_object_array ($value, GIMP_TYPE_CHANNEL, (GObject **) $var, $var_len)' }, take_value_func => 'gimp_value_take_object_array ($value, GIMP_TYPE_CHANNEL, (GObject **) $var, $var_len)' },
@ -184,7 +184,7 @@ package Gimp::CodeGen::pdb;
in_annotate => '(element-type GimpVectors)', in_annotate => '(element-type GimpVectors)',
out_annotate => '(element-type GimpVectors) (transfer container)', out_annotate => '(element-type GimpVectors) (transfer container)',
get_value_func => '$var = (const GimpVectors **) gimp_value_get_object_array ($value)', get_value_func => '$var = (const GimpVectors **) gimp_value_get_object_array ($value)',
dup_value_func => '{ GimpObjectArray *a = g_value_get_boxed (gimp_value_array_index ($value)); if (a) $var = g_memdup (a->data, a->length * sizeof (gpointer)); }', dup_value_func => '{ GimpObjectArray *a = g_value_get_boxed (gimp_value_array_index ($value)); if (a) $var = g_memdup2 (a->data, a->length * sizeof (gpointer)); }',
set_value_func => 'gimp_value_set_object_array ($value, GIMP_TYPE_VECTORS, (GObject **) $var, $var_len)', set_value_func => 'gimp_value_set_object_array ($value, GIMP_TYPE_VECTORS, (GObject **) $var, $var_len)',
take_value_func => 'gimp_value_take_object_array ($value, GIMP_TYPE_VECTORS, (GObject **) $var, $var_len)' }, take_value_func => 'gimp_value_take_object_array ($value, GIMP_TYPE_VECTORS, (GObject **) $var, $var_len)' },

View File

@ -992,7 +992,7 @@ dicom_add_element_copy (GSList *elements,
elements = dicom_add_element (elements, elements = dicom_add_element (elements,
group_word, element_word, value_rep, group_word, element_word, value_rep,
element_length, element_length,
g_memdup (value, element_length)); g_memdup2 (value, element_length));
((DICOMELEMENT *) elements->data)->free = TRUE; ((DICOMELEMENT *) elements->data)->free = TRUE;

View File

@ -375,8 +375,8 @@ smooth_palette (GimpDrawable *drawable,
gdouble len_best = 0; gdouble len_best = 0;
gint try; gint try;
pal_best = g_memdup (pal, bpp * psize); pal_best = g_memdup2 (pal, bpp * psize);
original = g_memdup (pal, bpp * psize); original = g_memdup2 (pal, bpp * psize);
for (try = 0; try < config.ntries; try++) for (try = 0; try < config.ntries; try++)
{ {

View File

@ -359,7 +359,7 @@ struct _EXRLoader
} }
} }
return (guchar *)g_memdup (exif_data, *size); return (guchar *)g_memdup2 (exif_data, *size);
} }
guchar *getXmp(guint *size) const { guchar *getXmp(guint *size) const {
@ -369,7 +369,7 @@ struct _EXRLoader
if (xmp) if (xmp)
{ {
*size = xmp->value().size(); *size = xmp->value().size();
result = (guchar *) g_memdup (xmp->value().data(), *size); result = (guchar *) g_memdup2 (xmp->value().data(), *size);
} }
return result; return result;
} }

View File

@ -402,7 +402,7 @@ ppm_copy (ppm_t *s, ppm_t *p)
ppm_kill (p); ppm_kill (p);
p->width = s->width; p->width = s->width;
p->height = s->height; p->height = s->height;
p->col = g_memdup (s->col, p->width * 3 * p->height); p->col = g_memdup2 (s->col, p->width * 3 * p->height);
} }
void void