db/upnp/ContentDirectoryService: use fmt::format_int

This commit is contained in:
Max Kellermann 2023-03-06 16:43:13 +01:00
parent 35b6d65f27
commit 8f41e05a39

View File

@ -12,7 +12,8 @@
#include "Directory.hxx" #include "Directory.hxx"
#include "util/NumberParser.hxx" #include "util/NumberParser.hxx"
#include "util/ScopeExit.hxx" #include "util/ScopeExit.hxx"
#include "util/StringFormat.hxx"
#include <fmt/format.h>
#include <algorithm> #include <algorithm>
@ -44,9 +45,9 @@ ContentDirectoryService::readDirSlice(UpnpClient_Handle hdl,
"Filter", "*", "Filter", "*",
"SortCriteria", "", "SortCriteria", "",
"StartingIndex", "StartingIndex",
StringFormat<32>("%u", offset).c_str(), fmt::format_int{offset}.c_str(),
"RequestedCount", "RequestedCount",
StringFormat<32>("%u", count).c_str()); fmt::format_int{count}.c_str());
if (request == nullptr) if (request == nullptr)
throw std::runtime_error("UpnpMakeAction() failed"); throw std::runtime_error("UpnpMakeAction() failed");
@ -76,8 +77,9 @@ ContentDirectoryService::readDirSlice(UpnpClient_Handle hdl,
{"BrowseFlag", "BrowseDirectChildren"}, {"BrowseFlag", "BrowseDirectChildren"},
{"Filter", "*"}, {"Filter", "*"},
{"SortCriteria", ""}, {"SortCriteria", ""},
{"StartingIndex", StringFormat<32>("%u", offset).c_str()}, {"StartingIndex", fmt::format_int{offset}.c_str(),
{"RequestedCount", StringFormat<32>("%u", count).c_str()}}; {"RequestedCount", fmt::format_int{count).c_str()},
};
std::vector<std::pair<std::string, std::string>> responseData; std::vector<std::pair<std::string, std::string>> responseData;
int errcode; int errcode;
std::string errdesc; std::string errdesc;
@ -134,7 +136,7 @@ ContentDirectoryService::search(UpnpClient_Handle hdl,
"Filter", "*", "Filter", "*",
"SortCriteria", "", "SortCriteria", "",
"StartingIndex", "StartingIndex",
StringFormat<32>("%u", offset).c_str(), fmt::format_int{offset}.c_str(),
"RequestedCount", "0")); // Setting a value here gets twonky into fits "RequestedCount", "0")); // Setting a value here gets twonky into fits
if (!request) if (!request)
throw std::runtime_error("UpnpMakeAction() failed"); throw std::runtime_error("UpnpMakeAction() failed");
@ -170,7 +172,7 @@ ContentDirectoryService::search(UpnpClient_Handle hdl,
{"SearchCriteria", ss}, {"SearchCriteria", ss},
{"Filter", "*"}, {"Filter", "*"},
{"SortCriteria", ""}, {"SortCriteria", ""},
{"StartingIndex", StringFormat<32>("%u", offset).c_str()}, {"StartingIndex", fmt::format_int{offset}.c_str()},
{"RequestedCount", "0"}}; {"RequestedCount", "0"}};
std::vector<std::pair<std::string, std::string>> responseData; std::vector<std::pair<std::string, std::string>> responseData;
int errcode; int errcode;