Commit Graph

13061 Commits

Author SHA1 Message Date
Max Kellermann
a43ee97746 util/UriUtil: strip credentials from smb:// URIs
Closes https://github.com/MusicPlayerDaemon/MPD/issues/910
2020-06-22 22:48:56 +02:00
Max Kellermann
43c32372e7 util/UriUtil: make schemes array static 2020-06-22 22:48:07 +02:00
Max Kellermann
5716cde1fb queue/PlaylistEdit: fix crash in SetSongIdRange() while playing
An assertion failure in UpdateQueuedSong() could trigger because the
`prev` parameter is always `nullptr`, but `queued` may be set.  And in
fact, calling UpdateQueuedSong() is only necessary when the queued
song was edited, to re-queue it with the new range.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/901
2020-06-11 07:07:02 +02:00
Max Kellermann
c6a7f6dabc release v0.21.24
-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCgAuFiEEA5IzWngIOJSkMBxDI26KWMbbRRIFAl7hRzQQHG1heEBtdXNp
 Y3BkLm9yZwAKCRAjbopYxttFEp7dD/483fkBEyipufQyQT9nntP8R/vqKlUT+M9V
 8LyoJBtNtbNkO4bdrgAQCzElYzkDnd8VR++ZDEcqSEF49y5wafsiuufJNW2/s02Y
 ygAqgTCpcuS58F7aK92CW99bhZcKC6zoQovkenSMaZ39gorE1ZuO1JyrFR1LWOat
 ELekougQe0JbX2YX0YOH0Qags5fv9joxYJYsx8ZC60sCRNc+h8CBQjpyhZqzk7wC
 EPviLeMDw5lXkoSI3C045QmwJRFG8GMEyZ/4E/mnibxoTXBJmsm4ArKrfJznrUUs
 r8Mkf4G7sVqbsRMyMFBpzw+lsRDpVWI26mhdah9Y1zuUYPaEMe7OVKuEsASJQ/oK
 33wRSBVZc7EPhV3m8f7U8NAJI0/XaaPKGgP2OrtnOfxD+OyAze4vNLZ/GJCYSsh+
 wN1grmJw1mTP52xBicN2AITqXSVVpuvznn+p0g9MBB9Nw8/vbeWaqGPQhMHGHW6a
 JIL9yUTWwhkvkhav1bT7zKaeZv3qfgO7fjkgJqQFYt/q4FZwPFHJme55mVGq9d1y
 FNR8BMh+0A8hRhhQVwVycLxr4+NJja3vaqx+uVG2kov1g3eQBSgnEYCiEV7uls4V
 Pr4sIEeU/QQ+0jsMoJCaW65bNm4tOGKibpjSHrwJ+gxwKn3N7sJaAOo7PgGsUZyS
 30cBC5zkjw==
 =XHev
 -----END PGP SIGNATURE-----

Merge tag 'v0.21.24'

release v0.21.24
2020-06-10 22:58:41 +02:00
Max Kellermann
6b3a282db4 lib/curl/Request: don't enable CURLOPT_NETRC on Windows
Our Windows build is built with `--disable-netrc`, and that makes
CURLOPT_NETRC fail, causing failures with all streams.  D'oh!

Closes https://github.com/MusicPlayerDaemon/MPD/issues/886
2020-06-10 22:46:42 +02:00
Max Kellermann
aafc9ce75b decoder/gme: use class NarrowPath() for Windows compatibility 2020-06-10 21:22:00 +02:00
Max Kellermann
fea326530b decoder/gme: simplify LoadGmeAndM3u() by moving code to ReplaceSuffix() 2020-06-10 21:20:49 +02:00
Max Kellermann
8925cc17d8 decoder/gme: use StringAfterPrefix() 2020-06-10 21:11:08 +02:00
Max Kellermann
14412c867f add a few IWYU pragmas 2020-06-10 21:10:33 +02:00
Max Kellermann
c5cc256bf2 decoder/gme: use Path::GetSuffix() 2020-06-10 21:02:07 +02:00
Max Kellermann
563c7318f9 fs/AllocatedPath: add method GetSuffix() 2020-06-10 21:00:41 +02:00
Max Kellermann
374cc51f77 decoder/Bridge: add flag to make initial seek errors fatal
When the client wants to seek, but the decoder has already finished
decoding the current song, the player restarts the decoder with an
initial seek at the new position.  When this initial seek fails, MPD
pretends nothing has happened and plays this song from the start.

With this new flag, a restarted decoder marks the initial seek as
"essential" and fails the decoder if that seek fails.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/895
2020-06-10 17:49:10 +02:00
Max Kellermann
068006ebd7 decoder/Bridge: install an InputStreamHandler on local files
Before the advent of io_uring (commit dae8da7066), this didn't
matter, because the `FileInputStream` never called this.  But
`UringInputStream` is derived from `AsyncInputStream`, and needs the
handler to signal completion.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/898
2020-06-09 21:07:38 +02:00
Shen-Ta Hsieh
93d87854e9
src/output: add wasapi output and mixer plugin 2020-05-30 22:21:03 +08:00
Shen-Ta Hsieh
e5eac71d72
win32: add COM helper classes 2020-05-30 22:21:03 +08:00
Max Kellermann
f20b927858 Merge branch 'v0.21.x' 2020-05-30 14:05:18 +02:00
Rosen Penev
e4dad42ca1 use std chr functions
The ones in std have overloads for const char/char.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-05-30 13:36:53 +02:00
Max Kellermann
99afe8e6d1 lib/icu/Win32: paranoid-ify the buffer length checks
Passing `length+1` to `MultiByteToWideChar()` means the function may
fill the whole buffer with output data, and could theoretically
overwrite the null terminator.  In practice, this will never happen,
but this way, it's slightly more correct.

