Commit Graph

293 Commits

Author SHA1 Message Date
Max Kellermann 381215fd73 *: use std::scoped_lock with implicit template parameter 2024-05-23 20:54:49 +02:00
Max Kellermann b64d01677b storage/nfs: optimize OpenFile() 2024-05-17 13:39:42 +02:00
Max Kellermann f578a1cb2b storage/Interface: add virtual method OpenFile()
This should replace most InputStream::Open() calls because it is a
chance to reuse existing resources (e.g. the NFS connection).  No such
optimization is implemented, currently (and the method is not yet used
by anybody).
2024-05-17 12:54:08 +02:00
Max Kellermann 4800f1d8f2 storage/Interface: add [[nodiscard]] 2024-05-10 19:08:57 +02:00
Max Kellermann 9384bff6f9 lib/nfs/Manager: add method MakeConnection()
This uses the libnfs function nfs_parse_url_dir() which means MPD
gains support for the libnfs arguments like "version".

Closes https://github.com/MusicPlayerDaemon/MPD/issues/2039
2024-05-07 21:22:43 +02:00
Max Kellermann 164b5b0cf3 db/Song, SongUpdate: remove unnecessary c_str() calls
Just case implicitly to std::string_view, which is both simpler and
safer.
2024-05-07 21:13:38 +02:00
Max Kellermann d61c83ace8 lib/nfs/Connection: create the nfs_context in the constructor
Another lifetime simplification.
2024-05-06 18:22:23 +02:00
Max Kellermann e013c19223 storage/nfs: remove unused method EnsureConnected() 2024-05-06 18:16:11 +02:00
Max Kellermann 2b0275a1c8 lib/nfs/Connection: pass `server` and `export_name` as std::string_view 2024-05-06 17:01:15 +02:00
Max Kellermann 96888cce9c storage/nfs: pass std::string_view to the NfsStorage ctor 2024-05-06 15:28:01 +02:00
Max Kellermann bcc39be784 lib/nfs/Base: use std::string_view 2024-05-06 15:25:55 +02:00
Max Kellermann 0c1ecc96a8 *: let libfmt quote strings 2024-04-16 11:50:18 +02:00
Max Kellermann c04490bd52 storage/curl: eliminate std::strings, parse string_view directly 2024-01-04 21:11:07 +01:00
Max Kellermann b283fe07af lib/expat/ExpatParser: pass std::string_view to CharacterData() 2024-01-04 20:55:14 +01:00
Max Kellermann ee4b49d12f lib/expat/ExpatParser: pass std::string_view to Parse() 2024-01-04 14:28:12 +01:00
Max Kellermann 642de1510b lib/curl/Request: remove redundant CurlEasy wrapper methods 2023-12-09 20:54:21 +01:00
Max Kellermann 9027e5c5bb release v0.23.13
-----BEGIN PGP SIGNATURE-----
 
 iQJBBAABCgArFiEEA5IzWngIOJSkMBxDI26KWMbbRRIFAmRrqn4NHG1heEBibGFy
 Zy5kZQAKCRAjbopYxttFErXiD/9QIaeO5d+U7BJK1yGkQgu5vHo4Pm34ewP8LTxs
 K2MYxQQ2jZc7PXqi5Z04wmUw8ymq1BVA2D0ytMdl1Ejcbrste7UrP+1TuD8L9JBj
 WCE+4otNVYDpx1PB32BN+gxCmJqiFtAQS+eMIz/SXdEXZ9sJvIgYRRkSiSFd0WHM
 dT3OeeZ0V8cANbXpgI+RLghRGkVdpZJo4uXh3c0OHog1fjEBWPw6+7tH/mkotM0n
 /hQjI5j14wnzZuIpkDR1kuzvGYmxJKG6LkuUqcm1WexNFbxMqDSbAlXeCmzJn7eK
 NQvtROOGNjQ84thxRPLlDlYa6vbxoTqdYgZsVHzsQZWejhqw8zsPsF+Ea0A4tkLd
 UKDQFTphZMVqx74+1u7IjQyW7x+k02iXWLwH2IheEl+BJhvEB7zEflN9TR81jek4
 RrGx7jcTArdpt7okAe2ONkHvTYtIpaK5E2voza8K4TGOMzpkVlOkyvJ+rpn8CDRf
 w0faVvmCQdSrgHKfwUUY8Z47a7d+kkKpFLlvvzNoDV8drQXfgIj5t9HOLATSVVux
 l2pbgauXFsKyd4IsByXj+m8cBSvmy2C4eLJCsmguiZEvcobdJtzwOr4KuwQDjBsC
 8HW0BD0t9S1dSL59vJdMG+CfK/QU5rmAIkxdydD42uo9UmSS78xw1uQgi9oDaPa8
 XNCGdQ==
 =nOGh
 -----END PGP SIGNATURE-----

