From eb213d24ed27c7dd7ed2babf75aaf63443f96e29 Mon Sep 17 00:00:00 2001 From: kayomn Date: Thu, 23 Feb 2023 14:44:55 +0000 Subject: [PATCH] Remove redundant constructor argument from coral::fixed_buffer --- source/app.cpp | 6 +++--- source/coral/io.cpp | 11 +++++------ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/source/app.cpp b/source/app.cpp index da5c475..a97f08a 100644 --- a/source/app.cpp +++ b/source/app.cpp @@ -157,7 +157,7 @@ struct sandboxed_fs : public coral::fs { void read_file(coral::path const & file_path, coral::callable const & then) override { if (!this->access_rules.can_read) return; - native_path sandbox_file_path{0}; + native_path sandbox_file_path; { coral::expected const written = sandbox_file_path.write(this->sandbox_path.as_slice()); @@ -186,7 +186,7 @@ struct sandboxed_fs : public coral::fs { void write_file(coral::path const & file_path, coral::callable const & then) override { if (!this->access_rules.can_write) return; - native_path sandbox_file_path{0}; + native_path sandbox_file_path; { coral::expected const written = sandbox_file_path.write(this->sandbox_path.as_slice()); @@ -213,7 +213,7 @@ struct sandboxed_fs : public coral::fs { } private: - native_path sandbox_path{0}; + native_path sandbox_path; access_rules access_rules{ .can_read = false, diff --git a/source/coral/io.cpp b/source/coral/io.cpp index b512c09..1ae6019 100644 --- a/source/coral/io.cpp +++ b/source/coral/io.cpp @@ -8,7 +8,7 @@ export namespace coral { * I/O operations and lightweight data construction. */ template struct fixed_buffer : public writer, public reader { - fixed_buffer(coral::u8 fill_value) : data{fill_value} {} + fixed_buffer() = default; /** * Returns a mutable [slice] ranging from the head to the last-filled element. @@ -74,7 +74,6 @@ export namespace coral { * from the buffer. */ expected read(slice const & data) override { - slice const readable_data{this->data, min(this->filled, data.length)}; this->filled -= readable_data.length; @@ -108,13 +107,13 @@ export namespace coral { } private: - usize filled = 0; + usize filled {0}; - usize read_index = 0; + usize read_index {0}; - usize write_index = 0; + usize write_index {0}; - u8 data[capacity]; + u8 data[capacity]{0}; }; /**