summaryrefslogtreecommitdiff
path: root/AK
AgeCommit message (Collapse)Author
2021-08-27AK: Add Traits for Enumskleines Filmröllchen
Enums can be hashed as their underlying integral type. This allows enum keys in hash maps etc.
2021-08-26AK: Implement method to convert a String/StringView to title caseTimothy Flynn
This implementation preserves consecutive spaces in the orginal string.
2021-08-26AK: Make explode_byte depend on sizeof(FlatPtr) instead of ARCH(...)Ali Mohammad Pur
The assumption that FlatPtr is 64-bit on every platform except i686 is not correct, and also makes the definition of explode_byte() less nice to look at.
2021-08-24Userland: Remove IRC ClientAndreas Kling
The IRC Client application made some sense while our main communication hub was an IRC channel. Now that we've moved on, IRC is just a random protocol with no particular relevance to this project. This also has the benefit of removing one major client of the single- process Web::InProcessWebView class.
2021-08-23AK: Use explode_byte for pointer sanitizationHendiadyoin1
2021-08-23Kernel: Rename Processor::id() => current_id()Andreas Kling
And let id() be the non-static version that gives you the ID of a Processor object.
2021-08-22AK: Use POSIX specified types for Time::to_timespec and to_timevalRichard Wurth
The previous implementation assumed 64-bit time_t and 32-bit long, which is not true on some 32-bit systems
2021-08-21AK: Use `__builtin_bit_cast` if availableJesse Buhagiar
We now use the compiler's buitin version of bitcast if it's available instead of just resorting to using the builtin `memcpy`.
2021-08-19AK: Add GenericLexer API to consume an escaped Unicode code pointTimothy Flynn
This parsing is already duplicated between LibJS and LibRegex, and will shortly be needed in more places in those libraries. Move it to AK to prevent further duplication. This API will consume escaped Unicode code points of the form: \\u{code point} \\unnnn (where each n is a hexadecimal digit) \\unnnn\\unnnn (where the two escaped values are a surrogate pair)
2021-08-19AK: Move FormatParser definition from header to implementation fileTimothy Flynn
This is primarily to be able to remove the GenericLexer include out of Format.h as well. A subsequent commit will add AK::Result to GenericLexer, which will cause naming conflicts with other structures named Result. This can be avoided (for now) by preventing nearly every file in the system from implicitly including GenericLexer. Other changes in this commit are to add the GenericLexer include to files where it is missing.
2021-08-19AK: Add GenericLexer to forwarding headerTimothy Flynn
2021-08-19LibCore: Make DateTime's members signedIdan Horowitz
Core::DateTime is essentially a C++ wrapper of the tm struct, so we should support the same signed range as the underlying tm.
2021-08-19AK: Enable IntrusiveList self reference to be optimized out when emptyBrian Gianforcaro
If a member is an empty class, the standard normally stats that it needs to have a size of at least 1 byte in order to guarantee that the addresses of distinct objects of the same type are always distinct. However as of c++20, we can use [[no_unique_address]] to instruct the compiler that if the member has an empty type, it may optimize it to occupy no space.
2021-08-18AK+Kernel: StringView hash map Traits should not set peek type to StringBrian Gianforcaro
This typo / bug in the Traits<T> implementation for StringView caused AK::HashMap methods to return a `String` when looking up values out of a hash map of type HashTable<StringView,StringView>. This change fixes the typo, and fixes the only consumer, the kernel Commandline class.
2021-08-18AK: Add Utf8View::byte_offset_of overload for code point index lookupsTimothy Flynn
2021-08-15AK: Add adopt_nonnull_own_or_enomemsin-ack
This is basically a complement to adopt_nonnull_ref_or_enomem, and simplifies boilerplate for try_create functions which just return ENOMEM or the object based on whether it was able to allocate.
2021-08-15AK: Stop publishing detail namespaced functionsLenny Maiorani
Problem: - `AK::Detail::integer_sequence_generate_array` is published via a `using` directive in the `Array.h` header, but this is a `Detail` function. Solution: - Remove the `using` declaration.
2021-08-15AK: Pull RefCountedBase into the global namespaceAndreas Kling
2021-08-15AK: Add Time::is_negative() to detect negative time valuesBrian Gianforcaro
2021-08-15AK: Annotate AK::Time APIs as [[nodiscard]]Brian Gianforcaro
2021-08-15AK: Add Time::now_<clock_id> functions for obtaining the current timeBrian Gianforcaro
In the quest of removing as timespec / timeval usage in the Userland as possible, we need a way to conveniently retrieving the current clock time from the kernel and storing it in `AK::Time` format.
2021-08-15AK: Add adopt_nonnull_ref_or_enomemsin-ack
This gets rid of the ENOMEM boilerplate for handling memory allocation failures in the kernel.
2021-08-13IntrusiveRedBlackTree: Remove redundant subtraction of 0Lenny Maiorani
Problem: - ToT clang will not build due to casting `nullptr` to `u8*`. This is redundant because it casts to get a `0` then subtracts it. Solution: - Remove it since subtracting `0` doesn't do anything.
2021-08-13AK+Everywhere: Delete Variant's default constructorAli Mohammad Pur
This was exposed to the user by mistake, and even accumulated a bunch of users that didn't blow up out of sheer luck.
2021-08-13AK: Annotate String.count as [[nodiscard]]Brian Gianforcaro
2021-08-13AK: Avoid OOB access in UniformBumpAllocator::destroy_all()Ali Mohammad Pur
Otherwise we would end up calling T::~T() on some random memory right after our mapped block, which is most likely a pretty bad thing to do :P
2021-08-12AK: Add a IsSpecializationOf<T, Template> type traitAli Mohammad Pur
2021-08-12AK: Don't zero Variant data in the move constructorAli Mohammad Pur
There's no reason to zero the data that will be immediately overwritten.
2021-08-12AK: Add contains(char) method to StringJean-Baptiste Boric
2021-08-10AK: Add a formatter overload for Utf16ViewTimothy Flynn
2021-08-10AK+Kernel: Add StringBuilder::append overload for UTF-16 viewsTimothy Flynn
Currently, to append a UTF-16 view to a StringBuilder, callers must first convert the view to UTF-8 and then append the copy. Add a UTF-16 overload so callers do not need to hold an entire copy in memory.
2021-08-10AK: Convert StringBuilder to use east-constTimothy Flynn
2021-08-08AK: Add `typename` keyword for dependent typesDaniel Bertalan
This was made optional in C++20 in most cases, but Clang doesn't support omitting it yet. See P0634R3.
2021-08-08AK: Add formatting for infinity and NaNDaniel Bertalan
Without this patch, we would end up printing garbage values when we encountered floating point infinity or NaN values, and also triggered UBSAN with Clang. This added code models `std::format`'s behavior: the sign is added the same way as with normal values and the strings 'nan' and 'inf' are printed.
2021-08-08AK: Handle partial remaindersDaniel Bertalan
On x86, the `fprem` and `fmprem1` instructions may produce a 'partial remainder', for which we should check by reading a FPU flag. If we don't check for it, we may end up using values that are outside the expected range of values.
2021-08-08LibSanitizer+AK: Add float cast overflow handlerDaniel Bertalan
This is not enabled by default in GCC, but is in Clang.
2021-08-08AK: Use `explode_byte` in BumpAllocator.hDaniel Bertalan
When compiling this code with Clang, both branches of the ternary operator get evaluated at compile-time, triggering a warning about a narrowing implicit conversion. We can use `explode_byte` instead.
2021-08-08AK: Make `InputMemoryStream::read_LEB128_*` templatedDaniel Bertalan
On i686, reading integers larger than `2^32 - 1` would fail as the 32-bit `size_t` parameter would overflow. This caused us to read too few bytes in LibDebug's DWARF parser. Making this method templated solves this issue, as we now can call this API with a `u64` parameter.
2021-08-08AK: Use kmalloc_array() where appropriateAndreas Kling
2021-08-08AK: Add kmalloc_array() to trap multiplication overflowsAndreas Kling
This pattern is no good: kmalloc(elements * sizeof(T)); Since it silently swallows any multiplication overflow. This patch adds a simple kmalloc_array() that stops the program if overflow occurs: kmalloc_array(elements, sizeof(T));
2021-08-08Everywhere: Replace AK::Singleton => SingletonAndreas Kling
2021-08-08AK: Bring Singleton into the global namespace with `using`Andreas Kling
2021-08-07AK: Add RecursionDecisionsin-ack
Similar to IterationDecision, this can be returned from callbacks passed to recursive traversal functions to signal how to proceed.
2021-08-07AK: Use east const in MappedFileTimothy
2021-08-07AK: Add method to create MappedFile from fdTimothy
2021-08-07AK: Introduce IntrusiveListRelaxedConstJean-Baptiste Boric
This container is the same as IntrusiveList, except that it allows modifications to the elements even if the reference to the IntrusiveList itself is const, by returning mutable iterators. This represents a use-case where we want to allow modifications to the elements while keeping the list itself immutable. This behavior is explicitely opt-in by using IntrusiveListRelaxedConst instead of IntrusiveList. It will be useful later on when we model shared/exclusive locks with the help of const and mutable references.
2021-08-06AK: Implement any_of using common implementationLenny Maiorani
Problem: - `any_of` is implemented in 2 different ways, one for the entire container and a different implementation for a partial container using iterators. Solution: - Follow the "don't repeat yourself" (DRY) idiom and implement the entire container version in terms of the partial version.
2021-08-06Kernel: Rename Kernel/VM/ to Kernel/Memory/Andreas Kling
This directory isn't just about virtual memory, it's about all kinds of memory management.
2021-08-06AK: Improve the parsing of data urlsTheFightingCatfish
Improve the parsing of data urls in URLParser to bring it more up-to- spec. At the moment, we cannot parse the components of the MIME type since it is represented as a string, but the spec requires it to be parsed as a "MIME type record".
2021-08-06AK: Make StringBuilder::join() use appendff() instead of append()Ali Mohammad Pur
`append()` is almost never going to select the overload that is desired. e.g. it will append chars when you pass it a Vector<size_t>, which is definitely not the right overload :)