base64: Replace char pointer with StringView

This commit is contained in:
Kenneth Myhra 2022-04-30 21:50:21 +02:00 committed by Linus Groh
parent bd81e15bc9
commit b8de830683
Notes: sideshowbarker 2024-07-17 11:23:02 +09:00

View File

@ -9,14 +9,13 @@
#include <LibCore/File.h>
#include <LibCore/System.h>
#include <LibMain/Main.h>
#include <string.h>
ErrorOr<int> serenity_main(Main::Arguments arguments)
{
TRY(Core::System::pledge("stdio rpath"));
bool decode = false;
char const* filepath = nullptr;
StringView filepath = {};
Core::ArgsParser args_parser;
args_parser.add_option(decode, "Decode data", "decode", 'd');
@ -24,7 +23,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
args_parser.parse(arguments);
ByteBuffer buffer;
if (filepath == nullptr || strcmp(filepath, "-") == 0) {
if (filepath == nullptr || filepath == "-") {
buffer = Core::File::standard_input()->read_all();
} else {
auto file = TRY(Core::File::open(filepath, Core::OpenMode::ReadOnly));