Also, null-terminate after `MultiByteToWideChar()`, after we got the
real output length.  Again, this would never have been a problem, but
who knows...
2020-05-30 13:29:09 +02:00
Rosen Penev
1008d5f67c use cwchar include
Needed for std::wmemchr under libcxx

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-05-30 13:22:04 +02:00
Shen-Ta Hsieh
169810e8f4
lib/icu: add null terminate in win32 string and wstring 2020-05-30 04:04:34 +08:00
Shen-Ta Hsieh
8e07ea7ad8 src/db: fitting libmpdclient interface 2020-05-29 19:00:16 +02:00
Max Kellermann
9f5c6d29b2 output/osx: use range-based for 2020-05-28 15:59:52 +02:00
Max Kellermann
f6823cc679 output/osx: move code to FindAudioDeviceByName() 2020-05-28 15:54:57 +02:00
Max Kellermann
69c0f0fe99 apple/AudioUnit: wrapper functions for AudioObject properties 2020-05-28 15:54:57 +02:00
Max Kellermann
28a00472ff apple/Throw: new helper library replacing osx_os_status_to_cstring() 2020-05-28 15:06:53 +02:00
Max Kellermann
8d540737b9 output/osx: silently ignore some errors in osx_output_set_device() 2020-05-28 15:06:51 +02:00
Max Kellermann
1112d779be apple/ErrorRef: new library wrapping CFErrorRef 2020-05-28 15:06:41 +02:00
Max Kellermann
ecced0ce13 apple/StringRef: new library wrapping CFStringRef 2020-05-28 15:06:38 +02:00
Max Kellermann
d751df0a73 storage/State: disable -Wcomma to work around Boost compiler warning 2020-05-28 14:00:31 +02:00
Max Kellermann
2c084781b0 output/openal: disable -Wdeprecated-declarations on Apple 2020-05-28 13:59:52 +02:00
Max Kellermann
6e1a21a42a output/osx: make several fields const 2020-05-28 13:59:32 +02:00
Max Kellermann
80e8338014 output/osx: make variables more local 2020-05-28 13:44:28 +02:00
Max Kellermann
bfaa7afcb0 output/osx: make more AudioObjectPropertyAddress instances static constexpr 2020-05-28 13:39:46 +02:00
Max Kellermann
7fdbaa6156 output/osx: make AudioObjectPropertyAddress variables static constexpr 2020-05-27 19:50:44 +02:00
Max Kellermann
aa7dc62f72 output/osx: don't use C99 designated initializers
Fixes `-Wpedantic`.
2020-05-27 19:50:43 +02:00
Max Kellermann
6a4992118a lib/ffmpeg/Time: redefine AV_TIME_BASE_Q with initializer list
libavutil's macro definition is a compound literal, which is illegal
in C++.  Fixes yet another -Wpedantic warning.
2020-05-27 16:55:55 +02:00
Max Kellermann
f03cc1012d lib/upnp/Compat: workaround for -Wkeyword-macro 2020-05-27 16:50:27 +02:00
Max Kellermann
736a696f98 lib/upnp: drop support for libupnp versions older than 1.8 2020-05-27 16:49:02 +02:00
Max Kellermann
caec384ed0 archive/ArchiveList, input/Registry: avoid zero-sized array
Some more `-Wpedantic` fixups.
2020-05-27 16:31:52 +02:00
Max Kellermann
5e93e882c9 Merge branch 'v0.21.x' 2020-05-27 16:16:30 +02:00
Max Kellermann
30d97fe8a0 meson.build: fix the WildMidi check when the feature is disabled
Fixes regression from commit 69f09648a4
2020-05-27 16:06:49 +02:00
Max Kellermann
8e4ca23727 lib/ffmpeg/Time: replace C99 compound literal with C++ initializer list 2020-05-27 15:54:34 +02:00
Max Kellermann
bdc861f058 util/TemplateString: remove extra semicolon 2020-05-27 15:46:55 +02:00
Rosen Penev
8925040262 remove some more extra semicolons
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-05-27 15:36:53 +02:00
Max Kellermann
4e5d6e560b decoder/modplug: assume ModPlug is built as static library on Windows 2020-05-27 15:03:46 +02:00
Max Kellermann
d276d8eda2 decoder/wildmidi: assume WildMidi is built as static library on Windows 2020-05-27 15:03:35 +02:00
Max Kellermann
ebcb5e9368 decoder/wildmidi: use NarrowPath, fixing the Windows build 2020-05-27 15:03:33 +02:00
Max Kellermann
69f09648a4 meson.build: attempt to detect WildMidi using pkg-config
The WildMidi project added the pkg-config file in version 0.3.3, but
unfortunately, Debian still doesn't ship it 4 years later:

 https://bugs.debian.org/916631

