be_package.c: fix compiler warning

be_package.c: In function 'parse_descfile':
be_package.c:181:28: error: comparison between signed and unsigned
integer expressions [-Werror=sign-compare]

ptr - key + 2 is guaranteed to be > 0 so we can cast to size_t

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Allan McRae 2012-01-02 14:31:46 +10:00 committed by Dan McGee
parent eb5cb8ec02
commit 29e94dc065
1 changed files with 1 additions and 1 deletions

View File

@ -178,7 +178,7 @@ static int parse_descfile(alpm_handle_t *handle, struct archive *a, alpm_pkg_t *
/* line is always in this format: "key = value"
* we can be sure the " = " exists, so look for that */
ptr = memchr(key, ' ', len);
if(!ptr || ptr - key + 2 > len || memcmp(ptr, " = ", 3) != 0) {
if(!ptr || (size_t)(ptr - key + 2) > len || memcmp(ptr, " = ", 3) != 0) {
_alpm_log(handle, ALPM_LOG_DEBUG,
"%s: syntax error in description file line %d\n",
newpkg->name ? newpkg->name : "error", linenum);