[gtk/ebassi/memdup2: 3/11] macos: Move from g_memdup() to g_memdup2()




commit a5e13d2d816cbd29160f0e1bed4569aa95f42078
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Thu Feb 4 19:13:36 2021 +0000

    macos: Move from g_memdup() to g_memdup2()
    
    The g_memdup() function is replaced by a safer version in newer versions
    of GLib.

 gdk/macos/gdkmacosclipboard.c | 4 ++--
 gdk/macos/gdkmacosseat.c      | 3 +--
 2 files changed, 3 insertions(+), 4 deletions(-)
---
diff --git a/gdk/macos/gdkmacosclipboard.c b/gdk/macos/gdkmacosclipboard.c
index 288a7c64d5..77b75f61a1 100644
--- a/gdk/macos/gdkmacosclipboard.c
+++ b/gdk/macos/gdkmacosclipboard.c
@@ -213,7 +213,7 @@ create_stream_from_nsdata (NSData *data)
   const guint8 *bytes = [data bytes];
   gsize len = [data length];
 
-  return g_memory_input_stream_new_from_data (g_memdup (bytes, len), len, g_free);
+  return g_memory_input_stream_new_from_data (g_memdup2 (bytes, len), len, g_free);
 }
 
 static void
@@ -309,7 +309,7 @@ _gdk_macos_clipboard_read_async (GdkClipboard        *clipboard,
       color[2] = 0xffff * [nscolor blueComponent];
       color[3] = 0xffff * [nscolor alphaComponent];
 
-      stream = g_memory_input_stream_new_from_data (g_memdup (&color, sizeof color),
+      stream = g_memory_input_stream_new_from_data (g_memdup2 (&color, sizeof color),
                                                     sizeof color,
                                                     g_free);
     }
diff --git a/gdk/macos/gdkmacosseat.c b/gdk/macos/gdkmacosseat.c
index a7b7c59915..e843f24513 100644
--- a/gdk/macos/gdkmacosseat.c
+++ b/gdk/macos/gdkmacosseat.c
@@ -622,6 +622,5 @@ _gdk_macos_seat_get_tablet_axes_from_nsevent (GdkMacosSeat *seat,
                                   [nsevent rotation], &tablet->axes[GDK_AXIS_ROTATION]);
     }
 
-  return g_memdup (tablet->axes,
-                   sizeof (double) * GDK_AXIS_LAST);
+  return g_memdup2 (tablet->axes, sizeof (double) * GDK_AXIS_LAST);
 }


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