mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:38:11 +00:00
base64: Replace char pointer with StringView
This commit is contained in:
parent
bd81e15bc9
commit
b8de830683
1 changed files with 2 additions and 3 deletions
|
@ -9,14 +9,13 @@
|
||||||
#include <LibCore/File.h>
|
#include <LibCore/File.h>
|
||||||
#include <LibCore/System.h>
|
#include <LibCore/System.h>
|
||||||
#include <LibMain/Main.h>
|
#include <LibMain/Main.h>
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
{
|
{
|
||||||
TRY(Core::System::pledge("stdio rpath"));
|
TRY(Core::System::pledge("stdio rpath"));
|
||||||
|
|
||||||
bool decode = false;
|
bool decode = false;
|
||||||
char const* filepath = nullptr;
|
StringView filepath = {};
|
||||||
|
|
||||||
Core::ArgsParser args_parser;
|
Core::ArgsParser args_parser;
|
||||||
args_parser.add_option(decode, "Decode data", "decode", 'd');
|
args_parser.add_option(decode, "Decode data", "decode", 'd');
|
||||||
|
@ -24,7 +23,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
args_parser.parse(arguments);
|
args_parser.parse(arguments);
|
||||||
|
|
||||||
ByteBuffer buffer;
|
ByteBuffer buffer;
|
||||||
if (filepath == nullptr || strcmp(filepath, "-") == 0) {
|
if (filepath == nullptr || filepath == "-") {
|
||||||
buffer = Core::File::standard_input()->read_all();
|
buffer = Core::File::standard_input()->read_all();
|
||||||
} else {
|
} else {
|
||||||
auto file = TRY(Core::File::open(filepath, Core::OpenMode::ReadOnly));
|
auto file = TRY(Core::File::open(filepath, Core::OpenMode::ReadOnly));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue