summaryrefslogtreecommitdiff
path: root/binaryview.cpp
diff options
context:
space:
mode:
authorBrian Potchik <brian@vector35.com>2019-08-02 22:05:36 -0400
committerBrian Potchik <brian@vector35.com>2019-08-02 22:05:36 -0400
commit93bb3e8cf9ef789b5fdbf321815ed6108291786c (patch)
tree85e86a6bb4e0728841e6e9d2fa08d0bbc3243e68 /binaryview.cpp
parent26d7d2f1d5daf50583b18fe59566f5d4436f79f2 (diff)
Refactor settings system to be reference counted.
Diffstat (limited to 'binaryview.cpp')
-rw-r--r--binaryview.cpp14
1 files changed, 7 insertions, 7 deletions
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<Settings> 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> settings)
{
- BNBinaryViewSetLoadSettings(m_object, typeName.c_str(), loadSettings.c_str());
+ BNBinaryViewSetLoadSettings(m_object, typeName.c_str(), settings->GetObject());
}