summaryrefslogtreecommitdiff
path: root/gdk/broadway
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gnome.org>2021-02-04 19:09:56 +0000
committerEmmanuele Bassi <ebassi@gnome.org>2021-02-11 14:22:22 +0000
commit504b5bbd1b056613b6ba8ec3462a9498b8745caa (patch)
tree62b6ba75a97f115bca364602d5b52338b80891d1 /gdk/broadway
parent965e74f902645cf126011a5b929a8d9d254750cc (diff)
downloadgtk+-504b5bbd1b056613b6ba8ec3462a9498b8745caa.tar.gz
broadway: Move from g_memdup() to g_memdup2()
The g_memdup() function is replaced by a safer version in newer versions of GLib.
Diffstat (limited to 'gdk/broadway')
-rw-r--r--gdk/broadway/broadway-server.c6
-rw-r--r--gdk/broadway/gdkbroadway-server.c6
-rw-r--r--gdk/broadway/gdksurface-broadway.c5
3 files changed, 12 insertions, 5 deletions
diff --git a/gdk/broadway/broadway-server.c b/gdk/broadway/broadway-server.c
index a82b3e82df..b54ae55149 100644
--- a/gdk/broadway/broadway-server.c
+++ b/gdk/broadway/broadway-server.c
@@ -36,6 +36,10 @@
#include <string.h>
#endif
+#if !GLIB_CHECK_VERSION (2, 67, 3)
+# define g_memdup2(mem,size) g_memdup((mem), (size))
+#endif
+
typedef struct {
int id;
guint32 tag;
@@ -605,7 +609,7 @@ update_future_pointer_info (BroadwayServer *server, BroadwayInputPointerMsg *dat
static void
queue_input_message (BroadwayServer *server, BroadwayInputMsg *msg)
{
- server->input_messages = g_list_append (server->input_messages, g_memdup (msg, sizeof (BroadwayInputMsg)));
+ server->input_messages = g_list_append (server->input_messages, g_memdup2 (msg, sizeof (BroadwayInputMsg)));
}
static void
diff --git a/gdk/broadway/gdkbroadway-server.c b/gdk/broadway/gdkbroadway-server.c
index 1aeb1649e9..02b6f93183 100644
--- a/gdk/broadway/gdkbroadway-server.c
+++ b/gdk/broadway/gdkbroadway-server.c
@@ -13,6 +13,8 @@
#include "gdkbroadway-server.h"
#include "gdkprivate-broadway.h"
+#include "gdk-private.h"
+
#include <gdk/gdktextureprivate.h>
#include <glib.h>
@@ -233,7 +235,7 @@ static void
parse_all_input (GdkBroadwayServer *server)
{
guint8 *p, *end;
- guint32 size;
+ size_t size;
BroadwayReply *reply;
p = server->recv_buffer;
@@ -245,7 +247,7 @@ parse_all_input (GdkBroadwayServer *server)
if (p + size > end)
break;
- reply = g_memdup (p, size);
+ reply = g_memdup2 (p, size);
p += size;
server->incoming = g_list_append (server->incoming, reply);
diff --git a/gdk/broadway/gdksurface-broadway.c b/gdk/broadway/gdksurface-broadway.c
index 0d90e270a6..36930072c4 100644
--- a/gdk/broadway/gdksurface-broadway.c
+++ b/gdk/broadway/gdksurface-broadway.c
@@ -41,6 +41,7 @@
#include "gdksurfaceprivate.h"
#include "gdktextureprivate.h"
#include "gdktoplevelprivate.h"
+#include "gdk-private.h"
#include <graphene.h>
#include <stdlib.h>
@@ -1025,7 +1026,7 @@ _gdk_broadway_moveresize_handle_event (GdkDisplay *display,
*mv_resize->moveresize_pending_event = *event;
else
mv_resize->moveresize_pending_event =
- g_memdup (event, sizeof (BroadwayInputMsg));
+ g_memdup2 (event, sizeof (BroadwayInputMsg));
break;
}
@@ -1043,7 +1044,7 @@ _gdk_broadway_moveresize_handle_event (GdkDisplay *display,
*mv_resize->moveresize_pending_event = *event;
else
mv_resize->moveresize_pending_event =
- g_memdup (event, sizeof (BroadwayInputMsg));
+ g_memdup2 (event, sizeof (BroadwayInputMsg));
break;
}