summaryrefslogtreecommitdiff
path: root/Libraries/LibCore
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-03-08 10:36:51 +0100
committerAndreas Kling <kling@serenityos.org>2020-03-08 13:06:51 +0100
commitb1058b33fb32cb398d1723eb6fe59c27dc7967cc (patch)
tree49f0e5af7b7e37afd80a6dedf655917bf51ed915 /Libraries/LibCore
parentb98d8ad5b01c41efff24faffe94918435194257a (diff)
downloadserenity-b1058b33fb32cb398d1723eb6fe59c27dc7967cc.zip
AK: Add global FlatPtr typedef. It's u32 or u64, based on sizeof(void*)
Use this instead of uintptr_t throughout the codebase. This makes it possible to pass a FlatPtr to something that has u32 and u64 overloads.
Diffstat (limited to 'Libraries/LibCore')
-rw-r--r--Libraries/LibCore/EventLoop.cpp8
-rw-r--r--Libraries/LibCore/Object.cpp4
2 files changed, 6 insertions, 6 deletions
diff --git a/Libraries/LibCore/EventLoop.cpp b/Libraries/LibCore/EventLoop.cpp
index 74532d6b44..c79f73e7a4 100644
--- a/Libraries/LibCore/EventLoop.cpp
+++ b/Libraries/LibCore/EventLoop.cpp
@@ -164,9 +164,9 @@ public:
}
if (type == "SetInspectedObject") {
- auto address = request.get("address").to_number<uintptr_t>();
+ auto address = request.get("address").to_number<FlatPtr>();
for (auto& object : Object::all_objects()) {
- if ((uintptr_t)&object == address) {
+ if ((FlatPtr)&object == address) {
if (m_inspected_object)
m_inspected_object->decrement_inspector_count({});
m_inspected_object = object.make_weak_ptr();
@@ -178,9 +178,9 @@ public:
}
if (type == "SetProperty") {
- auto address = request.get("address").to_number<uintptr_t>();
+ auto address = request.get("address").to_number<FlatPtr>();
for (auto& object : Object::all_objects()) {
- if ((uintptr_t)&object == address) {
+ if ((FlatPtr)&object == address) {
bool success = object.set_property(request.get("name").to_string(), request.get("value"));
JsonObject response;
response.set("type", "SetProperty");
diff --git a/Libraries/LibCore/Object.cpp b/Libraries/LibCore/Object.cpp
index c503a23d02..1321230317 100644
--- a/Libraries/LibCore/Object.cpp
+++ b/Libraries/LibCore/Object.cpp
@@ -168,9 +168,9 @@ void Object::deferred_invoke(Function<void(Object&)> invokee)
void Object::save_to(JsonObject& json)
{
json.set("class_name", class_name());
- json.set("address", (uintptr_t)this);
+ json.set("address", (FlatPtr)this);
json.set("name", name());
- json.set("parent", (uintptr_t)parent());
+ json.set("parent", (FlatPtr)parent());
}
bool Object::set_property(const StringView& name, const JsonValue& value)