summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2021-05-19 18:04:55 +0200
committerMax Kellermann <max@musicpd.org>2021-05-19 18:06:40 +0200
commit6de4064cca78ab1e833dd318f76a3b33a4e6eaaa (patch)
treed08cc6ee7fb7eb23b4fbf28fde270022e4488232
parentbcf0fdd3a8ed46cce22527fc12d10160031e5373 (diff)
client/Response, command/file: use %lu instead of %zu on Windows
Fixes -Wformat warnings. Closes https://github.com/MusicPlayerDaemon/MPD/issues/1150
-rw-r--r--src/client/Response.cxx7
-rw-r--r--src/command/FileCommands.cxx9
2 files changed, 15 insertions, 1 deletions
diff --git a/src/client/Response.cxx b/src/client/Response.cxx
index 0c9145a50..b582d6bbc 100644
--- a/src/client/Response.cxx
+++ b/src/client/Response.cxx
@@ -61,7 +61,12 @@ Response::WriteBinary(ConstBuffer<void> payload) noexcept
{
assert(payload.size <= client.binary_limit);
- return Format("binary: %zu\n", payload.size) &&
+ return
+#ifdef _WIN32
+ Format("binary: %lu\n", (unsigned long)payload.size) &&
+#else
+ Format("binary: %zu\n", payload.size) &&
+#endif
Write(payload.data, payload.size) &&
Write("\n");
}
diff --git a/src/command/FileCommands.cxx b/src/command/FileCommands.cxx
index 739cc6579..e5638a10a 100644
--- a/src/command/FileCommands.cxx
+++ b/src/command/FileCommands.cxx
@@ -231,7 +231,12 @@ read_stream_art(Response &r, const char *uri, size_t offset)
read_size = is->Read(lock, buffer.get(), buffer_size);
}
+#ifdef _WIN32
+ r.Format("size: %lu\n", (unsigned long)art_file_size);
+#else
r.Format("size: %" PRIoffset "\n", art_file_size);
+#endif
+
r.WriteBinary({buffer.get(), read_size});
return CommandResult::OK;
@@ -313,7 +318,11 @@ public:
return;
}
+#ifdef _WIN32
+ response.Format("size: %lu\n", (unsigned long)buffer.size);
+#else
response.Format("size: %zu\n", buffer.size);
+#endif
if (mime_type != nullptr)
response.Format("type: %s\n", mime_type);