From b1058b33fb32cb398d1723eb6fe59c27dc7967cc Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 8 Mar 2020 10:36:51 +0100 Subject: 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. --- Libraries/LibCore/EventLoop.cpp | 8 ++++---- Libraries/LibCore/Object.cpp | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'Libraries/LibCore') 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(); + auto address = request.get("address").to_number(); 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(); + auto address = request.get("address").to_number(); 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 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) -- cgit v1.2.3