[libgdata] Compiler warning fixes



commit 08a5db51d3a1d4f796cd9c12c04400a704b57ba3
Author: Philip Withnall <philip tecnocode co uk>
Date:   Sat Apr 18 23:58:02 2009 +0100

    Compiler warning fixes
---
 gdata/gdata-entry.c                               |    8 +++---
 gdata/gdata-feed.c                                |   16 ++++++------
 gdata/gdata-media-rss.c                           |   16 ++++++------
 gdata/gdata-media-rss.h                           |    4 +-
 gdata/gdata-service.c                             |    8 +++---
 gdata/services/calendar/gdata-calendar-calendar.c |   17 +++++++------
 gdata/services/calendar/gdata-calendar-calendar.h |    2 +-
 gdata/services/calendar/gdata-calendar-event.c    |    6 ++--
 gdata/services/youtube/gdata-youtube-video.c      |   26 ++++++++++----------
 9 files changed, 52 insertions(+), 51 deletions(-)

diff --git a/gdata/gdata-entry.c b/gdata/gdata-entry.c
index 8a45ea4..f97794f 100644
--- a/gdata/gdata-entry.c
+++ b/gdata/gdata-entry.c
@@ -275,9 +275,9 @@ real_get_xml (GDataEntry *self, GString *xml_string)
 		g_string_append_printf (xml_string, "<link href='%s'", link->href);
 
 		if (G_UNLIKELY (link->title != NULL)) {
-			gchar *title = g_markup_escape_text (link->title, -1);
-			g_string_append_printf (xml_string, " title='%s'", title);
-			g_free (title);
+			gchar *link_title = g_markup_escape_text (link->title, -1);
+			g_string_append_printf (xml_string, " title='%s'", link_title);
+			g_free (link_title);
 		}
 
 		if (G_LIKELY (link->rel != NULL))
@@ -320,7 +320,7 @@ real_get_xml (GDataEntry *self, GString *xml_string)
 static void
 real_get_namespaces (GDataEntry *self, GHashTable *namespaces)
 {
-	g_hash_table_insert (namespaces, "gd", "http://schemas.google.com/g/2005";);
+	g_hash_table_insert (namespaces, (gchar*) "gd", (gchar*) "http://schemas.google.com/g/2005";);
 }
 
 /**
diff --git a/gdata/gdata-feed.c b/gdata/gdata-feed.c
index d7a6b07..7ad4bb3 100644
--- a/gdata/gdata-feed.c
+++ b/gdata/gdata-feed.c
@@ -518,7 +518,7 @@ _gdata_feed_new_from_xml (const gchar *xml, gint length, GType entry_type,
 			logo = xmlNodeListGetString (doc, node->xmlChildrenNode, TRUE);
 		} else if (xmlStrcmp (node->name, (xmlChar*) "link") == 0) {
 			/* atom:link */
-			xmlChar *href, *rel, *type, *hreflang, *title, *length;
+			xmlChar *href, *rel, *type, *hreflang, *link_title, *link_length;
 			gint length_int;
 			GDataLink *link;
 
@@ -526,23 +526,23 @@ _gdata_feed_new_from_xml (const gchar *xml, gint length, GType entry_type,
 			rel = xmlGetProp (node, (xmlChar*) "rel");
 			type = xmlGetProp (node, (xmlChar*) "type");
 			hreflang = xmlGetProp (node, (xmlChar*) "hreflang");
-			title = xmlGetProp (node, (xmlChar*) "title");
-			length = xmlGetProp (node, (xmlChar*) "length");
+			link_title = xmlGetProp (node, (xmlChar*) "title");
+			link_length = xmlGetProp (node, (xmlChar*) "length");
 
-			if (length == NULL)
+			if (link_length == NULL)
 				length_int = -1;
 			else
-				length_int = strtoul ((gchar*) length, NULL, 10);
+				length_int = strtoul ((gchar*) link_length, NULL, 10);
 
-			link = gdata_link_new ((gchar*) href, (gchar*) rel, (gchar*) type, (gchar*) hreflang, (gchar*) title, length_int);
+			link = gdata_link_new ((gchar*) href, (gchar*) rel, (gchar*) type, (gchar*) hreflang, (gchar*) link_title, length_int);
 			links = g_list_prepend (links, link);
 
 			xmlFree (href);
 			xmlFree (rel);
 			xmlFree (type);
 			xmlFree (hreflang);
-			xmlFree (title);
-			xmlFree (length);
+			xmlFree (link_title);
+			xmlFree (link_length);
 		} else if (xmlStrcmp (node->name, (xmlChar*) "author") == 0) {
 			/* atom:author */
 			GDataAuthor *author;
diff --git a/gdata/gdata-media-rss.c b/gdata/gdata-media-rss.c
index 4e7fdb4..ff5db11 100644
--- a/gdata/gdata-media-rss.c
+++ b/gdata/gdata-media-rss.c
@@ -130,13 +130,13 @@ gdata_media_content_free (GDataMediaContent *self)
 }
 
 GDataMediaThumbnail *
