From 0526ecd2f95877b167293e50ab8ce0ce614d03f4 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sun, 15 Jan 2023 13:43:27 -0800 Subject: clang-tidy cleanups (#800) * clang-tidy: use bool literals Found with modernize-use-bool-literals Signed-off-by: Rosen Penev * clang-tidy: replace std::bind with lambdas Found with modernize-avoid-bind Signed-off-by: Rosen Penev * clang-tidy: use data() instead of pointer stuff Found with readability-container-data-pointe Signed-off-by: Rosen Penev * clang-tidy: use empty() Found with readability-container-size-empty Signed-off-by: Rosen Penev * clang-tidy: remove static in anon namespace Found with readability-static-definition-in-anonymous-namespace Signed-off-by: Rosen Penev * clang-tidy: remove const return Found with readability-const-return-type Signed-off-by: Rosen Penev Signed-off-by: Rosen Penev --- alc/backends/alsa.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'alc/backends/alsa.cpp') diff --git a/alc/backends/alsa.cpp b/alc/backends/alsa.cpp index e495a34d..d620a83c 100644 --- a/alc/backends/alsa.cpp +++ b/alc/backends/alsa.cpp @@ -132,7 +132,7 @@ constexpr char alsaDevice[] = "ALSA Default"; MAGIC(snd_card_next); \ MAGIC(snd_config_update_free_global) -static void *alsa_handle; +void *alsa_handle; #define MAKE_FUNC(f) decltype(f) * p##f ALSA_FUNCS(MAKE_FUNC); #undef MAKE_FUNC @@ -330,7 +330,7 @@ al::vector probe_devices(snd_pcm_stream_t stream) ConfigValueStr(nullptr, "alsa", name.c_str()).value_or(main_prefix)}; int dev{-1}; - while(1) + while(true) { if(snd_ctl_pcm_next_device(handle, &dev) < 0) ERR("snd_ctl_pcm_next_device failed\n"); @@ -692,7 +692,7 @@ bool AlsaPlayback::reset() break; } - bool allowmmap{!!GetConfigValueBool(mDevice->DeviceName.c_str(), "alsa", "mmap", 1)}; + bool allowmmap{!!GetConfigValueBool(mDevice->DeviceName.c_str(), "alsa", "mmap", true)}; uint periodLen{static_cast(mDevice->UpdateSize * 1000000_u64 / mDevice->Frequency)}; uint bufferLen{static_cast(mDevice->BufferSize * 1000000_u64 / mDevice->Frequency)}; uint rate{mDevice->Frequency}; @@ -750,7 +750,7 @@ bool AlsaPlayback::reset() else mDevice->FmtChans = DevFmtStereo; } /* set rate (implicitly constrains period/buffer parameters) */ - if(!GetConfigValueBool(mDevice->DeviceName.c_str(), "alsa", "allow-resampler", 0) + if(!GetConfigValueBool(mDevice->DeviceName.c_str(), "alsa", "allow-resampler", false) || !mDevice->Flags.test(FrequencyRequest)) { if(snd_pcm_hw_params_set_rate_resample(mPcmHandle, hp.get(), 0) < 0) -- cgit v1.2.3