From 9f6af4f2cc1f806bbbd32b18f64beb01a218cb6d Mon Sep 17 00:00:00 2001 From: FlashSystems <developer@flashsystems.de> Date: Sat, 17 Feb 2018 18:51:40 +0100 Subject: [PATCH] Fix for bogus output of the albumart command on 32bit platforms. read_stream_art uses PRIu64 unconditionally with the Format method of a Respone instance to output a size_t typed value. If size_t is 32bit the output is garbeled. This patch uses offset_type and PRIoffset to make sure the format string and the type of the output value always match. --- src/command/FileCommands.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/command/FileCommands.cxx b/src/command/FileCommands.cxx index 49f769eeb..fa055618d 100644 --- a/src/command/FileCommands.cxx +++ b/src/command/FileCommands.cxx @@ -282,7 +282,7 @@ read_stream_art(Response &r, const char *uri, size_t offset) return CommandResult::ERROR; } - const size_t art_file_size = is->GetSize(); + const offset_type art_file_size = is->GetSize(); constexpr size_t CHUNK_SIZE = 8192; uint8_t buffer[CHUNK_SIZE]; @@ -291,7 +291,7 @@ read_stream_art(Response &r, const char *uri, size_t offset) is->Seek(offset); read_size = is->Read(&buffer, CHUNK_SIZE); - r.Format("size: %" PRIu64 "\n" + r.Format("size: %" PRIoffset "\n" "binary: %u\n", art_file_size, read_size