mirror of
https://github.com/upx/upx
synced 2025-09-28 19:06:07 +08:00
Small cleanups.
committer: mfx <mfx> 979748793 +0000
This commit is contained in:
parent
4a52be76fe
commit
342679b6d3
19
src/ui.cpp
19
src/ui.cpp
|
@ -60,12 +60,12 @@ struct UiPacker::State
|
||||||
|
|
||||||
// message stuff
|
// message stuff
|
||||||
char msg_buf[1+79+1];
|
char msg_buf[1+79+1];
|
||||||
int pos; // last progress bar position
|
int pos; // last progress bar position
|
||||||
int counter; // for spinner
|
unsigned spin_counter; // for spinner
|
||||||
|
|
||||||
int bar_pos;
|
int bar_pos;
|
||||||
int bar_len;
|
int bar_len;
|
||||||
int pass_digits; // number of digits needed to print total_passes
|
int pass_digits; // number of digits needed to print total_passes
|
||||||
|
|
||||||
#if defined(UI_USE_SCREEN)
|
#if defined(UI_USE_SCREEN)
|
||||||
screen_t *screen;
|
screen_t *screen;
|
||||||
|
@ -78,9 +78,6 @@ struct UiPacker::State
|
||||||
#else
|
#else
|
||||||
void *screen;
|
void *screen;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// debug
|
|
||||||
unsigned progress_updates;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -184,9 +181,8 @@ void UiPacker::startCallback(unsigned u_len, unsigned step,
|
||||||
|
|
||||||
s->bar_len = 64;
|
s->bar_len = 64;
|
||||||
s->pos = -2;
|
s->pos = -2;
|
||||||
s->counter = 0;
|
s->spin_counter = 0;
|
||||||
s->bar_pos = 1; // because of the leading `\r'
|
s->bar_pos = 1; // because of the leading `\r'
|
||||||
s->progress_updates = 0;
|
|
||||||
s->pass_digits = 0;
|
s->pass_digits = 0;
|
||||||
|
|
||||||
clear_cb();
|
clear_cb();
|
||||||
|
@ -323,7 +319,7 @@ void UiPacker::endCallback()
|
||||||
clear_cb();
|
clear_cb();
|
||||||
#if 0
|
#if 0
|
||||||
printf("callback: pass %d, step %6d, updates %6d\n",
|
printf("callback: pass %d, step %6d, updates %6d\n",
|
||||||
s->pass, s->step, s->progress_updates);
|
s->pass, s->step, s->spin_counter);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -403,12 +399,11 @@ void UiPacker::doCallback(unsigned isize, unsigned osize)
|
||||||
|
|
||||||
sprintf(m," %3d.%1d%% %c ",
|
sprintf(m," %3d.%1d%% %c ",
|
||||||
ratio / 10000, (ratio % 10000) / 1000,
|
ratio / 10000, (ratio % 10000) / 1000,
|
||||||
spinner[s->counter]);
|
spinner[s->spin_counter & 3]);
|
||||||
assert((int)strlen(s->msg_buf) < 1 + 80);
|
assert((int)strlen(s->msg_buf) < 1 + 80);
|
||||||
|
|
||||||
s->pos = pos;
|
s->pos = pos;
|
||||||
s->counter = (s->counter + 1) & 3;
|
s->spin_counter++;
|
||||||
s->progress_updates++;
|
|
||||||
|
|
||||||
if (s->mode == M_CB_TERM)
|
if (s->mode == M_CB_TERM)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user