[rygel/wip/meson: 5/12] all: Fix compiler warnings in C code



commit 138d247ce14be3b8290663e10b0ca236d1b482eb
Author: Jens Georg <mail jensge org>
Date:   Tue May 23 16:28:14 2017 +0200

    all: Fix compiler warnings in C code

 examples/fullscreen-renderer.c                     |  9 ++++---
 examples/renderer-plugins/C/example-player.c       | 11 ++++-----
 .../renderer-plugins/C/example-renderer-plugin.c   |  4 ++--
 examples/server-plugins/C/example-root-container.c | 12 +++++-----
 examples/standalone-renderer-gst.c                 |  2 --
 examples/standalone-ruih.c                         |  4 ----
 examples/standalone-server.c                       | 28 ++++++++++++----------
 src/librygel-db/collate.c                          |  2 +-
 8 files changed, 32 insertions(+), 40 deletions(-)
---
diff --git a/examples/fullscreen-renderer.c b/examples/fullscreen-renderer.c
index c49bf09b..517ad198 100644
--- a/examples/fullscreen-renderer.c
+++ b/examples/fullscreen-renderer.c
@@ -74,12 +74,12 @@ static void on_realize (GtkWidget *widget, gpointer user_data)
 
 #ifdef GDK_WINDOWING_WAYLAND
     if (GDK_IS_WAYLAND_WINDOW (window)) {
-        window_handle = gdk_wayland_window_get_wl_surface (window);
+        window_handle = (guintptr) gdk_wayland_window_get_wl_surface (window);
     } else
 #endif
 #ifdef GDK_WINDOWING_X11
     if (GDK_IS_X11_WINDOW (window)) {
-        window_handle = GDK_WINDOW_XID (window);
+        window_handle = (guintptr) GDK_WINDOW_XID (window);
     } else
 #endif
     {
@@ -126,6 +126,8 @@ static gboolean on_draw (GtkWidget *widget, cairo_t *cr, gpointer user_data)
 
         cairo_paint (cr);
     }
