Skip to content

Commit

Permalink
Simplify code
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoffland committed Dec 22, 2024
1 parent 1739d90 commit cc3168a
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/fah/client/Core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ void Core::next() {

void Core::ready() {
state = CORE_READY;
for (unsigned i = 0; i < progressCBs.size(); i++) progressCBs[i](1, 1);
for (auto &cb: progressCBs) cb(1, 1);
progressCBs.clear(); // Release callbacks
}

Expand Down Expand Up @@ -202,11 +202,8 @@ void Core::download(const string &url) {
// Monitor download progress
Progress::callback_t progressCB =
[this] (const Progress &p) {
unsigned bytes = p.getTotal();
unsigned size = p.getSize();

for (unsigned i = 0; i < progressCBs.size(); i++)
progressCBs[i](bytes, size);
for (auto &cb: progressCBs)
cb(p.getTotal(), p.getSize());
};

HTTP::Client::callback_t cb = [this] (HTTP::Request &req) {response(req);};
Expand Down

0 comments on commit cc3168a

Please sign in to comment.