mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-08 04:15:23 +03:00
base64: Replace char pointer with StringView
This commit is contained in:
parent
bd81e15bc9
commit
b8de830683
Notes:
sideshowbarker
2024-07-17 11:23:02 +09:00
Author: https://github.com/kennethmyhra Commit: https://github.com/SerenityOS/serenity/commit/b8de830683 Pull-request: https://github.com/SerenityOS/serenity/pull/13888 Reviewed-by: https://github.com/linusg ✅
@ -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));
|
||||
|
Loading…
Reference in New Issue
Block a user