aboutsummaryrefslogtreecommitdiffstats
path: root/src/input
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-11-28 18:48:35 +0100
committerMax Kellermann <max@duempel.org>2013-11-28 18:48:35 +0100
commitaf4133e3c92c78cc19ff14b876be6afcab1db091 (patch)
treeda38387995bde630b20f81a717862ae21d19bb48 /src/input
parenta788b7e747bc21b9aadee45dd028fa6198af794e (diff)
downloadmpd-af4133e3c92c78cc19ff14b876be6afcab1db091.tar.gz
mpd-af4133e3c92c78cc19ff14b876be6afcab1db091.tar.xz
mpd-af4133e3c92c78cc19ff14b876be6afcab1db091.zip
Util/StringUtil: add StringStartsWith()
Replaces GLib's g_str_has_prefix().
Diffstat (limited to '')
-rw-r--r--src/input/CdioParanoiaInputPlugin.cxx3
-rw-r--r--src/input/DespotifyInputPlugin.cxx5
-rw-r--r--src/input/FfmpegInputPlugin.cxx15
-rw-r--r--src/input/MmsInputPlugin.cxx10
4 files changed, 16 insertions, 17 deletions
diff --git a/src/input/CdioParanoiaInputPlugin.cxx b/src/input/CdioParanoiaInputPlugin.cxx
index cc366bff5..de699ea3a 100644
--- a/src/input/CdioParanoiaInputPlugin.cxx
+++ b/src/input/CdioParanoiaInputPlugin.cxx
@@ -25,6 +25,7 @@
#include "CdioParanoiaInputPlugin.hxx"
#include "InputStream.hxx"
#include "InputPlugin.hxx"
+#include "util/StringUtil.hxx"
#include "util/Error.hxx"
#include "util/Domain.hxx"
#include "system/ByteOrder.hxx"
@@ -117,7 +118,7 @@ struct cdio_uri {
static bool
parse_cdio_uri(struct cdio_uri *dest, const char *src, Error &error)
{
- if (!g_str_has_prefix(src, "cdda://"))
+ if (!StringStartsWith(src, "cdda://"))
return false;
src += 7;
diff --git a/src/input/DespotifyInputPlugin.cxx b/src/input/DespotifyInputPlugin.cxx
index b08299516..9441ef327 100644
--- a/src/input/DespotifyInputPlugin.cxx
+++ b/src/input/DespotifyInputPlugin.cxx
@@ -23,14 +23,13 @@
#include "InputStream.hxx"
#include "InputPlugin.hxx"
#include "tag/Tag.hxx"
+#include "util/StringUtil.hxx"
#include "Log.hxx"
extern "C" {
#include <despotify.h>
}
-#include <glib.h>
-
#include <unistd.h>
#include <string.h>
#include <errno.h>
@@ -130,7 +129,7 @@ input_despotify_open(const char *url,
struct ds_link *ds_link;
struct ds_track *track;
- if (!g_str_has_prefix(url, "spt://"))
+ if (!StringStartsWith(url, "spt://"))
return nullptr;
session = mpd_despotify_get_session();
diff --git a/src/input/FfmpegInputPlugin.cxx b/src/input/FfmpegInputPlugin.cxx
index c6f4afb7f..7d041677b 100644
--- a/src/input/FfmpegInputPlugin.cxx
+++ b/src/input/FfmpegInputPlugin.cxx
@@ -24,6 +24,7 @@
#include "FfmpegInputPlugin.hxx"
#include "InputStream.hxx"
#include "InputPlugin.hxx"
+#include "util/StringUtil.hxx"
#include "util/Error.hxx"
#include "util/Domain.hxx"
@@ -32,8 +33,6 @@ extern "C" {
#include <libavformat/avformat.h>
}
-#include <glib.h>
-
struct FfmpegInputStream {
InputStream base;
@@ -90,12 +89,12 @@ input_ffmpeg_open(const char *uri,
Mutex &mutex, Cond &cond,
Error &error)
{
- if (!g_str_has_prefix(uri, "gopher://") &&
- !g_str_has_prefix(uri, "rtp://") &&
- !g_str_has_prefix(uri, "rtsp://") &&
- !g_str_has_prefix(uri, "rtmp://") &&
- !g_str_has_prefix(uri, "rtmpt://") &&
- !g_str_has_prefix(uri, "rtmps://"))
+ if (!StringStartsWith(uri, "gopher://") &&
+ !StringStartsWith(uri, "rtp://") &&
+ !StringStartsWith(uri, "rtsp://") &&
+ !StringStartsWith(uri, "rtmp://") &&
+ !StringStartsWith(uri, "rtmpt://") &&
+ !StringStartsWith(uri, "rtmps://"))
return nullptr;
AVIOContext *h;
diff --git a/src/input/MmsInputPlugin.cxx b/src/input/MmsInputPlugin.cxx
index df45f71e8..2c7f6d166 100644
--- a/src/input/MmsInputPlugin.cxx
+++ b/src/input/MmsInputPlugin.cxx
@@ -21,10 +21,10 @@
#include "MmsInputPlugin.hxx"
#include "InputStream.hxx"
#include "InputPlugin.hxx"
+#include "util/StringUtil.hxx"
#include "util/Error.hxx"
#include "util/Domain.hxx"
-#include <glib.h>
#include <libmms/mmsx.h>
struct MmsInputStream {
@@ -58,10 +58,10 @@ input_mms_open(const char *url,
Mutex &mutex, Cond &cond,
Error &error)
{
- if (!g_str_has_prefix(url, "mms://") &&
- !g_str_has_prefix(url, "mmsh://") &&
- !g_str_has_prefix(url, "mmst://") &&
- !g_str_has_prefix(url, "mmsu://"))
+ if (!StringStartsWith(url, "mms://") &&
+ !StringStartsWith(url, "mmsh://") &&
+ !StringStartsWith(url, "mmst://") &&
+ !StringStartsWith(url, "mmsu://"))
return nullptr;
const auto mms = mmsx_connect(nullptr, nullptr, url, 128 * 1024);