From 60aa22f20d63a3da9f06b9398a2a8656ebbd0342 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 11 Dec 2023 18:59:54 -0800 Subject: Mostly finish cleanup for backends Except CoreAudio and Solaris backends --- alc/backends/sndio.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'alc/backends/sndio.cpp') diff --git a/alc/backends/sndio.cpp b/alc/backends/sndio.cpp index 8bf63a59..d05db2e8 100644 --- a/alc/backends/sndio.cpp +++ b/alc/backends/sndio.cpp @@ -23,11 +23,11 @@ #include "sndio.h" #include +#include +#include +#include #include #include -#include -#include -#include #include #include @@ -43,7 +43,8 @@ namespace { -static const char sndio_device[] = "SndIO Default"; +/* NOLINTNEXTLINE(*-avoid-c-arrays) */ +constexpr char sndio_device[] = "SndIO Default"; struct SioPar : public sio_par { SioPar() { sio_initpar(this); } @@ -317,19 +318,19 @@ int SndioCapture::recordProc() return 1; } - auto fds = std::make_unique(static_cast(nfds_pre)); + auto fds = std::vector(static_cast(nfds_pre)); while(!mKillNow.load(std::memory_order_acquire) && mDevice->Connected.load(std::memory_order_acquire)) { /* Wait until there's some samples to read. */ - const int nfds{sio_pollfd(mSndHandle, fds.get(), POLLIN)}; + const int nfds{sio_pollfd(mSndHandle, fds.data(), POLLIN)}; if(nfds <= 0) { mDevice->handleDisconnect("Failed to get polling fds: %d", nfds); break; } - int pollres{::poll(fds.get(), static_cast(nfds), 2000)}; + int pollres{::poll(fds.data(), fds.size(), 2000)}; if(pollres < 0) { if(errno == EINTR) continue; @@ -339,7 +340,7 @@ int SndioCapture::recordProc() if(pollres == 0) continue; - const int revents{sio_revents(mSndHandle, fds.get())}; + const int revents{sio_revents(mSndHandle, fds.data())}; if((revents&POLLHUP)) { mDevice->handleDisconnect("Got POLLHUP from poll events"); @@ -373,8 +374,8 @@ int SndioCapture::recordProc() if(buffer.empty()) { /* Got samples to read, but no place to store it. Drop it. */ - static char junk[4096]; - sio_read(mSndHandle, junk, sizeof(junk) - (sizeof(junk)%frameSize)); + static std::array junk; + sio_read(mSndHandle, junk.data(), junk.size() - (junk.size()%frameSize)); } } -- cgit v1.2.3