1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:08:12 +00:00

LibCore: Make IODevice::read_line() return a String

Almost everyone using this API actually wanted String instead of a
ByteBuffer anyway, and there were a bunch of slightly different ways
clients would convert to String.

Let's just cut out all the confusion and make it return String. :^)
This commit is contained in:
Andreas Kling 2020-12-13 11:44:53 +01:00
parent 4da327d650
commit b9b7b2b28a
22 changed files with 50 additions and 66 deletions

View file

@ -71,9 +71,9 @@ void Job::on_socket_connected()
return deferred_invoke([this](auto&) { did_fail(Core::NetworkJob::Error::TransmissionFailed); });
}
auto parts = String::copy(line, Chomp).split_limit(' ', 2);
auto parts = line.split_limit(' ', 2);
if (parts.size() != 2) {
fprintf(stderr, "Job: Expected 2-part status line, got '%s'\n", line.data());
warnln("Job: Expected 2-part status line, got '{}'", line);
return deferred_invoke([this](auto&) { did_fail(Core::NetworkJob::Error::ProtocolFailed); });
}