Skip to content

Commit 18d1346

Browse files
committed
add total bytes to progrez indication call
1 parent 9645f05 commit 18d1346

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/blar.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -858,27 +858,31 @@ static bool collect_entries_recurse(const char *path, entry_list_t *el) {
858858
* Expanded entries replace the original at its index (DIR entry) and
859859
* append child entries at the end of the list. */
860860
static bool expand_containers_pass(entry_list_t *el) {
861-
/* Count expandable files for progress */
861+
/* Count expandable files and their total bytes for progress */
862862
size_t expandable = 0;
863+
uint64_t total_expandable_bytes = 0;
863864
for (size_t i = 0; i < el->count; i++) {
864865
if (el->entries[i].is_dir) continue;
865866
const uint8_t *content = el->entries[i].content;
866867
size_t content_len = el->entries[i].content_len;
867868
if (content_len >= 4 && blip_is_zip(content, content_len) &&
868869
(el->expand_all_zips || !is_archive_extension(el->entries[i].path))) {
869870
expandable++;
871+
total_expandable_bytes += content_len;
870872
} else if (content_len >= 5 && blip_is_pdf(content, content_len)) {
871873
expandable++;
874+
total_expandable_bytes += content_len;
872875
} else if (content_len >= 8 && blip_is_png(content, content_len)) {
873876
expandable++;
877+
total_expandable_bytes += content_len;
874878
}
875879
}
876880
if (expandable == 0) return true;
877881

878882
/* Set up progress for expansion phase */
879883
if (el->progress) {
880884
progrez_set_label(el->progress, "Expanding");
881-
progrez_set_determinate(el->progress, expandable, 0);
885+
progrez_set_determinate(el->progress, expandable, total_expandable_bytes);
882886
progrez_update(el->progress, 0, 0);
883887
}
884888

0 commit comments

Comments
 (0)