1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 09:57:35 +00:00

LibCore+Everywhere: Remove ArgsParser::add*(char const*&)

This is not guaranteed to always work correctly as ArgsParser deals in
StringViews and might have a non-properly-null-terminated string as a
value. As a bonus, using StringView (and DeprecatedString where
necessary) leads to nicer looking code too :^)
This commit is contained in:
Ali Mohammad Pur 2023-03-01 00:11:43 +03:30 committed by Andreas Kling
parent 60908adcbe
commit 500044906d
43 changed files with 122 additions and 145 deletions

View file

@ -65,7 +65,7 @@ int main(int argc, char** argv)
for (auto i = 0; i < argc; ++i)
arguments.append({ argv[i], strlen(argv[i]) });
char const* target = nullptr;
DeprecatedString target;
int min_block_offset = 0;
int block_length = 2048;
int block_size = 512;
@ -96,7 +96,7 @@ int main(int argc, char** argv)
}
auto buffer = buffer_result.release_value();
int fd = open(target, O_CREAT | O_RDWR, 0666);
int fd = open(target.characters(), O_CREAT | O_RDWR, 0666);
if (fd < 0) {
perror("Couldn't create target file");
return EXIT_FAILURE;