Warning in trans2.c under AIX

Juergen Hasch Hasch at t-online.de
Thu May 30 14:47:02 GMT 2002


When compiling Samba 2_2 CVS under AIX 4.3.3 using gcc or xlc_r, I get the following warnings:

smbd/trans2.c: In function `get_lanman2_dir_entry':
smbd/trans2.c:759: warning: right shift count >= width of type
smbd/trans2.c:759: warning: right shift count >= width of type
smbd/trans2.c:759: warning: right shift count >= width of type
smbd/trans2.c:759: warning: right shift count >= width of type
smbd/trans2.c: In function `call_trans2qfilepathinfo':
smbd/trans2.c:2025: warning: right shift count >= width of type
smbd/trans2.c:2025: warning: right shift count >= width of type
smbd/trans2.c:2025: warning: right shift count >= width of type
smbd/trans2.c:2025: warning: right shift count >= width of type

The first offending line in smbd/trans2.c is:
	SOFF_T(p,0,sbuf.st_blocks*STAT_ST_BLOCKSIZE); /* Number of bytes used on disk - 64 Bit */

sbuf.st_blocks is of type blksize_t which is defined as int with only 32 bits and STAT_ST_BLOCKSIZE=512.

The SOFF_T macro is defined as:
#define SOFF_T(p, ofs, v) (SIVAL(p,ofs,(v)&0xFFFFFFFF), SIVAL(p,(ofs)+4,(v)>>32))

The value passed to SOFF_T needs to be a 64 bit value, attached is a patch I use to silence the compiler.

...Juergen

-------------- next part --------------
A non-text attachment was scrubbed...
Name: trans2.c.patch
Type: text/x-diff
Size: 989 bytes
Desc: not available
Url : http://lists.samba.org/archive/samba-technical/attachments/20020530/a62f9b02/trans2.c.bin


More information about the samba-technical mailing list