Commit graph

2351 commits

Author SHA1 Message Date
Ali Mohammad Pur e7dea10381 AK: Add RBTree::find_smallest_above_iterator(Key) 2022-02-09 20:57:41 +00:00
Ali Mohammad Pur cb7becb067 LibTLS+RequestServer: Add an option to dump TLS keys to a log file
This file allows us to decrypt TLS messages in wireshark, which can help
immensely in debugging network stuff :^)
2022-02-09 21:23:25 +01:00
Lenny Maiorani 138d54e595 AK+Kernel: Alphabetize debug macros
This is not ASCII-betical because `_` comes after all the uppercase
characters. Treating `_` as a ` ` (space character), these lists are
now alphabetical.
2022-02-09 17:59:19 +00:00
Hendiadyoin1 fbb798f98c AK: Move integral log2 and exp to IntegerMath.h 2022-02-06 17:52:33 +00:00
Hendiadyoin1 9ba9691d19 AK: Use integral power for FixedPoint formatting
This removes an ifdef for the Kernel
2022-02-06 17:52:33 +00:00
Hendiadyoin1 581c23dc55 AK: Introduce IntegralMath.h starting with pow<I> 2022-02-06 17:52:33 +00:00
Andreas Kling 5dd4b3eaaa LibWeb: Put ResolvedCSSStyleDeclaration debug spam behind a macro
Blowing up the debug console with a fajillion FIXME's whenever you
navigate in the web inspector is no fun.
2022-02-06 16:22:58 +01:00
Ali Mohammad Pur 9cf1c382df AK: Replace 'consteval' with 'constexpr' in some Variant helpers
CLion and/or clangd didn't like the consteval and highlighted visit() as
an error, just replace it with constexpr as it makes no difference here.
2022-02-06 13:10:10 +01:00
Liav A 54845c4bf2 AK: Remove commented-out code from Bitmap container
Instead, add a note to explain that there's a const variant of data()
method in the parent BitmapView class.
2022-02-05 18:14:12 +00:00
Idan Horowitz de7b5279cb AK: Make Vector::data() ALWAYS_INLINE
This was showing up in profiles of Browser, and it really shouldn't be.
2022-02-05 16:48:14 +01:00
Idan Horowitz 18b98f8c28 AK: Convert the try_make<T> factory function to use ErrorOr
This allows more ergonomic memory allocation failure related error
checking using the TRY macro.
2022-02-03 23:33:20 +01:00
Idan Horowitz ba0a2a3e2f AK: Hide the infallible make<T> factory function from the Kernel
This function has no users, nor should it ever be used in the kernel,
as all allocation failures in the Kernel should be explicitly checked.
2022-02-03 23:33:20 +01:00
Idan Horowitz 7933a9b6c8 AK: Stop using the make<T> factory function in Trie
This function is infallible, and so we would like to exclude it from
the Kernel, which includes this header.
2022-02-03 23:33:20 +01:00
Idan Horowitz a65bbbdb71 Kernel: Convert try_make_ref_counted to use ErrorOr
This allows more ergonomic memory allocation failure related error
checking using the TRY macro.
2022-02-03 23:33:20 +01:00
Idan Horowitz be4c144524 AK: Support formatting Vectors with any inline_capacity
The default Vector type has its inline capacity set to 0, which means
any Vector with non-zero inline capacity was unformattable.
2022-02-03 23:33:20 +01:00
Andreas Kling e86ab57078 AK+Kernel+LibSanitizer: Store "ubsan-is-deadly" flag as Atomic<bool> 2022-02-03 16:11:26 +01:00
Idan Horowitz 44e8c05c67 AK: Add a Utf16View::code_unit_offset_of(Utf16CodePointIterator) helper
This helper can be used to used to retrieve the code unit offset of an
active Utf16CodePointIterator efficiently.
2022-01-31 21:05:04 +02:00
Timothy Flynn 6efbafa6e0 Everywhere: Update copyrights with my new serenityos.org e-mail :^) 2022-01-31 18:23:22 +00:00
Timothy Flynn 94a346c9b9 AK: Add is_ascii_[binary,octal]_digit to CharacterTypes 2022-01-31 17:50:54 +00:00
Andreas Kling 51e5cc4e13 AK: Remove thread safety gunk from userspace WeakPtr
The implicit thread safety stuff is only needed by the kernel version
of WeakPtr, as userspace already makes no guarantees about this.
2022-01-31 16:19:23 +01:00
Daniel Bertalan 8473f6caee AK+Tests: Make null strings compare less than non-null strings
This behavior regressed in ca58c71faa.

