mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:28:11 +00:00
AK: Make string-to-number conversion helpers return Optional
Get rid of the weird old signature: - int StringType::to_int(bool& ok) const And replace it with sensible new signature: - Optional<int> StringType::to_int() const
This commit is contained in:
parent
15f4043a7a
commit
fdfda6dec2
55 changed files with 354 additions and 455 deletions
|
@ -77,13 +77,13 @@ void Job::on_socket_connected()
|
|||
return deferred_invoke([this](auto&) { did_fail(Core::NetworkJob::Error::ProtocolFailed); });
|
||||
}
|
||||
|
||||
bool ok;
|
||||
m_status = parts[0].to_uint(ok);
|
||||
if (!ok) {
|
||||
auto status = parts[0].to_uint();
|
||||
if (!status.has_value()) {
|
||||
fprintf(stderr, "Job: Expected numeric status code\n");
|
||||
return deferred_invoke([this](auto&) { did_fail(Core::NetworkJob::Error::ProtocolFailed); });
|
||||
}
|
||||
|
||||
m_status = status.value();
|
||||
m_meta = parts[1];
|
||||
|
||||
if (m_status >= 10 && m_status < 20) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue