FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux Pacman Development

 
 
LinkBack Thread Tools
 
Old 01-02-2012, 03:32 AM
Allan McRae
 
Default 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>
---

I did reply to the patch email about this...

lib/libalpm/be_package.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/libalpm/be_package.c b/lib/libalpm/be_package.c
index c602996..fccbb10 100644
--- a/lib/libalpm/be_package.c
+++ b/lib/libalpm/be_package.c
@@ -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
",
newpkg->name ? newpkg->name : "error", linenum);
--
1.7.8.1
 
Old 01-02-2012, 05:18 PM
Dan McGee
 
Default be_package.c: fix compiler warning

On Sun, Jan 1, 2012 at 10:32 PM, Allan McRae <allan@archlinux.org> wrote:
> 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>
> ---
>
> I did reply to the patch email about this...
100% my fault on missing this change; sorry 'bout that.

> *lib/libalpm/be_package.c | * *2 +-
> *1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/lib/libalpm/be_package.c b/lib/libalpm/be_package.c
> index c602996..fccbb10 100644
> --- a/lib/libalpm/be_package.c
> +++ b/lib/libalpm/be_package.c
> @@ -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
",
> * * * * * * * * * * * * * * * * * * * *newpkg->name ? newpkg->name : "error", linenum);
> --
> 1.7.8.1
>
>
 

Thread Tools




All times are GMT. The time now is 06:28 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org