diff options
| author | Glenn Smith <glenn@vector35.com> | 2022-09-26 17:07:52 -0400 |
|---|---|---|
| committer | Glenn Smith <glenn@vector35.com> | 2022-09-29 21:02:25 -0400 |
| commit | 571d4ed2f01c1117237b1a9684ad9b1d1ad8963a (patch) | |
| tree | d63530c2510fc123496e7550625e7ebfc8c594f5 /binaryview.cpp | |
| parent | b6442a914783cb2861ff8d1cd6a3865fed29e0f7 (diff) | |
DebugInfo: make parseInfo have a progress callback
This will enable us to have progress bars and cancellation of debuginfo application
Diffstat (limited to 'binaryview.cpp')
| -rw-r--r-- | binaryview.cpp | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/binaryview.cpp b/binaryview.cpp index 8c6080d0..e8c080df 100644 --- a/binaryview.cpp +++ b/binaryview.cpp @@ -3494,12 +3494,6 @@ void BinaryView::DefineUserType(const QualifiedName& name, Ref<Type> type) } -struct ProgressCallback -{ - std::function<bool(size_t, size_t)> func; -}; - - void BinaryView::DefineTypes(const vector<pair<string, QualifiedNameAndType>>& types, std::function<bool(size_t, size_t)> progress) { BNQualifiedNameTypeAndId* apiTypes = new BNQualifiedNameTypeAndId[types.size()]; @@ -3510,14 +3504,9 @@ void BinaryView::DefineTypes(const vector<pair<string, QualifiedNameAndType>>& t apiTypes[i].id = BNAllocString(types[i].first.c_str()); } - ProgressCallback cb; - cb.func = progress; - BNDefineAnalysisTypes(m_object, apiTypes, types.size(), [](void* ctxt, size_t cur, size_t total) { - ProgressCallback* cb = (ProgressCallback*)ctxt; - if (cb->func) - return cb->func(cur, total); - return true; - }, &cb); + ProgressContext cb; + cb.callback = progress; + BNDefineAnalysisTypes(m_object, apiTypes, types.size(), ProgressCallback, &cb); for (size_t i = 0; i < types.size(); i++) { @@ -3537,14 +3526,9 @@ void BinaryView::DefineUserTypes(const vector<QualifiedNameAndType>& types, std: apiTypes[i].type = types[i].type->GetObject(); } - ProgressCallback cb; - cb.func = progress; - BNDefineUserAnalysisTypes(m_object, apiTypes, types.size(), [](void* ctxt, size_t cur, size_t total) { - ProgressCallback* cb = (ProgressCallback*)ctxt; - if (cb->func) - return cb->func(cur, total); - return true; - }, &cb); + ProgressContext cb; + cb.callback = progress; + BNDefineUserAnalysisTypes(m_object, apiTypes, types.size(), ProgressCallback, &cb); for (size_t i = 0; i < types.size(); i++) { |
