Commit 9f6af4f2 authored by FlashSystems's avatar FlashSystems

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.
parent 60efdce5
...@@ -282,7 +282,7 @@ read_stream_art(Response &r, const char *uri, size_t offset) ...@@ -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) ...@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment