From 7a0ab6ffa99533bc241c88b8761fb82d795dc832 Mon Sep 17 00:00:00 2001 From: Josh Ferrell Date: Wed, 21 Aug 2024 10:30:46 -0400 Subject: Add progress context to load APIs --- binaryview.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'binaryview.cpp') diff --git a/binaryview.cpp b/binaryview.cpp index 2f24904d..9c1373c1 100644 --- a/binaryview.cpp +++ b/binaryview.cpp @@ -5427,7 +5427,9 @@ Ref BinaryNinja::Load(Ref view, bool updateAnalysis, Ref BinaryNinja::Load(const std::string& filename, bool updateAnalysis, const std::string& options, std::function progress) { - BNBinaryView* handle = BNLoadFilename(filename.c_str(), updateAnalysis, options.c_str(), (bool (*)(size_t, size_t))progress.target()); + ProgressContext cb; + cb.callback = progress; + BNBinaryView* handle = BNLoadFilename(filename.c_str(), updateAnalysis, options.c_str(), ProgressCallback, &cb); if (!handle) return nullptr; return new BinaryView(handle); @@ -5444,7 +5446,9 @@ Ref BinaryNinja::Load(const DataBuffer& rawData, bool updateAnalysis Ref BinaryNinja::Load(Ref view, bool updateAnalysis, const std::string& options, std::function progress) { - BNBinaryView* handle = BNLoadBinaryView(view->GetObject(), updateAnalysis, options.c_str(), (bool (*)(size_t, size_t))progress.target()); + ProgressContext cb; + cb.callback = progress; + BNBinaryView* handle = BNLoadBinaryView(view->GetObject(), updateAnalysis, options.c_str(), ProgressCallback, &cb); if (!handle) return nullptr; return new BinaryView(handle); -- cgit v1.3.1