Util/StringUtil: add StringStartsWith()
Replaces GLib's g_str_has_prefix().
This commit is contained in:
@@ -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;
|
||||
|
@@ -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();
|
||||
|
@@ -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;
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user