From 0f6f924f277084429029ba69907d7d51770476e4 Mon Sep 17 00:00:00 2001 From: Rusty Wagner Date: Mon, 2 Nov 2015 23:10:07 -0500 Subject: Don't allow update to be aborted in critical path, and fixes for updating after manually overwriting a build --- binaryninjaapi.h | 4 ++-- update.cpp | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/binaryninjaapi.h b/binaryninjaapi.h index fe4acd30..7127eda8 100644 --- a/binaryninjaapi.h +++ b/binaryninjaapi.h @@ -1368,9 +1368,9 @@ namespace BinaryNinja BNUpdateResult UpdateToVersion(const std::string& version); BNUpdateResult UpdateToVersion(const std::string& version, - const std::function& progress); + const std::function& progress); BNUpdateResult UpdateToLatestVersion(); - BNUpdateResult UpdateToLatestVersion(const std::function& progress); + BNUpdateResult UpdateToLatestVersion(const std::function& progress); }; struct UpdateVersion diff --git a/update.cpp b/update.cpp index 1586c363..ca782f3e 100644 --- a/update.cpp +++ b/update.cpp @@ -8,12 +8,12 @@ namespace BinaryNinja { struct UpdateProgress { - function func; + function func; - static void UpdateCallback(void* ctxt, uint64_t progress, uint64_t total) + static bool UpdateCallback(void* ctxt, uint64_t progress, uint64_t total) { UpdateProgress* self = (UpdateProgress*)ctxt; - self->func(progress, total); + return self->func(progress, total); } }; } @@ -65,12 +65,12 @@ bool UpdateChannel::AreUpdatesAvailable() BNUpdateResult UpdateChannel::UpdateToVersion(const string& version) { - return UpdateToVersion(version, [](uint64_t, uint64_t){}); + return UpdateToVersion(version, [](uint64_t, uint64_t){ return true; }); } BNUpdateResult UpdateChannel::UpdateToVersion(const string& version, - const function& progress) + const function& progress) { UpdateProgress up; up.func = progress; @@ -92,11 +92,11 @@ BNUpdateResult UpdateChannel::UpdateToVersion(const string& version, BNUpdateResult UpdateChannel::UpdateToLatestVersion() { - return UpdateToLatestVersion([](uint64_t, uint64_t){}); + return UpdateToLatestVersion([](uint64_t, uint64_t){ return true; }); } -BNUpdateResult UpdateChannel::UpdateToLatestVersion(const function& progress) +BNUpdateResult UpdateChannel::UpdateToLatestVersion(const function& progress) { UpdateProgress up; up.func = progress; -- cgit v1.3.1