summaryrefslogtreecommitdiff
path: root/AK
AgeCommit message (Collapse)Author
2022-07-22Everywhere: Prefix 'TYPEDEF_DISTINCT_ORDERED_ID' with 'AK_'Linus Groh
2022-07-22Everywhere: Prefix 'TYPEDEF_DISTINCT_NUMERIC_GENERAL' with 'AK_'Linus Groh
2022-07-22AK: Add FixedArray::fill_withkleines Filmröllchen
This is a memset-like utility method.
2022-07-22AK: Remove FixedArray::must_create_but_fixme_should_propagate_errorskleines Filmröllchen
Nobody was using this anymore.
2022-07-21Kernel+LibPartition: Move GUIDPartitionTable into LibPartitionSamuel Bowman
2022-07-21Kernel+LibPartition: Move MBRPartitionTable into LibPartitionSamuel Bowman
2022-07-19AK+LibGfx+LibJS: Pass -1 as the file descriptor to anonymous mmapDaniel Bertalan
Serenity/Linux/macOS ignore the file descriptor when an anonymous mapping is requested. However, BSDs require the fd to be -1.
2022-07-19AK: Port StackInfo to FreeBSDDaniel Bertalan
This can almost be identical to the Linux version, except that the `pthread_attr_t` object is populated using a call to `pthread_attr_get_np` instead of `pthread_getattr_np`. FreeBSD also needs `pthread_atttr_t` to be initialized using `pthread_attr_init` instead of zero-initialization, but it's the technically correct thing to do on Linux as well.
2022-07-19AK: Do not negate Pthread error codes for `strerror()`Daniel Bertalan
On all systems I've checked, pthread functions return the positive error code directly.
2022-07-19AK: Add support for building on Android with API version >= 30Andrew Kaster
2022-07-15AK: Add a helper to get the last split-groupHendiadyoin1
2022-07-14AK: Use the correct data types in bitap_bitwise()Ali Mohammad Pur
Otherwise the bit twiddling goes all wrong and breaks some boundary cases. Fixes `StringView::contains(31-chars)`.
2022-07-14AK: Add Traits<ByteBuffer>::hash()Linus Groh
2022-07-12AK: Remove StringView(char const*) :^)sin-ack
This constructor relied on running strlen implicitly on its argument, thereby potentially causing out-of-bound reads (some of which were caught a few days ago). The removal of this constructor ensures that the caller must explicitly pass the size of the string by either: 1) Using operator""sv on literal strings; or 2) Calling strlen explicitly, making it clear that the size of the view is being calculated at runtime.
2022-07-12AK+Userland+Tests: Remove URL(char const*) constructorsin-ack
The StringView(char const*) constructor is being removed, and there was only a few users of this left, which are also cleaned up in this commit.
2022-07-12AK: Remove String <-> char const* comparison operatorssin-ack
During the removal of StringView(char const*), all users of these functions were removed, and they are of dubious value (relying on implicit StringView conversion).
2022-07-12Everywhere: Replace single-char StringView op. arguments with charssin-ack
This prevents us from needing a sv suffix, and potentially reduces the need to run generic code for a single character (as contains, starts_with, ends_with etc. for a char will be just a length and equality check). No functional changes.
2022-07-12Everywhere: Add sv suffix to strings relying on StringView(char const*)sin-ack
Each of these strings would previously rely on StringView's char const* constructor overload, which would call __builtin_strlen on the string. Since we now have operator ""sv, we can replace these with much simpler versions. This opens the door to being able to remove StringView(char const*). No functional changes.
2022-07-12Everywhere: Split Error::from_string_literal and Error::from_string_viewsin-ack
Error::from_string_literal now takes direct char const*s, while Error::from_string_view does what Error::from_string_literal used to do: taking StringViews. This change will remove the need to insert `sv` after error strings when returning string literal errors once StringView(char const*) is removed. No functional changes.
2022-07-12Everywhere: Explicitly specify the size in StringView constructorssin-ack
This commit moves the length calculations out to be directly on the StringView users. This is an important step towards the goal of removing StringView(char const*), as it moves the responsibility of calculating the size of the string to the user of the StringView (which will prevent naive uses causing OOB access).
2022-07-12AK: Add string literal helpers to AK::SourceGeneratorsin-ack
Since all uses of SourceGenerator are with literal strings, there is no need to burden generators with the sv suffix.
2022-07-12AK: Explicitly calculate length of char* when printingsin-ack
This moves out the calculation of the char* out to the formatter. Additionally, we now print (null) when a null pointer is passed.
2022-07-12AK: Make CheckedFormatString pass the char array size to StringViewsin-ack
This makes the assumption that we never pass a stack-allocated char array to CheckedFormatString arguments (dbgln, outln, warnln). This assumption seems to hold true for the current state of Serenity code, at least. :^)
2022-07-10AK: Treat empty string as invalid JSONLuke Wilde
Previously we would treat the empty string as `null`. This caused JavaScript like this to fail: ```js var object = {}; try { object = JSON.parse(""); } catch {} var array = object.array || []; ``` Since `JSON.parse("")` returned null instead of throwing, it would set `object` to null and then try and use it instead of using the default backup value.
2022-07-10LibGfx: Implement PNG filtering on writeKarol Kosek
Is it another great upgrade to our PNG encoder like in 9aafaec259? Well, not really - it's not a 2x or 55x improvement like you saw there, but still it saves something: - a screenshot of a blank Serenity desktop dropped from about 45 KiB to 40 KiB. - re-encoding NASA photo of the Earth to PNG again saves about 25% (16.5 MiB -> 12.3 MiB), compared to not using filters. [1]: https://commons.wikimedia.org/wiki/File:The_Blue_Marble_(remastered).jpg
2022-07-09AK: Always check shift amount in LEB128 read functionskleines Filmröllchen
Even shifting 0 by more than the value size is UB.
2022-07-09AK: Make VERIFY() work in MinSizeRel buildsAndreas Kling
2022-07-09AK: Add equality operators to compare RefPtr to NonNullRefPtrAllan Regush
2022-07-09AK: Add comparison operators to NonnullRefPtrAllan Regush
2022-07-09AK: Add IPv4Address::netmask_from_cidrMaciej
2022-07-06AK: Use an enum instead of a bool for String::replace(all_occurences)DexesTTP
This commit has no behavior changes. In particular, this does not fix any of the wrong uses of the previous default parameter (which used to be 'false', meaning "only replace the first occurence in the string"). It simply replaces the default uses by String::replace(..., ReplaceMode::FirstOnly), leaving them incorrect.
2022-07-05AK: Add an align_down_to power of two helperIdan Horowitz
Matching the similar align_up_to helper
2022-07-04AK: Add header for generic shorthandsFrHun
These are functions that can be expressed with just normal operators, but would be very repetetive.
2022-07-04AK: Add `nodiscard` attribute to Find functionsLenny Maiorani
2022-07-04AK: Add `nodiscard` attribute to BitStream functionsLenny Maiorani
2022-07-04AK: Add `nodiscard` attribute to BitCast functionsLenny Maiorani
2022-07-04AK: Add `nodiscard` attribute to BinarySearch functionsLenny Maiorani
2022-07-04AK: Add `nodiscard` attribute to BinaryHeap functionsLenny Maiorani
2022-07-04AK: Add `nodiscard` attribute to Base64 functionsLenny Maiorani
2022-07-04AK: Add `nodiscard` attribute to AnyOf functionsLenny Maiorani
2022-07-04AK: Add `nodiscard` attribute to AllOf functionsLenny Maiorani
2022-06-30AK: Add AK::ceil(float) and AK::ceil_log2(integer)MacDue
Co-authored-by: Leon Albrecht <leon2002.la@gmail.com>
2022-06-27AK: Perform a resize in ByteBuffer::get_bytes_for_writing()Lucas CHOLLET
ByteBuffer::get_bytes_for_writing() was only ensuring capacity before this patch. The method needs to call resize to register the appended data, otherwise it will be overwritten with next data addition.
2022-06-26AK: Recognize __CLION_IDE__ as well as __CLION_IDE_Ali Mohammad Pur
This used to be `__CLION_IDE_` before, but it seems to have been fixed in the latest EAP.
2022-06-23AK: Add saturating addition and subtraction to Checkedkleines Filmröllchen
2022-06-23AK: Zero previous pointer *after* fixing the insertion list in HashTableHendiadyoin1
2022-06-22AK: Clear the previous and next pointers of deleted HashTable bucketsIdan Horowitz
Usually the values of the previous and next pointers of deleted buckets are never used, as they're not part of the main ordered bucket chain, but if an in-place rehashing is done, which results in the bucket being turned into a free bucket, the stale pointers will remain, at which point any item that is inserted into said free-bucket will have either a stale previous pointer if the HashTable was empty on insertion, or a stale next pointer, resulting in undefined behaviour. This commit also includes a new HashMap test that reproduces this issue
2022-06-18Revert "AK: Add comparison operators to NonnullOwnPtr"Linus Groh
This reverts commit 50c88e5e3a6918f99cfcfb802d111cb22a87645c. The intention was to add them to NonnullRefPtr, not NonnullOwnPtr. That is also what was advertised in the PR, but not actually done in the reverted commit.
2022-06-18AK: Add comparison operators to NonnullOwnPtrAllan Regush
2022-06-15AK+Kernel: Remove RefPtrTraits template param in userspace codeAndreas Kling
Only the kernel actually uses RefPtrTraits, so let's not burden userspace builds with the complexity.