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

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