[patch] 1.11.0.svn: compiler warnings when building for i386 arch)

Cristian Ionescu-Idbohrn cristian.ionescu-idbohrn at axis.com
Mon May 12 18:58:16 UTC 2008


On Mon, 12 May 2008, Denys Vlasenko wrote:

> On Friday 09 May 2008 23:42, Cristian Ionescu-Idbohrn wrote:
>
> When the tree will build cleanly with -Wall, we should add it to CFLAGS.

Good stuff.

> > Catched a few more (attached).  Please review.
>
> -               rr = getsockopt(netfd, IPPROTO_IP, IP_OPTIONS, optbuf, &x);
> +               rr = getsockopt(netfd, IPPROTO_IP, IP_OPTIONS, optbuf, (socklen_t *)&x);
>
> This is wrong. You need to change x from int to socklen_t instead.

That's fine.

> -               io_hdr.cmdp = (char*)sg_commands[i];
> +               io_hdr.cmdp = (unsigned char *)sg_commands[i];
>
> Since type of cmdp ptr is buried in some header file, I typically
> just cast to (void*) - it is compatible with any pointer.

I digged that burried thing out.  I read somewhere that using using
(void *) is not always TRT to do.

> > Some still lurcking around.  The big chunk are the
> > get_terminal_width_height related along whith these two:
> >
> > archival/libunarchive/get_header_tar.c: In function 'get_header_tar':
> > archival/libunarchive/get_header_tar.c:148: warning: comparison is always
> > false due to limited range of data type
>
> Which line is it? In my tree, line 148 is this one:
>
> #if ENABLE_FEATURE_TAR_GZIP
>                 if (tar.name[0] == 0x1f && tar.name[1] == 0x8b) { /* gzip */
>                         get_header_ptr = get_header_tar_gz;
>                 } else <============================ LINE 148
> #endif

Yes.  Sorry about that.  That's a patched file in my tree.  This is the
svn source:

archival/libunarchive/get_header_tar.c: In function 'get_header_tar':
archival/libunarchive/get_header_tar.c:146: warning: comparison is always
false due to limited range of data type


> Patch is applied with minor corrections, thanks.


Cheers,

-- 
Cristian



More information about the busybox mailing list