clang-tidy: cast initial variable

Fixes: bugprone-integer-division

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev 2023-02-10 18:11:27 -08:00
parent e188df1e14
commit d1a2cd0b76
2 changed files with 3 additions and 3 deletions

View File

@ -873,7 +873,7 @@ void MatroskaVideo::decodeFloatTags(const MatroskaTag* tag, const byte* buf, siz
frame_rate = static_cast<double>(1000000000) / static_cast<double>(key);
break;
case 2: // audio
frame_rate = static_cast<double>(key / 1000);
frame_rate = static_cast<double>(key) / 1000;
break;
default:
break;

View File

@ -556,13 +556,13 @@ void RiffVideo::readStreamHeader() {
uint32_t divisor = readDWORDTag(io_); // TimeScale
if (divisor) {
double rate = static_cast<double>(readDWORDTag(io_) / divisor);
auto rate = static_cast<double>(readDWORDTag(io_)) / divisor;
xmpData_[(streamType_ == Video) ? "Xmp.video.FrameRate" : "Xmp.audio.SampleRate"] = rate;
}
io_->seekOrThrow(io_->tell() + DWORD, BasicIo::beg, ErrorCode::kerFailedToReadImageData); // dwStart
if (divisor) {
double frame_count = static_cast<double>(readDWORDTag(io_) / divisor); // DataLength
auto frame_count = static_cast<double>(readDWORDTag(io_)) / divisor; // DataLength
xmpData_[(streamType_ == Video) ? "Xmp.video.FrameCount" : "Xmp.audio.FrameCount"] = frame_count;
}