The "pure" and "const" attributes are not so well-defined, and a
recent clang version implements an optimization which pushes the
definition's boundary beyond what I believed it was. clang now
assumes that functions declared "pure" cannot throw exceptions, even
if they lack the "noexcept" specification.
When compiled with this new clang version, MPD will crash randomly if
an exception happens to get thrown by such as "pure" function
(https://github.com/MusicPlayerDaemon/MPD/issues/41).
This commit removes all such misplaced "pure" and "const" attributes,
closing #41.
An ino_t is usually a 64 bit integer, and some file systems (such as
Linux's kernel NFS client) really uses the upper 32 bit. This can
lead to false positives in the directory loop detection in
FindAncestorLoop(). Increasing these two attributes (in
StorageFileInfo and Directory) to 64 bit adds little overhead, but
makes the check a lot safer.
The TAG_MODIFIED handler (i.e. playlist::TagModified()) works only if
the modified song is the current song - something that is not updated
until SYNC_WITH_PLAYER is finished. This fixes tag updates right
after a new song is started.
GCC7 outputs the following error without this change:
src/util/ReusableArray.hxx:61:35: error: no matching function for call to ‘swap(size_t&, const size_t&)’
std::swap(capacity, src.capacity);
which can be resolved by just using an rvalue-reference rather than a
const rvalue-reference.
Signed-off-by: Ben Boeckel <mathstuf@gmail.com>
https://bugs.musicpd.org/view.php?id=4656 describes a crash due to
division by zero because frame.samples==0. This should never happen,
but apparently can happen after seeking. The best we can do is to
just ignore this frame.
Fixes another buffer overflow: if the stream has a very long title or
URL, resulting in a metadata string of more than 2 kB, icy_string[0]
is a negative value, which gets casted to size_t - ouch!
https://bugs.musicpd.org/view.php?id=4652
Fixes a buffer overflow due to the bad formula rounding the buffer
size up. At the same time, remove the "+1" from the meta_length
calculation, which takes the padding into account and at the same time
implements proper rounding.
Now ClearSocketList() may only be called from PrepareSockets().
Calling it before destroying the object doesn't work properly, because
it doesn't unregister the TimeoutMonitor and the IdleMonitor. Some of
its callers need to be fixed.
Change EventLoop::IsInside() call to EventLoop::IsInsideOrNull().
This means that BlockingCall() may be used during shutdown, after the
main EventLoop::Run() has finished. This is important because mixers
are currently registered in the main EventLoop.