[gtk/ebassi/memdup2: 2/11] broadway: Move from g_memdup() to g_memdup2()




commit 42cfbadb14da4acb757eb74f4d509886ecc2a8d1
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     | 2 +-
 gdk/broadway/gdkbroadway-server.c  | 4 ++--
 gdk/broadway/gdksurface-broadway.c | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/gdk/broadway/broadway-server.c b/gdk/broadway/broadway-server.c
index a82b3e82df..cf039abdd7 100644
--- a/gdk/broadway/broadway-server.c
+++ b/gdk/broadway/broadway-server.c
@@ -605,7 +605,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..587575d1ba 100644
--- a/gdk/broadway/gdkbroadway-server.c
+++ b/gdk/broadway/gdkbroadway-server.c
@@ -233,7 +233,7 @@ static void
 parse_all_input (GdkBroadwayServer *server)
 {
   guint8 *p, *end;
-  guint32 size;
+  size_t size;
   BroadwayReply *reply;
 
   p = server->recv_buffer;
@@ -245,7 +245,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..4b642b8adb 100644
--- a/gdk/broadway/gdksurface-broadway.c
+++ b/gdk/broadway/gdksurface-broadway.c
@@ -1025,7 +1025,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 +1043,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]