summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibCoredump
diff options
context:
space:
mode:
authorSam Atkins <atkinssj@serenityos.org>2022-12-21 17:26:59 +0000
committerTim Flynn <trflynn89@pm.me>2023-01-26 09:57:14 -0500
commit08f932259a58c75fd2ddc9d59f314f7ac52435ed (patch)
tree13a604348084a5442dd3fe82d204aba6a909308e /Userland/Libraries/LibCoredump
parent269ce258b49f8181dbb9eee57d4978791719a3a8 (diff)
downloadserenity-08f932259a58c75fd2ddc9d59f314f7ac52435ed.zip
LibCoreDump: Replace uses of JsonObject::get_deprecated()/get_ptr()
Diffstat (limited to 'Userland/Libraries/LibCoredump')
-rw-r--r--Userland/Libraries/LibCoredump/Reader.cpp27
1 files changed, 13 insertions, 14 deletions
diff --git a/Userland/Libraries/LibCoredump/Reader.cpp b/Userland/Libraries/LibCoredump/Reader.cpp
index a6cc8bc24e..5f84958909 100644
--- a/Userland/Libraries/LibCoredump/Reader.cpp
+++ b/Userland/Libraries/LibCoredump/Reader.cpp
@@ -196,35 +196,34 @@ Optional<MemoryRegionInfo> Reader::region_containing(FlatPtr address) const
int Reader::process_pid() const
{
auto process_info = this->process_info();
- auto pid = process_info.get_deprecated("pid"sv);
- return pid.to_number<int>();
+ auto pid = process_info.get_integer<int>("pid"sv).value_or(0);
+ return pid;
}
u8 Reader::process_termination_signal() const
{
auto process_info = this->process_info();
- auto termination_signal = process_info.get_deprecated("termination_signal"sv);
- auto signal_number = termination_signal.to_number<u8>();
- if (signal_number <= SIGINVAL || signal_number >= NSIG)
+ auto termination_signal = process_info.get_u8("termination_signal"sv);
+ if (!termination_signal.has_value() || *termination_signal <= SIGINVAL || *termination_signal >= NSIG)
return SIGINVAL;
- return signal_number;
+ return *termination_signal;
}
DeprecatedString Reader::process_executable_path() const
{
auto process_info = this->process_info();
- auto executable_path = process_info.get_deprecated("executable_path"sv);
- return executable_path.as_string_or({});
+ auto executable_path = process_info.get_deprecated_string("executable_path"sv);
+ return executable_path.value_or({});
}
Vector<DeprecatedString> Reader::process_arguments() const
{
auto process_info = this->process_info();
- auto arguments = process_info.get_deprecated("arguments"sv);
- if (!arguments.is_array())
+ auto arguments = process_info.get_array("arguments"sv);
+ if (!arguments.has_value())
return {};
Vector<DeprecatedString> vector;
- arguments.as_array().for_each([&](auto& value) {
+ arguments->for_each([&](auto& value) {
if (value.is_string())
vector.append(value.as_string());
});
@@ -234,11 +233,11 @@ Vector<DeprecatedString> Reader::process_arguments() const
Vector<DeprecatedString> Reader::process_environment() const
{
auto process_info = this->process_info();
- auto environment = process_info.get_deprecated("environment"sv);
- if (!environment.is_array())
+ auto environment = process_info.get_array("environment"sv);
+ if (!environment.has_value())
return {};
Vector<DeprecatedString> vector;
- environment.as_array().for_each([&](auto& value) {
+ environment->for_each([&](auto& value) {
if (value.is_string())
vector.append(value.as_string());
});