Commit Graph

959 Commits

Author SHA1 Message Date
Max Kellermann ea3f044cd8 util/SplitString: use std::string_view 2022-07-01 11:29:11 +02:00
Max Kellermann 6d23ac67f9 util/UriQueryParser: use std::string_view 2022-07-01 11:29:10 +02:00
Max Kellermann ca46b4d7a7 util/MimeType: use std::string_view 2022-07-01 11:29:10 +02:00
Max Kellermann 9976665cc7 util/UriRelative: use std::string_view internally 2022-07-01 10:56:29 +02:00
Max Kellermann c5f037fa64 util/StringCompare: move code from StringView 2022-07-01 10:48:34 +02:00
Max Kellermann 5ec13c0b06 util/StringStrip: add libc++ compatibility kludge 2022-07-01 10:45:37 +02:00
Max Kellermann b806b0a97f util/StringStrip: add std::string_view overloads 2022-06-30 21:00:07 +02:00
Max Kellermann 10197a0041 util/IterableSplitString: use std::string_view internally 2022-06-30 20:54:42 +02:00
Max Kellermann 166885802a util/StringSplit: move code from StringView.hxx 2022-06-30 20:40:41 +02:00
Max Kellermann 0173d3b313 util/IterableSplitString: use StringView::Split() 2022-06-30 20:37:58 +02:00
Max Kellermann aadd32c973 util/IterableSplitString: add `noexcept` 2022-06-30 20:34:04 +02:00
Max Kellermann 81afb47cd0 util/ByteOrder: add class PackedBE64 2022-06-30 10:30:54 +02:00
Max Kellermann bc3415ce8b Copyright year 2022 2022-06-30 09:41:53 +02:00
Max Kellermann 5140eaa5e7 util/IntrusiveList: use std::is_base_of_v 2022-06-29 17:30:11 +02:00
Max Kellermann 8a68d085b4 util/IntrusiveList: add option "constant_time_size" 2022-06-29 17:28:39 +02:00
Max Kellermann e437cc4faf util/IntrusiveList: add size() 2022-06-29 17:28:35 +02:00
Max Kellermann 1fb858e2d7 util/IntrusiveList: add struct IntrusiveListMemberHookTraits 2022-06-29 17:28:16 +02:00
Max Kellermann 3945a3add9 util/MemberPointer: new library 2022-06-29 17:28:15 +02:00
Max Kellermann 5348a446a7 util/IntrusiveList: move various static functions to struct IntrusiveListBaseHook 2022-06-29 17:27:40 +02:00
Max Kellermann e8e33d5fc4 util/IntrusiveList: add missing ToHook() calls 2022-06-29 17:27:37 +02:00
Max Kellermann c28580745b util/IntrusiveList: move struct HookDetection to top-level 2022-06-29 17:24:08 +02:00
Max Kellermann e7b587d550 util/CopyConst: use std::add_const 2022-06-29 17:23:50 +02:00
Max Kellermann 5d34b9b5bb util/SpanCast: move CopyConst to separate header 2022-06-29 17:23:44 +02:00
Max Kellermann 86be7938f1 util/SpanCast: swap the CopyConst template parameters 2022-06-29 17:23:41 +02:00
Max Kellermann 7ad5a5efec util/OffsetPointer: use std::byte 2022-06-29 17:23:32 +02:00
Max Kellermann 64f2735e60 util/SpanCast: add ToStringView() 2022-06-29 17:23:14 +02:00
Max Kellermann 3a0a0facdf util/SpanCast: suppress alignment warnings 2022-06-29 17:23:13 +02:00
Max Kellermann 4cb5c3782b util/HexFormat: require std::span 2022-06-29 17:22:17 +02:00
Max Kellermann 0a8aca516a util/StringBuffer: use data() instead of &front() 2022-06-07 10:11:05 +02:00
Max Kellermann 70808bde64 util/ForeignFifoBuffer: add MoveFrom() overload with std::span 2022-06-07 10:09:08 +02:00
Max Kellermann 93bf0fc547 util/ForeignFifoBuffer: use iterators 2022-06-07 10:08:58 +02:00
Max Kellermann 95e7f8b1c8 util/ForeignFifoBuffer: more `constexpr` 2022-06-07 10:08:58 +02:00
Max Kellermann 27e78c71e0 util/HexFormat: use std::span instead of ConstBuffer 2022-06-01 22:50:54 +02:00
Max Kellermann db03db0dca util/SpanCast: add FromBytesStrict() 2022-06-01 21:50:01 +02:00
Max Kellermann bd96f6e572 util/SpanCast: add const support to FromBytesFloor() 2022-06-01 21:49:35 +02:00
Max Kellermann 04041f9583 util/Manual: use std::aligned_storage_t
By using std::launder(), we can re-enable -Wstrict-aliasing.
2022-05-31 16:44:07 +02:00
Max Kellermann 826d1b207e util/Manual: add type aliases 2022-05-31 16:44:07 +02:00
Max Kellermann f92bae887f util/Manual: add `noexcept` 2022-05-31 16:44:07 +02:00
Max Kellermann d256d3dabe util/StringCompare: use std::string_view instead of StringView 2022-05-31 13:24:45 +02:00
Max Kellermann f045cf43e4 output/snapcast/Client: work around clang 14 std::span cast bug
Closes https://github.com/MusicPlayerDaemon/MPD/issues/1538
2022-05-24 14:18:50 +02:00
Max Kellermann 97f78059a2 util/AllocatedArray: add missing type alias "value_type" 2022-05-23 22:15:20 +02:00
Max Kellermann 01b32d5ee0 util/WritableBuffer: remove unused library 2022-05-20 11:22:03 +02:00
Max Kellermann b50173ae8b util/CircularBuffer: use std::span 2022-05-20 11:15:45 +02:00
Max Kellermann b37c031fd1 util/{HugeAllocator,SparseBuffer}: use std::span 2022-05-20 11:15:45 +02:00
Max Kellermann 7006b075c3 util/AllocatedArray: fix -Wunused-parameter 2022-05-20 09:48:49 +02:00
Max Kellermann 5fb97b81d1 util/AllocatedArray: migrate from {Const,Writable}Buffer to std::span 2022-05-19 20:52:48 +02:00
Max Kellermann bb7be9a4cd util/*FifoBuffer: migrate from WritableBuffer to std::span 2022-05-19 14:01:57 +02:00
Max Kellermann 957d3e51e0 util/{Const,Writable}Buffer: add std::span cast operators 2022-05-19 13:25:02 +02:00
Max Kellermann 6e1500c251 Merge branch 'v0.23.x' 2022-04-26 21:05:39 +02:00
Max Kellermann f88fc0ca1a util/ByteOrder: add class PackedBE32 2022-04-26 21:03:05 +02:00
Max Kellermann 7ed67d216b util/HugeAllocator: add SetName() 2022-04-26 20:44:36 +02:00
Max Kellermann a742e1fc71 util/PeakBuffer, ...: use [[gnu::]] attributes 2022-04-26 20:31:56 +02:00
Max Kellermann 7293b32025 util/HexFormat: faster implementation without snprintf() 2022-03-14 12:18:52 +01:00
Max Kellermann 047e169f3e util/BindMethod: merge MakeBind{Method,Function}Wrapper(), they are identical now 2021-12-03 13:51:56 +01:00
Max Kellermann 687327c9e8 util/BindMethod: merge structs {Method,Function}SignatureHelper into one 2021-12-03 13:51:56 +01:00
Max Kellermann 26dc37bd76 util/BindMethod: merge structs {Method,Function}WrapperGenerator into one 2021-12-03 13:51:55 +01:00
Max Kellermann c693e4aa64 util/BindMethod: remove unused struct MethodWithSignature 2021-12-03 13:51:55 +01:00
Max Kellermann acab731fef util/BindMethod: simplify MakeBindFunctionWrapper() 2021-12-03 13:51:55 +01:00
Max Kellermann 7e4ba3cb72 util/BindMethod: add MethodSignatureHelper::function_pointer 2021-12-03 13:51:55 +01:00
Max Kellermann 172c4d9c7d util/BindMethod: remove unnecessary template arguments from BindMethodWrapperGenerator 2021-12-03 13:51:55 +01:00
Max Kellermann bd5f6cbc7b util/BindMethod: simplify more templates using "auto" template arguments 2021-12-03 13:51:55 +01:00
Max Kellermann 6fcd1c734b util/BindMethod: eliminate struct BindMethodWrapperGenerator2 2021-12-03 13:51:55 +01:00
Max Kellermann eca097dbfb util/BindMethod: simplify more templates using "auto" template arguments 2021-12-03 13:51:55 +01:00
Max Kellermann 51ffafa011 util/BindMethod: use std::remove_reference_t 2021-12-03 13:51:25 +01:00
Max Kellermann 8dca602346 util/BindMethod: simplify BindMethod() 2021-12-03 13:51:18 +01:00
Max Kellermann 0ed24f3a05 util/IntrusiveList: disallow copying IntrusiveListHook 2021-12-03 13:50:05 +01:00
August2111 1ff8626716 MSVC util/StringAPI.hxx add usage of MSVC compiler 2021-11-26 17:30:17 +01:00
Max Kellermann 05f529fffd util/StringStrip: use [[gnu::...]] attributes 2021-11-26 16:24:55 +01:00
Max Kellermann 6f83bdd6f3 Merge branch '1' of git://github.com/neheb/MPD 2021-11-23 10:39:07 +01:00
Rosen Penev 9bcd425a85 array conversions
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-11-23 01:38:10 -08: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
Max Kellermann eea2d35d3a util/AllocatedString, ...: add missing include for std::exchange()
Fixes building with GCC 12.
2021-11-19 16:06:20 +01:00
Shen-Ta Hsieh e783c2bd2c
util/LazyRandomEngine: use std::optional to avoid allocation
Signed-off-by: Shen-Ta Hsieh <ibmibmibm.tw@gmail.com>
2021-11-14 03:53:42 +08:00
Max Kellermann f8cbba1850 util/Alloc: remove unused library 2021-10-13 14:48:16 +02:00
Max Kellermann 635ec3ce37 util/VarSize: use plain malloc() 2021-10-13 14:46:40 +02:00
Max Kellermann f510564d9d more [[gnu::...]] attributes 2021-10-13 12:07:05 +02:00
Max Kellermann a15c1c71d5 util/WritableBuffer: add WritableBuffer<void>::{FromVoid,ToVoid}() 2021-10-13 11:05:33 +02:00
Max Kellermann 8d679e7e00 util/IntrusiveList: add IntrusiveList::swap() 2021-10-13 11:04:42 +02:00
Max Kellermann 2b30ac2351 util/IntrusiveList: add another missing ToNode() call 2021-10-13 11:04:21 +02:00
Max Kellermann 1c97793b49 util/IntrusiveList: do not use the deprecated class std::iterator
Deprecated in C++17.  Since C++17, one is supposed to declare those 5
types manually.
2021-10-13 11:03:49 +02:00
Max Kellermann f6035f2dda util/UriRelative: use std::string_view
Eliminates lots of implicit std::string temporaries.
2021-10-07 14:49:53 +02:00
Max Kellermann c34a1e29de util/UriRelative: fix variable mixup 2021-10-07 14:44:41 +02:00
James D. Smith 49ed9dae34 util/UriUtil: New uri_squash_dot_segments. 2021-10-07 13:14:54 +02:00
Max Kellermann b1175acb59 util/StringView: hard-code C++17 2021-08-27 12:01:31 +02:00
Max Kellermann 672278e5fd util/StringView: use [[gnu::]] attributes 2021-08-27 11:59:37 +02:00
Max Kellermann da155f8822 util/StringCompare: use [[gnu::]] attributes 2021-08-27 11:58:25 +02:00
Max Kellermann 4026ef63b6 util/StringAPI: use [[gnu::]] attributes 2021-08-27 11:57:56 +02:00
Max Kellermann b282682ba5 use `using` instead of `typedef` 2021-08-27 11:57:33 +02:00
Max Kellermann ad00926e1b util/AllocatedArray: add method release() 2021-08-27 11:24:50 +02:00
Rosen Penev 53ffcf455c make several member functions const
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-08-26 13:15:52 -07:00
Max Kellermann 8a9d678bac Merge branch 'v0.22.x' 2021-05-25 18:21:42 +02:00
Namkhai B dbe12a6b90 util/RuntimeError: Disable format-security for gcc
Fixes building under GCC 11
2021-05-25 18:19:19 +02:00
Max Kellermann 96707c0426 release v0.22.7
-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCgAuFiEEA5IzWngIOJSkMBxDI26KWMbbRRIFAmClOSYQHG1heEBtdXNp
 Y3BkLm9yZwAKCRAjbopYxttFEkODD/49e950HLmZE8x3rmyeEEsgdvHkOVpPlKHo
 +wsmSsi+N0sQKgEOffSYyL0MRWaQqzRMnl1EcEVErCfQl5f1mOw9+TL4f5ZEjVNw
 CQFMy1awHtCfktgF5zq6NzXD3nor9mkjiP733x/kGcsxwfk/Y4radqUBKJ5Y4a2B
 YSg35a/YTOfLCmb9WBquwAi22x7AkyBzyrY3ToCzynVuaNcT3gvLsAAMFzRUKpqD
 QEoCtUxJ4CQayjWjtG/bBCs2TVSmJvovhM2xB4Jnm+MeZz+bKI0y+ALW2Wk0Agnd
 qxDqyCEnvHi5pf8i9usl4/A63VDC7HHj9kDSLtPLGTijv+7Wvvr4kNpwm2DuJ4q1
 1pOEgT480ryK1FPyO6XnYCk616NqjgMbplr6SQ1DuVpIddWdiGARoge/WiNvsbT9
 pnEp0q9V3cQmuJ30LlskMJHAPyrE3KSrO1s+4P2zUeirwnMnOCPdq+gT+lRw4GNG
 OqLFEDHaELgSaZxInCN8RCXdLMrpuvKm+FQQApU1KwbYPXIassR14yt6BPpjxqea
 vkvFLtpwFWthNPLkujak5rDqAPvbHzAeOfaOiZelzd21nl/1omiMXSXRcJkEjONi
 JC5VWJpi1PHMXocq6AcOQT/9XhIH4uDA+Xghn7CURBTB6WoB954TSmuVIjXTfgAv
 XQYqRR+7Yw==
 =Gtzo
 -----END PGP SIGNATURE-----

Merge tag 'v0.22.7'

release v0.22.7
2021-05-19 18:43:19 +02:00
Max Kellermann a169a05e41 win32, ...: avoid including windows.h
Include the most specific header documented by MSDN instead.
2021-05-19 17:25:32 +02:00
Max Kellermann 28e7be248f util/RuntimeError: disable -Wformat-security as a kludge 2021-05-19 14:57:20 +02:00
John Regan 87fa6bca54 flac encoder: enable Ogg FLAC and Ogg chaining
refactors GenerateOggSerial into a generic GenerateSerial
utility, under the util lib.

libFLAC may be encoded without Ogg support. If Ogg support is disabled,
libFLAC will still export Ogg-related methods (like setting a serial
number), and throw a runtime error when initializing an Ogg stream.

GenerateOggSerial does not depend on libogg. Refactoring it into
a generic GenerateSerial prevents having to add build-time checks
for libogg within the FLAC encoder plugin.
2021-05-15 11:31:01 -04:00
Max Kellermann 0122dc8452 util/BindMethod: drop support for GCC older than 7 2021-04-20 20:01:08 +02:00
Max Kellermann 95ad1b0cc6 use [[gnu::pure]] instead of gcc_pure
This is semi-standard and doesn't require the util/Compiler.h header.
2021-04-06 14:09:21 +02:00
Max Kellermann 52f46b94e9 util/AllocatedString: add concatenating constructor 2021-04-06 14:06:16 +02:00
Max Kellermann e07e0bc9c1 util/AllocatedArray: include cleanup 2021-04-06 14:05:29 +02:00
Max Kellermann ca726a0110 util/StringBuffer: make capacity() static
This allows using it in constant expressions.
2021-04-06 13:46:07 +02:00
Max Kellermann e01710cbd1 util/DereferenceIterator: simplify operator->()
This makes it compatible with containers storing std::unique_ptr.
2021-04-06 13:45:32 +02:00
Max Kellermann c87a4a7d08 util/DereferenceIterator: fix static_cast in operator->() 2021-04-06 13:45:10 +02:00
Max Kellermann dc9103befe util/AllocatedString: remove Null(), IsNull() 2021-03-04 18:05:29 +01:00
Max Kellermann 67760f5283 util/AllocatedString: support casting a nulled instance to string_view 2021-03-04 18:05:29 +01:00
Max Kellermann 99405a4c93 util/AllocatedString: add operator=() 2021-03-04 18:05:26 +01:00
Max Kellermann b833c5d2c7 util/AllocatedString: replace Clone() with copy constructor 2021-03-04 18:04:21 +01:00
Max Kellermann bca5d79f88 util/AllocatedString: add const_pointer constructor 2021-03-04 18:04:17 +01:00
Max Kellermann 6e1c8edf09 util/AllocatedString: add string_view constructor
Replaces the static Duplicate() method.
2021-03-04 18:04:11 +01:00
Max Kellermann 32b7b2e2fa util/AllocatedString: add default constructor 2021-03-04 18:04:06 +01:00
Max Kellermann cfb7f8ab84 util/AllocatedString: rename to BasicAllocatedString
To make things simpler, AllocatedString is now a non-template class.
2021-03-04 18:03:56 +01:00
Max Kellermann a6eb264770 util/IntrusiveList: add type alias "Hook"
By casting to SafeLinkIntrusiveListHook if appropriate, this fixes a
bug in the erase() method, where erase() calls
IntrusiveListHook::unlink() instead of
SafeLinkIntrusiveListHook::unlink().
2021-03-02 17:51:50 +01:00
Max Kellermann 0091c4e12b util/Exception: add FindNested() 2021-03-02 17:13:29 +01:00
Max Kellermann 80172e17ac util/Exception: remove redundant std::exception catch clause
The "std::nested_exception" catch block already covers this perfectly.
2021-03-02 17:13:21 +01:00
Max Kellermann ec0c1f0d02 util/Exception: fix comment typo 2021-03-02 17:12:20 +01:00
Max Kellermann 946b3c1f80 util/IntrusiveList: add method erase_and_dispose() 2021-02-25 14:12:47 +01:00
Max Kellermann a0dc398f36 util/IntrusiveList: erase() returns an iterator 2021-02-25 14:12:39 +01:00
Max Kellermann b54d2d984a util/IntrusiveList: use ToHook() in erase() 2021-02-25 14:12:10 +01:00
Max Kellermann 4ab73f9de9 util/IntrusiveList: add missing ToNode() cast in iterator_to() 2021-02-25 14:10:55 +01:00
Max Kellermann 1048f23680 util/IntrusiveList: add hook class SafeLinkIntrusiveListHook
Similar to boost::intrusive::safe_link.
2021-02-24 20:29:16 +01:00
Max Kellermann 8fe8f09027 util/IntrusiveList: add `noexcept` 2021-02-24 20:17:28 +01:00
Max Kellermann 78670c0941 util/IntrusiveList: add `constexpr` 2021-02-24 20:16:54 +01:00
Max Kellermann 75e8795e3f util/IntrusiveList: add method insert() 2021-02-22 23:32:51 +01:00
Max Kellermann 4912466d50 util/IntrusiveList: add method erase() 2021-02-22 23:32:47 +01:00
Max Kellermann 75c8d2235b util/ByteOrder: add classes PackedBE16, PackedLE16, PackedLE32 2021-02-16 17:37:25 +01:00
Max Kellermann 3456b1e50d use std::size_t 2021-02-12 18:39:28 +01:00
Max Kellermann 7fe0095fa7 util/IntrusiveList: add `noexcept` to defaulted constructor 2021-02-11 21:22:15 +01:00
Max Kellermann f4a5d671fe util/{Const,Writable}Buffer: include cleanup 2021-02-04 17:27:48 +01:00
Max Kellermann 04731fb7cc util/StringPointer: add operator==(std::nullptr_t) 2021-01-21 21:08:52 +01:00
Max Kellermann 9b2eb74f95 util/AllocatedString: fix operator= parameter type 2021-01-21 20:44:07 +01:00
Max Kellermann 84084baa65 util/AllocatedString: remove wrong `std::` prefix 2021-01-21 20:16:32 +01:00
Max Kellermann 3bc45fbf68 util/AllocatedString: remove Null(), IsNull() 2021-01-21 20:12:05 +01:00
Max Kellermann 36168a24f5 util/AllocatedString: support casting a nulled instance to string_view 2021-01-21 20:06:01 +01:00
Max Kellermann 5e67443a1a util/{Const,Writable}Buffer: always enable assertions 2021-01-21 20:04:00 +01:00
Max Kellermann 17858143b3 util/{Const,Writable}Buffer: enable `constexpr` on more methods 2021-01-21 20:03:53 +01:00
Max Kellermann c44a7b2705 util/AllocatedArray: add operator=(nullptr) 2021-01-21 20:03:38 +01:00
Max Kellermann 0ded23591b util/AllocatedString: add operator=() 2021-01-21 20:02:52 +01:00
Max Kellermann c1a7aa652d util/AllocatedString: replace Clone() with copy constructor 2021-01-21 20:02:41 +01:00
Max Kellermann 8d47f51399 util/AllocatedString: add const_pointer constructor 2021-01-21 18:06:10 +01:00
Max Kellermann a81c9bfb81 util/AllocatedString: add string_view constructor
Replaces the static Duplicate() method.
2021-01-21 18:05:51 +01:00
Max Kellermann 1caf57644f util/AllocatedString: add default constructor 2021-01-21 18:05:50 +01:00
Max Kellermann c70b63c183 util/AllocatedString: rename to BasicAllocatedString
To make things simpler, AllocatedString is now a non-template class.
2021-01-21 18:04:03 +01:00
Max Kellermann 8279cafd6d release v0.22.4
-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCgAuFiEEA5IzWngIOJSkMBxDI26KWMbbRRIFAmAJqgAQHG1heEBtdXNp
 Y3BkLm9yZwAKCRAjbopYxttFEg2QEACJLeN2mk2RU7Iqxbh/ekwm6aTM8D6bx8RH
 Xys4l1YAFQ0cg7sKZwMqefedGJG2j8CORbihYIF6Z8EvFsAiI6I3LjElfXrmnAc0
 Y9SnWHIR5vxlSQgyqPlJ0jl213uzoHHpel8PpEJbTtYONT+8f3fQEuLpO4/uWOIT
 S6mlX16vI0/Ydp//8UIazUUvjar1pPvBnSEZ0JZsZl8RTYlS/4SOfqpHnhhWnWpO
 9RXlLP9Zo68rJzNhUPwRj7NkyVEkg74xpjHOWoyeTMNQ6tKMQn8b4jb/LcBfj6hk
 I7mof5oX0aS+GyYaehKi9c9Az7wUcBxnnaN02qlAaSutcuox7ce70fKMtiAXRN0o
 T9mFSJm1JKqHZb1dFvxqSqFjVr7eO9XCxHqaEqTbXCT+CL/6AJQZi5SVcX4gCY1P
 NSM3Jnydjr73WFLmEfjCkWLTdtiJhY/2Q/J6+vcILMb3W2y5FaSHZTOFbxVG4nMM
 spoQ27b7PoB9MbxLR3QJkYLa0WE3FrTORYgsH8Po7ZcCU9+JvqDSBnGXxx+Yv+JJ
 dKMI5bEAvPziodSHHQXgD4lhx744JuiLAJNtlSYJvev1s2Irf2TtMHdmGERHQZwH
 5cr9sQLgyHCLvTBDGt1dVZq/Z0T/PCkweIa5cT6ZBAim1hs7g20g8ksyFK2ZPUbB
 vEGBNcuMIg==
 =CEEr
 -----END PGP SIGNATURE-----

Merge tag 'v0.22.4'

release v0.22.4
2021-01-21 17:42:26 +01:00
Max Kellermann 056ab199ab util/PeakBuffer: add method max_size() 2021-01-21 16:45:56 +01:00
Max Kellermann eea0e084af util/PeakBuffer: use std::byte instead of std::uint8_t 2021-01-21 16:45:31 +01:00
Max Kellermann fa82f558be util/PeakBuffer: add `noexcept` 2021-01-21 16:45:17 +01:00
Max Kellermann 6b555b7017 util/PeakBuffer: use std::size_t 2021-01-21 16:45:14 +01:00
Max Kellermann dafba203e7 util/ForeignFifoBuffer: use `auto` 2021-01-21 16:38:32 +01:00
Max Kellermann 07d2bc6898 util/StringView: add method SplitLast() 2021-01-21 13:20:01 +01:00
Max Kellermann 81ea749248 Merge branch 'v0.22.x' 2021-01-05 13:11:29 +01:00
Vincent Petry 74b2fc7fdc
Use uri_has_scheme for Webdav response href
Use uri_has_scheme to find out if the href in Webdav responses is absolute
to use the matching base path extraction.

Signed-off-by: Vincent Petry <PVince81@yahoo.fr>
2021-01-05 12:04:08 +01:00
Max Kellermann abbd980671 Merge branch 'v0.22.x' 2021-01-01 19:59:15 +01:00
Max Kellermann 5348f8c9c8 copyright year 2021 2021-01-01 19:54:28 +01:00
Max Kellermann 937da63ba6 util/StringView: add {Starts,Ends}With(char) 2020-12-15 17:04:39 +01:00
Max Kellermann 618f94f589 util/TemplateString: add StringView cast operator 2020-12-02 15:00:49 +01:00
Max Kellermann ad2c22844c util/TemplateString: add FromLiteral() 2020-12-02 15:00:39 +01:00
Max Kellermann 9420c74101 util/AllocatedArray: add nullptr constructor 2020-11-30 22:30:57 +01:00
Max Kellermann b1bef9c21d util/AllocatedArray: add method data() 2020-11-30 22:30:28 +01:00
Max Kellermann 5b0ef7ea98 util/AllocatedArray: add types pointer, const_pointer 2020-11-30 22:30:25 +01:00
Max Kellermann ab53c414bc util/StringView: add method SplitLast() 2020-11-30 22:29:38 +01:00
Max Kellermann b47e0cffdd util/TemplateString: rename CharAsString() to FromChar() 2020-11-30 22:23:28 +01:00
Max Kellermann 3af35aee9e util/TemplateString: add cast operators 2020-11-30 22:22:24 +01:00
Max Kellermann 02314ac7dd util/TemplateString: rewrite as constexpr functions
Hooray C++17!
2020-11-30 22:19:57 +01:00
Max Kellermann e7c4e87ac4 util/TemplateString: remove unnecessary implementation for static variable
This is obsolete since C++17.
2020-11-30 22:13:13 +01:00
Max Kellermann de58bfbb7f util/TemplateString: use std::size_t 2020-11-30 22:13:08 +01:00
Max Kellermann 0dda4c06b1 util/TemplateString: no indent after `namespace` 2020-11-30 22:13:04 +01:00
Max Kellermann ac4975cd7a util/MimeType: relicense to BSD-2 2020-11-18 15:28:21 +01:00
Max Kellermann afbcac9fb1 util/MimeType: use IterableSplitString() in ParseMimeTypeParameters() 2020-11-04 21:29:42 +01:00
Max Kellermann bb07fd42ce util/MimeType: migrate GetMimeTypeBase() to std::string_view 2020-11-04 21:20:03 +01:00
Max Kellermann bab626c325 util/UriExtract: remove the query string at the beginning of uri_get_suffix() 2020-11-04 21:15:41 +01:00
Max Kellermann 2a9131498f util/UriExtract: pass std::string_view to uri_get_suffix() 2020-11-04 21:13:57 +01:00
Max Kellermann 35a232105e util/UriExtract: uri_get_suffix() returns std::string_view
No need to copy it to a buffer.
2020-11-04 21:08:26 +01:00
Max Kellermann bb99cf37e3 release v0.22.2
-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCgAuFiEEA5IzWngIOJSkMBxDI26KWMbbRRIFAl+Zm30QHG1heEBtdXNp
 Y3BkLm9yZwAKCRAjbopYxttFEm0BD/0eeuI09j2LPCCQQdOUxl3ydWDLVVqDbT/b
 wUYLFEIscr0Kr8k4Mcl3C5LBEeCJq4ZYQ/VqlgNVC11SXVhq7IHJALJ3rYQVIpx+
 7MGfd1M0G39d9nlEFeKG2iNKx78aiBTqkMC9MtctacIOiKmntXP0cZZxpqGMMVZs
 5t8l8i2CM35BWisu0PjSvPJMzGVf9lgEIqx1ejHBFrX6V6DEZ8d6KEbV9FulNo1Y
 bH1UmKdsz71LC1ZE9EescmL5kVvaXyWyJmDDiu2/sqcMRjAHl2+RIAsunv6SqdGH
 Sk4OZbtXB8M8EQHuSJESUS6SnQEyGdwCptBn4NHXkajzRJqKCq0FRDyQGT+qrmUr
 H+91rZeWRYFbBMStP9l9MMQiTTjXgfCnHExDK9AmrMhiuYnuVxV1deEP7FXswCkd
 yU3sPpcKgdzMEYzoTuzXJVyMIKr0WOmNGFMEUbxfBXZDCbT1i9SH+Bi0kQAYe9h9
 JQTSWeS5NDRcI/b6nHS6ccUGFEp1scbXQNLw+17UvrUwfeZW9N9/t6jPS4kdUNEm
 tnNmbM/3o7yT3B8BGKTl5qBVSjCcgqKfsBXvy9Qn2zE0TN4HQPiJSDXZEH9LuZR1
 c6b8aI94gZkN4av1OAjmZgLyn+Pr2gyrei4FQNXyjNJkV5F3wiiLhhDTEMc2WLNm
 Zf4qpZArww==
 =eRNp
 -----END PGP SIGNATURE-----

Merge tag 'v0.22.2' into master

release v0.22.2
2020-10-28 17:33:10 +01:00
Max Kellermann 6bc73a9ebe util/FormatString: update API documentation 2020-10-28 15:48:42 +01:00
Max Kellermann 6f0ad2b6c5 util/IntrusiveList: replacement for boost::intrusive::list 2020-10-18 19:23:34 +02:00
Max Kellermann 643bf95366 util/OffsetPointer: use std::ptrdiff_t 2020-10-15 16:41:39 +02:00
Max Kellermann 36a187da39 util/Cast: include cleanup 2020-10-15 16:40:26 +02:00
Max Kellermann fec80f2835 util/Cast: use std::ptrdiff_t 2020-10-15 16:40:18 +02:00
Max Kellermann bb20af8f20 util/StringStrip: use std::strlen() 2020-10-15 12:54:47 +02:00
Max Kellermann 9355ec44e0 util/StringStrip: use std::size_t 2020-10-15 12:53:02 +02:00
Max Kellermann c63bd323ce util/StringCompare: use std::memcmp() 2020-10-15 12:48:33 +02:00
Max Kellermann 7c8427b0f7 Merge branch 'v0.21.x' into master 2020-09-21 11:37:50 +02:00
Max Kellermann b72801abf3 util/ByteOrder: add FromLE16S() 2020-09-21 11:15:45 +02:00
Max Kellermann 540919f256 *: use nullptr instead of NULL 2020-09-07 20:08:27 +02:00
Max Kellermann 67c7116f05 Merge branch 'v0.21.x' into master 2020-09-04 18:35:21 +02:00
Max Kellermann cbcdc73f9a system/ByteOrder: add `noexcept` 2020-08-14 16:36:24 +02:00
Max Kellermann 155fc8fa5a include cleanup 2020-07-23 16:26:18 +02:00
Max Kellermann 7daf80a0c0 util/RuntimeError: add IWYU pragma 2020-07-23 16:10:28 +02:00
Max Kellermann eb87c28225 util/CharUtil: fix doc typo 2020-07-23 16:08:52 +02:00
Max Kellermann df38e7565b util/HugeAllocator: import std::swap() 2020-07-01 21:56:58 +02:00
Max Kellermann cb49a03fd7 util/HugeAllocator: add `noexcept` 2020-07-01 21:56:54 +02:00
Max Kellermann 472881cb95 util/ByteOrder: remove redundant `inline` keywords from `constexpr` functions 2020-07-01 17:50:34 +02:00
Max Kellermann c4efc37ad8 system/ByteOrder: move to util/ 2020-07-01 17:49:57 +02:00
Max Kellermann 3d7147390f Merge branch 'v0.21.x' 2020-07-01 16:56:17 +02:00
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 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 14412c867f add a few IWYU pragmas 2020-06-10 21:10:33 +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
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
Max Kellermann bdc861f058 util/TemplateString: remove extra semicolon 2020-05-27 15:46:55 +02:00
Max Kellermann be94b4373a util/OffsetPointer: add `noexcept` 2020-05-14 15:44:23 +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 ba576ffa37 Merge branch 'v0.21.x' 2020-05-05 19:00:53 +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
Max Kellermann 814b2a218d util/CharUtil: add IsNonPrintableASCII()
Prepare to fix cc72ceb368
2020-04-27 14:01:54 +02:00
Max Kellermann 18ca734819 util/DereferenceIterator: new utility class 2020-04-24 16:02:31 +02: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 db93bb996c util/SplitString: convert return value to std::string_view
Eliminates lots of overhead.
2020-04-08 23:14:25 +02: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 870151214d util/SplitString: convert parameter to std::string_view 2020-04-03 16:47:45 +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 7d7bd51bc0 util/AllocatedArray: use `using` instead of `typedef` 2020-04-01 15:42:55 +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
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
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
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 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
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 1ec283d213 util/Exception: include cleanup 2020-03-19 20:13:04 +01:00
Max Kellermann fd71514068 Merge remote-tracking branch 'neheb/h' 2020-03-16 17:29:05 +01:00
Rosen Penev 97425d56e7
remove gcc_unused
[[maybe_unused]] (introduced in C++17) is standard C++.

https://clang.llvm.org/docs/AttributeReference.html#maybe-unused-unused
says that this is equivalent to the GNU unused attribute.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-16 00:08:21 -07:00
Rosen Penev 0afb156a5b
remove gcc_warn_unused
[[nodiscard] (introduced in C++17) can be used instead.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-16 00:08:21 -07:00
Rosen Penev a192e7b29b
remove gcc_deprecated
[[deprecated]] (introduced in C++14) may be used instead.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-16 00:08:21 -07:00
Rosen Penev 591f51f3d3
replace noreturn attribute with standard C++ version
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-16 00:08:18 -07:00
Rosen Penev 177371a003
treewide: get rid of C math function usage
Boost does not seem to offer an overload for lrint.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-15 20:22:07 -07:00
Rosen Penev 3ec9fcfc44
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>
2020-03-15 20:17:31 -07:00
Max Kellermann b5d1a09010 util/StringUtil: pass std::string_view to StringArrayContainsCase() 2020-03-13 20:38:40 +01:00
Max Kellermann 85b072b3d3 util/StringCompare: add StringIsEqual() with string_view 2020-03-13 20:36:48 +01:00
Max Kellermann 8a1f1fbe06 util/ASCII: migrate to std::string_view 2020-03-13 20:17:53 +01:00
Max Kellermann 3796247d6d util/Stringview: use `const_pointer` instead of hard-coding `const char *`
Fixes Windows build failure.
2020-03-13 19:43:23 +01:00
Max Kellermann 332f480ec3 util/UriExtract: uri_get_path() returns std::string_view 2020-03-13 18:54:41 +01:00
Max Kellermann 9a164668f2 util/UriExtract: migrate uri_get_scheme() to std::string_view 2020-03-13 18:51:11 +01:00
Max Kellermann 6876d160cf util/StringCompare: add more StringView overloads 2020-03-13 18:49:47 +01:00
Max Kellermann a63d0ee8fc util/StringView: add method substr() 2020-03-13 18:48:40 +01:00
Rosen Penev a2f5a63bbc
replace stdint.h with cstdint
The former is deprecated by C++14. The standard says they are the same:

The header defines all types and macros the same as the C standard library
header<stdint.h>.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-12 19:04:39 -07:00
Rosen Penev 2db8bcc353
replace stddef.h with cstddef
The former is deprecated with C++14. The standard says both are the same:

The contents and meaning of the header<cstddef>are the same as the C
standard library header<stddef.h>,except that it does not declare the type
wchar_t, that it also declares the type byte and its associated
operations (21.2.5), and as noted in 21.2.3 and 21.2.4.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-12 19:04:38 -07:00
Rosen Penev c846ee0d1b
replace stdarg.h with cstdarg
The former was deprecated in C++14. The Standard says they are the same:

The contents of the header<cstdarg>are the same as the C standard library
header<stdarg.h>, with the following changes: The restrictions that ISO C
places on the second parameter to the va_start macro in header<stdarg.h>
are different in this International Standard. The parameter parmN is the
rightmost parameter in the variable parameter list of the function
definition (the one just before the...).219If the parameter parmN is a
pack expansion (17.5.3) or an entity resulting from a lambda capture
(8.1.5), the program is ill-formed, no diagnostic required. If the
parameter parmN is of a reference type, or of a type that is not
compatible with the type that results when passing an argument for which
there is no parameter, the behavior is undefined.

Also changed va_list to the std:: namespace version, which is the same.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-12 19:03:12 -07:00
Rosen Penev ab9f5d2067
replace assert.h with cassert
The former was deprecated with C++14.

According to the C++11 and C++17 standards, both files are identical.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-12 15:25:38 -07:00
Max Kellermann 2d3b51665e util/BitReverse: generate table with constexpr function
Get rid of the macro hell.
2020-02-05 19:51:46 +01:00