Fix gcc strict-overflow error
Recent gcc (tested with 6.2.1) produces the following error when
compiling with both --enable-warningflags and --enable-debug.
In particular, it seems it is the combination of GCC_STACK_PROTECT_LIB
and -Wstrict-overflow=5 produces the error.
be_local.c:609:4: error: assuming signed overflow does not occur
when simplifying conditional
[-Werror=strict-overflow]
if(count > 0) {
Fix this by changing the type of count from int to size_t, which is
fine since count is never negative.
Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
(cherry picked from commit 34f3f1e7a6
)
This commit is contained in:
parent
eca2e0f5ed
commit
22cadea56a
1 changed files with 3 additions and 3 deletions
|
@ -501,7 +501,7 @@ version_error:
|
||||||
static int local_db_populate(alpm_db_t *db)
|
static int local_db_populate(alpm_db_t *db)
|
||||||
{
|
{
|
||||||
size_t est_count;
|
size_t est_count;
|
||||||
int count = 0;
|
size_t count = 0;
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
struct dirent *ent = NULL;
|
struct dirent *ent = NULL;
|
||||||
const char *dbpath;
|
const char *dbpath;
|
||||||
|
@ -607,9 +607,9 @@ static int local_db_populate(alpm_db_t *db)
|
||||||
|
|
||||||
closedir(dbdir);
|
closedir(dbdir);
|
||||||
if(count > 0) {
|
if(count > 0) {
|
||||||
db->pkgcache->list = alpm_list_msort(db->pkgcache->list, (size_t)count, _alpm_pkg_cmp);
|
db->pkgcache->list = alpm_list_msort(db->pkgcache->list, count, _alpm_pkg_cmp);
|
||||||
}
|
}
|
||||||
_alpm_log(db->handle, ALPM_LOG_DEBUG, "added %d packages to package cache for db '%s'\n",
|
_alpm_log(db->handle, ALPM_LOG_DEBUG, "added %zu packages to package cache for db '%s'\n",
|
||||||
count, db->treename);
|
count, db->treename);
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
|
|
Loading…
Add table
Reference in a new issue