From 4b95d310aee4e6aa0485a6c637701bd2850c7968 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Thu, 11 Apr 2019 16:01:11 -0700 Subject: [PATCH] Remove the SZFMT macro C++11 mandates the %zu/d formatter --- Alc/alc.cpp | 24 ++++++++++++------------ Alc/ambdec.cpp | 14 +++++++------- Alc/hrtf.cpp | 6 +++--- Alc/logging.h | 8 -------- Alc/panning.cpp | 2 +- 5 files changed, 23 insertions(+), 31 deletions(-) diff --git a/Alc/alc.cpp b/Alc/alc.cpp index 7331ac7d..f5da7657 100644 --- a/Alc/alc.cpp +++ b/Alc/alc.cpp @@ -1928,8 +1928,8 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) /* Allocate extra channels for any post-filter output. */ const ALsizei num_chans{device->Dry.NumChannels + device->RealOut.NumChannels}; - TRACE("Allocating %d channels, " SZFMT " bytes\n", num_chans, - num_chans*sizeof(device->MixBuffer[0])); + TRACE("Allocating %d channels, %zu bytes\n", num_chans, + num_chans*sizeof(device->MixBuffer[0])); device->MixBuffer.resize(num_chans); device->Dry.Buffer = &reinterpret_cast(device->MixBuffer[0]); @@ -2207,21 +2207,21 @@ ALCdevice::~ALCdevice() { return cur + POPCNT64(~sublist.FreeMask); } )}; if(count > 0) - WARN(SZFMT " Buffer%s not deleted\n", count, (count==1)?"":"s"); + WARN("%zu Buffer%s not deleted\n", count, (count==1)?"":"s"); count = std::accumulate(EffectList.cbegin(), EffectList.cend(), size_t{0u}, [](size_t cur, const EffectSubList &sublist) noexcept -> size_t { return cur + POPCNT64(~sublist.FreeMask); } ); if(count > 0) - WARN(SZFMT " Effect%s not deleted\n", count, (count==1)?"":"s"); + WARN("%zu Effect%s not deleted\n", count, (count==1)?"":"s"); count = std::accumulate(FilterList.cbegin(), FilterList.cend(), size_t{0u}, [](size_t cur, const FilterSubList &sublist) noexcept -> size_t { return cur + POPCNT64(~sublist.FreeMask); } ); if(count > 0) - WARN(SZFMT " Filter%s not deleted\n", count, (count==1)?"":"s"); + WARN("%zu Filter%s not deleted\n", count, (count==1)?"":"s"); if(mHrtf) mHrtf->DecRef(); @@ -2379,14 +2379,14 @@ ALCcontext::~ALCcontext() cprops = next; ++count; } - TRACE("Freed " SZFMT " context property object%s\n", count, (count==1)?"":"s"); + TRACE("Freed %zu context property object%s\n", count, (count==1)?"":"s"); count = std::accumulate(SourceList.cbegin(), SourceList.cend(), size_t{0u}, [](size_t cur, const SourceSubList &sublist) noexcept -> size_t { return cur + POPCNT64(~sublist.FreeMask); } ); if(count > 0) - WARN(SZFMT " Source%s not deleted\n", count, (count==1)?"":"s"); + WARN("%zu Source%s not deleted\n", count, (count==1)?"":"s"); SourceList.clear(); NumSources = 0; @@ -2400,7 +2400,7 @@ ALCcontext::~ALCcontext() eprops = next; ++count; } - TRACE("Freed " SZFMT " AuxiliaryEffectSlot property object%s\n", count, (count==1)?"":"s"); + TRACE("Freed %zu AuxiliaryEffectSlot property object%s\n", count, (count==1)?"":"s"); delete ActiveAuxSlots.exchange(nullptr, std::memory_order_relaxed); DefaultSlot = nullptr; @@ -2410,7 +2410,7 @@ ALCcontext::~ALCcontext() { return cur + POPCNT64(~sublist.FreeMask); } ); if(count > 0) - WARN(SZFMT " AuxiliaryEffectSlot%s not deleted\n", count, (count==1)?"":"s"); + WARN("%zu AuxiliaryEffectSlot%s not deleted\n", count, (count==1)?"":"s"); EffectSlotList.clear(); NumEffectSlots = 0; @@ -2423,7 +2423,7 @@ ALCcontext::~ALCcontext() vprops = next; ++count; } - TRACE("Freed " SZFMT " voice property object%s\n", count, (count==1)?"":"s"); + TRACE("Freed %zu voice property object%s\n", count, (count==1)?"":"s"); std::for_each(Voices, Voices + MaxVoices, DeinitVoice); al_free(Voices); @@ -2446,7 +2446,7 @@ ALCcontext::~ALCcontext() lprops = next; ++count; } - TRACE("Freed " SZFMT " listener property object%s\n", count, (count==1)?"":"s"); + TRACE("Freed %zu listener property object%s\n", count, (count==1)?"":"s"); if(AsyncEvents) { @@ -2467,7 +2467,7 @@ ALCcontext::~ALCcontext() ++count; } if(count > 0) - TRACE("Destructed " SZFMT " orphaned event%s\n", count, (count==1)?"":"s"); + TRACE("Destructed %zu orphaned event%s\n", count, (count==1)?"":"s"); } ALCdevice_DecRef(Device); diff --git a/Alc/ambdec.cpp b/Alc/ambdec.cpp index e37a5a09..0991cfc5 100644 --- a/Alc/ambdec.cpp +++ b/Alc/ambdec.cpp @@ -91,15 +91,15 @@ bool load_ambdec_speakers(al::vector &spkrs, const std: const size_t spkr_num{spkrs.size()}; istr >> spkr.Name; - if(istr.fail()) WARN("Name not specified for speaker " SZFMT "\n", spkr_num); + if(istr.fail()) WARN("Name not specified for speaker %zu\n", spkr_num); istr >> spkr.Distance; - if(istr.fail()) WARN("Distance not specified for speaker " SZFMT "\n", spkr_num); + if(istr.fail()) WARN("Distance not specified for speaker %zu\n", spkr_num); istr >> spkr.Azimuth; - if(istr.fail()) WARN("Azimuth not specified for speaker " SZFMT "\n", spkr_num); + if(istr.fail()) WARN("Azimuth not specified for speaker %zu\n", spkr_num); istr >> spkr.Elevation; - if(istr.fail()) WARN("Elevation not specified for speaker " SZFMT "\n", spkr_num); + if(istr.fail()) WARN("Elevation not specified for speaker %zu\n", spkr_num); istr >> spkr.Connection; - if(istr.fail()) TRACE("Connection not specified for speaker " SZFMT "\n", spkr_num); + if(istr.fail()) TRACE("Connection not specified for speaker %zu\n", spkr_num); } else { @@ -149,7 +149,7 @@ bool load_ambdec_matrix(float (&gains)[MAX_AMBI_ORDER+1], al::vector(istr.tellg())); return false; } @@ -171,7 +171,7 @@ bool load_ambdec_matrix(float (&gains)[MAX_AMBI_ORDER+1], al::vector(istr.tellg())); matrix.pop_back(); return false; diff --git a/Alc/hrtf.cpp b/Alc/hrtf.cpp index 72e16263..dc15f9e9 100644 --- a/Alc/hrtf.cpp +++ b/Alc/hrtf.cpp @@ -626,7 +626,7 @@ std::unique_ptr LoadHrtf00(std::istream &data, const char *filename) } if(irCount <= evOffset.back()) { - ERR("Invalid evOffset: evOffset[" SZFMT "]=%d (irCount=%d)\n", + ERR("Invalid evOffset: evOffset[%zu]=%d (irCount=%d)\n", evOffset.size()-1, evOffset.back(), irCount); failed = AL_TRUE; } @@ -647,7 +647,7 @@ std::unique_ptr LoadHrtf00(std::istream &data, const char *filename) azCount.back() = irCount - evOffset.back(); if(azCount.back() < MIN_AZ_COUNT || azCount.back() > MAX_AZ_COUNT) { - ERR("Unsupported azimuth count: azCount[" SZFMT "]=%d (%d to %d)\n", + ERR("Unsupported azimuth count: azCount[%zu]=%d (%d to %d)\n", azCount.size()-1, azCount.back(), MIN_AZ_COUNT, MAX_AZ_COUNT); failed = AL_TRUE; } @@ -1297,7 +1297,7 @@ HrtfEntry *GetLoadedHrtf(HrtfHandle *handle) char magic[sizeof(magicMarker02)]; stream->read(magic, sizeof(magic)); if(stream->gcount() < static_cast(sizeof(magicMarker02))) - ERR("%s data is too short (" SZFMT " bytes)\n", name, stream->gcount()); + ERR("%s data is too short (%zu bytes)\n", name, stream->gcount()); else if(memcmp(magic, magicMarker02, sizeof(magicMarker02)) == 0) { TRACE("Detected data set format v2\n"); diff --git a/Alc/logging.h b/Alc/logging.h index 6c2c1c94..e709bbf2 100644 --- a/Alc/logging.h +++ b/Alc/logging.h @@ -6,14 +6,6 @@ #include "opthelpers.h" -#if defined(_WIN64) -#define SZFMT "%I64u" -#elif defined(_WIN32) -#define SZFMT "%u" -#else -#define SZFMT "%zu" -#endif - #ifdef __GNUC__ #define DECL_FORMAT(x, y, z) __attribute__((format(x, (y), (z)))) #else diff --git a/Alc/panning.cpp b/Alc/panning.cpp index eb1a7e16..4fbf3cc3 100644 --- a/Alc/panning.cpp +++ b/Alc/panning.cpp @@ -812,7 +812,7 @@ void aluInitRenderer(ALCdevice *device, ALint hrtf_id, HrtfRequestMode hrtf_appr if(!conf.load(fname)) ERR("Failed to load layout file %s\n", fname); else if(conf.Speakers.size() > MAX_OUTPUT_CHANNELS) - ERR("Unsupported speaker count " SZFMT " (max %d)\n", conf.Speakers.size(), + ERR("Unsupported speaker count %zu (max %d)\n", conf.Speakers.size(), MAX_OUTPUT_CHANNELS); else if(conf.ChanMask > AMBI_3ORDER_MASK) ERR("Unsupported channel mask 0x%04x (max 0x%x)\n", conf.ChanMask,