1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 05:27:46 +00:00

HexEditor: Use the constructor pattern

This commit is contained in:
Lucas CHOLLET 2023-01-14 22:24:48 -05:00 committed by Andrew Kaster
parent a621b5f015
commit b1d8404c92
3 changed files with 13 additions and 4 deletions

View file

@ -65,7 +65,7 @@ ErrorOr<void> HexEditor::open_new_file(size_t size)
void HexEditor::open_file(NonnullRefPtr<Core::File> file)
{
m_document = make<HexDocumentFile>(file);
m_document = HexDocumentFile::create(move(file)).release_value_but_fixme_should_propagate_errors();
set_content_length(m_document->size());
m_position = 0;
m_cursor_at_low_nibble = false;
@ -146,7 +146,7 @@ bool HexEditor::save_as(NonnullRefPtr<Core::File> new_file)
auto& memory_document = static_cast<HexDocumentMemory&>(*m_document);
if (!memory_document.write_to_file(new_file))
return false;
m_document = make<HexDocumentFile>(new_file);
m_document = HexDocumentFile::create(move(new_file)).release_value_but_fixme_should_propagate_errors();
}
update();