Compare commits

...

25 Commits

Author SHA1 Message Date
Max Kellermann
cf86dfd317 release v0.20.9 2017-06-04 12:51:36 +02:00
Max Kellermann
a057b4f6d8 *: add lost of "noexcept" specifications 2017-06-04 12:46:48 +02:00
Max Kellermann
62b03cfddf storage, db, mixer, command: remove more bogus "pure" attributes
This commit is similar to 788e3b31e1,
and removes more "pure" attributes which were placed on functions that
could throw exceptions, which is illegal according to clang's
understanding of the attribute (but not according to GCC's).  GitHub
issue  was most likely about StorageDirectoryReader::GetInfo() and
Storage::GetInfo(), which still had "pure" attributes.

Closes 
2017-06-03 21:54:24 +02:00
Jörg Raftopoulos
18b827b979 decoder/ffmpeg: add support for adx
Add ffmpeg decoder support for *.adx files (Sega game console)

Closes 
2017-06-03 20:57:20 +02:00
Max Kellermann
0a379fc514 system/ByteOrder: fix byte order detection on FreeBSD/aarch64
Patch from
 https://svnweb.freebsd.org/ports/head/audio/musicpd/files/patch-src_system_ByteOrder.hxx?revision=441921&view=co
(with a tiny modification)

Closes 
2017-05-29 20:37:14 +02:00
Max Kellermann
445c11b8d9 increment version number to 0.20.9 2017-05-29 20:36:08 +02:00
Max Kellermann
8d290ad509 release v0.20.8 2017-05-19 20:10:22 +02:00
Max Kellermann
b90c48b50f .travis.yml: enable Mac OS X 2017-05-19 19:54:27 +02:00
Max Kellermann
d19e7db09e .travis.yml: add shell variable OPTIONS 2017-05-19 19:54:27 +02:00
Max Kellermann
9939904b02 .travis.yml: configure with --disable-silent-rules --disable-dependency-tracking 2017-05-19 19:54:27 +02:00
Max Kellermann
ca23b15f5c test/test_byte_reverse: move "alignas" attribute to the front
Apparently, this makes old clang versions happy ("'alignas' attribute
cannot be applied to types).
2017-05-19 19:45:42 +02:00
Mario Di Raimondo
ffa676f577 playlist/m3u: support for mime-type audio-mpegurl for M3U playlists 2017-05-19 15:25:58 +02:00
Max Kellermann
6d023c4df3 .travis.yml: remove the unnecessary "compiler" setting 2017-05-17 16:22:19 +02:00
Max Kellermann
b31bd37a30 .travis.yml: check $TRAVIS_OS_NAME
Prepare for Mac OS X support by omitting those Ubuntu-specific
commands.
2017-05-17 15:59:25 +02:00
Max Kellermann
78faee8c7c .travis.yml: choose compiler with environment variables
.. and not update-alternatives, which requires "sudo".
2017-05-17 15:56:19 +02:00
Max Kellermann
40e2a703d0 .travis.yml: parallel build 2017-05-17 15:36:59 +02:00
Max Kellermann
b01edcb9bc .travis.yml: indent 2 2017-05-17 15:27:40 +02:00
André Klitzing
f7fffc9be8 Add initial travis configuration 2017-05-16 07:37:46 +02:00
Max Kellermann
50e8634097 python/build/libs: upgrade FFmpeg to 3.3.1 2017-05-16 07:27:08 +02:00
Max Kellermann
e3994e517e INSTALL: merge into doc/user.xml 2017-05-16 07:24:02 +02:00
Max Kellermann
2bb7785189 doc/user.xml: add sticker documentation 2017-05-16 07:23:57 +02:00
Max Kellermann
90c8408111 doc/user.xml: add Zeroconf documentation 2017-05-16 07:23:52 +02:00
Max Kellermann
64786ec12a Main: omit "constexpr" on MIN_BUFFER_SIZE with GCC 4.x 2017-05-16 07:20:47 +02:00
Max Kellermann
b3c82f8886 output/{osx,haiku,pulse,sles}: add missing "noexcept"
Fixes build failure on OS X, closes .  With the other plugins,
that's not critical, because those use the AudioOutputWrapper, which
hides this problem.
2017-05-16 07:12:30 +02:00
Max Kellermann
063259dc52 increment version number to 0.20.8 2017-05-16 07:06:57 +02:00
86 changed files with 492 additions and 508 deletions
.travis.ymlINSTALLNEWSREADME.mdconfigure.ac
doc
python/build
src
test

36
.travis.yml Normal file

@@ -0,0 +1,36 @@
dist: trusty
language: cpp
addons:
apt:
packages:
- libcppunit-dev
- libboost-dev
os:
- linux
- osx
env:
global:
- MAKEFLAGS="-j2"
before_install:
# C++14
- test "$TRAVIS_OS_NAME" != "linux" || sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
- test "$TRAVIS_OS_NAME" != "linux" || sudo apt-get update -qq
- test "$TRAVIS_OS_NAME" != "osx" || brew update
install:
# C++14
- test "$TRAVIS_OS_NAME" != "linux" || sudo apt-get install -qq g++-5
- test "$TRAVIS_OS_NAME" != "osx" || brew install cppunit
script:
- OPTIONS="--enable-test"
- test "$TRAVIS_OS_NAME" != "linux" || export CC=gcc-5 CXX=g++-5
- test "$TRAVIS_OS_NAME" != "osx" || OPTIONS="$OPTIONS --enable-osx"
- ./autogen.sh
- ./configure --disable-silent-rules --disable-dependency-tracking $OPTIONS
- make
- make check

206
INSTALL

@@ -1,206 +0,0 @@
Music Player Daemon (MPD) - INSTALL
Introduction
------------
This document is a very small amount of documentation about what is needed to
install MPD. If more information is desired, read the user manual:
http://www.musicpd.org/doc/user/
Dependencies
------------
gcc 4.7 or later - http://gcc.gnu.org/
clang 3.2 or later - http://clang.llvm.org/
Any other C++11 compliant compiler should also work.
Boost 1.46 - http://www.boost.org/
Optional Output Dependencies
----------------------------
You will need at least one of these to compile MPD.
Most of these are available as packages on major distributions. Be sure to
install both the library package as well as the development package.
AO - http://www.xiph.org/ao/
A portable library that abstracts many audio output types as one API. Should
be used only if there is no native plugin available or if the native plugin
doesn't work. You will need libao.
ALSA - http://www.alsa-project.org/
The Advanced Linux Sound Architecture. Recommended audio output if you use
Linux. You will need libasound.
FIFO
This is a mostly undocumented, developer plugin to transmit raw data.
OSS - http://www.opensound.com
Open Sound System.
PulseAudio - http://www.pulseaudio.org/
An advanced sound daemon. You will need libpulse.
JACK - http://www.jackaudio.org/
A low-latency sound daemon.
libshout - http://www.icecast.org/
For streaming to an Icecast or Shoutcast server.
You also need an encoder: either libvorbisenc (ogg), or liblame (mp3).
OpenAL - http://kcat.strangesoft.net/openal.html
Open Audio Library
Optional Input Dependencies
---------------------------
You will need at least one of these to compile MPD.
Most of these are available as packages on major distributions. Be sure to
install both the library package as well as the development package.
MAD - http://www.underbit.com/products/mad/
For MP3 support. You will need libmad, and optionally libid3tag if you want
ID3 tag support.
libmpg123 - http://www.mpg123.de/
Alternative for MP3 support.
Ogg Vorbis - http://www.xiph.org/ogg/vorbis/
For Ogg Vorbis support. You will need libogg and libvorbis.
libopus - http://www.opus-codec.org/
Opus codec support
FLAC - http://flac.sourceforge.net/
For FLAC support. You will need version 1.2 or higher of libFLAC.
Audio File - http://www.68k.org/~michael/audiofile/
For WAVE, AIFF, and AU support. You will need libaudiofile.
FAAD2 - http://www.audiocoding.com/
For MP4/AAC support.
libmpcdec - http://www.musepack.net/
For Musepack support.
MikMod - http://mikmod.raphnet.net/
For MOD support. You will need libmikmod.
libavcodec, libavformat (ffmpeg or libav) - http://ffmpeg.mplayerhq.hu/ http://libav.org/
Multi-codec library.
libsidplay2 - http://sidplay2.sourceforge.net/
For C64 SID support.
libfluidsynth - http://fluidsynth.resonance.org/
For MIDI support.
libwildmidi 0.2.3 - http://wildmidi.sourceforge.net/
For MIDI support.
libsndfile - http://www.mega-nerd.com/libsndfile/
WAVE, AIFF, and many others.
libwavpack - http://www.wavpack.com/
For WavPack playback.
libadplug - http://adplug.sourceforge.net/
For AdLib playback.
Optional Miscellaneous Dependencies
-----------------------------------
Avahi - http://www.avahi.org/
For Zeroconf support.
libsamplerate - http://www.mega-nerd.com/SRC/
For advanced samplerate conversions.
libcurl - http://curl.haxx.se/
For playing HTTP streams.
libmms - https://launchpad.net/libmms
For playing MMS streams.
SQLite - http://www.sqlite.org/
For the sticker database.
libcdio - http://www.gnu.org/software/libcdio/
For playing audio CDs.
libsystemd-daemon - http://freedesktop.org/wiki/Software/systemd/
For systemd activation.
pkg-config
----------
MPD uses pkg-config to locate most external libraries. If you do not
have pkg-config, or if your version of the library does not ship the
".pc" file, you have to provide the library's build options in
environment variables. These variables are documented in "./configure
--help". Example:
FLAC_CFLAGS=-I/usr/include/FLAC FLAC_LIBS=-lFLAC ./configure
Download
--------
Get the latest release from of MPD from <http://www.musicpd.org/>.
Compile
-------
1) unpack the archive
$ tar xf mpd-x.x.x.tar.xz
2) change to directory created
$ cd mpd-x.x.x
3) Run configure script (this will determine what dependencies you have)
$ ./configure
4) Compile
$ make
Install (Optional)
-------
(as root)
$ make install
Run
---
1) run mpd:
$ mpd <config file>
First default is $XDG_CONFIG_HOME/mpd/mpd.conf then ~/.mpdconf then
~/.mpd/mpd.conf then /etc/mpd.conf. If neither of these exist a mpd
configuration file must be specified at runtime.
A sample config file is included with the source of MPD, mpdconf.example.
The first time MPD is run it will attempt to discover all music in your
music root, recursively. This can be affected by the symbolic link
options specified in the example mpd.conf.
Using MPD
---------
You can download many different interfaces for MPD at
http://www.musicpd.org/clients/

