[GTK] Fix compilation warnings
* Remove leftover sizeof that isn't defined anymore.
* Fix GTK3/4 compatibility for gdk_cursor_new_from_name.
* Fix signed/unsigned comparison and uninitialized field warnings.
Change-Id: I9497f1f715568c4511eca974009c04d1f904ac8d
Signed-off-by: Nikita Nemkin <nikita@nemkin.ru>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
index c2b3e5b..32070a8 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
@@ -84,18 +84,6 @@
}
#endif
-#ifndef NO_GdkEventAny_1sizeof
-JNIEXPORT jint JNICALL GDK_NATIVE(GdkEventAny_1sizeof)
- (JNIEnv *env, jclass that)
-{
- jint rc = 0;
- GDK_NATIVE_ENTER(env, that, GdkEventAny_1sizeof_FUNC);
- rc = (jint)GdkEventAny_sizeof();
- GDK_NATIVE_EXIT(env, that, GdkEventAny_1sizeof_FUNC);
- return rc;
-}
-#endif
-
#ifndef NO_GdkEventButton_1sizeof
JNIEXPORT jint JNICALL GDK_NATIVE(GdkEventButton_1sizeof)
(JNIEnv *env, jclass that)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h
index 611c5a1..867aac7 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h
@@ -176,7 +176,6 @@
#define NO_GdkEventWindowState
#define NO_GdkWindowAttr
#define NO_GdkEvent
-#define NO_GdkEventAny
#define NO_GdkEventButton
#define NO_GdkEventCrossing
#define NO_GdkEventFocus
@@ -191,8 +190,6 @@
#define NO_memmove__LLorg_eclipse_swt_internal_gtk_GtkTargetEntry_2JJ
#define NO_memmove__Iorg_eclipse_swt_internal_gtk_GdkEvent_2I
#define NO_memmove__Jorg_eclipse_swt_internal_gtk_GdkEvent_2J
-#define NO_memmove__Iorg_eclipse_swt_internal_gtk_GdkEventAny_2I
-#define NO_memmove__Jorg_eclipse_swt_internal_gtk_GdkEventAny_2J
#define NO_memmove__ILorg_eclipse_swt_internal_gtk_GdkEventButton_2I
#define NO_memmove__JLorg_eclipse_swt_internal_gtk_GdkEventButton_2J
#define NO_memmove__Lorg_eclipse_swt_internal_gtk_GdkEventButton_2II
@@ -370,8 +367,7 @@
#define NO_gdk_1cursor_1new_1for_1display
#define NO_gdk_1cursor_1new_1from_1pixbuf
#define NO_gdk_1display_1supports_1cursor_1color
-#define NO_gdk_1cursor_1new_1from_1name__I_3B
-#define NO_gdk_1cursor_1new_1from_1name__J_3B
+#define NO_gdk_1cursor_1new_1from_1name__JLjava_lang_String_2
#else
@@ -470,6 +466,10 @@
#define NO_gdk_1event_1get_1string
#define NO_gdk_1event_1get_1key_1group
#define NO_gdk_1event_1get_1crossing_1mode
+
+// GdkCursor API changes
+#define NO_gdk_1cursor_1new_1from_1name__Ljava_lang_String_2J
+
#endif
#include "os_custom.h"
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
index 56d5ab9..a9fab99 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
@@ -27,7 +27,6 @@
"GDK_1IS_1X11_1DISPLAY",
"GDK_1TYPE_1PIXBUF",
"GDK_1TYPE_1RGBA",
- "GdkEventAny_1sizeof",
"GdkEventButton_1sizeof",
"GdkEventCrossing_1sizeof",
"GdkEventFocus_1sizeof",
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
index 430f29c..b09796a 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
@@ -37,7 +37,6 @@
GDK_1IS_1X11_1DISPLAY_FUNC,
GDK_1TYPE_1PIXBUF_FUNC,
GDK_1TYPE_1RGBA_FUNC,
- GdkEventAny_1sizeof_FUNC,
GdkEventButton_1sizeof_FUNC,
GdkEventCrossing_1sizeof_FUNC,
GdkEventFocus_1sizeof_FUNC,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GDK.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GDK.java
index 307fb42..f7b5284 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GDK.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GDK.java
@@ -239,7 +239,6 @@
public static final native int GdkKeymapKey_sizeof();
public static final native int GdkRGBA_sizeof();
public static final native int GdkEvent_sizeof();
- public static final native int GdkEventAny_sizeof();
public static final native int GdkEventButton_sizeof();
public static final native int GdkEventCrossing_sizeof();
public static final native int GdkEventFocus_sizeof();
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk_extension.c b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk_extension.c
index e459576..5db8a18 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk_extension.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk_extension.c
@@ -199,11 +199,10 @@
}
if (g_variant_is_of_type(value, G_VARIANT_TYPE_TUPLE)) {
- gsize length = (int) g_variant_n_children(value);
+ gsize length = g_variant_n_children(value);
JSValueRef *children = g_new(JSValueRef, length);
- int i = 0;
- for (i = 0; i < length; i++) {
+ for (gsize i = 0; i < length; i++) {
children[i] = convert_gvariant_to_js(context, g_variant_get_child_value(value, i));
}
JSValueRef result = JSObjectMakeArray(context, length, children, NULL);
@@ -364,7 +363,7 @@
continue;
}
guint64 page = g_variant_get_uint64(g_variant_get_child_value(child, 0));
- if (page == -1) {
+ if (page == -1UL) {
// Empty or malformed BrowserFunction, skip this one
continue;
} else {
@@ -411,7 +410,7 @@
*/
if (function_list != NULL) {
guint64 page_id = webkit_web_page_get_id (web_page);
- if (page_id != -1) {
+ if (page_id != -1UL) {
g_slist_foreach(function_list, (GFunc)execute_browser_functions, GUINT_TO_POINTER(page_id));
} else {
g_warning("There was an error fetching the page ID in the object_cleared callback.\n");
@@ -434,7 +433,7 @@
// Check method names
if (g_strcmp0(method_name, "webkitgtk_extension_register_function") == 0) {
g_variant_get(parameters, "(t&s&s)", &page_id, &script, &url);
- if (page_id != -1) {
+ if (page_id != -1UL) {
result = TRUE;
// Return before processing the linked list, to prevent DBus from hanging
g_dbus_method_invocation_return_value(invocation, g_variant_new("(b)", result));
@@ -446,7 +445,7 @@
}
if (g_strcmp0(method_name, "webkitgtk_extension_deregister_function") == 0) {
g_variant_get(parameters, "(t&s&s)", &page_id, &script, &url);
- if (page_id != -1) {
+ if (page_id != -1UL) {
result = TRUE;
// Return before processing the linked list, to prevent DBus from hanging
g_dbus_method_invocation_return_value(invocation, g_variant_new("(b)", result));
@@ -459,7 +458,7 @@
g_error ("Unknown method %s\n", method_name);
}
-static const GDBusInterfaceVTable interface_vtable = {webkitgtk_extension_handle_method_call, NULL, NULL};
+static const GDBusInterfaceVTable interface_vtable = {.method_call = webkitgtk_extension_handle_method_call};
static void connection_closed_cb (GDBusConnection *connection, gboolean remote_peer_vanished, GError *error,
gpointer user_data) {