[totem] gcc warning fixes in plugins



commit b7ddff7b1b20fef6f324f4dd6954e5939223cd39
Author: Philip Withnall <philip tecnocode co uk>
Date:   Thu Jul 15 23:07:16 2010 +0100

    gcc warning fixes in plugins
    
    Duplicate declarations, unsigned/signed confusion and non-optimiseable
    loops.

 src/plugins/bemused/totem-bemused.c                |   42 +++++++++----------
 .../brasero-disc-recorder/totem-disc-recorder.c    |    2 -
 src/plugins/lirc/totem-lirc.c                      |   10 +---
 src/plugins/publish/totem-publish.c                |    6 +-
 4 files changed, 26 insertions(+), 34 deletions(-)
---
diff --git a/src/plugins/bemused/totem-bemused.c b/src/plugins/bemused/totem-bemused.c
index 48df3c6..61f8ec7 100644
--- a/src/plugins/bemused/totem-bemused.c
+++ b/src/plugins/bemused/totem-bemused.c
@@ -75,8 +75,6 @@ typedef struct
 
 GType	totem_bemused_plugin_get_type		(void) G_GNUC_CONST;
 
-static void totem_bemused_plugin_init		(TotemBemusedPlugin *plugin);
-
 TOTEM_PLUGIN_REGISTER(TOTEM_TYPE_BEMUSED_PLUGIN, TotemBemusedPlugin, totem_bemused_plugin)
 
 /* Bluetooth functions */
@@ -95,7 +93,7 @@ flush_response (TotemBemusedPlugin *tp, GIOChannel *source)
 }
 
 static void
