From 2b3277f61da11ac220623678a9163b25b6c0bf05 Mon Sep 17 00:00:00 2001 From: Cathy Chen Date: Mon, 2 Dec 2024 11:38:34 -0500 Subject: [PATCH] Fixed Incorrect format specifiers issue --- pxr/base/arch/testenv/testArchPRead.cpp | 4 ++-- pxr/base/tf/testenv/hash.cpp | 4 ++-- pxr/base/trace/wrapCollector.cpp | 2 +- pxr/imaging/hd/testenv/testHdSortedIdsPerf.cpp | 4 ++-- pxr/usd/usd/crateFile.cpp | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pxr/base/arch/testenv/testArchPRead.cpp b/pxr/base/arch/testenv/testArchPRead.cpp index 8ee8efd205..879f234fd8 100644 --- a/pxr/base/arch/testenv/testArchPRead.cpp +++ b/pxr/base/arch/testenv/testArchPRead.cpp @@ -42,12 +42,12 @@ int main(int argc, char** argv) } const int64_t fileSize = ArchGetFileLength(f.get()); - printf("Reading %s (%zu bytes)...\n", filename.c_str(), fileSize); + printf("Reading %s (%lld bytes)...\n", filename.c_str(), fileSize); std::unique_ptr fileContents(new char[fileSize]); const int64_t numRead = ArchPRead(f.get(), fileContents.get(), fileSize, 0); if (numRead != fileSize) { - printf("ERROR: Read %zu bytes, expected %zu\n", numRead, fileSize); + printf("ERROR: Read %lld bytes, expected %lld\n", numRead, fileSize); return 1; } diff --git a/pxr/base/tf/testenv/hash.cpp b/pxr/base/tf/testenv/hash.cpp index d14f2308ec..dc91ba8858 100644 --- a/pxr/base/tf/testenv/hash.cpp +++ b/pxr/base/tf/testenv/hash.cpp @@ -100,7 +100,7 @@ _TestStatsOne(Hasher const &h, char const *label) TestOne(h, num, counts); } - printf("%s One: %zu tests.\n", label, NTESTS * 64); + printf("%s One: %llu tests.\n", label, NTESTS * 64); for (int i = 0; i != 64; ++i) { printf("bit %d flipped %d times (%.2f%%)\n", i, counts[i], 100.0 * double(counts[i]) / (double(NTESTS) * 64.0)); @@ -128,7 +128,7 @@ _TestStatsTwo(Hasher const &h, char const *label) TestTwo(h, t, counts); } - printf("%s Two: %zu tests.\n", label, NTESTS * 64); + printf("%s Two: %llu tests.\n", label, NTESTS * 64); for (int i = 0; i != 64; ++i) { printf("bit %d flipped %d times (%.2f%%)\n", i, counts[i], 100.0 * double(counts[i]) / (double(NTESTS) * 64.0)); diff --git a/pxr/base/trace/wrapCollector.cpp b/pxr/base/trace/wrapCollector.cpp index ed24dfb454..47ff2a55e8 100644 --- a/pxr/base/trace/wrapCollector.cpp +++ b/pxr/base/trace/wrapCollector.cpp @@ -27,7 +27,7 @@ static double GetElapsedSeconds(TraceEvent::TimeStamp begin, TraceEvent::TimeStamp end) { if (begin > end) { - TF_CODING_ERROR("Invalid interval: begin=%zu, end=%zu", begin, end); + TF_CODING_ERROR("Invalid interval: begin=%llu, end=%llu", begin, end); return 0.0; } return ArchTicksToSeconds(end-begin); diff --git a/pxr/imaging/hd/testenv/testHdSortedIdsPerf.cpp b/pxr/imaging/hd/testenv/testHdSortedIdsPerf.cpp index 92dd59ae3a..1498dc0158 100644 --- a/pxr/imaging/hd/testenv/testHdSortedIdsPerf.cpp +++ b/pxr/imaging/hd/testenv/testHdSortedIdsPerf.cpp @@ -384,9 +384,9 @@ int main() FILE *statsFile = fopen("perfstats.raw", "w"); for (const auto &[metricName, ns]: metrics) { fprintf(statsFile, - "{'profile':'%s','metric':'time','value':%zd,'samples':1}\n", + "{'profile':'%s','metric':'time','value':%lld,'samples':1}\n", metricName.c_str(), ns); - printf("%s : %zd ns\n", metricName.c_str(), ns); + printf("%s : %lld ns\n", metricName.c_str(), ns); } fclose(statsFile); diff --git a/pxr/usd/usd/crateFile.cpp b/pxr/usd/usd/crateFile.cpp index f3a3f27b06..2d9d54d74c 100644 --- a/pxr/usd/usd/crateFile.cpp +++ b/pxr/usd/usd/crateFile.cpp @@ -3593,7 +3593,7 @@ CrateFile::_ReadTokens(Reader reader) } wd.Wait(); if (i != numTokens) { - TF_RUNTIME_ERROR("Crate file claims %zu tokens, found %zu", + TF_RUNTIME_ERROR("Crate file claims %llu tokens, found %zu", numTokens, i); }