Fixes #12213
2022-01-30 17:23:02 +00:00
Daniel Bertalan 1a4aad9b7e AK: Implement String's comparison operators in terms of StringView's 2022-01-29 23:08:27 +01:00
Daniel Bertalan 5b3ba2d9ad AK: Implement FlyString's comparison operators in terms of StringView's 2022-01-29 23:08:27 +01:00
Daniel Bertalan ca58c71faa AK: Implement all comparison operators for StringView 2022-01-29 23:08:27 +01:00
Idan Horowitz 9b0d90a71d AK: Support using custom comparison operations for hash compatible keys 2022-01-29 23:01:23 +02:00
Lenny Maiorani b0a54518d8 Everywhere: Remove redundant inline keyword
`constexpr` implies `inline` so when both are used it is redundant.
2022-01-29 21:45:17 +02:00
Pankaj Raghav 24c66b8442 AK: Fix log2 calculation for Integer
For a `N` bit integer X, the log2 calculation should be as follows:
(N - 1) - ctz(X)
2022-01-29 17:41:06 +02:00
Pankaj Raghav 61027e5303 AK: Add is_power_of_2 helper 2022-01-29 17:41:06 +02:00
Liav A 308e54bc19 AK+Kernel: Implement UUID mixed endianness support
This is being used by GUID partitions so the first three dash-delimited
fields of the GUID are stored in little endian order but the last two
fields are stored in big endian order, hence it's a representation which
is mixed.
2022-01-29 13:35:54 +02:00
kleines Filmröllchen cfb8eeebe8 AK: Allow constructing a JsonArray from any array-like type 2022-01-28 23:40:25 +01:00
kleines Filmröllchen 2f631f7dc0 AK: Allow constructing a JsonValue from a StringView explicitly
The next commit will destroy overload detection otherwise, so let's add
this constructor. Currently, the same work is already done implicitly
through the implicit `String(StringView)` constructor.
2022-01-28 23:40:25 +01:00
kleines Filmröllchen 07977ad94c AK: Introduce the ArrayLike concept
The ArrayLike type concept focuses on array-like data accesses. This
means the ability to randomly index, obtain size information, as well as
being able to expose the storage pointer. The last two already have the
standard APIs `size` and `data`, respectively.

The ArrayLike concept should always be fulfilled by Vector, FixedArray
and Array as the three main array-like types. C-style arrays themselves
of course can't fulfil ArrayLike (which could be considered ironic), but
as we don't use them much anyways this isn't a problem.
2022-01-28 23:40:25 +01:00
Ali Mohammad Pur bf82d9b5d7 AK: Simplify Variant's explicit overload detection mechanism a bit
This also allows us to remove the max-64-visitors restriction, and so
removes that assertion.
2022-01-28 00:50:04 +03:30
Timothy Flynn 01395169dc AK: Export the SameAs concept 2022-01-27 16:27:00 +00:00
Idan Horowitz 85437abfad Kernel: Support try-inserting RedBlackTree entry values by reference 2022-01-26 22:05:34 +00:00
Idan Horowitz 6e38076b48 AK: Use x86 specific fast path in fast_u32{fill, copy} on x86_64 2022-01-26 01:16:43 +02:00
Idan Horowitz 67ce9e28a5 AK: Standardize the behaviour of GenericLexer::consume_until overloads
Before this commit all consume_until overloads aside from the Predicate
one would consume (and ignore) the stop char/string, while the
Predicate overload would not, in order to keep behaviour consistent,
the other overloads no longer consume the stop char/string as well.
2022-01-25 13:41:09 +03:30
Idan Horowitz d49d2c7ec4 AK: Add a consume_until(StringView) overload to GenericLexer
This allows us to skip a strlen call.
2022-01-25 13:41:09 +03:30
James Puleo 10b25d2a57 AK: Implement HashTable::try_ensure_capacity, as used in HashMap
This was used in `HashMap::try_ensure_capacity`, but was missing from
`HashTable`s implementation. No one had used
`HashMap::try_ensure_capacity` before so it went unnoticed!
2022-01-25 09:17:22 +01:00
Sam Atkins c388a879d7 AK+Userland: Make AK::decode_base64 return ErrorOr 2022-01-24 22:36:09 +01:00
Sam Atkins f590cd1850 AK+Userland: Make AK::decode_hex() return ErrorOr
This lets us propagate the reason why it failed up to the caller. :^)
2022-01-24 22:36:09 +01:00
Sam Atkins 45cf40653a Everywhere: Convert ByteBuffer factory methods from Optional -> ErrorOr
Apologies for the enormous commit, but I don't see a way to split this
up nicely. In the vast majority of cases it's a simple change. A few
extra places can use TRY instead of manual error checking though. :^)
2022-01-24 22:36:09 +01:00
Tom c468a9cc2d AK: Add FixedPoint cast operator for up/downcasting to other sizes
This enables casting between different size FixedPoint variables or
constructing them from other sized FixedPoint values.
2022-01-23 22:45:21 +00:00
Tom 06fc72ca0c AK: Fix warnings when using FixedPoint with a precision >= 32 bits 2022-01-23 22:45:21 +00:00
Tom f021baf255 AK: Add Formatter<FixedPoint<...>> without floating point
Rather than casting the FixedPoint to double, format the FixedPoint
directly. This avoids using floating point instruction, which in
turn enables this to be used even in the kernel.
2022-01-23 22:45:21 +00:00
Tom 77b3230c80 AK: Loosen FixedPoint template contraints and forward-declare it
Because AK/Concepts.h includes AK/Forward.h and concepts cannot be
forward declared, slightly losen the FixedPoint template arguments
so that we can forward declare it in AK/Forward.h
2022-01-23 22:45:21 +00:00
Idan Horowitz a3a4d0aea2 AK: Make Optional<T> explicitly constructible from Optional<U>
As long as T is constructible from U. This allows us to avoid patterns
like `abc.has_value() ? Optional<U>(abc.value()) : Optional<U>()`.
2022-01-23 18:53:42 +02:00
Timothy Flynn b873a222d7 AK: Implement AK::Time's seconds_since_epoch_to_year without LibM
In order for this method to be used within LibC itself, avoid using the
floor() method from LibM, which is not available from within LibC. This
header similarly avoids other standard headers as well.
2022-01-23 12:48:26 +00:00
Michel Hermier e986ce961a AK: Avoid impl initialization before assignment in Stringconstructor 2022-01-23 13:29:12 +01:00
Nico Weber fd7de68d07 LibHTTP+AK: Rename CNETWORKJOB_DEBUG to NETWORKJOB_DEBUG 2022-01-23 00:45:22 +00:00