-gdata_media_thumbnail_new (const gchar *uri, guint width, guint height, gint64 time)
+gdata_media_thumbnail_new (const gchar *uri, guint width, guint height, gint64 _time)
 {
 	GDataMediaThumbnail *self = g_slice_new (GDataMediaThumbnail);
 	self->uri = g_strdup (uri);
 	self->width = width;
 	self->height = height;
-	self->time = time;
+	self->time = _time;
 	return self;
 }
 
@@ -165,18 +165,18 @@ gdata_media_thumbnail_parse_time (const gchar *time_string)
 }
 
 gchar *
-gdata_media_thumbnail_build_time (gint64 time)
+gdata_media_thumbnail_build_time (gint64 _time)
 {
 	guint hours, minutes;
 	gfloat seconds;
 
-	hours = time % 3600000;
-	time -= hours * 3600000;
+	hours = _time % 3600000;
+	_time -= hours * 3600000;
 
-	minutes = time % 60000;
-	time -= minutes * 60000;
+	minutes = _time % 60000;
+	_time -= minutes * 60000;
 
-	seconds = time / 1000.0;
+	seconds = _time / 1000.0;
 
 	return g_strdup_printf ("%02u:%02u:%02f", hours, minutes, seconds);
 }
diff --git a/gdata/gdata-media-rss.h b/gdata/gdata-media-rss.h
index 217ed8c..246d888 100644
--- a/gdata/gdata-media-rss.h
+++ b/gdata/gdata-media-rss.h
@@ -82,9 +82,9 @@ typedef struct {
 	gint64 time;
 } GDataMediaThumbnail;
 
-GDataMediaThumbnail *gdata_media_thumbnail_new (const gchar *uri, guint width, guint height, gint64 time);
+GDataMediaThumbnail *gdata_media_thumbnail_new (const gchar *uri, guint width, guint height, gint64 _time);
 gint64 gdata_media_thumbnail_parse_time (const gchar *time_string);
-gchar *gdata_media_thumbnail_build_time (gint64 time);
+gchar *gdata_media_thumbnail_build_time (gint64 _time);
 void gdata_media_thumbnail_free (GDataMediaThumbnail *self);
 
 G_END_DECLS