However, for cross-compiling, the pkg-config file is very helpful.
2020-05-27 15:03:16 +02:00
Max Kellermann
6cc58ccb9b lib/icu/Converter: add missing <string_view> include 2020-05-26 17:48:01 +02:00
Max Kellermann
be94b4373a util/OffsetPointer: add noexcept 2020-05-14 15:44:23 +02:00
Max Kellermann
eeec0ee804 dsd/Dsd2Pcm: convert struct GenerateCtableValue to lambda
Since we have dropped support for GCC 6 a while ago, we can use
constexpr lambdas now.
2020-05-07 15:04:51 +02:00
Max Kellermann
60f957ed64 util/MimeType: use string_view::substr()
Fixes regression from commit db93bb996c because
ParseMimeTypeParameters() assumed the items were null-terminated, but
after that commit, they were not anymore.
2020-05-06 20:33:13 +02:00
Max Kellermann
864d26cd1b Merge branch 'bind' of git://github.com/neheb/MPD 2020-05-06 06:14:55 +02:00
Max Kellermann
ba576ffa37 Merge branch 'v0.21.x' 2020-05-05 19:00:53 +02:00
Max Kellermann
209364adf2 db/simple: fix crash when mounting twice
The `db->close()` call was a `nullptr` dereference because the `db`
variable had already been moved.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/839
2020-05-05 18:57:29 +02:00
Max Kellermann
dae8da7066 input/uring: new input plugin using io_uring
This is the final piece of the series to establish io_uring support on
Linux.

MPD doesn't need io_uring for its efficient bulk I/O support, but to
allow file I/O to be cancelled.  This is a big problem on CIFS/NFS
mounts where processes sleep uninterruptable if the file server
disappears, deadlocking MPD.

With io_uring, a flaky NFS connection allows MPD to continue to work
(even though there are still deadlocks inside MPD which need to be
addressed).

This plugin does not yet use cancellable `open()` using
`IORING_OP_OPENAT`.  This will be implemented later.

Lots of other optimization opportunities for io_uring are still
missing as well - for example the database update could benefit a lot,
but unfortunately, io_uring doesn't have `readdir()` support just yet.
2020-05-05 17:41:03 +02:00
Max Kellermann
cdf8ac001c event/Loop: integrate io_uring support 2020-05-05 17:13:14 +02:00
Max Kellermann
62d0ceabcc io/uring: basic Linux io_uring support 2020-05-05 17:10:17 +02:00
Max Kellermann
935e622915 event/Loop: allow calling AddFD()... before starting the EventThread
Relax the assertions.  This is necessary if BlockingCall() is used
before the thread is started.
2020-05-05 17:10:17 +02:00
Max Kellermann
1efbbfcd6f GitVersion: make GIT_VERSION const 2020-05-05 15:12:40 +02:00
Max Kellermann
e0edf0b206 meson.build: move VERSION and others to Version.h 2020-05-05 15:12:11 +02:00
Max Kellermann
8f178401e4 */plugins/meson.build: define feature macros in Features.h
This makes ccache more efficient when recompiling with different
plugins.
2020-05-05 15:06:50 +02:00
Max Kellermann
8c1d78873d system/KernelVersion: new library 2020-05-05 14:30:56 +02:00
Max Kellermann
9815d10137 system/FileDescriptor: move to io/ 2020-05-05 14:27:03 +02:00
Max Kellermann
97f7270aa8 fs/FileSystem: remove unused function FOpen() 2020-05-05 14:19:29 +02:00
Max Kellermann
1787aa5e00 decoder/sidplay: drop support for libsidplayfp < 1.8 2020-05-05 13:53:10 +02:00
Rosen Penev
e6a77e1297
remove std::bind usage as much as possible
Reduces unstripped size. stripped size is the same.

Also took the time to remove using std::placeholders.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-05-04 15:40:28 -07:00
Max Kellermann
24afdee35c command/all: "tagtypes" requires no permissions
The command is used to configure the client's connection, and this
shouldn't require any permissions.  The client should be able to do
that before sending a password.
2020-04-30 13:08:09 +02:00
Max Kellermann
7aea285361 Revert "Fix unsafe float comparison."
This reverts commit a5273d6992.  It was
wrong and broke the MixRamp unit test.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/844
2020-04-30 06:57:36 +02:00
Rosen Penev
47a7707df1 Math.hxx: fix wrong macro name
_GLIBCXX_USE_C99_MATH_TR1 is the correct one.

_GLIBCXX_USE_C99_MATH is always defined.
2020-04-29 23:20:04 +02:00
skidoo23
a485c4856c decoder/sidplay: support new song length format with libsidplayfp 2.0 2020-04-29 16:27:54 +02:00
Max Kellermann
bca9678683 tag/FixString: use IsNonPrintableASCII()
Fixes breakage of non-ASCII characters, regression from commit
cc72ceb368

