[totem] Fix various compiler warnings



commit 10f2485d2fcef546b90e3352091e21e6dbd18f20
Author: Philip Withnall <philip tecnocode co uk>
Date:   Thu Feb 18 13:24:34 2010 +0000

    Fix various compiler warnings
    
    Various small compiler warnings (such as variable shadowing, constness, etc.)
    fixed, plus some more serious ones which could've caused crashes:
     * potentially passing 0 to g_source_remove() due to a bad comparison
     * passing by value, not reference, to g_object_get()

 browser-plugin/totem-glow-button.c        |    6 ++----
 browser-plugin/totem-glow-button.h        |    2 +-
 browser-plugin/totem-plugin-viewer.c      |   14 +++++++-------
 src/backend/Makefile.am                   |    1 -
 src/backend/bacon-video-widget-gst-0.10.c |   10 +++++-----
 src/backend/bacon-video-widget.h          |    2 +-
 src/plugins/Makefile.am                   |    1 -
 src/plugins/screenshot/Makefile.am        |    3 +--
 src/plugins/skipto/Makefile.am            |    3 +--
 src/totem-cell-renderer-video.c           |    2 +-
 src/totem-statusbar.c                     |    1 -
 src/totem-statusbar.h                     |    2 +-
 src/totem-time-label.c                    |    1 -
 src/totem-time-label.h                    |   12 ++++++------
 14 files changed, 26 insertions(+), 34 deletions(-)
---
diff --git a/browser-plugin/totem-glow-button.c b/browser-plugin/totem-glow-button.c
index 9ace690..4244ff9 100644
--- a/browser-plugin/totem-glow-button.c
+++ b/browser-plugin/totem-glow-button.c
@@ -53,14 +53,12 @@ struct _TotemGlowButton {
 	guint anim_finished :1;
 };
 
-static void	totem_glow_button_class_init	(TotemGlowButtonClass * klass);
-static void	totem_glow_button_init		(TotemGlowButton      * button);
 static void	totem_glow_button_set_timeout	(TotemGlowButton *button,
 						 gboolean set_timeout);
 
 static GtkButtonClass *parent_class;
 
-G_DEFINE_TYPE(TotemGlowButton, totem_glow_button, GTK_TYPE_BUTTON);
+G_DEFINE_TYPE (TotemGlowButton, totem_glow_button, GTK_TYPE_BUTTON);
 
 static void
 totem_glow_button_do_expose (TotemGlowButton *button)
@@ -327,7 +325,7 @@ totem_glow_button_unmap (GtkWidget *buttonw)
 
 	button = TOTEM_GLOW_BUTTON (buttonw);
 
