mirror of
https://github.com/badaix/snapcast.git
synced 2025-07-21 10:27:39 +02:00
Fix config password parsing
This commit is contained in:
parent
11cdc979a6
commit
164b3abf40
4 changed files with 52 additions and 4 deletions
|
@ -140,7 +140,7 @@ std::string uriDecode(const std::string& src)
|
|||
if (int(src[i]) == 37)
|
||||
{
|
||||
unsigned int ii;
|
||||
sscanf(src.substr(i + 1, 2).c_str(), "%x", &ii);
|
||||
sscanf(src.substr(i + 1, 2).c_str(), "%x", &ii); // NOLINT
|
||||
ch = static_cast<char>(ii);
|
||||
ret += ch;
|
||||
i += 2;
|
||||
|
@ -170,6 +170,22 @@ void split_left(const std::string& s, char delim, std::string& left, std::string
|
|||
}
|
||||
|
||||
|
||||
void split_right(const std::string& s, char delim, std::string& left, std::string& right)
|
||||
{
|
||||
auto pos = s.rfind(delim);
|
||||
if (pos != std::string::npos)
|
||||
{
|
||||
left = s.substr(0, pos);
|
||||
right = s.substr(pos + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
left = s;
|
||||
right = "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::string split_left(const std::string& s, char delim, std::string& right)
|
||||
{
|
||||
std::string left;
|
||||
|
@ -178,6 +194,14 @@ std::string split_left(const std::string& s, char delim, std::string& right)
|
|||
}
|
||||
|
||||
|
||||
std::string split_right(const std::string& s, char delim, std::string& right)
|
||||
{
|
||||
std::string left;
|
||||
split_right(s, delim, left, right);
|
||||
return left;
|
||||
}
|
||||
|
||||
|
||||
|
||||
std::vector<std::string>& split(const std::string& s, char delim, std::vector<std::string>& elems)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue