From 8f41e05a39959a60e88b70357fab287b22e460e2 Mon Sep 17 00:00:00 2001
From: Max Kellermann <max.kellermann@gmail.com>
Date: Mon, 6 Mar 2023 16:43:13 +0100
Subject: [PATCH] db/upnp/ContentDirectoryService: use fmt::format_int

---
 src/db/plugins/upnp/ContentDirectoryService.cxx | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/src/db/plugins/upnp/ContentDirectoryService.cxx b/src/db/plugins/upnp/ContentDirectoryService.cxx
index 98c95ddd3..c7ef5f98b 100644
--- a/src/db/plugins/upnp/ContentDirectoryService.cxx
+++ b/src/db/plugins/upnp/ContentDirectoryService.cxx
@@ -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;