Merge tag 'v0.23.13'

release v0.23.13
2023-05-22 19:52:08 +02:00
Max Kellermann d5bf128cee storage/curl: throw HttpStatusError 2023-05-22 19:29:46 +02:00
Max Kellermann 8b77da545d *: use transparent comparison for std::{map,set} with std::string keys
This avoids many std::string temporaries for lookups.
2023-03-12 09:12:02 +01:00
Max Kellermann 815b248990 */Registry: use `constinit` 2023-03-07 12:04:16 +01:00
Max Kellermann 415de497d3 use more libfmt instead of sprintf() 2023-03-06 19:50:53 +01:00
Max Kellermann b5d224ce22 fs/{StandardDirectory,CheckFile}: move to fs/glue/
Distangle library dependencies.
2023-03-06 19:43:09 +01:00
Max Kellermann 42f6a0441c use [[gnu::...]] attributes 2023-03-06 16:14:15 +01:00
Max Kellermann 148aca23be use SPDX IDs, replacing the long copyright headers 2023-03-06 14:59:48 +01:00
Max Kellermann 8b73257a86 storage/meson.build: move MemoryDirectoryReader.cxx to storage_api.a
This library is required by the plugins, so this fixes a dependency issue.
2023-01-29 08:21:58 +01:00
Max Kellermann 3cc770a00b remove obsolete Boost dependency
Boost makes building a piece of software much more difficult than
necessary.  It's a huge library, and just uncompressing it takes a
considerable amount of time. MPD only used a tiny fraction of it, yet
its header bloat made the MPD build very slow.  Locating Boost was
difficult due to its arcane build system and its resistance to use
pkg-config; it's always a special case.  MPD could never use features
of newer Boost versions because Linux distributions always shipped old
Boost versions.  Boost made everything complicated and slow.

So, finally, after getting rid of GLib (commit ccdb94b06c), switching
to C++ and using Boost (commit 0801b3f495), we've finally get rid of
it 8 years later.

Unfortunately, I had to reimplement parts of it along the way
(e.g. IntrusiveList).  Kind of NIH, but on the other hand, compiling
MPD has become much easier for users.
2023-01-23 15:06:58 +01:00
Max Kellermann fa58db798b lib/fmt/RuntimeError: new library
Replacing FormatRuntimeError().
2022-11-29 14:10:34 +01:00
Max Kellermann 3278ad2ed8 storage/State: remove obsolete Boost compiler warning workaround 2022-11-17 05:32:29 +01:00
Max Kellermann 2e453ef58a storage/State: use std::hash() instead of boost::crc
Also eliminate the useless std::set.
2022-11-17 05:28:53 +01:00
Max Kellermann a5d04be21f storage/State: add `noexcept` 2022-11-17 05:19:11 +01:00
Max Kellermann 98c24d1a32 Merge branch 'v0.23.x' 2022-11-12 12:29:21 +01:00
Max Kellermann c2d0f35e7a storage/meson.build: move StorageState.cxx to "mpd" executable
Fixes spurious linker errors.
2022-11-12 12:24:48 +01:00
Max Kellermann ab99a57997 test/meson.build: reduce test_translate_song. dependencies 2022-11-12 12:17:35 +01:00
Max Kellermann d6d0f78e93 release v0.23.10
-----BEGIN PGP SIGNATURE-----
 
 iQJBBAABCgArFiEEA5IzWngIOJSkMBxDI26KWMbbRRIFAmNJ2e0NHG1heEBibGFy
 Zy5kZQAKCRAjbopYxttFEjBYEACk4QtVnD52sGtz0CwThFYzekvkZHOBcP2fYOH7
 rVcQaNmV7Fpnv+iz+k7zrqhs/A8FgQq6KUNpUn3gzxae4KsA7i1yEpopIqfzRh71
 eVrjTGijMirddehsxKbkjZ1TZy5S+SkZ+Bu965qzXUZuIrErKm4m5xqkIxXBHMEc
 twK9BSCqlTT2vpND5cmX90T/NBDgZd3uQxQP2ohWjVXvg9ou2gtns18ZdYUVRTym
 rLqRLfx1rG1lS8hzKqUqt9YxbWSD606T4giC2vYg2+2OFA9VFh3TNCSaFgWEJMZe
 ou6iaX+aSoCP+H6nktxfYravwdmHvBseRtrOouxPd8Br2k1eSQGXEVlZVTKrpBME
 OZnncEGqN27GggYH1RyVZ6showJ7G05HOhGFDDs8ABR0EbAbNkGvhrjl8cGXONYH
 ScTBbvqkTrhRMOOSmiAp7X1eLJ4QICAfhCV85YzSV93u69egO1MQLYzVYUurOOyt
 TuT+XbUD+Irk3DrHvhxs/IE+ciIvilFsvCmeNjCAyH4ZPvvHt/AIskQNyF3Jj720
 XKjtq6rMF9bizut/kboPgsVQoFbnj7ncCaIZ90h27obeqqiXajTx7ixJldvwDbrp
 yKQY6xDdm7DZChqYF0KKWWzLt2BoAzqVPW3zgRfJRqb9HtQ+ZVJuljvV8bBVFKN1
 zIA4Nw==
 =GQl1
 -----END PGP SIGNATURE-----

