convert const double to const auto

Fixes some Wconversion warnings.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev 2024-01-19 13:28:26 -08:00 committed by Urs Fleisch
parent a08acdcf23
commit e1ac724cfe
10 changed files with 11 additions and 11 deletions

View File

@ -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<double>(d->sampleFrames) * 1000.0 / d->sampleRate;
d->length = static_cast<int>(length + 0.5);
d->bitrate = static_cast<int>(streamLength * 8.0 / length + 0.5);
}

View File

@ -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<double>(d->sampleFrames) * 1000.0 / d->sampleRate;
d->length = static_cast<int>(length + 0.5);
d->bitrate = static_cast<int>(streamLength * 8.0 / length + 0.5);
}

View File

@ -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<double>(frameCount) * 1000.0 / d->sampleRate;
d->length = static_cast<int>(length + 0.5);
d->bitrate = static_cast<int>(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<double>(d->sampleFrames) * 1000.0 / d->sampleRate;
d->length = static_cast<int>(length + 0.5);
if(d->bitrate == 0)

View File

@ -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<double>(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

View File

@ -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<double>(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

View File

@ -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<double>(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

View File

@ -145,7 +145,7 @@ void RIFF::AIFF::Properties::read(File *file)
d->sampleRate = static_cast<int>(smplRate + 0.5);
if(d->sampleFrames > 0 && d->sampleRate > 0) {
const double length = d->sampleFrames * 1000.0 / smplRate;
const auto length = static_cast<double>(d->sampleFrames) * 1000.0 / smplRate;
d->length = static_cast<int>(length + 0.5);
d->bitrate = static_cast<int>(streamLength * 8.0 / length + 0.5);
}

View File

@ -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<double>(d->sampleFrames) * 1000.0 / d->sampleRate;
d->length = static_cast<int>(length + 0.5);
d->bitrate = static_cast<int>(streamLength * 8.0 / length + 0.5);
}

View File

@ -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<double>(d->sampleFrames) * 1000.0 / d->sampleRate;
d->length = static_cast<int>(length + 0.5);
d->bitrate = static_cast<int>(streamLength * 8.0 / length + 0.5);
}

View File

@ -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<double>(d->sampleFrames) * 1000.0 / d->sampleRate;
d->length = static_cast<int>(length + 0.5);
d->bitrate = static_cast<int>(streamLength * 8.0 / length + 0.5);
}