From e5ae2b043568a33052c924e2a9c107f74f5f9af6 Mon Sep 17 00:00:00 2001 From: apio Date: Fri, 23 Dec 2022 13:08:31 +0100 Subject: [PATCH] TarStream: Make read_contents and friends const --- luna/include/luna/TarStream.h | 4 ++-- luna/src/TarStream.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/luna/include/luna/TarStream.h b/luna/include/luna/TarStream.h index 29506dbe..9c926331 100644 --- a/luna/include/luna/TarStream.h +++ b/luna/include/luna/TarStream.h @@ -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 read_contents_as_string(const Entry& entry, usize offset, usize max); + Result read_contents_as_string(const Entry& entry, usize offset, usize max) const; private: struct [[gnu::packed]] TarHeader diff --git a/luna/src/TarStream.cpp b/luna/src/TarStream.cpp index 7383ef07..0235881c 100644 --- a/luna/src/TarStream.cpp +++ b/luna/src/TarStream.cpp @@ -87,7 +87,7 @@ Result 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 TarStream::read_contents_as_string(const Entry& entry, usize offset, usize max) +Result TarStream::read_contents_as_string(const Entry& entry, usize offset, usize max) const { char* buf = TRY(make_array(max + 1));