Mercurial > audlegacy
changeset 2074:c725daec3849 trunk
[svn] - move xmms_urldecode_path() back into main binary
author | nenolod |
---|---|
date | Sat, 09 Dec 2006 02:01:53 -0800 |
parents | 25308f10b50f |
children | 2b93747d7b04 |
files | ChangeLog audacious/util.c audacious/util.h libaudacious/urldecode.c |
diffstat | 4 files changed, 60 insertions(+), 44 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Sat Dec 09 01:55:27 2006 -0800 +++ b/ChangeLog Sat Dec 09 02:01:53 2006 -0800 @@ -1,3 +1,15 @@ +2006-12-09 09:55:27 +0000 William Pitcock <nenolod@nenolod.net> + revision [3149] + - fix urldecode dependencies + + trunk/audacious/mainwin.c | 2 +- + trunk/audacious/playback.c | 2 +- + trunk/audacious/playlist.c | 2 +- + trunk/audacious/prefswin.c | 2 +- + trunk/audacious/ui_fileinfo.c | 2 +- + 5 files changed, 5 insertions(+), 5 deletions(-) + + 2006-12-09 09:49:39 +0000 Kiyoshi Aman <kiyoshi.aman@gmail.com> revision [3147] Shut up, mkdir.
--- a/audacious/util.c Sat Dec 09 01:55:27 2006 -0800 +++ b/audacious/util.c Sat Dec 09 02:01:53 2006 -0800 @@ -1926,3 +1926,48 @@ } return dblimg; } + +/* URL-decode a file: URL path, return NULL if it's not what we expect */ +gchar * +xmms_urldecode_path(const gchar * encoded_path) +{ + const gchar *cur, *ext; + gchar *path, *tmp; + gint realchar; + + if (!encoded_path) + return NULL; + + if (!str_has_prefix_nocase(encoded_path, "file:")) + return NULL; + + cur = encoded_path + 5; + + if (str_has_prefix_nocase(cur, "//localhost")) + cur += 11; + + if (*cur == '/') + while (cur[1] == '/') + cur++; + + tmp = g_malloc0(strlen(cur) + 1); + + while ((ext = strchr(cur, '%')) != NULL) { + strncat(tmp, cur, ext - cur); + ext++; + cur = ext + 2; + if (!sscanf(ext, "%2x", &realchar)) { + /* Assume it is a literal '%'. Several file + * managers send unencoded file: urls on drag + * and drop. */ + realchar = '%'; + cur -= 2; + } + tmp[strlen(tmp)] = realchar; + } + + path = g_strconcat(tmp, cur, NULL); + g_free(tmp); + return path; +} +
--- a/audacious/util.h Sat Dec 09 01:55:27 2006 -0800 +++ b/audacious/util.h Sat Dec 09 02:01:53 2006 -0800 @@ -148,6 +148,9 @@ GdkImage *create_dblsize_image(GdkImage * img); +gchar *xmms_urldecode_path(const gchar * encoded_path); + + G_END_DECLS #endif
--- a/libaudacious/urldecode.c Sat Dec 09 01:55:27 2006 -0800 +++ b/libaudacious/urldecode.c Sat Dec 09 02:01:53 2006 -0800 @@ -27,50 +27,6 @@ #include "util.h" -/* URL-decode a file: URL path, return NULL if it's not what we expect */ -gchar * -xmms_urldecode_path(const gchar * encoded_path) -{ - const gchar *cur, *ext; - gchar *path, *tmp; - gint realchar; - - if (!encoded_path) - return NULL; - - if (!str_has_prefix_nocase(encoded_path, "file:")) - return NULL; - - cur = encoded_path + 5; - - if (str_has_prefix_nocase(cur, "//localhost")) - cur += 11; - - if (*cur == '/') - while (cur[1] == '/') - cur++; - - tmp = g_malloc0(strlen(cur) + 1); - - while ((ext = strchr(cur, '%')) != NULL) { - strncat(tmp, cur, ext - cur); - ext++; - cur = ext + 2; - if (!sscanf(ext, "%2x", &realchar)) { - /* Assume it is a literal '%'. Several file - * managers send unencoded file: urls on drag - * and drop. */ - realchar = '%'; - cur -= 2; - } - tmp[strlen(tmp)] = realchar; - } - - path = g_strconcat(tmp, cur, NULL); - g_free(tmp); - return path; -} - gchar * xmms_urldecode_plain(const gchar * encoded_path) {