From e1ac724cfec5de33803b6acf68384d972240dd22 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Fri, 19 Jan 2024 13:28:26 -0800 Subject: [PATCH] convert const double to const auto Fixes some Wconversion warnings. Signed-off-by: Rosen Penev --- taglib/ape/apeproperties.cpp | 2 +- taglib/flac/flacproperties.cpp | 2 +- taglib/mpc/mpcproperties.cpp | 4 ++-- taglib/ogg/opus/opusproperties.cpp | 2 +- taglib/ogg/speex/speexproperties.cpp | 2 +- taglib/ogg/vorbis/vorbisproperties.cpp | 2 +- taglib/riff/aiff/aiffproperties.cpp | 2 +- taglib/riff/wav/wavproperties.cpp | 2 +- taglib/trueaudio/trueaudioproperties.cpp | 2 +- taglib/wavpack/wavpackproperties.cpp | 2 +- 10 files changed, 11 insertions(+), 11 deletions(-) diff --git a/taglib/ape/apeproperties.cpp b/taglib/ape/apeproperties.cpp index 79046337..d9d2fe87 100644 --- a/taglib/ape/apeproperties.cpp +++ b/taglib/ape/apeproperties.cpp @@ -137,7 +137,7 @@ void APE::Properties::read(File *file, offset_t streamLength) analyzeOld(file); if(d->sampleFrames > 0 && d->sampleRate > 0) { - const double length = d->sampleFrames * 1000.0 / d->sampleRate; + const auto length = static_cast(d->sampleFrames) * 1000.0 / d->sampleRate; d->length = static_cast(length + 0.5); d->bitrate = static_cast(streamLength * 8.0 / length + 0.5); } diff --git a/taglib/flac/flacproperties.cpp b/taglib/flac/flacproperties.cpp index ce379e15..03a741eb 100644 --- a/taglib/flac/flacproperties.cpp +++ b/taglib/flac/flacproperties.cpp @@ -132,7 +132,7 @@ void FLAC::Properties::read(const ByteVector &data, offset_t streamLength) d->sampleFrames = (hi << 32) | lo; if(d->sampleFrames > 0 && d->sampleRate > 0) { - const double length = d->sampleFrames * 1000.0 / d->sampleRate; + const auto length = static_cast(d->sampleFrames) * 1000.0 / d->sampleRate; d->length = static_cast(length + 0.5); d->bitrate = static_cast(streamLength * 8.0 / length + 0.5); } diff --git a/taglib/mpc/mpcproperties.cpp b/taglib/mpc/mpcproperties.cpp index d2a535d1..46fef24d 100644 --- a/taglib/mpc/mpcproperties.cpp +++ b/taglib/mpc/mpcproperties.cpp @@ -227,7 +227,7 @@ void MPC::Properties::readSV8(File *file, offset_t streamLength) if(const auto frameCount = d->sampleFrames - begSilence; frameCount > 0 && d->sampleRate > 0) { - const double length = frameCount * 1000.0 / d->sampleRate; + const auto length = static_cast(frameCount) * 1000.0 / d->sampleRate; d->length = static_cast(length + 0.5); d->bitrate = static_cast(streamLength * 8.0 / length + 0.5); } @@ -327,7 +327,7 @@ void MPC::Properties::readSV7(const ByteVector &data, offset_t streamLength) } if(d->sampleFrames > 0 && d->sampleRate > 0) { - const double length = d->sampleFrames * 1000.0 / d->sampleRate; + const auto length = static_cast(d->sampleFrames) * 1000.0 / d->sampleRate; d->length = static_cast(length + 0.5); if(d->bitrate == 0) diff --git a/taglib/ogg/opus/opusproperties.cpp b/taglib/ogg/opus/opusproperties.cpp index f5f06a0d..296d795f 100644 --- a/taglib/ogg/opus/opusproperties.cpp +++ b/taglib/ogg/opus/opusproperties.cpp @@ -139,7 +139,7 @@ void Opus::Properties::read(File *file) if(start >= 0 && end >= 0) { if(const long long frameCount = end - start - preSkip; frameCount > 0) { - const double length = frameCount * 1000.0 / 48000.0; + const auto length = static_cast(frameCount) * 1000.0 / 48000.0; offset_t fileLengthWithoutOverhead = file->length(); // Ignore the two mandatory header packets, see "3. Packet Organization" // in https://tools.ietf.org/html/rfc7845.html diff --git a/taglib/ogg/speex/speexproperties.cpp b/taglib/ogg/speex/speexproperties.cpp index f1b84e53..7b54758b 100644 --- a/taglib/ogg/speex/speexproperties.cpp +++ b/taglib/ogg/speex/speexproperties.cpp @@ -155,7 +155,7 @@ void Speex::Properties::read(File *file) if(start >= 0 && end >= 0 && d->sampleRate > 0) { if(const long long frameCount = end - start; frameCount > 0) { - const double length = frameCount * 1000.0 / d->sampleRate; + const auto length = static_cast(frameCount) * 1000.0 / d->sampleRate; offset_t fileLengthWithoutOverhead = file->length(); // Ignore the two header packets, see "Ogg file format" in // https://www.speex.org/docs/manual/speex-manual/node8.html diff --git a/taglib/ogg/vorbis/vorbisproperties.cpp b/taglib/ogg/vorbis/vorbisproperties.cpp index 10af261e..4afe3151 100644 --- a/taglib/ogg/vorbis/vorbisproperties.cpp +++ b/taglib/ogg/vorbis/vorbisproperties.cpp @@ -158,7 +158,7 @@ void Vorbis::Properties::read(File *file) if(start >= 0 && end >= 0 && d->sampleRate > 0) { if(const long long frameCount = end - start; frameCount > 0) { - const double length = frameCount * 1000.0 / d->sampleRate; + const auto length = static_cast(frameCount) * 1000.0 / d->sampleRate; offset_t fileLengthWithoutOverhead = file->length(); // Ignore the three initial header packets, see "1.3.1. Decode Setup" in // https://xiph.org/vorbis/doc/Vorbis_I_spec.html diff --git a/taglib/riff/aiff/aiffproperties.cpp b/taglib/riff/aiff/aiffproperties.cpp index f5ff37f3..4b609f7e 100644 --- a/taglib/riff/aiff/aiffproperties.cpp +++ b/taglib/riff/aiff/aiffproperties.cpp @@ -145,7 +145,7 @@ void RIFF::AIFF::Properties::read(File *file) d->sampleRate = static_cast(smplRate + 0.5); if(d->sampleFrames > 0 && d->sampleRate > 0) { - const double length = d->sampleFrames * 1000.0 / smplRate; + const auto length = static_cast(d->sampleFrames) * 1000.0 / smplRate; d->length = static_cast(length + 0.5); d->bitrate = static_cast(streamLength * 8.0 / length + 0.5); } diff --git a/taglib/riff/wav/wavproperties.cpp b/taglib/riff/wav/wavproperties.cpp index 07faa912..f1494c8b 100644 --- a/taglib/riff/wav/wavproperties.cpp +++ b/taglib/riff/wav/wavproperties.cpp @@ -166,7 +166,7 @@ void RIFF::WAV::Properties::read(File *file) d->sampleFrames = streamLength / (d->channels * ((d->bitsPerSample + 7) / 8)); if(d->sampleFrames > 0 && d->sampleRate > 0) { - const double length = d->sampleFrames * 1000.0 / d->sampleRate; + const auto length = static_cast(d->sampleFrames) * 1000.0 / d->sampleRate; d->length = static_cast(length + 0.5); d->bitrate = static_cast(streamLength * 8.0 / length + 0.5); } diff --git a/taglib/trueaudio/trueaudioproperties.cpp b/taglib/trueaudio/trueaudioproperties.cpp index 8f6bb0e8..3f885472 100644 --- a/taglib/trueaudio/trueaudioproperties.cpp +++ b/taglib/trueaudio/trueaudioproperties.cpp @@ -143,7 +143,7 @@ void TrueAudio::Properties::read(const ByteVector &data, offset_t streamLength) d->sampleFrames = data.toUInt(pos, false); if(d->sampleFrames > 0 && d->sampleRate > 0) { - const double length = d->sampleFrames * 1000.0 / d->sampleRate; + const auto length = static_cast(d->sampleFrames) * 1000.0 / d->sampleRate; d->length = static_cast(length + 0.5); d->bitrate = static_cast(streamLength * 8.0 / length + 0.5); } diff --git a/taglib/wavpack/wavpackproperties.cpp b/taglib/wavpack/wavpackproperties.cpp index ba3313c3..ad84f1e1 100644 --- a/taglib/wavpack/wavpackproperties.cpp +++ b/taglib/wavpack/wavpackproperties.cpp @@ -306,7 +306,7 @@ void WavPack::Properties::read(File *file, offset_t streamLength) d->sampleFrames = seekFinalIndex(file, streamLength); if(d->sampleFrames > 0 && d->sampleRate > 0) { - const double length = d->sampleFrames * 1000.0 / d->sampleRate; + const auto length = static_cast(d->sampleFrames) * 1000.0 / d->sampleRate; d->length = static_cast(length + 0.5); d->bitrate = static_cast(streamLength * 8.0 / length + 0.5); }