-send_response_flush (TotemBemusedPlugin *tp, GIOChannel *source, const char *resp, gssize len, gboolean flush)
+send_response_flush (TotemBemusedPlugin *tp, GIOChannel *source, const char *resp, gsize len, gboolean flush)
 {
 	GError *error = NULL;
 	gsize written = 0;
@@ -109,26 +107,26 @@ send_response_flush (TotemBemusedPlugin *tp, GIOChannel *source, const char *res
 		flush_response (tp, source);
 
 	if (len != written)
-		g_message ("sent response: %d chars but len %d chars", (int) written, (int) len);
+		g_message ("sent response: %"G_GSIZE_FORMAT" chars but len %"G_GSIZE_FORMAT" chars", written, len);
 }
 
 static void
-send_response (TotemBemusedPlugin *tp, GIOChannel *source, const char *resp, gssize len)
+send_response (TotemBemusedPlugin *tp, GIOChannel *source, const char *resp, gsize len)
 {
 	send_response_flush (tp, source, resp, len, TRUE);
 }
 
 static void
-read_response (TotemBemusedPlugin *tp, GIOChannel *source, char *buf, gssize len)
+read_response (TotemBemusedPlugin *tp, GIOChannel *source, char *buf, gsize len)
 {
 	GError *error = NULL;
-	gsize read;
+	gsize num_read;
 
-	if (g_io_channel_read_chars (source, buf, len, &read, &error) != G_IO_STATUS_NORMAL) {
+	if (g_io_channel_read_chars (source, buf, len, &num_read, &error) != G_IO_STATUS_NORMAL) {
 		g_message ("error reading response: %s", error->message);
 		g_error_free (error);
-	} else if (len != read) {
-		g_message ("read %d chars but len %d chars", (int) read, (int) len);
+	} else if (len != num_read) {
+		g_message ("read %"G_GSIZE_FORMAT" chars but len %"G_GSIZE_FORMAT" chars", num_read, len);
 	}
 }
 
@@ -136,7 +134,7 @@ static char *
 read_filename (TotemBemusedPlugin *tp, GIOChannel *source)
 {
 	char namelenbuf[2], *filename;
-	int namelen;
+	guint namelen;
 
 	/* Read length */
 	read_response (tp, source, namelenbuf, 2);
@@ -239,15 +237,15 @@ static void
 seek_to_pos (TotemBemusedPlugin *tp, GIOChannel *source)
 {
 	char buf[4];
-	int time;
+	int _time;
 
 	read_response (tp, source, buf, 4);
-	time = buf[0] << 24;
-	time += buf[1] << 16;
-	time += buf[2] << 8;
-	time += buf[3];
+	_time = buf[0] << 24;
+	_time += buf[1] << 16;
+	_time += buf[2] << 8;
+	_time += buf[3];
 
-	totem_action_seek_time (tp->totem, (gint64) time * 1000, FALSE);
+	totem_action_seek_time (tp->totem, (gint64) _time * 1000, FALSE);
 }
 
 static void
@@ -392,11 +390,11 @@ static void
 set_playlist_at_pos (TotemBemusedPlugin *tp, GIOChannel *source)
 {
 	char buf[2];
-	int index;
+	int idx;
 
 	read_response (tp, source, buf, 2);
-	index = (buf[0] << 8) + buf[1];
-	totem_action_set_playlist_index (tp->totem, index);
+	idx = (buf[0] << 8) + buf[1];
+	totem_action_set_playlist_index (tp->totem, idx);
 }
 
 #if 0
@@ -521,13 +519,13 @@ client_watch_func (GIOChannel *source, GIOCondition condition, gpointer data)
 
 	if (condition & G_IO_IN || condition & G_IO_PRI) {
 		char buf[5];
-		gsize read;
+		gsize num_read;
 
 		status = G_IO_STATUS_NORMAL;
 
 		while (status == G_IO_STATUS_NORMAL) {
 			memset(buf, 0, 5);
-			status = g_io_channel_read_chars (source, buf, 4, &read, NULL);
+			status = g_io_channel_read_chars (source, buf, 4, &num_read, NULL);
 
 			if (status == G_IO_STATUS_NORMAL)
 				handle_command (tp, source, buf);
diff --git a/src/plugins/brasero-disc-recorder/totem-disc-recorder.c b/src/plugins/brasero-disc-recorder/totem-disc-recorder.c
index 765640f..57b9aa7 100644
--- a/src/plugins/brasero-disc-recorder/totem-disc-recorder.c
+++ b/src/plugins/brasero-disc-recorder/totem-disc-recorder.c
@@ -68,8 +68,6 @@ typedef struct
 
 GType totem_disc_recorder_plugin_get_type	(void) G_GNUC_CONST;
 
-static void peas_activatable_iface_init		(PeasActivatableInterface *iface);
-
 TOTEM_PLUGIN_REGISTER(TOTEM_TYPE_DISC_RECORDER_PLUGIN, TotemDiscRecorderPlugin, totem_disc_recorder_plugin)
 
 static void totem_disc_recorder_plugin_burn (GtkAction *action,
diff --git a/src/plugins/lirc/totem-lirc.c b/src/plugins/lirc/totem-lirc.c
index fe7203c..c348927 100644
--- a/src/plugins/lirc/totem-lirc.c
+++ b/src/plugins/lirc/totem-lirc.c
@@ -98,8 +98,6 @@ typedef struct
 
 GType	totem_lirc_plugin_get_type		(void) G_GNUC_CONST;
 
-static void totem_lirc_plugin_init		(TotemLircPlugin *plugin);
-
 TOTEM_PLUGIN_REGISTER(TOTEM_TYPE_LIRC_PLUGIN, TotemLircPlugin, totem_lirc_plugin)
 
 static void
@@ -125,7 +123,7 @@ totem_lirc_get_url (const char *str)
 	return g_strdup (s + 1);
 }
 
-static TotemRemoteSetting
+static gint
 totem_lirc_to_setting (const gchar *str, char **url)
 {
 	if (strcmp (str, TOTEM_IR_SETTING_TOGGLE_REPEAT) == 0)
@@ -228,9 +226,7 @@ totem_lirc_read_code (GIOChannel *source, GIOCondition condition, TotemLircPlugi
 		}
 
 		if (g_str_has_prefix (str, TOTEM_IR_SETTING) != FALSE) {
-			TotemRemoteSetting setting;
-
-			setting = totem_lirc_to_setting (str, &url);
+			gint setting = totem_lirc_to_setting (str, &url);
 			if (setting >= 0) {
 				gboolean value;
 
@@ -260,7 +256,7 @@ impl_activate (PeasActivatable *plugin,
 
 	pi->totem = g_object_ref (totem);
 
-	fd = lirc_init ("Totem", 0);
+	fd = lirc_init ((char*) "Totem", 0);
 	if (fd < 0) {
 		//FIXME
 #if 0
diff --git a/src/plugins/publish/totem-publish.c b/src/plugins/publish/totem-publish.c
index 18384f8..d08bc10 100644
--- a/src/plugins/publish/totem-publish.c
+++ b/src/plugins/publish/totem-publish.c
@@ -427,14 +427,14 @@ totem_publish_plugin_load_playlist (TotemPublishPlugin   *self,
 		ev_sidebar_set_current_page (EV_SIDEBAR (self->totem->sidebar), "playlist");
 		totem_playlist_clear (self->totem->playlist);
 
-		for (i = 1; i <= n_entries; ++i) {
+		for (i = 0; i < n_entries; ++i) {
 			gchar *key, *mrl, *title;
 
-			key = g_strdup_printf ("File%d", i);
+			key = g_strdup_printf ("File%d", i + 1);
 			mrl = g_key_file_get_string (keyfile, "playlist", key, NULL);
 			g_free (key);
 
-			key = g_strdup_printf ("Title%d", i);
+			key = g_strdup_printf ("Title%d", i + 1);
 			title = g_key_file_get_string (keyfile, "playlist", key, NULL);
 			g_free (key);
 



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