Removed sign comparison warning.

Michael Stefaniuc mstefani at redhat.com
Wed Jun 2 16:00:29 CDT 2010


Hello Marko,

thank you for your patch and welcome to Wine development.
While in general patches to make Wine use proper types are accepted 
there is a slight problem with this patch.

On 06/01/2010 11:42 PM, grkoma at gmail.com wrote:
> From: Marko Nikolic<grkoma at gmail.com>
>
> ---
>   libs/wine/config.c |    4 ++--
>   1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libs/wine/config.c b/libs/wine/config.c
> index 6bb87b0..c04b704 100644
> --- a/libs/wine/config.c
> +++ b/libs/wine/config.c
> @@ -146,10 +146,10 @@ static char *get_runtime_bindir( const char *argv0 )
>   #ifdef linux
>       for (size = 256; ; size *= 2)
>       {
> -        int ret;
> +        ssize_t ret;
>           if (!(bindir = malloc( size ))) break;
>           if ((ret = readlink( "/proc/self/exe", bindir, size )) == -1) break;
> -        if (ret != size)
> +        if ((size_t)ret != size)   /* Safe to cast, ret is>  0 here */
Having to use a cast to silence a -Wsign-compare is worse than keeping 
the warning; especially as that is an extra warning not included in the 
-Wall used by Wine. Though in this specific case by using the proper 
types the warning can be eliminated without resorting to casts.

>           {
>               if (!(p = memrchr( bindir, '/', ret ))) break;
>               if (p == bindir) p++;

bye
	michael



More information about the wine-devel mailing list