decoder/wavpack: use AllocatedString for concatenation
This commit is contained in:
parent
a49b49cba7
commit
e1c16d78e4
@ -24,7 +24,7 @@
|
|||||||
#include "pcm/CheckAudioFormat.hxx"
|
#include "pcm/CheckAudioFormat.hxx"
|
||||||
#include "tag/Handler.hxx"
|
#include "tag/Handler.hxx"
|
||||||
#include "fs/Path.hxx"
|
#include "fs/Path.hxx"
|
||||||
#include "util/Alloc.hxx"
|
#include "util/AllocatedString.hxx"
|
||||||
#include "util/Math.hxx"
|
#include "util/Math.hxx"
|
||||||
#include "util/ScopeExit.hxx"
|
#include "util/ScopeExit.hxx"
|
||||||
#include "util/RuntimeError.hxx"
|
#include "util/RuntimeError.hxx"
|
||||||
@ -37,6 +37,8 @@
|
|||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
using std::string_view_literals::operator""sv;
|
||||||
|
|
||||||
#define ERRORLEN 80
|
#define ERRORLEN 80
|
||||||
|
|
||||||
#ifdef OPEN_DSD_AS_PCM
|
#ifdef OPEN_DSD_AS_PCM
|
||||||
@ -506,22 +508,12 @@ static WavpackStreamReader mpd_is_reader = {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static InputStreamPtr
|
static InputStreamPtr
|
||||||
wavpack_open_wvc(DecoderClient &client, const char *uri)
|
wavpack_open_wvc(DecoderClient &client, std::string_view uri)
|
||||||
{
|
{
|
||||||
/*
|
const AllocatedString wvc_url{uri, "c"sv};
|
||||||
* As we use dc->utf8url, this function will be bad for
|
|
||||||
* single files. utf8url is not absolute file path :/
|
|
||||||
*/
|
|
||||||
if (uri == nullptr)
|
|
||||||
return nullptr;
|
|
||||||
|
|
||||||
char *wvc_url = xstrcatdup(uri, "c");
|
|
||||||
AtScopeExit(wvc_url) {
|
|
||||||
free(wvc_url);
|
|
||||||
};
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return client.OpenUri(wvc_url);
|
return client.OpenUri(wvc_url.c_str());
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user