Fixes https://github.com/MusicPlayerDaemon/MPD/issues/842
2020-04-27 14:01:54 +02:00
Max Kellermann
814b2a218d util/CharUtil: add IsNonPrintableASCII()
Prepare to fix cc72ceb368
2020-04-27 14:01:54 +02:00
John Regan
6423670eae gme: use song-reported fade-out time when available 2020-04-26 09:24:34 -04:00
John Regan
90a2109fd1 gme: add configurable fade-out time
Also include fade-out time in song length.
2020-04-26 09:21:57 -04:00
Max Kellermann
464b90210c tag/GenParseName: include stdlib.h for EXIT_SUCCESS
Closes https://github.com/MusicPlayerDaemon/MPD/issues/838
2020-04-24 20:39:24 +02:00
Max Kellermann
fa45a8adfa tag/ParseName: generate an optimized tag_name_parse() at build time 2020-04-24 16:28:29 +02:00
Max Kellermann
1532983fb5 tag/Pool: use strncmp() without strlen() to compare strings 2020-04-24 16:16:19 +02:00
Max Kellermann
ae5b2643da tag/Builder: reserve room in std::vector in default constructor
This reduces resource waste for resizing the std::vector in most
cases.
2020-04-24 16:16:19 +02:00
Max Kellermann
02556ffce9 tag/Tag: use class DereferenceIterator 2020-04-24 16:02:36 +02:00
Max Kellermann
18ca734819 util/DereferenceIterator: new utility class 2020-04-24 16:02:31 +02:00
Max Kellermann
8a28f7b0a1 tag/FixString: add optimistic quick check
Optimizes a few nanoseconds from the common code path.
2020-04-24 15:57:40 +02:00
Max Kellermann
cc72ceb368 tag/FixString: use IsPrintableASCII() 2020-04-24 15:42:09 +02:00
Max Kellermann
0b3acc3eec release v0.21.23
-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCgAuFiEEA5IzWngIOJSkMBxDI26KWMbbRRIFAl6huEwQHG1heEBtdXNp
 Y3BkLm9yZwAKCRAjbopYxttFEgcrD/9jLUkiszNc+QWbUGj+RiTaD6fMxA1M8itn
 nB7MKI/g/3ggryWMWNhG51O+8wFNs/4PmJJPGxKoU6i6wmS3YFhTAcs0ryilDGAU
 1FumnMg/2qIyi2E6K2BMbi0YwZiJhBPWwD4JSt1KGvwPes/qQPFgHAi7ZWhP3tar
 fHmgmjwDZ/Kgpl5/Bn7nVNgVuzk/MpBOSwxX9tFtRxqE9wdpm9idve7SVDT7MTvk
 vdONWbAe8jXl/A8JHWaUsws0l7fyK5ZKSOXvdeSbzd67I8Rz3aqJMqUh2k/rDuv/
 GrDyeEtLV5cXZsL4B3/34kCTKac2ZJmRbSh+buKeDc1Gf0clWnvRMdsMbSoRBY4F
 lTWJbjndfq2+iHHBRfaqRjombv52R11yLT+O0aMLEm6l7xPm/rHZXJIcYSmCafd7
 FR1qMaVKP5s+M+MqGePxzCUJSWJ+1bjZwjLaHrYXYPUoXSg3mSaeDE5g7BjQhm1E
 2Hcfui9lvqR55UNo0NvDBjRT5FBGBUdjF6DjYplUGApw7xFtdahXlEvG7yfyg3ae
 pZ3FQ1MZ4dESAw7EhTEBwajsVRQ9DhGQenYTxxCnGVdCucZRPQ9Abhas0U4iFHUA
 wGj7j4WKPi+OUSyiT0j4nGuwEVtCkBFv34DqPMLjx8jqtJ8YgCt4iJD4dFwhk1zz
 uoQBhq27Gg==
 =sR2r
 -----END PGP SIGNATURE-----

Merge tag 'v0.21.23'

release v0.21.23
2020-04-23 18:01:23 +02:00
Max Kellermann
3040ddb5ec lib/nfs/FileReader: use struct stat64 on Windows 32-bit
libnfs is compiled with `-D_FILE_OFFSET_BITS=64`, but Meson decides
not to enable this mode.  We could force this mode, but then again,
these days, nobody should be using 32-bit Windows ... so this is a
kludge only for debugging with 32-bit WINE.
2020-04-23 17:32:34 +02:00
Max Kellermann
fdb28eb0c4 fs/NarrowPath: preserve nullptr in Path operator
Fixes Path::IsNull() checks on Windows.
2020-04-23 17:10:28 +02:00
Max Kellermann
7ded244a61 lib/nfs/Connection: pass POLLHUP and POLLERR to nfs_service() 2020-04-23 16:58:53 +02:00
Max Kellermann
8ed533acf3 event/SocketMonitor: handle epoll_ctl()=EBADF/ENOENT in Schedule()
This fixes a freeze bug in the NFS input/storage plugins: when libnfs
auto-reconnets after a failure, it installs the new socket on the same
file descriptor number.  MPD's attempt to unregister the old socket by
calling SocketMonitor::Steal() from NfsConnection::ScheduleSocket()
fails because the new/old socket number is not registered in epoll, so
epoll_ctl() returns ENOENT.  The problem is that it left
`scheduled_flags`, and so subsequent Schedule() calls will use
`EPOLL_CTL_MOD`, which will fail again and again.  Instead, we need to
use `EPOLL_CTL_ADD` to register the new socket.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/806

