mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-26 21:51:08 +00:00
macos: Move from g_memdup() to g_memdup2()
The g_memdup() function is replaced by a safer version in newer versions of GLib.
This commit is contained in:
parent
504b5bbd1b
commit
435d12680d
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user