mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 22:27:35 +00:00
AK+Everywhere: Rename String to DeprecatedString
We have a new, improved string type coming up in AK (OOM aware, no null state), and while it's going to use UTF-8, the name UTF8String is a mouthful - so let's free up the String name by renaming the existing class. Making the old one have an annoying name will hopefully also help with quick adoption :^)
This commit is contained in:
parent
f74251606d
commit
6e19ab2bbc
2006 changed files with 11635 additions and 11636 deletions
|
@ -4,8 +4,8 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/Optional.h>
|
||||
#include <AK/String.h>
|
||||
#include <LibCore/ElapsedTimer.h>
|
||||
#include <LibMain/Main.h>
|
||||
#include <unistd.h>
|
||||
|
|
|
@ -5,11 +5,11 @@
|
|||
*/
|
||||
|
||||
#include <AK/Assertions.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/IPv4Address.h>
|
||||
#include <AK/JsonObject.h>
|
||||
#include <AK/MACAddress.h>
|
||||
#include <AK/QuickSort.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/Types.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/Stream.h>
|
||||
|
@ -53,10 +53,10 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
};
|
||||
|
||||
struct Column {
|
||||
String title;
|
||||
DeprecatedString title;
|
||||
Alignment alignment { Alignment::Left };
|
||||
int width { 0 };
|
||||
String buffer;
|
||||
DeprecatedString buffer;
|
||||
};
|
||||
|
||||
Vector<Column> columns;
|
||||
|
|
|
@ -31,7 +31,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
auto audio_client = TRY(Audio::ConnectionToServer::try_create());
|
||||
audio_client->async_pause_playback();
|
||||
|
||||
String command = String::empty();
|
||||
DeprecatedString command = DeprecatedString::empty();
|
||||
Vector<StringView> command_arguments;
|
||||
bool human_mode = false;
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
args_parser.parse(arguments);
|
||||
Core::EventLoop loop;
|
||||
|
||||
Core::DirIterator iterator(String::formatted("/proc/{}/stacks", pid), Core::DirIterator::SkipDots);
|
||||
Core::DirIterator iterator(DeprecatedString::formatted("/proc/{}/stacks", pid), Core::DirIterator::SkipDots);
|
||||
if (iterator.has_error()) {
|
||||
warnln("Error: pid '{}' doesn't appear to exist.", pid);
|
||||
return 1;
|
||||
|
@ -54,11 +54,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
// See if we can find the sources in /usr/src
|
||||
// FIXME: I'm sure this can be improved!
|
||||
auto full_path = LexicalPath::canonicalized_path(String::formatted("/usr/src/serenity/dummy/dummy/{}", source_position.file_path));
|
||||
auto full_path = LexicalPath::canonicalized_path(DeprecatedString::formatted("/usr/src/serenity/dummy/dummy/{}", source_position.file_path));
|
||||
if (access(full_path.characters(), F_OK) == 0) {
|
||||
linked = true;
|
||||
auto url = URL::create_with_file_scheme(full_path, {}, hostname);
|
||||
url.set_query(String::formatted("line_number={}", source_position.line_number));
|
||||
url.set_query(DeprecatedString::formatted("line_number={}", source_position.line_number));
|
||||
out("\033]8;;{}\033\\", url.serialize());
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
}
|
||||
|
||||
auto hash_name = program_name.substring_view(0, program_name.length() - 3).to_string().to_uppercase();
|
||||
auto paths_help_string = String::formatted("File(s) to print {} checksum of", hash_name);
|
||||
auto paths_help_string = DeprecatedString::formatted("File(s) to print {} checksum of", hash_name);
|
||||
|
||||
bool verify_from_paths = false;
|
||||
Vector<StringView> paths;
|
||||
|
@ -97,7 +97,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
hash.reset();
|
||||
while (!file_from_filename->is_eof())
|
||||
hash.update(TRY(file_from_filename->read(buffer)));
|
||||
if (String::formatted("{:hex-dump}", hash.digest().bytes()) == line[0])
|
||||
if (DeprecatedString::formatted("{:hex-dump}", hash.digest().bytes()) == line[0])
|
||||
outln("{}: OK", filename);
|
||||
else {
|
||||
++failed_verification_count;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/String.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibMain/Main.h>
|
||||
|
@ -28,12 +28,12 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
gid_t new_gid = -1;
|
||||
|
||||
if (String(gid_arg).is_empty()) {
|
||||
if (DeprecatedString(gid_arg).is_empty()) {
|
||||
warnln("Empty gid option");
|
||||
return 1;
|
||||
}
|
||||
|
||||
auto number = String(gid_arg).to_uint();
|
||||
auto number = DeprecatedString(gid_arg).to_uint();
|
||||
if (number.has_value()) {
|
||||
new_gid = number.value();
|
||||
} else {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/String.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/DirIterator.h>
|
||||
|
@ -21,7 +21,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio rpath chown"));
|
||||
|
||||
String spec;
|
||||
DeprecatedString spec;
|
||||
Vector<StringView> paths;
|
||||
bool no_dereference = false;
|
||||
bool recursive = false;
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
Vector<String> paths;
|
||||
Vector<DeprecatedString> paths;
|
||||
char const* opt_algorithm = nullptr;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
|
@ -22,9 +22,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
args_parser.add_positional_argument(paths, "File", "file", Core::ArgsParser::Required::No);
|
||||
args_parser.parse(arguments);
|
||||
|
||||
auto algorithm = (opt_algorithm == nullptr) ? "crc32" : String(opt_algorithm).to_lowercase();
|
||||
auto algorithm = (opt_algorithm == nullptr) ? "crc32" : DeprecatedString(opt_algorithm).to_lowercase();
|
||||
|
||||
auto available_algorithms = Vector<String> { "crc32", "adler32" };
|
||||
auto available_algorithms = Vector<DeprecatedString> { "crc32", "adler32" };
|
||||
|
||||
if (algorithm == "list") {
|
||||
outln("Available algorithms:");
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include <LibMain/Main.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static ErrorOr<NonnullOwnPtr<Core::Stream::BufferedFile>> open_file_or_stdin(String const& filename)
|
||||
static ErrorOr<NonnullOwnPtr<Core::Stream::BufferedFile>> open_file_or_stdin(DeprecatedString const& filename)
|
||||
{
|
||||
OwnPtr<Core::Stream::File> file;
|
||||
if (filename == "-") {
|
||||
|
@ -27,8 +27,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
TRY(Core::System::pledge("stdio rpath"));
|
||||
|
||||
Core::ArgsParser parser;
|
||||
String filename1;
|
||||
String filename2;
|
||||
DeprecatedString filename1;
|
||||
DeprecatedString filename2;
|
||||
bool verbose = false;
|
||||
bool silent = false;
|
||||
|
||||
|
@ -69,8 +69,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
if (silent)
|
||||
return;
|
||||
auto additional_info = verbose
|
||||
? String::formatted(" after byte {}", byte_number)
|
||||
: String::formatted(" after byte {}, line {}", byte_number, line_number);
|
||||
? DeprecatedString::formatted(" after byte {}", byte_number)
|
||||
: DeprecatedString::formatted(" after byte {}, line {}", byte_number, line_number);
|
||||
warnln("cmp: EOF on {}{}", shorter_file_name, additional_info);
|
||||
};
|
||||
|
||||
|
|
|
@ -22,8 +22,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio rpath"));
|
||||
|
||||
String file1_path;
|
||||
String file2_path;
|
||||
DeprecatedString file1_path;
|
||||
DeprecatedString file2_path;
|
||||
bool suppress_col1 { false };
|
||||
bool suppress_col2 { false };
|
||||
bool suppress_col3 { false };
|
||||
|
@ -61,7 +61,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
return 1;
|
||||
}
|
||||
|
||||
auto open_file = [](String const& path, auto& file, int file_number) {
|
||||
auto open_file = [](DeprecatedString const& path, auto& file, int file_number) {
|
||||
auto file_or_error = Core::Stream::File::open_file_or_standard_stream(path, Core::Stream::OpenMode::Read);
|
||||
if (file_or_error.is_error()) {
|
||||
warnln("Failed to open file{} '{}': {}", file_number, path, file_or_error.error());
|
||||
|
@ -90,17 +90,17 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
char tab { '\t' };
|
||||
size_t tab_count { 0 };
|
||||
String col1_fmt;
|
||||
String col2_fmt;
|
||||
String col3_fmt;
|
||||
DeprecatedString col1_fmt;
|
||||
DeprecatedString col2_fmt;
|
||||
DeprecatedString col3_fmt;
|
||||
if (!suppress_col1)
|
||||
col1_fmt = String::formatted("{}{}", String::repeated(tab, tab_count++), print_color ? COL1_COLOR : "{}");
|
||||
col1_fmt = DeprecatedString::formatted("{}{}", DeprecatedString::repeated(tab, tab_count++), print_color ? COL1_COLOR : "{}");
|
||||
if (!suppress_col2)
|
||||
col2_fmt = String::formatted("{}{}", String::repeated(tab, tab_count++), print_color ? COL2_COLOR : "{}");
|
||||
col2_fmt = DeprecatedString::formatted("{}{}", DeprecatedString::repeated(tab, tab_count++), print_color ? COL2_COLOR : "{}");
|
||||
if (!suppress_col3)
|
||||
col3_fmt = String::formatted("{}{}", String::repeated(tab, tab_count++), print_color ? COL3_COLOR : "{}");
|
||||
col3_fmt = DeprecatedString::formatted("{}{}", DeprecatedString::repeated(tab, tab_count++), print_color ? COL3_COLOR : "{}");
|
||||
|
||||
auto cmp = [&](String const& str1, String const& str2) {
|
||||
auto cmp = [&](DeprecatedString const& str1, DeprecatedString const& str2) {
|
||||
if (case_insensitive)
|
||||
return strcasecmp(str1.characters(), str2.characters());
|
||||
return strcmp(str1.characters(), str2.characters());
|
||||
|
@ -111,8 +111,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
int col1_count { 0 };
|
||||
int col2_count { 0 };
|
||||
int col3_count { 0 };
|
||||
String file1_line;
|
||||
String file2_line;
|
||||
DeprecatedString file1_line;
|
||||
DeprecatedString file2_line;
|
||||
Array<u8, PAGE_SIZE> buffer;
|
||||
|
||||
auto should_continue_comparing_files = [&]() {
|
||||
|
@ -167,7 +167,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
outln(col2_fmt, file2_line);
|
||||
}
|
||||
|
||||
auto process_remaining = [&](String const& fmt, auto& file, int& count, bool print) {
|
||||
auto process_remaining = [&](DeprecatedString const& fmt, auto& file, int& count, bool print) {
|
||||
while (true) {
|
||||
auto can_read_result = file->can_read_line();
|
||||
if (can_read_result.is_error() || !can_read_result.value())
|
||||
|
|
|
@ -12,10 +12,10 @@
|
|||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
Core::EventLoop loop;
|
||||
String domain;
|
||||
String group;
|
||||
String key;
|
||||
String value_to_write;
|
||||
DeprecatedString domain;
|
||||
DeprecatedString group;
|
||||
DeprecatedString key;
|
||||
DeprecatedString value_to_write;
|
||||
bool remove = false;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#include <AK/Assertions.h>
|
||||
#include <AK/ByteBuffer.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/Stream.h>
|
||||
|
@ -16,7 +16,7 @@
|
|||
#include <unistd.h>
|
||||
|
||||
struct Options {
|
||||
String data;
|
||||
DeprecatedString data;
|
||||
StringView type;
|
||||
bool clear;
|
||||
};
|
||||
|
@ -24,7 +24,7 @@ struct Options {
|
|||
static ErrorOr<Options> parse_options(Main::Arguments arguments)
|
||||
{
|
||||
auto type = "text/plain"sv;
|
||||
Vector<String> text;
|
||||
Vector<DeprecatedString> text;
|
||||
bool clear = false;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
|
|
|
@ -21,7 +21,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
bool recursion_allowed = false;
|
||||
bool verbose = false;
|
||||
Vector<StringView> sources;
|
||||
String destination;
|
||||
DeprecatedString destination;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_option(link, "Link files instead of copying", "link", 'l');
|
||||
|
@ -73,7 +73,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
for (auto& source : sources) {
|
||||
auto destination_path = destination_is_existing_dir
|
||||
? String::formatted("{}/{}", destination, LexicalPath::basename(source))
|
||||
? DeprecatedString::formatted("{}/{}", destination, LexicalPath::basename(source))
|
||||
: destination;
|
||||
|
||||
auto result = Core::File::copy_file_or_directory(
|
||||
|
|
|
@ -21,7 +21,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
auto file = TRY(Core::Stream::File::open(path, Core::Stream::OpenMode::Read));
|
||||
auto content = TRY(file->read_all());
|
||||
String name = LexicalPath::basename(path);
|
||||
DeprecatedString name = LexicalPath::basename(path);
|
||||
Cpp::Preprocessor cpp(name, StringView { content });
|
||||
auto tokens = cpp.process_and_lex();
|
||||
|
||||
|
@ -31,7 +31,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
if (definition.value.parameters.is_empty())
|
||||
outln("{}: {}", definition.key, definition.value.value);
|
||||
else
|
||||
outln("{}({}): {}", definition.key, String::join(',', definition.value.parameters), definition.value.value);
|
||||
outln("{}({}): {}", definition.key, DeprecatedString::join(',', definition.value.parameters), definition.value.value);
|
||||
}
|
||||
outln("");
|
||||
}
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/QuickSort.h>
|
||||
#include <AK/StdLibExtras.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibMain/Main.h>
|
||||
|
@ -32,9 +32,9 @@ struct Range {
|
|||
}
|
||||
};
|
||||
|
||||
static bool expand_list(String& list, Vector<Range>& ranges)
|
||||
static bool expand_list(DeprecatedString& list, Vector<Range>& ranges)
|
||||
{
|
||||
Vector<String> tokens = list.split(',');
|
||||
Vector<DeprecatedString> tokens = list.split(',');
|
||||
|
||||
for (auto& token : tokens) {
|
||||
if (token.length() == 0) {
|
||||
|
@ -127,7 +127,7 @@ static void process_line_bytes(char* line, size_t length, Vector<Range> const& r
|
|||
continue;
|
||||
|
||||
auto to = min(i.m_to, length);
|
||||
auto sub_string = String(line).substring(i.m_from - 1, to - i.m_from + 1);
|
||||
auto sub_string = DeprecatedString(line).substring(i.m_from - 1, to - i.m_from + 1);
|
||||
out("{}", sub_string);
|
||||
}
|
||||
outln();
|
||||
|
@ -135,8 +135,8 @@ static void process_line_bytes(char* line, size_t length, Vector<Range> const& r
|
|||
|
||||
static void process_line_fields(char* line, size_t length, Vector<Range> const& ranges, char delimiter)
|
||||
{
|
||||
auto string_split = String(line, length).split(delimiter);
|
||||
Vector<String> output_fields;
|
||||
auto string_split = DeprecatedString(line, length).split(delimiter);
|
||||
Vector<DeprecatedString> output_fields;
|
||||
|
||||
for (auto& range : ranges) {
|
||||
for (size_t i = range.m_from - 1; i < min(range.m_to, string_split.size()); i++) {
|
||||
|
@ -144,14 +144,14 @@ static void process_line_fields(char* line, size_t length, Vector<Range> const&
|
|||
}
|
||||
}
|
||||
|
||||
outln("{}", String::join(delimiter, output_fields));
|
||||
outln("{}", DeprecatedString::join(delimiter, output_fields));
|
||||
}
|
||||
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
String byte_list = "";
|
||||
String fields_list = "";
|
||||
String delimiter = "\t";
|
||||
DeprecatedString byte_list = "";
|
||||
DeprecatedString fields_list = "";
|
||||
DeprecatedString delimiter = "\t";
|
||||
|
||||
Vector<StringView> files;
|
||||
|
||||
|
@ -185,7 +185,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
return 1;
|
||||
}
|
||||
|
||||
String ranges_list;
|
||||
DeprecatedString ranges_list;
|
||||
Vector<Range> ranges_vector;
|
||||
|
||||
if (selected_bytes) {
|
||||
|
@ -224,13 +224,13 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
}
|
||||
|
||||
if (files.is_empty())
|
||||
files.append(String());
|
||||
files.append(DeprecatedString());
|
||||
|
||||
/* Process each file */
|
||||
for (auto& file : files) {
|
||||
FILE* fp = stdin;
|
||||
if (!file.is_null()) {
|
||||
fp = fopen(String(file).characters(), "r");
|
||||
fp = fopen(DeprecatedString(file).characters(), "r");
|
||||
if (!fp) {
|
||||
warnln("cut: Could not open file '{}'", file);
|
||||
continue;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/String.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/DateTime.h>
|
||||
#include <LibCore/System.h>
|
||||
|
@ -32,7 +32,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
args_parser.parse(arguments);
|
||||
|
||||
if (set_date != nullptr) {
|
||||
auto number = String(set_date).to_uint();
|
||||
auto number = DeprecatedString(set_date).to_uint();
|
||||
|
||||
if (!number.has_value()) {
|
||||
warnln("date: Invalid timestamp value");
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/Optional.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibMain/Main.h>
|
||||
#include <ctype.h>
|
||||
|
|
|
@ -16,13 +16,13 @@
|
|||
static bool flag_human_readable = false;
|
||||
|
||||
struct FileSystem {
|
||||
String fs;
|
||||
DeprecatedString fs;
|
||||
size_t total_block_count { 0 };
|
||||
size_t free_block_count { 0 };
|
||||
size_t total_inode_count { 0 };
|
||||
size_t free_inode_count { 0 };
|
||||
size_t block_size { 0 };
|
||||
String mount_point;
|
||||
DeprecatedString mount_point;
|
||||
};
|
||||
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
|
|
|
@ -16,8 +16,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
TRY(Core::System::pledge("stdio rpath"));
|
||||
|
||||
Core::ArgsParser parser;
|
||||
String filename1;
|
||||
String filename2;
|
||||
DeprecatedString filename1;
|
||||
DeprecatedString filename2;
|
||||
|
||||
parser.add_positional_argument(filename1, "First file to compare", "file1", Core::ArgsParser::Required::Yes);
|
||||
parser.add_positional_argument(filename2, "Second file to compare", "file2", Core::ArgsParser::Required::Yes);
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
String path = {};
|
||||
DeprecatedString path = {};
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_positional_argument(path, "Path", "path");
|
||||
args_parser.parse(arguments);
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
*/
|
||||
|
||||
#include <AK/ByteBuffer.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/ScopeGuard.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/Types.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
|
@ -39,11 +39,11 @@ static Result average_result(Vector<Result> const& results)
|
|||
return average;
|
||||
}
|
||||
|
||||
static ErrorOr<Result> benchmark(String const& filename, int file_size, ByteBuffer& buffer, bool allow_cache);
|
||||
static ErrorOr<Result> benchmark(DeprecatedString const& filename, int file_size, ByteBuffer& buffer, bool allow_cache);
|
||||
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
String directory = ".";
|
||||
DeprecatedString directory = ".";
|
||||
int time_per_benchmark = 10;
|
||||
Vector<size_t> file_sizes;
|
||||
Vector<size_t> block_sizes;
|
||||
|
@ -66,7 +66,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
umask(0644);
|
||||
|
||||
auto filename = String::formatted("{}/disk_benchmark.tmp", directory);
|
||||
auto filename = DeprecatedString::formatted("{}/disk_benchmark.tmp", directory);
|
||||
|
||||
for (auto file_size : file_sizes) {
|
||||
for (auto block_size : block_sizes) {
|
||||
|
@ -99,7 +99,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
return 0;
|
||||
}
|
||||
|
||||
ErrorOr<Result> benchmark(String const& filename, int file_size, ByteBuffer& buffer, bool allow_cache)
|
||||
ErrorOr<Result> benchmark(DeprecatedString const& filename, int file_size, ByteBuffer& buffer, bool allow_cache)
|
||||
{
|
||||
int flags = O_CREAT | O_TRUNC | O_RDWR;
|
||||
if (!allow_cache)
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/LexicalPath.h>
|
||||
#include <AK/NumberFormat.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/DateTime.h>
|
||||
|
@ -30,17 +30,17 @@ struct DuOption {
|
|||
bool apparent_size = false;
|
||||
i64 threshold = 0;
|
||||
TimeType time_type = TimeType::NotUsed;
|
||||
Vector<String> excluded_patterns;
|
||||
Vector<DeprecatedString> excluded_patterns;
|
||||
u64 block_size = 1024;
|
||||
size_t max_depth = SIZE_MAX;
|
||||
};
|
||||
|
||||
static ErrorOr<void> parse_args(Main::Arguments arguments, Vector<String>& files, DuOption& du_option);
|
||||
static ErrorOr<u64> print_space_usage(String const& path, DuOption const& du_option, size_t current_depth, bool inside_dir = false);
|
||||
static ErrorOr<void> parse_args(Main::Arguments arguments, Vector<DeprecatedString>& files, DuOption& du_option);
|
||||
static ErrorOr<u64> print_space_usage(DeprecatedString const& path, DuOption const& du_option, size_t current_depth, bool inside_dir = false);
|
||||
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
Vector<String> files;
|
||||
Vector<DeprecatedString> files;
|
||||
DuOption du_option;
|
||||
|
||||
TRY(parse_args(arguments, files, du_option));
|
||||
|
@ -51,7 +51,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
return 0;
|
||||
}
|
||||
|
||||
ErrorOr<void> parse_args(Main::Arguments arguments, Vector<String>& files, DuOption& du_option)
|
||||
ErrorOr<void> parse_args(Main::Arguments arguments, Vector<DeprecatedString>& files, DuOption& du_option)
|
||||
{
|
||||
bool summarize = false;
|
||||
StringView pattern;
|
||||
|
@ -117,7 +117,7 @@ ErrorOr<void> parse_args(Main::Arguments arguments, Vector<String>& files, DuOpt
|
|||
auto file = TRY(Core::Stream::File::open(exclude_from, Core::Stream::OpenMode::Read));
|
||||
auto const buff = TRY(file->read_all());
|
||||
if (!buff.is_empty()) {
|
||||
String patterns = String::copy(buff, Chomp);
|
||||
DeprecatedString patterns = DeprecatedString::copy(buff, Chomp);
|
||||
du_option.excluded_patterns.extend(patterns.split('\n'));
|
||||
}
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ ErrorOr<void> parse_args(Main::Arguments arguments, Vector<String>& files, DuOpt
|
|||
return {};
|
||||
}
|
||||
|
||||
ErrorOr<u64> print_space_usage(String const& path, DuOption const& du_option, size_t current_depth, bool inside_dir)
|
||||
ErrorOr<u64> print_space_usage(DeprecatedString const& path, DuOption const& du_option, size_t current_depth, bool inside_dir)
|
||||
{
|
||||
u64 size = 0;
|
||||
struct stat path_stat = TRY(Core::System::lstat(path));
|
||||
|
|
|
@ -39,7 +39,7 @@ static Optional<u8> parse_hex_number(GenericLexer& lexer)
|
|||
return value;
|
||||
}
|
||||
|
||||
static String interpret_backslash_escapes(StringView string, bool& no_trailing_newline)
|
||||
static DeprecatedString interpret_backslash_escapes(StringView string, bool& no_trailing_newline)
|
||||
{
|
||||
static constexpr auto escape_map = "a\ab\be\ef\fn\nr\rt\tv\v"sv;
|
||||
static constexpr auto unescaped_chars = "\a\b\e\f\n\r\t\v\\"sv;
|
||||
|
@ -101,7 +101,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio"));
|
||||
|
||||
Vector<String> text;
|
||||
Vector<DeprecatedString> text;
|
||||
bool no_trailing_newline = false;
|
||||
bool should_interpret_backslash_escapes = false;
|
||||
|
||||
|
@ -118,7 +118,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
return 0;
|
||||
}
|
||||
|
||||
auto output = String::join(' ', text);
|
||||
auto output = DeprecatedString::join(' ', text);
|
||||
if (should_interpret_backslash_escapes)
|
||||
output = interpret_backslash_escapes(output, no_trailing_newline);
|
||||
out("{}", output);
|
||||
|
|
|
@ -17,7 +17,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
bool ignore_env = false;
|
||||
StringView split_string {};
|
||||
Vector<String> values;
|
||||
Vector<DeprecatedString> values;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.set_stop_on_first_non_option(true);
|
||||
|
|
|
@ -32,7 +32,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
if (search) {
|
||||
for (int i = 0; i < sys_nerr; i++) {
|
||||
auto error = String::formatted("{}", strerror(i));
|
||||
auto error = DeprecatedString::formatted("{}", strerror(i));
|
||||
if (error.contains(keyword, CaseSensitivity::CaseInsensitive)) {
|
||||
outln("{} {}", i, error);
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
return 1;
|
||||
}
|
||||
|
||||
auto error = String::formatted("{}", strerror(maybe_errno.value()));
|
||||
auto error = DeprecatedString::formatted("{}", strerror(maybe_errno.value()));
|
||||
if (error == "Unknown error"sv) {
|
||||
warnln("ERROR: Unknown errno: {}", keyword);
|
||||
return 1;
|
||||
|
|
|
@ -5,11 +5,11 @@
|
|||
*/
|
||||
|
||||
#include <AK/Assertions.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/GenericLexer.h>
|
||||
#include <AK/NonnullOwnPtr.h>
|
||||
#include <AK/OwnPtr.h>
|
||||
#include <AK/Queue.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/StringView.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibMain/Main.h>
|
||||
|
@ -56,7 +56,7 @@ public:
|
|||
|
||||
virtual bool truth() const = 0;
|
||||
virtual int integer() const = 0;
|
||||
virtual String string() const = 0;
|
||||
virtual DeprecatedString string() const = 0;
|
||||
virtual Type type() const = 0;
|
||||
virtual ~Expression() = default;
|
||||
};
|
||||
|
@ -69,7 +69,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
ValueExpression(String&& v)
|
||||
ValueExpression(DeprecatedString&& v)
|
||||
: as_string(move(v))
|
||||
, m_type(Type::String)
|
||||
{
|
||||
|
@ -96,11 +96,11 @@ private:
|
|||
}
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
virtual String string() const override
|
||||
virtual DeprecatedString string() const override
|
||||
{
|
||||
switch (m_type) {
|
||||
case Type::Integer:
|
||||
return String::formatted("{}", as_integer);
|
||||
return DeprecatedString::formatted("{}", as_integer);
|
||||
case Type::String:
|
||||
return as_string;
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ private:
|
|||
|
||||
union {
|
||||
int as_integer;
|
||||
String as_string;
|
||||
DeprecatedString as_string;
|
||||
};
|
||||
Type m_type { Type::String };
|
||||
};
|
||||
|
@ -161,7 +161,7 @@ private:
|
|||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
virtual String string() const override
|
||||
virtual DeprecatedString string() const override
|
||||
{
|
||||
switch (m_op) {
|
||||
case BooleanOperator::And:
|
||||
|
@ -260,7 +260,7 @@ private:
|
|||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
virtual int integer() const override { return truth(); }
|
||||
virtual String string() const override { return truth() ? "1" : "0"; }
|
||||
virtual DeprecatedString string() const override { return truth() ? "1" : "0"; }
|
||||
virtual Type type() const override { return Type::Integer; }
|
||||
|
||||
ComparisonOperation m_op { ComparisonOperation::Less };
|
||||
|
@ -330,9 +330,9 @@ private:
|
|||
}
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
virtual String string() const override
|
||||
virtual DeprecatedString string() const override
|
||||
{
|
||||
return String::formatted("{}", integer());
|
||||
return DeprecatedString::formatted("{}", integer());
|
||||
}
|
||||
virtual Type type() const override
|
||||
{
|
||||
|
@ -388,7 +388,7 @@ private:
|
|||
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
static auto safe_substring(String const& str, int start, int length)
|
||||
static auto safe_substring(DeprecatedString const& str, int start, int length)
|
||||
{
|
||||
if (start < 1 || (size_t)start > str.length())
|
||||
fail("Index out of range");
|
||||
|
@ -397,7 +397,7 @@ private:
|
|||
fail("Index out of range");
|
||||
return str.substring(start, length);
|
||||
}
|
||||
virtual String string() const override
|
||||
virtual DeprecatedString string() const override
|
||||
{
|
||||
if (m_op == StringOperation::Substring)
|
||||
return safe_substring(m_str->string(), m_pos_or_chars->integer(), m_length->integer());
|
||||
|
@ -412,7 +412,7 @@ private:
|
|||
for (auto& m : match.matches)
|
||||
count += m.view.length();
|
||||
|
||||
return String::number(count);
|
||||
return DeprecatedString::number(count);
|
||||
} else {
|
||||
if (!match.success)
|
||||
return "";
|
||||
|
@ -425,7 +425,7 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
return String::number(integer());
|
||||
return DeprecatedString::number(integer());
|
||||
}
|
||||
virtual Type type() const override
|
||||
{
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/String.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/MappedFile.h>
|
||||
#include <LibCore/System.h>
|
||||
|
@ -15,7 +15,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio rpath"));
|
||||
|
||||
String filename;
|
||||
DeprecatedString filename;
|
||||
|
||||
Core::ArgsParser args;
|
||||
args.add_positional_argument(filename, "File to process", "file", Core::ArgsParser::Required::Yes);
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include "AK/String.h"
|
||||
#include "AK/DeprecatedString.h"
|
||||
#include <AK/Assertions.h>
|
||||
#include <AK/Format.h>
|
||||
#include <LibCore/System.h>
|
||||
|
|
|
@ -20,13 +20,13 @@
|
|||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static Optional<String> description_only(String description, [[maybe_unused]] String const& path)
|
||||
static Optional<DeprecatedString> description_only(DeprecatedString description, [[maybe_unused]] DeprecatedString const& path)
|
||||
{
|
||||
return description;
|
||||
}
|
||||
|
||||
// FIXME: Ideally Gfx::ImageDecoder could tell us the image type directly.
|
||||
static Optional<String> image_details(String const& description, String const& path)
|
||||
static Optional<DeprecatedString> image_details(DeprecatedString const& description, DeprecatedString const& path)
|
||||
{
|
||||
auto file_or_error = Core::MappedFile::map(path);
|
||||
if (file_or_error.is_error())
|
||||
|
@ -37,10 +37,10 @@ static Optional<String> image_details(String const& description, String const& p
|
|||
if (!image_decoder)
|
||||
return {};
|
||||
|
||||
return String::formatted("{}, {} x {}", description, image_decoder->width(), image_decoder->height());
|
||||
return DeprecatedString::formatted("{}, {} x {}", description, image_decoder->width(), image_decoder->height());
|
||||
}
|
||||
|
||||
static Optional<String> gzip_details(String description, String const& path)
|
||||
static Optional<DeprecatedString> gzip_details(DeprecatedString description, DeprecatedString const& path)
|
||||
{
|
||||
auto file_or_error = Core::MappedFile::map(path);
|
||||
if (file_or_error.is_error())
|
||||
|
@ -54,10 +54,10 @@ static Optional<String> gzip_details(String description, String const& path)
|
|||
if (!gzip_details.has_value())
|
||||
return {};
|
||||
|
||||
return String::formatted("{}, {}", description, gzip_details.value());
|
||||
return DeprecatedString::formatted("{}, {}", description, gzip_details.value());
|
||||
}
|
||||
|
||||
static Optional<String> elf_details(String description, String const& path)
|
||||
static Optional<DeprecatedString> elf_details(DeprecatedString description, DeprecatedString const& path)
|
||||
{
|
||||
auto file_or_error = Core::MappedFile::map(path);
|
||||
if (file_or_error.is_error())
|
||||
|
@ -80,9 +80,9 @@ static Optional<String> elf_details(String description, String const& path)
|
|||
auto byteorder = header.e_ident[EI_DATA] == ELFDATA2LSB ? "LSB" : "MSB";
|
||||
|
||||
bool is_dynamically_linked = !interpreter_path.is_empty();
|
||||
String dynamic_section = String::formatted(", dynamically linked, interpreter {}", interpreter_path);
|
||||
DeprecatedString dynamic_section = DeprecatedString::formatted(", dynamically linked, interpreter {}", interpreter_path);
|
||||
|
||||
return String::formatted("{} {}-bit {} {}, {}, version {} ({}){}",
|
||||
return DeprecatedString::formatted("{} {}-bit {} {}, {}, version {} ({}){}",
|
||||
description,
|
||||
bitness,
|
||||
byteorder,
|
||||
|
@ -130,11 +130,11 @@ static Optional<String> elf_details(String description, String const& path)
|
|||
__ENUMERATE_MIME_TYPE_DESCRIPTION("text/markdown", "Markdown document", description_only) \
|
||||
__ENUMERATE_MIME_TYPE_DESCRIPTION("text/x-shellscript", "POSIX shell script text executable", description_only)
|
||||
|
||||
static Optional<String> get_description_from_mime_type(String const& mime, String const& path)
|
||||
static Optional<DeprecatedString> get_description_from_mime_type(DeprecatedString const& mime, DeprecatedString const& path)
|
||||
{
|
||||
#define __ENUMERATE_MIME_TYPE_DESCRIPTION(mime_type, description, details) \
|
||||
if (String(mime_type) == mime) \
|
||||
return details(String(description), path);
|
||||
if (DeprecatedString(mime_type) == mime) \
|
||||
return details(DeprecatedString(description), path);
|
||||
ENUMERATE_MIME_TYPE_DESCRIPTIONS;
|
||||
#undef __ENUMERATE_MIME_TYPE_DESCRIPTION
|
||||
return {};
|
||||
|
@ -144,7 +144,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio rpath"));
|
||||
|
||||
Vector<String> paths;
|
||||
Vector<DeprecatedString> paths;
|
||||
bool flag_mime_only = false;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
|
@ -177,7 +177,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
auto bytes = TRY(file->read(buffer));
|
||||
auto file_name_guess = Core::guess_mime_type_based_on_filename(path);
|
||||
auto mime_type = Core::guess_mime_type_based_on_sniffed_bytes(bytes).value_or(file_name_guess);
|
||||
auto human_readable_description = get_description_from_mime_type(mime_type, String(path)).value_or(mime_type);
|
||||
auto human_readable_description = get_description_from_mime_type(mime_type, DeprecatedString(path)).value_or(mime_type);
|
||||
outln("{}: {}", path, flag_mime_only ? mime_type : human_readable_description);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -580,8 +580,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
paths.append(LexicalPath("."));
|
||||
|
||||
for (auto& path : paths) {
|
||||
String dirname = path.dirname();
|
||||
String basename = path.basename();
|
||||
DeprecatedString dirname = path.dirname();
|
||||
DeprecatedString basename = path.basename();
|
||||
|
||||
int dirfd = TRY(Core::System::open(dirname, O_RDONLY | O_DIRECTORY | O_CLOEXEC));
|
||||
|
||||
|
|
|
@ -41,20 +41,20 @@ public:
|
|||
return q;
|
||||
}
|
||||
|
||||
String const& quote() const { return m_quote; }
|
||||
String const& author() const { return m_author; }
|
||||
DeprecatedString const& quote() const { return m_quote; }
|
||||
DeprecatedString const& author() const { return m_author; }
|
||||
u64 const& utc_time() const { return m_utc_time; }
|
||||
String const& url() const { return m_url; }
|
||||
Optional<String> const& context() const { return m_context; }
|
||||
DeprecatedString const& url() const { return m_url; }
|
||||
Optional<DeprecatedString> const& context() const { return m_context; }
|
||||
|
||||
private:
|
||||
Quote() = default;
|
||||
|
||||
String m_quote;
|
||||
String m_author;
|
||||
DeprecatedString m_quote;
|
||||
DeprecatedString m_author;
|
||||
u64 m_utc_time;
|
||||
String m_url;
|
||||
Optional<String> m_context;
|
||||
DeprecatedString m_url;
|
||||
Optional<DeprecatedString> m_context;
|
||||
};
|
||||
|
||||
static Vector<Quote> parse_all(JsonArray const& array)
|
||||
|
|
|
@ -35,7 +35,7 @@ static void handle_sigint(int)
|
|||
g_debug_session = nullptr;
|
||||
}
|
||||
|
||||
static void print_function_call(String function_name, size_t depth)
|
||||
static void print_function_call(DeprecatedString function_name, size_t depth)
|
||||
{
|
||||
for (size_t i = 0; i < depth; ++i) {
|
||||
out(" ");
|
||||
|
|
|
@ -40,7 +40,7 @@ ErrorOr<int> serenity_main(Main::Arguments args)
|
|||
TRY(Core::System::pledge("stdio rpath wpath cpath"));
|
||||
|
||||
bool inplace = false;
|
||||
Vector<String> files;
|
||||
Vector<DeprecatedString> files;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.set_general_help("Format GML files.");
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
*/
|
||||
|
||||
#include <AK/Assertions.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/LexicalPath.h>
|
||||
#include <AK/ScopeGuard.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/DirIterator.h>
|
||||
|
@ -37,13 +37,13 @@ ErrorOr<int> serenity_main(Main::Arguments args)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio rpath"));
|
||||
|
||||
String program_name = AK::LexicalPath::basename(args.strings[0]);
|
||||
DeprecatedString program_name = AK::LexicalPath::basename(args.strings[0]);
|
||||
|
||||
Vector<String> files;
|
||||
Vector<DeprecatedString> files;
|
||||
|
||||
bool recursive = (program_name == "rgrep"sv);
|
||||
bool use_ere = (program_name == "egrep"sv);
|
||||
Vector<String> patterns;
|
||||
Vector<DeprecatedString> patterns;
|
||||
BinaryFileMode binary_mode { BinaryFileMode::Binary };
|
||||
bool case_insensitive = false;
|
||||
bool line_numbers = false;
|
||||
|
@ -232,7 +232,7 @@ ErrorOr<int> serenity_main(Main::Arguments args)
|
|||
return true;
|
||||
};
|
||||
|
||||
auto add_directory = [&handle_file, user_has_specified_files](String base, Optional<String> recursive, auto handle_directory) -> void {
|
||||
auto add_directory = [&handle_file, user_has_specified_files](DeprecatedString base, Optional<DeprecatedString> recursive, auto handle_directory) -> void {
|
||||
Core::DirIterator it(recursive.value_or(base), Core::DirIterator::Flags::SkipDots);
|
||||
while (it.has_next()) {
|
||||
auto path = it.next_full_path();
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include <unistd.h>
|
||||
|
||||
static bool use_color = false;
|
||||
static void print(StringView name, JsonValue const&, Vector<String>& trail);
|
||||
static void print(StringView name, JsonValue const&, Vector<DeprecatedString>& trail);
|
||||
|
||||
static StringView color_name = ""sv;
|
||||
static StringView color_index = ""sv;
|
||||
|
@ -58,12 +58,12 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
color_off = "\033[0m"sv;
|
||||
}
|
||||
|
||||
Vector<String> trail;
|
||||
Vector<DeprecatedString> trail;
|
||||
print("json"sv, json, trail);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void print(StringView name, JsonValue const& value, Vector<String>& trail)
|
||||
static void print(StringView name, JsonValue const& value, Vector<DeprecatedString>& trail)
|
||||
{
|
||||
for (size_t i = 0; i < trail.size(); ++i)
|
||||
out("{}", trail[i]);
|
||||
|
@ -72,16 +72,16 @@ static void print(StringView name, JsonValue const& value, Vector<String>& trail
|
|||
|
||||
if (value.is_object()) {
|
||||
outln("{}{{}}{};", color_brace, color_off);
|
||||
trail.append(String::formatted("{}{}{}.", color_name, name, color_off));
|
||||
trail.append(DeprecatedString::formatted("{}{}{}.", color_name, name, color_off));
|
||||
value.as_object().for_each_member([&](auto& on, auto& ov) { print(on, ov, trail); });
|
||||
trail.take_last();
|
||||
return;
|
||||
}
|
||||
if (value.is_array()) {
|
||||
outln("{}[]{};", color_brace, color_off);
|
||||
trail.append(String::formatted("{}{}{}", color_name, name, color_off));
|
||||
trail.append(DeprecatedString::formatted("{}{}{}", color_name, name, color_off));
|
||||
for (size_t i = 0; i < value.as_array().size(); ++i) {
|
||||
auto element_name = String::formatted("{}{}[{}{}{}{}{}]{}", color_off, color_brace, color_off, color_index, i, color_off, color_brace, color_off);
|
||||
auto element_name = DeprecatedString::formatted("{}{}[{}{}{}{}{}]{}", color_off, color_brace, color_off, color_index, i, color_off, color_brace, color_off);
|
||||
print(element_name, value.as_array()[i], trail);
|
||||
}
|
||||
trail.take_last();
|
||||
|
|
|
@ -35,7 +35,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
TRY(Core::System::unveil(nullptr, nullptr));
|
||||
TRY(Core::System::pledge("stdio rpath"));
|
||||
|
||||
Vector<String> usernames;
|
||||
Vector<DeprecatedString> usernames;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.set_general_help("Print group memberships for each username or, if no username is specified, for the current process.");
|
||||
|
|
|
@ -42,13 +42,13 @@ ErrorOr<int> serenity_main(Main::Arguments args)
|
|||
|
||||
for (auto filename : filenames) {
|
||||
|
||||
String input_filename;
|
||||
String output_filename;
|
||||
DeprecatedString input_filename;
|
||||
DeprecatedString output_filename;
|
||||
if (filename.ends_with(".gz"sv)) {
|
||||
input_filename = filename;
|
||||
output_filename = filename.substring_view(0, filename.length() - 3);
|
||||
} else {
|
||||
input_filename = String::formatted("{}.gz", filename);
|
||||
input_filename = DeprecatedString::formatted("{}.gz", filename);
|
||||
output_filename = filename;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
keep_input_files = true;
|
||||
|
||||
for (auto const& input_filename : filenames) {
|
||||
String output_filename;
|
||||
DeprecatedString output_filename;
|
||||
if (decompress) {
|
||||
if (!input_filename.ends_with(".gz"sv)) {
|
||||
warnln("unknown suffix for: {}, skipping", input_filename);
|
||||
|
@ -38,7 +38,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
}
|
||||
output_filename = input_filename.substring_view(0, input_filename.length() - ".gz"sv.length());
|
||||
} else {
|
||||
output_filename = String::formatted("{}.gz", input_filename);
|
||||
output_filename = DeprecatedString::formatted("{}.gz", input_filename);
|
||||
}
|
||||
|
||||
// We map the whole file instead of streaming to reduce size overhead (gzip header) and increase the deflate block size (better compression)
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int head(String const& filename, bool print_filename, ssize_t line_count, ssize_t byte_count);
|
||||
int head(DeprecatedString const& filename, bool print_filename, ssize_t line_count, ssize_t byte_count);
|
||||
|
||||
ErrorOr<int> serenity_main(Main::Arguments args)
|
||||
{
|
||||
|
@ -24,7 +24,7 @@ ErrorOr<int> serenity_main(Main::Arguments args)
|
|||
int byte_count = -1;
|
||||
bool never_print_filenames = false;
|
||||
bool always_print_filenames = false;
|
||||
Vector<String> files;
|
||||
Vector<DeprecatedString> files;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.set_general_help("Print the beginning ('head') of a file.");
|
||||
|
@ -60,7 +60,7 @@ ErrorOr<int> serenity_main(Main::Arguments args)
|
|||
return rc;
|
||||
}
|
||||
|
||||
int head(String const& filename, bool print_filename, ssize_t line_count, ssize_t byte_count)
|
||||
int head(DeprecatedString const& filename, bool print_filename, ssize_t line_count, ssize_t byte_count)
|
||||
{
|
||||
bool is_stdin = false;
|
||||
int fd = -1;
|
||||
|
|
|
@ -151,7 +151,7 @@ public:
|
|||
return m_preferred_color_scheme;
|
||||
}
|
||||
|
||||
virtual void page_did_change_title(String const&) override
|
||||
virtual void page_did_change_title(DeprecatedString const&) override
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -175,23 +175,23 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual void page_did_request_link_context_menu(Gfx::IntPoint const&, AK::URL const&, String const&, unsigned) override
|
||||
virtual void page_did_request_link_context_menu(Gfx::IntPoint const&, AK::URL const&, DeprecatedString const&, unsigned) override
|
||||
{
|
||||
}
|
||||
|
||||
virtual void page_did_request_image_context_menu(Gfx::IntPoint const&, AK::URL const&, String const&, unsigned, Gfx::Bitmap const*) override
|
||||
virtual void page_did_request_image_context_menu(Gfx::IntPoint const&, AK::URL const&, DeprecatedString const&, unsigned, Gfx::Bitmap const*) override
|
||||
{
|
||||
}
|
||||
|
||||
virtual void page_did_click_link(AK::URL const&, String const&, unsigned) override
|
||||
virtual void page_did_click_link(AK::URL const&, DeprecatedString const&, unsigned) override
|
||||
{
|
||||
}
|
||||
|
||||
virtual void page_did_middle_click_link(AK::URL const&, String const&, unsigned) override
|
||||
virtual void page_did_middle_click_link(AK::URL const&, DeprecatedString const&, unsigned) override
|
||||
{
|
||||
}
|
||||
|
||||
virtual void page_did_enter_tooltip_area(Gfx::IntPoint const&, String const&) override
|
||||
virtual void page_did_enter_tooltip_area(Gfx::IntPoint const&, DeprecatedString const&) override
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -223,21 +223,21 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual void page_did_request_alert(String const&) override
|
||||
virtual void page_did_request_alert(DeprecatedString const&) override
|
||||
{
|
||||
}
|
||||
|
||||
virtual void page_did_request_confirm(String const&) override
|
||||
virtual void page_did_request_confirm(DeprecatedString const&) override
|
||||
{
|
||||
}
|
||||
|
||||
virtual void page_did_request_prompt(String const&, String const&) override
|
||||
virtual void page_did_request_prompt(DeprecatedString const&, DeprecatedString const&) override
|
||||
{
|
||||
}
|
||||
|
||||
virtual String page_did_request_cookie(AK::URL const&, Web::Cookie::Source) override
|
||||
virtual DeprecatedString page_did_request_cookie(AK::URL const&, Web::Cookie::Source) override
|
||||
{
|
||||
return String::empty();
|
||||
return DeprecatedString::empty();
|
||||
}
|
||||
|
||||
virtual void page_did_set_cookie(AK::URL const&, Web::Cookie::ParsedCookie const&, Web::Cookie::Source) override
|
||||
|
@ -307,7 +307,7 @@ public:
|
|||
: public Web::ResourceLoaderConnectorRequest
|
||||
, public Weakable<HTTPHeadlessRequest> {
|
||||
public:
|
||||
static ErrorOr<NonnullRefPtr<HTTPHeadlessRequest>> create(String const& method, AK::URL const& url, HashMap<String, String> const& request_headers, ReadonlyBytes request_body, Core::ProxyData const&)
|
||||
static ErrorOr<NonnullRefPtr<HTTPHeadlessRequest>> create(DeprecatedString const& method, AK::URL const& url, HashMap<DeprecatedString, DeprecatedString> const& request_headers, ReadonlyBytes request_body, Core::ProxyData const&)
|
||||
{
|
||||
auto stream_backing_buffer = TRY(ByteBuffer::create_uninitialized(1 * MiB));
|
||||
auto underlying_socket = TRY(Core::Stream::TCPSocket::connect(url.host(), url.port().value_or(80)));
|
||||
|
@ -379,14 +379,14 @@ public:
|
|||
NonnullOwnPtr<Core::Stream::MemoryStream> m_output_stream;
|
||||
NonnullOwnPtr<Core::Stream::BufferedSocketBase> m_socket;
|
||||
NonnullRefPtr<HTTP::Job> m_job;
|
||||
HashMap<String, String, CaseInsensitiveStringTraits> m_response_headers;
|
||||
HashMap<DeprecatedString, DeprecatedString, CaseInsensitiveStringTraits> m_response_headers;
|
||||
};
|
||||
|
||||
class HTTPSHeadlessRequest
|
||||
: public Web::ResourceLoaderConnectorRequest
|
||||
, public Weakable<HTTPSHeadlessRequest> {
|
||||
public:
|
||||
static ErrorOr<NonnullRefPtr<HTTPSHeadlessRequest>> create(String const& method, AK::URL const& url, HashMap<String, String> const& request_headers, ReadonlyBytes request_body, Core::ProxyData const&)
|
||||
static ErrorOr<NonnullRefPtr<HTTPSHeadlessRequest>> create(DeprecatedString const& method, AK::URL const& url, HashMap<DeprecatedString, DeprecatedString> const& request_headers, ReadonlyBytes request_body, Core::ProxyData const&)
|
||||
{
|
||||
auto stream_backing_buffer = TRY(ByteBuffer::create_uninitialized(1 * MiB));
|
||||
auto underlying_socket = TRY(TLS::TLSv12::connect(url.host(), url.port().value_or(443)));
|
||||
|
@ -458,14 +458,14 @@ public:
|
|||
NonnullOwnPtr<Core::Stream::MemoryStream> m_output_stream;
|
||||
NonnullOwnPtr<Core::Stream::BufferedSocketBase> m_socket;
|
||||
NonnullRefPtr<HTTP::HttpsJob> m_job;
|
||||
HashMap<String, String, CaseInsensitiveStringTraits> m_response_headers;
|
||||
HashMap<DeprecatedString, DeprecatedString, CaseInsensitiveStringTraits> m_response_headers;
|
||||
};
|
||||
|
||||
class GeminiHeadlessRequest
|
||||
: public Web::ResourceLoaderConnectorRequest
|
||||
, public Weakable<GeminiHeadlessRequest> {
|
||||
public:
|
||||
static ErrorOr<NonnullRefPtr<GeminiHeadlessRequest>> create(String const&, AK::URL const& url, HashMap<String, String> const&, ReadonlyBytes, Core::ProxyData const&)
|
||||
static ErrorOr<NonnullRefPtr<GeminiHeadlessRequest>> create(DeprecatedString const&, AK::URL const& url, HashMap<DeprecatedString, DeprecatedString> const&, ReadonlyBytes, Core::ProxyData const&)
|
||||
{
|
||||
auto stream_backing_buffer = TRY(ByteBuffer::create_uninitialized(1 * MiB));
|
||||
auto underlying_socket = TRY(Core::Stream::TCPSocket::connect(url.host(), url.port().value_or(80)));
|
||||
|
@ -527,7 +527,7 @@ public:
|
|||
NonnullOwnPtr<Core::Stream::MemoryStream> m_output_stream;
|
||||
NonnullOwnPtr<Core::Stream::BufferedSocketBase> m_socket;
|
||||
NonnullRefPtr<Gemini::Job> m_job;
|
||||
HashMap<String, String, CaseInsensitiveStringTraits> m_response_headers;
|
||||
HashMap<DeprecatedString, DeprecatedString, CaseInsensitiveStringTraits> m_response_headers;
|
||||
};
|
||||
|
||||
static NonnullRefPtr<HeadlessRequestServer> create()
|
||||
|
@ -540,7 +540,7 @@ public:
|
|||
virtual void prefetch_dns(AK::URL const&) override { }
|
||||
virtual void preconnect(AK::URL const&) override { }
|
||||
|
||||
virtual RefPtr<Web::ResourceLoaderConnectorRequest> start_request(String const& method, AK::URL const& url, HashMap<String, String> const& request_headers, ReadonlyBytes request_body, Core::ProxyData const& proxy) override
|
||||
virtual RefPtr<Web::ResourceLoaderConnectorRequest> start_request(DeprecatedString const& method, AK::URL const& url, HashMap<DeprecatedString, DeprecatedString> const& request_headers, ReadonlyBytes request_body, Core::ProxyData const& proxy) override
|
||||
{
|
||||
RefPtr<Web::ResourceLoaderConnectorRequest> request;
|
||||
if (url.scheme().equals_ignoring_case("http"sv)) {
|
||||
|
@ -610,7 +610,7 @@ public:
|
|||
m_websocket->send(WebSocket::Message(message));
|
||||
}
|
||||
|
||||
virtual void close(u16 code, String reason) override
|
||||
virtual void close(u16 code, DeprecatedString reason) override
|
||||
{
|
||||
m_websocket->close(code, reason);
|
||||
}
|
||||
|
@ -652,7 +652,7 @@ public:
|
|||
}
|
||||
}
|
||||
};
|
||||
m_websocket->on_close = [weak_this = make_weak_ptr()](u16 code, String reason, bool was_clean) {
|
||||
m_websocket->on_close = [weak_this = make_weak_ptr()](u16 code, DeprecatedString reason, bool was_clean) {
|
||||
if (auto strong_this = weak_this.strong_ref())
|
||||
if (strong_this->on_close)
|
||||
strong_this->on_close(code, move(reason), was_clean);
|
||||
|
@ -669,7 +669,7 @@ public:
|
|||
|
||||
virtual ~HeadlessWebSocketClientManager() override { }
|
||||
|
||||
virtual RefPtr<Web::WebSockets::WebSocketClientSocket> connect(AK::URL const& url, String const& origin) override
|
||||
virtual RefPtr<Web::WebSockets::WebSocketClientSocket> connect(AK::URL const& url, DeprecatedString const& origin) override
|
||||
{
|
||||
WebSocket::ConnectionInfo connection_info(url);
|
||||
connection_info.set_origin(origin);
|
||||
|
@ -690,7 +690,7 @@ static void load_page_for_screenshot_and_exit(HeadlessBrowserPageClient& page_cl
|
|||
take_screenshot_after * 1000,
|
||||
[&]() {
|
||||
// FIXME: Allow passing the output path as argument
|
||||
String output_file_path = "output.png";
|
||||
DeprecatedString output_file_path = "output.png";
|
||||
dbgln("Saving to {}", output_file_path);
|
||||
|
||||
if (Core::File::exists(output_file_path))
|
||||
|
|
|
@ -17,7 +17,7 @@ ErrorOr<int> serenity_main(Main::Arguments args)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio unix"));
|
||||
|
||||
String name_or_ip {};
|
||||
DeprecatedString name_or_ip {};
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.set_general_help("Convert between domain name and IPv4 address.");
|
||||
args_parser.add_positional_argument(name_or_ip, "Domain name or IPv4 address", "name");
|
||||
|
|
|
@ -21,7 +21,7 @@ static bool flag_print_uid = false;
|
|||
static bool flag_print_gid = false;
|
||||
static bool flag_print_name = false;
|
||||
static bool flag_print_gid_all = false;
|
||||
static String user_str;
|
||||
static DeprecatedString user_str;
|
||||
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
|
|
|
@ -66,7 +66,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
return 1;
|
||||
}
|
||||
|
||||
String ifname = value_adapter;
|
||||
DeprecatedString ifname = value_adapter;
|
||||
|
||||
if (!value_ipv4.is_empty()) {
|
||||
auto address = IPv4Address::from_string(value_ipv4);
|
||||
|
|
|
@ -15,9 +15,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
TRY(Core::System::pledge("stdio rpath wpath cpath"));
|
||||
|
||||
StringView path;
|
||||
String group;
|
||||
String key;
|
||||
String value_to_write;
|
||||
DeprecatedString group;
|
||||
DeprecatedString key;
|
||||
DeprecatedString value_to_write;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_positional_argument(path, "Path to INI file", "path");
|
||||
|
|
|
@ -32,15 +32,15 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
auto permission_mask = TRY(Core::FilePermissionsMask::parse(mode));
|
||||
|
||||
String destination_dir = (sources.size() > 1 ? String { destination } : LexicalPath::dirname(destination));
|
||||
DeprecatedString destination_dir = (sources.size() > 1 ? DeprecatedString { destination } : LexicalPath::dirname(destination));
|
||||
|
||||
if (create_leading_dest_components) {
|
||||
String destination_dir_absolute = Core::File::absolute_path(destination_dir);
|
||||
DeprecatedString destination_dir_absolute = Core::File::absolute_path(destination_dir);
|
||||
MUST(Core::Directory::create(destination_dir_absolute, Core::Directory::CreateDirectories::Yes));
|
||||
}
|
||||
|
||||
for (auto const& source : sources) {
|
||||
String final_destination;
|
||||
DeprecatedString final_destination;
|
||||
if (sources.size() > 1) {
|
||||
final_destination = LexicalPath(destination).append(LexicalPath::basename(source)).string();
|
||||
} else {
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include <unistd.h>
|
||||
|
||||
RefPtr<JS::VM> g_vm;
|
||||
Vector<String> g_repl_statements;
|
||||
Vector<DeprecatedString> g_repl_statements;
|
||||
JS::Handle<JS::Value> g_last_value = JS::make_handle(JS::js_undefined());
|
||||
|
||||
class ReplObject final : public JS::GlobalObject {
|
||||
|
@ -80,7 +80,7 @@ static bool s_print_last_result = false;
|
|||
static bool s_strip_ansi = false;
|
||||
static bool s_disable_source_location_hints = false;
|
||||
static RefPtr<Line::Editor> s_editor;
|
||||
static String s_history_path = String::formatted("{}/.js-history", Core::StandardPaths::home_directory());
|
||||
static DeprecatedString s_history_path = DeprecatedString::formatted("{}/.js-history", Core::StandardPaths::home_directory());
|
||||
static int s_repl_line_level = 0;
|
||||
static bool s_fail_repl = false;
|
||||
|
||||
|
@ -101,7 +101,7 @@ static ErrorOr<void> print(JS::Value value, PrintTarget target = PrintTarget::St
|
|||
return print(value, *stream);
|
||||
}
|
||||
|
||||
static String prompt_for_level(int level)
|
||||
static DeprecatedString prompt_for_level(int level)
|
||||
{
|
||||
static StringBuilder prompt_builder;
|
||||
prompt_builder.clear();
|
||||
|
@ -113,7 +113,7 @@ static String prompt_for_level(int level)
|
|||
return prompt_builder.build();
|
||||
}
|
||||
|
||||
static String read_next_piece()
|
||||
static DeprecatedString read_next_piece()
|
||||
{
|
||||
StringBuilder piece;
|
||||
|
||||
|
@ -185,7 +185,7 @@ static String read_next_piece()
|
|||
return piece.to_string();
|
||||
}
|
||||
|
||||
static bool write_to_file(String const& path)
|
||||
static bool write_to_file(DeprecatedString const& path)
|
||||
{
|
||||
int fd = open(path.characters(), O_WRONLY | O_CREAT | O_TRUNC, 0666);
|
||||
for (size_t i = 0; i < g_repl_statements.size(); i++) {
|
||||
|
@ -348,7 +348,7 @@ static JS::ThrowCompletionOr<JS::Value> load_ini_impl(JS::VM& vm)
|
|||
auto filename = TRY(vm.argument(0).to_string(vm));
|
||||
auto file_or_error = Core::Stream::File::open(filename, Core::Stream::OpenMode::Read);
|
||||
if (file_or_error.is_error())
|
||||
return vm.throw_completion<JS::Error>(String::formatted("Failed to open '{}': {}", filename, file_or_error.error()));
|
||||
return vm.throw_completion<JS::Error>(DeprecatedString::formatted("Failed to open '{}': {}", filename, file_or_error.error()));
|
||||
|
||||
auto config_file = MUST(Core::ConfigFile::open(filename, file_or_error.release_value()));
|
||||
auto* object = JS::Object::create(realm, realm.intrinsics().object_prototype());
|
||||
|
@ -368,11 +368,11 @@ static JS::ThrowCompletionOr<JS::Value> load_json_impl(JS::VM& vm)
|
|||
auto filename = TRY(vm.argument(0).to_string(vm));
|
||||
auto file_or_error = Core::Stream::File::open(filename, Core::Stream::OpenMode::Read);
|
||||
if (file_or_error.is_error())
|
||||
return vm.throw_completion<JS::Error>(String::formatted("Failed to open '{}': {}", filename, file_or_error.error()));
|
||||
return vm.throw_completion<JS::Error>(DeprecatedString::formatted("Failed to open '{}': {}", filename, file_or_error.error()));
|
||||
|
||||
auto file_contents_or_error = file_or_error.value()->read_all();
|
||||
if (file_contents_or_error.is_error())
|
||||
return vm.throw_completion<JS::Error>(String::formatted("Failed to read '{}': {}", filename, file_contents_or_error.error()));
|
||||
return vm.throw_completion<JS::Error>(DeprecatedString::formatted("Failed to read '{}': {}", filename, file_contents_or_error.error()));
|
||||
|
||||
auto json = JsonValue::from_string(file_contents_or_error.value());
|
||||
if (json.is_error())
|
||||
|
@ -419,7 +419,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();
|
||||
DeprecatedString save_path = vm.argument(0).to_string_without_side_effects();
|
||||
if (write_to_file(save_path)) {
|
||||
return JS::Value(true);
|
||||
}
|
||||
|
@ -459,7 +459,7 @@ JS_DEFINE_NATIVE_FUNCTION(ReplObject::print)
|
|||
{
|
||||
auto result = ::print(vm.argument(0));
|
||||
if (result.is_error())
|
||||
return g_vm->throw_completion<JS::InternalError>(String::formatted("Failed to print value: {}", result.error()));
|
||||
return g_vm->throw_completion<JS::InternalError>(DeprecatedString::formatted("Failed to print value: {}", result.error()));
|
||||
|
||||
outln();
|
||||
|
||||
|
@ -491,7 +491,7 @@ JS_DEFINE_NATIVE_FUNCTION(ScriptObject::print)
|
|||
{
|
||||
auto result = ::print(vm.argument(0));
|
||||
if (result.is_error())
|
||||
return g_vm->throw_completion<JS::InternalError>(String::formatted("Failed to print value: {}", result.error()));
|
||||
return g_vm->throw_completion<JS::InternalError>(DeprecatedString::formatted("Failed to print value: {}", result.error()));
|
||||
|
||||
outln();
|
||||
|
||||
|
@ -501,7 +501,7 @@ JS_DEFINE_NATIVE_FUNCTION(ScriptObject::print)
|
|||
static ErrorOr<void> repl(JS::Interpreter& interpreter)
|
||||
{
|
||||
while (!s_fail_repl) {
|
||||
String piece = read_next_piece();
|
||||
DeprecatedString piece = read_next_piece();
|
||||
if (Utf8View { piece }.trim(JS::whitespace_characters).is_empty())
|
||||
continue;
|
||||
|
||||
|
@ -540,7 +540,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(" "sv, m_group_stack_depth);
|
||||
DeprecatedString indent = DeprecatedString::repeated(" "sv, m_group_stack_depth);
|
||||
|
||||
if (log_level == JS::Console::LogLevel::Trace) {
|
||||
auto trace = arguments.get<JS::Console::Trace>();
|
||||
|
@ -562,7 +562,7 @@ public:
|
|||
return JS::js_undefined();
|
||||
}
|
||||
|
||||
auto output = String::join(' ', arguments.get<JS::MarkedVector<JS::Value>>());
|
||||
auto output = DeprecatedString::join(' ', arguments.get<JS::MarkedVector<JS::Value>>());
|
||||
#ifdef AK_OS_SERENITY
|
||||
m_console.output_debug_message(log_level, output);
|
||||
#endif
|
||||
|
@ -807,7 +807,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
if (key.view().starts_with(property_pattern)) {
|
||||
Line::CompletionSuggestion completion { key, Line::CompletionSuggestion::ForSearch };
|
||||
if (!results.contains_slow(completion)) { // hide duplicates
|
||||
results.append(String(key));
|
||||
results.append(DeprecatedString(key));
|
||||
results.last().invariant_offset = property_pattern.length();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/String.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/ConfigFile.h>
|
||||
|
@ -13,9 +13,9 @@
|
|||
#include <LibMain/Main.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int set_keymap(String const& keymap);
|
||||
int set_keymap(DeprecatedString const& keymap);
|
||||
|
||||
int set_keymap(String const& keymap)
|
||||
int set_keymap(DeprecatedString const& keymap)
|
||||
{
|
||||
auto character_map = Keyboard::CharacterMap::load_from_file(keymap);
|
||||
if (character_map.is_error()) {
|
||||
|
@ -38,8 +38,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
TRY(Core::System::unveil("/res/keymaps", "r"));
|
||||
TRY(Core::System::unveil("/etc/Keyboard.ini", "rwc"));
|
||||
|
||||
String mapping;
|
||||
String mappings;
|
||||
DeprecatedString mapping;
|
||||
DeprecatedString mappings;
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_option(mapping, "The mapping to be used", "set-keymap", 'm', "keymap");
|
||||
args_parser.add_option(mappings, "Comma separated list of enabled mappings", "set-keymaps", 's', "keymaps");
|
||||
|
@ -72,7 +72,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
}
|
||||
}
|
||||
|
||||
auto keymaps = String::join(',', mappings_vector);
|
||||
auto keymaps = DeprecatedString::join(',', mappings_vector);
|
||||
mapper_config->write_entry("Mapping", "Keymaps", keymaps);
|
||||
TRY(mapper_config->sync());
|
||||
}
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/Optional.h>
|
||||
#include <AK/String.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibMain/Main.h>
|
||||
#include <ctype.h>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/String.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <LibCore/ProcessStatisticsReader.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibMain/Main.h>
|
||||
|
@ -19,7 +19,7 @@ static void print_usage_and_exit()
|
|||
exit(1);
|
||||
}
|
||||
|
||||
static ErrorOr<int> kill_all(String const& process_name, unsigned const signum)
|
||||
static ErrorOr<int> kill_all(DeprecatedString const& process_name, unsigned const signum)
|
||||
{
|
||||
auto all_processes = Core::ProcessStatisticsReader::get_all();
|
||||
if (!all_processes.has_value())
|
||||
|
@ -57,7 +57,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
}
|
||||
|
||||
if (!number.has_value())
|
||||
number = String(&arguments.argv[1][1]).to_uint();
|
||||
number = DeprecatedString(&arguments.argv[1][1]).to_uint();
|
||||
|
||||
if (!number.has_value()) {
|
||||
warnln("'{}' is not a valid signal name or number", &arguments.argv[1][1]);
|
||||
|
|
|
@ -50,7 +50,7 @@ static ErrorOr<void> teardown_tty(bool switch_buffer)
|
|||
return {};
|
||||
}
|
||||
|
||||
static Vector<StringView> wrap_line(String const& string, size_t width)
|
||||
static Vector<StringView> wrap_line(DeprecatedString const& string, size_t width)
|
||||
{
|
||||
auto const result = Line::Editor::actual_rendered_string_metrics(string, {}, width);
|
||||
|
||||
|
@ -265,7 +265,7 @@ public:
|
|||
if (line[size - 1] == '\n')
|
||||
--size;
|
||||
|
||||
m_lines.append(String(line, size));
|
||||
m_lines.append(DeprecatedString(line, size));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -437,7 +437,7 @@ private:
|
|||
}
|
||||
|
||||
// FIXME: Don't save scrollback when emulating more.
|
||||
Vector<String> m_lines;
|
||||
Vector<DeprecatedString> m_lines;
|
||||
|
||||
size_t m_line { 0 };
|
||||
size_t m_subline { 0 };
|
||||
|
@ -452,20 +452,20 @@ private:
|
|||
size_t m_width { 0 };
|
||||
size_t m_height { 0 };
|
||||
|
||||
String m_filename;
|
||||
String m_prompt;
|
||||
DeprecatedString m_filename;
|
||||
DeprecatedString m_prompt;
|
||||
};
|
||||
|
||||
/// Return the next key sequence, or nothing if a signal is received while waiting
|
||||
/// to read the next sequence.
|
||||
static Optional<String> get_key_sequence()
|
||||
static Optional<DeprecatedString> get_key_sequence()
|
||||
{
|
||||
// We need a buffer to handle ansi sequences.
|
||||
char buff[8];
|
||||
|
||||
ssize_t n = read(STDOUT_FILENO, buff, sizeof(buff));
|
||||
if (n > 0) {
|
||||
return String(buff, n);
|
||||
return DeprecatedString(buff, n);
|
||||
} else {
|
||||
return {};
|
||||
}
|
||||
|
@ -494,8 +494,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
TRY(Core::System::pledge("stdio rpath tty sigaction"));
|
||||
|
||||
// FIXME: Make these into StringViews once we stop using fopen below.
|
||||
String filename = "-";
|
||||
String prompt = "?f%f :.(line %l)?e (END):.";
|
||||
DeprecatedString filename = "-";
|
||||
DeprecatedString prompt = "?f%f :.(line %l)?e (END):.";
|
||||
bool dont_switch_buffer = false;
|
||||
bool quit_at_eof = false;
|
||||
bool emulate_more = false;
|
||||
|
@ -512,7 +512,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
args_parser.parse(arguments);
|
||||
|
||||
FILE* file;
|
||||
if (String("-") == filename) {
|
||||
if (DeprecatedString("-") == filename) {
|
||||
file = stdin;
|
||||
} else if ((file = fopen(filename.characters(), "r")) == nullptr) {
|
||||
perror("fopen");
|
||||
|
@ -545,7 +545,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
pager.init();
|
||||
|
||||
StringBuilder modifier_buffer = StringBuilder(10);
|
||||
for (Optional<String> sequence_value;; sequence_value = get_key_sequence()) {
|
||||
for (Optional<DeprecatedString> sequence_value;; sequence_value = get_key_sequence()) {
|
||||
if (g_resized) {
|
||||
g_resized = false;
|
||||
pager.resize();
|
||||
|
|
|
@ -24,7 +24,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
args_parser.add_positional_argument(path, "Link path", "path", Core::ArgsParser::Required::No);
|
||||
args_parser.parse(arguments);
|
||||
|
||||
String path_buffer;
|
||||
DeprecatedString path_buffer;
|
||||
if (path.is_empty()) {
|
||||
path_buffer = LexicalPath::basename(target);
|
||||
path = path_buffer.view();
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
*/
|
||||
|
||||
#include <AK/Assertions.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include <AK/NumberFormat.h>
|
||||
#include <AK/QuickSort.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <AK/URL.h>
|
||||
#include <AK/Utf8View.h>
|
||||
|
@ -36,8 +36,8 @@
|
|||
#include <unistd.h>
|
||||
|
||||
struct FileMetadata {
|
||||
String name;
|
||||
String path;
|
||||
DeprecatedString name;
|
||||
DeprecatedString path;
|
||||
struct stat stat {
|
||||
};
|
||||
};
|
||||
|
@ -70,8 +70,8 @@ static size_t terminal_rows = 0;
|
|||
static size_t terminal_columns = 0;
|
||||
static bool output_is_terminal = false;
|
||||
|
||||
static HashMap<uid_t, String> users;
|
||||
static HashMap<gid_t, String> groups;
|
||||
static HashMap<uid_t, DeprecatedString> users;
|
||||
static HashMap<gid_t, DeprecatedString> groups;
|
||||
|
||||
static bool is_a_tty = false;
|
||||
|
||||
|
@ -147,7 +147,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
FileMetadata metadata;
|
||||
metadata.name = path;
|
||||
|
||||
int rc = lstat(String(path).characters(), &metadata.stat);
|
||||
int rc = lstat(DeprecatedString(path).characters(), &metadata.stat);
|
||||
if (rc < 0) {
|
||||
perror("lstat");
|
||||
continue;
|
||||
|
@ -172,7 +172,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
}
|
||||
|
||||
while (di.has_next()) {
|
||||
String directory = di.next_full_path();
|
||||
DeprecatedString directory = di.next_full_path();
|
||||
if (Core::File::is_directory(directory) && !Core::File::is_link(directory)) {
|
||||
++subdirs;
|
||||
FileMetadata new_file;
|
||||
|
@ -219,9 +219,9 @@ static int print_escaped(StringView name)
|
|||
return printed;
|
||||
}
|
||||
|
||||
static String& hostname()
|
||||
static DeprecatedString& hostname()
|
||||
{
|
||||
static String s_hostname;
|
||||
static DeprecatedString s_hostname;
|
||||
if (s_hostname.is_null()) {
|
||||
char buffer[HOST_NAME_MAX];
|
||||
if (gethostname(buffer, sizeof(buffer)) == 0)
|
||||
|
@ -232,7 +232,7 @@ static String& hostname()
|
|||
return s_hostname;
|
||||
}
|
||||
|
||||
static size_t print_name(const struct stat& st, String const& name, char const* path_for_link_resolution, char const* path_for_hyperlink)
|
||||
static size_t print_name(const struct stat& st, DeprecatedString const& name, char const* path_for_link_resolution, char const* path_for_hyperlink)
|
||||
{
|
||||
if (!flag_disable_hyperlinks) {
|
||||
auto full_path = Core::File::real_path_for(path_for_hyperlink);
|
||||
|
@ -297,10 +297,10 @@ static size_t print_name(const struct stat& st, String const& name, char const*
|
|||
return nprinted;
|
||||
}
|
||||
|
||||
static bool print_filesystem_object(String const& path, String const& name, const struct stat& st)
|
||||
static bool print_filesystem_object(DeprecatedString const& path, DeprecatedString const& name, const struct stat& st)
|
||||
{
|
||||
if (flag_show_inode)
|
||||
printf("%s ", String::formatted("{}", st.st_ino).characters());
|
||||
printf("%s ", DeprecatedString::formatted("{}", st.st_ino).characters());
|
||||
|
||||
if (S_ISDIR(st.st_mode))
|
||||
printf("d");
|
||||
|
@ -447,7 +447,7 @@ static bool print_filesystem_object_short(char const* path, char const* name, si
|
|||
}
|
||||
|
||||
if (flag_show_inode)
|
||||
printf("%s ", String::formatted("{}", st.st_ino).characters());
|
||||
printf("%s ", DeprecatedString::formatted("{}", st.st_ino).characters());
|
||||
|
||||
*nprinted = print_name(st, name, nullptr, path);
|
||||
return true;
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/Hex.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/StringView.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/DirIterator.h>
|
||||
|
@ -37,19 +37,19 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
while (di.has_next()) {
|
||||
auto dir = di.next_path();
|
||||
auto command_set_filename = String::formatted("/sys/devices/storage/{}/command_set", dir);
|
||||
auto command_set_filename = DeprecatedString::formatted("/sys/devices/storage/{}/command_set", dir);
|
||||
auto command_set_file = Core::Stream::File::open(command_set_filename, Core::Stream::OpenMode::Read);
|
||||
if (command_set_file.is_error()) {
|
||||
dbgln("Error: Could not open {}: {}", command_set_filename, command_set_file.error());
|
||||
continue;
|
||||
}
|
||||
auto last_lba_filename = String::formatted("/sys/devices/storage/{}/last_lba", dir);
|
||||
auto last_lba_filename = DeprecatedString::formatted("/sys/devices/storage/{}/last_lba", dir);
|
||||
auto last_lba_file = Core::Stream::File::open(last_lba_filename, Core::Stream::OpenMode::Read);
|
||||
if (last_lba_file.is_error()) {
|
||||
dbgln("Error: Could not open {}: {}", last_lba_filename, last_lba_file.error());
|
||||
continue;
|
||||
}
|
||||
auto sector_size_filename = String::formatted("/sys/devices/storage/{}/sector_size", dir);
|
||||
auto sector_size_filename = DeprecatedString::formatted("/sys/devices/storage/{}/sector_size", dir);
|
||||
auto sector_size_file = Core::Stream::File::open(sector_size_filename, Core::Stream::OpenMode::Read);
|
||||
if (sector_size_file.is_error()) {
|
||||
dbgln("Error: Could not open {}: {}", sector_size_filename, sector_size_file.error());
|
||||
|
@ -61,21 +61,21 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
dbgln("Error: Could not read {}: {}", command_set_filename, maybe_command_set.error());
|
||||
continue;
|
||||
}
|
||||
String command_set = StringView(maybe_command_set.value().bytes());
|
||||
DeprecatedString command_set = StringView(maybe_command_set.value().bytes());
|
||||
|
||||
auto maybe_last_lba = last_lba_file.value()->read_all();
|
||||
if (maybe_last_lba.is_error()) {
|
||||
dbgln("Error: Could not read {}: {}", last_lba_filename, maybe_last_lba.error());
|
||||
continue;
|
||||
}
|
||||
String last_lba = StringView(maybe_last_lba.value().bytes());
|
||||
DeprecatedString last_lba = StringView(maybe_last_lba.value().bytes());
|
||||
|
||||
auto maybe_sector_size = sector_size_file.value()->read_all();
|
||||
if (maybe_sector_size.is_error()) {
|
||||
dbgln("Error: Could not read {}: {}", sector_size_filename, maybe_sector_size.error());
|
||||
continue;
|
||||
}
|
||||
String sector_size = StringView(maybe_sector_size.value().bytes());
|
||||
DeprecatedString sector_size = StringView(maybe_sector_size.value().bytes());
|
||||
|
||||
outln(format_row, dir, command_set, sector_size, last_lba);
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ ErrorOr<int> serenity_main(Main::Arguments)
|
|||
|
||||
out(" "sv);
|
||||
for (size_t i = 0; i < cpu_count; ++i) {
|
||||
out("{:>10}", String::formatted("CPU{}", i));
|
||||
out("{:>10}", DeprecatedString::formatted("CPU{}", i));
|
||||
}
|
||||
outln("");
|
||||
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/GenericLexer.h>
|
||||
#include <AK/JsonArray.h>
|
||||
#include <AK/JsonObject.h>
|
||||
#include <AK/JsonValue.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/ProcessStatisticsReader.h>
|
||||
|
@ -21,10 +21,10 @@
|
|||
struct OpenFile {
|
||||
int fd;
|
||||
int pid;
|
||||
String type;
|
||||
String name;
|
||||
String state;
|
||||
String full_name;
|
||||
DeprecatedString type;
|
||||
DeprecatedString name;
|
||||
DeprecatedString state;
|
||||
DeprecatedString full_name;
|
||||
};
|
||||
|
||||
static bool parse_name(StringView name, OpenFile& file)
|
||||
|
@ -65,7 +65,7 @@ static bool parse_name(StringView name, OpenFile& file)
|
|||
|
||||
static Vector<OpenFile> get_open_files_by_pid(pid_t pid)
|
||||
{
|
||||
auto file = Core::Stream::File::open(String::formatted("/proc/{}/fds", pid), Core::Stream::OpenMode::Read);
|
||||
auto file = Core::Stream::File::open(DeprecatedString::formatted("/proc/{}/fds", pid), Core::Stream::OpenMode::Read);
|
||||
if (file.is_error()) {
|
||||
outln("lsof: PID {}: {}", pid, file.error());
|
||||
return Vector<OpenFile>();
|
||||
|
@ -89,7 +89,7 @@ static Vector<OpenFile> get_open_files_by_pid(pid_t pid)
|
|||
open_file.pid = pid;
|
||||
open_file.fd = object.as_object().get("fd"sv).to_int();
|
||||
|
||||
String name = object.as_object().get("absolute_path"sv).to_string();
|
||||
DeprecatedString name = object.as_object().get("absolute_path"sv).to_string();
|
||||
VERIFY(parse_name(name, open_file));
|
||||
open_file.full_name = name;
|
||||
|
||||
|
@ -135,7 +135,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
}
|
||||
{
|
||||
// try convert UID to int
|
||||
auto arg = String(arg_uid).to_int();
|
||||
auto arg = DeprecatedString(arg_uid).to_int();
|
||||
if (arg.has_value())
|
||||
arg_uid_int = arg.value();
|
||||
}
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/Hex.h>
|
||||
#include <AK/JsonArray.h>
|
||||
#include <AK/JsonObject.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/StringUtils.h>
|
||||
#include <AK/StringView.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
|
@ -29,11 +29,11 @@ static u32 read_hex_string_from_bytebuffer(ByteBuffer const& buf)
|
|||
{
|
||||
// FIXME: Propagate errors.
|
||||
return AK::StringUtils::convert_to_uint_from_hex(
|
||||
String(MUST(buf.slice(2, buf.size() - 2)).bytes()))
|
||||
DeprecatedString(MUST(buf.slice(2, buf.size() - 2)).bytes()))
|
||||
.release_value();
|
||||
}
|
||||
|
||||
static u32 convert_sysfs_value_to_uint(String const& value)
|
||||
static u32 convert_sysfs_value_to_uint(DeprecatedString const& value)
|
||||
{
|
||||
if (auto result = AK::StringUtils::convert_to_uint_from_hex(value); result.has_value())
|
||||
return result.release_value();
|
||||
|
@ -88,31 +88,31 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
VERIFY(function_parts.size() == 2);
|
||||
auto function = convert_sysfs_value_to_uint(function_parts[1]);
|
||||
|
||||
auto vendor_id_filename = String::formatted("/sys/bus/pci/{}/vendor", dir);
|
||||
auto vendor_id_filename = DeprecatedString::formatted("/sys/bus/pci/{}/vendor", dir);
|
||||
auto vendor_id_file = Core::Stream::File::open(vendor_id_filename, Core::Stream::OpenMode::Read);
|
||||
if (vendor_id_file.is_error()) {
|
||||
dbgln("Error: Could not open {}: {}", vendor_id_filename, vendor_id_file.error());
|
||||
continue;
|
||||
}
|
||||
auto device_id_filename = String::formatted("/sys/bus/pci/{}/device_id", dir);
|
||||
auto device_id_filename = DeprecatedString::formatted("/sys/bus/pci/{}/device_id", dir);
|
||||
auto device_id_file = Core::Stream::File::open(device_id_filename, Core::Stream::OpenMode::Read);
|
||||
if (device_id_file.is_error()) {
|
||||
dbgln("Error: Could not open {}: {}", device_id_filename, device_id_file.error());
|
||||
continue;
|
||||
}
|
||||
auto class_id_filename = String::formatted("/sys/bus/pci/{}/class", dir);
|
||||
auto class_id_filename = DeprecatedString::formatted("/sys/bus/pci/{}/class", dir);
|
||||
auto class_id_file = Core::Stream::File::open(class_id_filename, Core::Stream::OpenMode::Read);
|
||||
if (class_id_file.is_error()) {
|
||||
dbgln("Error: Could not open {}: {}", class_id_filename, class_id_file.error());
|
||||
continue;
|
||||
}
|
||||
auto subclass_id_filename = String::formatted("/sys/bus/pci/{}/subclass", dir);
|
||||
auto subclass_id_filename = DeprecatedString::formatted("/sys/bus/pci/{}/subclass", dir);
|
||||
auto subclass_id_file = Core::Stream::File::open(subclass_id_filename, Core::Stream::OpenMode::Read);
|
||||
if (subclass_id_file.is_error()) {
|
||||
dbgln("Error: Could not open {}: {}", subclass_id_filename, subclass_id_file.error());
|
||||
continue;
|
||||
}
|
||||
auto revision_id_filename = String::formatted("/sys/bus/pci/{}/revision", dir);
|
||||
auto revision_id_filename = DeprecatedString::formatted("/sys/bus/pci/{}/revision", dir);
|
||||
auto revision_id_file = Core::Stream::File::open(revision_id_filename, Core::Stream::OpenMode::Read);
|
||||
if (revision_id_file.is_error()) {
|
||||
dbgln("Error: Could not open {}: {}", revision_id_filename, revision_id_file.error());
|
||||
|
@ -154,9 +154,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
}
|
||||
u32 subclass_id = read_hex_string_from_bytebuffer(subclass_id_contents.value());
|
||||
|
||||
String vendor_name;
|
||||
String device_name;
|
||||
String class_name;
|
||||
DeprecatedString vendor_name;
|
||||
DeprecatedString device_name;
|
||||
DeprecatedString class_name;
|
||||
|
||||
if (db) {
|
||||
vendor_name = db->get_vendor(vendor_id);
|
||||
|
@ -165,18 +165,18 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
}
|
||||
|
||||
if (vendor_name.is_empty())
|
||||
vendor_name = String::formatted("{:04x}", vendor_id);
|
||||
vendor_name = DeprecatedString::formatted("{:04x}", vendor_id);
|
||||
if (device_name.is_empty())
|
||||
device_name = String::formatted("{:04x}", device_id);
|
||||
device_name = DeprecatedString::formatted("{:04x}", device_id);
|
||||
if (class_name.is_empty())
|
||||
class_name = String::formatted("{:02x}{:02x}", class_id, subclass_id);
|
||||
class_name = DeprecatedString::formatted("{:02x}{:02x}", class_id, subclass_id);
|
||||
|
||||
outln(format, domain, bus, device, function, class_name, vendor_name, device_name, revision_id);
|
||||
|
||||
if (!flag_verbose)
|
||||
continue;
|
||||
for (size_t bar_index = 0; bar_index <= 5; bar_index++) {
|
||||
auto bar_value_filename = String::formatted("/sys/bus/pci/{}/bar{}", dir, bar_index);
|
||||
auto bar_value_filename = DeprecatedString::formatted("/sys/bus/pci/{}/bar{}", dir, bar_index);
|
||||
auto bar_value_file = Core::Stream::File::open(bar_value_filename, Core::Stream::OpenMode::Read);
|
||||
if (bar_value_file.is_error()) {
|
||||
dbgln("Error: Could not open {}: {}", bar_value_filename, bar_value_file.error());
|
||||
|
|
|
@ -5,11 +5,11 @@
|
|||
*/
|
||||
|
||||
#include <AK/ByteBuffer.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/FixedArray.h>
|
||||
#include <AK/JsonArray.h>
|
||||
#include <AK/JsonObject.h>
|
||||
#include <AK/LexicalPath.h>
|
||||
#include <AK/String.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/DirIterator.h>
|
||||
#include <LibCore/Stream.h>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#include <AK/Assertions.h>
|
||||
#include <AK/ByteBuffer.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/Stream.h>
|
||||
#include <LibCore/System.h>
|
||||
|
@ -19,7 +19,7 @@
|
|||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static ErrorOr<pid_t> pipe_to_pager(String const& command)
|
||||
static ErrorOr<pid_t> pipe_to_pager(DeprecatedString const& command)
|
||||
{
|
||||
char const* argv[] = { "sh", "-c", command.characters(), nullptr };
|
||||
|
||||
|
@ -71,7 +71,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
args_parser.parse(arguments);
|
||||
|
||||
auto make_path = [name](StringView section) {
|
||||
return String::formatted("/usr/share/man/man{}/{}.md", section, name);
|
||||
return DeprecatedString::formatted("/usr/share/man/man{}/{}.md", section, name);
|
||||
};
|
||||
if (section.is_empty()) {
|
||||
constexpr StringView sections[] = {
|
||||
|
@ -85,7 +85,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
"8"sv
|
||||
};
|
||||
for (auto s : sections) {
|
||||
String path = make_path(s);
|
||||
DeprecatedString path = make_path(s);
|
||||
if (access(path.characters(), R_OK) == 0) {
|
||||
section = s;
|
||||
break;
|
||||
|
@ -101,11 +101,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
exit(1);
|
||||
}
|
||||
|
||||
String pager_command;
|
||||
DeprecatedString pager_command;
|
||||
if (!pager.is_empty())
|
||||
pager_command = pager;
|
||||
else
|
||||
pager_command = String::formatted("less -P 'Manual Page {}({}) line %l?e (END):.'", StringView(name).replace("'"sv, "'\\''"sv, ReplaceMode::FirstOnly), StringView(section).replace("'"sv, "'\\''"sv, ReplaceMode::FirstOnly));
|
||||
pager_command = DeprecatedString::formatted("less -P 'Manual Page {}({}) line %l?e (END):.'", StringView(name).replace("'"sv, "'\\''"sv, ReplaceMode::FirstOnly), StringView(section).replace("'"sv, "'\\''"sv, ReplaceMode::FirstOnly));
|
||||
pid_t pager_pid = TRY(pipe_to_pager(pager_command));
|
||||
|
||||
auto file = TRY(Core::Stream::File::open(filename, Core::Stream::OpenMode::Read));
|
||||
|
@ -114,11 +114,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
dbgln("Loading man page from {}", filename);
|
||||
auto buffer = TRY(file->read_all());
|
||||
auto source = String::copy(buffer);
|
||||
auto source = DeprecatedString::copy(buffer);
|
||||
|
||||
const String title("SerenityOS manual");
|
||||
const DeprecatedString title("SerenityOS manual");
|
||||
|
||||
int spaces = view_width / 2 - String(name).length() - String(section).length() - title.length() / 2 - 4;
|
||||
int spaces = view_width / 2 - DeprecatedString(name).length() - DeprecatedString(section).length() - title.length() / 2 - 4;
|
||||
if (spaces < 0)
|
||||
spaces = 0;
|
||||
out("{}({})", name, section);
|
||||
|
@ -129,7 +129,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
auto document = Markdown::Document::parse(source);
|
||||
VERIFY(document);
|
||||
|
||||
String rendered = document->render_for_terminal(view_width);
|
||||
DeprecatedString rendered = document->render_for_terminal(view_width);
|
||||
outln("{}", rendered);
|
||||
|
||||
// FIXME: Remove this wait, it shouldn't be necessary but Shell does not
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include <LibMarkdown/Visitor.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
static bool is_missing_file_acceptable(String const& filename)
|
||||
static bool is_missing_file_acceptable(DeprecatedString const& filename)
|
||||
{
|
||||
const StringView acceptable_missing_files[] = {
|
||||
// FIXME: Please write these manpages!
|
||||
|
@ -61,9 +61,9 @@ static bool is_missing_file_acceptable(String const& filename)
|
|||
}
|
||||
|
||||
struct FileLink {
|
||||
String file_path; // May be empty, but not null
|
||||
String anchor; // May be null ("foo.md", "bar.png"), may be empty ("baz.md#")
|
||||
String label; // May be empty, but not null
|
||||
DeprecatedString file_path; // May be empty, but not null
|
||||
DeprecatedString anchor; // May be null ("foo.md", "bar.png"), may be empty ("baz.md#")
|
||||
DeprecatedString label; // May be empty, but not null
|
||||
};
|
||||
|
||||
class MarkdownLinkage final : Markdown::Visitor {
|
||||
|
@ -72,8 +72,8 @@ public:
|
|||
|
||||
static MarkdownLinkage analyze(Markdown::Document const&);
|
||||
|
||||
bool has_anchor(String const& anchor) const { return m_anchors.contains(anchor); }
|
||||
HashTable<String> const& anchors() const { return m_anchors; }
|
||||
bool has_anchor(DeprecatedString const& anchor) const { return m_anchors.contains(anchor); }
|
||||
HashTable<DeprecatedString> const& anchors() const { return m_anchors; }
|
||||
bool has_invalid_link() const { return m_has_invalid_link; }
|
||||
Vector<FileLink> const& file_links() const { return m_file_links; }
|
||||
|
||||
|
@ -91,11 +91,11 @@ private:
|
|||
virtual RecursionDecision visit(Markdown::Heading const&) override;
|
||||
virtual RecursionDecision visit(Markdown::Text::LinkNode const&) override;
|
||||
|
||||
HashTable<String> m_anchors;
|
||||
HashTable<DeprecatedString> m_anchors;
|
||||
Vector<FileLink> m_file_links;
|
||||
bool m_has_invalid_link { false };
|
||||
|
||||
String m_serenity_source_directory;
|
||||
DeprecatedString m_serenity_source_directory;
|
||||
};
|
||||
|
||||
MarkdownLinkage MarkdownLinkage::analyze(Markdown::Document const& document)
|
||||
|
@ -112,16 +112,16 @@ public:
|
|||
StringCollector() = default;
|
||||
virtual ~StringCollector() = default;
|
||||
|
||||
String build() { return m_builder.build(); }
|
||||
DeprecatedString build() { return m_builder.build(); }
|
||||
|
||||
static String from(Markdown::Heading const& heading)
|
||||
static DeprecatedString from(Markdown::Heading const& heading)
|
||||
{
|
||||
StringCollector collector;
|
||||
heading.walk(collector);
|
||||
return collector.build();
|
||||
}
|
||||
|
||||
static String from(Markdown::Text::Node const& node)
|
||||
static DeprecatedString from(Markdown::Text::Node const& node)
|
||||
{
|
||||
StringCollector collector;
|
||||
node.walk(collector);
|
||||
|
@ -129,7 +129,7 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
virtual RecursionDecision visit(String const& text) override
|
||||
virtual RecursionDecision visit(DeprecatedString const& text) override
|
||||
{
|
||||
m_builder.append(text);
|
||||
return RecursionDecision::Recurse;
|
||||
|
@ -138,10 +138,10 @@ private:
|
|||
StringBuilder m_builder;
|
||||
};
|
||||
|
||||
static String slugify(String const& text)
|
||||
static DeprecatedString slugify(DeprecatedString const& text)
|
||||
{
|
||||
// TODO: This feels like it belongs into LibWeb.
|
||||
String slug = text.to_lowercase();
|
||||
DeprecatedString 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(" "sv, "-"sv, ReplaceMode::All)
|
||||
|
@ -174,7 +174,7 @@ RecursionDecision MarkdownLinkage::visit(Markdown::Heading const& heading)
|
|||
|
||||
RecursionDecision MarkdownLinkage::visit(Markdown::Text::LinkNode const& link_node)
|
||||
{
|
||||
String const& href = link_node.href;
|
||||
DeprecatedString const& href = link_node.href;
|
||||
if (href.is_null()) {
|
||||
// Nothing to do here.
|
||||
return RecursionDecision::Recurse;
|
||||
|
@ -196,16 +196,16 @@ RecursionDecision MarkdownLinkage::visit(Markdown::Text::LinkNode const& link_no
|
|||
m_has_invalid_link = true;
|
||||
return RecursionDecision::Recurse;
|
||||
}
|
||||
auto file = String::formatted("../man{}/{}.md", url.paths()[0], url.paths()[1]);
|
||||
auto file = DeprecatedString::formatted("../man{}/{}.md", url.paths()[0], url.paths()[1]);
|
||||
|
||||
m_file_links.append({ file, String(), StringCollector::from(*link_node.text) });
|
||||
m_file_links.append({ file, DeprecatedString(), StringCollector::from(*link_node.text) });
|
||||
return RecursionDecision::Recurse;
|
||||
}
|
||||
if (url.scheme() == "file") {
|
||||
// TODO: Check more possible links other than 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) });
|
||||
auto file = DeprecatedString::formatted("{}/Base{}", m_serenity_source_directory, url.path());
|
||||
m_file_links.append({ file, DeprecatedString(), StringCollector::from(*link_node.text) });
|
||||
return RecursionDecision::Recurse;
|
||||
}
|
||||
outln("Not checking local link {}", href);
|
||||
|
@ -213,12 +213,12 @@ RecursionDecision MarkdownLinkage::visit(Markdown::Text::LinkNode const& link_no
|
|||
}
|
||||
}
|
||||
|
||||
String label = StringCollector::from(*link_node.text);
|
||||
DeprecatedString label = StringCollector::from(*link_node.text);
|
||||
Optional<size_t> last_hash = href.find_last('#');
|
||||
if (last_hash.has_value()) {
|
||||
m_file_links.append({ href.substring(0, last_hash.value()), href.substring(last_hash.value() + 1), label });
|
||||
} else {
|
||||
m_file_links.append({ href, String(), label });
|
||||
m_file_links.append({ href, DeprecatedString(), label });
|
||||
}
|
||||
|
||||
return RecursionDecision::Recurse;
|
||||
|
@ -232,7 +232,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
args_parser.parse(arguments);
|
||||
|
||||
outln("Reading and parsing Markdown files ...");
|
||||
HashMap<String, MarkdownLinkage> files;
|
||||
HashMap<DeprecatedString, MarkdownLinkage> files;
|
||||
for (auto path : file_paths) {
|
||||
auto file_or_error = Core::Stream::File::open(path, Core::Stream::OpenMode::Read);
|
||||
if (file_or_error.is_error()) {
|
||||
|
@ -272,7 +272,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
auto file_lexical_path = LexicalPath(file_item.key);
|
||||
auto file_dir = file_lexical_path.dirname();
|
||||
for (auto const& file_link : file_item.value.file_links()) {
|
||||
String pointee_file;
|
||||
DeprecatedString pointee_file;
|
||||
if (file_link.file_path.is_empty()) {
|
||||
pointee_file = file_item.key;
|
||||
} else {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/String.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/Stream.h>
|
||||
#include <LibCore/System.h>
|
||||
|
@ -48,7 +48,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
auto buffer = TRY(file->read_all());
|
||||
dbgln("Read size {}", buffer.size());
|
||||
|
||||
auto input = String::copy(buffer);
|
||||
auto input = DeprecatedString::copy(buffer);
|
||||
auto document = Markdown::Document::parse(input);
|
||||
|
||||
if (!document) {
|
||||
|
@ -56,7 +56,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
return 1;
|
||||
}
|
||||
|
||||
String res = html ? document->render_to_html() : document->render_for_terminal(view_width);
|
||||
DeprecatedString res = html ? document->render_to_html() : document->render_for_terminal(view_width);
|
||||
out("{}", res);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -21,8 +21,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
TRY(Core::System::pledge("stdio cpath rpath"));
|
||||
|
||||
bool create_parents = false;
|
||||
String mode_string;
|
||||
Vector<String> directories;
|
||||
DeprecatedString mode_string;
|
||||
Vector<DeprecatedString> directories;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_option(create_parents, "Create parent directories if they don't exist", "parents", 'p');
|
||||
|
|
|
@ -14,7 +14,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio dpath"));
|
||||
|
||||
String mode_string;
|
||||
DeprecatedString mode_string;
|
||||
mode_t mask_reference_mode = 0777;
|
||||
mode_t mode = 0666;
|
||||
Vector<StringView> paths;
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
constexpr StringView default_template = "tmp.XXXXXXXXXX"sv;
|
||||
|
||||
static String generate_random_filename(String const& pattern)
|
||||
static DeprecatedString generate_random_filename(DeprecatedString const& pattern)
|
||||
{
|
||||
StringBuilder new_filename { pattern.length() };
|
||||
|
||||
|
@ -30,7 +30,7 @@ static String generate_random_filename(String const& pattern)
|
|||
return new_filename.to_string();
|
||||
}
|
||||
|
||||
static ErrorOr<String> make_temp(String const& pattern, bool directory, bool dry_run)
|
||||
static ErrorOr<DeprecatedString> make_temp(DeprecatedString const& pattern, bool directory, bool dry_run)
|
||||
{
|
||||
for (int i = 0; i < 100; ++i) {
|
||||
auto path = generate_random_filename(pattern);
|
||||
|
@ -49,7 +49,7 @@ static ErrorOr<String> make_temp(String const& pattern, bool directory, bool dry
|
|||
}
|
||||
}
|
||||
}
|
||||
return String {};
|
||||
return DeprecatedString {};
|
||||
}
|
||||
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
|
|
|
@ -63,13 +63,13 @@ static ErrorOr<int> get_source_fd(StringView source)
|
|||
return fd_or_error;
|
||||
}
|
||||
|
||||
static bool mount_by_line(String const& line)
|
||||
static bool mount_by_line(DeprecatedString const& line)
|
||||
{
|
||||
// Skip comments and blank lines.
|
||||
if (line.is_empty() || line.starts_with('#'))
|
||||
return true;
|
||||
|
||||
Vector<String> parts = line.split('\t');
|
||||
Vector<DeprecatedString> parts = line.split('\t');
|
||||
if (parts.size() < 3) {
|
||||
warnln("Invalid fstab entry: {}", line);
|
||||
return false;
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/LexicalPath.h>
|
||||
#include <AK/String.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/System.h>
|
||||
|
@ -23,7 +23,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
bool no_clobber = false;
|
||||
bool verbose = false;
|
||||
|
||||
Vector<String> paths;
|
||||
Vector<DeprecatedString> paths;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_option(force, "Force", "force", 'f');
|
||||
|
@ -61,11 +61,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
umask(my_umask);
|
||||
|
||||
for (auto& old_path : paths) {
|
||||
String combined_new_path;
|
||||
DeprecatedString combined_new_path;
|
||||
auto new_path = original_new_path;
|
||||
if (S_ISDIR(st.st_mode)) {
|
||||
auto old_basename = LexicalPath::basename(old_path);
|
||||
combined_new_path = String::formatted("{}/{}", original_new_path, old_basename);
|
||||
combined_new_path = DeprecatedString::formatted("{}/{}", original_new_path, old_basename);
|
||||
new_path = combined_new_path.characters();
|
||||
}
|
||||
|
||||
|
|
|
@ -4,12 +4,12 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include <AK/IPv4Address.h>
|
||||
#include <AK/JsonArray.h>
|
||||
#include <AK/JsonObject.h>
|
||||
#include <AK/QuickSort.h>
|
||||
#include <AK/String.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/ProcessStatisticsReader.h>
|
||||
#include <LibCore/Stream.h>
|
||||
|
@ -55,7 +55,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
uid_t current_uid = getuid();
|
||||
|
||||
HashMap<pid_t, String> programs;
|
||||
HashMap<pid_t, DeprecatedString> programs;
|
||||
|
||||
if (flag_program) {
|
||||
auto processes = Core::ProcessStatisticsReader::get_all();
|
||||
|
@ -73,10 +73,10 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
};
|
||||
|
||||
struct Column {
|
||||
String title;
|
||||
DeprecatedString title;
|
||||
Alignment alignment { Alignment::Left };
|
||||
int width { 0 };
|
||||
String buffer;
|
||||
DeprecatedString buffer;
|
||||
};
|
||||
|
||||
Vector<Column> columns;
|
||||
|
@ -114,22 +114,22 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
}
|
||||
};
|
||||
|
||||
auto get_formatted_address = [&](String const& address, String const& port) {
|
||||
auto get_formatted_address = [&](DeprecatedString const& address, DeprecatedString const& port) {
|
||||
if (flag_wide)
|
||||
return String::formatted("{}:{}", address, port);
|
||||
return DeprecatedString::formatted("{}:{}", address, port);
|
||||
|
||||
if ((address.length() + port.length()) <= max_formatted_address_length)
|
||||
return String::formatted("{}:{}", address, port);
|
||||
return DeprecatedString::formatted("{}:{}", address, port);
|
||||
|
||||
return String::formatted("{}:{}", address.substring_view(0, max_formatted_address_length - port.length()), port);
|
||||
return DeprecatedString::formatted("{}:{}", address.substring_view(0, max_formatted_address_length - port.length()), port);
|
||||
};
|
||||
|
||||
auto get_formatted_program = [&](pid_t pid) {
|
||||
if (pid == -1)
|
||||
return String("-");
|
||||
return DeprecatedString("-");
|
||||
|
||||
auto program = programs.get(pid);
|
||||
return String::formatted("{}/{}", pid, program.value());
|
||||
return DeprecatedString::formatted("{}/{}", pid, program.value());
|
||||
};
|
||||
|
||||
if (!has_protocol_flag || flag_tcp || flag_udp) {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/String.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibMain/Main.h>
|
||||
|
@ -25,7 +25,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
char const* separator = " ";
|
||||
int start_number = 1;
|
||||
int number_width = 6;
|
||||
Vector<String> files;
|
||||
Vector<DeprecatedString> files;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ static timeval timeval_from_ntp_timestamp(NtpTimestamp const& ntp_timestamp)
|
|||
return t;
|
||||
}
|
||||
|
||||
static String format_ntp_timestamp(NtpTimestamp ntp_timestamp)
|
||||
static DeprecatedString format_ntp_timestamp(NtpTimestamp ntp_timestamp)
|
||||
{
|
||||
char buffer[28]; // YYYY-MM-DDTHH:MM:SS.UUUUUUZ is 27 characters long.
|
||||
timeval t = timeval_from_ntp_timestamp(ntp_timestamp);
|
||||
|
|
|
@ -31,7 +31,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
bool lock = false;
|
||||
bool unlock = false;
|
||||
// FIXME: Replace with StringView once Core::Account::from_name stops taking a char const*.
|
||||
String username {};
|
||||
DeprecatedString username {};
|
||||
|
||||
auto args_parser = Core::ArgsParser();
|
||||
args_parser.set_general_help("Modify an account password.");
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/Format.h>
|
||||
#include <AK/String.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibGUI/Application.h>
|
||||
|
@ -69,7 +69,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
if (watch) {
|
||||
watch_command.append({});
|
||||
|
||||
clipboard.on_change = [&](String const&) {
|
||||
clipboard.on_change = [&](DeprecatedString const&) {
|
||||
// Technically there's a race here...
|
||||
auto data_and_type = clipboard.fetch_data_and_type();
|
||||
if (data_and_type.mime_type.is_null()) {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/String.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibMain/Main.h>
|
||||
|
@ -18,7 +18,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
static bool flag_most_posix = false;
|
||||
static bool flag_portability = false;
|
||||
static bool flag_empty_name_and_leading_dash = false;
|
||||
Vector<String> paths;
|
||||
Vector<DeprecatedString> paths;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_option(flag_most_posix, "Check for most POSIX systems", nullptr, 'p');
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/String.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/ProcessStatisticsReader.h>
|
||||
#include <LibCore/System.h>
|
||||
|
@ -14,7 +14,7 @@
|
|||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static ErrorOr<int> pid_of(String const& process_name, bool single_shot, bool omit_pid, pid_t pid)
|
||||
static ErrorOr<int> pid_of(DeprecatedString const& process_name, bool single_shot, bool omit_pid, pid_t pid)
|
||||
{
|
||||
bool displayed_at_least_one = false;
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ static ErrorOr<bool> is_dynamically_linked_executable(StringView filename)
|
|||
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
String promises;
|
||||
DeprecatedString promises;
|
||||
Vector<StringView> command;
|
||||
bool add_promises_for_dynamic_linker;
|
||||
|
||||
|
@ -39,7 +39,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
auto constexpr loader_promises = "stdio rpath prot_exec"sv;
|
||||
MUST(Core::System::setenv("_LOADER_PLEDGE_PROMISES"sv, loader_promises, true));
|
||||
MUST(Core::System::setenv("_LOADER_MAIN_PROGRAM_PLEDGE_PROMISES"sv, promises, true));
|
||||
promises = String::formatted("{} {}", promises, loader_promises);
|
||||
promises = DeprecatedString::formatted("{} {}", promises, loader_promises);
|
||||
}
|
||||
|
||||
TRY(Core::System::pledge(StringView(), promises));
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/JsonObject.h>
|
||||
#include <AK/QuickSort.h>
|
||||
#include <AK/String.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/Stream.h>
|
||||
#include <LibCore/System.h>
|
||||
|
@ -26,7 +26,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
args_parser.add_positional_argument(pid, "PID", "PID", Core::ArgsParser::Required::Yes);
|
||||
args_parser.parse(arguments);
|
||||
|
||||
auto file = TRY(Core::Stream::File::open(String::formatted("/proc/{}/vm", pid), Core::Stream::OpenMode::Read));
|
||||
auto file = TRY(Core::Stream::File::open(DeprecatedString::formatted("/proc/{}/vm", pid), Core::Stream::OpenMode::Read));
|
||||
|
||||
outln("{}:", pid);
|
||||
|
||||
|
@ -55,7 +55,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
auto address = map.get("address"sv).to_addr();
|
||||
auto size = map.get("size"sv).to_string();
|
||||
|
||||
auto access = String::formatted("{}{}{}{}{}",
|
||||
auto access = DeprecatedString::formatted("{}{}{}{}{}",
|
||||
(map.get("readable"sv).to_bool() ? "r" : "-"),
|
||||
(map.get("writable"sv).to_bool() ? "w" : "-"),
|
||||
(map.get("executable"sv).to_bool() ? "x" : "-"),
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/String.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/StringUtils.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/System.h>
|
||||
|
@ -20,7 +20,7 @@
|
|||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static bool try_set_offset_and_length_parameters(String const& arg_offset, String const& arg_length, u64& offset, u64& length)
|
||||
static bool try_set_offset_and_length_parameters(DeprecatedString const& arg_offset, DeprecatedString const& arg_length, u64& offset, u64& length)
|
||||
{
|
||||
// TODO: Add support for hex values
|
||||
auto possible_offset = arg_offset.to_uint<u64>();
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
*/
|
||||
|
||||
#include <AK/Assertions.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/PrintfImplementation.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <AK/Types.h>
|
||||
#include <LibMain/Main.h>
|
||||
|
@ -234,7 +234,7 @@ struct ArgvWithCount {
|
|||
int& argc;
|
||||
};
|
||||
|
||||
static String handle_escapes(char const* string)
|
||||
static DeprecatedString handle_escapes(char const* string)
|
||||
{
|
||||
StringBuilder builder;
|
||||
for (auto c = *string; c; c = *++string) {
|
||||
|
@ -300,7 +300,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
auto argv = arguments.argv;
|
||||
|
||||
++argv;
|
||||
String format = handle_escapes(*(argv++));
|
||||
DeprecatedString format = handle_escapes(*(argv++));
|
||||
auto format_string = format.characters();
|
||||
|
||||
argc -= 2;
|
||||
|
|
|
@ -153,9 +153,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
bool should_follow_url = false;
|
||||
char const* data = nullptr;
|
||||
StringView proxy_spec;
|
||||
String method = "GET";
|
||||
DeprecatedString method = "GET";
|
||||
StringView method_override;
|
||||
HashMap<String, String, CaseInsensitiveStringTraits> request_headers;
|
||||
HashMap<DeprecatedString, DeprecatedString, CaseInsensitiveStringTraits> request_headers;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.set_general_help(
|
||||
|
@ -253,7 +253,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
should_save_stream_data = true;
|
||||
|
||||
if (!following_url && save_at_provided_name) {
|
||||
String output_name;
|
||||
DeprecatedString output_name;
|
||||
if (auto content_disposition = response_headers.get("Content-Disposition"); content_disposition.has_value()) {
|
||||
auto& value = content_disposition.value();
|
||||
ContentDispositionParser parser(value);
|
||||
|
@ -272,7 +272,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
do {
|
||||
output_name = url.host();
|
||||
if (i > -1)
|
||||
output_name = String::formatted("{}.{}", output_name, i);
|
||||
output_name = DeprecatedString::formatted("{}.{}", output_name, i);
|
||||
++i;
|
||||
} while (Core::File::exists(output_name));
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
args_parser.add_option(Core::ArgsParser::Option {
|
||||
Core::ArgsParser::OptionArgumentMode::Required,
|
||||
"Enable tracking specific event type", nullptr, 't', "event_type",
|
||||
[&](String event_type) {
|
||||
[&](DeprecatedString event_type) {
|
||||
seen_event_type_arg = true;
|
||||
if (event_type == "sample")
|
||||
event_mask |= PERF_EVENT_SAMPLE;
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include <sys/sysmacros.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static ErrorOr<String> determine_tty_pseudo_name()
|
||||
static ErrorOr<DeprecatedString> determine_tty_pseudo_name()
|
||||
{
|
||||
struct stat tty_stat;
|
||||
if (fstat(STDIN_FILENO, &tty_stat) < 0) {
|
||||
|
@ -25,11 +25,11 @@ static ErrorOr<String> determine_tty_pseudo_name()
|
|||
int tty_device_minor = minor(tty_stat.st_rdev);
|
||||
|
||||
if (tty_device_major == 201) {
|
||||
return String::formatted("pts:{}", tty_device_minor);
|
||||
return DeprecatedString::formatted("pts:{}", tty_device_minor);
|
||||
}
|
||||
|
||||
if (tty_device_major == 4) {
|
||||
return String::formatted("tty:{}", tty_device_minor);
|
||||
return DeprecatedString::formatted("tty:{}", tty_device_minor);
|
||||
}
|
||||
return "n/a";
|
||||
}
|
||||
|
@ -51,15 +51,15 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
};
|
||||
|
||||
struct Column {
|
||||
String title;
|
||||
DeprecatedString title;
|
||||
Alignment alignment { Alignment::Left };
|
||||
int width { 0 };
|
||||
String buffer;
|
||||
DeprecatedString buffer;
|
||||
};
|
||||
|
||||
bool every_process_flag = false;
|
||||
bool full_format_flag = false;
|
||||
String pid_list;
|
||||
DeprecatedString pid_list;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_option(every_process_flag, "Show every process", nullptr, 'e');
|
||||
|
@ -132,10 +132,10 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
quick_sort(processes, [](auto& a, auto& b) { return a.pid < b.pid; });
|
||||
}
|
||||
|
||||
Vector<Vector<String>> rows;
|
||||
Vector<Vector<DeprecatedString>> rows;
|
||||
TRY(rows.try_ensure_capacity(1 + processes.size()));
|
||||
|
||||
Vector<String> header;
|
||||
Vector<DeprecatedString> header;
|
||||
TRY(header.try_ensure_capacity(columns.size()));
|
||||
for (auto& column : columns)
|
||||
header.unchecked_append(column.title);
|
||||
|
@ -148,7 +148,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
auto* state = process.threads.is_empty() ? "Zombie" : process.threads.first().state.characters();
|
||||
|
||||
Vector<String> row;
|
||||
Vector<DeprecatedString> row;
|
||||
TRY(row.try_resize(columns.size()));
|
||||
|
||||
if (tty == "")
|
||||
|
@ -157,13 +157,13 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
if (uid_column != -1)
|
||||
row[uid_column] = process.username;
|
||||
if (pid_column != -1)
|
||||
row[pid_column] = String::number(process.pid);
|
||||
row[pid_column] = DeprecatedString::number(process.pid);
|
||||
if (ppid_column != -1)
|
||||
row[ppid_column] = String::number(process.ppid);
|
||||
row[ppid_column] = DeprecatedString::number(process.ppid);
|
||||
if (pgid_column != -1)
|
||||
row[pgid_column] = String::number(process.pgid);
|
||||
row[pgid_column] = DeprecatedString::number(process.pgid);
|
||||
if (sid_column != -1)
|
||||
row[sid_column] = String::number(process.sid);
|
||||
row[sid_column] = DeprecatedString::number(process.sid);
|
||||
if (tty_column != -1)
|
||||
row[tty_column] = tty;
|
||||
if (state_column != -1)
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/Format.h>
|
||||
#include <AK/String.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibMain/Main.h>
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/LexicalPath.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <AK/StringView.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
|
@ -233,7 +233,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio rpath"));
|
||||
|
||||
String path {};
|
||||
DeprecatedString path {};
|
||||
static bool display_all = false;
|
||||
static bool display_elf_header = false;
|
||||
static bool display_program_headers = false;
|
||||
|
@ -471,9 +471,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
return IterationDecision::Break;
|
||||
});
|
||||
|
||||
Vector<String> libraries;
|
||||
Vector<DeprecatedString> libraries;
|
||||
object->for_each_needed_library([&libraries](StringView entry) {
|
||||
libraries.append(String::formatted("{}", entry));
|
||||
libraries.append(DeprecatedString::formatted("{}", entry));
|
||||
});
|
||||
|
||||
auto library_index = 0;
|
||||
|
|
|
@ -12,7 +12,7 @@ ErrorOr<int> serenity_main(Main::Arguments)
|
|||
{
|
||||
auto file = TRY(Core::Stream::File::open("/sys/kernel/power_state"sv, Core::Stream::OpenMode::Write));
|
||||
|
||||
const String file_contents = "1";
|
||||
const DeprecatedString file_contents = "1";
|
||||
TRY(file->write(file_contents.bytes()));
|
||||
file->close();
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
if (path == "-") {
|
||||
streams.append(stdin);
|
||||
} else {
|
||||
FILE* stream = fopen(String(path).characters(), "r");
|
||||
FILE* stream = fopen(DeprecatedString(path).characters(), "r");
|
||||
if (!stream) {
|
||||
warnln("Failed to open {}: {}", path, strerror(errno));
|
||||
continue;
|
||||
|
@ -70,7 +70,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
}
|
||||
break;
|
||||
}
|
||||
outln("{}", String { buffer, Chomp }.reverse());
|
||||
outln("{}", DeprecatedString { buffer, Chomp }.reverse());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio cpath"));
|
||||
|
||||
Vector<String> paths;
|
||||
Vector<DeprecatedString> paths;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_positional_argument(paths, "Directories to remove", "paths");
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/IPv4Address.h>
|
||||
#include <AK/JsonArray.h>
|
||||
#include <AK/JsonObject.h>
|
||||
#include <AK/QuickSort.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/StringView.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/ProcessStatisticsReader.h>
|
||||
|
@ -51,10 +51,10 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
};
|
||||
|
||||
struct Column {
|
||||
String title;
|
||||
DeprecatedString title;
|
||||
Alignment alignment { Alignment::Left };
|
||||
int width { 0 };
|
||||
String buffer;
|
||||
DeprecatedString buffer;
|
||||
};
|
||||
|
||||
Vector<Column> columns;
|
||||
|
|
|
@ -33,11 +33,11 @@ struct FileResult {
|
|||
pid_t child_pid { 0 };
|
||||
};
|
||||
|
||||
String g_currently_running_test;
|
||||
DeprecatedString g_currently_running_test;
|
||||
|
||||
class TestRunner : public ::Test::TestRunner {
|
||||
public:
|
||||
TestRunner(String test_root, Regex<PosixExtended> exclude_regex, NonnullRefPtr<Core::ConfigFile> config, Regex<PosixExtended> skip_regex, bool run_skipped_tests, bool print_progress, bool print_json, bool print_all_output, bool print_times = true)
|
||||
TestRunner(DeprecatedString test_root, Regex<PosixExtended> exclude_regex, NonnullRefPtr<Core::ConfigFile> config, Regex<PosixExtended> skip_regex, bool run_skipped_tests, bool print_progress, bool print_json, bool print_all_output, bool print_times = true)
|
||||
: ::Test::TestRunner(move(test_root), print_times, print_progress, print_json)
|
||||
, m_exclude_regex(move(exclude_regex))
|
||||
, m_config(move(config))
|
||||
|
@ -54,28 +54,28 @@ public:
|
|||
virtual ~TestRunner() = default;
|
||||
|
||||
protected:
|
||||
virtual void do_run_single_test(String const& test_path, size_t current_text_index, size_t num_tests) override;
|
||||
virtual Vector<String> get_test_paths() const override;
|
||||
virtual Vector<String> const* get_failed_test_names() const override { return &m_failed_test_names; }
|
||||
virtual void do_run_single_test(DeprecatedString const& test_path, size_t current_text_index, size_t num_tests) override;
|
||||
virtual Vector<DeprecatedString> get_test_paths() const override;
|
||||
virtual Vector<DeprecatedString> const* get_failed_test_names() const override { return &m_failed_test_names; }
|
||||
|
||||
virtual FileResult run_test_file(String const& test_path);
|
||||
virtual FileResult run_test_file(DeprecatedString const& test_path);
|
||||
|
||||
bool should_skip_test(LexicalPath const& test_path);
|
||||
|
||||
Regex<PosixExtended> m_exclude_regex;
|
||||
NonnullRefPtr<Core::ConfigFile> m_config;
|
||||
Vector<String> m_skip_directories;
|
||||
Vector<String> m_skip_files;
|
||||
Vector<String> m_failed_test_names;
|
||||
Vector<DeprecatedString> m_skip_directories;
|
||||
Vector<DeprecatedString> m_skip_files;
|
||||
Vector<DeprecatedString> m_failed_test_names;
|
||||
Regex<PosixExtended> m_skip_regex;
|
||||
bool m_run_skipped_tests { false };
|
||||
bool m_print_all_output { false };
|
||||
};
|
||||
|
||||
Vector<String> TestRunner::get_test_paths() const
|
||||
Vector<DeprecatedString> TestRunner::get_test_paths() const
|
||||
{
|
||||
Vector<String> paths;
|
||||
Test::iterate_directory_recursively(m_test_root, [&](String const& file_path) {
|
||||
Vector<DeprecatedString> paths;
|
||||
Test::iterate_directory_recursively(m_test_root, [&](DeprecatedString const& file_path) {
|
||||
if (access(file_path.characters(), R_OK | X_OK) != 0)
|
||||
return;
|
||||
auto result = m_exclude_regex.match(file_path, PosixFlags::Global);
|
||||
|
@ -91,11 +91,11 @@ bool TestRunner::should_skip_test(LexicalPath const& test_path)
|
|||
if (m_run_skipped_tests)
|
||||
return false;
|
||||
|
||||
for (String const& dir : m_skip_directories) {
|
||||
for (DeprecatedString const& dir : m_skip_directories) {
|
||||
if (test_path.dirname().contains(dir))
|
||||
return true;
|
||||
}
|
||||
for (String const& file : m_skip_files) {
|
||||
for (DeprecatedString const& file : m_skip_files) {
|
||||
if (test_path.basename().contains(file))
|
||||
return true;
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ bool TestRunner::should_skip_test(LexicalPath const& test_path)
|
|||
return false;
|
||||
}
|
||||
|
||||
void TestRunner::do_run_single_test(String const& test_path, size_t current_test_index, size_t num_tests)
|
||||
void TestRunner::do_run_single_test(DeprecatedString const& test_path, size_t current_test_index, size_t num_tests)
|
||||
{
|
||||
g_currently_running_test = test_path;
|
||||
auto test_relative_path = LexicalPath::relative_path(test_path, m_test_root);
|
||||
|
@ -141,7 +141,7 @@ void TestRunner::do_run_single_test(String const& test_path, size_t current_test
|
|||
out("{}", test_result.result == Test::Result::Fail ? " FAIL " : "CRASHED");
|
||||
print_modifiers({ Test::CLEAR });
|
||||
if (test_result.result == Test::Result::Crashed) {
|
||||
auto pid_search_string = String::formatted("_{}_", test_result.child_pid);
|
||||
auto pid_search_string = DeprecatedString::formatted("_{}_", test_result.child_pid);
|
||||
Core::DirIterator iterator("/tmp/coredump"sv);
|
||||
if (!iterator.has_error()) {
|
||||
while (iterator.has_next()) {
|
||||
|
@ -225,7 +225,7 @@ void TestRunner::do_run_single_test(String const& test_path, size_t current_test
|
|||
close(test_result.stdout_err_fd);
|
||||
}
|
||||
|
||||
FileResult TestRunner::run_test_file(String const& test_path)
|
||||
FileResult TestRunner::run_test_file(DeprecatedString const& test_path)
|
||||
{
|
||||
double start_time = get_time_in_ms();
|
||||
|
||||
|
@ -241,8 +241,8 @@ FileResult TestRunner::run_test_file(String const& test_path)
|
|||
int child_out_err_file = mkstemp(child_out_err_path);
|
||||
VERIFY(child_out_err_file >= 0);
|
||||
|
||||
String dirname = path_for_test.dirname();
|
||||
String basename = path_for_test.basename();
|
||||
DeprecatedString dirname = path_for_test.dirname();
|
||||
DeprecatedString basename = path_for_test.basename();
|
||||
|
||||
(void)posix_spawn_file_actions_adddup2(&file_actions, child_out_err_file, STDOUT_FILENO);
|
||||
(void)posix_spawn_file_actions_adddup2(&file_actions, child_out_err_file, STDERR_FILENO);
|
||||
|
@ -316,9 +316,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
bool run_benchmarks = false;
|
||||
bool run_skipped_tests = false;
|
||||
char const* specified_test_root = nullptr;
|
||||
String test_glob;
|
||||
String exclude_pattern;
|
||||
String config_file;
|
||||
DeprecatedString test_glob;
|
||||
DeprecatedString exclude_pattern;
|
||||
DeprecatedString config_file;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_option(Core::ArgsParser::Option {
|
||||
|
@ -346,7 +346,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
args_parser.add_positional_argument(specified_test_root, "Tests root directory", "path", Core::ArgsParser::Required::No);
|
||||
args_parser.parse(arguments);
|
||||
|
||||
test_glob = String::formatted("*{}*", test_glob);
|
||||
test_glob = DeprecatedString::formatted("*{}*", test_glob);
|
||||
|
||||
if (getenv("DISABLE_DBG_OUTPUT")) {
|
||||
AK::set_debug_enabled(false);
|
||||
|
@ -358,10 +358,10 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
if (!run_benchmarks)
|
||||
TRY(Core::System::setenv("TESTS_ONLY"sv, "1"sv, true));
|
||||
|
||||
String test_root;
|
||||
DeprecatedString test_root;
|
||||
|
||||
if (specified_test_root) {
|
||||
test_root = String { specified_test_root };
|
||||
test_root = DeprecatedString { specified_test_root };
|
||||
} else {
|
||||
test_root = "/usr/Tests";
|
||||
}
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/Format.h>
|
||||
#include <AK/StdLibExtras.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/System.h>
|
||||
|
|
|
@ -93,7 +93,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
Core::ArgsParser args_parser;
|
||||
|
||||
String output_path;
|
||||
DeprecatedString output_path;
|
||||
bool output_to_clipboard = false;
|
||||
unsigned delay = 0;
|
||||
bool select_region = false;
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/Random.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/Stream.h>
|
||||
|
|
|
@ -16,7 +16,7 @@ ErrorOr<int> serenity_main(Main::Arguments)
|
|||
{
|
||||
auto file = TRY(Core::Stream::File::open("/sys/kernel/power_state"sv, Core::Stream::OpenMode::Write));
|
||||
|
||||
const String file_contents = "2";
|
||||
const DeprecatedString file_contents = "2";
|
||||
TRY(file->write(file_contents.bytes()));
|
||||
file->close();
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/QuickSort.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibMain/Main.h>
|
||||
|
@ -19,7 +19,7 @@ ErrorOr<int> serenity_main([[maybe_unused]] Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio"sv));
|
||||
|
||||
Vector<String> lines;
|
||||
Vector<DeprecatedString> lines;
|
||||
|
||||
for (;;) {
|
||||
char* buffer = nullptr;
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/Format.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/File.h>
|
||||
|
@ -21,7 +21,7 @@
|
|||
|
||||
class SQLRepl {
|
||||
public:
|
||||
explicit SQLRepl(String const& database_name)
|
||||
explicit SQLRepl(DeprecatedString const& database_name)
|
||||
: m_loop()
|
||||
{
|
||||
m_editor = Line::Editor::construct();
|
||||
|
@ -76,7 +76,7 @@ public:
|
|||
|
||||
m_sql_client = SQL::SQLClient::try_create().release_value_but_fixme_should_propagate_errors();
|
||||
|
||||
m_sql_client->on_connected = [this](int connection_id, String const& connected_to_database) {
|
||||
m_sql_client->on_connected = [this](int connection_id, DeprecatedString const& connected_to_database) {
|
||||
outln("Connected to \033[33;1m{}\033[0m", connected_to_database);
|
||||
m_current_database = connected_to_database;
|
||||
m_pending_database = "";
|
||||
|
@ -93,7 +93,7 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
m_sql_client->on_next_result = [](int, Vector<String> const& row) {
|
||||
m_sql_client->on_next_result = [](int, Vector<DeprecatedString> const& row) {
|
||||
StringBuilder builder;
|
||||
builder.join(", "sv, row);
|
||||
outln("{}", builder.build());
|
||||
|
@ -104,12 +104,12 @@ public:
|
|||
read_sql();
|
||||
};
|
||||
|
||||
m_sql_client->on_connection_error = [this](int, int code, String const& message) {
|
||||
m_sql_client->on_connection_error = [this](int, int code, DeprecatedString const& message) {
|
||||
outln("\033[33;1mConnection error:\033[0m {}", message);
|
||||
m_loop.quit(code);
|
||||
};
|
||||
|
||||
m_sql_client->on_execution_error = [this](int, int, String const& message) {
|
||||
m_sql_client->on_execution_error = [this](int, int, DeprecatedString const& message) {
|
||||
outln("\033[33;1mExecution error:\033[0m {}", message);
|
||||
read_sql();
|
||||
};
|
||||
|
@ -134,7 +134,7 @@ public:
|
|||
m_editor->save_history(m_history_path);
|
||||
}
|
||||
|
||||
void connect(String const& database_name)
|
||||
void connect(DeprecatedString const& database_name)
|
||||
{
|
||||
if (m_current_database.is_empty()) {
|
||||
m_sql_client->connect(database_name);
|
||||
|
@ -144,13 +144,13 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
void source_file(String file_name)
|
||||
void source_file(DeprecatedString file_name)
|
||||
{
|
||||
m_input_file_chain.append(move(file_name));
|
||||
m_quit_when_files_read = false;
|
||||
}
|
||||
|
||||
void read_file(String file_name)
|
||||
void read_file(DeprecatedString file_name)
|
||||
{
|
||||
m_input_file_chain.append(move(file_name));
|
||||
m_quit_when_files_read = true;
|
||||
|
@ -162,21 +162,21 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
String m_history_path { String::formatted("{}/.sql-history", Core::StandardPaths::home_directory()) };
|
||||
DeprecatedString m_history_path { DeprecatedString::formatted("{}/.sql-history", Core::StandardPaths::home_directory()) };
|
||||
RefPtr<Line::Editor> m_editor { nullptr };
|
||||
int m_repl_line_level { 0 };
|
||||
bool m_keep_running { true };
|
||||
String m_pending_database {};
|
||||
String m_current_database {};
|
||||
DeprecatedString m_pending_database {};
|
||||
DeprecatedString m_current_database {};
|
||||
AK::RefPtr<SQL::SQLClient> m_sql_client { nullptr };
|
||||
int m_connection_id { 0 };
|
||||
Core::EventLoop m_loop;
|
||||
OwnPtr<Core::Stream::BufferedFile> m_input_file { nullptr };
|
||||
bool m_quit_when_files_read { false };
|
||||
Vector<String> m_input_file_chain {};
|
||||
Vector<DeprecatedString> m_input_file_chain {};
|
||||
Array<u8, PAGE_SIZE> m_buffer {};
|
||||
|
||||
Optional<String> get_line()
|
||||
Optional<DeprecatedString> get_line()
|
||||
{
|
||||
if (!m_input_file && !m_input_file_chain.is_empty()) {
|
||||
auto file_name = m_input_file_chain.take_first();
|
||||
|
@ -216,7 +216,7 @@ private:
|
|||
return line_result.value();
|
||||
}
|
||||
|
||||
String read_next_piece()
|
||||
DeprecatedString read_next_piece()
|
||||
{
|
||||
StringBuilder piece;
|
||||
|
||||
|
@ -275,7 +275,7 @@ private:
|
|||
|
||||
void read_sql()
|
||||
{
|
||||
String piece = read_next_piece();
|
||||
DeprecatedString piece = read_next_piece();
|
||||
|
||||
// m_keep_running can be set to false when the file we are reading
|
||||
// from is exhausted...
|
||||
|
@ -302,7 +302,7 @@ private:
|
|||
}
|
||||
};
|
||||
|
||||
static String prompt_for_level(int level)
|
||||
static DeprecatedString prompt_for_level(int level)
|
||||
{
|
||||
static StringBuilder prompt_builder;
|
||||
prompt_builder.clear();
|
||||
|
@ -348,11 +348,11 @@ private:
|
|||
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
String database_name(getlogin());
|
||||
String file_to_source;
|
||||
String file_to_read;
|
||||
DeprecatedString database_name(getlogin());
|
||||
DeprecatedString file_to_source;
|
||||
DeprecatedString file_to_read;
|
||||
bool suppress_sqlrc = false;
|
||||
auto sqlrc_path = String::formatted("{}/.sqlrc", Core::StandardPaths::home_directory());
|
||||
auto sqlrc_path = DeprecatedString::formatted("{}/.sqlrc", Core::StandardPaths::home_directory());
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.set_general_help("This is a client for the SerenitySQL database server.");
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/String.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/DateTime.h>
|
||||
#include <LibCore/System.h>
|
||||
|
|
|
@ -34,13 +34,13 @@
|
|||
#define HANDLE(VALUE) \
|
||||
case VALUE: \
|
||||
return #VALUE##sv;
|
||||
#define VALUES_TO_NAMES(FUNC_NAME) \
|
||||
static String FUNC_NAME(int value) \
|
||||
{ \
|
||||
#define VALUES_TO_NAMES(FUNC_NAME) \
|
||||
static DeprecatedString FUNC_NAME(int value) \
|
||||
{ \
|
||||
switch (value) {
|
||||
#define END_VALUES_TO_NAMES() \
|
||||
} \
|
||||
return String::formatted("{}", value); \
|
||||
#define END_VALUES_TO_NAMES() \
|
||||
} \
|
||||
return DeprecatedString::formatted("{}", value); \
|
||||
}
|
||||
|
||||
VALUES_TO_NAMES(errno_name)
|
||||
|
|
|
@ -8,10 +8,10 @@
|
|||
#define __USE_MISC
|
||||
#define TTYDEFCHARS
|
||||
#include <AK/Array.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/Optional.h>
|
||||
#include <AK/Result.h>
|
||||
#include <AK/ScopeGuard.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/StringView.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibCore/System.h>
|
||||
|
@ -536,7 +536,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
TRY(Core::System::unveil("/dev", "r"));
|
||||
TRY(Core::System::unveil(nullptr, nullptr));
|
||||
|
||||
String device_file;
|
||||
DeprecatedString device_file;
|
||||
bool stty_readable = false;
|
||||
bool all_settings = false;
|
||||
|
||||
|
|
|
@ -12,9 +12,9 @@
|
|||
|
||||
static bool s_set_variable = false;
|
||||
|
||||
static String get_variable(StringView name)
|
||||
static DeprecatedString get_variable(StringView name)
|
||||
{
|
||||
auto path = String::formatted("/sys/kernel/variables/{}", name);
|
||||
auto path = DeprecatedString::formatted("/sys/kernel/variables/{}", name);
|
||||
auto file = Core::Stream::File::open(path, Core::Stream::OpenMode::Read);
|
||||
if (file.is_error()) {
|
||||
warnln("Failed to open {}: {}", path, file.error());
|
||||
|
@ -42,7 +42,7 @@ static bool write_variable(StringView name, StringView value)
|
|||
auto old_value = get_variable(name);
|
||||
if (old_value.is_null())
|
||||
return false;
|
||||
auto path = String::formatted("/sys/kernel/variables/{}", name);
|
||||
auto path = DeprecatedString::formatted("/sys/kernel/variables/{}", name);
|
||||
auto file = Core::Stream::File::open(path, Core::Stream::OpenMode::Write);
|
||||
if (file.is_error()) {
|
||||
warnln("Failed to open {}: {}", path, file.error());
|
||||
|
|
|
@ -32,7 +32,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
if (path == "-"sv) {
|
||||
stream = stdin;
|
||||
} else {
|
||||
stream = fopen(String(path).characters(), "r");
|
||||
stream = fopen(DeprecatedString(path).characters(), "r");
|
||||
if (!stream) {
|
||||
warnln("Failed to open {}: {}", path, strerror(errno));
|
||||
continue;
|
||||
|
@ -56,7 +56,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
TRY(Core::System::pledge("stdio"));
|
||||
|
||||
for (auto* stream : streams) {
|
||||
Vector<String> lines;
|
||||
Vector<DeprecatedString> lines;
|
||||
for (;;) {
|
||||
size_t n = 0;
|
||||
errno = 0;
|
||||
|
|
|
@ -36,7 +36,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
StringView archive_file;
|
||||
bool dereference;
|
||||
StringView directory;
|
||||
Vector<String> paths;
|
||||
Vector<DeprecatedString> paths;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_option(create, "Create archive", "create", 'c');
|
||||
|
@ -89,16 +89,16 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
auto tar_stream = TRY(Archive::TarInputStream::construct(move(input_stream)));
|
||||
|
||||
HashMap<String, String> global_overrides;
|
||||
HashMap<String, String> local_overrides;
|
||||
HashMap<DeprecatedString, DeprecatedString> global_overrides;
|
||||
HashMap<DeprecatedString, DeprecatedString> local_overrides;
|
||||
|
||||
auto get_override = [&](StringView key) -> Optional<String> {
|
||||
Optional<String> maybe_local = local_overrides.get(key);
|
||||
auto get_override = [&](StringView key) -> Optional<DeprecatedString> {
|
||||
Optional<DeprecatedString> maybe_local = local_overrides.get(key);
|
||||
|
||||
if (maybe_local.has_value())
|
||||
return maybe_local;
|
||||
|
||||
Optional<String> maybe_global = global_overrides.get(key);
|
||||
Optional<DeprecatedString> maybe_global = global_overrides.get(key);
|
||||
|
||||
if (maybe_global.has_value())
|
||||
return maybe_global;
|
||||
|
@ -162,13 +162,13 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
LexicalPath path = LexicalPath(header.filename());
|
||||
if (!header.prefix().is_empty())
|
||||
path = path.prepend(header.prefix());
|
||||
String filename = get_override("path"sv).value_or(path.string());
|
||||
DeprecatedString filename = get_override("path"sv).value_or(path.string());
|
||||
|
||||
if (list || verbose)
|
||||
outln("{}", filename);
|
||||
|
||||
if (extract) {
|
||||
String absolute_path = Core::File::absolute_path(filename);
|
||||
DeprecatedString absolute_path = Core::File::absolute_path(filename);
|
||||
auto parent_path = LexicalPath(absolute_path).parent();
|
||||
auto header_mode = TRY(header.mode());
|
||||
|
||||
|
@ -239,7 +239,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
OutputStream& gzip_output_stream = gzip_stream;
|
||||
Archive::TarOutputStream tar_stream((gzip) ? gzip_output_stream : file_output_stream);
|
||||
|
||||
auto add_file = [&](String path) -> ErrorOr<void> {
|
||||
auto add_file = [&](DeprecatedString path) -> ErrorOr<void> {
|
||||
auto file = Core::File::construct(path);
|
||||
if (!file->open(Core::OpenMode::ReadOnly)) {
|
||||
warnln("Failed to open {}: {}", path, file->error_string());
|
||||
|
@ -255,7 +255,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
return {};
|
||||
};
|
||||
|
||||
auto add_link = [&](String path) -> ErrorOr<void> {
|
||||
auto add_link = [&](DeprecatedString path) -> ErrorOr<void> {
|
||||
auto statbuf = TRY(Core::System::lstat(path));
|
||||
|
||||
auto canonicalized_path = LexicalPath::canonicalized_path(path);
|
||||
|
@ -266,7 +266,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
return {};
|
||||
};
|
||||
|
||||
auto add_directory = [&](String path, auto handle_directory) -> ErrorOr<void> {
|
||||
auto add_directory = [&](DeprecatedString path, auto handle_directory) -> ErrorOr<void> {
|
||||
auto statbuf = TRY(Core::System::lstat(path));
|
||||
|
||||
auto canonicalized_path = LexicalPath::canonicalized_path(path);
|
||||
|
|
|
@ -21,8 +21,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
Core::ArgsParser args_parser;
|
||||
|
||||
String origin;
|
||||
String url_string;
|
||||
DeprecatedString origin;
|
||||
DeprecatedString url_string;
|
||||
|
||||
args_parser.add_positional_argument(url_string, "URL to connect to", "url", Core::ArgsParser::Required::Yes);
|
||||
args_parser.add_option(origin, "URL to use as origin", "origin", 'o', "origin");
|
||||
|
@ -63,7 +63,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
outln("[Received binary data : {} bytes]", message.data.size());
|
||||
return;
|
||||
}
|
||||
outln("[Received utf8 text] {}", String(ReadonlyBytes(message.data)));
|
||||
outln("[Received utf8 text] {}", DeprecatedString(ReadonlyBytes(message.data)));
|
||||
};
|
||||
socket->on_close = [&](auto code, auto message, bool was_clean) {
|
||||
outln("[Server {} closed connection : '{}' (code {})]",
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/String.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/Stream.h>
|
||||
#include <LibMain/Main.h>
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue