Turns out that using CP_ACP is a lousy idea, because only very few
Unicode characters can be represented by it. Instead, switch to UTF-8
(which every sane person on other operating system already uses).
Closes#102
Our previous use of Queue::SwapOrders() could cause surprising
results:
- sometimes, the old "current" song would be played again (if the
newly selected song had not been played already)
- sometimes, the old "current" song would not be played again (if the
newly selected song had already been played)
This is inconsistent, because it should not depend on whether the
newly selected song had already been played.
So instead of Queue::SwapOrders() we now use Queue::MoveOrderAfter()
and Queue::MoveOrderBefore(), which is more expensive, but also more
consistent. It attempts to retain as much from the previous order
list as possible, and only moves the newly selected song around.
If an early exception gets caught (e.g. from
AllocatedPath::FromUTF8Throw()) before
DecoderControl::CommandFinishedLocked() is called, the decoder thread
would go in an endless loop, because DecoderCommand::START is still
set.
Closes#118
Our IcuCaseFold() fallback using strxfrm() is not actually case
insensitive. This commit fixes the problem by switching to
strcasecmp(). That function is not guaranteed to support UTF-8, but
it's the best we can do in this sparse situation.
Closes#111
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 #58 was most likely about StorageDirectoryReader::GetInfo() and
Storage::GetInfo(), which still had "pure" attributes.
Closes#58
Fixes build failure on OS X, closes#44. With the other plugins,
that's not critical, because those use the AudioOutputWrapper, which
hides this problem.
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.
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