Closes https://github.com/MusicPlayerDaemon/MPD/issues/756
2020-04-23 16:58:26 +02:00
Max Kellermann
a27580d0cc lib/nfs/Connection: don't pass HANGUP to Schedule()
This flag is output-only.
2020-04-23 15:21:04 +02:00
Max Kellermann
905db05cf9 zeroconf/AvahiPoll: don't pass ERROR|HANGUP to Schedule()
These flags are output-only.
2020-04-23 15:19:24 +02:00
Max Kellermann
4242aee21e event/SocketMonitor: remove HANGUP|ERROR from ScheduleRead()
These flags are output-only.  Using them here is misleading.
2020-04-23 15:18:18 +02:00
Max Kellermann
e71bd2a08b event/PollGroupWinSelect: make EVENT_{READ,WRITE} static 2020-04-23 15:10:57 +02:00
Max Kellermann
e53a4d0a9e lib/nfs/FileReader: reset state in OnNfsCallback()
The object's state is `IDLE` when OnNfsCallback() gets invoked, so
let's use the start of the method to reset the `state` field.
2020-04-23 14:54:52 +02:00
Max Kellermann
159389164a lib/nfs/FileReader: set state=IDLE before invoking callback
Fixes assertion failure if the callback fails.
2020-04-23 14:51:43 +02:00
geneticdrift
0a92fbc18e tag/Fallback: add tag fallback for AlbumSort
Closes https://github.com/MusicPlayerDaemon/MPD/issues/832
2020-04-22 22:00:38 +02:00
Max Kellermann
138c29320b gme: adapt to API change in the upcoming version 0.7.0
Closes https://github.com/MusicPlayerDaemon/MPD/issues/833
2020-04-22 21:53:00 +02:00
Max Kellermann
8f00dbea45 lib/icu/Compare: add Windows implementation
Using CompareStringEx() and FindNLSStringEx().

Implements a missing piece for
https://github.com/MusicPlayerDaemon/MPD/issues/820
2020-04-22 21:42:12 +02:00
Max Kellermann
f3fd2eb618 lib/icu/Compare: use AllocatedString::Clone() 2020-04-22 21:39:13 +02:00
Max Kellermann
fc92db83cf lib/icu/Collate: use NORM_IGNORECASE instead of LINGUISTIC_IGNORECASE
LINGUISTIC_IGNORECASE is unimplemented on Wine, but since we don't
have any locale support (yet), and we're using LOCALE_NAME_INVARIANT,
NORM_IGNORECASE should essentially be the same, so why bother.
2020-04-22 21:39:13 +02:00
Max Kellermann
3b0f8d5516 lib/icu/CaseFold: remove Windows implementation
Reverts commit fb3564fbe7

LCMapStringEx() doesn't do what I imagined it would do 5 years ago.
D'oh!

Closes https://github.com/MusicPlayerDaemon/MPD/issues/820
2020-04-22 19:32:36 +02:00
Rosen Penev
a5273d6992 Fix unsafe float comparison.
Switching == to >= should be safe here since the next if is the opposite.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-04-22 18:21:40 +02:00
Rosen Penev
6979be008c [clang-tidy] use auto
Found with modernize-use-auto.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-04-22 18:21:07 +02:00
Rosen Penev
71792ffd43 [clang-tidy] use raw string
Found with modernize-raw-string-literal

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-04-22 18:21:00 +02:00
Rosen Penev
3c145c0f49 [clang-tidy] add nodiscard
Found with modernize-use-nodiscard

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-04-22 18:20:51 +02:00
Thomas Guillem
b18074f899 storage/curl: fix path comparison when the server escapes differently
Unescape the base path and the path coming from the server (href) to fix the
comparison when the server uses different escaped characters.

The outputted name need to be unescaped. Doing that before or after the
HrefToEscapedName() call should not change the current behavior.
2020-04-15 13:50:12 +02:00
Thomas Guillem
3d8067a041 storage/curl: fix href when file has a '&' char
If the file name is "Hello & bye", 3 CharacterData events will be sent with the
State::HREF state:
 - "Hello%20"
 - "&"
 - "%20bye"

Reproduced with files hosted on an apache2 DAV server: 2.4.38-3+deb10u3.
2020-04-15 13:18:16 +02:00
Florian Heese
f6fe001fa9 Added missing channel order setups for ALSA 2020-04-15 13:13:09 +02:00
Max Kellermann
32a5bf043b player/Thread: drain outputs at end of song in "single" mode
Without this, the Pause() call would drop the ring buffers and would
skip a considerable portion of the end of the song.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/824
2020-04-14 16:07:03 +02:00
nia
8437b141a4 SolarisOutputPlugin: Support S8 and S32 encodings. 2020-04-14 14:38:30 +01:00
nia
1f0881eec0 SolarisOutputPlugin: Use AUDIO_INITINFO for initialization
This is recommended by Solaris and NetBSD documentation.
2020-04-14 14:20:24 +01:00
Rosen Penev
6080c3b4ba
Math.hxx: move cmath include out of define
The _GLIBCXX_USE_C99_MATH macro is defined in glibcxx by c++config.h, which
gets included by every header. Which means a header needs to be present.

