mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 13:47:46 +00:00
AK: Add the Input
word to input-only buffered streams
This concerns both `BufferedSeekable` and `BufferedFile`.
This commit is contained in:
parent
48b000a36c
commit
8c34959b53
50 changed files with 101 additions and 102 deletions
|
@ -19,7 +19,7 @@ static inline GLuint get_index_value(StringView& representation)
|
|||
|
||||
ErrorOr<NonnullRefPtr<Mesh>> WavefrontOBJLoader::load(String const& filename, NonnullOwnPtr<Core::File> file)
|
||||
{
|
||||
auto buffered_file = TRY(Core::BufferedFile::create(move(file)));
|
||||
auto buffered_file = TRY(Core::InputBufferedFile::create(move(file)));
|
||||
|
||||
Vector<Vertex> vertices;
|
||||
Vector<Vertex> normals;
|
||||
|
|
|
@ -48,7 +48,7 @@ DeprecatedString g_webdriver_content_ipc_path;
|
|||
static ErrorOr<void> load_content_filters()
|
||||
{
|
||||
auto file = TRY(Core::File::open(TRY(String::formatted("{}/BrowserContentFilters.txt", Core::StandardPaths::config_directory())), Core::File::OpenMode::Read));
|
||||
auto ad_filter_list = TRY(Core::BufferedFile::create(move(file)));
|
||||
auto ad_filter_list = TRY(Core::InputBufferedFile::create(move(file)));
|
||||
auto buffer = TRY(ByteBuffer::create_uninitialized(4096));
|
||||
|
||||
Browser::g_content_filters.clear_with_capacity();
|
||||
|
@ -68,7 +68,7 @@ static ErrorOr<void> load_content_filters()
|
|||
static ErrorOr<void> load_autoplay_allowlist()
|
||||
{
|
||||
auto file = TRY(Core::File::open(TRY(String::formatted("{}/BrowserAutoplayAllowlist.txt", Core::StandardPaths::config_directory())), Core::File::OpenMode::Read));
|
||||
auto allowlist = TRY(Core::BufferedFile::create(move(file)));
|
||||
auto allowlist = TRY(Core::InputBufferedFile::create(move(file)));
|
||||
auto buffer = TRY(ByteBuffer::create_uninitialized(4096));
|
||||
|
||||
Browser::g_autoplay_allowlist.clear_with_capacity();
|
||||
|
|
|
@ -29,7 +29,7 @@ ErrorOr<void> DomainListModel::load()
|
|||
{
|
||||
// FIXME: This should be somewhat shared with Browser.
|
||||
auto file = TRY(Core::File::open(TRY(filter_list_file_path()), Core::File::OpenMode::Read));
|
||||
auto content_filter_list = TRY(Core::BufferedFile::create(move(file)));
|
||||
auto content_filter_list = TRY(Core::InputBufferedFile::create(move(file)));
|
||||
auto buffer = TRY(ByteBuffer::create_uninitialized(4096));
|
||||
|
||||
m_domain_list.clear_with_capacity();
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
namespace FileManager {
|
||||
|
||||
FileOperationProgressWidget::FileOperationProgressWidget(FileOperation operation, NonnullOwnPtr<Core::BufferedFile> helper_pipe, int helper_pipe_fd)
|
||||
FileOperationProgressWidget::FileOperationProgressWidget(FileOperation operation, NonnullOwnPtr<Core::InputBufferedFile> helper_pipe, int helper_pipe_fd)
|
||||
: m_operation(operation)
|
||||
, m_helper_pipe(move(helper_pipe))
|
||||
{
|
||||
|
|
|
@ -21,7 +21,7 @@ public:
|
|||
|
||||
private:
|
||||
// FIXME: The helper_pipe_fd parameter is only needed because we can't get the fd from a Core::Stream.
|
||||
FileOperationProgressWidget(FileOperation, NonnullOwnPtr<Core::BufferedFile> helper_pipe, int helper_pipe_fd);
|
||||
FileOperationProgressWidget(FileOperation, NonnullOwnPtr<Core::InputBufferedFile> helper_pipe, int helper_pipe_fd);
|
||||
|
||||
void did_finish();
|
||||
void did_error(StringView message);
|
||||
|
@ -34,6 +34,6 @@ private:
|
|||
|
||||
FileOperation m_operation;
|
||||
RefPtr<Core::Notifier> m_notifier;
|
||||
OwnPtr<Core::BufferedFile> m_helper_pipe;
|
||||
OwnPtr<Core::InputBufferedFile> m_helper_pipe;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -99,7 +99,7 @@ ErrorOr<void> run_file_operation(FileOperation operation, Vector<DeprecatedStrin
|
|||
}
|
||||
|
||||
auto pipe_input_file = TRY(Core::File::adopt_fd(pipe_fds[0], Core::File::OpenMode::Read));
|
||||
auto buffered_pipe = TRY(Core::BufferedFile::create(move(pipe_input_file)));
|
||||
auto buffered_pipe = TRY(Core::InputBufferedFile::create(move(pipe_input_file)));
|
||||
|
||||
(void)TRY(window->set_main_widget<FileOperationProgressWidget>(operation, move(buffered_pipe), pipe_fds[0]));
|
||||
window->resize(320, 190);
|
||||
|
|
|
@ -215,7 +215,7 @@ ErrorOr<Vector<Color>> PaletteWidget::load_palette_file(NonnullOwnPtr<Core::File
|
|||
{
|
||||
Vector<Color> palette;
|
||||
Array<u8, PAGE_SIZE> buffer;
|
||||
auto buffered_file = TRY(Core::BufferedFile::create(move(file)));
|
||||
auto buffered_file = TRY(Core::InputBufferedFile::create(move(file)));
|
||||
|
||||
while (TRY(buffered_file->can_read_line())) {
|
||||
auto line = TRY(buffered_file->read_line(buffer));
|
||||
|
|
|
@ -169,7 +169,7 @@ ErrorOr<void> RunWindow::load_history()
|
|||
{
|
||||
m_path_history.clear();
|
||||
auto file = TRY(Core::File::open(history_file_path(), Core::File::OpenMode::Read));
|
||||
auto buffered_file = TRY(Core::BufferedFile::create(move(file)));
|
||||
auto buffered_file = TRY(Core::InputBufferedFile::create(move(file)));
|
||||
Array<u8, PAGE_SIZE> line_buffer;
|
||||
|
||||
while (!buffered_file->is_eof()) {
|
||||
|
|
|
@ -95,7 +95,7 @@ ErrorOr<void> WelcomeWidget::open_and_parse_tips_file()
|
|||
{
|
||||
auto path = TRY(String::formatted("{}/tips.txt", Core::StandardPaths::documents_directory()));
|
||||
auto file = TRY(Core::File::open(path, Core::File::OpenMode::Read));
|
||||
auto buffered_file = TRY(Core::BufferedFile::create(move(file)));
|
||||
auto buffered_file = TRY(Core::InputBufferedFile::create(move(file)));
|
||||
Array<u8, PAGE_SIZE> buffer;
|
||||
|
||||
while (TRY(buffered_file->can_read_line())) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue