mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 13:57:36 +00:00
Everywhere: Add sv suffix to strings relying on StringView(char const*)
Each of these strings would previously rely on StringView's char const* constructor overload, which would call __builtin_strlen on the string. Since we now have operator ""sv, we can replace these with much simpler versions. This opens the door to being able to remove StringView(char const*). No functional changes.
This commit is contained in:
parent
e5f09ea170
commit
3f3f45580a
762 changed files with 8315 additions and 8316 deletions
|
@ -28,7 +28,7 @@ ErrorOr<int> serenity_main(Main::Arguments args)
|
|||
args_parser.add_option(sample_count, "How many samples to load at maximum", "sample-count", 's', "samples");
|
||||
args_parser.parse(args);
|
||||
|
||||
TRY(Core::System::unveil(Core::File::absolute_path(path), "r"));
|
||||
TRY(Core::System::unveil(Core::File::absolute_path(path), "r"sv));
|
||||
TRY(Core::System::unveil(nullptr, nullptr));
|
||||
TRY(Core::System::pledge("stdio recvfd rpath"));
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
args_parser.add_option(show_sample_progress, "Show playback progress in samples", "sample-progress", 's');
|
||||
args_parser.parse(arguments);
|
||||
|
||||
TRY(Core::System::unveil(Core::File::absolute_path(path), "r"));
|
||||
TRY(Core::System::unveil(Core::File::absolute_path(path), "r"sv));
|
||||
TRY(Core::System::unveil("/tmp/portal/audio", "rw"));
|
||||
TRY(Core::System::unveil(nullptr, nullptr));
|
||||
|
||||
|
|
|
@ -105,26 +105,26 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
Vector<JsonValue> sorted_regions = json.as_array().values();
|
||||
quick_sort(sorted_regions, [](auto& a, auto& b) {
|
||||
return a.as_object().get("ip_address").to_string() < b.as_object().get("ip_address").to_string();
|
||||
return a.as_object().get("ip_address"sv).to_string() < b.as_object().get("ip_address"sv).to_string();
|
||||
});
|
||||
|
||||
for (auto& value : sorted_regions) {
|
||||
auto& if_object = value.as_object();
|
||||
|
||||
auto ip_address = if_object.get("ip_address").to_string();
|
||||
auto ip_address = if_object.get("ip_address"sv).to_string();
|
||||
|
||||
if (!flag_numeric) {
|
||||
auto from_string = IPv4Address::from_string(ip_address);
|
||||
auto addr = from_string.value().to_in_addr_t();
|
||||
auto* hostent = gethostbyaddr(&addr, sizeof(in_addr), AF_INET);
|
||||
if (hostent != nullptr) {
|
||||
auto host_name = StringView(hostent->h_name);
|
||||
StringView host_name { hostent->h_name, strlen(hostent->h_name) };
|
||||
if (!host_name.is_empty())
|
||||
ip_address = host_name;
|
||||
}
|
||||
}
|
||||
|
||||
auto mac_address = if_object.get("mac_address").to_string();
|
||||
auto mac_address = if_object.get("mac_address"sv).to_string();
|
||||
|
||||
if (proto_address_column != -1)
|
||||
columns[proto_address_column].buffer = ip_address;
|
||||
|
|
|
@ -45,7 +45,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
TRY(Core::System::unveil(nullptr, nullptr));
|
||||
TRY(Core::System::pledge("stdio rpath wpath recvfd thread"));
|
||||
|
||||
if (command.equals_ignoring_case("get") || command == "g") {
|
||||
if (command.equals_ignoring_case("get"sv) || command == "g") {
|
||||
// Get variables
|
||||
Vector<AudioVariable> values_to_print;
|
||||
if (command_arguments.is_empty()) {
|
||||
|
@ -97,7 +97,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
}
|
||||
if (!human_mode)
|
||||
outln();
|
||||
} else if (command.equals_ignoring_case("set") || command == "s") {
|
||||
} else if (command.equals_ignoring_case("set"sv) || command == "s") {
|
||||
// Set variables
|
||||
HashMap<AudioVariable, Variant<int, bool>> values_to_set;
|
||||
for (size_t i = 0; i < command_arguments.size(); ++i) {
|
||||
|
@ -120,9 +120,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
} else if (variable.is_one_of("m"sv, "mute"sv)) {
|
||||
auto& mute_text = command_arguments[++i];
|
||||
bool mute;
|
||||
if (mute_text.equals_ignoring_case("true") || mute_text == "1") {
|
||||
if (mute_text.equals_ignoring_case("true"sv) || mute_text == "1") {
|
||||
mute = true;
|
||||
} else if (mute_text.equals_ignoring_case("false") || mute_text == "0") {
|
||||
} else if (mute_text.equals_ignoring_case("false"sv) || mute_text == "0") {
|
||||
mute = false;
|
||||
} else {
|
||||
warnln("Error: {} is not one of {{0, 1, true, false}}", mute_text);
|
||||
|
|
|
@ -43,7 +43,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
args_parser.parse(arguments);
|
||||
|
||||
if (paths.is_empty())
|
||||
paths.append("-");
|
||||
paths.append("-"sv);
|
||||
|
||||
Crypto::Hash::Manager hash;
|
||||
hash.initialize(hash_kind);
|
||||
|
|
|
@ -145,7 +145,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
process_remaining(col2_fmt, file2, col2_count, !suppress_col2);
|
||||
|
||||
if (print_total)
|
||||
outln(print_color ? COL1_COLOR "\t" COL2_COLOR "\t" COL3_COLOR "\ttotal" : "{}\t{}\t{}\ttotal", col1_count, col2_count, col3_count);
|
||||
outln(print_color ? COL1_COLOR "\t" COL2_COLOR "\t" COL3_COLOR "\ttotal"sv : "{}\t{}\t{}\ttotal"sv, col1_count, col2_count, col3_count);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ struct Options {
|
|||
|
||||
static Options parse_options(Main::Arguments arguments)
|
||||
{
|
||||
char const* type = "text/plain";
|
||||
auto type = "text/plain"sv;
|
||||
Vector<String> text;
|
||||
bool clear = false;
|
||||
|
||||
|
|
|
@ -62,13 +62,13 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
} else if (print_unix_date) {
|
||||
outln("{}", date.timestamp());
|
||||
} else if (print_iso_8601) {
|
||||
outln("{}", date.to_string("%Y-%m-%dT%H:%M:%S%:z"));
|
||||
outln("{}", date.to_string("%Y-%m-%dT%H:%M:%S%:z"sv));
|
||||
} else if (print_rfc_5322) {
|
||||
outln("{}", date.to_string("%a, %d %b %Y %H:%M:%S %z"));
|
||||
outln("{}", date.to_string("%a, %d %b %Y %H:%M:%S %z"sv));
|
||||
} else if (print_rfc_3339) {
|
||||
outln("{}", date.to_string("%Y-%m-%d %H:%M:%S%:z"));
|
||||
outln("{}", date.to_string("%Y-%m-%d %H:%M:%S%:z"sv));
|
||||
} else {
|
||||
outln("{}", date.to_string("%Y-%m-%d %H:%M:%S %Z"));
|
||||
outln("{}", date.to_string("%Y-%m-%d %H:%M:%S %Z"sv));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -148,31 +148,31 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
if (argument == "--help") {
|
||||
out("{}", usage);
|
||||
return 0;
|
||||
} else if (argument.starts_with("if=")) {
|
||||
} else if (argument.starts_with("if="sv)) {
|
||||
if (handle_io_file_arguments(input_fd, input_flags, argument) < 0) {
|
||||
return 1;
|
||||
}
|
||||
} else if (argument.starts_with("of=")) {
|
||||
} else if (argument.starts_with("of="sv)) {
|
||||
if (handle_io_file_arguments(output_fd, output_flags, argument) < 0) {
|
||||
return 1;
|
||||
}
|
||||
} else if (argument.starts_with("bs=")) {
|
||||
} else if (argument.starts_with("bs="sv)) {
|
||||
if (handle_size_arguments(block_size, argument) < 0) {
|
||||
return 1;
|
||||
}
|
||||
} else if (argument.starts_with("count=")) {
|
||||
} else if (argument.starts_with("count="sv)) {
|
||||
if (handle_size_arguments(count, argument) < 0) {
|
||||
return 1;
|
||||
}
|
||||
} else if (argument.starts_with("seek=")) {
|
||||
} else if (argument.starts_with("seek="sv)) {
|
||||
if (handle_size_arguments(seek, argument) < 0) {
|
||||
return 1;
|
||||
}
|
||||
} else if (argument.starts_with("skip=")) {
|
||||
} else if (argument.starts_with("skip="sv)) {
|
||||
if (handle_size_arguments(skip, argument) < 0) {
|
||||
return 1;
|
||||
}
|
||||
} else if (argument.starts_with("status=")) {
|
||||
} else if (argument.starts_with("status="sv)) {
|
||||
if (handle_status_arguments(status, argument) < 0) {
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -46,13 +46,13 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
auto const& json = json_result.as_array();
|
||||
json.for_each([](auto& value) {
|
||||
auto& fs_object = value.as_object();
|
||||
auto fs = fs_object.get("class_name").to_string();
|
||||
auto total_block_count = fs_object.get("total_block_count").to_u64();
|
||||
auto free_block_count = fs_object.get("free_block_count").to_u64();
|
||||
[[maybe_unused]] auto total_inode_count = fs_object.get("total_inode_count").to_u64();
|
||||
[[maybe_unused]] auto free_inode_count = fs_object.get("free_inode_count").to_u64();
|
||||
auto block_size = fs_object.get("block_size").to_u64();
|
||||
auto mount_point = fs_object.get("mount_point").to_string();
|
||||
auto fs = fs_object.get("class_name"sv).to_string();
|
||||
auto total_block_count = fs_object.get("total_block_count"sv).to_u64();
|
||||
auto free_block_count = fs_object.get("free_block_count"sv).to_u64();
|
||||
[[maybe_unused]] auto total_inode_count = fs_object.get("total_inode_count"sv).to_u64();
|
||||
[[maybe_unused]] auto free_inode_count = fs_object.get("free_inode_count"sv).to_u64();
|
||||
auto block_size = fs_object.get("block_size"sv).to_u64();
|
||||
auto mount_point = fs_object.get("mount_point"sv).to_string();
|
||||
|
||||
out("{:10}", fs);
|
||||
|
||||
|
|
|
@ -85,10 +85,10 @@ static Optional<String> elf_details(String description, String const& path)
|
|||
description,
|
||||
bitness,
|
||||
byteorder,
|
||||
ELF::Image::object_file_type_to_string(header.e_type).value_or("(?)"),
|
||||
ELF::Image::object_machine_type_to_string(header.e_machine).value_or("(?)"),
|
||||
ELF::Image::object_file_type_to_string(header.e_type).value_or("(?)"sv),
|
||||
ELF::Image::object_machine_type_to_string(header.e_machine).value_or("(?)"sv),
|
||||
header.e_ident[EI_ABIVERSION],
|
||||
ELF::Image::object_abi_type_to_string(header.e_ident[EI_OSABI]).value_or("(?)"),
|
||||
ELF::Image::object_abi_type_to_string(header.e_ident[EI_OSABI]).value_or("(?)"sv),
|
||||
is_dynamically_linked ? dynamic_section : "");
|
||||
}
|
||||
|
||||
|
|
|
@ -27,16 +27,16 @@ public:
|
|||
return {};
|
||||
auto& entry = value.as_object();
|
||||
Quote q;
|
||||
if (!entry.has("quote") || !entry.has("author") || !entry.has("utc_time") || !entry.has("url"))
|
||||
if (!entry.has("quote"sv) || !entry.has("author"sv) || !entry.has("utc_time"sv) || !entry.has("url"sv))
|
||||
return {};
|
||||
// From here on, trust that it's probably fine.
|
||||
q.m_quote = entry.get("quote").as_string();
|
||||
q.m_author = entry.get("author").as_string();
|
||||
q.m_quote = entry.get("quote"sv).as_string();
|
||||
q.m_author = entry.get("author"sv).as_string();
|
||||
// It is sometimes parsed as u32, sometimes as u64, depending on how large the number is.
|
||||
q.m_utc_time = entry.get("utc_time").to_number<u64>();
|
||||
q.m_url = entry.get("url").as_string();
|
||||
if (entry.has("context"))
|
||||
q.m_context = entry.get("context").as_string();
|
||||
q.m_utc_time = entry.get("utc_time"sv).to_number<u64>();
|
||||
q.m_url = entry.get("url"sv).as_string();
|
||||
if (entry.has("context"sv))
|
||||
q.m_context = entry.get("context"sv).as_string();
|
||||
|
||||
return q;
|
||||
}
|
||||
|
|
|
@ -167,15 +167,15 @@ ErrorOr<int> serenity_main(Main::Arguments args)
|
|||
}
|
||||
|
||||
if (is_binary && binary_mode == BinaryFileMode::Binary) {
|
||||
outln(colored_output ? "binary file \x1B[34m{}\x1B[0m matches" : "binary file {} matches", filename);
|
||||
outln(colored_output ? "binary file \x1B[34m{}\x1B[0m matches"sv : "binary file {} matches"sv, filename);
|
||||
} else {
|
||||
if ((result.matches.size() || invert_match) && print_filename)
|
||||
out(colored_output ? "\x1B[34m{}:\x1B[0m" : "{}:", filename);
|
||||
out(colored_output ? "\x1B[34m{}:\x1B[0m"sv : "{}:"sv, filename);
|
||||
if ((result.matches.size() || invert_match) && line_numbers)
|
||||
out(colored_output ? "\x1B[35m{}:\x1B[0m" : "{}:", line_number);
|
||||
out(colored_output ? "\x1B[35m{}:\x1B[0m"sv : "{}:"sv, line_number);
|
||||
|
||||
for (auto& match : result.matches) {
|
||||
out(colored_output ? "{}\x1B[32m{}\x1B[0m" : "{}{}",
|
||||
out(colored_output ? "{}\x1B[32m{}\x1B[0m"sv : "{}{}"sv,
|
||||
StringView(&str[last_printed_char_pos], match.global_offset - last_printed_char_pos),
|
||||
match.view.to_string());
|
||||
last_printed_char_pos = match.global_offset + match.view.length();
|
||||
|
@ -261,7 +261,7 @@ ErrorOr<int> serenity_main(Main::Arguments args)
|
|||
if (is_binary && binary_mode == BinaryFileMode::Skip)
|
||||
return 1;
|
||||
|
||||
auto matched = matches(line_view, "stdin", line_number, false, is_binary);
|
||||
auto matched = matches(line_view, "stdin"sv, line_number, false, is_binary);
|
||||
did_match_something = did_match_something || matched;
|
||||
if (matched && is_binary && binary_mode == BinaryFileMode::Binary)
|
||||
break;
|
||||
|
|
|
@ -44,7 +44,7 @@ ErrorOr<int> serenity_main(Main::Arguments args)
|
|||
|
||||
String input_filename;
|
||||
String output_filename;
|
||||
if (filename.ends_with(".gz")) {
|
||||
if (filename.ends_with(".gz"sv)) {
|
||||
input_filename = filename;
|
||||
output_filename = filename.substring_view(0, filename.length() - 3);
|
||||
} else {
|
||||
|
|
|
@ -43,16 +43,16 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
json.as_array().for_each([](auto& value) {
|
||||
auto& if_object = value.as_object();
|
||||
|
||||
auto name = if_object.get("name").to_string();
|
||||
auto class_name = if_object.get("class_name").to_string();
|
||||
auto mac_address = if_object.get("mac_address").to_string();
|
||||
auto ipv4_address = if_object.get("ipv4_address").to_string();
|
||||
auto netmask = if_object.get("ipv4_netmask").to_string();
|
||||
auto packets_in = if_object.get("packets_in").to_u32();
|
||||
auto bytes_in = if_object.get("bytes_in").to_u32();
|
||||
auto packets_out = if_object.get("packets_out").to_u32();
|
||||
auto bytes_out = if_object.get("bytes_out").to_u32();
|
||||
auto mtu = if_object.get("mtu").to_u32();
|
||||
auto name = if_object.get("name"sv).to_string();
|
||||
auto class_name = if_object.get("class_name"sv).to_string();
|
||||
auto mac_address = if_object.get("mac_address"sv).to_string();
|
||||
auto ipv4_address = if_object.get("ipv4_address"sv).to_string();
|
||||
auto netmask = if_object.get("ipv4_netmask"sv).to_string();
|
||||
auto packets_in = if_object.get("packets_in"sv).to_u32();
|
||||
auto bytes_in = if_object.get("bytes_in"sv).to_u32();
|
||||
auto packets_out = if_object.get("packets_out"sv).to_u32();
|
||||
auto bytes_out = if_object.get("bytes_out"sv).to_u32();
|
||||
auto mtu = if_object.get("mtu"sv).to_u32();
|
||||
|
||||
outln("{}:", name);
|
||||
outln("\tmac: {}", mac_address);
|
||||
|
|
|
@ -136,10 +136,10 @@ static String prompt_for_level(int level)
|
|||
{
|
||||
static StringBuilder prompt_builder;
|
||||
prompt_builder.clear();
|
||||
prompt_builder.append("> ");
|
||||
prompt_builder.append("> "sv);
|
||||
|
||||
for (auto i = 0; i < level; ++i)
|
||||
prompt_builder.append(" ");
|
||||
prompt_builder.append(" "sv);
|
||||
|
||||
return prompt_builder.build();
|
||||
}
|
||||
|
@ -265,7 +265,7 @@ static void print_type(FlyString const& name)
|
|||
|
||||
static void print_separator(bool& first)
|
||||
{
|
||||
js_out(first ? " " : ", ");
|
||||
js_out(first ? " "sv : ", "sv);
|
||||
first = false;
|
||||
}
|
||||
|
||||
|
@ -1319,8 +1319,7 @@ JS_DEFINE_NATIVE_FUNCTION(ReplObject::save_to_file)
|
|||
if (!vm.argument_count())
|
||||
return JS::Value(false);
|
||||
String save_path = vm.argument(0).to_string_without_side_effects();
|
||||
StringView path = StringView(save_path.characters());
|
||||
if (write_to_file(path)) {
|
||||
if (write_to_file(save_path)) {
|
||||
return JS::Value(true);
|
||||
}
|
||||
return JS::Value(false);
|
||||
|
@ -1395,7 +1394,7 @@ static void repl(JS::Interpreter& interpreter)
|
|||
continue;
|
||||
|
||||
g_repl_statements.append(piece);
|
||||
parse_and_run(interpreter, piece, "REPL");
|
||||
parse_and_run(interpreter, piece, "REPL"sv);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1428,7 +1427,7 @@ public:
|
|||
// 2.3. Printer(logLevel, args[, options]), https://console.spec.whatwg.org/#printer
|
||||
virtual JS::ThrowCompletionOr<JS::Value> printer(JS::Console::LogLevel log_level, PrinterArguments arguments) override
|
||||
{
|
||||
String indent = String::repeated(" ", m_group_stack_depth);
|
||||
String indent = String::repeated(" "sv, m_group_stack_depth);
|
||||
|
||||
if (log_level == JS::Console::LogLevel::Trace) {
|
||||
auto trace = arguments.get<JS::Console::Trace>();
|
||||
|
@ -1681,7 +1680,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
if (mode == CompleteNullProperty) {
|
||||
mode = CompleteProperty;
|
||||
property_name = "";
|
||||
property_name = ""sv;
|
||||
last_token_has_trivia = false; // <name> <dot> [tab] is sensible to complete.
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ ErrorOr<int> serenity_main(Main::Arguments)
|
|||
{
|
||||
constexpr size_t num_entries = 1024 * 100;
|
||||
|
||||
int fd = TRY(Core::System::open("/dev/kcov0", O_RDWR));
|
||||
int fd = TRY(Core::System::open("/dev/kcov0"sv, O_RDWR));
|
||||
TRY(Core::System::ioctl(fd, KCOV_SETBUFSIZE, num_entries));
|
||||
kcov_pc_t* cover = (kcov_pc_t*)TRY(Core::System::mmap(NULL, num_entries * KCOV_ENTRY_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0));
|
||||
TRY(Core::System::ioctl(fd, KCOV_ENABLE));
|
||||
|
|
|
@ -140,7 +140,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
};
|
||||
|
||||
if (paths.is_empty())
|
||||
paths.append(".");
|
||||
paths.append("."sv);
|
||||
|
||||
Vector<FileMetadata> files;
|
||||
for (auto& path : paths) {
|
||||
|
@ -267,7 +267,7 @@ static size_t print_name(const struct stat& st, String const& name, char const*
|
|||
else if (S_ISCHR(st.st_mode) || S_ISBLK(st.st_mode))
|
||||
begin_color = "\033[33;1m";
|
||||
printf("%s", begin_color);
|
||||
nprinted = print_escaped(name.characters());
|
||||
nprinted = print_escaped(name);
|
||||
printf("%s", end_color);
|
||||
}
|
||||
if (S_ISLNK(st.st_mode)) {
|
||||
|
@ -276,7 +276,7 @@ static size_t print_name(const struct stat& st, String const& name, char const*
|
|||
if (link_destination_or_error.is_error()) {
|
||||
perror("readlink");
|
||||
} else {
|
||||
nprinted += printf(" -> ") + print_escaped(link_destination_or_error.value().characters());
|
||||
nprinted += printf(" -> ") + print_escaped(link_destination_or_error.value());
|
||||
}
|
||||
} else {
|
||||
if (flag_classify)
|
||||
|
|
|
@ -16,35 +16,35 @@
|
|||
static void print_cache_info(StringView description, JsonObject const& cache_object)
|
||||
{
|
||||
outln("\t{}:", description);
|
||||
outln("\t\tSize: {}", human_readable_size(cache_object.get("size").as_u32()));
|
||||
outln("\t\tLine size: {}", human_readable_size(cache_object.get("line_size").as_u32()));
|
||||
outln("\t\tSize: {}", human_readable_size(cache_object.get("size"sv).as_u32()));
|
||||
outln("\t\tLine size: {}", human_readable_size(cache_object.get("line_size"sv).as_u32()));
|
||||
};
|
||||
|
||||
static void print_cpu_info(JsonObject const& value)
|
||||
{
|
||||
outln("CPU {}:", value.get("processor").as_u32());
|
||||
outln("\tVendor ID: {}", value.get("vendor_id").as_string());
|
||||
if (value.has("hypervisor_vendor_id"))
|
||||
outln("\tHypervisor Vendor ID: {}", value.get("hypervisor_vendor_id").as_string());
|
||||
outln("\tBrand: {}", value.get("brand").as_string());
|
||||
outln("\tFamily: {}", value.get("family").as_u32());
|
||||
outln("\tModel: {}", value.get("model").as_u32());
|
||||
outln("\tStepping: {}", value.get("stepping").as_u32());
|
||||
outln("\tType: {}", value.get("type").as_u32());
|
||||
outln("CPU {}:", value.get("processor"sv).as_u32());
|
||||
outln("\tVendor ID: {}", value.get("vendor_id"sv).as_string());
|
||||
if (value.has("hypervisor_vendor_id"sv))
|
||||
outln("\tHypervisor Vendor ID: {}", value.get("hypervisor_vendor_id"sv).as_string());
|
||||
outln("\tBrand: {}", value.get("brand"sv).as_string());
|
||||
outln("\tFamily: {}", value.get("family"sv).as_u32());
|
||||
outln("\tModel: {}", value.get("model"sv).as_u32());
|
||||
outln("\tStepping: {}", value.get("stepping"sv).as_u32());
|
||||
outln("\tType: {}", value.get("type"sv).as_u32());
|
||||
|
||||
auto& caches = value.get("caches").as_object();
|
||||
if (caches.has("l1_data"))
|
||||
print_cache_info("L1 data cache", caches.get("l1_data").as_object());
|
||||
if (caches.has("l1_instruction"))
|
||||
print_cache_info("L1 instruction cache", caches.get("l1_instruction").as_object());
|
||||
if (caches.has("l2"))
|
||||
print_cache_info("L2 cache", caches.get("l2").as_object());
|
||||
if (caches.has("l3"))
|
||||
print_cache_info("L3 cache", caches.get("l3").as_object());
|
||||
auto& caches = value.get("caches"sv).as_object();
|
||||
if (caches.has("l1_data"sv))
|
||||
print_cache_info("L1 data cache"sv, caches.get("l1_data"sv).as_object());
|
||||
if (caches.has("l1_instruction"sv))
|
||||
print_cache_info("L1 instruction cache"sv, caches.get("l1_instruction"sv).as_object());
|
||||
if (caches.has("l2"sv))
|
||||
print_cache_info("L2 cache"sv, caches.get("l2"sv).as_object());
|
||||
if (caches.has("l3"sv))
|
||||
print_cache_info("L3 cache"sv, caches.get("l3"sv).as_object());
|
||||
|
||||
out("\tFeatures: ");
|
||||
|
||||
auto& features = value.get("features").as_array();
|
||||
auto& features = value.get("features"sv).as_array();
|
||||
|
||||
for (auto const& feature : features.values())
|
||||
out("{} ", feature.as_string());
|
||||
|
|
|
@ -25,10 +25,10 @@ ErrorOr<int> serenity_main(Main::Arguments)
|
|||
auto json = TRY(JsonValue::from_string(file_contents));
|
||||
json.as_array().for_each([](auto& value) {
|
||||
auto& handler = value.as_object();
|
||||
auto purpose = handler.get("purpose").to_string();
|
||||
auto interrupt = handler.get("interrupt_line").to_string();
|
||||
auto controller = handler.get("controller").to_string();
|
||||
auto call_count = handler.get("call_count").to_string();
|
||||
auto purpose = handler.get("purpose"sv).to_string();
|
||||
auto interrupt = handler.get("interrupt_line"sv).to_string();
|
||||
auto controller = handler.get("controller"sv).to_string();
|
||||
auto call_count = handler.get("call_count"sv).to_string();
|
||||
|
||||
outln("{:>4}: {:10} {:10} {:30}", interrupt, call_count, controller, purpose);
|
||||
});
|
||||
|
|
|
@ -83,9 +83,9 @@ static Vector<OpenFile> get_open_files_by_pid(pid_t pid)
|
|||
json.as_array().for_each([pid, &files](JsonValue const& object) {
|
||||
OpenFile open_file;
|
||||
open_file.pid = pid;
|
||||
open_file.fd = object.as_object().get("fd").to_int();
|
||||
open_file.fd = object.as_object().get("fd"sv).to_int();
|
||||
|
||||
String name = object.as_object().get("absolute_path").to_string();
|
||||
String name = object.as_object().get("absolute_path"sv).to_string();
|
||||
VERIFY(parse_name(name, open_file));
|
||||
open_file.full_name = name;
|
||||
|
||||
|
|
|
@ -21,9 +21,9 @@
|
|||
static bool flag_show_numerical = false;
|
||||
static bool flag_verbose = false;
|
||||
|
||||
static constexpr StringView format_numerical = "{:04x}:{:02x}:{:02x}.{} {}: {}:{} (rev {:02x})";
|
||||
static constexpr StringView format_textual = "{:04x}:{:02x}:{:02x}.{} {}: {} {} (rev {:02x})";
|
||||
static constexpr StringView format_region = "\tBAR {}: {} region @ {:#x}";
|
||||
static constexpr StringView format_numerical = "{:04x}:{:02x}:{:02x}.{} {}: {}:{} (rev {:02x})"sv;
|
||||
static constexpr StringView format_textual = "{:04x}:{:02x}:{:02x}.{} {}: {} {} (rev {:02x})"sv;
|
||||
static constexpr StringView format_region = "\tBAR {}: {} region @ {:#x}"sv;
|
||||
|
||||
static u32 read_hex_string_from_bytebuffer(ByteBuffer const& buf)
|
||||
{
|
||||
|
|
|
@ -59,77 +59,77 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
json.as_array().for_each([usb_db, print_verbose](auto& value) {
|
||||
auto& device_descriptor = value.as_object();
|
||||
|
||||
auto device_address = device_descriptor.get("device_address").to_u32();
|
||||
auto vendor_id = device_descriptor.get("vendor_id").to_u32();
|
||||
auto product_id = device_descriptor.get("product_id").to_u32();
|
||||
auto device_address = device_descriptor.get("device_address"sv).to_u32();
|
||||
auto vendor_id = device_descriptor.get("vendor_id"sv).to_u32();
|
||||
auto product_id = device_descriptor.get("product_id"sv).to_u32();
|
||||
|
||||
StringView vendor_string = usb_db->get_vendor(vendor_id);
|
||||
StringView device_string = usb_db->get_device(vendor_id, product_id);
|
||||
if (device_string.is_empty())
|
||||
device_string = "Unknown Device";
|
||||
device_string = "Unknown Device"sv;
|
||||
|
||||
outln("Device {}: ID {:04x}:{:04x} {} {}", device_address, vendor_id, product_id, vendor_string, device_string);
|
||||
|
||||
if (print_verbose) {
|
||||
outln("Device Descriptor");
|
||||
outln(" bLength {}", device_descriptor.get("length").to_u32());
|
||||
outln(" bDescriptorType {}", device_descriptor.get("descriptor_type").to_u32());
|
||||
outln(" bcdUSB {}", device_descriptor.get("usb_spec_compliance_bcd").to_u32());
|
||||
outln(" bDeviceClass {}", device_descriptor.get("device_class").to_u32());
|
||||
outln(" bDeviceSubClass {}", device_descriptor.get("device_sub_class").to_u32());
|
||||
outln(" bDeviceProtocol {}", device_descriptor.get("device_protocol").to_u32());
|
||||
outln(" bMaxPacketSize {}", device_descriptor.get("max_packet_size").to_u32());
|
||||
outln(" idVendor 0x{:04x} {}", device_descriptor.get("vendor_id").to_u32(), vendor_string);
|
||||
outln(" idProduct 0x{:04x} {}", device_descriptor.get("product_id").to_u32(), device_string);
|
||||
outln(" bcdDevice {}", device_descriptor.get("device_release_bcd").to_u32());
|
||||
outln(" iManufacturer {}", device_descriptor.get("manufacturer_id_descriptor_index").to_u32());
|
||||
outln(" iProduct {}", device_descriptor.get("product_string_descriptor_index").to_u32());
|
||||
outln(" iSerial {}", device_descriptor.get("serial_number_descriptor_index").to_u32());
|
||||
outln(" bNumConfigurations {}", device_descriptor.get("num_configurations").to_u32());
|
||||
outln(" bLength {}", device_descriptor.get("length"sv).to_u32());
|
||||
outln(" bDescriptorType {}", device_descriptor.get("descriptor_type"sv).to_u32());
|
||||
outln(" bcdUSB {}", device_descriptor.get("usb_spec_compliance_bcd"sv).to_u32());
|
||||
outln(" bDeviceClass {}", device_descriptor.get("device_class"sv).to_u32());
|
||||
outln(" bDeviceSubClass {}", device_descriptor.get("device_sub_class"sv).to_u32());
|
||||
outln(" bDeviceProtocol {}", device_descriptor.get("device_protocol"sv).to_u32());
|
||||
outln(" bMaxPacketSize {}", device_descriptor.get("max_packet_size"sv).to_u32());
|
||||
outln(" idVendor 0x{:04x} {}", device_descriptor.get("vendor_id"sv).to_u32(), vendor_string);
|
||||
outln(" idProduct 0x{:04x} {}", device_descriptor.get("product_id"sv).to_u32(), device_string);
|
||||
outln(" bcdDevice {}", device_descriptor.get("device_release_bcd"sv).to_u32());
|
||||
outln(" iManufacturer {}", device_descriptor.get("manufacturer_id_descriptor_index"sv).to_u32());
|
||||
outln(" iProduct {}", device_descriptor.get("product_string_descriptor_index"sv).to_u32());
|
||||
outln(" iSerial {}", device_descriptor.get("serial_number_descriptor_index"sv).to_u32());
|
||||
outln(" bNumConfigurations {}", device_descriptor.get("num_configurations"sv).to_u32());
|
||||
|
||||
auto const& configuration_descriptors = value.as_object().get("configurations");
|
||||
auto const& configuration_descriptors = value.as_object().get("configurations"sv);
|
||||
configuration_descriptors.as_array().for_each([&](auto& config_value) {
|
||||
auto const& configuration_descriptor = config_value.as_object();
|
||||
outln(" Configuration Descriptor:");
|
||||
outln(" bLength {}", configuration_descriptor.get("length").as_u32());
|
||||
outln(" bDescriptorType {}", configuration_descriptor.get("descriptor_type").as_u32());
|
||||
outln(" wTotalLength {}", configuration_descriptor.get("total_length").as_u32());
|
||||
outln(" bNumInterfaces {}", configuration_descriptor.get("number_of_interfaces").as_u32());
|
||||
outln(" bmAttributes 0x{:02x}", configuration_descriptor.get("attributes_bitmap").as_u32());
|
||||
outln(" MaxPower {}mA", configuration_descriptor.get("max_power").as_u32() * 2u);
|
||||
outln(" bLength {}", configuration_descriptor.get("length"sv).as_u32());
|
||||
outln(" bDescriptorType {}", configuration_descriptor.get("descriptor_type"sv).as_u32());
|
||||
outln(" wTotalLength {}", configuration_descriptor.get("total_length"sv).as_u32());
|
||||
outln(" bNumInterfaces {}", configuration_descriptor.get("number_of_interfaces"sv).as_u32());
|
||||
outln(" bmAttributes 0x{:02x}", configuration_descriptor.get("attributes_bitmap"sv).as_u32());
|
||||
outln(" MaxPower {}mA", configuration_descriptor.get("max_power"sv).as_u32() * 2u);
|
||||
|
||||
auto const& interface_descriptors = config_value.as_object().get("interfaces");
|
||||
auto const& interface_descriptors = config_value.as_object().get("interfaces"sv);
|
||||
interface_descriptors.as_array().for_each([&](auto& interface_value) {
|
||||
auto const& interface_descriptor = interface_value.as_object();
|
||||
auto const interface_class_code = interface_descriptor.get("interface_class_code").to_u32();
|
||||
auto const interface_subclass_code = interface_descriptor.get("interface_sub_class_code").to_u32();
|
||||
auto const interface_protocol_code = interface_descriptor.get("interface_protocol").to_u32();
|
||||
auto const interface_class_code = interface_descriptor.get("interface_class_code"sv).to_u32();
|
||||
auto const interface_subclass_code = interface_descriptor.get("interface_sub_class_code"sv).to_u32();
|
||||
auto const interface_protocol_code = interface_descriptor.get("interface_protocol"sv).to_u32();
|
||||
auto const interface_class = usb_db->get_class(interface_class_code);
|
||||
auto const interface_subclass = usb_db->get_subclass(interface_class_code, interface_subclass_code);
|
||||
auto const interface_protocol = usb_db->get_protocol(interface_class_code, interface_subclass_code, interface_protocol_code);
|
||||
|
||||
outln(" Interface Descriptor:");
|
||||
outln(" bLength {}", interface_descriptor.get("length").to_u32());
|
||||
outln(" bDescriptorType {}", interface_descriptor.get("descriptor_type").to_u32());
|
||||
outln(" bInterfaceNumber {}", interface_descriptor.get("interface_number").to_u32());
|
||||
outln(" bAlternateSetting {}", interface_descriptor.get("alternate_setting").to_u32());
|
||||
outln(" bNumEndpoints {}", interface_descriptor.get("num_endpoints").to_u32());
|
||||
outln(" bLength {}", interface_descriptor.get("length"sv).to_u32());
|
||||
outln(" bDescriptorType {}", interface_descriptor.get("descriptor_type"sv).to_u32());
|
||||
outln(" bInterfaceNumber {}", interface_descriptor.get("interface_number"sv).to_u32());
|
||||
outln(" bAlternateSetting {}", interface_descriptor.get("alternate_setting"sv).to_u32());
|
||||
outln(" bNumEndpoints {}", interface_descriptor.get("num_endpoints"sv).to_u32());
|
||||
outln(" bInterfaceClass {} {}", interface_class_code, interface_class);
|
||||
outln(" bInterfaceSubClass {} {}", interface_subclass_code, interface_subclass);
|
||||
outln(" bInterfaceProtocol {} {}", interface_protocol_code, interface_protocol);
|
||||
outln(" iInterface {}", interface_descriptor.get("interface_string_desc_index").to_u32());
|
||||
outln(" iInterface {}", interface_descriptor.get("interface_string_desc_index"sv).to_u32());
|
||||
|
||||
auto const& endpoint_descriptors = interface_value.as_object().get("endpoints");
|
||||
auto const& endpoint_descriptors = interface_value.as_object().get("endpoints"sv);
|
||||
endpoint_descriptors.as_array().for_each([&](auto& endpoint_value) {
|
||||
auto const& endpoint_descriptor = endpoint_value.as_object();
|
||||
auto const endpoint_address = endpoint_descriptor.get("endpoint_address").to_u32();
|
||||
auto const endpoint_address = endpoint_descriptor.get("endpoint_address"sv).to_u32();
|
||||
outln(" Endpoint Descriptor:");
|
||||
outln(" bLength {}", endpoint_descriptor.get("length").to_u32());
|
||||
outln(" bDescriptorType {}", endpoint_descriptor.get("descriptor_type").to_u32());
|
||||
outln(" bLength {}", endpoint_descriptor.get("length"sv).to_u32());
|
||||
outln(" bDescriptorType {}", endpoint_descriptor.get("descriptor_type"sv).to_u32());
|
||||
outln(" bEndpointAddress 0x{:02x} EP {} {}", endpoint_address, (endpoint_address & 0xFu), ((endpoint_address & 0x80u) ? "IN" : "OUT"));
|
||||
outln(" bmAttributes 0x{:02x}", endpoint_descriptor.get("attribute_bitmap").to_u32());
|
||||
outln(" wMaxPacketSize 0x{:04x}", endpoint_descriptor.get("max_packet_size").to_u32());
|
||||
outln(" bInterval {}", endpoint_descriptor.get("polling_interval").to_u32());
|
||||
outln(" bmAttributes 0x{:02x}", endpoint_descriptor.get("attribute_bitmap"sv).to_u32());
|
||||
outln(" wMaxPacketSize 0x{:04x}", endpoint_descriptor.get("max_packet_size"sv).to_u32());
|
||||
outln(" bInterval {}", endpoint_descriptor.get("polling_interval"sv).to_u32());
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -29,28 +29,28 @@ static bool is_missing_file_acceptable(String const& filename)
|
|||
{
|
||||
const StringView acceptable_missing_files[] = {
|
||||
// FIXME: Please write these manpages!
|
||||
"/usr/share/man/man2/accept.md",
|
||||
"/usr/share/man/man2/exec.md",
|
||||
"/usr/share/man/man2/fcntl.md",
|
||||
"/usr/share/man/man2/fork.md",
|
||||
"/usr/share/man/man2/ioctl.md",
|
||||
"/usr/share/man/man2/listen.md",
|
||||
"/usr/share/man/man2/mmap.md",
|
||||
"/usr/share/man/man2/mprotect.md",
|
||||
"/usr/share/man/man2/open.md",
|
||||
"/usr/share/man/man2/ptrace.md",
|
||||
"/usr/share/man/man5/perfcore.md",
|
||||
"/usr/share/man/man2/accept.md"sv,
|
||||
"/usr/share/man/man2/exec.md"sv,
|
||||
"/usr/share/man/man2/fcntl.md"sv,
|
||||
"/usr/share/man/man2/fork.md"sv,
|
||||
"/usr/share/man/man2/ioctl.md"sv,
|
||||
"/usr/share/man/man2/listen.md"sv,
|
||||
"/usr/share/man/man2/mmap.md"sv,
|
||||
"/usr/share/man/man2/mprotect.md"sv,
|
||||
"/usr/share/man/man2/open.md"sv,
|
||||
"/usr/share/man/man2/ptrace.md"sv,
|
||||
"/usr/share/man/man5/perfcore.md"sv,
|
||||
// These ones are okay:
|
||||
"/home/anon/Tests/js-tests/test-common.js",
|
||||
"/man1/index.html",
|
||||
"/man2/index.html",
|
||||
"/man3/index.html",
|
||||
"/man4/index.html",
|
||||
"/man5/index.html",
|
||||
"/man6/index.html",
|
||||
"/man7/index.html",
|
||||
"/man8/index.html",
|
||||
"index.html",
|
||||
"/home/anon/Tests/js-tests/test-common.js"sv,
|
||||
"/man1/index.html"sv,
|
||||
"/man2/index.html"sv,
|
||||
"/man3/index.html"sv,
|
||||
"/man4/index.html"sv,
|
||||
"/man5/index.html"sv,
|
||||
"/man6/index.html"sv,
|
||||
"/man7/index.html"sv,
|
||||
"/man8/index.html"sv,
|
||||
"index.html"sv,
|
||||
};
|
||||
for (auto const& suffix : acceptable_missing_files) {
|
||||
if (filename.ends_with(suffix))
|
||||
|
@ -143,24 +143,24 @@ static String slugify(String const& text)
|
|||
String slug = text.to_lowercase();
|
||||
// Reverse-engineered through github, using:
|
||||
// find AK/ Base/ Documentation/ Kernel/ Meta/ Ports/ Tests/ Userland/ -name '*.md' | xargs grep --color=always -Pin '^##+ .*[^a-z0-9 ?()`_:/!&|.$'"'"',<>"+-]' README.md
|
||||
slug = slug.replace(" ", "-", ReplaceMode::All)
|
||||
.replace("!", "", ReplaceMode::All)
|
||||
.replace("?", "", ReplaceMode::All)
|
||||
.replace("(", "", ReplaceMode::All)
|
||||
.replace(")", "", ReplaceMode::All)
|
||||
.replace(":", "", ReplaceMode::All)
|
||||
.replace("/", "-", ReplaceMode::All)
|
||||
.replace("&", "", ReplaceMode::All)
|
||||
.replace("|", "", ReplaceMode::All)
|
||||
.replace(".", "", ReplaceMode::All)
|
||||
.replace("$", "", ReplaceMode::All)
|
||||
.replace("'", "", ReplaceMode::All)
|
||||
.replace(",", "", ReplaceMode::All)
|
||||
.replace("\"", "", ReplaceMode::All)
|
||||
.replace("+", "", ReplaceMode::All)
|
||||
.replace("\\", "", ReplaceMode::All)
|
||||
.replace("<", "", ReplaceMode::All)
|
||||
.replace(">", "", ReplaceMode::All);
|
||||
slug = slug.replace(" "sv, "-"sv, ReplaceMode::All)
|
||||
.replace("!"sv, ""sv, ReplaceMode::All)
|
||||
.replace("?"sv, ""sv, ReplaceMode::All)
|
||||
.replace("("sv, ""sv, ReplaceMode::All)
|
||||
.replace(")"sv, ""sv, ReplaceMode::All)
|
||||
.replace(":"sv, ""sv, ReplaceMode::All)
|
||||
.replace("/"sv, "-"sv, ReplaceMode::All)
|
||||
.replace("&"sv, ""sv, ReplaceMode::All)
|
||||
.replace("|"sv, ""sv, ReplaceMode::All)
|
||||
.replace("."sv, ""sv, ReplaceMode::All)
|
||||
.replace("$"sv, ""sv, ReplaceMode::All)
|
||||
.replace("'"sv, ""sv, ReplaceMode::All)
|
||||
.replace(","sv, ""sv, ReplaceMode::All)
|
||||
.replace("\""sv, ""sv, ReplaceMode::All)
|
||||
.replace("+"sv, ""sv, ReplaceMode::All)
|
||||
.replace("\\"sv, ""sv, ReplaceMode::All)
|
||||
.replace("<"sv, ""sv, ReplaceMode::All)
|
||||
.replace(">"sv, ""sv, ReplaceMode::All);
|
||||
// What about "="?
|
||||
return slug;
|
||||
}
|
||||
|
@ -202,7 +202,7 @@ RecursionDecision MarkdownLinkage::visit(Markdown::Text::LinkNode const& link_no
|
|||
}
|
||||
if (url.scheme() == "file") {
|
||||
// TODO: Check more possible links other than icons.
|
||||
if (url.path().starts_with("/res/icons/")) {
|
||||
if (url.path().starts_with("/res/icons/"sv)) {
|
||||
auto file = String::formatted("{}/Base{}", m_serenity_source_directory, url.path());
|
||||
m_file_links.append({ file, String(), StringCollector::from(*link_node.text) });
|
||||
return RecursionDecision::Recurse;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
ErrorOr<int> serenity_main(Main::Arguments)
|
||||
{
|
||||
auto document = Video::MatroskaReader::parse_matroska_from_file("/home/anon/Videos/test-webm.webm");
|
||||
auto document = Video::MatroskaReader::parse_matroska_from_file("/home/anon/Videos/test-webm.webm"sv);
|
||||
if (!document) {
|
||||
return Error::from_string_literal("Failed to parse :(");
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
constexpr StringView default_template = "tmp.XXXXXXXXXX";
|
||||
constexpr StringView default_template = "tmp.XXXXXXXXXX"sv;
|
||||
|
||||
static String generate_random_filename(String const& pattern)
|
||||
{
|
||||
|
@ -87,7 +87,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
file_template = default_template;
|
||||
}
|
||||
|
||||
if (!file_template.find("XXX").has_value()) {
|
||||
if (!file_template.find("XXX"sv).has_value()) {
|
||||
if (!quiet)
|
||||
warnln("Too few X's in template {}", file_template);
|
||||
return 1;
|
||||
|
|
|
@ -159,11 +159,11 @@ static ErrorOr<void> print_mounts()
|
|||
|
||||
json.as_array().for_each([](auto& value) {
|
||||
auto& fs_object = value.as_object();
|
||||
auto class_name = fs_object.get("class_name").to_string();
|
||||
auto mount_point = fs_object.get("mount_point").to_string();
|
||||
auto source = fs_object.get("source").as_string_or("none");
|
||||
auto readonly = fs_object.get("readonly").to_bool();
|
||||
auto mount_flags = fs_object.get("mount_flags").to_int();
|
||||
auto class_name = fs_object.get("class_name"sv).to_string();
|
||||
auto mount_point = fs_object.get("mount_point"sv).to_string();
|
||||
auto source = fs_object.get("source"sv).as_string_or("none");
|
||||
auto readonly = fs_object.get("readonly"sv).to_bool();
|
||||
auto mount_flags = fs_object.get("mount_flags"sv).to_int();
|
||||
|
||||
out("{} on {} type {} (", source, mount_point, class_name);
|
||||
|
||||
|
@ -219,7 +219,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
if (!source.is_empty() && !mountpoint.is_empty()) {
|
||||
if (fs_type.is_empty())
|
||||
fs_type = "ext2";
|
||||
fs_type = "ext2"sv;
|
||||
int flags = !options.is_empty() ? parse_options(options) : 0;
|
||||
|
||||
int fd = get_source_fd(source);
|
||||
|
|
|
@ -170,16 +170,16 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
Vector<JsonValue> sorted_regions = json.as_array().values();
|
||||
quick_sort(sorted_regions, [](auto& a, auto& b) {
|
||||
return a.as_object().get("local_port").to_u32() < b.as_object().get("local_port").to_u32();
|
||||
return a.as_object().get("local_port"sv).to_u32() < b.as_object().get("local_port"sv).to_u32();
|
||||
});
|
||||
|
||||
for (auto& value : sorted_regions) {
|
||||
auto& if_object = value.as_object();
|
||||
|
||||
auto bytes_in = if_object.get("bytes_in").to_string();
|
||||
auto bytes_out = if_object.get("bytes_out").to_string();
|
||||
auto bytes_in = if_object.get("bytes_in"sv).to_string();
|
||||
auto bytes_out = if_object.get("bytes_out"sv).to_string();
|
||||
|
||||
auto peer_address = if_object.get("peer_address").to_string();
|
||||
auto peer_address = if_object.get("peer_address"sv).to_string();
|
||||
if (!flag_numeric) {
|
||||
auto from_string = IPv4Address::from_string(peer_address);
|
||||
auto addr = from_string.value().to_in_addr_t();
|
||||
|
@ -191,9 +191,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
}
|
||||
}
|
||||
|
||||
auto peer_port = if_object.get("peer_port").to_string();
|
||||
auto peer_port = if_object.get("peer_port"sv).to_string();
|
||||
if (!flag_numeric) {
|
||||
auto service = getservbyport(htons(if_object.get("peer_port").to_u32()), "tcp");
|
||||
auto service = getservbyport(htons(if_object.get("peer_port"sv).to_u32()), "tcp");
|
||||
if (service != nullptr) {
|
||||
auto s_name = StringView { service->s_name, strlen(service->s_name) };
|
||||
if (!s_name.is_empty())
|
||||
|
@ -201,7 +201,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
}
|
||||
}
|
||||
|
||||
auto local_address = if_object.get("local_address").to_string();
|
||||
auto local_address = if_object.get("local_address"sv).to_string();
|
||||
if (!flag_numeric) {
|
||||
auto from_string = IPv4Address::from_string(local_address);
|
||||
auto addr = from_string.value().to_in_addr_t();
|
||||
|
@ -213,9 +213,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
}
|
||||
}
|
||||
|
||||
auto local_port = if_object.get("local_port").to_string();
|
||||
auto local_port = if_object.get("local_port"sv).to_string();
|
||||
if (!flag_numeric) {
|
||||
auto service = getservbyport(htons(if_object.get("local_port").to_u32()), "tcp");
|
||||
auto service = getservbyport(htons(if_object.get("local_port"sv).to_u32()), "tcp");
|
||||
if (service != nullptr) {
|
||||
auto s_name = StringView { service->s_name, strlen(service->s_name) };
|
||||
if (!s_name.is_empty())
|
||||
|
@ -223,8 +223,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
}
|
||||
}
|
||||
|
||||
auto state = if_object.get("state").to_string();
|
||||
auto origin_pid = (if_object.has("origin_pid")) ? if_object.get("origin_pid").to_u32() : -1;
|
||||
auto state = if_object.get("state"sv).to_string();
|
||||
auto origin_pid = (if_object.has("origin_pid"sv)) ? if_object.get("origin_pid"sv).to_u32() : -1;
|
||||
|
||||
if (!flag_all && ((state == "Listen" && !flag_list) || (state != "Listen" && flag_list)))
|
||||
continue;
|
||||
|
@ -257,13 +257,13 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
Vector<JsonValue> sorted_regions = json.as_array().values();
|
||||
quick_sort(sorted_regions, [](auto& a, auto& b) {
|
||||
return a.as_object().get("local_port").to_u32() < b.as_object().get("local_port").to_u32();
|
||||
return a.as_object().get("local_port"sv).to_u32() < b.as_object().get("local_port"sv).to_u32();
|
||||
});
|
||||
|
||||
for (auto& value : sorted_regions) {
|
||||
auto& if_object = value.as_object();
|
||||
|
||||
auto local_address = if_object.get("local_address").to_string();
|
||||
auto local_address = if_object.get("local_address"sv).to_string();
|
||||
if (!flag_numeric) {
|
||||
auto from_string = IPv4Address::from_string(local_address);
|
||||
auto addr = from_string.value().to_in_addr_t();
|
||||
|
@ -275,9 +275,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
}
|
||||
}
|
||||
|
||||
auto local_port = if_object.get("local_port").to_string();
|
||||
auto local_port = if_object.get("local_port"sv).to_string();
|
||||
if (!flag_numeric) {
|
||||
auto service = getservbyport(htons(if_object.get("local_port").to_u32()), "udp");
|
||||
auto service = getservbyport(htons(if_object.get("local_port"sv).to_u32()), "udp");
|
||||
if (service != nullptr) {
|
||||
auto s_name = StringView { service->s_name, strlen(service->s_name) };
|
||||
if (!s_name.is_empty())
|
||||
|
@ -285,7 +285,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
}
|
||||
}
|
||||
|
||||
auto peer_address = if_object.get("peer_address").to_string();
|
||||
auto peer_address = if_object.get("peer_address"sv).to_string();
|
||||
if (!flag_numeric) {
|
||||
auto from_string = IPv4Address::from_string(peer_address);
|
||||
auto addr = from_string.value().to_in_addr_t();
|
||||
|
@ -297,9 +297,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
}
|
||||
}
|
||||
|
||||
auto peer_port = if_object.get("peer_port").to_string();
|
||||
auto peer_port = if_object.get("peer_port"sv).to_string();
|
||||
if (!flag_numeric) {
|
||||
auto service = getservbyport(htons(if_object.get("peer_port").to_u32()), "udp");
|
||||
auto service = getservbyport(htons(if_object.get("peer_port"sv).to_u32()), "udp");
|
||||
if (service != nullptr) {
|
||||
auto s_name = StringView { service->s_name, strlen(service->s_name) };
|
||||
if (!s_name.is_empty())
|
||||
|
@ -307,7 +307,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
}
|
||||
}
|
||||
|
||||
auto origin_pid = (if_object.has("origin_pid")) ? if_object.get("origin_pid").to_u32() : -1;
|
||||
auto origin_pid = (if_object.has("origin_pid"sv)) ? if_object.get("origin_pid"sv).to_u32() : -1;
|
||||
|
||||
if (protocol_column != -1)
|
||||
columns[protocol_column].buffer = "udp";
|
||||
|
|
|
@ -143,7 +143,7 @@ int main(int argc, char** argv)
|
|||
}
|
||||
|
||||
#ifdef __serenity__
|
||||
TRY(Core::System::pledge((adjust_time || set_time) ? "stdio inet settime" : "stdio inet"));
|
||||
TRY(Core::System::pledge((adjust_time || set_time) ? "stdio inet settime"sv : "stdio inet"sv));
|
||||
TRY(Core::System::unveil(nullptr, nullptr));
|
||||
#endif
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
target_account.set_password_enabled(true);
|
||||
} else {
|
||||
if (current_uid != 0) {
|
||||
auto current_password = TRY(Core::get_password("Current password: "));
|
||||
auto current_password = TRY(Core::get_password("Current password: "sv));
|
||||
|
||||
if (!target_account.authenticate(current_password)) {
|
||||
warnln("Incorrect or disabled password.");
|
||||
|
@ -73,8 +73,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
}
|
||||
}
|
||||
|
||||
auto new_password = TRY(Core::get_password("New password: "));
|
||||
auto new_password_retype = TRY(Core::get_password("Retype new password: "));
|
||||
auto new_password = TRY(Core::get_password("New password: "sv));
|
||||
auto new_password_retype = TRY(Core::get_password("Retype new password: "sv));
|
||||
|
||||
if (new_password.is_empty() && new_password_retype.is_empty()) {
|
||||
warnln("No password supplied.");
|
||||
|
|
|
@ -95,7 +95,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
if (!print_type) {
|
||||
out("{}", StringView(data_and_type.data));
|
||||
// Append a newline to text contents, unless the caller says otherwise.
|
||||
if (data_and_type.mime_type.starts_with("text/") && !no_newline)
|
||||
if (data_and_type.mime_type.starts_with("text/"sv) && !no_newline)
|
||||
outln();
|
||||
} else {
|
||||
outln("{}", data_and_type.mime_type);
|
||||
|
|
|
@ -25,7 +25,7 @@ static ErrorOr<int> pid_of(String const& process_name, bool single_shot, bool om
|
|||
for (auto& it : all_processes.value().processes) {
|
||||
if (it.name == process_name) {
|
||||
if (!omit_pid || it.pid != pid) {
|
||||
out(displayed_at_least_one ? " {}" : "{}", it.pid);
|
||||
out(displayed_at_least_one ? " {}"sv : "{}"sv, it.pid);
|
||||
displayed_at_least_one = true;
|
||||
|
||||
if (single_shot)
|
||||
|
|
|
@ -47,31 +47,31 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
Vector<JsonValue> sorted_regions = json.as_array().values();
|
||||
quick_sort(sorted_regions, [](auto& a, auto& b) {
|
||||
return a.as_object().get("address").to_addr() < b.as_object().get("address").to_addr();
|
||||
return a.as_object().get("address"sv).to_addr() < b.as_object().get("address"sv).to_addr();
|
||||
});
|
||||
|
||||
for (auto& value : sorted_regions) {
|
||||
auto& map = value.as_object();
|
||||
auto address = map.get("address").to_addr();
|
||||
auto size = map.get("size").to_string();
|
||||
auto address = map.get("address"sv).to_addr();
|
||||
auto size = map.get("size"sv).to_string();
|
||||
|
||||
auto access = String::formatted("{}{}{}{}{}",
|
||||
(map.get("readable").to_bool() ? "r" : "-"),
|
||||
(map.get("writable").to_bool() ? "w" : "-"),
|
||||
(map.get("executable").to_bool() ? "x" : "-"),
|
||||
(map.get("shared").to_bool() ? "s" : "-"),
|
||||
(map.get("syscall").to_bool() ? "c" : "-"));
|
||||
(map.get("readable"sv).to_bool() ? "r" : "-"),
|
||||
(map.get("writable"sv).to_bool() ? "w" : "-"),
|
||||
(map.get("executable"sv).to_bool() ? "x" : "-"),
|
||||
(map.get("shared"sv).to_bool() ? "s" : "-"),
|
||||
(map.get("syscall"sv).to_bool() ? "c" : "-"));
|
||||
|
||||
out("{:p} ", address);
|
||||
out("{:>10} ", size);
|
||||
if (extended) {
|
||||
auto resident = map.get("amount_resident").to_string();
|
||||
auto dirty = map.get("amount_dirty").to_string();
|
||||
auto vmobject = map.get("vmobject").to_string();
|
||||
if (vmobject.ends_with("VMObject"))
|
||||
auto resident = map.get("amount_resident"sv).to_string();
|
||||
auto dirty = map.get("amount_dirty"sv).to_string();
|
||||
auto vmobject = map.get("vmobject"sv).to_string();
|
||||
if (vmobject.ends_with("VMObject"sv))
|
||||
vmobject = vmobject.substring(0, vmobject.length() - 8);
|
||||
auto purgeable = map.get("purgeable").to_string();
|
||||
auto cow_pages = map.get("cow_pages").to_string();
|
||||
auto purgeable = map.get("purgeable"sv).to_string();
|
||||
auto cow_pages = map.get("cow_pages"sv).to_string();
|
||||
out("{:>10} ", resident);
|
||||
out("{:>10} ", dirty);
|
||||
out("{:6} ", access);
|
||||
|
@ -81,7 +81,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
} else {
|
||||
out("{:6} ", access);
|
||||
}
|
||||
auto name = map.get("name").to_string();
|
||||
auto name = map.get("name"sv).to_string();
|
||||
out("{:20}", name);
|
||||
outln();
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ public:
|
|||
if (lexer.next_is('"'))
|
||||
m_filename = lexer.consume_quoted_string();
|
||||
else
|
||||
m_filename = lexer.consume_until(is_any_of("()<>@,;:\\\"/[]?= "));
|
||||
m_filename = lexer.consume_until(is_any_of("()<>@,;:\\\"/[]?= "sv));
|
||||
} else {
|
||||
m_might_be_wrong = true;
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ public:
|
|||
if (lexer.next_is('"'))
|
||||
m_filename = lexer.consume_quoted_string();
|
||||
else
|
||||
m_filename = lexer.consume_until(is_any_of("()<>@,;:\\\"/[]?= "));
|
||||
m_filename = lexer.consume_until(is_any_of("()<>@,;:\\\"/[]?= "sv));
|
||||
} else {
|
||||
m_might_be_wrong = true;
|
||||
}
|
||||
|
|
|
@ -367,8 +367,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
}
|
||||
outln();
|
||||
|
||||
outln(" Type: {} ({})", header.e_type, ELF::Image::object_file_type_to_string(header.e_type).value_or("(?)"));
|
||||
outln(" Machine: {} ({})", header.e_machine, ELF::Image::object_machine_type_to_string(header.e_machine).value_or("(?)"));
|
||||
outln(" Type: {} ({})", header.e_type, ELF::Image::object_file_type_to_string(header.e_type).value_or("(?)"sv));
|
||||
outln(" Machine: {} ({})", header.e_machine, ELF::Image::object_machine_type_to_string(header.e_machine).value_or("(?)"sv));
|
||||
outln(" Version: {:#x}", header.e_version);
|
||||
outln(" Entry point address: {:#x}", header.e_entry);
|
||||
outln(" Start of program headers: {} (bytes into file)", header.e_phoff);
|
||||
|
@ -416,7 +416,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
if (display_program_headers) {
|
||||
if (!display_all) {
|
||||
outln("ELF file type is {} ({})", header.e_type, ELF::Image::object_file_type_to_string(header.e_type).value_or("(?)"));
|
||||
outln("ELF file type is {} ({})", header.e_type, ELF::Image::object_file_type_to_string(header.e_type).value_or("(?)"sv));
|
||||
outln("Entry point {:#x}\n", header.e_entry);
|
||||
outln("There are {} program headers, starting at offset {}", header.e_phnum, header.e_phoff);
|
||||
outln();
|
||||
|
@ -549,7 +549,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
if (display_unwind_info) {
|
||||
// TODO: Unwind info
|
||||
outln("Decoding of unwind sections for machine type {} is not supported.", ELF::Image::object_machine_type_to_string(header.e_machine).value_or("?"));
|
||||
outln("Decoding of unwind sections for machine type {} is not supported.", ELF::Image::object_machine_type_to_string(header.e_machine).value_or("?"sv));
|
||||
outln();
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
ErrorOr<int> serenity_main(Main::Arguments)
|
||||
{
|
||||
auto file = TRY(Core::Stream::File::open("/sys/firmware/power_state", Core::Stream::OpenMode::Write));
|
||||
auto file = TRY(Core::Stream::File::open("/sys/firmware/power_state"sv, Core::Stream::OpenMode::Write));
|
||||
|
||||
const String file_contents = "1";
|
||||
TRY(file->write(file_contents.bytes()));
|
||||
|
|
|
@ -101,25 +101,25 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
Vector<JsonValue> sorted_regions = json.as_array().values();
|
||||
quick_sort(sorted_regions, [](auto& a, auto& b) {
|
||||
return a.as_object().get("destination").to_string() < b.as_object().get("destination").to_string();
|
||||
return a.as_object().get("destination"sv).to_string() < b.as_object().get("destination"sv).to_string();
|
||||
});
|
||||
|
||||
for (auto& value : sorted_regions) {
|
||||
auto& if_object = value.as_object();
|
||||
|
||||
auto destination = if_object.get("destination").to_string();
|
||||
auto gateway = if_object.get("gateway").to_string();
|
||||
auto genmask = if_object.get("genmask").to_string();
|
||||
auto interface = if_object.get("interface").to_string();
|
||||
auto flags = if_object.get("flags").to_u32();
|
||||
auto destination = if_object.get("destination"sv).to_string();
|
||||
auto gateway = if_object.get("gateway"sv).to_string();
|
||||
auto genmask = if_object.get("genmask"sv).to_string();
|
||||
auto interface = if_object.get("interface"sv).to_string();
|
||||
auto flags = if_object.get("flags"sv).to_u32();
|
||||
|
||||
StringBuilder flags_builder;
|
||||
if (flags & RTF_UP)
|
||||
flags_builder.append("U");
|
||||
flags_builder.append('U');
|
||||
if (flags & RTF_GATEWAY)
|
||||
flags_builder.append("G");
|
||||
flags_builder.append('G');
|
||||
if (flags & RTF_HOST)
|
||||
flags_builder.append("H");
|
||||
flags_builder.append('H');
|
||||
|
||||
if (destination_column != -1)
|
||||
columns[destination_column].buffer = destination;
|
||||
|
|
|
@ -353,10 +353,10 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
}
|
||||
|
||||
// Make UBSAN deadly for all tests we run by default.
|
||||
TRY(Core::System::setenv("UBSAN_OPTIONS", "halt_on_error=1", true));
|
||||
TRY(Core::System::setenv("UBSAN_OPTIONS"sv, "halt_on_error=1"sv, true));
|
||||
|
||||
if (!run_benchmarks)
|
||||
TRY(Core::System::setenv("TESTS_ONLY", "1", true));
|
||||
TRY(Core::System::setenv("TESTS_ONLY"sv, "1"sv, true));
|
||||
|
||||
String test_root;
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
args_parser.parse(arguments);
|
||||
|
||||
if (output_path.is_empty()) {
|
||||
output_path = Core::DateTime::now().to_string("screenshot-%Y-%m-%d-%H-%M-%S.png");
|
||||
output_path = Core::DateTime::now().to_string("screenshot-%Y-%m-%d-%H-%M-%S.png"sv);
|
||||
}
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
ErrorOr<int> serenity_main(Main::Arguments)
|
||||
{
|
||||
auto file = TRY(Core::Stream::File::open("/sys/firmware/power_state", Core::Stream::OpenMode::Write));
|
||||
auto file = TRY(Core::Stream::File::open("/sys/firmware/power_state"sv, Core::Stream::OpenMode::Write));
|
||||
|
||||
const String file_contents = "2";
|
||||
TRY(file->write(file_contents.bytes()));
|
||||
|
|
|
@ -94,7 +94,7 @@ public:
|
|||
|
||||
m_sql_client->on_next_result = [](int, Vector<String> const& row) {
|
||||
StringBuilder builder;
|
||||
builder.join(", ", row);
|
||||
builder.join(", "sv, row);
|
||||
outln("{}", builder.build());
|
||||
};
|
||||
|
||||
|
@ -293,10 +293,10 @@ private:
|
|||
{
|
||||
static StringBuilder prompt_builder;
|
||||
prompt_builder.clear();
|
||||
prompt_builder.append("> ");
|
||||
prompt_builder.append("> "sv);
|
||||
|
||||
for (auto i = 0; i < level; ++i)
|
||||
prompt_builder.append(" ");
|
||||
prompt_builder.append(" "sv);
|
||||
|
||||
return prompt_builder.build();
|
||||
}
|
||||
|
@ -307,7 +307,7 @@ private:
|
|||
if (command == ".exit" || command == ".quit") {
|
||||
m_keep_running = false;
|
||||
ready_for_input = false;
|
||||
} else if (command.starts_with(".connect ")) {
|
||||
} else if (command.starts_with(".connect "sv)) {
|
||||
auto parts = command.split_view(' ');
|
||||
if (parts.size() == 2) {
|
||||
connect(parts[1]);
|
||||
|
@ -315,7 +315,7 @@ private:
|
|||
} else {
|
||||
outln("\033[33;1mUsage: .connect <database name>\033[0m");
|
||||
}
|
||||
} else if (command.starts_with(".read ")) {
|
||||
} else if (command.starts_with(".read "sv)) {
|
||||
if (!m_input_file) {
|
||||
auto parts = command.split_view(' ');
|
||||
if (parts.size() == 2) {
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
#define HANDLE(VALUE) \
|
||||
case VALUE: \
|
||||
return #VALUE;
|
||||
return #VALUE##sv;
|
||||
#define VALUES_TO_NAMES(FUNC_NAME) \
|
||||
static String FUNC_NAME(int value) \
|
||||
{ \
|
||||
|
@ -252,7 +252,7 @@ struct BitflagOption {
|
|||
};
|
||||
|
||||
#define BITFLAG(NAME) \
|
||||
BitflagOption { NAME, #NAME }
|
||||
BitflagOption { NAME, #NAME##sv }
|
||||
|
||||
struct BitflagBase {
|
||||
int flagset;
|
||||
|
@ -280,7 +280,7 @@ struct Formatter<BitflagDerivative> : StandardFormatter {
|
|||
continue;
|
||||
remaining &= ~option.value;
|
||||
if (had_any_output)
|
||||
TRY(format_builder.put_literal(" | "));
|
||||
TRY(format_builder.put_literal(" | "sv));
|
||||
TRY(format_builder.put_literal(option.name));
|
||||
had_any_output = true;
|
||||
}
|
||||
|
@ -288,7 +288,7 @@ struct Formatter<BitflagDerivative> : StandardFormatter {
|
|||
if (remaining != 0) {
|
||||
// No more BitflagOptions are available. Any remaining flags are unrecognized.
|
||||
if (had_any_output)
|
||||
TRY(format_builder.put_literal(" | "));
|
||||
TRY(format_builder.put_literal(" | "sv));
|
||||
format_builder.builder().appendff("0x{:x} (?)", static_cast<unsigned>(remaining));
|
||||
had_any_output = true;
|
||||
}
|
||||
|
@ -297,7 +297,7 @@ struct Formatter<BitflagDerivative> : StandardFormatter {
|
|||
if constexpr (requires { BitflagDerivative::default_; })
|
||||
TRY(format_builder.put_literal(BitflagDerivative::default_));
|
||||
else
|
||||
TRY(format_builder.put_literal("0"));
|
||||
TRY(format_builder.put_literal("0"sv));
|
||||
}
|
||||
|
||||
return {};
|
||||
|
@ -322,7 +322,7 @@ struct Formatter<PointerArgument> : StandardFormatter {
|
|||
{
|
||||
auto& builder = format_builder.builder();
|
||||
if (value.value == nullptr)
|
||||
builder.append("null");
|
||||
builder.append("null"sv);
|
||||
else
|
||||
builder.appendff("{}", value.value);
|
||||
return {};
|
||||
|
@ -348,7 +348,7 @@ struct Formatter<StringArgument> : StandardFormatter {
|
|||
{
|
||||
auto& builder = format_builder.builder();
|
||||
if (string_argument.argument.characters == nullptr) {
|
||||
builder.append("null");
|
||||
builder.append("null"sv);
|
||||
return {};
|
||||
}
|
||||
|
||||
|
@ -403,7 +403,7 @@ public:
|
|||
|
||||
void format_result(Integral auto res)
|
||||
{
|
||||
m_builder.append(") = ");
|
||||
m_builder.append(") = "sv);
|
||||
if (res < 0)
|
||||
m_builder.appendff("{} {}", res, errno_name(-(int)res));
|
||||
else
|
||||
|
@ -414,7 +414,7 @@ public:
|
|||
void format_result(void* res)
|
||||
{
|
||||
if (res == MAP_FAILED)
|
||||
m_builder.append(") = MAP_FAILED\n");
|
||||
m_builder.append(") = MAP_FAILED\n"sv);
|
||||
else if (FlatPtr(res) > FlatPtr(-EMAXERRNO))
|
||||
m_builder.appendff(") = {} {}\n", res, errno_name(-static_cast<int>(FlatPtr(res))));
|
||||
else
|
||||
|
@ -423,7 +423,7 @@ public:
|
|||
|
||||
void format_result()
|
||||
{
|
||||
m_builder.append(")\n");
|
||||
m_builder.append(")\n"sv);
|
||||
}
|
||||
|
||||
StringView string_view()
|
||||
|
@ -435,7 +435,7 @@ private:
|
|||
void add_argument_separator()
|
||||
{
|
||||
if (!m_first_arg) {
|
||||
m_builder.append(", ");
|
||||
m_builder.append(", "sv);
|
||||
}
|
||||
m_first_arg = false;
|
||||
}
|
||||
|
@ -592,7 +592,7 @@ struct Formatter<struct sockaddr> : StandardFormatter {
|
|||
ErrorOr<void> format(FormatBuilder& format_builder, struct sockaddr address)
|
||||
{
|
||||
auto& builder = format_builder.builder();
|
||||
builder.append("{sa_family=");
|
||||
builder.append("{sa_family="sv);
|
||||
builder.append(domain_name(address.sa_family));
|
||||
if (address.sa_family == AF_INET) {
|
||||
auto* address_in = (const struct sockaddr_in*)&address;
|
||||
|
@ -643,14 +643,14 @@ struct MmapFlags : BitflagBase {
|
|||
BITFLAG(MAP_RANDOMIZED), BITFLAG(MAP_STACK), BITFLAG(MAP_NORESERVE), BITFLAG(MAP_PURGEABLE),
|
||||
BITFLAG(MAP_FIXED_NOREPLACE)
|
||||
};
|
||||
static constexpr StringView default_ = "MAP_FILE";
|
||||
static constexpr StringView default_ = "MAP_FILE"sv;
|
||||
};
|
||||
|
||||
struct MemoryProtectionFlags : BitflagBase {
|
||||
static constexpr auto options = {
|
||||
BITFLAG(PROT_READ), BITFLAG(PROT_WRITE), BITFLAG(PROT_EXEC)
|
||||
};
|
||||
static constexpr StringView default_ = "PROT_NONE";
|
||||
static constexpr StringView default_ = "PROT_NONE"sv;
|
||||
};
|
||||
|
||||
static void format_mmap(FormattedSyscallBuilder& builder, Syscall::SC_mmap_params* params_p)
|
||||
|
|
|
@ -49,55 +49,55 @@ struct ControlCharacter {
|
|||
};
|
||||
|
||||
constexpr TermiosFlag all_iflags[] = {
|
||||
{ "ignbrk", IGNBRK, IGNBRK },
|
||||
{ "brkint", BRKINT, BRKINT },
|
||||
{ "ignpar", IGNPAR, IGNPAR },
|
||||
{ "parmer", PARMRK, PARMRK },
|
||||
{ "inpck", INPCK, INPCK },
|
||||
{ "istrip", ISTRIP, ISTRIP },
|
||||
{ "inlcr", INLCR, INLCR },
|
||||
{ "igncr", IGNCR, IGNCR },
|
||||
{ "icrnl", ICRNL, ICRNL },
|
||||
{ "iuclc", IUCLC, IUCLC },
|
||||
{ "ixon", IXON, IXON },
|
||||
{ "ixany", IXANY, IXANY },
|
||||
{ "ixoff", IXOFF, IXOFF },
|
||||
{ "imaxbel", IMAXBEL, IMAXBEL },
|
||||
{ "iutf8", IUTF8, IUTF8 }
|
||||
{ "ignbrk"sv, IGNBRK, IGNBRK },
|
||||
{ "brkint"sv, BRKINT, BRKINT },
|
||||
{ "ignpar"sv, IGNPAR, IGNPAR },
|
||||
{ "parmer"sv, PARMRK, PARMRK },
|
||||
{ "inpck"sv, INPCK, INPCK },
|
||||
{ "istrip"sv, ISTRIP, ISTRIP },
|
||||
{ "inlcr"sv, INLCR, INLCR },
|
||||
{ "igncr"sv, IGNCR, IGNCR },
|
||||
{ "icrnl"sv, ICRNL, ICRNL },
|
||||
{ "iuclc"sv, IUCLC, IUCLC },
|
||||
{ "ixon"sv, IXON, IXON },
|
||||
{ "ixany"sv, IXANY, IXANY },
|
||||
{ "ixoff"sv, IXOFF, IXOFF },
|
||||
{ "imaxbel"sv, IMAXBEL, IMAXBEL },
|
||||
{ "iutf8"sv, IUTF8, IUTF8 }
|
||||
};
|
||||
|
||||
constexpr TermiosFlag all_oflags[] = {
|
||||
{ "opost", OPOST, OPOST },
|
||||
{ "olcuc", OLCUC, OPOST },
|
||||
{ "onlcr", ONLCR, ONLCR },
|
||||
{ "onlret", ONLRET, ONLRET },
|
||||
{ "ofill", OFILL, OFILL },
|
||||
{ "ofdel", OFDEL, OFDEL },
|
||||
{ "opost"sv, OPOST, OPOST },
|
||||
{ "olcuc"sv, OLCUC, OPOST },
|
||||
{ "onlcr"sv, ONLCR, ONLCR },
|
||||
{ "onlret"sv, ONLRET, ONLRET },
|
||||
{ "ofill"sv, OFILL, OFILL },
|
||||
{ "ofdel"sv, OFDEL, OFDEL },
|
||||
};
|
||||
|
||||
constexpr TermiosFlag all_cflags[] = {
|
||||
{ "cs5", CS5, CSIZE },
|
||||
{ "cs6", CS6, CSIZE },
|
||||
{ "cs7", CS7, CSIZE },
|
||||
{ "cs8", CS8, CSIZE },
|
||||
{ "cstopb", CSTOPB, CSTOPB },
|
||||
{ "cread", CREAD, CREAD },
|
||||
{ "parenb", PARENB, PARENB },
|
||||
{ "parodd", PARODD, PARODD },
|
||||
{ "hupcl", HUPCL, HUPCL },
|
||||
{ "clocal", CLOCAL, CLOCAL },
|
||||
{ "cs5"sv, CS5, CSIZE },
|
||||
{ "cs6"sv, CS6, CSIZE },
|
||||
{ "cs7"sv, CS7, CSIZE },
|
||||
{ "cs8"sv, CS8, CSIZE },
|
||||
{ "cstopb"sv, CSTOPB, CSTOPB },
|
||||
{ "cread"sv, CREAD, CREAD },
|
||||
{ "parenb"sv, PARENB, PARENB },
|
||||
{ "parodd"sv, PARODD, PARODD },
|
||||
{ "hupcl"sv, HUPCL, HUPCL },
|
||||
{ "clocal"sv, CLOCAL, CLOCAL },
|
||||
};
|
||||
|
||||
constexpr TermiosFlag all_lflags[] = {
|
||||
{ "isig", ISIG, ISIG },
|
||||
{ "icanon", ICANON, ICANON },
|
||||
{ "echo", ECHO, ECHO },
|
||||
{ "echoe", ECHOE, ECHOE },
|
||||
{ "echok", ECHOK, ECHOK },
|
||||
{ "echonl", ECHONL, ECHONL },
|
||||
{ "noflsh", NOFLSH, NOFLSH },
|
||||
{ "tostop", TOSTOP, TOSTOP },
|
||||
{ "iexten", IEXTEN, IEXTEN }
|
||||
{ "isig"sv, ISIG, ISIG },
|
||||
{ "icanon"sv, ICANON, ICANON },
|
||||
{ "echo"sv, ECHO, ECHO },
|
||||
{ "echoe"sv, ECHOE, ECHOE },
|
||||
{ "echok"sv, ECHOK, ECHOK },
|
||||
{ "echonl"sv, ECHONL, ECHONL },
|
||||
{ "noflsh"sv, NOFLSH, NOFLSH },
|
||||
{ "tostop"sv, TOSTOP, TOSTOP },
|
||||
{ "iexten"sv, IEXTEN, IEXTEN }
|
||||
};
|
||||
|
||||
constexpr BaudRate baud_rates[] = {
|
||||
|
@ -135,22 +135,22 @@ constexpr BaudRate baud_rates[] = {
|
|||
};
|
||||
|
||||
constexpr ControlCharacter control_characters[] = {
|
||||
{ "intr", VINTR },
|
||||
{ "quit", VQUIT },
|
||||
{ "erase", VERASE },
|
||||
{ "kill", VKILL },
|
||||
{ "eof", VEOF },
|
||||
{ "intr"sv, VINTR },
|
||||
{ "quit"sv, VQUIT },
|
||||
{ "erase"sv, VERASE },
|
||||
{ "kill"sv, VKILL },
|
||||
{ "eof"sv, VEOF },
|
||||
/* time and min are handled separately */
|
||||
{ "swtc", VSWTC },
|
||||
{ "start", VSTART },
|
||||
{ "stop", VSTOP },
|
||||
{ "susp", VSUSP },
|
||||
{ "eol", VEOL },
|
||||
{ "reprint", VREPRINT },
|
||||
{ "discard", VDISCARD },
|
||||
{ "werase", VWERASE },
|
||||
{ "lnext", VLNEXT },
|
||||
{ "eol2", VEOL2 }
|
||||
{ "swtc"sv, VSWTC },
|
||||
{ "start"sv, VSTART },
|
||||
{ "stop"sv, VSTOP },
|
||||
{ "susp"sv, VSUSP },
|
||||
{ "eol"sv, VEOL },
|
||||
{ "reprint"sv, VREPRINT },
|
||||
{ "discard"sv, VDISCARD },
|
||||
{ "werase"sv, VWERASE },
|
||||
{ "lnext"sv, VLNEXT },
|
||||
{ "eol2"sv, VEOL2 }
|
||||
};
|
||||
|
||||
Optional<speed_t> numeric_value_to_speed(unsigned long);
|
||||
|
@ -208,7 +208,7 @@ void print_human_readable(termios const& modes, winsize const& ws, bool verbose_
|
|||
sb.append("^");
|
||||
sb.append(ch + 0x40);
|
||||
} else if (ch == 0x7f) {
|
||||
sb.append("^?");
|
||||
sb.append("^?"sv);
|
||||
} else {
|
||||
sb.append(ch);
|
||||
}
|
||||
|
@ -328,7 +328,7 @@ Result<void, int> apply_modes(size_t parameter_count, char** raw_parameters, ter
|
|||
return 0;
|
||||
} else if (parameters[idx][0] == '^' && parameters[idx].length() == 2) {
|
||||
return toupper(parameters[idx][1]) - 0x40;
|
||||
} else if (parameters[idx].starts_with("0x")) {
|
||||
} else if (parameters[idx].starts_with("0x"sv)) {
|
||||
cc_t value = 0;
|
||||
if (parameters[idx].length() == 2) {
|
||||
warnln("Invalid hexadecimal character code {}", parameters[idx]);
|
||||
|
@ -343,7 +343,7 @@ Result<void, int> apply_modes(size_t parameter_count, char** raw_parameters, ter
|
|||
value = 16 * value + (isdigit(ch)) ? (ch - '0') : (ch - 'a');
|
||||
}
|
||||
return value;
|
||||
} else if (parameters[idx].starts_with("0")) {
|
||||
} else if (parameters[idx].starts_with("0"sv)) {
|
||||
cc_t value = 0;
|
||||
for (size_t i = 1; i < parameters[idx].length(); ++i) {
|
||||
char ch = parameters[idx][i];
|
||||
|
|
|
@ -123,7 +123,7 @@ static FlatPtr as_buf(Vector<FlatPtr> params_vec)
|
|||
|
||||
if constexpr (SYSCALL_1_DEBUG) {
|
||||
StringBuilder builder;
|
||||
builder.append("Prepared [");
|
||||
builder.append("Prepared ["sv);
|
||||
for (size_t i = 0; i < params_vec.size(); ++i) {
|
||||
builder.appendff(" {:p}", params_vec[i]);
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
continue;
|
||||
|
||||
if (line.starts_with(".")) {
|
||||
if (line.starts_with(".text ")) {
|
||||
if (line.starts_with(".text "sv)) {
|
||||
editor->add_to_history(line);
|
||||
if (socket->ready_state() != Protocol::WebSocket::ReadyState::Open) {
|
||||
outln("Could not send message : socket is not open.");
|
||||
|
@ -103,7 +103,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
socket->send(line.substring(6));
|
||||
continue;
|
||||
}
|
||||
if (line.starts_with(".base64 ")) {
|
||||
if (line.starts_with(".base64 "sv)) {
|
||||
editor->add_to_history(line);
|
||||
if (socket->ready_state() != Protocol::WebSocket::ReadyState::Open) {
|
||||
outln("Could not send message : socket is not open.");
|
||||
|
|
|
@ -51,9 +51,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
response = move(client->send_simple_command(IMAP::CommandType::Capability)->await().value().get<IMAP::SolidResponse>());
|
||||
outln("[CAPABILITY] First capability: {}", response.data().capabilities().first());
|
||||
bool idle_supported = !response.data().capabilities().find_if([](auto capability) { return capability.equals_ignoring_case("IDLE"); }).is_end();
|
||||
bool idle_supported = !response.data().capabilities().find_if([](auto capability) { return capability.equals_ignoring_case("IDLE"sv); }).is_end();
|
||||
|
||||
response = client->list("", "*")->await().release_value();
|
||||
response = client->list(""sv, "*"sv)->await().release_value();
|
||||
outln("[LIST] First mailbox: {}", response.data().list_items().first().name);
|
||||
|
||||
auto mailbox = "Inbox"sv;
|
||||
|
@ -70,7 +70,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
"This is a message just to say hello.\r\n"
|
||||
"So, \"Hello\"."
|
||||
};
|
||||
auto promise = client->append("INBOX", move(message));
|
||||
auto promise = client->append("INBOX"sv, move(message));
|
||||
response = promise->await().release_value();
|
||||
outln("[APPEND] Response: {}", response.response_text());
|
||||
|
||||
|
@ -85,7 +85,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
auto added_message = search_results.first();
|
||||
outln("[SEARCH] Number of results: {}", search_results.size());
|
||||
|
||||
response = client->status("INBOX", { IMAP::StatusItemType::Recent, IMAP::StatusItemType::Messages })->await().release_value();
|
||||
response = client->status("INBOX"sv, { IMAP::StatusItemType::Recent, IMAP::StatusItemType::Messages })->await().release_value();
|
||||
outln("[STATUS] Recent items: {}", response.data().status_item().get(IMAP::StatusItemType::Recent));
|
||||
|
||||
for (auto item : search_results) {
|
||||
|
|
|
@ -346,7 +346,7 @@ static OwnPtr<Condition> parse_simple_expression(char* argv[])
|
|||
optind++;
|
||||
if (should_treat_expression_as_single_string({ argv[optind], strlen(argv[optind]) })) {
|
||||
--optind;
|
||||
return make<StringCompare>(move(arg), "", StringCompare::NotEqual);
|
||||
return make<StringCompare>(move(arg), ""sv, StringCompare::NotEqual);
|
||||
}
|
||||
|
||||
StringView value { argv[optind], strlen(argv[optind]) };
|
||||
|
@ -381,9 +381,9 @@ static OwnPtr<Condition> parse_simple_expression(char* argv[])
|
|||
--optind;
|
||||
return {};
|
||||
case 'n':
|
||||
return make<StringCompare>("", value, StringCompare::NotEqual);
|
||||
return make<StringCompare>(""sv, value, StringCompare::NotEqual);
|
||||
case 'z':
|
||||
return make<StringCompare>("", value, StringCompare::Equal);
|
||||
return make<StringCompare>(""sv, value, StringCompare::Equal);
|
||||
case 'g':
|
||||
case 'G':
|
||||
case 'k':
|
||||
|
@ -445,12 +445,12 @@ static OwnPtr<Condition> parse_simple_expression(char* argv[])
|
|||
// '-a' and '-o' are boolean ops, which are part of a complex expression
|
||||
// put them back and return with lhs as string compare.
|
||||
--optind;
|
||||
return make<StringCompare>("", lhs, StringCompare::NotEqual);
|
||||
return make<StringCompare>(""sv, lhs, StringCompare::NotEqual);
|
||||
} else {
|
||||
// Now that we know it's not a well-formed expression, see if it's actually a negation
|
||||
if (lhs == "!") {
|
||||
if (should_treat_expression_as_single_string(arg))
|
||||
return make<StringCompare>(move(lhs), "", StringCompare::NotEqual);
|
||||
return make<StringCompare>(move(lhs), ""sv, StringCompare::NotEqual);
|
||||
|
||||
auto command = parse_complex_expression(argv);
|
||||
if (!command)
|
||||
|
@ -459,7 +459,7 @@ static OwnPtr<Condition> parse_simple_expression(char* argv[])
|
|||
return make<Not>(command.release_nonnull());
|
||||
}
|
||||
--optind;
|
||||
return make<StringCompare>("", lhs, StringCompare::NotEqual);
|
||||
return make<StringCompare>(""sv, lhs, StringCompare::NotEqual);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -122,7 +122,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
if (!file_filters.is_empty()) {
|
||||
for (auto& filter : file_filters) {
|
||||
// Convert underscore wildcards (usual unzip convention) to question marks (as used by StringUtils)
|
||||
auto string_filter = filter.replace("_", "?", ReplaceMode::All);
|
||||
auto string_filter = filter.replace("_"sv, "?"sv, ReplaceMode::All);
|
||||
if (zip_member.name.matches(string_filter, CaseSensitivity::CaseSensitive)) {
|
||||
keep_file = true;
|
||||
break;
|
||||
|
|
|
@ -13,23 +13,23 @@
|
|||
|
||||
ErrorOr<int> serenity_main(Main::Arguments)
|
||||
{
|
||||
Core::DirIterator parser_tests(LexicalPath::join(Core::StandardPaths::home_directory(), "Tests/cpp-tests/parser").string());
|
||||
Core::DirIterator parser_tests(LexicalPath::join(Core::StandardPaths::home_directory(), "Tests/cpp-tests/parser"sv).string());
|
||||
while (parser_tests.has_next()) {
|
||||
auto cpp_full_path = parser_tests.next_full_path();
|
||||
if (!cpp_full_path.ends_with(".cpp"))
|
||||
if (!cpp_full_path.ends_with(".cpp"sv))
|
||||
continue;
|
||||
auto ast_full_path = cpp_full_path.replace(".cpp", ".ast", ReplaceMode::FirstOnly);
|
||||
auto ast_full_path = cpp_full_path.replace(".cpp"sv, ".ast"sv, ReplaceMode::FirstOnly);
|
||||
outln("{}", cpp_full_path);
|
||||
auto res = Core::command("/bin/sh", { "-c", String::formatted("cpp-parser {} > {}", cpp_full_path, ast_full_path) }, {});
|
||||
VERIFY(!res.is_error());
|
||||
}
|
||||
|
||||
Core::DirIterator preprocessor_tests(LexicalPath::join(Core::StandardPaths::home_directory(), "Tests/cpp-tests/preprocessor").string());
|
||||
Core::DirIterator preprocessor_tests(LexicalPath::join(Core::StandardPaths::home_directory(), "Tests/cpp-tests/preprocessor"sv).string());
|
||||
while (preprocessor_tests.has_next()) {
|
||||
auto cpp_full_path = preprocessor_tests.next_full_path();
|
||||
if (!cpp_full_path.ends_with(".cpp"))
|
||||
if (!cpp_full_path.ends_with(".cpp"sv))
|
||||
continue;
|
||||
auto ast_full_path = cpp_full_path.replace(".cpp", ".txt", ReplaceMode::FirstOnly);
|
||||
auto ast_full_path = cpp_full_path.replace(".cpp"sv, ".txt"sv, ReplaceMode::FirstOnly);
|
||||
outln("{}", cpp_full_path);
|
||||
auto res = Core::command("/bin/sh", { "-c", String::formatted("cpp-preprocessor {} > {}", cpp_full_path, ast_full_path) }, {});
|
||||
VERIFY(!res.is_error());
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
constexpr uid_t BASE_UID = 1000;
|
||||
constexpr gid_t USERS_GID = 100;
|
||||
constexpr char const* DEFAULT_SHELL = "/bin/sh";
|
||||
constexpr auto DEFAULT_SHELL = "/bin/sh"sv;
|
||||
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
|
@ -139,7 +139,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
fill_with_random(random_data, sizeof(random_data));
|
||||
|
||||
StringBuilder builder;
|
||||
builder.append("$5$");
|
||||
builder.append("$5$"sv);
|
||||
builder.append(encode_base64(ReadonlyBytes(random_data, sizeof(random_data))));
|
||||
|
||||
return builder.build();
|
||||
|
|
|
@ -51,7 +51,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
auto& target_account = account_or_error.value();
|
||||
|
||||
if (remove_home) {
|
||||
TRY(Core::System::unveil(target_account.home_directory().characters(), "c"));
|
||||
TRY(Core::System::unveil(target_account.home_directory(), "c"sv));
|
||||
} else {
|
||||
TRY(Core::System::pledge("stdio wpath rpath cpath fattr"));
|
||||
}
|
||||
|
|
|
@ -61,8 +61,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
auto& target_account = account_or_error.value();
|
||||
|
||||
if (move_home) {
|
||||
TRY(Core::System::unveil(target_account.home_directory().characters(), "c"));
|
||||
TRY(Core::System::unveil({ new_home_directory, strlen(new_home_directory) }, "wc"));
|
||||
TRY(Core::System::unveil(target_account.home_directory(), "c"sv));
|
||||
TRY(Core::System::unveil({ new_home_directory, strlen(new_home_directory) }, "wc"sv));
|
||||
}
|
||||
|
||||
unveil(nullptr, nullptr);
|
||||
|
|
|
@ -43,11 +43,11 @@ ErrorOr<int> serenity_main(Main::Arguments)
|
|||
outln("\033[1m{:10} {:12} {:16} {:6} {}\033[0m", "USER", "TTY", "LOGIN@", "IDLE", "WHAT");
|
||||
json.as_object().for_each_member([&](auto& tty, auto& value) {
|
||||
const JsonObject& entry = value.as_object();
|
||||
auto uid = entry.get("uid").to_u32();
|
||||
[[maybe_unused]] auto pid = entry.get("pid").to_i32();
|
||||
auto uid = entry.get("uid"sv).to_u32();
|
||||
[[maybe_unused]] auto pid = entry.get("pid"sv).to_i32();
|
||||
|
||||
auto login_time = Core::DateTime::from_timestamp(entry.get("login_at").to_number<time_t>());
|
||||
auto login_at = login_time.to_string("%b%d %H:%M:%S");
|
||||
auto login_time = Core::DateTime::from_timestamp(entry.get("login_at"sv).to_number<time_t>());
|
||||
auto login_at = login_time.to_string("%b%d %H:%M:%S"sv);
|
||||
|
||||
auto* pw = getpwuid(uid);
|
||||
String username;
|
||||
|
|
|
@ -33,7 +33,7 @@ static String build_header_string(Vector<char const*> const& command, struct tim
|
|||
StringBuilder builder;
|
||||
builder.appendff("Every {}.{}s: \x1b[1m", interval.tv_sec, interval.tv_usec / 100000);
|
||||
builder.join(' ', command);
|
||||
builder.append("\x1b[0m");
|
||||
builder.append("\x1b[0m"sv);
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ static String build_header_string(Vector<char const*> const& command, Vector<Str
|
|||
StringBuilder builder;
|
||||
builder.appendff("Every time any of {} changes: \x1b[1m", filenames);
|
||||
builder.join(' ', command);
|
||||
builder.append("\x1b[0m");
|
||||
builder.append("\x1b[0m"sv);
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ ErrorOr<int> serenity_main(Main::Arguments main_arguments)
|
|||
int devnull_fd = 0;
|
||||
|
||||
if (is_stdin) {
|
||||
devnull_fd = TRY(Core::System::open("/dev/null", O_RDONLY | O_CLOEXEC));
|
||||
devnull_fd = TRY(Core::System::open("/dev/null"sv, O_RDONLY | O_CLOEXEC));
|
||||
}
|
||||
|
||||
size_t total_command_length = 0;
|
||||
|
@ -254,8 +254,8 @@ ParsedInitialArguments::ParsedInitialArguments(Vector<String>& arguments, String
|
|||
// Append an implicit placeholder at the end if no argument has any placeholders.
|
||||
if (!some_argument_has_placeholder) {
|
||||
Vector<StringView> parts;
|
||||
parts.append("");
|
||||
parts.append("");
|
||||
parts.append(""sv);
|
||||
parts.append(""sv);
|
||||
m_all_parts.append(move(parts));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,9 +31,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
TRY(Core::System::pledge("stdio rpath wpath cpath"));
|
||||
|
||||
auto cwd = TRY(Core::System::getcwd());
|
||||
TRY(Core::System::unveil(LexicalPath::absolute_path(cwd, zip_path), "wc"));
|
||||
TRY(Core::System::unveil(LexicalPath::absolute_path(cwd, zip_path), "wc"sv));
|
||||
for (auto const& source_path : source_paths) {
|
||||
TRY(Core::System::unveil(LexicalPath::absolute_path(cwd, source_path), "r"));
|
||||
TRY(Core::System::unveil(LexicalPath::absolute_path(cwd, source_path), "r"sv));
|
||||
}
|
||||
TRY(Core::System::unveil(nullptr, nullptr));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue