packages/sound/mpd/patches/020-fix-incorrect-rounding.patch
Rosen Penev 3be4778840
mpd: update to 0.21.20
Updated patches to latest patchset and removed upstreamed ones.

Ran init script through shellcheck. Restart using SIGHUP.

Added logging from stderr as any kind of logging is missing in --no-daemon
mode.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-02-17 21:16:26 -08:00

34 lines
1.2 KiB
Diff

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,