Commit 6f83bdd6 authored by Max Kellermann's avatar Max Kellermann

Merge branch '1' of git://github.com/neheb/MPD

parents ec917f70 9bcd425a
......@@ -37,6 +37,7 @@
#endif
#include <algorithm>
#include <array>
#include <cassert>
#include <csignal>
......@@ -90,12 +91,12 @@ private:
/* this should be enough - is it? */
static constexpr unsigned MAX_SIGNAL = 64;
static SignalHandler signal_handlers[MAX_SIGNAL];
static std::array<SignalHandler, MAX_SIGNAL> signal_handlers;
#ifdef USE_SIGNALFD
static sigset_t signal_mask;
#else
static std::atomic_bool signal_pending[MAX_SIGNAL];
static std::array<std::atomic_bool, MAX_SIGNAL> signal_pending;
#endif
static Manual<SignalMonitor> monitor;
......@@ -153,7 +154,7 @@ void
SignalMonitorFinish() noexcept
{
#ifdef USE_SIGNALFD
std::fill_n(signal_handlers, MAX_SIGNAL, nullptr);
signal_handlers = {};
#else
struct sigaction sa;
sa.sa_flags = 0;
......@@ -167,7 +168,7 @@ SignalMonitorFinish() noexcept
}
}
std::fill_n(signal_pending, MAX_SIGNAL, false);
std::fill(signal_pending.begin(), signal_pending.end(), false);
#endif
monitor.Destruct();
......
......@@ -760,7 +760,7 @@ Play_44_1_Silence(snd_pcm_t *pcm)
throw Alsa::MakeError(err, "snd_pcm_prepare() failed");
AllocatedArray<int16_t> buffer{channels * period_size};
std::fill(buffer.begin(), buffer.end(), 0);
buffer = {};
/* play at least 250ms of silence */
for (snd_pcm_uframes_t remaining_frames = rate / 4;;) {
......
......@@ -172,7 +172,7 @@ void
Dsd2Pcm::Reset() noexcept
{
/* my favorite silence pattern */
std::fill_n(fifo, std::size(fifo), 0x69);
fifo.fill(0x69);
fifopos = 0;
/* 0x69 = 01101001
......@@ -186,7 +186,7 @@ inline void
Dsd2Pcm::ApplySample(size_t ffp, uint8_t src) noexcept
{
fifo[ffp] = src;
uint8_t *p = fifo + ((ffp-CTABLES) & FIFOMASK);
uint8_t *p = fifo.data() + ((ffp-CTABLES) & FIFOMASK);
*p = bit_reverse(*p);
}
......
......@@ -51,7 +51,7 @@ private:
/** bit mask for FIFO offsets */
static constexpr size_t FIFOMASK = FIFOSIZE - 1;
uint8_t fifo[FIFOSIZE];
std::array<uint8_t, FIFOSIZE> fifo;
size_t fifopos;
public:
......
......@@ -31,6 +31,7 @@
#include "ASCII.hxx"
#include "SplitString.hxx"
#include <array>
#include <cassert>
#include <cstring>
......@@ -73,7 +74,7 @@ gcc_pure
static const char *
SkipUriScheme(const char *uri) noexcept
{
static const char *const schemes[] = {
static constexpr auto schemes = std::array {
"http://", "https://",
"ftp://",
"smb://",
......@@ -100,7 +101,7 @@ uri_remove_auth(const char *uri) noexcept
if (slash == nullptr)
slash = auth + strlen(auth);
const char *at = (const char *)std::memchr(auth, '@', slash - auth);
auto at = (const char *)std::memchr(auth, '@', slash - auth);
if (at == nullptr)
/* no auth info present, do nothing */
return {};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment