Mercurial > audlegacy
view libaudacious/urldecode.c @ 2142:959722e6e277 trunk
[svn] - clear and free a playlist passed to playlist_remove_playlist
author | giacomo |
---|---|
date | Sat, 16 Dec 2006 05:41:27 -0800 |
parents | f18a5b617c34 |
children | f363009b7410 |
line wrap: on
line source
/* BMP - Cross-platform multimedia player * Copyright (C) 2003-2004 BMP development team. * * Based on XMMS: * Copyright (C) 1998-2003 XMMS development team. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; under version 2 of the License. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "urldecode.h" #include <glib.h> #include <stdio.h> #include <string.h> #include "util.h" gchar * xmms_urldecode_plain(const gchar * encoded_path) { const gchar *cur, *ext; gchar *path, *tmp; gint realchar; if (!encoded_path) return NULL; cur = encoded_path; 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 on * drag and drop. */ realchar = '%'; cur -= 2; } tmp[strlen(tmp)] = realchar; } path = g_strconcat(tmp, cur, NULL); g_free(tmp); return path; }