summaryrefslogtreecommitdiff
path: root/AK
AgeCommit message (Collapse)Author
2020-12-28AK: Enable AK::SharedBuffer for all platformsAndrew Kaster
A future patch could do some MacOS specific things for set_volatile/set_nonvolatile. For now, swap out the defined(__linux__) branches for simple not __serenity__ branches.
2020-12-28AK/Userland: Use AK/Endian.h for portable byte swapping in ntpqueryAndrew Kaster
Create macros for the byte swap operations one would expect to be in endian.h or byteswap.h in AK/Endian.h. It's likely a similar/different change will be needed for BSDs, but there's no github action for those added to the project yet.
2020-12-28AK: Add CLOCK_*_COARSE aliases for darwin and BSD variantsAndrew Kaster
The coarse clocks in time.h are a linux extension that we've adopted. MacOS and the BSDs don't have it, so we need an alias in a platform header for Lagom builds.
2020-12-27Kernel: Allow Userspace<T> pointers with invalid contentAndreas Kling
It's not an error to create a Userspace<T> that points to kernel memory as the point of Userspace<T> is not to validate the address, but rather to choose safe overloads that do validation before any data transfer takes place. Fixes #4581.
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.