13
NEWS

@@ -1,3 +1,16 @@
ver 0.20.9 (2017/06/04)
* decoder
- ffmpeg: support *.adx
* fix byte order detection on FreeBSD/aarch64
* fix more random crashes when compiled with clang
ver 0.20.8 (2017/05/19)
* output
- osx: fix build failure due to missing "noexcept"
* playlist
- m3u: support MIME type `audio/mpegurl`
* fix build failure with GCC 4.x
ver 0.20.7 (2017/05/15)
* database
- simple: fix false positive directory loop detection with NFS

@@ -7,7 +7,8 @@ server's audio device. The daemon stores info about all available music,
and this info can be easily searched and retrieved. Player control, info
retrieval, and playlist management can all be managed remotely.
For basic installation information see the INSTALL file.
For basic installation instructions
[read the manual](https://www.musicpd.org/doc/user/install.html).
# Users

@@ -1,10 +1,10 @@
AC_PREREQ(2.60)
AC_INIT(mpd, 0.20.7, musicpd-dev-team@lists.sourceforge.net)
AC_INIT(mpd, 0.20.9, musicpd-dev-team@lists.sourceforge.net)
VERSION_MAJOR=0
VERSION_MINOR=20
VERSION_REVISION=7
VERSION_REVISION=9
VERSION_EXTRA=0
AC_CONFIG_SRCDIR([src/Main.cxx])

@@ -80,8 +80,35 @@
cd mpd-version</programlisting>
<para>
Make sure that all the required libraries and build tools are
installed. The <filename>INSTALL</filename> file has a list.
In any case, you need:
</para>
<itemizedlist>
<listitem>
<para>
a C++14 compiler (e.g. <ulink
url="http://gcc.gnu.org/">gcc 4.9</ulink> or <ulink
url="http://clang.llvm.org/">clang 3.9</ulink>)
</para>
</listitem>
<listitem>
<para>
<ulink url="http://www.boost.org/">Boost 1.46</ulink>
</para>
</listitem>
<listitem>
<para>
<ulink url="https://www.freedesktop.org/wiki/Software/pkg-config/">pkg-config</ulink>
</para>
</listitem>
</itemizedlist>
<para>
Each plugin usually needs a codec library, which you also need
to install. Check the plugin reference for details about
required libraries.
</para>
<para>
@@ -1035,6 +1062,40 @@ systemctl start mpd.socket</programlisting>
</informaltable>
</section>
<section id="stickers">
<title>The Sticker Database</title>
<para>
"Stickers" are pieces of information attached to songs.
Some clients use them to store ratings and other volatile
data. This feature requires <ulink
url="http://www.sqlite.org/">SQLite</ulink>, compile-time
configure option <parameter>--enable-sqlite</parameter>.
</para>
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>Setting</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>
<varname>sticker_file</varname>
<parameter>PATH</parameter>
</entry>
<entry>
The location of the sticker database.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</section>
<section>
<title>Resource Limitations</title>
@@ -1165,6 +1226,55 @@ systemctl start mpd.socket</programlisting>
</tgroup>
</informaltable>
</section>
<section id="zeroconf">
<title>Zeroconf</title>
<para>
If Zeroconf support (<ulink
url="http://avahi.org/">Avahi</ulink> or Apple's Bonjour)
was enabled at compile time with
<parameter>--with-zeroconf=...</parameter>, MPD can announce
its presence on the network. The following settings control
this feature:
</para>
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>Setting</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>
<varname>zeroconf_enabled</varname>
<parameter>yes|no</parameter>
</entry>
<entry>
Enables or disables this feature. Default is
<parameter>yes</parameter>.
</entry>
</row>
<row>
<entry>
<varname>zeroconf_name</varname>
<parameter>NAME</parameter>
</entry>
<entry>
The service name to publish via Zeroconf. The
default is "<parameter>Music Player</parameter>".
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</section>
</section>
</chapter>
@@ -2078,7 +2188,9 @@ run</programlisting>
<title><varname>cdio_paranoia</varname></title>
<para>
Plays audio CDs. The URI has the form:
Plays audio CDs using <ulink
url="http://www.gnu.org/software/libcdio/"><filename>libcdio</filename></ulink>.
The URI has the form:
"<filename>cdda://[DEVICE][/TRACK]</filename>". The
simplest form <filename>cdda://</filename> plays the whole
disc in the default drive.
@@ -2114,7 +2226,8 @@ run</programlisting>
<title><varname>curl</varname></title>
<para>
Opens remote files or streams over HTTP.
Opens remote files or streams over HTTP using <ulink
url="http://curl.haxx.se/"><filename>libcurl</filename></ulink>.
</para>
<para>
@@ -2207,7 +2320,8 @@ run</programlisting>
<title><varname>mms</varname></title>
<para>
Plays streams with the MMS protocol.
Plays streams with the MMS protocol using <ulink
url="https://launchpad.net/libmms"><filename>libmms</filename></ulink>.
</para>
</section>
@@ -2263,7 +2377,8 @@ run</programlisting>
<title><varname>adplug</varname></title>
<para>
Decodes AdLib files.
Decodes AdLib files using <ulink
url="http://adplug.sourceforge.net/">libadplug</ulink>.
</para>
<informaltable>
@@ -2294,8 +2409,8 @@ run</programlisting>
<title><varname>audiofile</varname></title>
<para>
Decodes WAV and AIFF files using
<filename>libaudiofile</filename>.
Decodes WAV and AIFF files using <ulink
url="http://audiofile.68k.org/"><filename>libaudiofile</filename></ulink>.
</para>
</section>
@@ -2303,7 +2418,8 @@ run</programlisting>
<title><varname>faad</varname></title>
<para>
Decodes AAC files using <filename>libfaad</filename>.
Decodes AAC files using <ulink
url="http://www.audiocoding.com/"><filename>libfaad</filename></ulink>.
</para>
</section>
@@ -2311,8 +2427,8 @@ run</programlisting>
<title><varname>ffmpeg</varname></title>
<para>
Decodes various codecs using
<application>FFmpeg</application>.
Decodes various codecs using <ulink
url="https://ffmpeg.org/"><application>FFmpeg</application></ulink>.
</para>
<informaltable>
@@ -2363,7 +2479,7 @@ run</programlisting>
<para>
Decodes FLAC files using
<application>libFLAC</application>.
<ulink url="https://xiph.org/flac/"><application>libFLAC</application></ulink>.
</para>
</section>
@@ -2483,7 +2599,8 @@ run</programlisting>
<title><varname>mad</varname></title>
<para>
Decodes MP3 files using <application>libmad</application>.
Decodes MP3 files using <ulink
url="http://www.underbit.com/products/mad/"><application>libmad</application></ulink>.
</para>
</section>
@@ -2563,8 +2680,8 @@ run</programlisting>
<title><varname>mpcdec</varname></title>
<para>
Decodes Musepack files using
<application>libmpcdec</application>.
Decodes Musepack files using <ulink
url="http://www.musepack.net/"><application>libmpcdec</application></ulink>.
</para>
</section>
@@ -2572,7 +2689,17 @@ run</programlisting>
<title><varname>mpg123</varname></title>
<para>
Decodes MP3 files using <application>libmpg123</application>.
Decodes MP3 files using <ulink
url="http://www.mpg123.de/"><application>libmpg123</application></ulink>.
</para>
</section>
<section id="opus_decoder">
<title><varname>opus</varname></title>
<para>
Decodes Opus files using <ulink
url="http://www.opus-codec.org/"><application>libopus</application></ulink>.
</para>
</section>
@@ -2592,8 +2719,8 @@ run</programlisting>
<title><varname>sidplay</varname></title>
<para>
C64 SID decoder based on
<application>libsidplay</application>.
C64 SID decoder based on <ulink
url="http://sidplay2.sourceforge.net/"><application>libsidplay</application></ulink>.
</para>
<informaltable>
@@ -2649,8 +2776,8 @@ run</programlisting>
<title><varname>sndfile</varname></title>
<para>
Decodes WAV and AIFF files using
<filename>libsndfile</filename>.
Decodes WAV and AIFF files using <ulink
url="http://www.mega-nerd.com/libsndfile/"><filename>libsndfile</filename></ulink>.
</para>
</section>
@@ -2658,8 +2785,8 @@ run</programlisting>
<title><varname>vorbis</varname></title>
<para>
Decodes Ogg-Vorbis files using
<application>libvorbis</application>.
Decodes Ogg-Vorbis files using <ulink
url="http://www.xiph.org/ogg/vorbis/"><application>libvorbis</application></ulink>.
</para>
</section>
@@ -2668,7 +2795,7 @@ run</programlisting>
<para>
Decodes WavPack files using
<application>libwavpack</application>.
<ulink url="http://www.wavpack.com/"><application>libwavpack</application></ulink>.
</para>
</section>
@@ -3492,7 +3619,7 @@ run</programlisting>
</informaltable>
</section>
<section>
<section id="jack_output">
<title><varname>jack</varname></title>
<para>
@@ -3772,7 +3899,7 @@ run</programlisting>
</informaltable>
</section>
<section>
<section id="openal_output">
<title><varname>openal</varname></title>
<para>
@@ -3923,7 +4050,7 @@ run</programlisting>
<para>
The <varname>pulse</varname> plugin connects to a <ulink
url="http://www.freedesktop.org/wiki/Software/PulseAudio/"><application>PulseAudio</application></ulink>
server.
server. Requires <filename>libpulse</filename>.
</para>
<informaltable>
@@ -4111,7 +4238,8 @@ run</programlisting>
url="http://www.shoutcast.com/"><application>ShoutCast</application></ulink>
or <ulink
url="http://icecast.org/"><application>IceCast</application></ulink>
server. It forwards tags to this server.
server using <filename>libshout</filename>. It forwards
tags to this server.
</para>
<para>

@@ -58,8 +58,8 @@ libmad = AutotoolsProject(
)
ffmpeg = FfmpegProject(
'http://ffmpeg.org/releases/ffmpeg-3.3.tar.xz',
'599e7f7c017221c22011c4037b88bdcd1c47cd40c1e466838bc3c465f3e9569d',
'http://ffmpeg.org/releases/ffmpeg-3.3.1.tar.xz',
'b702a7fc656ac23e276b8c823a2f646e4e6f6309bb2788435a708e69bea98f2f',
'lib/libavcodec.a',
[
'--disable-shared', '--enable-static',

@@ -127,7 +127,7 @@ struct AudioFormat {
void ApplyMask(AudioFormat mask) noexcept;
gcc_pure
AudioFormat WithMask(AudioFormat mask) const {
AudioFormat WithMask(AudioFormat mask) const noexcept {
AudioFormat result = *this;
result.ApplyMask(mask);
return result;

@@ -152,7 +152,7 @@ public:
bool IsRemote() const noexcept;
gcc_pure
bool IsFile() const {
bool IsFile() const noexcept {
return !IsRemote();
}
@@ -162,11 +162,11 @@ public:
gcc_pure
bool IsInDatabase() const noexcept;
const Tag &GetTag() const {
const Tag &GetTag() const noexcept {
return tag;
}
Tag &WritableTag() {
Tag &WritableTag() noexcept {
return tag;
}

@@ -121,8 +121,16 @@ static constexpr size_t KILOBYTE = 1024;
static constexpr size_t MEGABYTE = 1024 * KILOBYTE;
static constexpr size_t DEFAULT_BUFFER_SIZE = 4 * MEGABYTE;
static constexpr size_t MIN_BUFFER_SIZE = std::max(CHUNK_SIZE * 32,
64 * KILOBYTE);
static
#if GCC_OLDER_THAN(5,0)
/* gcc 4.x has no "constexpr" for std::max() */
const
#else
constexpr
#endif
size_t MIN_BUFFER_SIZE = std::max(CHUNK_SIZE * 32,
64 * KILOBYTE);
static constexpr unsigned DEFAULT_BUFFER_BEFORE_PLAY = 10;

@@ -31,45 +31,45 @@ class MixRampInfo {
public:
MixRampInfo() = default;
void Clear() {
void Clear() noexcept {
start.clear();
end.clear();
}
gcc_pure
bool IsDefined() const {
bool IsDefined() const noexcept {
return !start.empty() || !end.empty();
}
gcc_pure
const char *GetStart() const {
const char *GetStart() const noexcept {
return start.empty() ? nullptr : start.c_str();
}
gcc_pure
const char *GetEnd() const {
const char *GetEnd() const noexcept {
return end.empty() ? nullptr : end.c_str();
}
void SetStart(const char *new_value) {
void SetStart(const char *new_value) noexcept {
if (new_value == nullptr)
start.clear();
else
start = new_value;
}
void SetStart(std::string &&new_value) {
void SetStart(std::string &&new_value) noexcept {
start = std::move(new_value);
}
void SetEnd(const char *new_value) {
void SetEnd(const char *new_value) noexcept {
if (new_value == nullptr)
end.clear();
else
end = new_value;
}
void SetEnd(std::string &&new_value) {
void SetEnd(std::string &&new_value) noexcept {
end = std::move(new_value);
}
};

@@ -60,7 +60,7 @@ public:
* music_buffer_new().
*/
gcc_pure
unsigned GetSize() const {
unsigned GetSize() const noexcept {
return buffer.GetCapacity();
}

@@ -39,7 +39,7 @@ MusicPipe::Contains(const MusicChunk *chunk) const noexcept
#endif
MusicChunk *
MusicPipe::Shift()
MusicPipe::Shift() noexcept
{
const std::lock_guard<Mutex> protect(mutex);
@@ -73,7 +73,7 @@ MusicPipe::Shift()
}
void
MusicPipe::Clear(MusicBuffer &buffer)
MusicPipe::Clear(MusicBuffer &buffer) noexcept
{
MusicChunk *chunk;
@@ -82,7 +82,7 @@ MusicPipe::Clear(MusicBuffer &buffer)
}
void
MusicPipe::Push(MusicChunk *chunk)
MusicPipe::Push(MusicChunk *chunk) noexcept
{
assert(!chunk->IsEmpty());
assert(chunk->length == 0 || chunk->audio_format.IsValid());

@@ -77,7 +77,7 @@ public:
* audio_format.
*/
gcc_pure
bool CheckFormat(AudioFormat other) const {
bool CheckFormat(AudioFormat other) const noexcept {
return !audio_format.IsDefined() ||
audio_format == other;
}
@@ -94,37 +94,37 @@ public:
* nullptr if the pipe is empty.
*/
gcc_pure
const MusicChunk *Peek() const {
const MusicChunk *Peek() const noexcept {
return head;
}
/**
* Removes the first chunk from the head, and returns it.
*/
MusicChunk *Shift();
MusicChunk *Shift() noexcept;
/**
* Clears the whole pipe and returns the chunks to the buffer.
*
* @param buffer the buffer object to return the chunks to
*/
void Clear(MusicBuffer &buffer);
void Clear(MusicBuffer &buffer) noexcept;
/**
* Pushes a chunk to the tail of the pipe.
*/
void Push(MusicChunk *chunk);
void Push(MusicChunk *chunk) noexcept;
/**
* Returns the number of chunks currently in this pipe.
*/
gcc_pure
unsigned GetSize() const {
unsigned GetSize() const noexcept {
return size;
}
gcc_pure
bool IsEmpty() const {
bool IsEmpty() const noexcept {
return GetSize() == 0;
}
};

@@ -100,7 +100,7 @@ public:
}
gcc_pure
bool IsExpired() const {
bool IsExpired() const noexcept {
return !FullyBufferedSocket::IsDefined();
}

@@ -45,68 +45,57 @@ public:
: default_value;
}
gcc_pure
int ParseInt(unsigned idx) const {
assert(idx < size);
return ParseCommandArgInt(data[idx]);
}
gcc_pure
int ParseInt(unsigned idx, int min_value, int max_value) const {
assert(idx < size);
return ParseCommandArgInt(data[idx], min_value, max_value);
}
gcc_pure
int ParseUnsigned(unsigned idx) const {
assert(idx < size);
return ParseCommandArgUnsigned(data[idx]);
}
gcc_pure
int ParseUnsigned(unsigned idx, unsigned max_value) const {
assert(idx < size);
return ParseCommandArgUnsigned(data[idx], max_value);
}
gcc_pure
bool ParseBool(unsigned idx) const {
assert(idx < size);
return ParseCommandArgBool(data[idx]);
}
gcc_pure
RangeArg ParseRange(unsigned idx) const {
assert(idx < size);
return ParseCommandArgRange(data[idx]);
}
gcc_pure
float ParseFloat(unsigned idx) const {
assert(idx < size);
return ParseCommandArgFloat(data[idx]);
}
gcc_pure
SongTime ParseSongTime(unsigned idx) const {
assert(idx < size);
return ParseCommandArgSongTime(data[idx]);
}
gcc_pure
SignedSongTime ParseSignedSongTime(unsigned idx) const {
assert(idx < size);
return ParseCommandArgSignedSongTime(data[idx]);
}
gcc_pure
int ParseOptional(unsigned idx, int default_value) const {
return idx < size
? ParseInt(idx)
: default_value;
}
gcc_pure
RangeArg ParseOptional(unsigned idx, RangeArg default_value) const {
return idx < size
? ParseRange(idx)

@@ -82,12 +82,12 @@ struct ConfigBlock {
* object that was synthesized and not loaded from a
* configuration file.
*/
bool IsNull() const {
bool IsNull() const noexcept {
return line < 0;
}
gcc_pure
bool IsEmpty() const {
bool IsEmpty() const noexcept {
return block_params.empty();
}

@@ -29,7 +29,7 @@
struct StringLess {
gcc_pure
bool operator()(const char *a, const char *b) const {
bool operator()(const char *a, const char *b) const noexcept {
return strcmp(a, b) < 0;
}
};

@@ -106,7 +106,6 @@ public:
TagType tag_type, tag_mask_t group_mask,
VisitTag visit_tag) const = 0;
gcc_pure
virtual DatabaseStats GetStats(const DatabaseSelection &selection) const = 0;
/**
@@ -127,7 +126,7 @@ public:
* Returns 0 if that is not not known/available.
*/
gcc_pure
virtual time_t GetUpdateStamp() const = 0;
virtual time_t GetUpdateStamp() const noexcept = 0;
};
#endif

@@ -44,16 +44,16 @@ struct LightDirectory {
constexpr LightDirectory(const char *_uri, time_t _mtime)
:uri(_uri), mtime(_mtime) {}
static constexpr LightDirectory Root() {
static constexpr LightDirectory Root() noexcept {
return LightDirectory("", 0);
}
bool IsRoot() const {
bool IsRoot() const noexcept {
return *uri == 0;
}
gcc_pure
const char *GetPath() const {
const char *GetPath() const noexcept {
return uri;
}
};

@@ -45,7 +45,7 @@ struct PlaylistInfo {
constexpr CompareName(const char *_name):name(_name) {}
gcc_pure
bool operator()(const PlaylistInfo &pi) const {
bool operator()(const PlaylistInfo &pi) const noexcept {
return pi.name.compare(name) == 0;
}
};

@@ -127,7 +127,7 @@ public:
unsigned Update(const char *uri_utf8, bool discard) override;
time_t GetUpdateStamp() const override {
time_t GetUpdateStamp() const noexcept override {
return update_stamp;
}

@@ -187,7 +187,7 @@ public:
}
gcc_pure
const char *GetPath() const {
const char *GetPath() const noexcept {
return path.c_str();
}

@@ -76,7 +76,7 @@ public:
const ConfigBlock &block);
gcc_pure
Directory &GetRoot() {
Directory &GetRoot() noexcept {
assert(root != NULL);
return *root;
@@ -125,7 +125,7 @@ public:
DatabaseStats GetStats(const DatabaseSelection &selection) const override;
time_t GetUpdateStamp() const override {
time_t GetUpdateStamp() const noexcept override {
return mtime;
}

@@ -60,7 +60,7 @@ public:
* Parent's ObjectId
*/
std::string parent_id;
std::string url;
/**
@@ -80,7 +80,7 @@ public:
UPnPDirObject &operator=(UPnPDirObject &&) = default;
void Clear() {
void Clear() noexcept {
id.clear();
parent_id.clear();
url.clear();
@@ -90,7 +90,7 @@ public:
}
gcc_pure
bool Check() const {
bool Check() const noexcept {
return !id.empty() && !parent_id.empty() && !name.empty() &&
(type != UPnPDirObject::Type::ITEM ||
item_class != UPnPDirObject::ItemClass::UNKNOWN);

@@ -93,7 +93,7 @@ public:
DatabaseStats GetStats(const DatabaseSelection &selection) const override;
time_t GetUpdateStamp() const override {
time_t GetUpdateStamp() const noexcept override {
return 0;
}

@@ -36,7 +36,7 @@
#include <string.h>
bool
ExcludeList::LoadFile(Path path_fs)
ExcludeList::LoadFile(Path path_fs) noexcept
try {
#ifdef HAVE_CLASS_GLOB
TextFile file(path_fs);
@@ -67,7 +67,7 @@ try {
}
bool
ExcludeList::Check(Path name_fs) const
ExcludeList::Check(Path name_fs) const noexcept
{
assert(!name_fs.IsNull());

@@ -50,7 +50,7 @@ public:
:parent(&_parent) {}
gcc_pure
bool IsEmpty() const {
bool IsEmpty() const noexcept {
#ifdef HAVE_CLASS_GLOB
return ((parent == nullptr) || parent->IsEmpty()) && patterns.empty();
#else
@@ -62,13 +62,13 @@ public:
/**
* Loads and parses a .mpdignore file.
*/
bool LoadFile(Path path_fs);
bool LoadFile(Path path_fs) noexcept;
/**
* Checks whether one of the patterns in the .mpdignore file matches
* the specified file name.
*/
bool Check(Path name_fs) const;
bool Check(Path name_fs) const noexcept;
};

@@ -277,7 +277,7 @@ DecoderBridge::Ready(const AudioFormat audio_format,
}
DecoderCommand
DecoderBridge::GetCommand()
DecoderBridge::GetCommand() noexcept
{
return LockGetVirtualCommand();
}
@@ -326,7 +326,7 @@ DecoderBridge::CommandFinished()
}
SongTime
DecoderBridge::GetSeekTime()
DecoderBridge::GetSeekTime() noexcept
{
assert(dc.pipe != nullptr);
@@ -341,7 +341,7 @@ DecoderBridge::GetSeekTime()
}
uint64_t
DecoderBridge::GetSeekFrame()
DecoderBridge::GetSeekFrame() noexcept
{
return GetSeekTime().ToScale<uint64_t>(dc.in_audio_format.sample_rate);
}

@@ -134,10 +134,10 @@ public:
/* virtual methods from DecoderClient */
void Ready(AudioFormat audio_format,
bool seekable, SignedSongTime duration) override;
DecoderCommand GetCommand() override;
DecoderCommand GetCommand() noexcept override;
void CommandFinished() override;
SongTime GetSeekTime() override;
uint64_t GetSeekFrame() override;
SongTime GetSeekTime() noexcept override;
uint64_t GetSeekFrame() noexcept override;
void SeekError() override;
InputStreamPtr OpenUri(const char *uri) override;
size_t Read(InputStream &is, void *buffer, size_t length) override;

@@ -58,7 +58,7 @@ public:
* command pending
*/
gcc_pure
virtual DecoderCommand GetCommand() = 0;
virtual DecoderCommand GetCommand() noexcept = 0;
/**
* Called by the decoder when it has performed the requested command
@@ -73,7 +73,7 @@ public:
* @return the destination position for the seek in milliseconds
*/
gcc_pure
virtual SongTime GetSeekTime() = 0;
virtual SongTime GetSeekTime() noexcept = 0;
/**
* Call this when you have received the DecoderCommand::SEEK command.
@@ -81,7 +81,7 @@ public:
* @return the destination position for the seek in frames
*/
gcc_pure
virtual uint64_t GetSeekFrame() = 0;
virtual uint64_t GetSeekFrame() noexcept = 0;
/**
* Call this instead of CommandFinished() when seeking has

@@ -54,11 +54,11 @@ public:
size_t _size)
:client(_client), is(_is), buffer(_size) {}
const InputStream &GetStream() const {
const InputStream &GetStream() const noexcept {
return is;
}
void Clear() {
void Clear() noexcept {
buffer.Clear();
}
@@ -75,7 +75,7 @@ public:
* How many bytes are stored in the buffer?
*/
gcc_pure
size_t GetAvailable() const {
size_t GetAvailable() const noexcept {
return buffer.GetAvailable();
}
@@ -84,7 +84,7 @@ public:
* you have to call Consume() to do that. The returned buffer
* becomes invalid after a Fill() or a Consume() call.
*/
ConstBuffer<void> Read() const {
ConstBuffer<void> Read() const noexcept {
auto r = buffer.Read();
return { r.data, r.size };
}
@@ -102,7 +102,7 @@ public:
*
* @param nbytes the number of bytes to consume
*/
void Consume(size_t nbytes) {
void Consume(size_t nbytes) noexcept {
buffer.Consume(nbytes);
}

@@ -227,29 +227,29 @@ struct DecoderControl {
}
gcc_pure
bool LockIsIdle() const {
bool LockIsIdle() const noexcept {
const std::lock_guard<Mutex> protect(mutex);
return IsIdle();
}
bool IsStarting() const {
bool IsStarting() const noexcept {
return state == DecoderState::START;
}
gcc_pure
bool LockIsStarting() const {
bool LockIsStarting() const noexcept {
const std::lock_guard<Mutex> protect(mutex);
return IsStarting();
}
bool HasFailed() const {
bool HasFailed() const noexcept {
assert(command == DecoderCommand::NONE);
return state == DecoderState::ERROR;
}
gcc_pure
bool LockHasFailed() const {
bool LockHasFailed() const noexcept {
const std::lock_guard<Mutex> protect(mutex);
return HasFailed();
}

@@ -881,7 +881,8 @@ ffmpeg_scan_stream(InputStream &is,
* more formats.
*/
static const char *const ffmpeg_suffixes[] = {
"16sv", "3g2", "3gp", "4xm", "8svx", "aa3", "aac", "ac3", "afc", "aif",
"16sv", "3g2", "3gp", "4xm", "8svx",
"aa3", "aac", "ac3", "adx", "afc", "aif",
"aifc", "aiff", "al", "alaw", "amr", "anim", "apc", "ape", "asf",
"atrac", "au", "aud", "avi", "avm2", "avs", "bap", "bfi", "c93", "cak",
"cin", "cmv", "cpk", "daud", "dct", "divx", "dts", "dv", "dvd", "dxa",
@@ -934,6 +935,7 @@ static const char *const ffmpeg_mime_types[] = {
"audio/x-16sv",
"audio/x-aac",
"audio/x-ac3",
"audio/x-adx",
"audio/x-aiff"
"audio/x-alaw",
"audio/x-au",

@@ -42,25 +42,27 @@ public:
return chain;
}
bool Read(const char *path) {
bool Read(const char *path) noexcept {
return ::FLAC__metadata_chain_read(chain, path);
}
bool Read(FLAC__IOHandle handle, FLAC__IOCallbacks callbacks) {
bool Read(FLAC__IOHandle handle,
FLAC__IOCallbacks callbacks) noexcept {
return ::FLAC__metadata_chain_read_with_callbacks(chain,
handle,
callbacks);
}
bool Read(InputStream &is) {
bool Read(InputStream &is) noexcept {
return Read(::ToFlacIOHandle(is), ::GetFlacIOCallbacks(is));
}
bool ReadOgg(const char *path) {
bool ReadOgg(const char *path) noexcept {
return ::FLAC__metadata_chain_read_ogg(chain, path);
}
bool ReadOgg(FLAC__IOHandle handle, FLAC__IOCallbacks callbacks) {
bool ReadOgg(FLAC__IOHandle handle,
FLAC__IOCallbacks callbacks) noexcept {
return ::FLAC__metadata_chain_read_ogg_with_callbacks(chain,
handle,
callbacks);
@@ -71,12 +73,12 @@ public:
}
gcc_pure
FLAC__Metadata_ChainStatus GetStatus() const {
FLAC__Metadata_ChainStatus GetStatus() const noexcept {
return ::FLAC__metadata_chain_status(chain);
}
gcc_pure
const char *GetStatusString() const {
const char *GetStatusString() const noexcept {
return FLAC__Metadata_ChainStatusString[GetStatus()];
}
@@ -99,12 +101,12 @@ public:
::FLAC__metadata_iterator_delete(iterator);
}
bool Next() {
bool Next() noexcept {
return ::FLAC__metadata_iterator_next(iterator);
}
gcc_pure
FLAC__StreamMetadata *GetBlock() {
FLAC__StreamMetadata *GetBlock() noexcept {
return ::FLAC__metadata_iterator_get_block(iterator);
}
};

@@ -52,14 +52,14 @@ static constexpr unsigned opus_output_buffer_frames = opus_sample_rate / 4;
gcc_pure
static bool
IsOpusHead(const ogg_packet &packet)
IsOpusHead(const ogg_packet &packet) noexcept
{
return packet.bytes >= 8 && memcmp(packet.packet, "OpusHead", 8) == 0;
}
gcc_pure
static bool
IsOpusTags(const ogg_packet &packet)
IsOpusTags(const ogg_packet &packet) noexcept
{
return packet.bytes >= 8 && memcmp(packet.packet, "OpusTags", 8) == 0;
}

@@ -199,7 +199,7 @@ public:
* Are we currently running inside this EventLoop's thread?
*/
gcc_pure
bool IsInside() const {
bool IsInside() const noexcept {
assert(!thread.IsNull());
return thread.IsInside();
@@ -207,7 +207,7 @@ public:
#ifndef NDEBUG
gcc_pure
bool IsInsideOrVirgin() const {
bool IsInsideOrVirgin() const noexcept {
return virgin || IsInside();
}
#endif
@@ -219,7 +219,7 @@ public:
* are not yet/anymore handled.
*/
gcc_pure
bool IsInsideOrNull() const {
bool IsInsideOrNull() const noexcept {
return thread.IsNull() || thread.IsInside();
}
};

@@ -77,12 +77,12 @@ public:
* @see IsNull()
*/
gcc_const
static AllocatedPath Null() {
static AllocatedPath Null() noexcept {
return AllocatedPath(nullptr);
}
gcc_pure
operator Path() const {
operator Path() const noexcept {
return Path::FromFS(c_str());
}
@@ -90,36 +90,39 @@ public:
* Join two path components with the path separator.
*/
gcc_pure gcc_nonnull_all
static AllocatedPath Build(const_pointer_type a, const_pointer_type b) {
static AllocatedPath Build(const_pointer_type a,
const_pointer_type b) noexcept {
return Build(a, PathTraitsFS::GetLength(a),
b, PathTraitsFS::GetLength(b));
}
gcc_pure gcc_nonnull_all
static AllocatedPath Build(Path a, const_pointer_type b) {
static AllocatedPath Build(Path a, const_pointer_type b) noexcept {
return Build(a.c_str(), b);
}
gcc_pure gcc_nonnull_all
static AllocatedPath Build(Path a, Path b) {
static AllocatedPath Build(Path a, Path b) noexcept {
return Build(a, b.c_str());
}
gcc_pure gcc_nonnull_all
static AllocatedPath Build(const_pointer_type a, const AllocatedPath &b) {
static AllocatedPath Build(const_pointer_type a,
const AllocatedPath &b) noexcept {
return Build(a, PathTraitsFS::GetLength(a),
b.value.c_str(), b.value.size());
}
gcc_pure gcc_nonnull_all
static AllocatedPath Build(const AllocatedPath &a, const_pointer_type b) {
static AllocatedPath Build(const AllocatedPath &a,
const_pointer_type b) noexcept {
return Build(a.value.c_str(), a.value.size(),
b, PathTraitsFS::GetLength(b));
}
gcc_pure
static AllocatedPath Build(const AllocatedPath &a,
const AllocatedPath &b) {
const AllocatedPath &b) noexcept {
return Build(a.value.c_str(), a.value.size(),
b.value.c_str(), b.value.size());
}
@@ -129,13 +132,13 @@ public:
* character set to a #Path instance.
*/
gcc_pure
static AllocatedPath FromFS(const_pointer_type fs) {
static AllocatedPath FromFS(const_pointer_type fs) noexcept {
return AllocatedPath(fs);
}
gcc_pure
static AllocatedPath FromFS(const_pointer_type _begin,
const_pointer_type _end) {
const_pointer_type _end) noexcept {
return AllocatedPath(_begin, _end);
}
@@ -144,7 +147,7 @@ public:
* character set to a #Path instance.
*/
gcc_pure
static AllocatedPath FromFS(string &&fs) {
static AllocatedPath FromFS(string &&fs) noexcept {
return AllocatedPath(std::move(fs));
}
@@ -176,12 +179,12 @@ public:
}
gcc_pure
bool operator==(const AllocatedPath &other) const {
bool operator==(const AllocatedPath &other) const noexcept {
return value == other.value;
}
gcc_pure
bool operator!=(const AllocatedPath &other) const {
bool operator!=(const AllocatedPath &other) const noexcept {
return value != other.value;
}
@@ -197,7 +200,7 @@ public:
* Check if this is a "nulled" instance. A "nulled" instance
* must not be used.
*/
bool IsNull() const {
bool IsNull() const noexcept {
return value.empty();
}
@@ -206,7 +209,7 @@ public:
*
* @see IsNull()
*/
void SetNull() {
void SetNull() noexcept {
value.clear();
}
@@ -215,7 +218,7 @@ public:
* elements (which may not be the number of characters).
*/
gcc_pure
size_t length() const {
size_t length() const noexcept {
return value.length();
}
@@ -225,7 +228,7 @@ public:
* instance ends.
*/
gcc_pure
const_pointer_type c_str() const {
const_pointer_type c_str() const noexcept {
return value.c_str();
}
@@ -234,7 +237,7 @@ public:
* null-terminated.
*/
gcc_pure
const_pointer_type data() const {
const_pointer_type data() const noexcept {
return value.data();
}

@@ -54,7 +54,7 @@ public:
#endif
gcc_pure
bool Check(const char *name_fs) const {
bool Check(const char *name_fs) const noexcept {
#ifdef HAVE_FNMATCH
return fnmatch(pattern.c_str(), name_fs, 0) == 0;
#elif defined(WIN32)

@@ -92,7 +92,7 @@ public:
* elements (which may not be the number of characters).
*/
gcc_pure
size_t length() const {
size_t length() const noexcept {
assert(!IsNull());
return PathTraitsFS::GetLength(c_str());
@@ -104,7 +104,7 @@ public:
* instance ends.
*/
gcc_pure
const_pointer_type c_str() const {
const_pointer_type c_str() const noexcept {
return Base::c_str();
}
@@ -113,7 +113,7 @@ public:
* null-terminated.
*/
gcc_pure
const_pointer_type data() const {
const_pointer_type data() const noexcept {
return c_str();
}

@@ -63,7 +63,7 @@ struct PathTraitsFS {
static constexpr const_pointer_type CURRENT_DIRECTORY = PATH_LITERAL(".");
static constexpr bool IsSeparator(value_type ch) {
static constexpr bool IsSeparator(value_type ch) noexcept {
return
#ifdef WIN32
ch == '/' ||
@@ -72,7 +72,7 @@ struct PathTraitsFS {
}
gcc_pure gcc_nonnull_all
static const_pointer_type FindLastSeparator(const_pointer_type p) {
static const_pointer_type FindLastSeparator(const_pointer_type p) noexcept {
#if !CLANG_CHECK_VERSION(3,6)
/* disabled on clang due to -Wtautological-pointer-compare */
assert(p != nullptr);
@@ -90,13 +90,13 @@ struct PathTraitsFS {
#ifdef WIN32
gcc_pure gcc_nonnull_all
static constexpr bool IsDrive(const_pointer_type p) {
static constexpr bool IsDrive(const_pointer_type p) noexcept {
return IsAlphaASCII(p[0]) && p[1] == ':';
}
#endif
gcc_pure gcc_nonnull_all
static bool IsAbsolute(const_pointer_type p) {
static bool IsAbsolute(const_pointer_type p) noexcept {
#if !CLANG_CHECK_VERSION(3,6)
/* disabled on clang due to -Wtautological-pointer-compare */
assert(p != nullptr);
@@ -110,12 +110,12 @@ struct PathTraitsFS {
}
gcc_pure gcc_nonnull_all
static size_t GetLength(const_pointer_type p) {
static size_t GetLength(const_pointer_type p) noexcept {
return StringLength(p);
}
gcc_pure gcc_nonnull_all
static const_pointer_type Find(const_pointer_type p, value_type ch) {
static const_pointer_type Find(const_pointer_type p, value_type ch) noexcept {
return StringFind(p, ch);
}
@@ -179,7 +179,7 @@ struct PathTraitsUTF8 {
}
gcc_pure gcc_nonnull_all
static const_pointer_type FindLastSeparator(const_pointer_type p) {
static const_pointer_type FindLastSeparator(const_pointer_type p) noexcept {
#if !CLANG_CHECK_VERSION(3,6)
/* disabled on clang due to -Wtautological-pointer-compare */
assert(p != nullptr);
@@ -190,13 +190,13 @@ struct PathTraitsUTF8 {
#ifdef WIN32
gcc_pure gcc_nonnull_all
static constexpr bool IsDrive(const_pointer_type p) {
static constexpr bool IsDrive(const_pointer_type p) noexcept {
return IsAlphaASCII(p[0]) && p[1] == ':';
}
#endif
gcc_pure gcc_nonnull_all
static bool IsAbsolute(const_pointer_type p) {
static bool IsAbsolute(const_pointer_type p) noexcept {
#if !CLANG_CHECK_VERSION(3,6)
/* disabled on clang due to -Wtautological-pointer-compare */
assert(p != nullptr);
@@ -210,12 +210,12 @@ struct PathTraitsUTF8 {
}
gcc_pure gcc_nonnull_all
static size_t GetLength(const_pointer_type p) {
static size_t GetLength(const_pointer_type p) noexcept {
return StringLength(p);
}
gcc_pure gcc_nonnull_all
static const_pointer_type Find(const_pointer_type p, value_type ch) {
static const_pointer_type Find(const_pointer_type p, value_type ch) noexcept {
return StringFind(p, ch);
}
@@ -255,7 +255,7 @@ struct PathTraitsUTF8 {
const_pointer_type b, size_t b_size) noexcept;
gcc_pure gcc_nonnull_all
static string Build(const_pointer_type a, const_pointer_type b) {
static string Build(const_pointer_type a, const_pointer_type b) noexcept {
return Build(a, GetLength(a), b, GetLength(b));
}
};

@@ -67,7 +67,7 @@ BufferedReader::ReadFull(size_t size)
}
size_t
BufferedReader::ReadFromBuffer(WritableBuffer<void> dest)
BufferedReader::ReadFromBuffer(WritableBuffer<void> dest) noexcept
{
auto src = Read();
size_t nbytes = std::min(src.size, dest.size);

@@ -47,7 +47,7 @@ public:
* Reset the internal state. Should be called after rewinding
* the underlying #Reader.
*/
void Reset() {
void Reset() noexcept {
buffer.Clear();
eof = false;
line_number = 0;
@@ -56,7 +56,7 @@ public:
bool Fill(bool need_more);
gcc_pure
WritableBuffer<void> Read() const {
WritableBuffer<void> Read() const noexcept {
return buffer.Read().ToVoid();
}
@@ -67,7 +67,7 @@ public:
*/
void *ReadFull(size_t size);
void Consume(size_t n) {
void Consume(size_t n) noexcept {
buffer.Consume(n);
}
@@ -75,7 +75,7 @@ public:
* Read (and consume) data from the input buffer into the
* given buffer. Does not attempt to refill the buffer.
*/
size_t ReadFromBuffer(WritableBuffer<void> dest);
size_t ReadFromBuffer(WritableBuffer<void> dest) noexcept;
/**
* Read data into the given buffer and consume it from our
@@ -86,7 +86,7 @@ public:
char *ReadLine();
unsigned GetLineNumber() const {
unsigned GetLineNumber() const noexcept {
return line_number;
}
};

@@ -52,14 +52,14 @@ AsyncInputStream::~AsyncInputStream()
}
void
AsyncInputStream::SetTag(Tag *_tag)
AsyncInputStream::SetTag(Tag *_tag) noexcept
{
delete tag;
tag = _tag;
}
void
AsyncInputStream::Pause()
AsyncInputStream::Pause() noexcept
{
assert(io_thread_inside());
@@ -141,7 +141,7 @@ AsyncInputStream::Seek(offset_type new_offset)
}
void
AsyncInputStream::SeekDone()
AsyncInputStream::SeekDone() noexcept
{
assert(io_thread_inside());
assert(IsSeekPending());
@@ -201,7 +201,7 @@ AsyncInputStream::Read(void *ptr, size_t read_size)
}
void
AsyncInputStream::CommitWriteBuffer(size_t nbytes)
AsyncInputStream::CommitWriteBuffer(size_t nbytes) noexcept
{
buffer.Append(nbytes);
@@ -212,7 +212,7 @@ AsyncInputStream::CommitWriteBuffer(size_t nbytes)
}
void
AsyncInputStream::AppendToBuffer(const void *data, size_t append_size)
AsyncInputStream::AppendToBuffer(const void *data, size_t append_size) noexcept
{
auto w = buffer.Write();
assert(!w.IsEmpty());
@@ -238,7 +238,7 @@ AsyncInputStream::AppendToBuffer(const void *data, size_t append_size)
}
void
AsyncInputStream::DeferredResume()
AsyncInputStream::DeferredResume() noexcept
{
const std::lock_guard<Mutex> protect(mutex);
@@ -251,7 +251,7 @@ AsyncInputStream::DeferredResume()
}
void
AsyncInputStream::DeferredSeek()
AsyncInputStream::DeferredSeek() noexcept
{
const std::lock_guard<Mutex> protect(mutex);
if (seek_state != SeekState::SCHEDULED)

@@ -92,15 +92,15 @@ protected:
/**
* Pass an tag from the I/O thread to the client thread.
*/
void SetTag(Tag *_tag);
void SetTag(Tag *_tag) noexcept;
void ClearTag() {
void ClearTag() noexcept {
SetTag(nullptr);
}
void Pause();
void Pause() noexcept;
bool IsPaused() const {
bool IsPaused() const noexcept {
return paused;
}
@@ -109,15 +109,15 @@ protected:
* continue feeding Read() calls from the buffer until it runs
* empty.
*/
void SetClosed() {
void SetClosed() noexcept {
open = false;
}
bool IsBufferEmpty() const {
bool IsBufferEmpty() const noexcept {
return buffer.IsEmpty();
}
bool IsBufferFull() const {
bool IsBufferFull() const noexcept {
return buffer.IsFull();
}
@@ -125,21 +125,21 @@ protected:
* Determine how many bytes can be added to the buffer.
*/
gcc_pure
size_t GetBufferSpace() const {
size_t GetBufferSpace() const noexcept {
return buffer.GetSpace();
}
CircularBuffer<uint8_t>::Range PrepareWriteBuffer() {
CircularBuffer<uint8_t>::Range PrepareWriteBuffer() noexcept {
return buffer.Write();
}
void CommitWriteBuffer(size_t nbytes);
void CommitWriteBuffer(size_t nbytes) noexcept;
/**
* Append data to the buffer. The size must fit into the
* buffer; see GetBufferSpace().
*/
void AppendToBuffer(const void *data, size_t append_size);
void AppendToBuffer(const void *data, size_t append_size) noexcept;
/**
* Implement code here that will resume the stream after it
@@ -154,7 +154,7 @@ protected:
*/
virtual void DoSeek(offset_type new_offset) = 0;
bool IsSeekPending() const {
bool IsSeekPending() const noexcept {
return seek_state == SeekState::PENDING;
}
@@ -162,14 +162,14 @@ protected:
* Call this after seeking has finished. It will notify the
* client thread.
*/
void SeekDone();
void SeekDone() noexcept;
private:
void Resume();
/* for DeferredCall */
void DeferredResume();
void DeferredSeek();
void DeferredResume() noexcept;
void DeferredSeek() noexcept;
};
#endif

@@ -184,20 +184,20 @@ public:
void LockWaitReady();
gcc_pure
bool HasMimeType() const {
bool HasMimeType() const noexcept {
assert(ready);
return !mime.empty();
}
gcc_pure
const char *GetMimeType() const {
const char *GetMimeType() const noexcept {
assert(ready);
return mime.empty() ? nullptr : mime.c_str();
}
void ClearMimeType() {
void ClearMimeType() noexcept {
mime.clear();
}
@@ -215,35 +215,35 @@ public:
}
gcc_pure
bool KnownSize() const {
bool KnownSize() const noexcept {
assert(ready);
return size != UNKNOWN_SIZE;
}
gcc_pure
offset_type GetSize() const {
offset_type GetSize() const noexcept {
assert(ready);
assert(KnownSize());
return size;
}
void AddOffset(offset_type delta) {
void AddOffset(offset_type delta) noexcept {
assert(ready);
offset += delta;
}
gcc_pure
offset_type GetOffset() const {
offset_type GetOffset() const noexcept {
assert(ready);
return offset;
}
gcc_pure
offset_type GetRest() const {
offset_type GetRest() const noexcept {
assert(ready);
assert(KnownSize());
@@ -251,7 +251,7 @@ public:
}
gcc_pure
bool IsSeekable() const {
bool IsSeekable() const noexcept {
assert(ready);
return seekable;

@@ -63,7 +63,7 @@ public:
*/
static int SocketFunction(CURL *easy,
curl_socket_t s, int action,
void *userp, void *socketp);
void *userp, void *socketp) noexcept;
virtual bool OnSocketReady(unsigned flags) override;
@@ -75,7 +75,7 @@ private:
}
gcc_const
static unsigned CurlPollToFlags(int action) {
static unsigned CurlPollToFlags(int action) noexcept {
switch (action) {
case CURL_POLL_NONE:
return 0;
@@ -108,7 +108,7 @@ CurlGlobal::CurlGlobal(EventLoop &_loop)
int
CurlSocket::SocketFunction(gcc_unused CURL *easy,
curl_socket_t s, int action,
void *userp, void *socketp) {
void *userp, void *socketp) noexcept {
auto &global = *(CurlGlobal *)userp;
CurlSocket *cs = (CurlSocket *)socketp;

@@ -147,16 +147,16 @@ public:
~NfsConnection();
gcc_pure
const char *GetServer() const {
const char *GetServer() const noexcept {
return server.c_str();
}
gcc_pure
const char *GetExportName() const {
const char *GetExportName() const noexcept {
return export_name.c_str();
}
EventLoop &GetEventLoop() {
EventLoop &GetEventLoop() noexcept {
return SocketMonitor::GetEventLoop();
}

@@ -114,12 +114,12 @@ public:
std::list<std::string> getSearchCapabilities(UpnpClient_Handle handle) const;
gcc_pure
std::string GetURI() const {
std::string GetURI() const noexcept {
return "upnp://" + m_deviceId + "/" + m_serviceType;
}
/** Retrieve the "friendly name" for this server, useful for display. */
const char *getFriendlyName() const {
const char *getFriendlyName() const noexcept {
return m_friendlyName.c_str();
}
};

@@ -84,7 +84,6 @@ public:
* @return the current volume (0..100 including) or -1 if
* unavailable
*/
gcc_pure
virtual int GetVolume() = 0;
/**

@@ -48,12 +48,12 @@ class SmbclientNeighborExplorer final : public NeighborExplorer {
Server(const Server &) = delete;
gcc_pure
bool operator==(const Server &other) const {
bool operator==(const Server &other) const noexcept {
return name == other.name;
}
gcc_pure
NeighborInfo Export() const {
NeighborInfo Export() const noexcept {
return { "smb://" + name + "/", comment };
}
};

@@ -43,12 +43,12 @@ class UpnpNeighborExplorer final
Server(const Server &) = delete;
gcc_pure
bool operator==(const Server &other) const {
bool operator==(const Server &other) const noexcept {
return name == other.name;
}
gcc_pure
NeighborInfo Export() const {
NeighborInfo Export() const noexcept {
return { "smb://" + name + "/", comment };
}
};

@@ -76,47 +76,47 @@ public:
AllocatedSocketAddress &operator=(const AllocatedSocketAddress &) = delete;
AllocatedSocketAddress &operator=(AllocatedSocketAddress &&src) {
AllocatedSocketAddress &operator=(AllocatedSocketAddress &&src) noexcept {
std::swap(address, src.address);
std::swap(size, src.size);
return *this;
}
gcc_pure
bool operator==(SocketAddress other) const {
bool operator==(SocketAddress other) const noexcept {
return (SocketAddress)*this == other;
}
bool operator!=(SocketAddress &other) const {
bool operator!=(SocketAddress &other) const noexcept {
return !(*this == other);
}
gcc_const
static AllocatedSocketAddress Null() {
static AllocatedSocketAddress Null() noexcept {
return AllocatedSocketAddress(nullptr, 0);
}
bool IsNull() const {
bool IsNull() const noexcept {
return address == nullptr;
}
size_type GetSize() const {
size_type GetSize() const noexcept {
return size;
}
const struct sockaddr *GetAddress() const {
const struct sockaddr *GetAddress() const noexcept {
return address;
}
operator SocketAddress() const {
operator SocketAddress() const noexcept {
return SocketAddress(address, size);
}
operator const struct sockaddr *() const {
operator const struct sockaddr *() const noexcept {
return address;
}
int GetFamily() const {
int GetFamily() const noexcept {
return address->sa_family;
}
@@ -124,11 +124,11 @@ public:
* Does the object have a well-defined address? Check !IsNull()
* before calling this method.
*/
bool IsDefined() const {
bool IsDefined() const noexcept {
return GetFamily() != AF_UNSPEC;
}
void Clear() {
void Clear() noexcept {
free(address);
address = nullptr;
size = 0;

@@ -51,52 +51,52 @@ public:
StaticSocketAddress &operator=(SocketAddress other) noexcept;
operator SocketAddress() const {
operator SocketAddress() const noexcept {
return SocketAddress(reinterpret_cast<const struct sockaddr *>(&address),
size);
}
struct sockaddr *GetAddress() {
struct sockaddr *GetAddress() noexcept {
return reinterpret_cast<struct sockaddr *>(&address);
}
const struct sockaddr *GetAddress() const {
const struct sockaddr *GetAddress() const noexcept {
return reinterpret_cast<const struct sockaddr *>(&address);
}
constexpr size_type GetCapacity() const {
constexpr size_type GetCapacity() const noexcept {
return sizeof(address);
}
size_type GetSize() const {
size_type GetSize() const noexcept {
return size;
}
void SetSize(size_type _size) {
void SetSize(size_type _size) noexcept {
assert(_size > 0);
assert(size_t(_size) <= sizeof(address));
size = _size;
}
int GetFamily() const {
int GetFamily() const noexcept {
return address.ss_family;
}
bool IsDefined() const {
bool IsDefined() const noexcept {
return GetFamily() != AF_UNSPEC;
}
void Clear() {
void Clear() noexcept {
address.ss_family = AF_UNSPEC;
}
gcc_pure
bool operator==(SocketAddress other) const {
bool operator==(SocketAddress other) const noexcept {
return (SocketAddress)*this == other;
}
bool operator!=(SocketAddress &other) const {
bool operator!=(SocketAddress &other) const noexcept {
return !(*this == other);
}
};

@@ -85,7 +85,7 @@ public:
* those which are disabled right now.
*/
gcc_pure
unsigned Size() const {
unsigned Size() const noexcept {
return outputs.size();
}
@@ -186,7 +186,7 @@ public:
* finished yet.
*/
gcc_pure
SignedSongTime GetElapsedTime() const {
SignedSongTime GetElapsedTime() const noexcept {
return elapsed_time;
}

@@ -132,7 +132,7 @@ public:
}
gcc_pure
const char *GetDevice() {
const char *GetDevice() const noexcept {
return device.empty() ? default_device : device.c_str();
}

@@ -79,7 +79,7 @@ public:
size_t Play(const void *chunk, size_t size);
void Cancel();
std::chrono::steady_clock::duration Delay();
std::chrono::steady_clock::duration Delay() noexcept;
void FillBuffer(void* _buffer, size_t size,
gcc_unused const media_raw_audio_format& _format);
@@ -309,7 +309,7 @@ HaikuOutput::Play(const void *chunk, size_t size)
}
inline std::chrono::steady_clock::duration
HaikuOutput::Delay()
HaikuOutput::Delay() noexcept
{
unsigned delay = buffer_filled ? 0 : buffer_delay;

@@ -670,7 +670,7 @@ osx_output_play(AudioOutput *ao, const void *chunk, size_t size)
}
static std::chrono::steady_clock::duration
osx_output_delay(AudioOutput *ao)
osx_output_delay(AudioOutput *ao) noexcept
{
OSXOutput *od = (OSXOutput *)ao;
return od->ring_buffer->write_available()

@@ -73,19 +73,19 @@ class OpenALOutput {
private:
gcc_pure
ALint GetSourceI(ALenum param) const {
ALint GetSourceI(ALenum param) const noexcept {
ALint value;
alGetSourcei(source, param, &value);
return value;
}
gcc_pure
bool HasProcessed() const {
bool HasProcessed() const noexcept {
return GetSourceI(AL_BUFFERS_PROCESSED) > 0;
}
gcc_pure
bool IsPlaying() const {
bool IsPlaying() const noexcept {
return GetSourceI(AL_SOURCE_STATE) == AL_PLAYING;
}

@@ -100,7 +100,7 @@ public:
void Open(AudioFormat &audio_format);
void Close();
std::chrono::steady_clock::duration Delay();
std::chrono::steady_clock::duration Delay() noexcept;
size_t Play(const void *chunk, size_t size);
void Cancel();
bool Pause();
@@ -740,7 +740,7 @@ PulseOutput::StreamPause(bool pause)
}
inline std::chrono::steady_clock::duration
PulseOutput::Delay()
PulseOutput::Delay() noexcept
{
Pulse::LockGuard lock(mainloop);

@@ -97,7 +97,7 @@ class RecorderOutput {
private:
gcc_pure
bool HasDynamicPath() const {
bool HasDynamicPath() const noexcept {
return !format_path.empty();
}

@@ -191,7 +191,7 @@ public:
* Caller must lock the mutex.
*/
gcc_pure
bool HasClients() const {
bool HasClients() const noexcept {
return !clients.empty();
}
@@ -199,7 +199,7 @@ public:
* Check whether there is at least one client.
*/
gcc_pure
bool LockHasClients() const {
bool LockHasClients() const noexcept {
const std::lock_guard<Mutex> protect(mutex);
return HasClients();
}

@@ -96,7 +96,7 @@ public:
void Open(AudioFormat &audio_format);
void Close();
std::chrono::steady_clock::duration Delay() {
std::chrono::steady_clock::duration Delay() noexcept {
return pause && !cancel
? std::chrono::milliseconds(100)
: std::chrono::steady_clock::duration::zero();

@@ -63,11 +63,12 @@ public:
/**
* Resamples a block of PCM data.
*
* Throws std::runtime_error on error.
*
* @param src the input buffer
* @return the destination buffer (will be invalidated by
* filter_close() or filter_filter())
*/
gcc_pure
virtual ConstBuffer<void> Resample(ConstBuffer<void> src) = 0;
};

@@ -247,7 +247,7 @@ private:
* finished.
*/
gcc_pure
bool IsDecoderAtCurrentSong() const {
bool IsDecoderAtCurrentSong() const noexcept {
assert(pipe != nullptr);
return dc.pipe == pipe;
@@ -259,7 +259,7 @@ private:
* switched to that song yet.
*/
gcc_pure
bool IsDecoderAtNextSong() const {
bool IsDecoderAtNextSong() const noexcept {
return dc.pipe != nullptr && !IsDecoderAtCurrentSong();
}

@@ -146,6 +146,7 @@ static const char *const extm3u_suffixes[] = {
static const char *const extm3u_mime_types[] = {
"audio/x-mpegurl",
"audio/mpegurl",
nullptr
};

@@ -66,6 +66,7 @@ static const char *const m3u_suffixes[] = {
static const char *const m3u_mime_types[] = {
"audio/x-mpegurl",
"audio/mpegurl",
nullptr
};

@@ -162,14 +162,14 @@ struct Queue {
}
gcc_pure
unsigned OrderToPosition(unsigned _order) const {
unsigned OrderToPosition(unsigned _order) const noexcept {
assert(_order < length);
return order[_order];
}
gcc_pure
unsigned PositionToOrder(unsigned position) const {
unsigned PositionToOrder(unsigned position) const noexcept {
assert(position < length);
for (unsigned i = 0;; ++i) {
@@ -181,7 +181,7 @@ struct Queue {
}
gcc_pure
uint8_t GetPriorityAtPosition(unsigned position) const {
uint8_t GetPriorityAtPosition(unsigned position) const noexcept {
assert(position < length);
return items[position].priority;

@@ -149,7 +149,7 @@ CompositeStorage::Directory::Make(const char *uri)
}
bool
CompositeStorage::Directory::Unmount()
CompositeStorage::Directory::Unmount() noexcept
{
if (storage == nullptr)
return false;
@@ -160,7 +160,7 @@ CompositeStorage::Directory::Unmount()
}
bool
CompositeStorage::Directory::Unmount(const char *uri)
CompositeStorage::Directory::Unmount(const char *uri) noexcept
{
if (StringIsEmpty(uri))
return Unmount();

@@ -55,7 +55,7 @@ class CompositeStorage final : public Storage {
~Directory();
gcc_pure
bool IsEmpty() const {
bool IsEmpty() const noexcept {
return storage == nullptr && children.empty();
}
@@ -64,8 +64,8 @@ class CompositeStorage final : public Storage {
Directory &Make(const char *uri);
bool Unmount();
bool Unmount(const char *uri);
bool Unmount() noexcept;
bool Unmount(const char *uri) noexcept;
gcc_pure
bool MapToRelativeUTF8(std::string &buffer,

@@ -39,7 +39,6 @@ public:
/**
* Throws #std::runtime_error on error.
*/
gcc_pure
virtual StorageFileInfo GetInfo(bool follow) = 0;
};
@@ -52,7 +51,6 @@ public:
/**
* Throws #std::runtime_error on error.
*/
gcc_pure
virtual StorageFileInfo GetInfo(const char *uri_utf8, bool follow) = 0;
/**

@@ -511,7 +511,7 @@ private:
* to the base file name.
*/
gcc_pure
StringView HrefToEscapedName(const char *href) const {
StringView HrefToEscapedName(const char *href) const noexcept {
const char *path = uri_get_path(href);
if (path == nullptr)
return nullptr;

@@ -52,6 +52,15 @@
# define IS_LITTLE_ENDIAN false
# define IS_BIG_ENDIAN true
# endif
#elif defined(__BYTE_ORDER__)
/* GCC-specific macros */
# if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
# define IS_LITTLE_ENDIAN true
# define IS_BIG_ENDIAN false
# else
# define IS_LITTLE_ENDIAN false
# define IS_BIG_ENDIAN true
# endif
#else
/* generic compile-time check */
# include <endian.h>

@@ -53,7 +53,7 @@ ParseMixRampTag(MixRampInfo &info, const char *name, const char *value)
const char *value;
gcc_pure
const char *operator[](const char *n) const {
const char *operator[](const char *n) const noexcept {
return StringEqualsCaseASCII(name, n)
? value
: nullptr;
@@ -70,7 +70,7 @@ ParseMixRampVorbis(MixRampInfo &info, const char *entry)
const char *entry;
gcc_pure
const char *operator[](const char *n) const {
const char *operator[](const char *n) const noexcept {
return vorbis_comment_value(entry, n);
}
};

@@ -60,7 +60,7 @@ ParseReplayGainTag(ReplayGainInfo &info, const char *name, const char *value)
const char *value;
gcc_pure
const char *operator[](const char *n) const {
const char *operator[](const char *n) const noexcept {
return StringEqualsCaseASCII(name, n)
? value
: nullptr;
@@ -77,7 +77,7 @@ ParseReplayGainVorbis(ReplayGainInfo &info, const char *entry)
const char *entry;
gcc_pure
const char *operator[](const char *n) const {
const char *operator[](const char *n) const noexcept {
return vorbis_comment_value(entry, n);
}
};

@@ -67,7 +67,7 @@ CopyTagMask(TagBuilder &dest, const Tag &src, tag_mask_t mask)
void
TagSet::InsertUnique(const Tag &src, TagType type, const char *value,
tag_mask_t group_mask)
tag_mask_t group_mask) noexcept
{
TagBuilder builder;
if (value == nullptr)
@@ -85,7 +85,7 @@ TagSet::InsertUnique(const Tag &src, TagType type, const char *value,
bool
TagSet::CheckUnique(TagType dest_type,
const Tag &tag, TagType src_type,
tag_mask_t group_mask)
tag_mask_t group_mask) noexcept
{
bool found = false;
@@ -101,7 +101,7 @@ TagSet::CheckUnique(TagType dest_type,
void
TagSet::InsertUnique(const Tag &tag,
TagType type, tag_mask_t group_mask)
TagType type, tag_mask_t group_mask) noexcept
{
static_assert(sizeof(group_mask) * 8 >= TAG_NUM_OF_ITEM_TYPES,
"Mask is too small");

@@ -33,7 +33,7 @@
*/
struct TagLess {
gcc_pure
bool operator()(const Tag &a, const Tag &b) const {
bool operator()(const Tag &a, const Tag &b) const noexcept {
if (a.num_items != b.num_items)
return a.num_items < b.num_items;
@@ -59,15 +59,15 @@ struct TagLess {
class TagSet : public std::set<Tag, TagLess> {
public:
void InsertUnique(const Tag &tag,
TagType type, tag_mask_t group_mask);
TagType type, tag_mask_t group_mask) noexcept;
private:
void InsertUnique(const Tag &src, TagType type, const char *value,
tag_mask_t group_mask);
tag_mask_t group_mask) noexcept;
bool CheckUnique(TagType dest_type,
const Tag &tag, TagType src_type,
tag_mask_t group_mask);
tag_mask_t group_mask) noexcept;
};
#endif

@@ -82,7 +82,7 @@ public:
* Returns true if the object contains any information.
*/
gcc_pure
bool IsDefined() const {
bool IsDefined() const noexcept {
return !duration.IsNegative() || has_playlist || !IsEmpty();
}

@@ -53,7 +53,7 @@ public:
#endif
gcc_const
static ThreadId Null() {
static ThreadId Null() noexcept {
#ifdef WIN32
return 0;
#else
@@ -63,7 +63,7 @@ public:
}
gcc_pure
bool IsNull() const {
bool IsNull() const noexcept {
return *this == Null();
}
@@ -80,7 +80,7 @@ public:
}
gcc_pure
bool operator==(const ThreadId &other) const {
bool operator==(const ThreadId &other) const noexcept {
#ifdef WIN32
return id == other.id;
#else

@@ -77,7 +77,7 @@ public:
* Check if this thread is the current thread.
*/
gcc_pure
bool IsInside() const {
bool IsInside() const noexcept {
#ifdef WIN32
return GetCurrentThreadId() == id;
#else

@@ -140,7 +140,7 @@ struct ConstBuffer {
template<typename U>
gcc_pure
bool Contains(U &&u) const {
bool Contains(U &&u) const noexcept {
for (const auto &i : *this)
if (u == i)
return true;

@@ -31,14 +31,14 @@
#include "CharUtil.hxx"
void
StringView::StripLeft()
StringView::StripLeft() noexcept
{
while (!IsEmpty() && IsWhitespaceOrNull(front()))
pop_front();
}
void
StringView::StripRight()
StringView::StripRight() noexcept
{
while (!IsEmpty() && IsWhitespaceOrNull(back()))
pop_back();

@@ -64,67 +64,67 @@ struct StringView : ConstBuffer<char> {
return StringView("", size_t(0));
}
void SetEmpty() {
void SetEmpty() noexcept {
data = "";
size = 0;
}
gcc_pure
pointer_type Find(char ch) const {
pointer_type Find(char ch) const noexcept {
return (pointer_type)memchr(data, ch, size);
}
StringView &operator=(std::nullptr_t) {
StringView &operator=(std::nullptr_t) noexcept {
data = nullptr;
size = 0;
return *this;
}
StringView &operator=(pointer_type _data) {
StringView &operator=(pointer_type _data) noexcept {
data = _data;
size = _data != nullptr ? strlen(_data) : 0;
return *this;
}
gcc_pure
bool StartsWith(StringView needle) const {
bool StartsWith(StringView needle) const noexcept {
return size >= needle.size &&
memcmp(data, needle.data, needle.size) == 0;
}
gcc_pure
bool Equals(StringView other) const {
bool Equals(StringView other) const noexcept {
return size == other.size &&
memcmp(data, other.data, size) == 0;
}
template<size_t n>
bool EqualsLiteral(const char (&other)[n]) const {
bool EqualsLiteral(const char (&other)[n]) const noexcept {
return Equals(Literal(other));
}
gcc_pure
bool EqualsIgnoreCase(StringView other) const {
bool EqualsIgnoreCase(StringView other) const noexcept {
return size == other.size &&
strncasecmp(data, other.data, size) == 0;
}
template<size_t n>
bool EqualsLiteralIgnoreCase(const char (&other)[n]) const {
bool EqualsLiteralIgnoreCase(const char (&other)[n]) const noexcept {
return EqualsIgnoreCase(Literal(other));
}
/**
* Skip all whitespace at the beginning.
*/
void StripLeft();
void StripLeft() noexcept;
/**
* Skip all whitespace at the end.
*/
void StripRight();
void StripRight() noexcept;
void Strip() {
void Strip() noexcept {
StripLeft();
StripRight();
}

@@ -45,7 +45,7 @@ FakeDecoder::Ready(const AudioFormat audio_format,
}
DecoderCommand
FakeDecoder::GetCommand()
FakeDecoder::GetCommand() noexcept
{
return DecoderCommand::NONE;
}
@@ -56,13 +56,13 @@ FakeDecoder::CommandFinished()
}
SongTime
FakeDecoder::GetSeekTime()
FakeDecoder::GetSeekTime() noexcept
{
return SongTime();
}
uint64_t
FakeDecoder::GetSeekFrame()
FakeDecoder::GetSeekFrame() noexcept
{
return 1;
}

@@ -34,10 +34,10 @@ struct FakeDecoder final : DecoderClient {
/* virtual methods from DecoderClient */
void Ready(AudioFormat audio_format,
bool seekable, SignedSongTime duration) override;
DecoderCommand GetCommand() override;
DecoderCommand GetCommand() noexcept override;
void CommandFinished() override;
SongTime GetSeekTime() override;
uint64_t GetSeekFrame() override;
SongTime GetSeekTime() noexcept override;
uint64_t GetSeekFrame() noexcept override;
void SeekError() override;
InputStreamPtr OpenUri(const char *uri) override;
size_t Read(InputStream &is, void *buffer, size_t length) override;

@@ -49,9 +49,9 @@ CPPUNIT_TEST_SUITE_REGISTRATION(ByteReverseTest);
void
ByteReverseTest::TestByteReverse2()
{
static const char src[] alignas(uint16_t) = "123456";
alignas(uint16_t) static const char src[] = "123456";
static const char result[] = "214365";
static uint8_t dest[ARRAY_SIZE(src)] alignas(uint16_t);
alignas(uint16_t)static uint8_t dest[ARRAY_SIZE(src)];
reverse_bytes(dest, (const uint8_t *)src,
(const uint8_t *)(src + ARRAY_SIZE(src) - 1), 2);
@@ -73,9 +73,9 @@ ByteReverseTest::TestByteReverse3()
void
ByteReverseTest::TestByteReverse4()
{
static const char src[] alignas(uint32_t) = "12345678";
alignas(uint32_t) static const char src[] = "12345678";
static const char result[] = "43218765";
static uint8_t dest[ARRAY_SIZE(src)] alignas(uint32_t);
alignas(uint32_t) static uint8_t dest[ARRAY_SIZE(src)];
reverse_bytes(dest, (const uint8_t *)src,
(const uint8_t *)(src + ARRAY_SIZE(src) - 1), 4);