summaryrefslogtreecommitdiff
path: root/src/pacman
diff options
context:
space:
mode:
Diffstat (limited to 'src/pacman')
-rw-r--r--src/pacman/callback.c4
-rw-r--r--src/pacman/util.c7
2 files changed, 5 insertions, 6 deletions
diff --git a/src/pacman/callback.c b/src/pacman/callback.c
index 17c3d7a8..1f086755 100644
--- a/src/pacman/callback.c
+++ b/src/pacman/callback.c
@@ -99,7 +99,7 @@ static void fill_progress(const int bar_percent, const int disp_percent,
const int proglen)
{
/* 8 = 1 space + 1 [ + 1 ] + 5 for percent */
- const int hashlen = proglen - 8;
+ const int hashlen = proglen > 8 ? proglen - 8 : 0;
const int hash = bar_percent * hashlen / 100;
static int lasthash = 0, mouth = 0;
int i;
@@ -580,7 +580,7 @@ void cb_progress(alpm_progress_t event, const char *pkgname, int percent,
int i = textlen - 3;
wchar_t *p = wcstr;
/* grab the max number of char columns we can fill */
- while(i > 0 && wcwidth(*p) < i) {
+ while(i - wcwidth(*p) > 0) {
i -= wcwidth(*p);
p++;
}
diff --git a/src/pacman/util.c b/src/pacman/util.c
index 9fdc39a5..ea7faf80 100644
--- a/src/pacman/util.c
+++ b/src/pacman/util.c
@@ -1363,13 +1363,12 @@ static int multiselect_parse(char *array, int count, char *response)
if(!ends) {
array[start - 1] = include;
} else {
- int d;
if(parseindex(ends, &end, start, count) != 0) {
return -1;
}
- for(d = start; d <= end; d++) {
- array[d - 1] = include;
- }
+ do {
+ array[start - 1] = include;
+ } while(start++ < end);
}
}