[gtk/ebassi/memdup2: 2/10] macos: Move from g_memdup() to g_memdup2()




commit d229fa357e2cb3574198b455b8adebbf4cc5d9e2
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 | 5 +++--
 gdk/macos/gdkmacosseat.c      | 5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/gdk/macos/gdkmacosclipboard.c b/gdk/macos/gdkmacosclipboard.c
index 288a7c64d5..7ddf47d83b 100644
--- a/gdk/macos/gdkmacosclipboard.c
+++ b/gdk/macos/gdkmacosclipboard.c
@@ -23,6 +23,7 @@
 
 #include "gdkmacosclipboard-private.h"
 #include "gdkmacosutils-private.h"
+#include "gdk-private.h"
 
 struct _GdkMacosClipboard
 {
@@ -213,7 +214,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 +310,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..b003bb7ca6 100644
--- a/gdk/macos/gdkmacosseat.c
+++ b/gdk/macos/gdkmacosseat.c
@@ -28,6 +28,8 @@
 #include "gdkmacosdevice.h"
 #include "gdkmacosseat-private.h"
 
+#include "gdk-private.h"
+
 typedef struct
 {
   NSUInteger device_id;
@@ -622,6 +624,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]