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.
This commit is contained in:
FlashSystems 2018-02-17 18:51:40 +01:00
parent 60efdce5ff
commit 9f6af4f2cc
1 changed files with 2 additions and 2 deletions

View File

@ -282,7 +282,7 @@ read_stream_art(Response &r, const char *uri, size_t offset)
return CommandResult::ERROR; 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; constexpr size_t CHUNK_SIZE = 8192;
uint8_t buffer[CHUNK_SIZE]; uint8_t buffer[CHUNK_SIZE];
@ -291,7 +291,7 @@ read_stream_art(Response &r, const char *uri, size_t offset)
is->Seek(offset); is->Seek(offset);
read_size = is->Read(&buffer, CHUNK_SIZE); read_size = is->Read(&buffer, CHUNK_SIZE);
r.Format("size: %" PRIu64 "\n" r.Format("size: %" PRIoffset "\n"
"binary: %u\n", "binary: %u\n",
art_file_size, art_file_size,
read_size read_size