Remove redundant constructor argument from coral::fixed_buffer
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
ba5bc0674c
commit
eb213d24ed
|
@ -157,7 +157,7 @@ struct sandboxed_fs : public coral::fs {
|
||||||
void read_file(coral::path const & file_path, coral::callable<void(coral::file_reader &)> const & then) override {
|
void read_file(coral::path const & file_path, coral::callable<void(coral::file_reader &)> const & then) override {
|
||||||
if (!this->access_rules.can_read) return;
|
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());
|
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<void(coral::file_writer &)> const & then) override {
|
void write_file(coral::path const & file_path, coral::callable<void(coral::file_writer &)> const & then) override {
|
||||||
if (!this->access_rules.can_write) return;
|
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());
|
coral::expected const written = sandbox_file_path.write(this->sandbox_path.as_slice());
|
||||||
|
|
||||||
|
@ -213,7 +213,7 @@ struct sandboxed_fs : public coral::fs {
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
native_path sandbox_path{0};
|
native_path sandbox_path;
|
||||||
|
|
||||||
access_rules access_rules{
|
access_rules access_rules{
|
||||||
.can_read = false,
|
.can_read = false,
|
||||||
|
|
|
@ -8,7 +8,7 @@ export namespace coral {
|
||||||
* I/O operations and lightweight data construction.
|
* I/O operations and lightweight data construction.
|
||||||
*/
|
*/
|
||||||
template<usize capacity> struct fixed_buffer : public writer, public reader {
|
template<usize capacity> 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.
|
* Returns a mutable [slice] ranging from the head to the last-filled element.
|
||||||
|
@ -74,7 +74,6 @@ export namespace coral {
|
||||||
* from the buffer.
|
* from the buffer.
|
||||||
*/
|
*/
|
||||||
expected<usize, io_error> read(slice<u8> const & data) override {
|
expected<usize, io_error> read(slice<u8> const & data) override {
|
||||||
|
|
||||||
slice const readable_data{this->data, min(this->filled, data.length)};
|
slice const readable_data{this->data, min(this->filled, data.length)};
|
||||||
|
|
||||||
this->filled -= readable_data.length;
|
this->filled -= readable_data.length;
|
||||||
|
@ -108,13 +107,13 @@ export namespace coral {
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
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};
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue