output/ao: use IterableSplitString() instead of SplitString()

This commit is contained in:
Max Kellermann 2020-04-03 16:46:48 +02:00
parent 747436b17e
commit ae4fd576bf
1 changed files with 9 additions and 7 deletions

View File

@ -22,7 +22,7 @@
#include "thread/SafeSingleton.hxx"
#include "system/Error.hxx"
#include "util/DivideString.hxx"
#include "util/SplitString.hxx"
#include "util/IterableSplitString.hxx"
#include "util/RuntimeError.hxx"
#include "util/Domain.hxx"
#include "util/StringAPI.hxx"
@ -122,14 +122,16 @@ AoOutput::AoOutput(const ConfigBlock &block)
value = block.GetBlockValue("options", nullptr);
if (value != nullptr) {
for (const auto &i : SplitString(value, ';')) {
const DivideString ss(i.c_str(), '=', true);
for (StringView i : IterableSplitString(value, ';')) {
i.Strip();
if (!ss.IsDefined())
throw FormatRuntimeError("problems parsing options \"%s\"",
i.c_str());
auto s = i.Split('=');
if (s.first.empty() || s.second.IsNull())
throw FormatRuntimeError("problems parsing option \"%.*s\"",
int(i.size), i.data);
ao_append_option(&options, ss.GetFirst(), ss.GetSecond());
const std::string n(s.first), v(s.second);
ao_append_option(&options, n.c_str(), v.c_str());
}
}
}