From 1fc3cd833f19ffa534f04caf541e88042124fd91 Mon Sep 17 00:00:00 2001 From: Alexander Taylor Date: Tue, 25 Feb 2025 20:32:24 -0500 Subject: Remove platform registration API footgun. Turns out, you can just pass this thing an architecture that is *completely* different from the one in the platform you are also passing in and it'll just happily do the wrong thing. While that's pretty wild, I'm in favor of not having to make this particular mistake again the next time I copy/paste some code, so we're now deprecating it. --- binaryviewtype.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'binaryviewtype.cpp') diff --git a/binaryviewtype.cpp b/binaryviewtype.cpp index 2ee8e2ac..d0479a11 100644 --- a/binaryviewtype.cpp +++ b/binaryviewtype.cpp @@ -174,6 +174,17 @@ Ref BinaryViewType::GetArchitecture(uint32_t id, BNEndianness endi } +void BinaryViewType::RegisterPlatform(const string& name, uint32_t id, Platform* platform) +{ + Ref type = BinaryViewType::GetByName(name); + if (!type) + return; + Ref arch = platform->GetArchitecture(); + if (!arch) + return; + type->RegisterPlatform(id, arch, platform); +} + void BinaryViewType::RegisterPlatform(const string& name, uint32_t id, Architecture* arch, Platform* platform) { Ref type = BinaryViewType::GetByName(name); -- cgit v1.3.1