From c764338c86dd155eebef0060fe96bf87e94b1197 Mon Sep 17 00:00:00 2001 From: jelkins Date: Wed, 9 Jul 2025 14:02:50 -0700 Subject: [PATCH] fix: format specifiers that are not portable For printing long long signed and long long unsigned. This issue arose from using numpy or matplotlib in conjuction with printing the filesize of large files. --- src/KM_util.h | 4 ++-- src/MXF.cpp | 4 ++-- src/klvwalk.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/KM_util.h b/src/KM_util.h index 9dcf8467..e32ea7f2 100755 --- a/src/KM_util.h +++ b/src/KM_util.h @@ -103,11 +103,11 @@ namespace Kumu }; #else struct i64Printer : public IntPrinter { - i64Printer(i64_t value) : IntPrinter("%qd", value) {} + i64Printer(i64_t value) : IntPrinter("%lld", value) {} }; struct ui64Printer : public IntPrinter { - ui64Printer(ui64_t value) : IntPrinter("%qu", value) {} + ui64Printer(ui64_t value) : IntPrinter("%llu", value) {} }; #endif diff --git a/src/MXF.cpp b/src/MXF.cpp index b623d928..5a585964 100755 --- a/src/MXF.cpp +++ b/src/MXF.cpp @@ -794,11 +794,11 @@ ASDCP::MXF::OP1aHeader::InitFromFile(const Kumu::IFileReader& Reader) } else if ( HeaderByteCount < 1024 ) { - DefaultLogSink().Warn("Improbably small HeaderByteCount value: %qu\n", HeaderByteCount); + DefaultLogSink().Warn("Improbably small HeaderByteCount value: %llu\n", HeaderByteCount); } else if (HeaderByteCount > ( 4 * Kumu::Megabyte ) ) { - DefaultLogSink().Warn("Improbably huge HeaderByteCount value: %qu\n", HeaderByteCount); + DefaultLogSink().Warn("Improbably huge HeaderByteCount value: %llu\n", HeaderByteCount); } result = m_HeaderData.Capacity(Kumu::xmin(4*Kumu::Megabyte, static_cast(HeaderByteCount))); diff --git a/src/klvwalk.cpp b/src/klvwalk.cpp index dc9200f4..efe78f69 100755 --- a/src/klvwalk.cpp +++ b/src/klvwalk.cpp @@ -324,7 +324,7 @@ main(int argc, const char** argv) if ( plain_part.ThisPartition != i->ByteOffset ) { - DefaultLogSink().Error("ThisPartition value error: wanted=%qu, got=%qu\n", + DefaultLogSink().Error("ThisPartition value error: wanted=%llu, got=%llu\n", plain_part.ThisPartition, i->ByteOffset); }