From 49e534247aefd6a0c0df42b77bdf3363249132e7 Mon Sep 17 00:00:00 2001 From: Jehan Date: Thu, 26 Aug 2021 17:18:32 +0200 Subject: [PATCH] app, libgimp*, pdb, plug-ins: use g_memdup2() instead of g_memdup() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- app/core/gimpbezierdesc.c | 4 ++-- app/core/gimpbrushpipe.c | 16 ++++++++-------- app/core/gimphistogram.c | 8 ++++---- app/core/gimpimage-color-profile.c | 2 +- app/core/gimpimageundo.c | 8 ++++---- app/core/gimpsymmetry-mandala.c | 4 ++-- app/core/gimpsymmetry-mirror.c | 8 ++++---- app/core/gimpsymmetry-tiling.c | 4 ++-- app/core/gimpsymmetry.c | 4 ++-- app/display/gimpcanvasboundary.c | 4 ++-- app/display/gimpcanvaspolygon.c | 4 ++-- app/paint/gimpink-blob.c | 2 +- app/pdb/brush-cmds.c | 4 ++-- app/pdb/drawable-cmds.c | 8 ++++---- app/pdb/file-cmds.c | 4 ++-- app/pdb/image-cmds.c | 6 +++--- app/pdb/image-color-profile-cmds.c | 4 ++-- app/pdb/pattern-cmds.c | 2 +- app/pdb/pdb-cmds.c | 2 +- app/plug-in/gimpinterpreterdb.c | 4 ++-- app/plug-in/gimppluginmanager-data.c | 2 +- app/plug-in/gimppluginprocedure.c | 2 +- app/propgui/gimppropgui-focus-blur.c | 4 ++-- app/propgui/gimppropgui-motion-blur-circular.c | 4 ++-- app/propgui/gimppropgui-motion-blur-linear.c | 4 ++-- app/propgui/gimppropgui-motion-blur-zoom.c | 4 ++-- app/propgui/gimppropgui-panorama-projection.c | 4 ++-- app/propgui/gimppropgui-recursive-transform.c | 4 ++-- app/propgui/gimppropgui-spiral.c | 4 ++-- app/propgui/gimppropgui-supernova.c | 4 ++-- app/propgui/gimppropgui-vignette.c | 4 ++-- app/tools/gimpeditselectiontool.c | 12 ++++++------ app/widgets/gimpclipboard.c | 2 +- app/widgets/gimpcurveview.c | 2 +- app/widgets/gimpdnd.c | 2 +- app/widgets/gimppluginview.c | 2 +- app/widgets/gimpwidgets-utils.c | 2 +- libgimp/gimpbrushselectbutton.c | 2 +- libgimp/gimpedit_pdb.c | 2 +- libgimp/gimpfile_pdb.c | 2 +- libgimp/gimpgpparams-body.c | 4 ++-- libgimp/gimpgradientselectbutton.c | 4 ++-- libgimp/gimpimage_pdb.c | 10 +++++----- libgimp/gimpitem_pdb.c | 2 +- libgimp/gimpitemcombobox.c | 2 +- libgimp/gimppatternselectbutton.c | 2 +- libgimp/gimptilebackendplugin.c | 4 ++-- libgimp/gimpvectors_pdb.c | 4 ++-- libgimpbase/gimpparamspecs.c | 8 ++++---- libgimpbase/gimpparasite.c | 2 +- libgimpcolor/gimpcmyk.c | 2 +- libgimpcolor/gimpcolorprofile.c | 4 ++-- libgimpcolor/gimphsl.c | 2 +- libgimpcolor/gimphsv.c | 2 +- libgimpcolor/gimprgb.c | 2 +- libgimpconfig/gimpscanner.c | 2 +- libgimpmath/gimpmatrix.c | 4 ++-- pdb/groups/brush.pdb | 4 ++-- pdb/groups/drawable.pdb | 8 ++++---- pdb/groups/file.pdb | 4 ++-- pdb/groups/image.pdb | 6 +++--- pdb/groups/image_color_profile.pdb | 4 ++-- pdb/groups/pattern.pdb | 2 +- pdb/groups/pdb.pdb | 2 +- pdb/pdb.pl | 10 +++++----- plug-ins/common/file-dicom.c | 2 +- plug-ins/common/smooth-palette.c | 4 ++-- plug-ins/file-exr/openexr-wrapper.cc | 4 ++-- plug-ins/gimpressionist/ppmtool.c | 2 +- 69 files changed, 141 insertions(+), 141 deletions(-) diff --git a/app/core/gimpbezierdesc.c b/app/core/gimpbezierdesc.c index 65acd9f24f..be5f674922 100644 --- a/app/core/gimpbezierdesc.c +++ b/app/core/gimpbezierdesc.c @@ -176,8 +176,8 @@ gimp_bezier_desc_copy (const GimpBezierDesc *desc) { g_return_val_if_fail (desc != NULL, NULL); - return gimp_bezier_desc_new (g_memdup (desc->data, - desc->num_data * sizeof (cairo_path_data_t)), + return gimp_bezier_desc_new (g_memdup2 (desc->data, + desc->num_data * sizeof (cairo_path_data_t)), desc->num_data); } diff --git a/app/core/gimpbrushpipe.c b/app/core/gimpbrushpipe.c index cca68adf93..b9f7c239fe 100644 --- a/app/core/gimpbrushpipe.c +++ b/app/core/gimpbrushpipe.c @@ -178,20 +178,20 @@ gimp_brush_pipe_copy (GimpData *data, pipe->dimension = src_pipe->dimension; g_clear_pointer (&pipe->rank, g_free); - pipe->rank = g_memdup (src_pipe->rank, - pipe->dimension * sizeof (gint)); + pipe->rank = g_memdup2 (src_pipe->rank, + pipe->dimension * sizeof (gint)); g_clear_pointer (&pipe->stride, g_free); - pipe->stride = g_memdup (src_pipe->stride, - pipe->dimension * sizeof (gint)); + pipe->stride = g_memdup2 (src_pipe->stride, + pipe->dimension * sizeof (gint)); g_clear_pointer (&pipe->select, g_free); - pipe->select = g_memdup (src_pipe->select, - pipe->dimension * sizeof (PipeSelectModes)); + pipe->select = g_memdup2 (src_pipe->select, + pipe->dimension * sizeof (PipeSelectModes)); g_clear_pointer (&pipe->index, g_free); - pipe->index = g_memdup (src_pipe->index, - pipe->dimension * sizeof (gint)); + pipe->index = g_memdup2 (src_pipe->index, + pipe->dimension * sizeof (gint)); for (i = 0; i < pipe->n_brushes; i++) if (pipe->brushes[i]) diff --git a/app/core/gimphistogram.c b/app/core/gimphistogram.c index 6d01195a22..76c8e2b220 100644 --- a/app/core/gimphistogram.c +++ b/app/core/gimphistogram.c @@ -263,10 +263,10 @@ gimp_histogram_duplicate (GimpHistogram *histogram) dup->priv->n_channels = histogram->priv->n_channels; dup->priv->n_bins = histogram->priv->n_bins; - dup->priv->values = g_memdup (histogram->priv->values, - sizeof (gdouble) * - dup->priv->n_channels * - dup->priv->n_bins); + dup->priv->values = g_memdup2 (histogram->priv->values, + sizeof (gdouble) * + dup->priv->n_channels * + dup->priv->n_bins); return dup; } diff --git a/app/core/gimpimage-color-profile.c b/app/core/gimpimage-color-profile.c index 9cc8d8e935..a8dff7c922 100644 --- a/app/core/gimpimage-color-profile.c +++ b/app/core/gimpimage-color-profile.c @@ -909,7 +909,7 @@ gimp_image_convert_profile_colormap (GimpImage *image, gint n_colors; 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) flags |= GIMP_COLOR_TRANSFORM_FLAGS_BLACK_POINT_COMPENSATION; diff --git a/app/core/gimpimageundo.c b/app/core/gimpimageundo.c index d3d4ee5ef2..28ffd9a7f2 100644 --- a/app/core/gimpimageundo.c +++ b/app/core/gimpimageundo.c @@ -183,8 +183,8 @@ gimp_image_undo_constructed (GObject *object) case GIMP_UNDO_IMAGE_COLORMAP: image_undo->num_colors = gimp_image_get_colormap_size (image); - image_undo->colormap = g_memdup (gimp_image_get_colormap (image), - GIMP_IMAGE_COLORMAP_SIZE); + image_undo->colormap = g_memdup2 (gimp_image_get_colormap (image), + GIMP_IMAGE_COLORMAP_SIZE); break; case GIMP_UNDO_IMAGE_HIDDEN_PROFILE: @@ -454,8 +454,8 @@ gimp_image_undo_pop (GimpUndo *undo, gint num_colors; num_colors = gimp_image_get_colormap_size (image); - colormap = g_memdup (gimp_image_get_colormap (image), - GIMP_IMAGE_COLORMAP_SIZE); + colormap = g_memdup2 (gimp_image_get_colormap (image), + GIMP_IMAGE_COLORMAP_SIZE); if (image_undo->colormap) gimp_image_set_colormap (image, diff --git a/app/core/gimpsymmetry-mandala.c b/app/core/gimpsymmetry-mandala.c index 395b2925bf..2ab1e0a37f 100644 --- a/app/core/gimpsymmetry-mandala.c +++ b/app/core/gimpsymmetry-mandala.c @@ -471,7 +471,7 @@ gimp_mandala_update_strokes (GimpSymmetry *sym, g_list_free_full (sym->strokes, g_free); 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); /* The angle of each slice, in radians. */ @@ -492,7 +492,7 @@ gimp_mandala_update_strokes (GimpSymmetry *sym, { 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_translate (&matrix, -center_x, diff --git a/app/core/gimpsymmetry-mirror.c b/app/core/gimpsymmetry-mirror.c index f8de54bc4a..c519b8117f 100644 --- a/app/core/gimpsymmetry-mirror.c +++ b/app/core/gimpsymmetry-mirror.c @@ -336,25 +336,25 @@ gimp_mirror_update_strokes (GimpSymmetry *sym, g_list_free_full (sym->strokes, g_free); strokes = g_list_prepend (strokes, - g_memdup (origin, sizeof (GimpCoords))); + g_memdup2 (origin, sizeof (GimpCoords))); 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; strokes = g_list_prepend (strokes, coords); } 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; strokes = g_list_prepend (strokes, coords); } 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->y = 2.0 * mirror_position_y - origin->y; strokes = g_list_prepend (strokes, coords); diff --git a/app/core/gimpsymmetry-tiling.c b/app/core/gimpsymmetry-tiling.c index 762bca0d92..e9e0c6ada0 100644 --- a/app/core/gimpsymmetry-tiling.c +++ b/app/core/gimpsymmetry-tiling.c @@ -368,7 +368,7 @@ gimp_tiling_update_strokes (GimpSymmetry *sym, { 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->y = y; 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) break; - coords = g_memdup (origin, sizeof (GimpCoords)); + coords = g_memdup2 (origin, sizeof (GimpCoords)); coords->x = x; coords->y = y; strokes = g_list_prepend (strokes, coords); diff --git a/app/core/gimpsymmetry.c b/app/core/gimpsymmetry.c index 3d6d851bdc..89094718ae 100644 --- a/app/core/gimpsymmetry.c +++ b/app/core/gimpsymmetry.c @@ -235,7 +235,7 @@ gimp_symmetry_real_update_strokes (GimpSymmetry *sym, { /* The basic symmetry just uses the origin as is. */ sym->strokes = g_list_prepend (sym->strokes, - g_memdup (origin, sizeof (GimpCoords))); + g_memdup2 (origin, sizeof (GimpCoords))); } static void @@ -323,7 +323,7 @@ gimp_symmetry_set_origin (GimpSymmetry *sym, if (origin != 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); diff --git a/app/display/gimpcanvasboundary.c b/app/display/gimpcanvasboundary.c index a6cab9d150..d4adb51817 100644 --- a/app/display/gimpcanvasboundary.c +++ b/app/display/gimpcanvasboundary.c @@ -157,7 +157,7 @@ gimp_canvas_boundary_set_property (GObject *object, if (private->transform) g_free (private->transform); if (transform) - private->transform = g_memdup (transform, sizeof (GimpMatrix3)); + private->transform = g_memdup2 (transform, sizeof (GimpMatrix3)); else private->transform = NULL; } @@ -377,7 +377,7 @@ gimp_canvas_boundary_new (GimpDisplayShell *shell, private = GET_PRIVATE (item); /* puke */ - private->segs = g_memdup (segs, n_segs * sizeof (GimpBoundSeg)); + private->segs = g_memdup2 (segs, n_segs * sizeof (GimpBoundSeg)); private->n_segs = n_segs; return item; diff --git a/app/display/gimpcanvaspolygon.c b/app/display/gimpcanvaspolygon.c index 9c670e78fe..ab19f94ce6 100644 --- a/app/display/gimpcanvaspolygon.c +++ b/app/display/gimpcanvaspolygon.c @@ -148,7 +148,7 @@ gimp_canvas_polygon_set_property (GObject *object, 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); } } @@ -160,7 +160,7 @@ gimp_canvas_polygon_set_property (GObject *object, if (private->transform) g_free (private->transform); if (transform) - private->transform = g_memdup (transform, sizeof (GimpMatrix3)); + private->transform = g_memdup2 (transform, sizeof (GimpMatrix3)); else private->transform = NULL; } diff --git a/app/paint/gimpink-blob.c b/app/paint/gimpink-blob.c index 68a135a480..246c389b90 100644 --- a/app/paint/gimpink-blob.c +++ b/app/paint/gimpink-blob.c @@ -463,7 +463,7 @@ gimp_blob_duplicate (GimpBlob *b) { 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 diff --git a/app/pdb/brush-cmds.c b/app/pdb/brush-cmds.c index ef25c6c902..b8437b4380 100644 --- a/app/pdb/brush-cmds.c +++ b/app/pdb/brush-cmds.c @@ -361,7 +361,7 @@ brush_get_pixels_invoker (GimpProcedure *procedure, mask_bpp = babl_format_get_bytes_per_pixel (format); num_mask_bytes = gimp_temp_buf_get_height (mask) * 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); @@ -375,7 +375,7 @@ brush_get_pixels_invoker (GimpProcedure *procedure, num_color_bytes = gimp_temp_buf_get_height (pixmap) * gimp_temp_buf_get_width (pixmap) * color_bpp; - color_bytes = g_memdup (data, num_color_bytes); + color_bytes = g_memdup2 (data, num_color_bytes); gimp_temp_buf_unlock (pixmap, data); } diff --git a/app/pdb/drawable-cmds.c b/app/pdb/drawable-cmds.c index 5e20227b2f..b61efdb8a8 100644 --- a/app/pdb/drawable-cmds.c +++ b/app/pdb/drawable-cmds.c @@ -807,8 +807,8 @@ drawable_thumbnail_invoker (GimpProcedure *procedure, actual_height = gimp_temp_buf_get_height (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 = g_memdup (gimp_temp_buf_get_data (buf), - thumbnail_data_count); + thumbnail_data = g_memdup2 (gimp_temp_buf_get_data (buf), + thumbnail_data_count); gimp_temp_buf_unref (buf); } @@ -886,8 +886,8 @@ drawable_sub_thumbnail_invoker (GimpProcedure *procedure, height = gimp_temp_buf_get_height (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 = g_memdup (gimp_temp_buf_get_data (buf), - thumbnail_data_count); + thumbnail_data = g_memdup2 (gimp_temp_buf_get_data (buf), + thumbnail_data_count); gimp_temp_buf_unref (buf); } diff --git a/app/pdb/file-cmds.c b/app/pdb/file-cmds.c index 8813e1cc27..33485a7c9a 100644 --- a/app/pdb/file-cmds.c +++ b/app/pdb/file-cmds.c @@ -304,8 +304,8 @@ file_load_thumbnail_invoker (GimpProcedure *procedure, width = gdk_pixbuf_get_width (pixbuf); height = gdk_pixbuf_get_height (pixbuf); thumb_data_count = 3 * width * height; - thumb_data = g_memdup (gdk_pixbuf_get_pixels (pixbuf), - thumb_data_count); + thumb_data = g_memdup2 (gdk_pixbuf_get_pixels (pixbuf), + thumb_data_count); g_object_unref (pixbuf); } diff --git a/app/pdb/image-cmds.c b/app/pdb/image-cmds.c index 0b67ca6343..2ecc5a903b 100644 --- a/app/pdb/image-cmds.c +++ b/app/pdb/image-cmds.c @@ -1557,7 +1557,7 @@ image_get_colormap_invoker (GimpProcedure *procedure, if (success) { 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, @@ -1760,8 +1760,8 @@ image_thumbnail_invoker (GimpProcedure *procedure, actual_height = gimp_temp_buf_get_height (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 = g_memdup (gimp_temp_buf_get_data (buf), - thumbnail_data_count); + thumbnail_data = g_memdup2 (gimp_temp_buf_get_data (buf), + thumbnail_data_count); gimp_temp_buf_unref (buf); } diff --git a/app/pdb/image-color-profile-cmds.c b/app/pdb/image-color-profile-cmds.c index 96a4d90b59..f67ddbb85d 100644 --- a/app/pdb/image-color-profile-cmds.c +++ b/app/pdb/image-color-profile-cmds.c @@ -71,7 +71,7 @@ image_get_color_profile_invoker (GimpProcedure *procedure, data = gimp_color_profile_get_icc_profile (profile, &length); - profile_data = g_memdup (data, length); + profile_data = g_memdup2 (data, 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); - profile_data = g_memdup (data, length); + profile_data = g_memdup2 (data, length); num_bytes = length; } } diff --git a/app/pdb/pattern-cmds.c b/app/pdb/pattern-cmds.c index 424c9de2fe..3eaba1ba8f 100644 --- a/app/pdb/pattern-cmds.c +++ b/app/pdb/pattern-cmds.c @@ -127,7 +127,7 @@ pattern_get_pixels_invoker (GimpProcedure *procedure, height = gimp_temp_buf_get_height (pattern->mask); bpp = babl_format_get_bytes_per_pixel (format); 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); } diff --git a/app/pdb/pdb-cmds.c b/app/pdb/pdb-cmds.c index 3688d4dcd0..7788c79553 100644 --- a/app/pdb/pdb-cmds.c +++ b/app/pdb/pdb-cmds.c @@ -1112,7 +1112,7 @@ pdb_get_data_invoker (GimpProcedure *procedure, identifier, &bytes); if (orig_data) - data = g_memdup (orig_data, bytes); + data = g_memdup2 (orig_data, bytes); else success = FALSE; } diff --git a/app/plug-in/gimpinterpreterdb.c b/app/plug-in/gimpinterpreterdb.c index 0d48f99256..123742ec2c 100644 --- a/app/plug-in/gimpinterpreterdb.c +++ b/app/plug-in/gimpinterpreterdb.c @@ -511,8 +511,8 @@ gimp_interpreter_db_add_magic (GimpInterpreterDB *db, interp_magic = g_slice_new (GimpInterpreterMagic); interp_magic->offset = offset; - interp_magic->magic = g_memdup (magic, size); - interp_magic->mask = g_memdup (mask, size); + interp_magic->magic = g_memdup2 (magic, size); + interp_magic->mask = g_memdup2 (mask, size); interp_magic->size = size; interp_magic->program = g_strdup (program); diff --git a/app/plug-in/gimppluginmanager-data.c b/app/plug-in/gimppluginmanager-data.c index 08047b176f..187859e371 100644 --- a/app/plug-in/gimppluginmanager-data.c +++ b/app/plug-in/gimppluginmanager-data.c @@ -102,7 +102,7 @@ gimp_plug_in_manager_set_data (GimpPlugInManager *manager, } plug_in_data->bytes = bytes; - plug_in_data->data = g_memdup (data, bytes); + plug_in_data->data = g_memdup2 (data, bytes); } const guint8 * diff --git a/app/plug-in/gimppluginprocedure.c b/app/plug-in/gimppluginprocedure.c index 7f5138ec01..24b3419e0f 100644 --- a/app/plug-in/gimppluginprocedure.c +++ b/app/plug-in/gimppluginprocedure.c @@ -819,7 +819,7 @@ gimp_plug_in_procedure_set_icon (GimpPlugInProcedure *proc, GError **error) { 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); } diff --git a/app/propgui/gimppropgui-focus-blur.c b/app/propgui/gimppropgui-focus-blur.c index ecee097b23..150fad658f 100644 --- a/app/propgui/gimppropgui-focus-blur.c +++ b/app/propgui/gimppropgui-focus-blur.c @@ -66,7 +66,7 @@ focus_callback (GObject *config, gdouble midpoint) { g_object_set_data_full (G_OBJECT (config), "area", - g_memdup (area, sizeof (GeglRectangle)), + g_memdup2 (area, sizeof (GeglRectangle)), (GDestroyNotify) g_free); 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_full (G_OBJECT (config), "area", - g_memdup (area, sizeof (GeglRectangle)), + g_memdup2 (area, sizeof (GeglRectangle)), (GDestroyNotify) g_free); config_notify (config, NULL, set_data); diff --git a/app/propgui/gimppropgui-motion-blur-circular.c b/app/propgui/gimppropgui-motion-blur-circular.c index a008ef1397..c62e636503 100644 --- a/app/propgui/gimppropgui-motion-blur-circular.c +++ b/app/propgui/gimppropgui-motion-blur-circular.c @@ -48,7 +48,7 @@ line_callback (GObject *config, gdouble angle; g_object_set_data_full (G_OBJECT (config), "area", - g_memdup (area, sizeof (GeglRectangle)), + g_memdup2 (area, sizeof (GeglRectangle)), (GDestroyNotify) g_free); 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_full (G_OBJECT (config), "area", - g_memdup (area, sizeof (GeglRectangle)), + g_memdup2 (area, sizeof (GeglRectangle)), (GDestroyNotify) g_free); config_notify (config, NULL, set_data); diff --git a/app/propgui/gimppropgui-motion-blur-linear.c b/app/propgui/gimppropgui-motion-blur-linear.c index ed917aa15c..09d4008108 100644 --- a/app/propgui/gimppropgui-motion-blur-linear.c +++ b/app/propgui/gimppropgui-motion-blur-linear.c @@ -48,7 +48,7 @@ line_callback (GObject *config, gdouble angle; g_object_set_data_full (G_OBJECT (config), "area", - g_memdup (area, sizeof (GeglRectangle)), + g_memdup2 (area, sizeof (GeglRectangle)), (GDestroyNotify) g_free); 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_full (G_OBJECT (config), "area", - g_memdup (area, sizeof (GeglRectangle)), + g_memdup2 (area, sizeof (GeglRectangle)), (GDestroyNotify) g_free); config_notify (config, NULL, set_data); diff --git a/app/propgui/gimppropgui-motion-blur-zoom.c b/app/propgui/gimppropgui-motion-blur-zoom.c index e8e359b942..adf3238f40 100644 --- a/app/propgui/gimppropgui-motion-blur-zoom.c +++ b/app/propgui/gimppropgui-motion-blur-zoom.c @@ -48,7 +48,7 @@ line_callback (GObject *config, gdouble radius; g_object_set_data_full (G_OBJECT (config), "area", - g_memdup (area, sizeof (GeglRectangle)), + g_memdup2 (area, sizeof (GeglRectangle)), (GDestroyNotify) g_free); 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_full (G_OBJECT (config), "area", - g_memdup (area, sizeof (GeglRectangle)), + g_memdup2 (area, sizeof (GeglRectangle)), (GDestroyNotify) g_free); config_notify (config, NULL, set_data); diff --git a/app/propgui/gimppropgui-panorama-projection.c b/app/propgui/gimppropgui-panorama-projection.c index e5aed5b8b3..e11aa955c5 100644 --- a/app/propgui/gimppropgui-panorama-projection.c +++ b/app/propgui/gimppropgui-panorama-projection.c @@ -47,7 +47,7 @@ gyroscope_callback (GObject *config, gboolean invert) { g_object_set_data_full (G_OBJECT (config), "area", - g_memdup (area, sizeof (GeglRectangle)), + g_memdup2 (area, sizeof (GeglRectangle)), (GDestroyNotify) g_free); 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_full (G_OBJECT (config), "area", - g_memdup (area, sizeof (GeglRectangle)), + g_memdup2 (area, sizeof (GeglRectangle)), (GDestroyNotify) g_free); config_notify (config, NULL, set_data); diff --git a/app/propgui/gimppropgui-recursive-transform.c b/app/propgui/gimppropgui-recursive-transform.c index a2477234a9..3226d5f6fa 100644 --- a/app/propgui/gimppropgui-recursive-transform.c +++ b/app/propgui/gimppropgui-recursive-transform.c @@ -127,7 +127,7 @@ transform_grids_callback (GObject *config, gint i; g_object_set_data_full (G_OBJECT (config), "area", - g_memdup (area, sizeof (GeglRectangle)), + g_memdup2 (area, sizeof (GeglRectangle)), (GDestroyNotify) g_free); 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_full (G_OBJECT (config), "area", - g_memdup (area, sizeof (GeglRectangle)), + g_memdup2 (area, sizeof (GeglRectangle)), (GDestroyNotify) g_free); config_notify (config, NULL, set_data); diff --git a/app/propgui/gimppropgui-spiral.c b/app/propgui/gimppropgui-spiral.c index 9aaded20e9..66df52882e 100644 --- a/app/propgui/gimppropgui-spiral.c +++ b/app/propgui/gimppropgui-spiral.c @@ -62,7 +62,7 @@ slider_line_callback (GObject *config, gdouble balance; g_object_set_data_full (G_OBJECT (config), "area", - g_memdup (area, sizeof (GeglRectangle)), + g_memdup2 (area, sizeof (GeglRectangle)), (GDestroyNotify) g_free); 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_full (G_OBJECT (config), "area", - g_memdup (area, sizeof (GeglRectangle)), + g_memdup2 (area, sizeof (GeglRectangle)), (GDestroyNotify) g_free); config_notify (config, NULL, set_data); diff --git a/app/propgui/gimppropgui-supernova.c b/app/propgui/gimppropgui-supernova.c index 8cc0855600..d2c9c2c456 100644 --- a/app/propgui/gimppropgui-supernova.c +++ b/app/propgui/gimppropgui-supernova.c @@ -48,7 +48,7 @@ line_callback (GObject *config, gint radius; g_object_set_data_full (G_OBJECT (config), "area", - g_memdup (area, sizeof (GeglRectangle)), + g_memdup2 (area, sizeof (GeglRectangle)), (GDestroyNotify) g_free); 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_full (G_OBJECT (config), "area", - g_memdup (area, sizeof (GeglRectangle)), + g_memdup2 (area, sizeof (GeglRectangle)), (GDestroyNotify) g_free); config_notify (config, NULL, set_data); diff --git a/app/propgui/gimppropgui-vignette.c b/app/propgui/gimppropgui-vignette.c index 5d8ef81fa9..b4b038b395 100644 --- a/app/propgui/gimppropgui-vignette.c +++ b/app/propgui/gimppropgui-vignette.c @@ -57,7 +57,7 @@ focus_callback (GObject *config, gdouble scale; g_object_set_data_full (G_OBJECT (config), "area", - g_memdup (area, sizeof (GeglRectangle)), + g_memdup2 (area, sizeof (GeglRectangle)), (GDestroyNotify) g_free); 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_full (G_OBJECT (config), "area", - g_memdup (area, sizeof (GeglRectangle)), + g_memdup2 (area, sizeof (GeglRectangle)), (GDestroyNotify) g_free); config_notify (config, NULL, set_data); diff --git a/app/tools/gimpeditselectiontool.c b/app/tools/gimpeditselectiontool.c index 37f4a5a25d..a12197f7c7 100644 --- a/app/tools/gimpeditselectiontool.c +++ b/app/tools/gimpeditselectiontool.c @@ -285,14 +285,14 @@ gimp_edit_selection_tool_start (GimpTool *parent_tool, &edit_select->num_segs_out, 0, 0, 0, 0); - edit_select->segs_in = g_memdup (segs_in, - edit_select->num_segs_in * - sizeof (GimpBoundSeg)); - - edit_select->segs_out = g_memdup (segs_out, - edit_select->num_segs_out * + edit_select->segs_in = g_memdup2 (segs_in, + edit_select->num_segs_in * sizeof (GimpBoundSeg)); + edit_select->segs_out = g_memdup2 (segs_out, + edit_select->num_segs_out * + sizeof (GimpBoundSeg)); + if (edit_select->edit_mode == GIMP_TRANSLATE_MODE_VECTORS) { edit_select->sel_x = 0; diff --git a/app/widgets/gimpclipboard.c b/app/widgets/gimpclipboard.c index 7dc7e2c5f9..95b120ae97 100644 --- a/app/widgets/gimpclipboard.c +++ b/app/widgets/gimpclipboard.c @@ -493,7 +493,7 @@ gimp_clipboard_get_svg (Gimp *gimp, stream = gimp_selection_data_get_stream (data, svg_length); if (stream) - svg = g_memdup (stream, *svg_length); + svg = g_memdup2 (stream, *svg_length); gtk_selection_data_free (data); } diff --git a/app/widgets/gimpcurveview.c b/app/widgets/gimpcurveview.c index 0ed4ceab1d..2b3f54a5b8 100644 --- a/app/widgets/gimpcurveview.c +++ b/app/widgets/gimpcurveview.c @@ -1314,7 +1314,7 @@ gimp_curve_view_set_curve (GimpCurveView *view, g_free (view->curve_color); if (color) - view->curve_color = g_memdup (color, sizeof (GimpRGB)); + view->curve_color = g_memdup2 (color, sizeof (GimpRGB)); else view->curve_color = NULL; diff --git a/app/widgets/gimpdnd.c b/app/widgets/gimpdnd.c index 0c1991e9ed..89ff18e7b4 100644 --- a/app/widgets/gimpdnd.c +++ b/app/widgets/gimpdnd.c @@ -1366,7 +1366,7 @@ gimp_dnd_get_color_icon (GtkWidget *widget, GIMP_LOG (DND, "called"); 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); color_area = gimp_color_area_new (&color, GIMP_COLOR_AREA_SMALL_CHECKS, 0); diff --git a/app/widgets/gimppluginview.c b/app/widgets/gimppluginview.c index 8e83db931b..cf1e5d9117 100644 --- a/app/widgets/gimppluginview.c +++ b/app/widgets/gimppluginview.c @@ -138,7 +138,7 @@ gimp_plug_in_view_new (GSList *procedures) g_hash_table_insert (GIMP_PLUG_IN_VIEW (view)->plug_in_hash, g_object_ref (file), - g_memdup (&iter, sizeof (GtkTreeIter))); + g_memdup2 (&iter, sizeof (GtkTreeIter))); } } diff --git a/app/widgets/gimpwidgets-utils.c b/app/widgets/gimpwidgets-utils.c index 524ea67c3a..df67408358 100644 --- a/app/widgets/gimpwidgets-utils.c +++ b/app/widgets/gimpwidgets-utils.c @@ -509,7 +509,7 @@ gimp_get_mod_string (GdkModifierType modifiers) g_type_class_unref (accel_label_class); g_hash_table_insert (mod_labels, - g_memdup (&modifiers, sizeof (GdkModifierType)), + g_memdup2 (&modifiers, sizeof (GdkModifierType)), label); } diff --git a/libgimp/gimpbrushselectbutton.c b/libgimp/gimpbrushselectbutton.c index e393468917..359436c11f 100644 --- a/libgimp/gimpbrushselectbutton.c +++ b/libgimp/gimpbrushselectbutton.c @@ -577,7 +577,7 @@ gimp_brush_select_button_callback (const gchar *name, button->priv->brush_name = g_strdup (name); button->priv->width = width; 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->spacing = spacing; button->priv->paint_mode = paint_mode; diff --git a/libgimp/gimpedit_pdb.c b/libgimp/gimpedit_pdb.c index 8c2b3081d9..e03b7c1644 100644 --- a/libgimp/gimpedit_pdb.c +++ b/libgimp/gimpedit_pdb.c @@ -218,7 +218,7 @@ gimp_edit_paste (GimpDrawable *drawable, if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS) { *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); diff --git a/libgimp/gimpfile_pdb.c b/libgimp/gimpfile_pdb.c index b67b5b752d..e68676721a 100644 --- a/libgimp/gimpfile_pdb.c +++ b/libgimp/gimpfile_pdb.c @@ -164,7 +164,7 @@ gimp_file_load_layers (GimpRunMode run_mode, if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS) { *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); diff --git a/libgimp/gimpgpparams-body.c b/libgimp/gimpgpparams-body.c index 9c1a063ae4..2394b79dab 100644 --- a/libgimp/gimpgpparams-body.c +++ b/libgimp/gimpgpparams-body.c @@ -786,8 +786,8 @@ gimp_value_to_gp_param (const GValue *value, param->data.d_array.size = array->length; if (full_copy) - param->data.d_array.data = g_memdup (array->data, - array->length); + param->data.d_array.data = g_memdup2 (array->data, + array->length); else param->data.d_array.data = array->data; } diff --git a/libgimp/gimpgradientselectbutton.c b/libgimp/gimpgradientselectbutton.c index c8ce84d3ea..c464edc885 100644 --- a/libgimp/gimpgradientselectbutton.c +++ b/libgimp/gimpgradientselectbutton.c @@ -390,8 +390,8 @@ gimp_gradient_select_button_callback (const gchar *gradient_name, button->priv->gradient_name = g_strdup (gradient_name); button->priv->n_samples = n_samples; - button->priv->gradient_data = g_memdup (gradient_data, - n_samples * sizeof (gdouble)); + button->priv->gradient_data = g_memdup2 (gradient_data, + n_samples * sizeof (gdouble)); gtk_widget_queue_draw (button->priv->preview); diff --git a/libgimp/gimpimage_pdb.c b/libgimp/gimpimage_pdb.c index 7b9726daac..d6a88a4187 100644 --- a/libgimp/gimpimage_pdb.c +++ b/libgimp/gimpimage_pdb.c @@ -104,7 +104,7 @@ gimp_get_images (gint *num_images) if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS) { *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); @@ -502,7 +502,7 @@ gimp_image_get_layers (GimpImage *image, if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS) { *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); @@ -549,7 +549,7 @@ gimp_image_get_channels (GimpImage *image, if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS) { *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); @@ -595,7 +595,7 @@ gimp_image_get_vectors (GimpImage *image, if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS) { *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); @@ -2341,7 +2341,7 @@ gimp_image_get_selected_layers (GimpImage *image, if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS) { *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); diff --git a/libgimp/gimpitem_pdb.c b/libgimp/gimpitem_pdb.c index 5caefac553..839101285f 100644 --- a/libgimp/gimpitem_pdb.c +++ b/libgimp/gimpitem_pdb.c @@ -511,7 +511,7 @@ gimp_item_get_children (GimpItem *item, if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS) { *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); diff --git a/libgimp/gimpitemcombobox.c b/libgimp/gimpitemcombobox.c index 68df044596..3262d5cbb6 100644 --- a/libgimp/gimpitemcombobox.c +++ b/libgimp/gimpitemcombobox.c @@ -561,7 +561,7 @@ gimp_item_combo_box_remove_items (GtkTreeModel *model, -1); 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; } diff --git a/libgimp/gimppatternselectbutton.c b/libgimp/gimppatternselectbutton.c index 0ef70d1d19..46cc6ef306 100644 --- a/libgimp/gimppatternselectbutton.c +++ b/libgimp/gimppatternselectbutton.c @@ -418,7 +418,7 @@ gimp_pattern_select_button_callback (const gchar *pattern_name, button->priv->width = width; button->priv->height = height; 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, width, height, bytes, mask_data); diff --git a/libgimp/gimptilebackendplugin.c b/libgimp/gimptilebackendplugin.c index 93e39e6a84..33a3616fab 100644 --- a/libgimp/gimptilebackendplugin.c +++ b/libgimp/gimptilebackendplugin.c @@ -383,8 +383,8 @@ gimp_tile_get (GimpTileBackendPlugin *backend_plugin, if (tile_data->use_shm) { - tile->data = g_memdup (_gimp_shm_addr (), - tile->ewidth * tile->eheight * priv->bpp); + tile->data = g_memdup2 (_gimp_shm_addr (), + tile->ewidth * tile->eheight * priv->bpp); } else { diff --git a/libgimp/gimpvectors_pdb.c b/libgimp/gimpvectors_pdb.c index 51fa5fe3c2..e9ae9fcdbd 100644 --- a/libgimp/gimpvectors_pdb.c +++ b/libgimp/gimpvectors_pdb.c @@ -1115,7 +1115,7 @@ gimp_vectors_import_from_file (GimpImage *image, if (success) { *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); @@ -1177,7 +1177,7 @@ gimp_vectors_import_from_string (GimpImage *image, if (success) { *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); diff --git a/libgimpbase/gimpparamspecs.c b/libgimpbase/gimpparamspecs.c index e8db9a8678..8f8cd695be 100644 --- a/libgimpbase/gimpparamspecs.c +++ b/libgimpbase/gimpparamspecs.c @@ -47,7 +47,7 @@ gimp_array_new (const guint8 *data, 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->static_data = static_data; @@ -216,7 +216,7 @@ gimp_value_dup_array (const GValue *value) GimpArray *array = value->data[0].v_pointer; if (array) - return g_memdup (array->data, array->length); + return g_memdup2 (array->data, array->length); return NULL; } @@ -1015,7 +1015,7 @@ gimp_value_dup_string_array (const GValue *value) 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; for (i = 0; i < array->length; i++) @@ -1552,7 +1552,7 @@ gimp_value_dup_object_array (const GValue *value) if (array) { - GObject **ret = g_memdup (array->data, (array->length) * sizeof (GObject *)); + GObject **ret = g_memdup2 (array->data, (array->length) * sizeof (GObject *)); gsize i; for (i = 0; i < array->length; i++) diff --git a/libgimpbase/gimpparasite.c b/libgimpbase/gimpparasite.c index f267f13433..a6cad6f91a 100644 --- a/libgimpbase/gimpparasite.c +++ b/libgimpbase/gimpparasite.c @@ -239,7 +239,7 @@ gimp_parasite_new (const gchar *name, parasite->size = size; if (size) - parasite->data = g_memdup (data, size); + parasite->data = g_memdup2 (data, size); else parasite->data = NULL; diff --git a/libgimpcolor/gimpcmyk.c b/libgimpcolor/gimpcmyk.c index be85f1d269..0a87e2d90e 100644 --- a/libgimpcolor/gimpcmyk.c +++ b/libgimpcolor/gimpcmyk.c @@ -48,7 +48,7 @@ G_DEFINE_BOXED_TYPE (GimpCMYK, gimp_cmyk, gimp_cmyk_copy, g_free) static GimpCMYK * gimp_cmyk_copy (const GimpCMYK *cmyk) { - return g_memdup (cmyk, sizeof (GimpCMYK)); + return g_memdup2 (cmyk, sizeof (GimpCMYK)); } diff --git a/libgimpcolor/gimpcolorprofile.c b/libgimpcolor/gimpcolorprofile.c index 006277b32f..51668e668c 100644 --- a/libgimpcolor/gimpcolorprofile.c +++ b/libgimpcolor/gimpcolorprofile.c @@ -198,7 +198,7 @@ gimp_color_profile_new_from_file (GFile *file, return NULL; 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); @@ -295,7 +295,7 @@ gimp_color_profile_new_from_icc_profile (const guint8 *data, profile = g_object_new (GIMP_TYPE_COLOR_PROFILE, NULL); profile->priv->lcms_profile = lcms_profile; - profile->priv->data = g_memdup (data, length); + profile->priv->data = g_memdup2 (data, length); profile->priv->length = length; } else diff --git a/libgimpcolor/gimphsl.c b/libgimpcolor/gimphsl.c index 84575edeb3..ae71a0b235 100644 --- a/libgimpcolor/gimphsl.c +++ b/libgimpcolor/gimphsl.c @@ -37,7 +37,7 @@ G_DEFINE_BOXED_TYPE (GimpHSL, gimp_hsl, gimp_hsl_copy, g_free) static GimpHSL * gimp_hsl_copy (const GimpHSL *hsl) { - return g_memdup (hsl, sizeof (GimpHSL)); + return g_memdup2 (hsl, sizeof (GimpHSL)); } diff --git a/libgimpcolor/gimphsv.c b/libgimpcolor/gimphsv.c index 6cb430067f..741ae24dfe 100644 --- a/libgimpcolor/gimphsv.c +++ b/libgimpcolor/gimphsv.c @@ -46,7 +46,7 @@ G_DEFINE_BOXED_TYPE (GimpHSV, gimp_hsv, gimp_hsv_copy, g_free) static GimpHSV * gimp_hsv_copy (const GimpHSV *hsv) { - return g_memdup (hsv, sizeof (GimpHSV)); + return g_memdup2 (hsv, sizeof (GimpHSV)); } diff --git a/libgimpcolor/gimprgb.c b/libgimpcolor/gimprgb.c index 4fe984a294..58fee2bd2b 100644 --- a/libgimpcolor/gimprgb.c +++ b/libgimpcolor/gimprgb.c @@ -71,7 +71,7 @@ gimp_value_set_rgb (GValue *value, static GimpRGB * gimp_rgb_copy (const GimpRGB *rgb) { - return g_memdup (rgb, sizeof (GimpRGB)); + return g_memdup2 (rgb, sizeof (GimpRGB)); } diff --git a/libgimpconfig/gimpscanner.c b/libgimpconfig/gimpscanner.c index f168b1708e..6860d05cd1 100644 --- a/libgimpconfig/gimpscanner.c +++ b/libgimpconfig/gimpscanner.c @@ -482,7 +482,7 @@ gimp_scanner_parse_data (GimpScanner *scanner, g_scanner_get_next_token (scanner); if (scanner->value.v_string) - *dest = g_memdup (scanner->value.v_string, length); + *dest = g_memdup2 (scanner->value.v_string, length); else *dest = NULL; diff --git a/libgimpmath/gimpmatrix.c b/libgimpmath/gimpmatrix.c index 99f7d143ea..d9d75aed5e 100644 --- a/libgimpmath/gimpmatrix.c +++ b/libgimpmath/gimpmatrix.c @@ -200,7 +200,7 @@ gimp_param_spec_matrix2 (const gchar *name, static GimpMatrix2 * 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 * matrix3_copy (const GimpMatrix3 *matrix) { - return (GimpMatrix3 *) g_memdup (matrix, sizeof (GimpMatrix3)); + return (GimpMatrix3 *) g_memdup2 (matrix, sizeof (GimpMatrix3)); } diff --git a/pdb/groups/brush.pdb b/pdb/groups/brush.pdb index 6727c04596..8e544d7e70 100644 --- a/pdb/groups/brush.pdb +++ b/pdb/groups/brush.pdb @@ -320,7 +320,7 @@ HELP mask_bpp = babl_format_get_bytes_per_pixel (format); num_mask_bytes = gimp_temp_buf_get_height (mask) * 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); @@ -334,7 +334,7 @@ HELP num_color_bytes = gimp_temp_buf_get_height (pixmap) * gimp_temp_buf_get_width (pixmap) * color_bpp; - color_bytes = g_memdup (data, num_color_bytes); + color_bytes = g_memdup2 (data, num_color_bytes); gimp_temp_buf_unlock (pixmap, data); } diff --git a/pdb/groups/drawable.pdb b/pdb/groups/drawable.pdb index b3e10b9065..07c32f744c 100644 --- a/pdb/groups/drawable.pdb +++ b/pdb/groups/drawable.pdb @@ -797,8 +797,8 @@ HELP actual_height = gimp_temp_buf_get_height (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 = g_memdup (gimp_temp_buf_get_data (buf), - thumbnail_data_count); + thumbnail_data = g_memdup2 (gimp_temp_buf_get_data (buf), + thumbnail_data_count); gimp_temp_buf_unref (buf); } @@ -879,8 +879,8 @@ HELP height = gimp_temp_buf_get_height (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 = g_memdup (gimp_temp_buf_get_data (buf), - thumbnail_data_count); + thumbnail_data = g_memdup2 (gimp_temp_buf_get_data (buf), + thumbnail_data_count); gimp_temp_buf_unref (buf); } diff --git a/pdb/groups/file.pdb b/pdb/groups/file.pdb index 2bd1f7dc2b..eed6ff7b9d 100644 --- a/pdb/groups/file.pdb +++ b/pdb/groups/file.pdb @@ -341,8 +341,8 @@ HELP width = gdk_pixbuf_get_width (pixbuf); height = gdk_pixbuf_get_height (pixbuf); thumb_data_count = 3 * width * height; - thumb_data = g_memdup (gdk_pixbuf_get_pixels (pixbuf), - thumb_data_count); + thumb_data = g_memdup2 (gdk_pixbuf_get_pixels (pixbuf), + thumb_data_count); g_object_unref (pixbuf); } diff --git a/pdb/groups/image.pdb b/pdb/groups/image.pdb index fb6006b039..0164f5ed91 100644 --- a/pdb/groups/image.pdb +++ b/pdb/groups/image.pdb @@ -1546,7 +1546,7 @@ HELP code => <<'CODE' { 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 ); @@ -3017,8 +3017,8 @@ HELP actual_height = gimp_temp_buf_get_height (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 = g_memdup (gimp_temp_buf_get_data (buf), - thumbnail_data_count); + thumbnail_data = g_memdup2 (gimp_temp_buf_get_data (buf), + thumbnail_data_count); gimp_temp_buf_unref (buf); } diff --git a/pdb/groups/image_color_profile.pdb b/pdb/groups/image_color_profile.pdb index d6ae7aa941..1f9231ca13 100644 --- a/pdb/groups/image_color_profile.pdb +++ b/pdb/groups/image_color_profile.pdb @@ -54,7 +54,7 @@ HELP data = gimp_color_profile_get_icc_profile (profile, &length); - profile_data = g_memdup (data, length); + profile_data = g_memdup2 (data, length); num_bytes = length; } } @@ -102,7 +102,7 @@ HELP data = gimp_color_profile_get_icc_profile (profile, &length); - profile_data = g_memdup (data, length); + profile_data = g_memdup2 (data, length); num_bytes = length; } } diff --git a/pdb/groups/pattern.pdb b/pdb/groups/pattern.pdb index 2c3959d325..710c477452 100644 --- a/pdb/groups/pattern.pdb +++ b/pdb/groups/pattern.pdb @@ -111,7 +111,7 @@ HELP height = gimp_temp_buf_get_height (pattern->mask); bpp = babl_format_get_bytes_per_pixel (format); 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); } diff --git a/pdb/groups/pdb.pdb b/pdb/groups/pdb.pdb index a678123841..0a079a8e8f 100644 --- a/pdb/groups/pdb.pdb +++ b/pdb/groups/pdb.pdb @@ -1196,7 +1196,7 @@ HELP identifier, &bytes); if (orig_data) - data = g_memdup (orig_data, bytes); + data = g_memdup2 (orig_data, bytes); else success = FALSE; } diff --git a/pdb/pdb.pl b/pdb/pdb.pl index ffa17b9869..95e3c47f40 100644 --- a/pdb/pdb.pl +++ b/pdb/pdb.pl @@ -132,7 +132,7 @@ package Gimp::CodeGen::pdb; in_annotate => '(element-type GimpImage)', out_annotate => '(element-type GimpImage) (transfer container)', 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)', 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)', out_annotate => '(element-type GimpItem) (transfer container)', 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)', 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)', out_annotate => '(element-type GimpLayer) (transfer container)', 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)', 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)', out_annotate => '(element-type GimpChannel) (transfer container)', 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)', 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)', out_annotate => '(element-type GimpVectors) (transfer container)', 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)', take_value_func => 'gimp_value_take_object_array ($value, GIMP_TYPE_VECTORS, (GObject **) $var, $var_len)' }, diff --git a/plug-ins/common/file-dicom.c b/plug-ins/common/file-dicom.c index bc7a551fad..3a6f0669e7 100644 --- a/plug-ins/common/file-dicom.c +++ b/plug-ins/common/file-dicom.c @@ -992,7 +992,7 @@ dicom_add_element_copy (GSList *elements, elements = dicom_add_element (elements, group_word, element_word, value_rep, element_length, - g_memdup (value, element_length)); + g_memdup2 (value, element_length)); ((DICOMELEMENT *) elements->data)->free = TRUE; diff --git a/plug-ins/common/smooth-palette.c b/plug-ins/common/smooth-palette.c index 79d711484f..3265542127 100644 --- a/plug-ins/common/smooth-palette.c +++ b/plug-ins/common/smooth-palette.c @@ -375,8 +375,8 @@ smooth_palette (GimpDrawable *drawable, gdouble len_best = 0; gint try; - pal_best = g_memdup (pal, bpp * psize); - original = g_memdup (pal, bpp * psize); + pal_best = g_memdup2 (pal, bpp * psize); + original = g_memdup2 (pal, bpp * psize); for (try = 0; try < config.ntries; try++) { diff --git a/plug-ins/file-exr/openexr-wrapper.cc b/plug-ins/file-exr/openexr-wrapper.cc index 8ad1cec85e..3d7f3add47 100644 --- a/plug-ins/file-exr/openexr-wrapper.cc +++ b/plug-ins/file-exr/openexr-wrapper.cc @@ -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 { @@ -369,7 +369,7 @@ struct _EXRLoader if (xmp) { *size = xmp->value().size(); - result = (guchar *) g_memdup (xmp->value().data(), *size); + result = (guchar *) g_memdup2 (xmp->value().data(), *size); } return result; } diff --git a/plug-ins/gimpressionist/ppmtool.c b/plug-ins/gimpressionist/ppmtool.c index 307779e20b..4c54251959 100644 --- a/plug-ins/gimpressionist/ppmtool.c +++ b/plug-ins/gimpressionist/ppmtool.c @@ -402,7 +402,7 @@ ppm_copy (ppm_t *s, ppm_t *p) ppm_kill (p); p->width = s->width; 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