1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 08:18:11 +00:00

AK: Rename span() to bytes() when appropriate.

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.
This commit is contained in:
asynts 2020-08-15 18:38:24 +02:00 committed by Andreas Kling
parent 525d51bbb5
commit fff581cd72
18 changed files with 51 additions and 45 deletions

View file

@ -65,7 +65,7 @@ public:
virtual const ByteBuffer& data() const = 0;
virtual void overwrite(const ReadonlyBytes&) = 0;
virtual void overwrite(const ByteBuffer& buffer) { overwrite(buffer.span()); }
virtual void overwrite(const ByteBuffer& buffer) { overwrite(buffer.bytes()); }
virtual void overwrite(const u8* data, size_t size) { overwrite({ data, size }); }
virtual void apply_initialization_vector(const u8* ivec) = 0;