From 32e2ea658cd7e0966baea435fa5d46df8ed84a3b Mon Sep 17 00:00:00 2001 From: Glenn Smith Date: Tue, 13 Dec 2022 23:22:55 -0500 Subject: Move this api for consistency Sorry if you were using it (99.99% chance you weren't) --- binaryninjaapi.h | 2 +- binaryninjacore.h | 8 ++++---- database.cpp | 26 +++++++++++++------------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/binaryninjaapi.h b/binaryninjaapi.h index 6098510d..5027d283 100644 --- a/binaryninjaapi.h +++ b/binaryninjaapi.h @@ -1558,6 +1558,7 @@ namespace BinaryNinja { std::vector GetUndoEntries(const std::function& progress); Ref ReadData(); Ref ReadData(const std::function& progress); + bool StoreData(const Ref& data, const std::function& progress); bool HasAncestor(Ref other); }; @@ -1579,7 +1580,6 @@ namespace BinaryNinja { Ref GetCurrentSnapshot(); int64_t WriteSnapshotData(std::vector parents, Ref file, const std::string& name, const Ref& data, bool autoSave, const std::function& progress); - bool StoreDataForSnapshot(int64_t id, const Ref& data, const std::function& progress); void TrimSnapshot(int64_t id); void RemoveSnapshot(int64_t id); diff --git a/binaryninjacore.h b/binaryninjacore.h index 3044d4a4..3c7a8659 100644 --- a/binaryninjacore.h +++ b/binaryninjacore.h @@ -36,14 +36,14 @@ // Current ABI version for linking to the core. This is incremented any time // there are changes to the API that affect linking, including new functions, // new types, or modifications to existing functions or types. -#define BN_CURRENT_CORE_ABI_VERSION 29 +#define BN_CURRENT_CORE_ABI_VERSION 30 // Minimum ABI version that is supported for loading of plugins. Plugins that // are linked to an ABI version less than this will not be able to load and // will require rebuilding. The minimum version is increased when there are // incompatible changes that break binary compatibility, such as changes to // existing types or functions. -#define BN_MINIMUM_CORE_ABI_VERSION 29 +#define BN_MINIMUM_CORE_ABI_VERSION 30 #ifdef __GNUC__ #ifdef BINARYNINJACORE_LIBRARY @@ -3177,8 +3177,6 @@ extern "C" BINARYNINJACOREAPI int64_t BNWriteDatabaseSnapshotData(BNDatabase* database, int64_t* parents, size_t parentCount, BNBinaryView* file, const char* name, BNKeyValueStore* data, bool autoSave, void* ctxt, bool (*progress)(void*, size_t, size_t)); - BINARYNINJACOREAPI bool BNStoreDataForSnapshot(BNDatabase* database, int64_t id, BNKeyValueStore* data, - void* ctxt, bool (*progress)(void*, size_t, size_t)); BINARYNINJACOREAPI bool BNTrimDatabaseSnapshot(BNDatabase* database, int64_t id); BINARYNINJACOREAPI bool BNRemoveDatabaseSnapshot(BNDatabase* database, int64_t id); BINARYNINJACOREAPI char** BNGetDatabaseGlobalKeys(BNDatabase* database, size_t* count); @@ -3215,6 +3213,8 @@ extern "C" BINARYNINJACOREAPI BNUndoEntry* BNGetSnapshotUndoEntriesWithProgress( BNSnapshot* snapshot, void* ctxt, bool (*progress)(void* ctxt, size_t progress, size_t total), size_t* count); BINARYNINJACOREAPI bool BNSnapshotHasAncestor(BNSnapshot* snapshot, BNSnapshot* other); + BINARYNINJACOREAPI bool BNSnapshotStoreData(BNSnapshot* snapshot, BNKeyValueStore* data, + void* ctxt, bool (*progress)(void*, size_t, size_t)); BINARYNINJACOREAPI bool BNRebase(BNBinaryView* data, uint64_t address); diff --git a/database.cpp b/database.cpp index 4f284f15..af2a8a29 100644 --- a/database.cpp +++ b/database.cpp @@ -334,6 +334,19 @@ Ref Snapshot::ReadData(const std::function& } +bool Snapshot::StoreData(const Ref& data, const std::function& progress) +{ + ProgressContext pctxt; + pctxt.callback = progress; + bool result = BNSnapshotStoreData(m_object, data->GetObject(), &pctxt, ProgressCallback); + if (!result) + { + throw DatabaseException("BNSnapshotStoreData"); + } + return result; +} + + bool Snapshot::HasAncestor(Ref other) { return BNSnapshotHasAncestor(m_object, other->GetObject()); @@ -396,19 +409,6 @@ int64_t Database::WriteSnapshotData(std::vector parents, Ref& data, const std::function& progress) -{ - ProgressContext pctxt; - pctxt.callback = progress; - bool result = BNStoreDataForSnapshot(m_object, id, data->GetObject(), &pctxt, ProgressCallback); - if (!result) - { - throw DatabaseException("BNStoreDataForSnapshot"); - } - return result; -} - - void Database::TrimSnapshot(int64_t id) { if (!BNTrimDatabaseSnapshot(m_object, id)) -- cgit v1.3.1