input/Offset: add macro PRIoffset

This commit is contained in:
Max Kellermann 2018-01-24 13:25:11 +01:00
parent 87dfca0477
commit 41cdc4e14b
2 changed files with 9 additions and 1 deletions

View File

@ -29,4 +29,10 @@
*/
typedef uint64_t offset_type;
/**
* To format an offset_type with printf(). To use this, include
* <cinttypes>.
*/
#define PRIoffset PRIu64
#endif

View File

@ -40,6 +40,8 @@
#include "Log.hxx"
#include "PluginUnavailable.hxx"
#include <cinttypes>
#include <assert.h>
#include <string.h>
@ -416,7 +418,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);
}