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
--- smbd/trans2.c.orig Thu May 30 23:16:44 2002
+++ smbd/trans2.c Thu May 30 23:16:59 2002
@@ -756,7 +756,7 @@
p+= 8;
#if defined(HAVE_STAT_ST_BLOCKS) && defined(STAT_ST_BLOCKSIZE)
- SOFF_T(p,0,sbuf.st_blocks*STAT_ST_BLOCKSIZE); /* Number of bytes used on disk - 64 Bit */
+ SOFF_T(p,0,((long long)sbuf.st_blocks)*STAT_ST_BLOCKSIZE); /* Number of bytes used on disk - 64 Bit */
#else
/* Can't get the value - fake it using size. */
SOFF_T(p,0,sbuf.st_size); /* Number of bytes used on disk - 64 Bit */
@@ -2022,7 +2022,7 @@
pdata += 8;
#if defined(HAVE_STAT_ST_BLOCKS) && defined(STAT_ST_BLOCKSIZE)
- SOFF_T(pdata,0,sbuf.st_blocks*STAT_ST_BLOCKSIZE); /* Number of bytes used on disk - 64 Bit */
+ SOFF_T(pdata,0,(long long)sbuf.st_blocks*STAT_ST_BLOCKSIZE); /* Number of bytes used on disk - 64 Bit */
#else
/* Can't get the value - fake it using size. */
SOFF_T(pdata,0,sbuf.st_size); /* Number of bytes used on disk - 64 Bit */