[gtk/popup-shadow-width] broadway: Move from g_memdup() to g_memdup2()
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/popup-shadow-width] broadway: Move from g_memdup() to g_memdup2()
- Date: Sat, 13 Feb 2021 20:47:15 +0000 (UTC)
commit 5fe9cfb8584f899302b5d1a1644b30e8cfe0495c
Author: Emmanuele Bassi <ebassi gnome org>
Date: Thu Feb 4 19:09:56 2021 +0000
broadway: Move from g_memdup() to g_memdup2()
The g_memdup() function is replaced by a safer version in newer versions
of GLib.
gdk/broadway/broadway-server.c | 6 +++++-
gdk/broadway/gdkbroadway-server.c | 6 ++++--
gdk/broadway/gdksurface-broadway.c | 5 +++--
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;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]