diff --git a/gdata/gdata-service.c b/gdata/gdata-service.c
index 29427e4..71407a7 100644
--- a/gdata/gdata-service.c
+++ b/gdata/gdata-service.c
@@ -500,7 +500,7 @@ authenticate (GDataService *self, const gchar *username, const gchar *password,
 
 		if (strncmp (error_start, "CaptchaRequired", error_end - error_start) == 0) {
 			const gchar *captcha_base_uri = "http://www.google.com/accounts/";;
-			gchar *captcha_start, *captcha_end, *captcha_uri, *captcha_answer;
+			gchar *captcha_start, *captcha_end, *captcha_uri, *new_captcha_answer;
 			guint captcha_base_uri_length;
 
 			/* CAPTCHA required to log in */
@@ -521,10 +521,10 @@ authenticate (GDataService *self, const gchar *username, const gchar *password,
 			captcha_uri[captcha_base_uri_length + (captcha_end - captcha_start)] = '\0';
 
 			/* Request a CAPTCHA answer from the application */
-			g_signal_emit (self, service_signals[SIGNAL_CAPTCHA_CHALLENGE], 0, captcha_uri, &captcha_answer);
+			g_signal_emit (self, service_signals[SIGNAL_CAPTCHA_CHALLENGE], 0, captcha_uri, &new_captcha_answer);
 			g_free (captcha_uri);
 
-			if (captcha_answer == NULL || *captcha_answer == '\0') {
+			if (new_captcha_answer == NULL || *new_captcha_answer == '\0') {
 				g_set_error_literal (error, GDATA_AUTHENTICATION_ERROR, GDATA_AUTHENTICATION_ERROR_CAPTCHA_REQUIRED,
 						     _("A CAPTCHA must be filled out to log in."));
 				goto login_error;
@@ -543,7 +543,7 @@ authenticate (GDataService *self, const gchar *username, const gchar *password,
 			/* Save the CAPTCHA token and answer, and attempt to log in with them */
 			g_object_unref (message);
 
-			return authenticate (self, username, password, g_strndup (captcha_start, captcha_end - captcha_start), captcha_answer,
+			return authenticate (self, username, password, g_strndup (captcha_start, captcha_end - captcha_start), new_captcha_answer,
 					     cancellable, error);
 		} else if (strncmp (error_start, "Unknown", error_end - error_start) == 0) {
 			goto protocol_error; /* TODO: is this really a protocol error? It's an error with *our* code */
diff --git a/gdata/services/calendar/gdata-calendar-calendar.c b/gdata/services/calendar/gdata-calendar-calendar.c
index b678e6b..4520f98 100644
--- a/gdata/services/calendar/gdata-calendar-calendar.c
+++ b/gdata/services/calendar/gdata-calendar-calendar.c
@@ -223,11 +223,11 @@ parse_xml (GDataEntry *entry, xmlDoc *doc, xmlNode *node, GError **error)
 
 	if (xmlStrcmp (node->name, (xmlChar*) "timezone") == 0) {
 		/* gCal:timezone */
-		xmlChar *timezone = xmlGetProp (node, (xmlChar*) "value");
-		if (timezone == NULL)
+		xmlChar *_timezone = xmlGetProp (node, (xmlChar*) "value");
+		if (_timezone == NULL)
 			return gdata_parser_error_required_property_missing ("gCal:timezone", "value", error);
-		gdata_calendar_calendar_set_timezone (self, (gchar*) timezone);
-		xmlFree (timezone);
+		gdata_calendar_calendar_set_timezone (self, (gchar*) _timezone);
+		xmlFree (_timezone);
 	} else if (xmlStrcmp (node->name, (xmlChar*) "timesCleaned") == 0) {
 		/* gCal:timesCleaned */
 		xmlChar *times_cleaned = xmlGetProp (node, (xmlChar*) "value");
@@ -325,8 +325,8 @@ get_namespaces (GDataEntry *entry, GHashTable *namespaces)
 	/* Chain up to the parent class */
 	GDATA_ENTRY_CLASS (gdata_calendar_calendar_parent_class)->get_namespaces (entry, namespaces);
 
-	g_hash_table_insert (namespaces, "gCal", "http://schemas.google.com/gCal/2005";);
-	g_hash_table_insert (namespaces, "app", "http://www.w3.org/2007/app";);
+	g_hash_table_insert (namespaces, (gchar*) "gCal", (gchar*) "http://schemas.google.com/gCal/2005";);
+	g_hash_table_insert (namespaces, (gchar*) "app", (gchar*) "http://www.w3.org/2007/app";);
 }
 
 const gchar *
@@ -336,13 +336,14 @@ gdata_calendar_calendar_get_timezone (GDataCalendarCalendar *self)
 	return self->priv->timezone;
 }
 
+/* Blame "timezone" in /usr/include/time.h:291 for the weird parameter naming */
 void
-gdata_calendar_calendar_set_timezone (GDataCalendarCalendar *self, const gchar *timezone)
+gdata_calendar_calendar_set_timezone (GDataCalendarCalendar *self, const gchar *_timezone)
 {
 	g_return_if_fail (GDATA_IS_CALENDAR_CALENDAR (self));
 
 	g_free (self->priv->timezone);
-	self->priv->timezone = g_strdup (timezone);
+	self->priv->timezone = g_strdup (_timezone);
 	g_object_notify (G_OBJECT (self), "timezone");
 }
 
diff --git a/gdata/services/calendar/gdata-calendar-calendar.h b/gdata/services/calendar/gdata-calendar-calendar.h
index fd4638d..7fb9b2a 100644
--- a/gdata/services/calendar/gdata-calendar-calendar.h
+++ b/gdata/services/calendar/gdata-calendar-calendar.h
@@ -53,7 +53,7 @@ GDataCalendarCalendar *gdata_calendar_calendar_new (const gchar *id);
 GDataCalendarCalendar *gdata_calendar_calendar_new_from_xml (const gchar *xml, gint length, GError **error);
 
 const gchar *gdata_calendar_calendar_get_timezone (GDataCalendarCalendar *self);
-void gdata_calendar_calendar_set_timezone (GDataCalendarCalendar *self, const gchar *timezone);
+void gdata_calendar_calendar_set_timezone (GDataCalendarCalendar *self, const gchar *_timezone);
 guint gdata_calendar_calendar_get_times_cleaned (GDataCalendarCalendar *self);
 void gdata_calendar_calendar_set_times_cleaned (GDataCalendarCalendar *self, guint times_cleaned);
 gboolean gdata_calendar_calendar_get_hidden (GDataCalendarCalendar *self);
diff --git a/gdata/services/calendar/gdata-calendar-event.c b/gdata/services/calendar/gdata-calendar-event.c
index 0d78a00..a417f46 100644
--- a/gdata/services/calendar/gdata-calendar-event.c
+++ b/gdata/services/calendar/gdata-calendar-event.c
@@ -608,9 +608,9 @@ get_namespaces (GDataEntry *entry, GHashTable *namespaces)
 	/* Chain up to the parent class */
 	GDATA_ENTRY_CLASS (gdata_calendar_event_parent_class)->get_namespaces (entry, namespaces);
 
-	g_hash_table_insert (namespaces, "gd", "http://schemas.google.com/g/2005";);
-	g_hash_table_insert (namespaces, "gCal", "http://schemas.google.com/gCal/2005";);
-	g_hash_table_insert (namespaces, "app", "http://www.w3.org/2007/app";);
+	g_hash_table_insert (namespaces, (gchar*) "gd", (gchar*) "http://schemas.google.com/g/2005";);
+	g_hash_table_insert (namespaces, (gchar*) "gCal", (gchar*) "http://schemas.google.com/gCal/2005";);
+	g_hash_table_insert (namespaces, (gchar*) "app", (gchar*) "http://www.w3.org/2007/app";);
 }
 
 void
diff --git a/gdata/services/youtube/gdata-youtube-video.c b/gdata/services/youtube/gdata-youtube-video.c
index 0287807..fb6222e 100644
--- a/gdata/services/youtube/gdata-youtube-video.c
+++ b/gdata/services/youtube/gdata-youtube-video.c
@@ -737,7 +737,7 @@ parse_media_group_xml_node (GDataYouTubeVideo *self, xmlDoc *doc, xmlNode *node,
 		g_object_notify (G_OBJECT (self), "restriction");
 	} else if (xmlStrcmp (node->name, (xmlChar*) "thumbnail") == 0) {
 		/* media:thumbnail */
-		xmlChar *uri, *width, *height, *time;
+		xmlChar *uri, *width, *height, *_time;
 		guint width_uint, height_uint;
 		gint time_int;
 		GDataMediaThumbnail *thumbnail;
@@ -756,19 +756,19 @@ parse_media_group_xml_node (GDataYouTubeVideo *self, xmlDoc *doc, xmlNode *node,
 		xmlFree (height);
 
 		/* Get and parse the time */
-		time = xmlGetProp (node, (xmlChar*) "time");
-		if (time == NULL) {
+		_time = xmlGetProp (node, (xmlChar*) "time");
+		if (_time == NULL) {
 			time_int = -1;
 		} else {
-			time_int = gdata_media_thumbnail_parse_time ((gchar*) time);
+			time_int = gdata_media_thumbnail_parse_time ((gchar*) _time);
 			if (time_int == -1) {
 				g_set_error (error, GDATA_SERVICE_ERROR, GDATA_SERVICE_ERROR_PROTOCOL_ERROR,
 					     _("The @time property (\"%s\") of a <media:thumbnail> could not be parsed."),
-					     (gchar*) time);
-				xmlFree (time);
+					     (gchar*) _time);
+				xmlFree (_time);
 				return FALSE;
 			}
-			xmlFree (time);
+			xmlFree (_time);
 		}
 
 		uri = xmlGetProp (node, (xmlChar*) "url");
@@ -1065,14 +1065,14 @@ get_xml (GDataEntry *entry, GString *xml_string)
 
 	for (thumbnails = priv->thumbnails; thumbnails != NULL; thumbnails = thumbnails->next) {
 		GDataMediaThumbnail *thumbnail = (GDataMediaThumbnail*) thumbnails->data;
-		gchar *uri, *time;
+		gchar *uri, *_time;
 
 		uri = g_markup_escape_text (thumbnail->uri, -1);
-		time = gdata_media_thumbnail_build_time (thumbnail->time);
+		_time = gdata_media_thumbnail_build_time (thumbnail->time);
 		g_string_append_printf (xml_string, "<media:thumbnail url='%s' height='%u' width='%u' time='%s'/>",
-					uri, thumbnail->height, thumbnail->width, time);
+					uri, thumbnail->height, thumbnail->width, _time);
 		g_free (uri);
-		g_free (time);
+		g_free (_time);
 	}
 
 	if (priv->is_private == TRUE)
@@ -1105,8 +1105,8 @@ get_namespaces (GDataEntry *entry, GHashTable *namespaces)
 	/* Chain up to the parent class */
 	GDATA_ENTRY_CLASS (gdata_youtube_video_parent_class)->get_namespaces (entry, namespaces);
 
-	g_hash_table_insert (namespaces, "media", "http://search.yahoo.com/mrss/";);
-	g_hash_table_insert (namespaces, "yt", "http://gdata.youtube.com/schemas/2007";);
+	g_hash_table_insert (namespaces, (gchar*) "media", (gchar*) "http://search.yahoo.com/mrss/";);
+	g_hash_table_insert (namespaces, (gchar*) "yt", (gchar*) "http://gdata.youtube.com/schemas/2007";);
 }
 
 /**



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