[gtk/ebassi/memdup2: 2/10] macos: Move from g_memdup() to g_memdup2()
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/ebassi/memdup2: 2/10] macos: Move from g_memdup() to g_memdup2()
- Date: Thu, 11 Feb 2021 14:26:15 +0000 (UTC)
commit 435d12680d432121136e0d71a8901e29ea8a42a4
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]