mirror of
https://github.com/moparisthebest/pacman
synced 2024-12-22 15:58:50 -05:00
package.c: Fix incorrect buffersize and constant-folding
Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com> Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
906dc0ce24
commit
d5b0f0c26f
@ -90,9 +90,8 @@ static void make_aligned_titles(void)
|
|||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
size_t max = 0;
|
size_t max = 0;
|
||||||
static const wchar_t *title_suffix = L" :";
|
static const wchar_t title_suffix[] = L" :";
|
||||||
static const size_t title_suffix_len = sizeof(title_suffix);
|
wchar_t wbuf[ARRAYSIZE(titles)][TITLE_MAXLEN + ARRAYSIZE(title_suffix)];
|
||||||
wchar_t wbuf[ARRAYSIZE(titles)][TITLE_MAXLEN + title_suffix_len];
|
|
||||||
size_t wlen[ARRAYSIZE(wbuf)];
|
size_t wlen[ARRAYSIZE(wbuf)];
|
||||||
char *buf[ARRAYSIZE(wbuf)];
|
char *buf[ARRAYSIZE(wbuf)];
|
||||||
buf[T_ARCHITECTURE] = _("Architecture");
|
buf[T_ARCHITECTURE] = _("Architecture");
|
||||||
@ -133,7 +132,7 @@ static void make_aligned_titles(void)
|
|||||||
|
|
||||||
for(i = 0; i < ARRAYSIZE(wbuf); i++) {
|
for(i = 0; i < ARRAYSIZE(wbuf); i++) {
|
||||||
wmemset(wbuf[i] + wlen[i], L' ', max - wlen[i]);
|
wmemset(wbuf[i] + wlen[i], L' ', max - wlen[i]);
|
||||||
wmemcpy(wbuf[i] + max, title_suffix, title_suffix_len);
|
wmemcpy(wbuf[i] + max, title_suffix, ARRAYSIZE(title_suffix));
|
||||||
wcstombs(titles[i], wbuf[i], sizeof(wbuf[i]));
|
wcstombs(titles[i], wbuf[i], sizeof(wbuf[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user