gdk: 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:
Emmanuele Bassi 2021-02-04 19:16:02 +00:00
parent cf3f742ad8
commit 386d8326ca
2 changed files with 5 additions and 3 deletions

View File

@ -27,6 +27,8 @@
#include "gdkintl.h"
#include "gdkcontentproviderimpl.h"
#include "gdk-private.h"
#define GDK_TYPE_CONTENT_PROVIDER_VALUE (gdk_content_provider_value_get_type ())
#define GDK_CONTENT_PROVIDER_VALUE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDK_TYPE_CONTENT_PROVIDER_VALUE, GdkContentProviderValue))
#define GDK_IS_CONTENT_PROVIDER_VALUE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDK_TYPE_CONTENT_PROVIDER_VALUE))
@ -426,7 +428,7 @@ gdk_content_provider_new_union (GdkContentProvider **providers,
result = g_object_new (GDK_TYPE_CONTENT_PROVIDER_UNION, NULL);
result->n_providers = n_providers;
result->providers = g_memdup (providers, sizeof (GdkContentProvider *) * n_providers);
result->providers = g_memdup2 (providers, sizeof (GdkContentProvider *) * n_providers);
for (i = 0; i < n_providers; i++)
{

View File

@ -332,7 +332,7 @@ gdk_event_type_register_static (const char *type_name,
info.base_finalize = NULL;
info.class_init = gdk_event_generic_class_init;
info.class_finalize = NULL;
info.class_data = g_memdup (type_info, sizeof (GdkEventTypeInfo));
info.class_data = g_memdup2 (type_info, sizeof (GdkEventTypeInfo));
info.instance_size = type_info->instance_size;
info.n_preallocs = 0;
@ -1146,7 +1146,7 @@ gdk_event_dup_axes (GdkEvent *event)
if (gdk_event_get_axes (event, &axes, &n_axes))
{
double *axes_copy = g_memdup (axes, n_axes * sizeof (double));
double *axes_copy = g_memdup2 (axes, n_axes * sizeof (double));
return axes_copy;
}