+
+    return TRUE;
 }
 
 static gboolean on_key_released (GtkWidget *widget,
@@ -149,8 +151,6 @@ static gboolean on_key_released (GtkWidget *widget,
 int main (int argc, char *argv[])
 {
     RygelPlaybinRenderer *renderer;
-    GError *error = NULL;
-    GMainLoop *loop;
     MainData data;
     GdkCursor *cursor;
 
@@ -164,7 +164,6 @@ int main (int argc, char *argv[])
 
     data.window = GTK_WINDOW (gtk_window_new (GTK_WINDOW_TOPLEVEL));
     data.video = gtk_drawing_area_new ();
-    gtk_widget_set_double_buffered (data.video, FALSE);
     gtk_container_add (GTK_CONTAINER (data.window), data.video);
     g_signal_connect (data.video, "realize", G_CALLBACK (on_realize), &data);
     gtk_widget_add_events (data.video,
diff --git a/examples/renderer-plugins/C/example-player.c b/examples/renderer-plugins/C/example-player.c
index 482e641c..c802e3cc 100644
--- a/examples/renderer-plugins/C/example-player.c
+++ b/examples/renderer-plugins/C/example-player.c
@@ -286,10 +286,10 @@ rygel_example_player_real_get_protocols (RygelMediaPlayer *base, int *result_len
   /* RygelExamplePlayer *self = RYGEL_EXAMPLE_PLAYER (base); */
 
   if (result_length) {
-    *result_length = g_strv_length (RYGEL_EXAMPLE_PLAYER_PROTOCOLS);
+    *result_length = g_strv_length ((gchar **)RYGEL_EXAMPLE_PLAYER_PROTOCOLS);
   }
 
-  return g_strdupv (RYGEL_EXAMPLE_PLAYER_PROTOCOLS);
+  return g_strdupv ((gchar **) RYGEL_EXAMPLE_PLAYER_PROTOCOLS);
 }
 
 
@@ -298,10 +298,10 @@ rygel_example_player_real_get_mime_types (RygelMediaPlayer *base, int *result_le
   /* RygelExamplePlayer *self = RYGEL_EXAMPLE_PLAYER (base); */
 
   if (result_length) {
-    *result_length = g_strv_length (RYGEL_EXAMPLE_PLAYER_MIME_TYPES);
+    *result_length = g_strv_length ((gchar **) RYGEL_EXAMPLE_PLAYER_MIME_TYPES);
   }
 
-  return g_strdupv (RYGEL_EXAMPLE_PLAYER_MIME_TYPES);
+  return g_strdupv ((gchar **) RYGEL_EXAMPLE_PLAYER_MIME_TYPES);
 }
 
 
@@ -476,21 +476,18 @@ rygel_example_player_real_get_playback_speed (RygelMediaPlayer *base)
 static gint64
 rygel_example_player_real_get_byte_position (RygelMediaPlayer* base)
 {
-       RygelExamplePlayer *self = RYGEL_EXAMPLE_PLAYER (base);
        return 0;
 }
 
 static gint64
 rygel_example_player_real_get_size (RygelMediaPlayer* base)
 {
-       RygelExamplePlayer *self = RYGEL_EXAMPLE_PLAYER (base);
        return 0;
 }
 
 static gboolean
 rygel_example_player_real_get_can_seek_bytes (RygelMediaPlayer* base)
 {
-       RygelExamplePlayer *self = RYGEL_EXAMPLE_PLAYER (base);
        return FALSE;
 }
 
diff --git a/examples/renderer-plugins/C/example-renderer-plugin.c 
b/examples/renderer-plugins/C/example-renderer-plugin.c
index bf9baa31..c5912acb 100644
--- a/examples/renderer-plugins/C/example-renderer-plugin.c
+++ b/examples/renderer-plugins/C/example-renderer-plugin.c
@@ -77,14 +77,14 @@ rygel_example_renderer_plugin_get_player (RygelMediaRendererPlugin* plugin)
         player = rygel_example_player_new ();
     }
 
-    return RYGEL_EXAMPLE_PLAYER (g_object_ref (player));
+    return RYGEL_MEDIA_PLAYER (g_object_ref (player));
 }
 
 static void
 rygel_example_renderer_plugin_class_init (RygelExampleRendererPluginClass *klass) {
     RygelMediaRendererPluginClass *plugin_class;
 
-    plugin_class = RYGEL_EXAMPLE_RENDERER_PLUGIN_CLASS (klass);
+    plugin_class = RYGEL_MEDIA_RENDERER_PLUGIN_CLASS (klass);
     plugin_class->get_player = rygel_example_renderer_plugin_get_player;
 }
 
diff --git a/examples/server-plugins/C/example-root-container.c 
b/examples/server-plugins/C/example-root-container.c
index fa3a8aa9..1384babc 100644
--- a/examples/server-plugins/C/example-root-container.c
+++ b/examples/server-plugins/C/example-root-container.c
@@ -43,18 +43,18 @@ rygel_example_root_container_construct (GType object_type, const gchar *title) {
   
   self = (RygelExampleRootContainer*) rygel_simple_container_construct_root (object_type, title);
 
-  item = rygel_music_item_new ("test 1", (RygelMediaContainer*) self, "Test 1", RYGEL_MUSIC_ITEM_UPNP_CLASS);
+  item = RYGEL_MEDIA_ITEM (rygel_music_item_new ("test 1", (RygelMediaContainer*) self, "Test 1", 
RYGEL_MUSIC_ITEM_UPNP_CLASS));
   rygel_media_object_add_uri (RYGEL_MEDIA_OBJECT (item), 
"file:///home/murrayc/Music/Madness/05_Baggy_Trousers.mp3");
-  rygel_media_file_item_set_mime_type (item, "audio/mpeg");
+  rygel_media_file_item_set_mime_type (RYGEL_MEDIA_FILE_ITEM (item), "audio/mpeg");
   rygel_simple_container_add_child_item ((RygelSimpleContainer*) self, item);
-  rygel_media_file_item_add_engine_resources (item, NULL, NULL);
+  rygel_media_file_item_add_engine_resources (RYGEL_MEDIA_FILE_ITEM (item), NULL, NULL);
   g_object_unref (item);
   
-  item = rygel_music_item_new ("test 2", (RygelMediaContainer*) self, "Test 1", RYGEL_MUSIC_ITEM_UPNP_CLASS);
+  item = RYGEL_MEDIA_ITEM (rygel_music_item_new ("test 2", (RygelMediaContainer*) self, "Test 1", 
RYGEL_MUSIC_ITEM_UPNP_CLASS));
   rygel_media_object_add_uri (RYGEL_MEDIA_OBJECT (item), 
"file:///home/murrayc/Music/08%20Busload%20of%20Faith.mp3");
-  rygel_media_file_item_set_mime_type (item, "audio/mpeg");
+  rygel_media_file_item_set_mime_type (RYGEL_MEDIA_FILE_ITEM (item), "audio/mpeg");
   rygel_simple_container_add_child_item ((RygelSimpleContainer*) self, item);
-  rygel_media_file_item_add_engine_resources (item, NULL, NULL);
+  rygel_media_file_item_add_engine_resources (RYGEL_MEDIA_FILE_ITEM (item), NULL, NULL);
   g_object_unref (item);
 
   return self;
diff --git a/examples/standalone-renderer-gst.c b/examples/standalone-renderer-gst.c
index b87abc80..acbbea4e 100644
--- a/examples/standalone-renderer-gst.c
+++ b/examples/standalone-renderer-gst.c
@@ -43,10 +43,8 @@ int main(int argc, char *argv[])
 {
     GstElement *playbin, *sink, *asink;
     RygelPlaybinRenderer *renderer;
-    GError *error = NULL;
     GMainLoop *loop;
 
-    g_type_init ();
     gst_init (&argc, &argv);
 
     g_set_application_name ("Standalone-Renderer");
diff --git a/examples/standalone-ruih.c b/examples/standalone-ruih.c
index f1435bc9..0f5b0ace 100644
--- a/examples/standalone-ruih.c
+++ b/examples/standalone-ruih.c
@@ -48,11 +48,7 @@
 int main (int argc, char *argv[])
 {
     RygelRuihServer *server;
-    int i;
     GMainLoop *loop;
-    GError *error = NULL;
-
-    g_type_init ();
 
     g_set_application_name ("Standalone-Ruih");
 
diff --git a/examples/standalone-server.c b/examples/standalone-server.c
index 42abd200..d43b99e1 100644
--- a/examples/standalone-server.c
+++ b/examples/standalone-server.c
@@ -49,7 +49,9 @@ int main (int argc, char *argv[])
     GMainLoop *loop;
     GError *error = NULL;
 
+#if !GLIB_CHECK_VERSION(2, 36, 0)
     g_type_init ();
+#endif
 
     rygel_media_engine_init (&error);
 
@@ -101,33 +103,33 @@ int main (int argc, char *argv[])
         id = g_strdup_printf ("%06d", i);
 
         if (g_str_has_prefix (content_type, "audio/")) {
-            item = rygel_audio_item_new (id,
-                                         root_container,
+            item = RYGEL_MEDIA_ITEM (rygel_audio_item_new (id,
+                                         RYGEL_MEDIA_CONTAINER (root_container),
                                          display_name,
-                                         RYGEL_AUDIO_ITEM_UPNP_CLASS);
+                                         RYGEL_AUDIO_ITEM_UPNP_CLASS));
         } else if (g_str_has_prefix (content_type, "video/")) {
-            item = rygel_video_item_new (id,
-                                         root_container,
+            item = RYGEL_MEDIA_ITEM (rygel_video_item_new (id,
+                                         RYGEL_MEDIA_CONTAINER (root_container),
                                          display_name,
-                                         RYGEL_VIDEO_ITEM_UPNP_CLASS);
+                                         RYGEL_VIDEO_ITEM_UPNP_CLASS));
         } else if (g_str_has_prefix (content_type, "image/")) {
-            item = rygel_image_item_new (id,
-                                         root_container,
+            item = RYGEL_MEDIA_ITEM (rygel_image_item_new (id,
+                                         RYGEL_MEDIA_CONTAINER (root_container),
                                          display_name,
-                                         RYGEL_IMAGE_ITEM_UPNP_CLASS);
+                                         RYGEL_IMAGE_ITEM_UPNP_CLASS));
         }
         g_free (id);
 
         if (item != NULL) {
-            GeeArrayList* uris;
-
             rygel_media_file_item_set_mime_type (RYGEL_MEDIA_FILE_ITEM (item),
                                                  content_type);
 
             rygel_media_object_add_uri (RYGEL_MEDIA_OBJECT (item), uri);
 
             rygel_simple_container_add_child_item (root_container, item);
-            rygel_media_file_item_add_engine_resources (item, NULL, NULL);
+            rygel_media_file_item_add_engine_resources (RYGEL_MEDIA_FILE_ITEM (item),
+                                                        NULL,
+                                                        NULL);
         }
 
         i++;
@@ -135,7 +137,7 @@ int main (int argc, char *argv[])
     }
 
     server = rygel_media_server_new ("LibRygel sample server",
-                                     root_container,
+                                     RYGEL_MEDIA_CONTAINER (root_container),
                                      RYGEL_PLUGIN_CAPABILITIES_NONE);
     rygel_media_device_add_interface (RYGEL_MEDIA_DEVICE (server), "eth0");
     rygel_media_device_add_interface (RYGEL_MEDIA_DEVICE (server), "wlan0");
diff --git a/src/librygel-db/collate.c b/src/librygel-db/collate.c
index 9f0c17c7..a029e515 100644
--- a/src/librygel-db/collate.c
+++ b/src/librygel-db/collate.c
@@ -37,7 +37,7 @@ gint rygel_database_utf8_collate_str (const char *a, gsize alen,
     b_str = g_strndup (b, blen);
 
 #ifdef HAVE_UNISTRING
-    result = u8_strcoll (a_str, b_str);
+    result = u8_strcoll ((const uint8_t *) a_str, (const uint8_t *) b_str);
 #else
     return g_utf8_collate (a_str, b_str);
 #endif


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]