summaryrefslogtreecommitdiff
path: root/AK
AgeCommit message (Collapse)Author
2020-12-27AK: Use direct-list-initialization for Vector::empend() (#4564)Nathan Lanza
clang trunk with -std=c++20 doesn't seem to properly look for an aggregate initializer here when the type being constructed is a simple aggregate (e.g. `struct Thing { int a; int b; };`). This template fails to compile in a usage added 12/16/2020 in `AK/Trie.h`. Both forms of initialization are supposed to call the aggregate-initializers but direct-list-initialization delegating to aggregate initializers is a new addition in c++20 that might not be implemented yet.
2020-12-27LibJS: Implement (mostly) spec compliant version of Number.toString()Stephan Unverwerth
2020-12-27AK: Add NO_DISCARD macro to allow clang-format friendly class annotationsBrian Gianforcaro
clang-format seems to barf on these attributes, to make it easier to use these attributes and have clang-format not mangle the following code we can hide them behind a macro so clang-format doesn't have to handle it.
2020-12-26AK: Fix busted Trie testAnotherTest
This wasn't testing anything ^^'
2020-12-26AK: Make AK::IsSame<T, U>::value a constexpr boolAnotherTest
It being an enum value was preventing it from being used without `!!` in requires clauses (bool also makes more sense anyway).
2020-12-26AK: Add a prefix tree implementationAnotherTest
`AK::Trie` can be keyed by any given hashable type, and can store any metadata (including nothing at all). Also adds a test.
2020-12-26Everywhere: void arguments to C functionsLenny Maiorani
Problem: - C functions with no arguments require a single `void` in the argument list. Solution: - Put the `void` in the argument list of functions in C header files.
2020-12-26LibC: Enable compiler warnings for printf format stringsSahan Fernando
2020-12-25AK: Remove custom %w format string specifierAndreas Kling
This was a non-standard specifier alias for %04x. This patch replaces all uses of it with new-style formatting functions instead.
2020-12-25AK: Remove custom %b format string specifierAndreas Kling
This was a non-standard specifier alias for %02x. This patch replaces all uses of it with new-style formatting functions instead.
2020-12-24CMake: Decouple cmake utility functions from top-level CMakeLists.txtLenny Maiorani
Problem: - These utility functions are only used in `AK`, but are being defined in the top-level. This clutters the top-level. Solution: - Move the utility functions to `Meta/CMake/utils.cmake` and include where needed. - Also, move `all_the_debug_macros.cmake` into `Meta/CMake` directory to consolidate the location of `*.cmake` script files.
2020-12-23CMake: Remove file globbing in AK/TestsLenny Maiorani
Problem: - File globbing is performed at the time of build system generation. Any files which are not there at that time are not included. So, when a new file is added it is not built unless the build system is recreated. Solution: - Remove globbing from AK/Tests directory in favor of explicitly listing the files.
2020-12-23Kernel: Don't assert on PT_PEEK with kernelspace addressAndreas Kling
We were casting the address to Userspace<T> without validating it first which is no good and will trap an assertion soon after. Let's catch this sooner with an ASSERT in the Userspace<T> constructor and update the PT_PEEK and PT_POKE handlers to avoid it. Fixes #4505.
2020-12-21AK: Make JsonParser::parse_number properly parse >32bit intsSahan Fernando
2020-12-21AK: Test StringUtils::convert_to_int for different typesSahan Fernando
2020-12-21AK: Check for overflow in StringUtils::convert_to_intSahan Fernando
2020-12-21AK: Generalize AK::String::to_int() for more typesSahan Fernando
2020-12-21Everywhere: Switch from (void) to [[maybe_unused]] (#4473)Lenny Maiorani
Problem: - `(void)` simply casts the expression to void. This is understood to indicate that it is ignored, but this is really a compiler trick to get the compiler to not generate a warning. Solution: - Use the `[[maybe_unused]]` attribute to indicate the value is unused. Note: - Functions taking a `(void)` argument list have also been changed to `()` because this is not needed and shows up in the same grep command.
2020-12-20AllOf: Common iterator typesLenny Maiorani
Problem: - Interface is too permissive. It permits iterators of different types as long as they are comparable. Solution: - Require iterators be the same type.
2020-12-19AK: Remove bogus test case for CircularDuplexStream.asynts
2020-12-19AK: Remove awkward ByteBuffer construction modes (wrap & adopt)Andreas Kling
ByteBuffer previously had a flag that determined whether it owned the bytes inside it or not (m_owned.) Owned ByteBuffers would free() on destruction and non-owned ones would not. This was a huge source of confusion and made it hard to reason about lifetimes since there were no compile-time clues about whether a buffer was owned or non-owned. The adopt mode was used at some point to take over ownership of a random malloc'ed buffer, but nothing was using it so this patch removes that as well.
2020-12-19AK: Mark some Span functions with [[nodiscard]]Andreas Kling
I was confused by the trim() API, thinking it would mutate the span it was called on. Mark all const functions that return a new span with [[nodiscard]] so we can catch such mistakes.
2020-12-19LibTLS+LibCrypto: More ByteBuffer -> Span conversionAndreas Kling
2020-12-19LibTLS+LibCrypto: Replace a whole bunch of ByteBuffers with SpansAndreas Kling
2020-12-19AK: Add hash implementations for i16 and i64Sahan Fernando
2020-12-14Kernel: Generate a coredump file when a process crashesItamar
When a process crashes, we generate a coredump file and write it in /tmp/coredumps/. The coredump file is an ELF file of type ET_CORE. It contains a segment for every userspace memory region of the process, and an additional PT_NOTE segment that contains the registers state for each thread, and a additional data about memory regions (e.g their name).
2020-12-13AK: Add {encode,decode}_hex similar to {encode,decode}_base64Conrad Pankoff
2020-12-12AK: Fix urlencode() with high byte valuesConrad Pankoff
Previously urlencode() would encode bytes above 127 incorrectly, printing them as negative hex values.
2020-12-12AK::URL: Fix setting the port number in the case it was the last element of ↵xspager
the URL
2020-12-10AK: Add String::substring(start)Andreas Kling
This is a convenience API when you just want the rest of the string starting at some index. We already had substring_view() in the same flavor, so this is a complement to that.
2020-12-10AK: Ensure dual_pivot_quick_sort does not copy the pivotsAnotherTest
Also add a test that would fail to compile if quick_sort tries to copy anything :P
2020-12-09AK: Fix offset calculation error in DuplexMemoryStream::write.asynts
2020-12-09AK: Fix unsigned integer underflow in DuplexMemoryStream::write.asynts
2020-12-09AK: Add String::substring_view(size_t).asynts
2020-12-08AK: Fix reading across chunks in DuplexMemoryStreamAnotherTest
2020-12-08AK: Implement DuplexMemoryStream::offset_of() in terms of memmem()AnotherTest
This fixes the FIXME about missing matches that go across chunk boundaries.
2020-12-08AK: Implement memmem() for iterator haystacksAnotherTest
This uses the KMP algorithm to implement the search. Also replaces the slow route of the normal memmem() with KMP, which should be fairly faster (O(n + m) as opposed to O(n * m)) :^)
2020-12-08AK: Forward declare Nonnull{Own,Ref}PtrVectorAnotherTest
2020-12-08AK: Add header for SIMD vectorized typesSahan Fernando
2020-12-06AK: Make Formatter<StringView> not choke on Mode::CharacterLinus Groh
Formatter<char> internally uses Formatter<StringView> when in Mode::Character, but that would only accept Mode::{Default,String} and ASSERT_NOT_REACHED() otherwise, causing String::formatted("{:c}", 'a') to crash
2020-12-06AK: Add test for the will_be_destroyed and one_ref_left magic functionsAndrew Kaster
Fixes a regression introduced by 5c1b3ce. The commit description there asserts that the changes allow calling will_be_destroyed and one_ref_left, which are not required to be const qualified. The implementation in fact does require the methods to be const qualified, because we forgot to add the const_cast inside the decltypes :^)
2020-12-05AK: Pull Is{Integral,FloatingPoint} into the global namespaceLinus Groh
2020-12-02AK: Add insert_before/insert_after to InlineLinkedListTom
2020-11-30AK: Fix logic error in urldecode() percent-decodingLinus Groh
We also need to append the raw consumed value if *either* of the two characters after the % isn't a hex digit, not only if *both* aren't. Fixes #4257.
2020-11-29AK: Export ShouldChomp::NoChomp tooAnotherTest
It's much more elegant to say 'should_chomp ? Chomp : NoChomp' than to say 'if (should_chomp) ...(..., Chomp) else ...(...)'.
2020-11-29AK: Add missing GenericTraits<u8>devashish
This enables us to use keys of type u8 in HashMaps.
2020-11-27Lagom: Various fixes to make Lagom run on OSS-Fuzz (#4176)DavidKorczynski
2020-11-25AK: Always inline RefPtr::operator bool() and RefPtr::is_null()Andreas Kling
2020-11-25AK: Don't return empty StringImpl from create() when char* starts with \0Linus Groh
When creating a StringImpl for a C string that starts with a null-byte, we would ignore the explicitly given length and return the empty StringImpl - presumably to check for "\0", but this leads to false positives ("\0foo") so let's only care about the length.
2020-11-24AK: Add some inline capacity to StringBuilderAndreas Kling
This patch adds a 128-byte inline buffer that we use before switching to using a dynamically growing ByteBuffer. This allows us to avoid heap allocations in many cases, and totally incidentally also speeds up @nico's favorite test, "disasm /bin/id" more than 2x. :^)