You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

34 lines
1.2 KiB

From ab5183cbc45818114cc4c226ace299a1fb917ab0 Mon Sep 17 00:00:00 2001
From: Rosen Penev <rosenp@gmail.com>
Date: Sun, 2 Feb 2020 16:34:09 -0800
Subject: [PATCH] [clang-tidy] fix incorrect rounding
Found with bugprone-incorrect-roundings
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
src/decoder/plugins/WavpackDecoderPlugin.cxx | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/decoder/plugins/WavpackDecoderPlugin.cxx b/src/decoder/plugins/WavpackDecoderPlugin.cxx
index 77751167f..97824de75 100644
--- a/src/decoder/plugins/WavpackDecoderPlugin.cxx
+++ b/src/decoder/plugins/WavpackDecoderPlugin.cxx
@@ -26,6 +26,7 @@
#include "fs/Path.hxx"
#include "util/Macros.hxx"
#include "util/Alloc.hxx"
+#include "util/Math.hxx"
#include "util/ScopeExit.hxx"
#include "util/RuntimeError.hxx"
@@ -265,8 +266,7 @@ wavpack_decode(DecoderClient &client, WavpackContext *wpc, bool can_seek)
if (samples_got == 0)
break;
- int bitrate = (int)(WavpackGetInstantBitrate(wpc) / 1000 +
- 0.5);
+ int bitrate = lround(WavpackGetInstantBitrate(wpc) / 1000);
format_samples(chunk, samples_got * audio_format.channels);
cmd = client.SubmitData(nullptr, chunk,