summaryrefslogtreecommitdiff
path: root/AK/ByteBuffer.h
AgeCommit message (Collapse)Author
2021-01-02AK: Remove redundant compare() functions.asynts
2020-12-30AK: Add a ByteBuffer::copy(ReadonlyBytes) overloadAnotherTest
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-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-08-30AK: Fix ByteBuffer zero bytes allocationsTom
2020-08-22AK: Prevent confusing silent misuse of ByteBufferBen Wiederhake
Thankfully, this hasn't happened in any other code yet, but it happened while I was trying something out. Using '==' on two ByteBuffers to check whether they're equal seemed straight-forward, so I ran into the trap.
2020-08-15AK: Rename span() to bytes() when appropriate.asynts
I originally defined the bytes() method for the String class, because it made it obvious that it's a span of bytes instead of span of characters. This commit makes this more consistent by defining a bytes() method when the type of the span is known to be u8. Additionaly, the cast operator to Bytes is overloaded for ByteBuffer and such.
2020-08-06Refactor: Expose const_cast by removing ByteBuffer::warp(const void*, size_t)asynts
This function did a const_cast internally which made the call side look "safe". This method is removed completely and call sites are replaced with ByteBuffer::wrap(const_cast<void*>(data), size) which makes the behaviour obvious.
2020-07-27AK: Add span() / bytes() methods to container types.asynts
2020-07-03AK: Serialize entire log statementsTom
Prior to this, we wrote to the log every time the << operator was used, which meant that only these parts of the log statement were serialized. If the thread was preempted, or especially with multiple CPUs the debug output was hard to decipher. Instead, we buffer up the log statements. To avoid allocations we'll attempt to use stack space, which covers most log statements.
2020-05-02AK: Correct ByteBuffer::{overwrite,slice*} bounds checkAnotherTest
2020-04-08AK: Appending 0 bytes to a ByteBuffer should be a no-op (#1699)Paul Redmond
- inserting an empty string into LibLine Editor triggered an assertion trying to grow a ByteBuffer by 0 bytes.
2020-04-03AK: Add an overwrite API to ByteBufferAnotherTest
Since ByteBuffer is a Buffer, it should allow us to overwrite parts of it that we have allocated. This comes in useful in handling unsequenced writes like handling fragmented ip packets :^)
2020-03-08AK: Use __builtin_memset() and such to reduce header dependenciesAndreas Kling
We can use __builtin_memset() without including <string.h>. This is pretty neat, as it will allow us to reduce the header deps of AK templates a bit, if applied consistently. Note that this is an enabling change for an upcoming #include removal.
2020-02-20AK: Use size_t for ByteBuffer sizesAndreas Kling
This matches what we already do for string types.
2020-01-18Meta: Add license header to source filesAndreas Kling
As suggested by Joshua, this commit adds the 2-clause BSD license as a comment block to the top of every source file. For the first pass, I've just added myself for simplicity. I encourage everyone to add themselves as copyright holders of any file they've added or modified in some significant way. If I've added myself in error somewhere, feel free to replace it with the appropriate copyright holder instead. Going forward, all new source files should include a license header.
2019-09-30ByteBuffer: Remove pointer() in favor of data()Andreas Kling
We had two ways to get the data inside a ByteBuffer. That was silly.
2019-09-11AK: Add LogStream operator<< for ByteBufferAndreas Kling
2019-07-27ByteBuffer: Add slice_view(). Works like slice() but makes a wrapper only.Andreas Kling
So we already have ByteBuffer::wrap() which is like a StringView for random data. This might not be the best abstraction actually, but this will be immediately useful so let's add it.
2019-07-11AK: Remove use of copy_ref().Andreas Kling
2019-07-04AK: Move some of LogStream out of line & add overloads for smart pointers.Andreas Kling
2019-07-03AK: Rename the common integer typedefs to make it obvious what they are.Andreas Kling
These types can be picked up by including <AK/Types.h>: * u8, u16, u32, u64 (unsigned) * i8, i16, i32, i64 (signed)
2019-06-21AK: Rename Retainable.h => RefCounted.h.Andreas Kling
2019-06-21AK: Rename RetainPtr.h => RefPtr.h, Retained.h => NonnullRefPtr.h.Andreas Kling
2019-06-21AK: Rename RetainPtr => RefPtr and Retained => NonnullRefPtr.Andreas Kling
2019-06-21AK: Rename Retainable => RefCounted.Andreas Kling
(And various related renames that go along with it.)
2019-06-14AK: Massage it into building on my host system without breaking Serenity.Andreas Kling
2019-06-07Meta: Tweak .clang-format to not wrap braces after enums.Andreas Kling
2019-06-07AK: Run clang-format on everything.Andreas Kling
2019-05-28Add clang-format fileRobin Burchell
Also run it across the whole tree to get everything using the One True Style. We don't yet run this in an automated fashion as it's a little slow, but there is a snippet to do so in makeall.sh.
2019-04-25Kernel: Add a write cache to DiskBackedFS.Andreas Kling
This way you can spam small write()s on a file without the kernel writing to disk every single time. Flushes are included in the FS::sync() operation and will get triggered regularly by syncd. :^)
2019-04-23Do a pass of compiler warning fixes.Andreas Kling
This is really making me question not using 64-bit integers more.
2019-04-20AK: Add String::copy(BufferType) helper.Andreas Kling
This will create a String from any BufferType that has data() and size().
2019-03-18GIODevice: Add a read_all() that returns a ByteBuffer with all we can read.Andreas Kling
Use this to implement file opening in TextEditor.
2019-03-17AK: Make ByteBuffer's copy() and wrap() take void*.Andreas Kling
This way we don't have to cast whatever we're passing to copy()/wrap().
2019-03-16AK: Remove Buffer<T> since it was only ever instantiated with T=byte.Andreas Kling
Instead make a specialized AK::ByteBufferImpl class for the backing store of AK::ByteBuffer. This reduces template bloat.
2019-03-12Kernel: More work on the ICMP and IPv4 support.Andreas Kling
2019-02-25More moving towards using signed types.Andreas Kling
I'm still feeling this out, but I am starting to like the general idea.
2019-01-31Big, possibly complete sweep of naming changes.Andreas Kling
2019-01-18StringBuilder: Use a ByteBuffer internally instead of a Vector<String>.Andreas Kling
2018-12-21Yet another pass of style fixes.Andreas Kling
2018-12-04Import a simple text editor I started working on.Andreas Kling
2018-10-27Greatly improve /proc/PID/stack by tracing the ebp frame chain.Andreas Kling
I also added a generator cache to FileHandle. This way, multiple reads to a generated file (i.e in a synthfs) can transparently handle multiple calls to read() without the contents changing between calls. The cache is discarded at EOF (or when the FileHandle is destroyed.)
2018-10-16Reduce dependence on STL.Andreas Kling
2018-10-13Ext2FileSystem::readInode() should return an empty buffer for 0-length files.Andreas Kling
2018-10-10Import all this stuff into a single repo called Serenity.Andreas Kling