TarStream: Make read_contents and friends const
This commit is contained in:
parent
ad0f6546d7
commit
e5ae2b0435
@ -33,9 +33,9 @@ class TarStream
|
||||
|
||||
void rewind();
|
||||
|
||||
usize read_contents(const Entry& entry, void* buf, usize offset, usize length);
|
||||
usize read_contents(const Entry& entry, void* buf, usize offset, usize length) const;
|
||||
|
||||
Result<OwnedStringView> read_contents_as_string(const Entry& entry, usize offset, usize max);
|
||||
Result<OwnedStringView> read_contents_as_string(const Entry& entry, usize offset, usize max) const;
|
||||
|
||||
private:
|
||||
struct [[gnu::packed]] TarHeader
|
||||
|
@ -87,7 +87,7 @@ Result<TarStream::Entry> TarStream::read_next_entry()
|
||||
return parse_header(&header);
|
||||
}
|
||||
|
||||
usize TarStream::read_contents(const Entry& entry, void* buf, usize offset, usize length)
|
||||
usize TarStream::read_contents(const Entry& entry, void* buf, usize offset, usize length) const
|
||||
{
|
||||
if (offset >= entry.size) return 0;
|
||||
if ((length + offset) > entry.size) length = entry.size - offset;
|
||||
@ -97,7 +97,7 @@ usize TarStream::read_contents(const Entry& entry, void* buf, usize offset, usiz
|
||||
return length;
|
||||
}
|
||||
|
||||
Result<OwnedStringView> TarStream::read_contents_as_string(const Entry& entry, usize offset, usize max)
|
||||
Result<OwnedStringView> TarStream::read_contents_as_string(const Entry& entry, usize offset, usize max) const
|
||||
{
|
||||
char* buf = TRY(make_array<char>(max + 1));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user