From 4324fb2fbed32533d8efa8c211038ef8fe0b9a0e Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 24 Jan 2018 13:25:11 +0100 Subject: [PATCH] input/Offset: add macro PRIoffset --- src/input/Offset.hxx | 6 ++++++ src/input/plugins/CurlInputPlugin.cxx | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/input/Offset.hxx b/src/input/Offset.hxx index e5d0be21f..725591e6c 100644 --- a/src/input/Offset.hxx +++ b/src/input/Offset.hxx @@ -29,4 +29,10 @@ */ typedef uint64_t offset_type; +/** + * To format an offset_type with printf(). To use this, include + * . + */ +#define PRIoffset PRIu64 + #endif diff --git a/src/input/plugins/CurlInputPlugin.cxx b/src/input/plugins/CurlInputPlugin.cxx index 31ade2ab3..aa4b0d6d5 100644 --- a/src/input/plugins/CurlInputPlugin.cxx +++ b/src/input/plugins/CurlInputPlugin.cxx @@ -44,6 +44,8 @@ #include "Log.hxx" #include "PluginUnavailable.hxx" +#include + #include #include @@ -423,7 +425,7 @@ CurlInputStream::SeekInternal(offset_type new_offset) if (offset > 0) { char range[32]; - sprintf(range, "%llu-", (unsigned long long)offset); + sprintf(range, "%" PRIoffset "-", offset); request->SetOption(CURLOPT_RANGE, range); }