From 93bb3e8cf9ef789b5fdbf321815ed6108291786c Mon Sep 17 00:00:00 2001 From: Brian Potchik Date: Fri, 2 Aug 2019 22:05:36 -0400 Subject: Refactor settings system to be reference counted. --- binaryview.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'binaryview.cpp') diff --git a/binaryview.cpp b/binaryview.cpp index 553ce251..c62b434e 100644 --- a/binaryview.cpp +++ b/binaryview.cpp @@ -2977,18 +2977,18 @@ uint64_t BinaryView::GetUIntMetadata(const string& key) } -string BinaryView::GetLoadSettings(string typeName) +Ref BinaryView::GetLoadSettings(string typeName) { - char* name = BNBinaryViewGetLoadSettings(m_object, typeName.c_str()); - string result = name; - BNFreeString(name); - return result; + BNSettings* settings = BNBinaryViewGetLoadSettings(m_object, typeName.c_str()); + if (!settings) + return nullptr; + return new Settings(settings); } -void BinaryView::SetLoadSettings(string typeName, string loadSettings) +void BinaryView::SetLoadSettings(string typeName, Ref settings) { - BNBinaryViewSetLoadSettings(m_object, typeName.c_str(), loadSettings.c_str()); + BNBinaryViewSetLoadSettings(m_object, typeName.c_str(), settings->GetObject()); } -- cgit v1.3.1