input/async: pass std::string_view to constructor
This commit is contained in:
parent
4800f1d8f2
commit
6d5dab38dd
@ -12,7 +12,7 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
AsyncInputStream::AsyncInputStream(EventLoop &event_loop, const char *_url,
|
||||
AsyncInputStream::AsyncInputStream(EventLoop &event_loop, std::string_view _url,
|
||||
Mutex &_mutex,
|
||||
size_t _buffer_size,
|
||||
size_t _resume_at) noexcept
|
||||
|
@ -1,8 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
// Copyright The Music Player Daemon Project
|
||||
|
||||
#ifndef MPD_ASYNC_INPUT_STREAM_HXX
|
||||
#define MPD_ASYNC_INPUT_STREAM_HXX
|
||||
#pragma once
|
||||
|
||||
#include "InputStream.hxx"
|
||||
#include "event/InjectEvent.hxx"
|
||||
@ -54,7 +53,7 @@ protected:
|
||||
std::exception_ptr postponed_exception;
|
||||
|
||||
public:
|
||||
AsyncInputStream(EventLoop &event_loop, const char *_url,
|
||||
AsyncInputStream(EventLoop &event_loop, std::string_view _url,
|
||||
Mutex &_mutex,
|
||||
size_t _buffer_size,
|
||||
size_t _resume_at) noexcept;
|
||||
@ -155,5 +154,3 @@ private:
|
||||
void DeferredResume() noexcept;
|
||||
void DeferredSeek() noexcept;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -66,7 +66,7 @@ class CurlInputStream final : public AsyncInputStream, CurlResponseHandler {
|
||||
|
||||
public:
|
||||
template<typename I>
|
||||
CurlInputStream(EventLoop &event_loop, const char *_url,
|
||||
CurlInputStream(EventLoop &event_loop, std::string_view _url,
|
||||
const Curl::Headers &headers,
|
||||
I &&_icy,
|
||||
Mutex &_mutex);
|
||||
@ -76,7 +76,7 @@ public:
|
||||
CurlInputStream(const CurlInputStream &) = delete;
|
||||
CurlInputStream &operator=(const CurlInputStream &) = delete;
|
||||
|
||||
static InputStreamPtr Open(const char *url,
|
||||
static InputStreamPtr Open(std::string_view url,
|
||||
const Curl::Headers &headers,
|
||||
Mutex &mutex);
|
||||
|
||||
@ -435,7 +435,7 @@ input_curl_finish() noexcept
|
||||
|
||||
template<typename I>
|
||||
inline
|
||||
CurlInputStream::CurlInputStream(EventLoop &event_loop, const char *_url,
|
||||
CurlInputStream::CurlInputStream(EventLoop &event_loop, std::string_view _url,
|
||||
const Curl::Headers &headers,
|
||||
I &&_icy,
|
||||
Mutex &_mutex)
|
||||
@ -568,7 +568,7 @@ CurlInputStream::DoSeek(offset_type new_offset)
|
||||
}
|
||||
|
||||
inline InputStreamPtr
|
||||
CurlInputStream::Open(const char *url,
|
||||
CurlInputStream::Open(std::string_view url,
|
||||
const Curl::Headers &headers,
|
||||
Mutex &mutex)
|
||||
{
|
||||
@ -588,7 +588,7 @@ CurlInputStream::Open(const char *url,
|
||||
}
|
||||
|
||||
InputStreamPtr
|
||||
OpenCurlInputStream(const char *uri, const Curl::Headers &headers,
|
||||
OpenCurlInputStream(std::string_view uri, const Curl::Headers &headers,
|
||||
Mutex &mutex)
|
||||
{
|
||||
return CurlInputStream::Open(uri, headers, mutex);
|
||||
|
@ -1,13 +1,14 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
// Copyright The Music Player Daemon Project
|
||||
|
||||
#ifndef MPD_INPUT_CURL_HXX
|
||||
#define MPD_INPUT_CURL_HXX
|
||||
#pragma once
|
||||
|
||||
#include "lib/curl/Headers.hxx"
|
||||
#include "input/Ptr.hxx"
|
||||
#include "thread/Mutex.hxx"
|
||||
|
||||
#include <string_view>
|
||||
|
||||
extern const struct InputPlugin input_plugin_curl;
|
||||
|
||||
/**
|
||||
@ -18,7 +19,5 @@ extern const struct InputPlugin input_plugin_curl;
|
||||
* Throws on error.
|
||||
*/
|
||||
InputStreamPtr
|
||||
OpenCurlInputStream(const char *uri, const Curl::Headers &headers,
|
||||
OpenCurlInputStream(std::string_view uri, const Curl::Headers &headers,
|
||||
Mutex &mutex);
|
||||
|
||||
#endif
|
||||
|
@ -25,7 +25,7 @@ class NfsInputStream final : NfsFileReader, public AsyncInputStream {
|
||||
bool reconnect_on_resume = false, reconnecting = false;
|
||||
|
||||
public:
|
||||
NfsInputStream(const char *_uri, Mutex &_mutex)
|
||||
NfsInputStream(std::string_view _uri, Mutex &_mutex) noexcept
|
||||
:AsyncInputStream(NfsFileReader::GetEventLoop(),
|
||||
_uri, _mutex,
|
||||
NFS_MAX_BUFFERED,
|
||||
|
@ -45,7 +45,7 @@ class UringInputStream final : public AsyncInputStream, Uring::ReadHandler {
|
||||
|
||||
public:
|
||||
UringInputStream(EventLoop &event_loop, Uring::Queue &_uring,
|
||||
const char *path,
|
||||
std::string_view path,
|
||||
UniqueFileDescriptor &&_fd,
|
||||
offset_type _size, Mutex &_mutex)
|
||||
:AsyncInputStream(event_loop,
|
||||
|
Loading…
Reference in New Issue
Block a user