From ec1f5fd20fd27653abb9fd3023db34881730da3a Mon Sep 17 00:00:00 2001 From: Kenneth Myhra Date: Sat, 30 Apr 2022 21:13:17 +0200 Subject: base64: Use Core::File standard_input() standard_output() --- Userland/Utilities/base64.cpp | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/Userland/Utilities/base64.cpp b/Userland/Utilities/base64.cpp index 8d65d39d70..28e521644f 100644 --- a/Userland/Utilities/base64.cpp +++ b/Userland/Utilities/base64.cpp @@ -4,16 +4,12 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include #include -#include #include #include #include #include -#include #include -#include ErrorOr serenity_main(Main::Arguments arguments) { @@ -29,13 +25,7 @@ ErrorOr serenity_main(Main::Arguments arguments) ByteBuffer buffer; if (filepath == nullptr || strcmp(filepath, "-") == 0) { - auto file = Core::File::construct(); - bool success = file->open( - STDIN_FILENO, - Core::OpenMode::ReadOnly, - Core::File::ShouldCloseFileDescriptor::Yes); - VERIFY(success); - buffer = file->read_all(); + buffer = Core::File::standard_input()->read_all(); } else { auto result = Core::File::open(filepath, Core::OpenMode::ReadOnly); VERIFY(!result.is_error()); @@ -47,7 +37,7 @@ ErrorOr serenity_main(Main::Arguments arguments) if (decode) { auto decoded = TRY(decode_base64(StringView(buffer))); - fwrite(decoded.data(), sizeof(u8), decoded.size(), stdout); + Core::File::standard_output()->write(decoded.data(), decoded.size()); return 0; } -- cgit v1.2.3