output/ao: use std::string_view
This commit is contained in:
parent
6440df60aa
commit
c953ed48b7
@ -25,6 +25,8 @@
|
|||||||
#include "util/RuntimeError.hxx"
|
#include "util/RuntimeError.hxx"
|
||||||
#include "util/Domain.hxx"
|
#include "util/Domain.hxx"
|
||||||
#include "util/StringAPI.hxx"
|
#include "util/StringAPI.hxx"
|
||||||
|
#include "util/StringSplit.hxx"
|
||||||
|
#include "util/StringStrip.hxx"
|
||||||
#include "Log.hxx"
|
#include "Log.hxx"
|
||||||
|
|
||||||
#include <ao/ao.h>
|
#include <ao/ao.h>
|
||||||
@ -127,16 +129,14 @@ AoOutput::AoOutput(const ConfigBlock &block)
|
|||||||
|
|
||||||
value = block.GetBlockValue("options", nullptr);
|
value = block.GetBlockValue("options", nullptr);
|
||||||
if (value != nullptr) {
|
if (value != nullptr) {
|
||||||
for (StringView i : IterableSplitString(value, ';')) {
|
for (const std::string_view i : IterableSplitString(value, ';')) {
|
||||||
i.Strip();
|
const auto [n, v] = Split(Strip(i), '=');
|
||||||
|
if (n.empty() || v.data() == nullptr)
|
||||||
auto s = i.Split('=');
|
|
||||||
if (s.first.empty() || s.second.IsNull())
|
|
||||||
throw FormatRuntimeError("problems parsing option \"%.*s\"",
|
throw FormatRuntimeError("problems parsing option \"%.*s\"",
|
||||||
int(i.size), i.data);
|
int(i.size()), i.data());
|
||||||
|
|
||||||
const std::string n(s.first), v(s.second);
|
ao_append_option(&options, std::string{n}.c_str(),
|
||||||
ao_append_option(&options, n.c_str(), v.c_str());
|
std::string{v}.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user