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
1 changed files with 9 additions and 7 deletions

View File

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