summaryrefslogtreecommitdiff
path: root/AK
AgeCommit message (Collapse)Author
2021-06-20AK: Reimplement any_of in terms of find_ifLenny Maiorani
Problem: - Now that a generic free-function form of `find_if` is implemented the code in `any_of` is redundant. Solution: - Follow the "don't repeat yourself" mantra and make the code DRY by implementing `any_of` in terms of `find_if`.
2021-06-19AK: Add support for keeping trailing zeros in fixed precision floatsIdan Horowitz
This uses the same syntax as zero padding integers: String::formatted("{:0.5}", 1.234) => "1.23400"
2021-06-19LibCoreDump: Include source locations of inlined functions in backtraceItamar
2021-06-19AK: Add RedBlackTree::find_largest_not_above_iteratorItamar
It's a version of find_largest_not_above that returns an iterator.
2021-06-18AK: Add a way to disable the trimming of whitespace in to_*intsin-ack
This behavior might not always be desirable, and so this patch adds a way to disable it.
2021-06-17AK: Add a :hex-dump mode to AK::FormatAli Mohammad Pur
This will just hexdump the given value. Note that not all formatters respect this, the ones that do are: - (Readonly)Bytes: formatter added in this commit - StringView / char const* - integral types
2021-06-17Meta: Add support for declaring componentsGunnar Beutner
Components are a group of build targets that can be built and installed separately. Whether a component should be built can be configured with CMake arguments: -DBUILD_<NAME>=ON|OFF, where <NAME> is the name of the component (in all caps). Components can be marked as REQUIRED if they're necessary for a minimally functional base system or they can be marked as RECOMMENDED if they're not strictly necessary but are useful for most users. A component can have an optional description which isn't used by the build system but may be useful for a configuration UI. Components specify the TARGETS which should be built when the component is enabled. They can also specify other components which they depend on (with DEPENDS). This also adds the BUILD_EVERYTHING CMake variable which lets the user build all optional components. For now this defaults to ON to make the transition to the components-based build system easier. The list of components is exported as an INI file in the build directory (e.g. Build/i686/components.ini). Fixes #8048.
2021-06-16AK: Add the Utf8View::{contains, trim} helper methodsIdan Horowitz
2021-06-16AK: Remove now unused InlineLinkedList classBrian Gianforcaro
All usages of AK::InlineLinkedList have been converted to AK::IntrusiveList. So it's time to retire our old friend. Note: The empty white space change in AK/CMakeLists.txt is to force CMake to re-glob the header files in the AK directory so incremental build will work when folks git pull this change locally. Otherwise they'll get errors, because CMake will attempt to install a file which no longer exists.
2021-06-16AK+Tests: Add IntrusiveList<T,...>::insert_before(..) methodBrian Gianforcaro
The insert_before method on AK::InlineLinkedList is used, so in order to achieve feature parity, we need to implement it for AK::IntrusiveList as well.
2021-06-16AK: Use IntrusiveList::remove() in the IntrusiveList::prepend() prologBrian Gianforcaro
All other functions use the functionality for removal, use it in the prepend function as well for consistency.
2021-06-15AK: Add support for removing SinglyLinkedList nodes during iterationIdan Horowitz
This commit also fixes the now-broken usage of SinglyLinkedList::remove in the Piano application.
2021-06-15AK: Add a missing `using AK::OrderedHashMap` statementIdan Horowitz
2021-06-15AK: Add Ordering support to HashTable and HashMapHediadyoin1
Adds a IsOrdered flag to Hashtable and HashMap, which allows iteration in insertion order
2021-06-15AK: Add a function that casts an enum to its underlying typeAli Mohammad Pur
This is basically the same thing as `std::to_underlying(Enum)`.
2021-06-13AK: Add FlyString::from_fly_impl()Andreas Kling
This allows you to create a FlyString directly from a known-fly StringImpl instance.
2021-06-13Userland: Allow building SerenityOS with -funsigned-charGunnar Beutner
Some of the code assumed that chars were always signed while that is not the case on ARM hosts. Also, some of the code tried to use EOF (-1) in a way similar to what fgetc() does, however instead of storing the characters in an int variable a char was used. While this seemed to work it also meant that character 0xFF would be incorrectly seen as an end-of-file. Careful reading of fgetc() reveals that fgetc() stores character data in an int where valid characters are in the range of 0-255 and the EOF value is explicitly outside of that range (usually -1).
2021-06-12AK: Add ByteBuffer::append(ReadonlyBytes)Matthew Olsson
2021-06-12AK: Make Ptr32 more transparentHediadyoin1
This adds a transparent dereference operator, aswell as a constant arrow operator Also increaces the verbosity of the code
2021-06-12AK: Rename Vector::append(Vector) => Vector::extend(Vector)Andreas Kling
Let's make it a bit more clear when we're appending the elements from one vector to the end of another vector.
2021-06-11AK+LibX86: Generalize u128/256 to AK::UFixedBigIntHendiadyoin1
Doing these as custom classes might be faster, especially when writing them in SSE, but this would cause a lot of Code duplication and due to the nature of constexprs and the intelligence of the compiler they might be using SSE/MMX either way
2021-06-11AK: Make NonnullRefPtrVector constructible from Vector<NonnullRefPtr>Ali Mohammad Pur
2021-06-09AK: Make Vector::take_last() ALWAYS_INLINEAli Mohammad Pur
This function doesn't do a whole lot, but is called quite a bit.
2021-06-09AK: Make a bunch of Variant methods ALWAYS_INLINEAli Mohammad Pur
2021-06-09Meta: Disable -Wmaybe-uninitializedAli Mohammad Pur
It's prone to finding "technically uninitialized but can never happen" cases, particularly in Optional<T> and Variant<Ts...>. The general case seems to be that it cannot infer the dependency between Variant's index (or Optional's boolean state) and a particular alternative (or Optional's buffer) being untouched. So it can flag cases like this: ```c++ if (index == StaticIndexForF) new (new_buffer) F(move(*bit_cast<F*>(old_buffer))); ``` The code in that branch can _technically_ make a partially initialized `F`, but that path can never be taken since the buffer holding an object of type `F` and the condition being true are correlated, and so will never be taken _unless_ the buffer holds an object of type `F`. This commit also removed the various 'diagnostic ignored' pragmas used to work around this warning, as they no longer do anything.
2021-06-09AK: Implement IPv4Address::to_string_reversed()Max Wipfli
2021-06-09AK: Allow changing the HashTable behaviour for sets on existing entriesIdan Horowitz
Specifically, replacing the existing entry or just keeping it and canceling the set.
2021-06-08AK: Make Vector capable of holding reference typesAli Mohammad Pur
This commit makes it possible to instantiate `Vector<T&>` and use it to store references to `T` in a vector. All non-pointer observers are made to return the reference, and the pointer observers simply yield the underlying pointer. Note that the 'find_*' methods act on the values and not the pointers that are stored in the vector. This commit also makes errors in various vector methods much more readable by directly using requires-clauses on them. And finally, it should be noted that Vector cannot hold temporaries :^)
2021-06-08AK: Switch to east const in Vector.hAli Mohammad Pur
Let's get this out of the way before touching the file.
2021-06-08AK: Reorder Vector methods to place similar methods next to each otherAli Mohammad Pur
The methods of this class were all over the place, this commit reorders them to place them in a more logical order: - Constructors/Destructor - Observers - Comparisons and const existence checks - Mutators: insert - Mutators: append - Mutators: prepend - Mutators: assignment - Mutators: remove - OOM-safe mutators: insert - OOM-safe mutators: append - OOM-safe mutators: prepend - OOM-safe size management - Size management - Iterators
2021-06-08AK: Rename Vector::{value_type => ValueType}Ali Mohammad Pur
2021-06-08AK: Don't create Utf8View from temporary String in URLParserMax Wipfli
This fixes a bug where a Utf8View was created with data from a temporary string, which was immediately deleted. This lead to a use-after-free issue. This also changes most occurences for StringBuilder::to_string in URLParser to use ::string_view(), as the value is passed as StringView const& most of the time anyways. This fixes oss-fuzz issue 34973.
2021-06-08AK: Utf8CodePointIterator: Don't output full string to debug outputMax Wipfli
When a code point is invalid, the full string was outputted to the debug output. For large strings, this can make the system quite slow. Furthermore, one of the cases incorrectly assumed the data to be null terminated. This patch modifies the debug statements not to print the full string. This fixes oss-fuzz issue 35050.
2021-06-08LibC+AK: Remove our custom macros from <assert.h>Gunnar Beutner
Other software might not expect these to be defined and behave differently if they _are_ defined, e.g. scummvm which checks if the TODO macro is defined and fails to build if it is.
2021-06-08AK: Add children() accessor to TrieMax Wipfli
2021-06-07LibJS: Move bytecode debug spam behind JS_BYTECODE_DEBUG :^)Andreas Kling
2021-06-07AK: Add IntrusiveList::size_slow() to match InlineLinkedListBrian Gianforcaro
The functionality is needed to replace InlineLinkedList with IntrusiveList in the Kernel Process class.
2021-06-06LibVideo: Scaffold LibVideo and implement simplistic Matroska parserFalseHonesty
This commit initializes the LibVideo library and implements parsing basic Matroska container files. Currently, it will only parse audio and video tracks.
2021-06-06Revert "Revert "AK: Always inline FlyString::view()""Linus Groh
This reverts commit f09216ac42bac9108e7f36ed2938c6f278f497e4. This was supposed to be a local test only, didn't mean to push it. :^)
2021-06-06Revert "AK: Always inline FlyString::view()"Linus Groh
This reverts commit 66f15c2e0c34caed8ce56075a366b20c4d1819af.
2021-06-06AK: Add the parse_ascii_base36_digit methodIdan Horowitz
This is similar to parse_ascii_hex_digit but can parse the whole A-Z range (also known as base36).
2021-06-06AK+Everywhere: Disallow constructing Functions from incompatible typesAli Mohammad Pur
Previously, AK::Function would accept _any_ callable type, and try to call it when called, first with the given set of arguments, then with zero arguments, and if all of those failed, it would simply not call the function and **return a value-constructed Out type**. This lead to many, many, many hard to debug situations when someone forgot a `const` in their lambda argument types, and many cases of people taking zero arguments in their lambdas to ignore them. This commit reworks the Function interface to not include any such surprising behaviour, if your function instance is not callable with the declared argument set of the Function, it can simply not be assigned to that Function instance, end of story.
2021-06-05AK: Always inline FlyString::view()Andreas Kling
2021-06-05AK: Stop using U+0000 as end of file code point in URL parserMax Wipfli
This changes URL parser to use the 0xFFFFFFFF constant instead of 0 to indicate end of file. This fixes a bug where inputs containing null bytes would terminate the parser early, because they were interpreted as end of file.
2021-06-05AK: Make debugging URLParser easierMax Wipfli
This patch adds a state_name method to URLParser to convert a state to a string. With this, the debugging statements now display the state names. Furthermore, this fixes a bug where non-ASCII code points were formatted as characters, which fails an assertion in the formatting system.
2021-06-05AK: Do not trim away non-ASCII bytes when parsing URLMax Wipfli
Because non-ASCII code points have negative byte values, trimming away control characters requires checking for negative bytes values. This also adds a test case with a URL containing non-ASCII code points.
2021-06-05AK: Update URLParser.{cpp,h} to use east constMax Wipfli
2021-06-04AK: Verify that functions aren't modified while they're being invokedGunnar Beutner
A Function object should not be set to a different functor while the original functor is currently executing.
2021-06-04AK: Allow deferring clear() for the Function classGunnar Beutner
Ideally a Function should not be clear()ed while it's running. Unfortunately a number of callers do just that and identifying all of them would require inspecting all call sites for operator() and clear(). Instead this adds support for deferring clear() until after the function has finished executing.
2021-06-04AK: Inline *String::is_one_of<Ts...>()Ali Mohammad Pur
Previously this was generating a crazy number of symbols, and it was also pretty-damn-slow as it was defined recursively, which made the compiler incapable of inlining it (due to the many many layers of recursion before it terminated). This commit replaces the recursion with a pack expansion and marks it always-inline.