(cherry picked from commit 79e9aff338)
2020-04-09 14:24:06 -07:00
Max Kellermann
3c240e2119 db/simple/DirectorySave: pass std::string_view to _load_subdir()
Eliminates one strlen() call.
2020-04-08 23:54:58 +02:00
Max Kellermann
57fb153c5d db/Interface: pass std::string_view to GetSong() 2020-04-08 23:43:59 +02:00
Max Kellermann
212401d687 db/update/Service: pass std::string_view to Enqueue() 2020-04-08 23:38:28 +02:00
Max Kellermann
dd831d3922 db/simple: pass std::string_view to Directory::LookupDirectory() 2020-04-08 23:38:24 +02:00
Max Kellermann
9f8dc31b50 input/Plugin: copy protocols() to stack before using it
Fixes regression by commit 015cbff93d causing a crash bug because the
iterators of two different temporaries were used.
2020-04-08 23:37:32 +02:00
Max Kellermann
db93bb996c util/SplitString: convert return value to std::string_view
Eliminates lots of overhead.
2020-04-08 23:14:25 +02:00
Max Kellermann
2c02a04566 db/update/Walk: pass std::string_view to DirectoryMakeUriParentChecked()
Split the string into path segments with StringView::Split().  This
prepares to eliminate all allocations from the method.
2020-04-08 23:09:37 +02:00
Max Kellermann
f13f66487a fs/Charset: pass std::string_view to PathToUTF8() 2020-04-08 23:04:37 +02:00
Max Kellermann
0a4c5edc3b Merge branch 'stl' of git://github.com/neheb/MPD 2020-04-08 23:03:44 +02:00
Rosen Penev
015cbff93d [cppcheck] convert several functions to use std::all_of
std::all_of becomes constexpr in C++20. I'm not sure it results in better
performance.

Found with useStlAlgorithm

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-04-08 14:01:12 -07:00
Rosen Penev
79e9aff338
Math.hxx: move cmath include out of define
The _GLIBCXX_USE_C99_MATH macro is defined in glibcxx by c++config.h, which
gets included by every header. Which means a header needs to be present.
2020-04-07 20:14:00 -07:00
Max Kellermann
3a51fe31df util/ConstBuffer, ...: use using instead of typedef 2020-04-06 15:19:12 +02:00
Max Kellermann
cc3e71d8c7 util/CharUtil: add IsHexDigit() 2020-04-06 15:07:08 +02:00
Max Kellermann
dd37b4656e storage/{composite,local}: fix -Wnonnull warnings 2020-04-06 15:06:52 +02:00
Max Kellermann
e2d2bb8755 storage/Composite: use IterableSplitString() 2020-04-03 19:51:14 +02:00
Max Kellermann
a98d627c0b storage/Interface: convert URI parameters to std::string_view 2020-04-03 19:45:10 +02:00
Max Kellermann
0080eee857 fs/Traits: add Relative() overload with std::string_view 2020-04-03 19:45:01 +02:00
Max Kellermann
2429cc8778 fs/Traits: convert first Relative() parameter to std::string_view 2020-04-03 19:29:29 +02:00
Max Kellermann
3a83a6b527 storage/Composite: NextSegment() returns std::string_view 2020-04-03 19:29:01 +02:00
Max Kellermann
bcf4645263 db/simple/Directory: add LookupResult::uri 2020-04-03 17:18:00 +02:00
Max Kellermann
6c8eb3c7ed db/simple/Directory: rename LookupResult::uri to "rest" 2020-04-03 17:07:15 +02:00
Max Kellermann
870151214d util/SplitString: convert parameter to std::string_view 2020-04-03 16:47:45 +02:00
Max Kellermann
ae4fd576bf output/ao: use IterableSplitString() instead of SplitString() 2020-04-03 16:47:25 +02:00
Max Kellermann
747436b17e db,storage: pass std::string_view to PathTraits::Build() 2020-04-03 16:25:09 +02:00
Max Kellermann
7a58b8c3e8 fs/AllocatedPath: pass std::string_view to FromUTF8() 2020-04-03 16:21:41 +02:00
Max Kellermann
56b4b010d6 fs/FileSystem, ...: use AllocatedPath::FromFS(string_view) 2020-04-03 16:13:15 +02:00
Max Kellermann
91c75a133f lib/icu/Collate: pass std::string_view 2020-04-03 16:13:15 +02:00
Max Kellermann
e620677d7c lib/icu/CaseFold: pass std::string_view 2020-04-03 16:13:14 +02:00
Max Kellermann
09d8e44d56 lib/icu/Converter: pass std::string_view 2020-04-03 16:13:14 +02:00
Max Kellermann
9dc530ab51 lib/icu/Util: pass std::string_view 2020-04-03 16:13:14 +02:00
Max Kellermann
2d0798cd4d lib/icu/Win32: pass std::string_view 2020-04-03 16:13:14 +02:00
Max Kellermann
a269fc988b fs/Charset: enable RVO in FixSeparators() 2020-04-03 16:12:51 +02:00
Max Kellermann
915c48f748 util/AllocatedString: std::string_view support 2020-04-03 16:08:55 +02:00
Max Kellermann
f04a245769 util/AllocatedString: add noexcept 2020-04-03 15:26:47 +02:00
Max Kellermann
a8687fb7df util/AllocatedString: use using instead of typedef 2020-04-03 15:25:37 +02:00
Max Kellermann
3b88bac07c util/StringPointer: add noexcept 2020-04-03 15:25:33 +02:00
Max Kellermann
358f231391 util/StringPointer: use using instead of typedef 2020-04-03 15:25:16 +02:00
Max Kellermann
f0923231d0 storage/Interface: pass std::string_view to MapChildFS() 2020-04-02 20:14:00 +02:00
Max Kellermann
dadf054fbb db/simple/Directory: reimplement LookupDirectory() without allocations
Use std::string_view to avoid modifying the string for the temporary
null terminators.
2020-04-02 20:08:00 +02:00
Max Kellermann
6593b5998a db/simple/Directory: pass std::string_view to several methods 2020-04-02 19:58:24 +02:00
Max Kellermann
386235e2d2 db/simple/Mount: pass std::string_view to WalkMount() 2020-04-02 19:52:03 +02:00
Max Kellermann
ddfd92e547 db/simple/PrefixedLightSong: templatize the constructor 2020-04-02 19:51:41 +02:00
Max Kellermann
d5fd309484 db/update/IO: pass std::string_view to directory_child_is_regular() 2020-04-02 19:50:16 +02:00
Max Kellermann
6197b29aa0 db/PlaylistInfo: pass std::string_view to CompareName 2020-04-02 19:49:39 +02:00
Max Kellermann
02294a8236 song/Filter: pass std::string_view to WithoutBasePrefix() 2020-04-02 19:49:24 +02:00
Max Kellermann
66bcf04cbd db/update/Queue: pass std::string_view to Push() 2020-04-02 19:49:16 +02:00
Max Kellermann
12b97bbe38 release v0.21.22
-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCgAuFiEEA5IzWngIOJSkMBxDI26KWMbbRRIFAl6GCWgQHG1heEBtdXNp
 Y3BkLm9yZwAKCRAjbopYxttFEvkQD/9qg6cnCgCKSOmTjteJu1ayeXBMDiL3cCCg
 AwarHQoxsB0102NpV+MLka+4HIwHn+WNL55TzYgfbSh0nfmnki2fZ0YpsZoQR79w
 MP11iMPnFH1oKqj58minBkFNmAis2aLYHJGKaQNUh7wcf0WhbVTqtWBUrKb07RQ0
 Zj5lXtg65O/+yaCVdQGS6fMk2t7CqBM+S3RmbXCib/JRMC6aozoC7nWPvj8b2R8d
 PgxwKMRzyslyFoxDQZrusDjJ1piyigzUMMr32yzYDED4Xr8jsEELaJfULbr6qWT2
 ZNYF91e+D5V7riASAtlFTaVMaISx4QbHjKWR5Xcx0q/SJPAXTxF8RrAqGvqpWYmc
 kqmC8iNxQsW5o3sNhI9qg6sOkq2dIu43VasRCvuo19GABR36wwTK5ORoazIi8fbU
 /Ki/oZHtZczHRop9Cd6698Qr9jyTPdIs55FbgejzrVADvAmslqtcA6XxCBuG1nSF
 Qo48dp9Px7J74qNNuDt5/xLnQGJKaW60/BXrMK9G9QG4x9r4zuCayDO6Qc7FMWWR
 DG7k9nYoXJU5YG7xp9Rk+Yj3Ade8kqhTnKfqw0f2JfkLt0ChPG+rZcxICWSdzZm0
 AfHxuEQlwKaaFHFEsZhVehlsXkeU9OVywo+QDzmY2uqQ2ddlBZ47Qm2MWgTsv8i/
 euVsrzLtag==
 =EedX
 -----END PGP SIGNATURE-----

