diff options
author | Andreas Kling <kling@serenityos.org> | 2021-11-07 14:07:23 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-11-08 00:35:27 +0100 |
commit | 72f3fd824ecaca7223ad3304501f93de405bc116 (patch) | |
tree | d3d542558e70ddb9f27189754d516dfd67e2e32c /Userland/Libraries/LibSQL | |
parent | fbe8f185b551c2149c188686e9d3bee642a52e7d (diff) | |
download | serenity-72f3fd824ecaca7223ad3304501f93de405bc116.zip |
LibSQL: Replace Result<T, E> use with ErrorOr<T>
Diffstat (limited to 'Userland/Libraries/LibSQL')
-rw-r--r-- | Userland/Libraries/LibSQL/Heap.cpp | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibSQL/Heap.h | 3 |
2 files changed, 3 insertions, 4 deletions
diff --git a/Userland/Libraries/LibSQL/Heap.cpp b/Userland/Libraries/LibSQL/Heap.cpp index 63eab42804..7bf8bf9fd6 100644 --- a/Userland/Libraries/LibSQL/Heap.cpp +++ b/Userland/Libraries/LibSQL/Heap.cpp @@ -44,7 +44,7 @@ Heap::Heap(String file_name) dbgln_if(SQL_DEBUG, "Heap file {} opened. Size = {}", file_name, size()); } -Result<ByteBuffer, String> Heap::read_block(u32 block) +ErrorOr<ByteBuffer> Heap::read_block(u32 block) { auto buffer_or_empty = m_write_ahead_log.get(block); if (buffer_or_empty.has_value()) @@ -56,7 +56,7 @@ Result<ByteBuffer, String> Heap::read_block(u32 block) VERIFY_NOT_REACHED(); auto ret = m_file->read(BLOCKSIZE); if (ret.is_empty()) - return String("Could not read block"); + return Error::from_string_literal("Could not read block"sv); dbgln_if(SQL_DEBUG, "{:02x} {:02x} {:02x} {:02x} {:02x} {:02x} {:02x} {:02x}", *ret.offset_pointer(0), *ret.offset_pointer(1), *ret.offset_pointer(2), *ret.offset_pointer(3), diff --git a/Userland/Libraries/LibSQL/Heap.h b/Userland/Libraries/LibSQL/Heap.h index b78b486dda..51c21a224a 100644 --- a/Userland/Libraries/LibSQL/Heap.h +++ b/Userland/Libraries/LibSQL/Heap.h @@ -8,7 +8,6 @@ #include <AK/Debug.h> #include <AK/HashMap.h> -#include <AK/Result.h> #include <AK/String.h> #include <AK/Vector.h> #include <LibCore/File.h> @@ -36,7 +35,7 @@ public: virtual ~Heap() override { flush(); } u32 size() const { return m_end_of_file; } - Result<ByteBuffer, String> read_block(u32); + ErrorOr<ByteBuffer> read_block(u32); bool write_block(u32, ByteBuffer&); u32 new_record_pointer(); [[nodiscard]] bool has_block(u32 block) const { return block < size(); } |