summaryrefslogtreecommitdiff
path: root/AK
AgeCommit message (Collapse)Author
2020-09-06AK: Vector use Traits<T>::equals in findMuhammad Zahalqa
Use Traits<T>::equals for equality checking in search functions instead of operator==
2020-09-06AK: SinglyLinkedList use Traits<T>::equals in findMuhammad Zahalqa
Use Traits<T>::equals for equality checking in search functions instead of operator==
2020-09-06AK: Add Bitmap::count_in_range and Bitmap::fill_rangeTom
2020-09-06AK: Add LogStream overload for ReadonlyBytes.asynts
This is extremely useful for debugging.
2020-09-06AK: Add JsonObject::remove()Andreas Kling
2020-09-06LibCompress: Simplify logic in deflate implementation.asynts
2020-09-06Streams: Consistent behaviour when reading from stream with error.asynts
The streaming operator doesn't short-circuit, consider the following snippet: void foo(InputStream& stream) { int a, b; stream >> a >> b; } If the first read fails, the second is called regardless. It should be well defined what happens in this case: nothing.
2020-09-06AK: Add Buffered<T> which wraps a stream, adding input buffering.asynts
2020-09-06AK: Add log stream operator overload for Span.asynts
2020-09-05AK: Make all DoublyLinkedList search methods use Traits<T>::equals (#3404)Muhammad Zahalqa
2020-09-01AK: Add OutputMemoryStream class.asynts
2020-09-01AK: Add DuplexMemoryStream::copy_into_contiguous_buffer.asynts
2020-09-01AK: Move memory streams into their own header.asynts
2020-09-01AK: Remove history from DuplexMemoryStream.asynts
That feature was really only useful for Compress::DeflateDecompressor but that is now using CircularDuplexBuffer instead.
2020-09-01Streams: Distinguish recoverable and fatal errors.asynts
2020-08-31AK: Add is_any_of(StringView) to GenericLexerAnotherTest
2020-08-30AK: Make %llx work in printfNico Weber
2020-08-30AK: Add String::copy_characters_to_buffer()Sergey Bugaev
This is a strcpy()-like method with actually sane semantics: * It accepts a non-empty buffer along with its size in bytes. * It copies as much of the string as fits into the buffer. * It always null-terminates the result. * It returns, as a non-discardable boolean, whether the whole string has been copied. Intended usage looks like this: bool fits = string.copy_characters_to_buffer(buffer, sizeof(buffer)); and then either if (!fits) { fprintf(stderr, "The name does not fit!!11"); return nullptr; } or, if you're sure the buffer is large enough, // I'm totally sure it fits because [reasons go here]. ASSERT(fits); or if you're feeling extremely adventurous, (void)fits; but don't do that, please.
2020-08-30AK: Fix FixedArray zero bytes allocationsTom
2020-08-30AK: Fix ByteBuffer zero bytes allocationsTom
2020-08-30AK: Add missing declaration in StringImpl.cppAndreas Kling
2020-08-30AK: Stream operators for String for generic streams.asynts
I think this should really be a member function of InputStream instead, but I don't want to include String in Stream.h. This will do for now...
2020-08-30AK: Add Optional::emplace method.asynts
2020-08-30AK: Provide off-switch for dbg() outputBen Wiederhake
2020-08-30AK: Unbreak building with extra debug macrosBen Wiederhake
2020-08-29AK: Don't swap endianness when writing endian wrappers to stream.asynts
2020-08-27AK: Define MakeUnsigned and MakeSigned for char.asynts
For some weird reason the C++ standard considers char, signed char and unsigned char *three* different types. On the other hand int is just an alias for signed int, meaning that int, signed int and unsigned int are just *two* different types. https://stackoverflow.com/a/32856568/8746648
2020-08-27Meta: Force semi-colon after MAKE_AK_NONXXXABLE()Ben Wiederhake
Before, we had about these occurrence counts: COPY: 13 without, 33 with MOVE: 12 without, 28 with Clearly, 'with' was the preferred way. However, this introduced double-semicolons all over the place, and caused some warnings to trigger. This patch *forces* the usage of a semi-colon when calling the macro, by removing the semi-colon within the macro. (And thus also gets rid of the double-semicolon.)
2020-08-27Tests: Document 'missing' testsBen Wiederhake
It's up for grabs. Anyone wants to write them? :)
2020-08-26AK: Add InputBitStream class.asynts
2020-08-26AK: Add CircularDuplexStream class.asynts
2020-08-26AK: Fix the signature of binary_search.asynts
2020-08-26AK: Add stream operators for Optional.asynts
2020-08-26AK+LibC+LibCore: Have fewer implementations of day_of_weekNico Weber
The implementation in LibC did a timestamp->day-of-week conversion which looks like a valuable thing to have. But we only need it in time_to_tm, where we already computed year/month/day -- so let's consolidate on the day_of_week function in DateTime (which is getting extracted to AK).
2020-08-26AK+LibC+LibCore: Add a days_in_year functionNico Weber
2020-08-26AK+LibC+LibCore: Have fewer implementations of days_in_monthNico Weber
2020-08-26AK+LibCore+Kernel: Have fewer implementations of day_of_yearNico Weber
The JS tests pointed out that the implementation in DateTime had an off-by-one in the month when doing the leap year check, so this change fixes that bug.
2020-08-26AK+LibC+Kernel: Have fewer implementations of year_to_days_in_epochNico Weber
I believe the implementation in RTC.cpp had an off-by-one in the year passed to is_leap_year(). If that's true, then this fixes that too.
2020-08-26AK+LibC+LibCore+Kernel: Have fewer implementations of is_leap_yearNico Weber
2020-08-26AK: Demonstrate and fix CheckedBen Wiederhake
Specifically: - post-increment actually implemented pre-increment - helper-templates that provided operator{+,-,*,/}() couldn't possibly work, because the interface of add (etc) were incompatible (not taking a Checked<>, and returning void)
2020-08-25AK: Add Endian.h header to replace NetworkOrdered.h.asynts
2020-08-25AK: TestSuite: Define assert macros with do { } while(0). (#3292)Paul Scharnofske
Consider the following scenario: if(condition) FOO(); else bar(); Suppose FOO is defined as follows: #define FOO() { bar(); baz(); } Then it expands to the following: if(condition) // Syntax error, we are not allowed to put a semicolon at the end. { bar(); baz(); }; else bar(); If we define FOO as follows: #define FOO() do { bar(); baz(); } while(false) Then it expands to the following: if(condition) do { bar(); baz(); } while(false); else bar(); Which is correct.
2020-08-25Kernel: Switch singletons to use new Singleton classTom
MemoryManager cannot use the Singleton class because MemoryManager::initialize is called before the global constructors are run. That caused the Singleton to be re-initialized, causing it to create another MemoryManager instance. Fixes #3226
2020-08-24AK: Add URL::create_with_data() to create data URLsAnotherTest
2020-08-24AK: Document that String{,Impl} contains NUL-terminatorBen Wiederhake
2020-08-24AK: Remove redundant declaration in String.cppBen Wiederhake
It already includes AK/Memory.h, which includes Kernel/StdLib.h, which. declares strstr().
2020-08-23AK: Fix human_readable_size corner casesBen Wiederhake
In particular: consistent rounding and extreme values. Before, rounding was something like 'away from 0.999...', which led to surprising corner cases in which the value was rounded up. Now, rounding is always 'down'. This even works for 0xffffffff, and also for 0xffffffffffffffffULL on 64-bit.
2020-08-23AK: Add tests for human_readable_size()Ben Wiederhake
2020-08-23AK: Print RHS and LHS in EXPECT_EQ if we canBen Wiederhake
This makes error messages more useful during debugging. Old: START Running test compare_views FAIL: ../AK/Tests/TestStringView.cpp:59: EXPECT_EQ(view1, "foobar") failed New: START Running test compare_views FAIL: ../AK/Tests/TestStringView.cpp:59: EXPECT_EQ(view1, "foobar") failed: LHS="foo", RHS="foobar"
2020-08-23AK: Add operator== to AK::OptionalPeter Elliott
The semantics: - two Optionals are equal if they are both None - two Optionals are equal if they are both Some, and their values are operator==