diff options
author | Max Kellermann <max@duempel.org> | 2009-02-25 16:44:06 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-02-25 16:44:06 +0100 |
commit | 6823217697043e3ad2c1e67e4bba759c66d18a4f (patch) | |
tree | 2c947ebe3c0bdfab76ce67873eaa1570bc6a4674 /src | |
parent | 7957fefc91d2148fb2733f01ceaadf78d6844f1f (diff) | |
download | mpd-6823217697043e3ad2c1e67e4bba759c66d18a4f.tar.gz mpd-6823217697043e3ad2c1e67e4bba759c66d18a4f.tar.xz mpd-6823217697043e3ad2c1e67e4bba759c66d18a4f.zip |
ls: moved generic URI utilities to uri.c
"ls" is a bad name for a library which parses URIs. We'll move the
rest of the "ls" library later.
Diffstat (limited to 'src')
-rw-r--r-- | src/command.c | 1 | ||||
-rw-r--r-- | src/decoder/vorbis_plugin.c | 2 | ||||
-rw-r--r-- | src/decoder_thread.c | 2 | ||||
-rw-r--r-- | src/ls.c | 14 | ||||
-rw-r--r-- | src/ls.h | 8 | ||||
-rw-r--r-- | src/playlist_edit.c | 2 | ||||
-rw-r--r-- | src/playlist_save.c | 2 | ||||
-rw-r--r-- | src/queue_save.c | 2 | ||||
-rw-r--r-- | src/song.c | 2 | ||||
-rw-r--r-- | src/stored_playlist.c | 2 | ||||
-rw-r--r-- | src/update.c | 2 | ||||
-rw-r--r-- | src/uri.c | 37 | ||||
-rw-r--r-- | src/uri.h | 33 |
13 files changed, 80 insertions, 29 deletions
diff --git a/src/command.c b/src/command.c index 42ea87f77..12094bfbf 100644 --- a/src/command.c +++ b/src/command.c @@ -23,6 +23,7 @@ #include "playlist_save.h" #include "queue_print.h" #include "ls.h" +#include "uri.h" #include "directory.h" #include "directory_print.h" #include "database.h" diff --git a/src/decoder/vorbis_plugin.c b/src/decoder/vorbis_plugin.c index 982165783..5d1611c97 100644 --- a/src/decoder/vorbis_plugin.c +++ b/src/decoder/vorbis_plugin.c @@ -20,7 +20,7 @@ #include "_ogg_common.h" #include "config.h" -#include "ls.h" +#include "uri.h" #ifndef HAVE_TREMOR #include <vorbis/vorbisfile.h> diff --git a/src/decoder_thread.c b/src/decoder_thread.c index 5aa13efc0..b35683e6e 100644 --- a/src/decoder_thread.c +++ b/src/decoder_thread.c @@ -30,7 +30,7 @@ #include "mapper.h" #include "path.h" #include "log.h" -#include "ls.h" +#include "uri.h" #include <glib.h> @@ -17,6 +17,7 @@ */ #include "ls.h" +#include "uri.h" #include "client.h" #include "config.h" @@ -46,11 +47,6 @@ void print_supported_uri_schemes(struct client *client) } } -bool uri_has_scheme(const char *uri) -{ - return strstr(uri, "://") != NULL; -} - bool uri_supported_scheme(const char *uri) { const char **urlPrefixes = remoteUrlPrefixes; @@ -65,11 +61,3 @@ bool uri_supported_scheme(const char *uri) return false; } - -/* suffixes should be ascii only characters */ -const char *uri_get_suffix(const char *utf8file) -{ - const char *dot = strrchr(g_basename(utf8file), '.'); - - return dot != NULL ? dot + 1 : NULL; -} @@ -24,12 +24,6 @@ struct client; /** - * Checks whether the specified URI has a schema in the form - * "scheme://". - */ -bool uri_has_scheme(const char *uri); - -/** * Checks whether the scheme of the specified URI is supported by MPD. * It is not allowed to pass an URI without a scheme, check with * uri_has_scheme() first. @@ -42,6 +36,4 @@ bool uri_supported_scheme(const char *url); */ void print_supported_uri_schemes(struct client *client); -const char *uri_get_suffix(const char *utf8file); - #endif diff --git a/src/playlist_edit.c b/src/playlist_edit.c index 576cc8780..f4ebe3f7d 100644 --- a/src/playlist_edit.c +++ b/src/playlist_edit.c @@ -25,7 +25,7 @@ #include "playlist_internal.h" #include "player_control.h" #include "database.h" -#include "ls.h" +#include "uri.h" #include "song.h" #include "idle.h" diff --git a/src/playlist_save.c b/src/playlist_save.c index 65cc75e2f..e85305a93 100644 --- a/src/playlist_save.c +++ b/src/playlist_save.c @@ -21,7 +21,7 @@ #include "song.h" #include "mapper.h" #include "path.h" -#include "ls.h" +#include "uri.h" #include "database.h" #include "idle.h" diff --git a/src/queue_save.c b/src/queue_save.c index 73b59277d..b7aad6de2 100644 --- a/src/queue_save.c +++ b/src/queue_save.c @@ -19,7 +19,7 @@ #include "queue_save.h" #include "queue.h" #include "song.h" -#include "ls.h" +#include "uri.h" #include "database.h" #include <stdlib.h> diff --git a/src/song.c b/src/song.c index 6ddf597b2..0262d4b1a 100644 --- a/src/song.c +++ b/src/song.c @@ -17,7 +17,7 @@ */ #include "song.h" -#include "ls.h" +#include "uri.h" #include "directory.h" #include "mapper.h" #include "decoder_list.h" diff --git a/src/stored_playlist.c b/src/stored_playlist.c index ca2951b5e..c12821725 100644 --- a/src/stored_playlist.c +++ b/src/stored_playlist.c @@ -21,7 +21,7 @@ #include "song.h" #include "mapper.h" #include "path.h" -#include "ls.h" +#include "uri.h" #include "database.h" #include "idle.h" #include "conf.h" diff --git a/src/update.c b/src/update.c index 17059ffe0..66a41e49b 100644 --- a/src/update.c +++ b/src/update.c @@ -21,7 +21,7 @@ #include "database.h" #include "directory.h" #include "song.h" -#include "ls.h" +#include "uri.h" #include "mapper.h" #include "path.h" #include "decoder_list.h" diff --git a/src/uri.c b/src/uri.c new file mode 100644 index 000000000..6a6ddf82f --- /dev/null +++ b/src/uri.c @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2003-2009 The Music Player Daemon Project + * http://www.musicpd.org + * + * 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; either version 2 of the License, or + * (at your option) any later version. + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "uri.h" + +#include <glib.h> + +#include <string.h> + +bool uri_has_scheme(const char *uri) +{ + return strstr(uri, "://") != NULL; +} + +/* suffixes should be ascii only characters */ +const char * +uri_get_suffix(const char *uri) +{ + const char *dot = strrchr(g_basename(uri), '.'); + + return dot != NULL ? dot + 1 : NULL; +} diff --git a/src/uri.h b/src/uri.h new file mode 100644 index 000000000..6a20e94a4 --- /dev/null +++ b/src/uri.h @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2003-2009 The Music Player Daemon Project + * http://www.musicpd.org + * + * 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; either version 2 of the License, or + * (at your option) any later version. + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef MPD_URI_H +#define MPD_URI_H + +#include <stdbool.h> + +/** + * Checks whether the specified URI has a schema in the form + * "scheme://". + */ +bool uri_has_scheme(const char *uri); + +const char * +uri_get_suffix(const char *uri); + +#endif |