Commit Graph

947 Commits

Author SHA1 Message Date
Max Kellermann
bc758cece0 util/StringPointer: remove unnecessary operator!=()
The compiler must generate this implicitly from operator==().
2024-07-23 13:04:37 +02:00
Max Kellermann
0e4885c1fa util/IterableSplitString: remove unnecessary operator!=()
The compiler must generate this implicitly from operator==().
2024-07-23 13:04:30 +02:00
Max Kellermann
9944c97203 util/AllocatedString: remove unnecessary operator!=()
The compiler must generate this implicitly from operator==().
2024-07-23 13:04:20 +02:00
Max Kellermann
58a5550439 util/AllocatedArray: remove unnecessary operator!=()
The compiler must generate this implicitly from operator==().
2024-07-23 13:04:10 +02:00
Max Kellermann
f6a687dc2b util/FilteredContainer: new class 2024-07-11 15:30:30 +02:00
Max Kellermann
9210705598 util/TerminatedArray: new class 2024-07-11 15:30:30 +02:00
Max Kellermann
3d995bba5f util/DereferenceIterator: add class DereferenceContainerAdapter 2024-07-11 14:55:35 +02:00
Max Kellermann
c77f5095d6 util/DereferenceIterator: allow comparing with sentinel end iterators 2024-07-11 14:55:35 +02:00
Max Kellermann
3701378449 util/DereferenceIterator: fix operator- and operator+ return types 2024-07-11 14:29:10 +02:00
Max Kellermann
cb9f3c1a5b util/DereferenceIterator: optimize and simplify increment/decrement operators 2024-07-11 14:27:23 +02:00
Max Kellermann
fe66cde616 util/DereferenceIterator: add constexpr 2024-07-10 20:13:24 +02:00
Max Kellermann
0cc9ef0aee util/DereferenceIterator: remove unnecessary operator!=()
The compiler must generate this implicitly from operator==().
2024-07-10 20:13:19 +02:00
Max Kellermann
68a424d9e1 util/DereferenceIterator: add missing const 2024-07-10 20:11:55 +02:00
Max Kellermann
bd59c889f3 util/StringVerify: new library 2024-07-08 16:02:40 +02:00
Max Kellermann
7b938b4d14 util/Exception: sanitize message strings
This should prevent leaking unsanitized strings from libraries.
2024-06-25 20:29:07 +02:00
Max Kellermann
a67f7f88e4 util/MimeType: add missing include 2024-05-23 20:31:10 +02:00
Max Kellermann
ec8f467585 util/Intrusive*: add IWYU pragmas 2024-05-23 20:30:50 +02:00
Max Kellermann
9e3a66d5bf util/djb_hash: make inline and constexpr
Allows calculating hashes at compile time.
2024-05-23 20:30:17 +02:00
Max Kellermann
c7409d1e04 util/AllocatedString: add missing include 2024-05-23 20:22:44 +02:00
Max Kellermann
f5092cb73d util/DisposablePointer: new class 2024-05-15 05:58:23 +02:00
Max Kellermann
416f65fe01 util/RoundPowerOfTwo: new library 2024-05-13 20:25:57 +02:00
Max Kellermann
1760310123 Revert "util/IntrusiveList: allow the last disposer to destroy the IntrusiveList"
This reverts commit 669cbcd25a
("util/IntrusiveList: allow the last disposer to destroy the
IntrusiveList").  It was bad because it could lead to off-by-one crash
bugs when the last item was removed inside the previous item's
disposer.

We need a different solution for the other crash bug that was fixed by
the reverted commit.
2024-05-06 12:49:30 +02:00
Max Kellermann
56d4784b11 util/IntrusiveList: add API documentation 2024-05-06 12:48:53 +02:00
Max Kellermann
7ebe56fdd9 util/SpanCast: allow ToStringView() only with integral char types
This avoids std::string_view specialization that make no sense.
2024-04-16 12:37:08 +02:00
Max Kellermann
fae235197f util/SpanCast: allow ReferenceAsBytes() only with trivially-copyable
Addd the std::has_unique_object_representations_v constraint so we
cast stuff to std::byte only if this would make sense.
2024-04-16 12:33:36 +02:00
Max Kellermann
b3a31b69ee util/RedBlackTree: fix lost "right" child while swapping with successor
Fixes a tree corruption bug that led to assertion failures.
2024-04-10 13:35:31 +02:00
Max Kellermann
88475f2e2b util/RedBlackTree: swap colors when swapping with successor
Swapping was incomplete without swapping the colors; this led to
assertion failures under certain conditions.
2024-04-10 13:35:28 +02:00
Max Kellermann
e0a53d4747 util/IntrusiveTreeSet: add debug method Check()
Only for the unit test.
2024-04-10 13:35:21 +02:00
Max Kellermann
669cbcd25a util/IntrusiveList: allow the last disposer to destroy the IntrusiveList
Fixes a use-after-free bug in Co::MultiAwaitable::SetReady() when the
last callback frees the Co::MultiAwaitable owner.
2024-04-10 13:35:09 +02:00
Max Kellermann
2f7c19f139 util/SpanCast: rewrite ToStringView(std::span<std::byte>) to avoid cast ambiguities 2024-04-10 13:34:51 +02:00
Max Kellermann
e131f22642 util/SpanCast: merge two ToStringView() using std::remove_const_t 2024-04-10 13:34:25 +02:00
Max Kellermann
b6afdf1201 util/UriUtil: disable path segment stripping
This bug introduced by commit 49ed9dae34
and activated by commit acc1bd6297
caused leading spaces to disappear from the beginning of all file
names.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/1961
2024-04-03 22:00:36 +02:00
Max Kellermann
99da022775 util/IntrusiveSortedList: remove unused class 2024-04-03 21:31:08 +02:00
Max Kellermann
5a0bad3b2f util/IntrusiveTreeSet: new class 2024-04-03 21:29:34 +02:00
Max Kellermann
6a99f20828 util/IntrusiveHashSet: add concept checks to *Operators
This requires adding another template argument and reordering the others.
2024-04-03 21:27:37 +02:00
Max Kellermann
1e5c37ee78 util/SpanCast: add ToStringView() with non-const std::byte
Without this, we would get std::string_view<std::byte> which makes no
sense.
2024-04-03 20:58:03 +02:00
Max Kellermann
02c4512b00 util/CharUtil: add IsLowerHexDigit() 2024-03-11 15:32:24 +01:00
Max Kellermann
be84b189dc util, io, net, ...: use "#pragma once" 2024-03-11 15:32:24 +01:00
Max Kellermann
7f60acdfdd util/CharUtil: add IsUpperAlphaNumericASCII() 2024-01-18 18:53:05 +01:00
Max Kellermann
b601f4dc15 util/CNumberParser: remove unused function ParseInt64() 2024-01-04 21:07:50 +01:00
Max Kellermann
e1eea9d98a util/NumberParser: new library based on std::from_chars() 2024-01-04 21:03:37 +01:00
Max Kellermann
393d57b387 util/NumberParser: rename to CNumberParser
A new NumberParser library based on std::from_chars() will be added.
2024-01-04 21:02:45 +01:00
Max Kellermann
23b4688c44 util/ByteOrder: move Packed* classes to separate headers 2023-12-22 18:20:46 +01:00
Max Kellermann
ebf1fc7ca4 util/IntrusiveList: convert static_assert to concept check 2023-11-21 20:42:01 +01:00
Max Kellermann
edfa329e64 util/DereferenceIterator: use *declval() to guess the default value type
This allows the iterator to point to another iterator.
2023-11-21 20:40:47 +01:00
Max Kellermann
68b19ae087 util/SpanCast: add ReferenceAsWritableBytes() 2023-11-02 10:50:24 +01:00
Max Kellermann
a073db1e52 util/SpanCast: add ReferenceAsBytes() 2023-11-02 10:50:00 +01:00
Max Kellermann
10940da381 util/Intrusive{List,HashSet}: add "tag" for base hooks 2023-11-02 10:48:46 +01:00
Max Kellermann
db5f270f42 util/AllocatedString: fix string_view specialization in TotalSize() 2023-10-09 14:54:40 +02:00
Max Kellermann
86e7dff2fc util/TextFile: add missing cast 2023-10-07 08:39:24 +02:00