[PATCH] Problems when creating URLs with limits



While taking a look at a problem with limits, I saw this: setting the
page limit to G_MAXUINT causes that we get a -1 when printing it to a
URL with "%d", which is logic and it should be changed to "%u". I did it
for jamendo and shoutcast.

But when taking a look to all sources about this, I saw that vimeo and
flickr plugins use a gint, when we always deal with guint. Though
nothing happens as they clamp that value to [0..100], I think it is a
semantic problem that should be solved. Talking to Juan thru IRC, he
also thinks that what's not correct is that they don't use the automatic
threshold, but I didn't take a deeper look about this.

Do you think this should be fixed? Which way?

Br.

-- 
Xabier Rodríguez Calvar
Enxeñeiro en Informática
IGALIA http://www.igalia.com
From 8536fbdcad14431e108af515ccdacc5222e21fcb Mon Sep 17 00:00:00 2001
From: Xabier Rodriguez Calvar <xrcalvar igalia com>
Date: Thu, 10 Jun 2010 17:56:55 +0100
Subject: [PATCH 1/2] [shoutcast] Solved problem with the unsigned page limits

---
 src/shoutcast/grl-shoutcast.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/shoutcast/grl-shoutcast.c b/src/shoutcast/grl-shoutcast.c
index a33276e..d5a6648 100644
--- a/src/shoutcast/grl-shoutcast.c
+++ b/src/shoutcast/grl-shoutcast.c
@@ -48,8 +48,8 @@
 #define SHOUTCAST_BASE_ENTRY "http://yp.shoutcast.com";
 
 #define SHOUTCAST_GET_GENRES    SHOUTCAST_BASE_ENTRY "/sbin/newxml.phtml"
-#define SHOUTCAST_GET_RADIOS    SHOUTCAST_GET_GENRES "?genre=%s&limit=%d"
-#define SHOUTCAST_SEARCH_RADIOS SHOUTCAST_GET_GENRES "?search=%s&limit=%d"
+#define SHOUTCAST_GET_RADIOS    SHOUTCAST_GET_GENRES "?genre=%s&limit=%u"
+#define SHOUTCAST_SEARCH_RADIOS SHOUTCAST_GET_GENRES "?search=%s&limit=%u"
 #define SHOUTCAST_TUNE          SHOUTCAST_BASE_ENTRY "/sbin/tunein-station.pls?id=%s"
 
 /* --- Plugin information --- */
-- 
1.7.1

From 4644a0b0853991a60fdf6088c040f3520422063d Mon Sep 17 00:00:00 2001
From: Xabier Rodriguez Calvar <xrcalvar igalia com>
Date: Thu, 10 Jun 2010 17:57:14 +0100
Subject: [PATCH 2/2] [jamendo] Solved problem with the unsigned page limits

---
 src/jamendo/grl-jamendo.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/jamendo/grl-jamendo.c b/src/jamendo/grl-jamendo.c
index 5da2553..1b2fb3f 100644
--- a/src/jamendo/grl-jamendo.c
+++ b/src/jamendo/grl-jamendo.c
@@ -55,7 +55,7 @@
 
 #define JAMENDO_BASE_ENTRY "http://api.jamendo.com/get2";
 #define JAMENDO_FORMAT     "xml"
-#define JAMENDO_RANGE      "n=%d&pn=%d"
+#define JAMENDO_RANGE      "n=%u&pn=%u"
 
 #define JAMENDO_ARTIST_ENTRY JAMENDO_BASE_ENTRY "/%s/" JAMENDO_ARTIST "/" JAMENDO_FORMAT
 
-- 
1.7.1

Attachment: signature.asc
Description: Esta =?ISO-8859-1?Q?=E9?= unha parte de mensaxe asinada dixitalmente



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