diff options
| -rw-r--r-- | binaryninjaapi.h | 19 | ||||
| -rw-r--r-- | binaryninjacore.h | 19 | ||||
| -rw-r--r-- | database.cpp | 2 | ||||
| -rw-r--r-- | filemetadata.cpp | 30 | ||||
| -rw-r--r-- | python/filemetadata.py | 15 | ||||
| -rw-r--r-- | undoaction.cpp | 11 |
6 files changed, 7 insertions, 89 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h index 637aeb10..f0f3ce89 100644 --- a/binaryninjaapi.h +++ b/binaryninjaapi.h @@ -1687,26 +1687,12 @@ namespace BinaryNinja { struct UndoEntry { Ref<User> user; - std::string hash; + std::string id; std::vector<UndoAction> actions; uint64_t timestamp; }; /*! - - \ingroup coreapi - */ - struct MergeResult - { - BNMergeStatus status; - UndoAction action; - std::string hash; - - MergeResult() : status(NOT_APPLICABLE) {} - MergeResult(const BNMergeResult& result); - }; - - /*! \ingroup filemetadata */ class SaveSettings : public CoreRefCountObject<BNSaveSettings, BNNewSaveSettingsReference, BNFreeSaveSettings> @@ -1877,9 +1863,6 @@ namespace BinaryNinja { bool CreateSnapshotedView(BinaryView* data, const std::string& viewName, const std::function<bool(size_t progress, size_t total)>& progressCallback); - MergeResult MergeUserAnalysis(const std::string& name, const std::function<bool(size_t, size_t)>& progress, - const std::vector<std::string> excludedHashes = {}); - /*! Start recording actions taken so they can be undone at some point */ void BeginUndoActions(); diff --git a/binaryninjacore.h b/binaryninjacore.h index a87a5535..f2cc350e 100644 --- a/binaryninjacore.h +++ b/binaryninjacore.h @@ -2026,26 +2026,12 @@ extern "C" { bool valid; BNUser* user; - char* hash; + char* id; BNUndoAction* actions; uint64_t actionCount; uint64_t timestamp; }; - enum BNMergeStatus - { - NOT_APPLICABLE = 0, - OK = 1, - CONFLICT = 2 - }; - - struct BNMergeResult - { - BNMergeStatus status; - BNUndoAction action; - const char* hash; - }; - struct BNCallingConventionWithConfidence { BNCallingConvention* convention; @@ -3240,9 +3226,6 @@ extern "C" BINARYNINJACOREAPI bool BNCreateSnapshotedViewWithProgress(BNBinaryView* data, const char* viewName, void* ctxt, bool (*progress)(void* ctxt, size_t progress, size_t total)); - BINARYNINJACOREAPI BNMergeResult BNMergeUserAnalysis(BNFileMetadata* file, const char* name, void* ctxt, - bool (*progress)(void* ctxt, size_t progress, size_t total), char** excludedHashes, size_t excludedHashesCount); - BINARYNINJACOREAPI char* BNGetOriginalFilename(BNFileMetadata* file); BINARYNINJACOREAPI void BNSetOriginalFilename(BNFileMetadata* file, const char* name); diff --git a/database.cpp b/database.cpp index 34a57630..887cdea7 100644 --- a/database.cpp +++ b/database.cpp @@ -300,7 +300,7 @@ vector<UndoEntry> Snapshot::GetUndoEntries(const std::function<bool(size_t, size { UndoEntry temp; temp.timestamp = entries[i].timestamp; - temp.hash = entries[i].hash; + temp.id = entries[i].id; temp.user = new User(BNNewUserReference(entries[i].user)); size_t actionCount = entries[i].actionCount; for (size_t actionIndex = 0; actionIndex < actionCount; actionIndex++) diff --git a/filemetadata.cpp b/filemetadata.cpp index b6a839b6..0a12eb00 100644 --- a/filemetadata.cpp +++ b/filemetadata.cpp @@ -270,28 +270,6 @@ bool FileMetadata::CreateSnapshotedView(BinaryView* data, const std::string& vie } -MergeResult FileMetadata::MergeUserAnalysis( - const std::string& name, const std::function<bool(size_t, size_t)>& progress, std::vector<string> excludedHashes) -{ - size_t numHashes = excludedHashes.size(); - char** tempList = new char*[numHashes]; - for (size_t i = 0; i < numHashes; i++) - tempList[i] = BNAllocString(excludedHashes[i].c_str()); - - ProgressContext cb; - cb.callback = progress; - - BNMergeResult bnResult = - BNMergeUserAnalysis(m_object, name.c_str(), &cb, ProgressCallback, tempList, numHashes); - MergeResult result(bnResult); - - for (size_t i = 0; i < numHashes; i++) - BNFreeString(tempList[i]); - delete[] tempList; - return result; -} - - void FileMetadata::BeginUndoActions() { BNBeginUndoActions(m_object); @@ -355,7 +333,7 @@ vector<UndoEntry> FileMetadata::GetUndoEntries() continue; UndoEntry temp; temp.timestamp = entries[i].timestamp; - temp.hash = entries[i].hash; + temp.id = entries[i].id; temp.user = new User(BNNewUserReference(entries[i].user)); size_t actionCount = entries[i].actionCount; for (size_t actionIndex = 0; actionIndex < actionCount; actionIndex++) @@ -383,7 +361,7 @@ vector<UndoEntry> FileMetadata::GetRedoEntries() continue; UndoEntry temp; temp.timestamp = entries[i].timestamp; - temp.hash = entries[i].hash; + temp.id = entries[i].id; temp.user = new User(BNNewUserReference(entries[i].user)); size_t actionCount = entries[i].actionCount; for (size_t actionIndex = 0; actionIndex < actionCount; actionIndex++) @@ -407,7 +385,7 @@ std::optional<UndoEntry> FileMetadata::GetLastUndoEntry() UndoEntry entry; entry.timestamp = bnEntry.timestamp; - entry.hash = bnEntry.hash; + entry.id = bnEntry.id; entry.user = new User(BNNewUserReference(bnEntry.user)); size_t actionCount = bnEntry.actionCount; for (size_t actionIndex = 0; actionIndex < actionCount; actionIndex++) @@ -428,7 +406,7 @@ std::optional<UndoEntry> FileMetadata::GetLastRedoEntry() UndoEntry entry; entry.timestamp = bnEntry.timestamp; - entry.hash = bnEntry.hash; + entry.id = bnEntry.id; entry.user = new User(BNNewUserReference(bnEntry.user)); size_t actionCount = bnEntry.actionCount; for (size_t actionIndex = 0; actionIndex < actionCount; actionIndex++) diff --git a/python/filemetadata.py b/python/filemetadata.py index 5f59bcc7..d7330514 100644 --- a/python/filemetadata.py +++ b/python/filemetadata.py @@ -484,21 +484,6 @@ class FileMetadata: ctypes.c_ulonglong)(lambda ctxt, cur, total: _progress_func(cur, total)), _settings ) - def merge_user_analysis( - self, path: str, progress_func: ProgressFuncType, excluded_hashes: Optional[List[str]] = None - ): - if excluded_hashes is None: - excluded_hashes = [] - excluded = (ctypes.c_char_p * len(excluded_hashes))() - for i in range(len(excluded_hashes)): - excluded[i] = core.cstr(excluded_hashes[i]) - return core.BNMergeUserAnalysis( - self.handle, str(path), None, - ctypes.CFUNCTYPE(None, ctypes.c_bool, ctypes.c_ulonglong, - ctypes.c_ulonglong)(lambda ctxt, cur, total: progress_func(cur, total)), excluded, - len(excluded_hashes) - ) - def get_view_of_type(self, name: str) -> Optional['binaryview.BinaryView']: view = core.BNGetFileViewOfType(self.handle, str(name)) if view is None: diff --git a/undoaction.cpp b/undoaction.cpp index 99196280..73caa5bc 100644 --- a/undoaction.cpp +++ b/undoaction.cpp @@ -35,14 +35,3 @@ UndoAction::UndoAction(const BNUndoAction& action) summaryTokens.push_back(action.summaryTokens[i]); } } - - -MergeResult::MergeResult(const BNMergeResult& result) -{ - status = result.status; - if (status == BNMergeStatus::CONFLICT) - { - action = result.action; - hash = result.hash; - } -}; |