Merge tag 'v0.21.22'

release v0.21.22
2020-04-02 18:02:10 +02:00
Max Kellermann
afe2aaa5f6 fs/io/GzipOutputStream: increase buffer size to 16 kB
Reduce I/O overhead.
2020-04-02 17:17:58 +02:00
Max Kellermann
9b11caa0e6 fs/io/BufferedReader: larger default buffer (4 kB -> 16 kB)
Reduce I/O overhead.
2020-04-02 17:17:27 +02:00
Max Kellermann
e94c436264 src/event/meson.build: depend in libnet.a
The event library uses various libnet.a classes,
e.g. SocketDescriptor.
2020-04-02 17:16:05 +02:00
Max Kellermann
4d453a8313 fs/NarrowPath: add class FromNarrowPath
Move code from ParseCommandLine().
2020-04-02 17:15:34 +02:00
Max Kellermann
61d7b436a2 fs/NarrowPath: un-inline Windows constructor 2020-04-02 16:27:44 +02:00
Max Kellermann
cdddaf21b0 db/simple/Directory: optimize GetName() using the parent's path
This method gets called a lot during MPD startup, via FindChild() and
directory_load_subdir(), so this is worth optimizing at the expense of
code readability.

This speeds up MPD startup by 10%.
2020-04-02 16:12:08 +02:00
Max Kellermann
b267ba5f0a tag/Pool: enlarge hash table
This consumes more memory (plus 48 kB on 32 bit systems), but reduces
the number of hash collisions, speeding up MPD startup with large
databases.
2020-04-02 15:45:35 +02:00
Max Kellermann
8270043053 Revert "decoder/ffmpeg: copy the AVPacket in ffmpeg_send_packet()"
This reverts commit eb192137d6.

This is no longer necessary because we require FFmpeg 3.1 or newer
since MPD 0.21.2.

