diff --git a/AK/Tests/TestNumberFormat.cpp b/AK/Tests/TestNumberFormat.cpp index f78e87bbebe..a6805a4f492 100644 --- a/AK/Tests/TestNumberFormat.cpp +++ b/AK/Tests/TestNumberFormat.cpp @@ -135,13 +135,13 @@ void actual_extremes_8byte(); template<> void actual_extremes_8byte<4>() { - warn() << "(Skipping 8-byte-size_t test)"; + warnln("(Skipping 8-byte-size_t test)"); } template<> void actual_extremes_8byte<8>() { - warn() << "(Running true 8-byte-size_t test)"; + warnln("(Running true 8-byte-size_t test)"); // Your editor might show "implicit conversion" warnings here. // This is because your editor thinks the world is 32-bit, but it isn't. EXPECT_EQ(human_readable_size(0x100000000ULL), "4.0 GiB"); diff --git a/Applications/Browser/main.cpp b/Applications/Browser/main.cpp index e96a93fdceb..764ab49d856 100644 --- a/Applications/Browser/main.cpp +++ b/Applications/Browser/main.cpp @@ -63,7 +63,7 @@ static String bookmarks_file_path() int main(int argc, char** argv) { if (getuid() == 0) { - warn() << "Refusing to run as root"; + warnln("Refusing to run as root"); return 1; } diff --git a/Userland/Tests/LibC/snprintf-correctness.cpp b/Userland/Tests/LibC/snprintf-correctness.cpp index dee19fe2c7d..4a29d0ff812 100644 --- a/Userland/Tests/LibC/snprintf-correctness.cpp +++ b/Userland/Tests/LibC/snprintf-correctness.cpp @@ -46,7 +46,7 @@ static String show(const ByteBuffer& buf) { StringBuilder builder; for (size_t i = 0; i < buf.size(); ++i) { - builder.appendf("%02x", buf[i]); + builder.appendff("{:02x}", buf[i]); } builder.append(' '); builder.append('('); @@ -66,8 +66,7 @@ static bool test_single(const Testcase& testcase) { // Preconditions: if (testcase.dest_n != testcase.dest_expected_n) { - fprintf(stderr, "dest length %zu != expected dest length %zu? Check testcase! (Probably miscounted.)\n", - testcase.dest_n, testcase.dest_expected_n); + warnln("dest length {} != expected dest length {}? Check testcase! (Probably miscounted.)", testcase.dest_n, testcase.dest_expected_n); return false; } @@ -93,33 +92,29 @@ static bool test_single(const Testcase& testcase) // Evaluate gravity: if (buf_ok && (!canary_1_ok || !main_ok || !canary_2_ok)) { - fprintf(stderr, "Internal error! (%d != %d | %d | %d)\n", - buf_ok, canary_1_ok, main_ok, canary_2_ok); + warnln("Internal error! ({} != {} | {} | {})", buf_ok, canary_1_ok, main_ok, canary_2_ok); buf_ok = false; } if (!canary_1_ok) { - warn() << "Canary 1 overwritten: Expected canary " - << show(expected.slice_view(0, SANDBOX_CANARY_SIZE)) - << ", got " - << show(actual.slice_view(0, SANDBOX_CANARY_SIZE)) - << " instead!"; + warnln("Canary 1 overwritten: Expected {}\n" + " instead got {}", + show(expected.slice_view(0, SANDBOX_CANARY_SIZE)), + show(actual.slice_view(0, SANDBOX_CANARY_SIZE))); } if (!main_ok) { - warn() << "Wrong output: Expected " - << show(expected.slice_view(SANDBOX_CANARY_SIZE, testcase.dest_n)) - << "\n instead, got " // visually align - << show(actual.slice_view(SANDBOX_CANARY_SIZE, testcase.dest_n)); + warnln("Wrong output: Expected {}\n" + " instead, got {}", + show(expected.slice_view(SANDBOX_CANARY_SIZE, testcase.dest_n)), + show(actual.slice_view(SANDBOX_CANARY_SIZE, testcase.dest_n))); } if (!canary_2_ok) { - warn() << "Canary 2 overwritten: Expected " - << show(expected.slice_view(SANDBOX_CANARY_SIZE + testcase.dest_n, SANDBOX_CANARY_SIZE)) - << ", got " - << show(actual.slice_view(SANDBOX_CANARY_SIZE + testcase.dest_n, SANDBOX_CANARY_SIZE)) - << " instead!"; + warnln("Canary 2 overwritten: Expected {}\n" + " instead, got {}", + show(expected.slice_view(SANDBOX_CANARY_SIZE + testcase.dest_n, SANDBOX_CANARY_SIZE)), + show(actual.slice_view(SANDBOX_CANARY_SIZE + testcase.dest_n, SANDBOX_CANARY_SIZE))); } if (!return_ok) { - fprintf(stderr, "Wrong return value: Expected %d, got %d instead!\n", - testcase.expected_return, actual_return); + warnln("Wrong return value: Expected {}, got {} instead!", testcase.expected_return, actual_return); } return buf_ok && return_ok; diff --git a/Userland/Tests/LibC/strlcpy-correctness.cpp b/Userland/Tests/LibC/strlcpy-correctness.cpp index 5d5b27e7ac2..d36677a990e 100644 --- a/Userland/Tests/LibC/strlcpy-correctness.cpp +++ b/Userland/Tests/LibC/strlcpy-correctness.cpp @@ -46,7 +46,7 @@ static String show(const ByteBuffer& buf) { StringBuilder builder; for (size_t i = 0; i < buf.size(); ++i) { - builder.appendf("%02x", buf[i]); + builder.appendff("{:02x}", buf[i]); } builder.append(' '); builder.append('('); @@ -66,13 +66,11 @@ static bool test_single(const Testcase& testcase) { // Preconditions: if (testcase.dest_n != testcase.dest_expected_n) { - fprintf(stderr, "dest length %zu != expected dest length %zu? Check testcase! (Probably miscounted.)\n", - testcase.dest_n, testcase.dest_expected_n); + warnln("dest length {} != expected dest length {}? Check testcase! (Probably miscounted.)", testcase.dest_n, testcase.dest_expected_n); return false; } if (testcase.src_n != strlen(testcase.src)) { - fprintf(stderr, "src length %zu != actual src length %zu? src can't contain NUL bytes!\n", - testcase.src_n, strlen(testcase.src)); + warnln("src length {} != actual src length {}? src can't contain NUL bytes!", testcase.src_n, strlen(testcase.src)); return false; } @@ -98,33 +96,29 @@ static bool test_single(const Testcase& testcase) // Evaluate gravity: if (buf_ok && (!canary_1_ok || !main_ok || !canary_2_ok)) { - fprintf(stderr, "Internal error! (%d != %d | %d | %d)\n", - buf_ok, canary_1_ok, main_ok, canary_2_ok); + warnln("Internal error! ({} != {} | {} | {})", buf_ok, canary_1_ok, main_ok, canary_2_ok); buf_ok = false; } if (!canary_1_ok) { - warn() << "Canary 1 overwritten: Expected canary " - << show(expected.slice_view(0, SANDBOX_CANARY_SIZE)) - << ", got " - << show(actual.slice_view(0, SANDBOX_CANARY_SIZE)) - << " instead!"; + warnln("Canary 1 overwritten: Expected canary {}\n" + " instead got {}", + show(expected.slice_view(0, SANDBOX_CANARY_SIZE)), + show(actual.slice_view(0, SANDBOX_CANARY_SIZE))); } if (!main_ok) { - warn() << "Wrong output: Expected " - << show(expected.slice_view(SANDBOX_CANARY_SIZE, testcase.dest_n)) - << "\n instead, got " // visually align - << show(actual.slice_view(SANDBOX_CANARY_SIZE, testcase.dest_n)); + warnln("Wrong output: Expected {}\n" + " instead got {}", + show(expected.slice_view(SANDBOX_CANARY_SIZE, testcase.dest_n)), + show(actual.slice_view(SANDBOX_CANARY_SIZE, testcase.dest_n))); } if (!canary_2_ok) { - warn() << "Canary 2 overwritten: Expected " - << show(expected.slice_view(SANDBOX_CANARY_SIZE + testcase.dest_n, SANDBOX_CANARY_SIZE)) - << ", got " - << show(actual.slice_view(SANDBOX_CANARY_SIZE + testcase.dest_n, SANDBOX_CANARY_SIZE)) - << " instead!"; + warnln("Canary 2 overwritten: Expected {}\n" + " instead got {}", + show(expected.slice_view(SANDBOX_CANARY_SIZE + testcase.dest_n, SANDBOX_CANARY_SIZE)), + show(actual.slice_view(SANDBOX_CANARY_SIZE + testcase.dest_n, SANDBOX_CANARY_SIZE))); } if (!return_ok) { - fprintf(stderr, "Wrong return value: Expected %zu, got %zu instead!\n", - testcase.src_n, actual_return); + warnln("Wrong return value: Expected {}, got {} instead!", testcase.src_n, actual_return); } return buf_ok && return_ok; diff --git a/Userland/env.cpp b/Userland/env.cpp index 2af2dc2b6c6..5b925171bd1 100644 --- a/Userland/env.cpp +++ b/Userland/env.cpp @@ -58,7 +58,7 @@ int main(int argc, char** argv) String filepath = Core::find_executable_in_path(filename); if (filepath.is_null()) { - warn() << "no " << filename << " in path"; + warnln("no {} in path", filename); return 1; } diff --git a/Userland/tar.cpp b/Userland/tar.cpp index 926b3691f0c..75eb635da98 100644 --- a/Userland/tar.cpp +++ b/Userland/tar.cpp @@ -80,7 +80,7 @@ int main(int argc, char** argv) InputStream& gzip_input_stream = gzip_stream; Tar::TarStream tar_stream((gzip) ? gzip_input_stream : file_input_stream); if (!tar_stream.valid()) { - warn() << "the provided file is not a well-formatted ustar file"; + warnln("the provided file is not a well-formatted ustar file"); return 1; } for (; !tar_stream.finished(); tar_stream.advance()) { diff --git a/Userland/test_io.cpp b/Userland/test_io.cpp index a9775a673aa..316840a8e5f 100644 --- a/Userland/test_io.cpp +++ b/Userland/test_io.cpp @@ -298,7 +298,7 @@ static void test_rmdir_root() { int rc = rmdir("/"); if (rc != -1 || errno != EBUSY) { - warn() << "rmdir(/) didn't fail with EBUSY"; + warnln("rmdir(/) didn't fail with EBUSY"); ASSERT_NOT_REACHED(); } } diff --git a/Userland/utmpupdate.cpp b/Userland/utmpupdate.cpp index 4b475fd342c..04dff971aee 100644 --- a/Userland/utmpupdate.cpp +++ b/Userland/utmpupdate.cpp @@ -60,7 +60,7 @@ int main(int argc, char** argv) args_parser.parse(argc, argv); if (flag_create && flag_delete) { - warn() << "-c and -d are mutually exclusive"; + warnln("-c and -d are mutually exclusive"); return 1; } diff --git a/Userland/w.cpp b/Userland/w.cpp index fdaa20ac062..e2f47423021 100644 --- a/Userland/w.cpp +++ b/Userland/w.cpp @@ -65,13 +65,13 @@ int main() auto file_or_error = Core::File::open("/var/run/utmp", Core::IODevice::ReadOnly); if (file_or_error.is_error()) { - warn() << "Error: " << file_or_error.error(); + warnln("Error: {}", file_or_error.error()); return 1; } auto& file = *file_or_error.value(); auto json = JsonValue::from_string(file.read_all()); if (!json.has_value() || !json.value().is_object()) { - warn() << "Error: Could not parse /var/run/utmp"; + warnln("Error: Could not parse /var/run/utmp"); return 1; }