Merge tag 'v0.23.10'

release v0.23.10
2022-10-14 23:56:33 +02:00
Max Kellermann 5f9438dae6 storage/curl: include cleanup 2022-09-30 18:16:46 +02:00
BurroCargado 99e65c58ce storage/curl: make timestamp parsing more robust
According to the latest WebDAV specification (RFC4918),
timestamp string in the getlastmodified property is formatted
as rfc1123-date, such as "Sun, 06 Nov 1994 08:49:37 GMT".
However, to process responses from servers in the older style
format specified in RFC2518, timestamps in the HTTP-date format
had better be accepted.

As described in the libcurl api documentation, curl_getdate() can handle
timestamp strings in HTTP-date formats, including rfc1123-date.

https://www.rfc-editor.org/rfc/rfc4918#section-15.7
https://www.rfc-editor.org/rfc/rfc2518.html#section-13.7
https://curl.se/libcurl/c/curl_getdate.html
2022-09-29 18:19:30 +02:00
BurroCargado df71b07e9d storage/curl: fix can't get timestamp of remote file 2022-09-29 18:19:03 +02:00
Max Kellermann 2694195215 storage/curl: add `noexcept` and [[gnu::pure]] 2022-09-29 18:18:18 +02:00
Max Kellermann cc0def15c4 Copyright year 2022 2022-07-14 17:59:35 +02:00
Max Kellermann b52b0ac85a *: use BufferedOutputStream::Fmt() 2022-07-13 13:10:14 +02:00
Max Kellermann c7a8fc91c0 storage/curl: use std::string_view instead of StringView 2022-07-04 15:04:31 +02:00
Max Kellermann 19d2864c34 lib/curl/Headers: central type definition for the header map 2022-07-01 12:17:36 +02:00
Max Kellermann e6bb6c59ec storage/Composite: use std::string_view 2022-07-01 11:29:11 +02:00
Max Kellermann 1da09f5b1b lib/curl: use std::span 2022-06-29 17:37:12 +02:00
Max Kellermann d256d3dabe util/StringCompare: use std::string_view instead of StringView 2022-05-31 13:24:45 +02:00
Max Kellermann 1e548fb6e3 lib/curl/Headers: central type definition for the header map 2022-02-14 18:19:05 +01:00
Max Kellermann a5fa43b526 fs/io: move to io/ 2021-12-03 14:35:41 +01:00
Max Kellermann 8681a3d74c replace TextFile references with LineReader 2021-12-03 14:22:56 +01:00
Rosen Penev 250011f016 return by braced init list
shorter

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-11-22 23:28:08 -08:00
Rosen Penev 4e0e4c00bf treewide: replace lock_guard with scoped_lock
SonarLint reports the latter to be better:

std::scoped_lock basically provides the same feature as std::lock_guard,
but is more generic: It can lock several mutexes at the same time, with a
deadlock prevention mechanism (see {rule:cpp:S5524}). The equivalent code
to perform simultaneous locking with std::lock_guard is significantly more
complex. Therefore, it is simpler to use std::scoped_lock all the time,
even when locking only one mutex (there will be no performance impact).

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-11-11 17:13:03 -08:00