-	if (button->button_glow >= 0) {
+	if (button->button_glow > 0) {
 		g_source_remove (button->button_glow);
 		button->button_glow = 0;
 	}
diff --git a/browser-plugin/totem-glow-button.h b/browser-plugin/totem-glow-button.h
index 027ab46..138f8c4 100644
--- a/browser-plugin/totem-glow-button.h
+++ b/browser-plugin/totem-glow-button.h
@@ -41,7 +41,7 @@ typedef struct _TotemGlowButtonClass {
   gpointer __bla[4];
 } TotemGlowButtonClass;
 
-GType		totem_glow_button_get_type	(void);
+GType		totem_glow_button_get_type	(void) G_GNUC_CONST;
 
 GtkWidget *	totem_glow_button_new		(void);
 void		totem_glow_button_set_glow	(TotemGlowButton *button, gboolean glow);
diff --git a/browser-plugin/totem-plugin-viewer.c b/browser-plugin/totem-plugin-viewer.c
index 0c363b2..e81b08a 100644
--- a/browser-plugin/totem-plugin-viewer.c
+++ b/browser-plugin/totem-plugin-viewer.c
@@ -330,7 +330,7 @@ static void
 totem_embedded_set_state (TotemEmbedded *emb, TotemStates state)
 {
 	GtkWidget *image;
-	gchar *id;
+	const gchar *id;
 
 	if (state == emb->state)
 		return;
@@ -949,7 +949,7 @@ totem_embedded_set_playlist (TotemEmbedded *emb,
 			     GError **error)
 {
 	char *file_uri;
-	char *tmpfile;
+	char *tmp_file;
 	GError *err = NULL;
 	GFile *src, *dst;
 	int fd;
@@ -963,7 +963,7 @@ totem_embedded_set_playlist (TotemEmbedded *emb,
 	 * parse from memory or 
 	 * https://bugzilla.gnome.org/show_bug.cgi?id=598702 is fixed */
 	fd = g_file_open_tmp ("totem-browser-plugin-playlist-XXXXXX",
-			      &tmpfile,
+			      &tmp_file,
 			      &err);
 	if (fd < 0) {
 		g_warning ("Couldn't open temporary file for playlist: %s",
@@ -972,18 +972,18 @@ totem_embedded_set_playlist (TotemEmbedded *emb,
 		return TRUE;
 	}
 	src = g_file_new_for_path (path);
-	dst = g_file_new_for_path (tmpfile);
+	dst = g_file_new_for_path (tmp_file);
 	if (g_file_copy (src, dst, G_FILE_COPY_OVERWRITE | G_FILE_COPY_TARGET_DEFAULT_PERMS, NULL, NULL, NULL, &err) == FALSE) {
 		g_warning ("Failed to copy playlist '%s' to '%s': %s",
-			   path, tmpfile, err->message);
+			   path, tmp_file, err->message);
 		g_error_free (err);
 		g_object_unref (src);
 		g_object_unref (dst);
-		g_free (tmpfile);
+		g_free (tmp_file);
 		close (fd);
 		return TRUE;
 	}
-	g_free (tmpfile);
+	g_free (tmp_file);
 
 	file_uri = g_file_get_uri (dst);
 
diff --git a/src/backend/Makefile.am b/src/backend/Makefile.am
index a111199..a01dc6e 100644
--- a/src/backend/Makefile.am
+++ b/src/backend/Makefile.am
@@ -5,7 +5,6 @@ noinst_LTLIBRARIES = libbaconvideowidget.la
 bvw_test_SOURCES = bvw-test.c
 
 bvw_test_CPPFLAGS = \
-	-I$(top_srcdir)/plparse		\
 	-DDATADIR=\"$(pkgdatadir)\"	\
 	-DLOGO_PATH=DATADIR\"\"G_DIR_SEPARATOR_S\"totem\"G_DIR_SEPARATOR_S\"totem_logo.png\"
 	$(DISABLE_DEPRECATED)		\
diff --git a/src/backend/bacon-video-widget-gst-0.10.c b/src/backend/bacon-video-widget-gst-0.10.c
index 703390e..8f81179 100644
--- a/src/backend/bacon-video-widget-gst-0.10.c
+++ b/src/backend/bacon-video-widget-gst-0.10.c
@@ -3835,15 +3835,15 @@ bacon_video_widget_can_direct_seek (BaconVideoWidget *bvw)
  * Return value: %TRUE on success, %FALSE otherwise
  **/
 gboolean
-bacon_video_widget_seek_time (BaconVideoWidget *bvw, gint64 time, GError **error)
+bacon_video_widget_seek_time (BaconVideoWidget *bvw, gint64 _time, GError **error)
 {
   g_return_val_if_fail (bvw != NULL, FALSE);
   g_return_val_if_fail (BACON_IS_VIDEO_WIDGET (bvw), FALSE);
   g_return_val_if_fail (GST_IS_ELEMENT (bvw->priv->play), FALSE);
 
-  GST_LOG ("Seeking to %" GST_TIME_FORMAT, GST_TIME_ARGS (time * GST_MSECOND));
+  GST_LOG ("Seeking to %" GST_TIME_FORMAT, GST_TIME_ARGS (_time * GST_MSECOND));
 
-  if (time > bvw->priv->stream_length
+  if (_time > bvw->priv->stream_length
       && bvw->priv->stream_length > 0
       && !g_str_has_prefix (bvw->priv->mrl, "dvd:")
       && !g_str_has_prefix (bvw->priv->mrl, "vcd:")) {
@@ -3853,14 +3853,14 @@ bacon_video_widget_seek_time (BaconVideoWidget *bvw, gint64 time, GError **error
   }
 
   /* Emit a time tick of where we are going, we are paused */
-  got_time_tick (bvw->priv->play, time * GST_MSECOND, bvw);
+  got_time_tick (bvw->priv->play, _time * GST_MSECOND, bvw);
 
   if (bvw_set_playback_direction (bvw, TRUE) == FALSE)
     return FALSE;
 
   gst_element_seek (bvw->priv->play, FORWARD_RATE,
       GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT,
-      GST_SEEK_TYPE_SET, time * GST_MSECOND,
+      GST_SEEK_TYPE_SET, _time * GST_MSECOND,
       GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE);
   bvw->priv->rate = FORWARD_RATE;
 
diff --git a/src/backend/bacon-video-widget.h b/src/backend/bacon-video-widget.h
index c4ecb32..8f81c63 100644
--- a/src/backend/bacon-video-widget.h
+++ b/src/backend/bacon-video-widget.h
@@ -182,7 +182,7 @@ gboolean bacon_video_widget_seek		 (BaconVideoWidget *bvw,
 						  double position,
 						  GError **error);
 gboolean bacon_video_widget_seek_time		 (BaconVideoWidget *bvw,
-						  gint64 time,
+						  gint64 _time,
 						  GError **error);
 gboolean bacon_video_widget_step		 (BaconVideoWidget *bvw,
 						  gboolean forward,
diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am
index 92e4dc6..25abd30 100644
--- a/src/plugins/Makefile.am
+++ b/src/plugins/Makefile.am
@@ -41,7 +41,6 @@ libtotemmodule_la_CFLAGS = \
 	-I$(top_builddir)/lib 				\
 	-I$(top_srcdir)/src				\
 	-I$(top_srcdir)/src/backend			\
-	-I$(top_srcdir)/src/plparse			\
 	-I$(top_srcdir)/src/plugins
 
 libtotemmodule_la_LDFLAGS = \
diff --git a/src/plugins/screenshot/Makefile.am b/src/plugins/screenshot/Makefile.am
index 20b0017..b2aaa60 100644
--- a/src/plugins/screenshot/Makefile.am
+++ b/src/plugins/screenshot/Makefile.am
@@ -37,8 +37,7 @@ libscreenshot_la_SOURCES = \
 libscreenshot_la_LDFLAGS = $(modules_flags)
 libscreenshot_la_CPPFLAGS = \
 	$(common_defines)		\
-	-I$(top_srcdir)/src/backend	\
-	-I$(top_srcdir)/plparse
+	-I$(top_srcdir)/src/backend
 
 libscreenshot_la_CFLAGS = 		\
 	$(DEPENDENCY_CFLAGS)		\
diff --git a/src/plugins/skipto/Makefile.am b/src/plugins/skipto/Makefile.am
index e566770..40a20f1 100644
--- a/src/plugins/skipto/Makefile.am
+++ b/src/plugins/skipto/Makefile.am
@@ -33,8 +33,7 @@ libskipto_la_SOURCES = \
 libskipto_la_LDFLAGS = $(modules_flags)
 libskipto_la_CPPFLAGS = \
 	$(common_defines)		\
-	-I$(top_srcdir)/src/backend	\
-	-I$(top_srcdir)/plparse
+	-I$(top_srcdir)/src/backend
 
 libskipto_la_CFLAGS = 			\
 	$(DEPENDENCY_CFLAGS)		\
diff --git a/src/totem-cell-renderer-video.c b/src/totem-cell-renderer-video.c
index 33a28de..be2b03d 100644
--- a/src/totem-cell-renderer-video.c
+++ b/src/totem-cell-renderer-video.c
@@ -396,7 +396,7 @@ totem_cell_renderer_video_render (GtkCellRenderer *cell,
 	g_object_get (cell,
 		      "xpad", &cell_xpad,
 		      "ypad", &cell_ypad,
-		      "is_expander", cell_is_expander,
+		      "is_expander", &cell_is_expander,
 		      NULL);
 
 	get_size (cell, widget, cell_area, &draw_area, &title_area, &thumbnail_area);
diff --git a/src/totem-statusbar.c b/src/totem-statusbar.c
index f2615f8..3360f0d 100644
--- a/src/totem-statusbar.c
+++ b/src/totem-statusbar.c
@@ -42,7 +42,6 @@
 static void totem_statusbar_dispose          (GObject             *object);
 static void totem_statusbar_sync_description (TotemStatusbar      *statusbar);
 
-G_MODULE_EXPORT GType totem_statusbar_get_type (void);
 G_DEFINE_TYPE(TotemStatusbar, totem_statusbar, GTK_TYPE_STATUSBAR)
 
 static void
diff --git a/src/totem-statusbar.h b/src/totem-statusbar.h
index 62d99b1..402c75a 100644
--- a/src/totem-statusbar.h
+++ b/src/totem-statusbar.h
@@ -61,7 +61,7 @@ struct _TotemStatusbar
 
 typedef GtkStatusbarClass TotemStatusbarClass;
 
-GType      totem_statusbar_get_type     	(void) G_GNUC_CONST;
+G_MODULE_EXPORT GType totem_statusbar_get_type  (void) G_GNUC_CONST;
 GtkWidget* totem_statusbar_new          	(void);
 
 void       totem_statusbar_set_time		(TotemStatusbar *statusbar,
diff --git a/src/totem-time-label.c b/src/totem-time-label.c
index 8383ffc..efea1ea 100644
--- a/src/totem-time-label.c
+++ b/src/totem-time-label.c
@@ -11,7 +11,6 @@ struct _TotemTimeLabelPrivate {
 	gboolean seeking;
 };
 
-G_MODULE_EXPORT GType totem_time_label_get_type (void);
 G_DEFINE_TYPE (TotemTimeLabel, totem_time_label, GTK_TYPE_LABEL)
 #define TOTEM_TIME_LABEL_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TOTEM_TYPE_TIME_LABEL, TotemTimeLabelPrivate))
 
diff --git a/src/totem-time-label.h b/src/totem-time-label.h
index c7d292c..acb017d 100644
--- a/src/totem-time-label.h
+++ b/src/totem-time-label.h
@@ -23,11 +23,11 @@ struct TotemTimeLabelClass {
 	GtkLabelClass parent_class;
 };
 
-GType    totem_time_label_get_type 	(void);
-GtkWidget *totem_time_label_new      	(void);
-void       totem_time_label_set_time    (TotemTimeLabel *label,
-					 gint64 time, gint64 length);
-void       totem_time_label_set_seeking (TotemTimeLabel *label,
-           gboolean seeking);
+G_MODULE_EXPORT GType totem_time_label_get_type (void);
+GtkWidget *totem_time_label_new                 (void);
+void       totem_time_label_set_time            (TotemTimeLabel *label,
+                                                 gint64 time, gint64 length);
+void       totem_time_label_set_seeking         (TotemTimeLabel *label,
+                                                 gboolean seeking);
 
 #endif /* TOTEM_TIME_LABEL_H */



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