*: add "noexcept" to many, many function prototypes
This eliminates some overhead, because the compiler doesn't need to consider these functions throwing.
This commit is contained in:
@@ -249,7 +249,7 @@ alsa_test_default_device()
|
||||
*/
|
||||
gcc_const
|
||||
static snd_pcm_format_t
|
||||
ToAlsaPcmFormat(SampleFormat sample_format)
|
||||
ToAlsaPcmFormat(SampleFormat sample_format) noexcept
|
||||
{
|
||||
switch (sample_format) {
|
||||
case SampleFormat::UNDEFINED:
|
||||
@@ -287,7 +287,7 @@ ToAlsaPcmFormat(SampleFormat sample_format)
|
||||
* SND_PCM_FORMAT_UNKNOWN if the format cannot be byte-swapped.
|
||||
*/
|
||||
static snd_pcm_format_t
|
||||
ByteSwapAlsaPcmFormat(snd_pcm_format_t fmt)
|
||||
ByteSwapAlsaPcmFormat(snd_pcm_format_t fmt) noexcept
|
||||
{
|
||||
switch (fmt) {
|
||||
case SND_PCM_FORMAT_S16_LE: return SND_PCM_FORMAT_S16_BE;
|
||||
|
||||
@@ -66,7 +66,7 @@ public:
|
||||
void Open(AudioFormat &audio_format);
|
||||
void Close();
|
||||
|
||||
std::chrono::steady_clock::duration Delay() const;
|
||||
std::chrono::steady_clock::duration Delay() const noexcept;
|
||||
size_t Play(const void *chunk, size_t size);
|
||||
void Cancel();
|
||||
};
|
||||
@@ -205,7 +205,7 @@ FifoOutput::Cancel()
|
||||
}
|
||||
|
||||
inline std::chrono::steady_clock::duration
|
||||
FifoOutput::Delay() const
|
||||
FifoOutput::Delay() const noexcept
|
||||
{
|
||||
return timer->IsStarted()
|
||||
? timer->GetDelay()
|
||||
|
||||
@@ -119,7 +119,7 @@ struct JackOutput {
|
||||
* on all channels.
|
||||
*/
|
||||
gcc_pure
|
||||
jack_nframes_t GetAvailable() const;
|
||||
jack_nframes_t GetAvailable() const noexcept;
|
||||
|
||||
void Process(jack_nframes_t nframes);
|
||||
|
||||
@@ -128,7 +128,7 @@ struct JackOutput {
|
||||
*/
|
||||
size_t WriteSamples(const float *src, size_t n_frames);
|
||||
|
||||
std::chrono::steady_clock::duration Delay() const {
|
||||
std::chrono::steady_clock::duration Delay() const noexcept {
|
||||
return base.pause && pause && !shutdown
|
||||
? std::chrono::seconds(1)
|
||||
: std::chrono::steady_clock::duration::zero();
|
||||
@@ -215,7 +215,7 @@ JackOutput::JackOutput(const ConfigBlock &block)
|
||||
}
|
||||
|
||||
inline jack_nframes_t
|
||||
JackOutput::GetAvailable() const
|
||||
JackOutput::GetAvailable() const noexcept
|
||||
{
|
||||
size_t min = jack_ringbuffer_read_space(ringbuffer[0]);
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
delete timer;
|
||||
}
|
||||
|
||||
std::chrono::steady_clock::duration Delay() const {
|
||||
std::chrono::steady_clock::duration Delay() const noexcept {
|
||||
return sync && timer->IsStarted()
|
||||
? timer->GetDelay()
|
||||
: std::chrono::steady_clock::duration::zero();
|
||||
|
||||
@@ -58,7 +58,7 @@ class OpenALOutput {
|
||||
void Close();
|
||||
|
||||
gcc_pure
|
||||
std::chrono::steady_clock::duration Delay() const {
|
||||
std::chrono::steady_clock::duration Delay() const noexcept {
|
||||
return filled < NUM_BUFFERS || HasProcessed()
|
||||
? std::chrono::steady_clock::duration::zero()
|
||||
/* we don't know exactly how long we must wait
|
||||
|
||||
@@ -391,7 +391,7 @@ oss_setup_sample_rate(int fd, AudioFormat &audio_format)
|
||||
*/
|
||||
gcc_const
|
||||
static int
|
||||
sample_format_to_oss(SampleFormat format)
|
||||
sample_format_to_oss(SampleFormat format) noexcept
|
||||
{
|
||||
switch (format) {
|
||||
case SampleFormat::UNDEFINED:
|
||||
@@ -430,7 +430,7 @@ sample_format_to_oss(SampleFormat format)
|
||||
*/
|
||||
gcc_const
|
||||
static SampleFormat
|
||||
sample_format_from_oss(int format)
|
||||
sample_format_from_oss(int format) noexcept
|
||||
{
|
||||
switch (format) {
|
||||
case AFMT_S8:
|
||||
|
||||
@@ -90,7 +90,6 @@ public:
|
||||
Signal();
|
||||
}
|
||||
|
||||
gcc_const
|
||||
static bool TestDefaultDevice();
|
||||
|
||||
static PulseOutput *Create(const ConfigBlock &block);
|
||||
|
||||
@@ -73,7 +73,7 @@ static constexpr Domain roar_output_domain("roar_output");
|
||||
|
||||
gcc_pure
|
||||
static int
|
||||
GetConfiguredRole(const ConfigBlock &block)
|
||||
GetConfiguredRole(const ConfigBlock &block) noexcept
|
||||
{
|
||||
const char *role = block.GetBlockValue("role");
|
||||
return role != nullptr
|
||||
|
||||
@@ -63,7 +63,7 @@ struct ShoutOutput final {
|
||||
void Open(AudioFormat &audio_format);
|
||||
void Close();
|
||||
|
||||
std::chrono::steady_clock::duration Delay() const;
|
||||
std::chrono::steady_clock::duration Delay() const noexcept;
|
||||
void SendTag(const Tag &tag);
|
||||
size_t Play(const void *chunk, size_t size);
|
||||
void Cancel();
|
||||
@@ -361,7 +361,7 @@ ShoutOutput::Open(AudioFormat &audio_format)
|
||||
}
|
||||
|
||||
std::chrono::steady_clock::duration
|
||||
ShoutOutput::Delay() const
|
||||
ShoutOutput::Delay() const noexcept
|
||||
{
|
||||
int delay = shout_delay(shout_conn);
|
||||
if (delay < 0)
|
||||
|
||||
@@ -260,7 +260,7 @@ HttpdClient::TryWritePageN(const Page &page, size_t position, ssize_t n)
|
||||
}
|
||||
|
||||
ssize_t
|
||||
HttpdClient::GetBytesTillMetaData() const
|
||||
HttpdClient::GetBytesTillMetaData() const noexcept
|
||||
{
|
||||
if (metadata_requested &&
|
||||
current_page->size - current_position > metaint - metadata_fill)
|
||||
|
||||
@@ -168,7 +168,7 @@ public:
|
||||
bool SendResponse();
|
||||
|
||||
gcc_pure
|
||||
ssize_t GetBytesTillMetaData() const;
|
||||
ssize_t GetBytesTillMetaData() const noexcept;
|
||||
|
||||
ssize_t TryWritePage(const Page &page, size_t position);
|
||||
ssize_t TryWritePageN(const Page &page, size_t position, ssize_t n);
|
||||
|
||||
@@ -218,7 +218,7 @@ public:
|
||||
void SendHeader(HttpdClient &client) const;
|
||||
|
||||
gcc_pure
|
||||
std::chrono::steady_clock::duration Delay() const;
|
||||
std::chrono::steady_clock::duration Delay() const noexcept;
|
||||
|
||||
/**
|
||||
* Reads data from the encoder (as much as available) and
|
||||
|
||||
@@ -345,7 +345,7 @@ HttpdOutput::SendHeader(HttpdClient &client) const
|
||||
}
|
||||
|
||||
inline std::chrono::steady_clock::duration
|
||||
HttpdOutput::Delay() const
|
||||
HttpdOutput::Delay() const noexcept
|
||||
{
|
||||
if (!LockHasClients() && base.pause) {
|
||||
/* if there's no client and this output is paused,
|
||||
@@ -366,7 +366,7 @@ HttpdOutput::Delay() const
|
||||
}
|
||||
|
||||
static std::chrono::steady_clock::duration
|
||||
httpd_output_delay(AudioOutput *ao)
|
||||
httpd_output_delay(AudioOutput *ao) noexcept
|
||||
{
|
||||
HttpdOutput *httpd = HttpdOutput::Cast(ao);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user