This fixes a deprecation warning because the implicit AVPacket copy
constructor copies the deprecated attribute `convergence_duration`.
2020-04-01 17:30:28 +02:00
Max Kellermann
672bc3ab67 time/Convert: fix GetTimeZoneOffset() on Windows
Was using the wrong parameter.
2020-04-01 16:21:29 +02:00
Max Kellermann
7d7bd51bc0 util/AllocatedArray: use using instead of typedef 2020-04-01 15:42:55 +02:00
Rosen Penev
71e551df42 replace locale.h with clocale
Switch to std:: functions. Changed the meson check. Works locally.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-31 18:05:23 -07:00
Max Kellermann
9c3e1d450a fs/io/GunzipReader: increase buffer size to 64 kB
Reduces I/O overhead while reading a compressed database file.
2020-03-31 15:07:39 +02:00
Rosen Penev
3540cf26b1 replace exit and _exit with std variants
_exit and std::_Exit are identical, expect the latter is standard C++.

Added several functions to the std namespace as a result of headers.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-26 18:44:09 -07:00
Max Kellermann
e1c43ec65f Merge branch 'ucl' of git://github.com/neheb/MPD into v0.21.x 2020-03-26 17:28:21 +01:00
Thomas Guillem
4dd10894ba lib/curl/Request: fix Exception "error" on Android
Apparently, it's not possible to change CURLOPT_NETRC on Android.
2020-03-26 17:26:14 +01:00
Rosen Penev
608d7ec1e7 [clang-tidy] change integer prefixes to uppercase
Found with readability-uppercase-literal-suffix

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-26 17:25:20 +01:00
Max Kellermann
8474599ed6 lib/curl/Easy: add method Unpause() 2020-03-26 17:22:10 +01:00
Max Kellermann
ab39f64fc0 lib/curl/Easy: add setter functions 2020-03-26 17:21:30 +01:00
Max Kellermann
185fbca282 lib/curl/Global: make ReadInfo() private 2020-03-26 17:20:10 +01:00
Max Kellermann
6e3b2fd844 lib/curl/Global: remove redundant API docs 2020-03-26 17:20:06 +01:00
Max Kellermann
dab39dc778 lib/curl: fix coding style 2020-03-26 17:19:48 +01:00
Max Kellermann
8cd5e79fbd event/*, ...: make GetEventLoop() const 2020-03-26 17:19:13 +01:00
Max Kellermann
1de3ac6c78 lib/curl/Init: add const overloads 2020-03-26 17:18:27 +01:00
Max Kellermann
abe06a5fa6 lib/curl/Init: add noexcept 2020-03-26 17:18:23 +01:00
Rosen Penev
85c27840a3
treewide: use boost::lround when std::round is unavailable
This is the case with uClibc-ng currently.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
(cherry picked from commit 769cd0ee9f0cf8ceb026aa751b5d4a390bb5dbdc)
(changed define to match master)
2020-03-25 18:54:15 -07:00
Thomas Guillem
81c16273c5 output/sles: use the AndroidMixerPlugin 2020-03-25 20:08:53 +01:00
Thomas Guillem
801ae86b5d mixer: add AndroidMixerPlugin 2020-03-25 20:07:26 +01:00
Thomas Guillem
5619fd0bba android: Context: add GetAudioManager 2020-03-25 20:07:25 +01:00
Thomas Guillem
200258c7c3 android: add AudioManager 2020-03-25 20:07:24 +01:00
Max Kellermann
5418bb49fb android/Context: add noexcept 2020-03-25 20:07:18 +01:00
Max Kellermann
3449c14ff5 java/Object: rename class Object to GlobalObject 2020-03-25 20:07:15 +01:00
Rosen Penev
cfa4524cb3 util/Math: change define
This has nothing to do with uClibc. It has everything to do with gcc's
libstdc++.

C99 math can be compile time disabled for it. Check for that and use boost
lround when std is not available.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-25 19:27:45 +01:00
Rosen Penev
4fd0c84f46 replace lrint with lround
lrint is a configurable version of lround that behaves either as round,
floor, ceil, or trunc based on setting the proper FE_ macro using
fset/getround. Given that it's not set at all and that it defaults to
round behavior, simply replace with round.

Also removed the util/Math defines.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-25 19:27:44 +01:00
Rosen Penev
e41a52d909 change abs() to std::abs()
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-25 19:27:42 +01:00
Rosen Penev
01e00632cc [cppcheck] fix format string
Found with invalidPrintfArgType_sint

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-25 19:27:40 +01:00
Rosen Penev
9bad5ee3c5
remove boost pow stuff for uClibc-ng
It's available there.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-24 17:21:21 -07:00
Rosen Penev
e87454ae88
MpcdecDecoderPlugin: use std variant of pow
It's available with uClibc-ng. It also offers overloads.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-24 17:16:51 -07:00
Rosen Penev
f319f88df4 [cppcheck] use const for several variables
Found with constVariable

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-23 21:03:22 -07:00
Max Kellermann
637840264a util/WStringCompare: reorder functions to relocate API docs 2020-03-22 19:20:29 +01:00
Max Kellermann
3888bafc1f util/StringCompare: add API documentation 2020-03-22 19:15:55 +01:00
Max Kellermann
adad4c7298 util/StringCompare: add missing include 2020-03-22 19:12:02 +01:00
Max Kellermann
d54acbcffd Merge branch 'sles-assert-fix' of git://github.com/tguillem/MPD-1 2020-03-22 10:51:28 +01:00