input/plugins/QobuzClient: pass std::string_view to QueryStringBuilder()
This commit is contained in:
parent
718ae433b2
commit
fed8f12863
@ -30,8 +30,9 @@ class QueryStringBuilder {
|
|||||||
bool first = true;
|
bool first = true;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QueryStringBuilder &operator()(std::string &dest, const char *name,
|
QueryStringBuilder &operator()(std::string &dest,
|
||||||
const char *value) noexcept {
|
std::string_view name,
|
||||||
|
std::string_view value) noexcept {
|
||||||
dest.push_back(first ? '?' : '&');
|
dest.push_back(first ? '?' : '&');
|
||||||
first = false;
|
first = false;
|
||||||
|
|
||||||
@ -175,7 +176,7 @@ QobuzClient::MakeUrl(const char *object, const char *method,
|
|||||||
|
|
||||||
QueryStringBuilder q;
|
QueryStringBuilder q;
|
||||||
for (const auto &[key, url] : query)
|
for (const auto &[key, url] : query)
|
||||||
q(uri, key.c_str(), url.c_str());
|
q(uri, key, url);
|
||||||
|
|
||||||
q(uri, "app_id", app_id);
|
q(uri, "app_id", app_id);
|
||||||
return uri;
|
return uri;
|
||||||
@ -196,7 +197,7 @@ QobuzClient::MakeSignedUrl(const char *object, const char *method,
|
|||||||
std::string concatenated_query(object);
|
std::string concatenated_query(object);
|
||||||
concatenated_query += method;
|
concatenated_query += method;
|
||||||
for (const auto &[key, url] : query) {
|
for (const auto &[key, url] : query) {
|
||||||
q(uri, key.c_str(), url.c_str());
|
q(uri, key, url);
|
||||||
|
|
||||||
concatenated_query += key;
|
concatenated_query += key;
|
||||||
concatenated_query += url;
|
concatenated_query += url;
|
||||||
@ -205,13 +206,13 @@ QobuzClient::MakeSignedUrl(const char *object, const char *method,
|
|||||||
q(uri, "app_id", app_id);
|
q(uri, "app_id", app_id);
|
||||||
|
|
||||||
const auto request_ts = std::to_string(time(nullptr));
|
const auto request_ts = std::to_string(time(nullptr));
|
||||||
q(uri, "request_ts", request_ts.c_str());
|
q(uri, "request_ts", request_ts);
|
||||||
concatenated_query += request_ts;
|
concatenated_query += request_ts;
|
||||||
|
|
||||||
concatenated_query += app_secret;
|
concatenated_query += app_secret;
|
||||||
|
|
||||||
const auto md5_hex = MD5Hex({concatenated_query.data(), concatenated_query.size()});
|
const auto md5_hex = MD5Hex({concatenated_query.data(), concatenated_query.size()});
|
||||||
q(uri, "request_sig", md5_hex);
|
q(uri, "request_sig", md5_hex.c_str());
|
||||||
|
|
||||||
return uri;
|
return uri;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user