summaryrefslogtreecommitdiff
path: root/src/storage/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/storage/plugins')
-rw-r--r--src/storage/plugins/CurlStorage.cxx5
-rw-r--r--src/storage/plugins/NfsStorage.cxx6
-rw-r--r--src/storage/plugins/SmbclientStorage.cxx3
3 files changed, 8 insertions, 6 deletions
diff --git a/src/storage/plugins/CurlStorage.cxx b/src/storage/plugins/CurlStorage.cxx
index c077b8bb2..8e99f5c56 100644
--- a/src/storage/plugins/CurlStorage.cxx
+++ b/src/storage/plugins/CurlStorage.cxx
@@ -33,6 +33,7 @@
#include "event/DeferredMonitor.hxx"
#include "thread/Mutex.hxx"
#include "thread/Cond.hxx"
+#include "util/ASCII.hxx"
#include "util/RuntimeError.hxx"
#include "util/StringCompare.hxx"
#include "util/StringFormat.hxx"
@@ -590,8 +591,8 @@ CurlStorage::OpenDirectory(const char *uri_utf8)
static Storage *
CreateCurlStorageURI(EventLoop &event_loop, const char *uri)
{
- if (strncmp(uri, "http://", 7) != 0 &&
- strncmp(uri, "https://", 8) != 0)
+ if (!StringStartsWithCaseASCII(uri, "http://") &&
+ !StringStartsWithCaseASCII(uri, "https://"))
return nullptr;
return new CurlStorage(event_loop, uri);
diff --git a/src/storage/plugins/NfsStorage.cxx b/src/storage/plugins/NfsStorage.cxx
index 6ef6266aa..b2eec24ff 100644
--- a/src/storage/plugins/NfsStorage.cxx
+++ b/src/storage/plugins/NfsStorage.cxx
@@ -35,6 +35,7 @@
#include "event/Call.hxx"
#include "event/DeferredMonitor.hxx"
#include "event/TimeoutMonitor.hxx"
+#include "util/ASCII.hxx"
#include "util/StringCompare.hxx"
extern "C" {
@@ -401,11 +402,10 @@ NfsStorage::OpenDirectory(const char *uri_utf8)
static Storage *
CreateNfsStorageURI(EventLoop &event_loop, const char *base)
{
- if (strncmp(base, "nfs://", 6) != 0)
+ const char *p = StringAfterPrefixCaseASCII(base, "nfs://");
+ if (p == nullptr)
return nullptr;
- const char *p = base + 6;
-
const char *mount = strchr(p, '/');
if (mount == nullptr)
throw std::runtime_error("Malformed nfs:// URI");
diff --git a/src/storage/plugins/SmbclientStorage.cxx b/src/storage/plugins/SmbclientStorage.cxx
index 67d8c3bca..8c279f300 100644
--- a/src/storage/plugins/SmbclientStorage.cxx
+++ b/src/storage/plugins/SmbclientStorage.cxx
@@ -27,6 +27,7 @@
#include "fs/Traits.hxx"
#include "thread/Mutex.hxx"
#include "system/Error.hxx"
+#include "util/ASCII.hxx"
#include "util/StringCompare.hxx"
#include "util/ScopeExit.hxx"
@@ -182,7 +183,7 @@ SmbclientDirectoryReader::GetInfo(gcc_unused bool follow)
static Storage *
CreateSmbclientStorageURI(gcc_unused EventLoop &event_loop, const char *base)
{
- if (strncmp(base, "smb://", 6) != 0)
+ if (!StringStartsWithCaseASCII(base, "smb://"))
return nullptr;
SmbclientInit();