Apache OpenOffice (AOO) Bugzilla – Issue 71762
warning: operation on 'pPtr' may be undefined
Last modified: 2006-12-05 10:50:10 UTC
Building with warnings are errors on GNU/Linux SPARC and gcc4.1.2: -o ../../../unxlngs.pro/slo/enhwmf.o /home/jim/vanilla/svtools/source/filter.vcl/wmf/enhwmf.cxx cc1plus: warnings being treated as errors /home/jim/vanilla/svtools/source/filter.vcl/wmf/enhwmf.cxx: In function 'float GetSwapFloat (SvStream&)': /home/jim/vanilla/svtools/source/filter.vcl/wmf/enhwmf.cxx:180: warning: operation on 'pPtr' may be undefined dmake: Error code 1, while making '../../../unxlngs.pro/slo/enhwmf.obj' '---* tg_merge.mk *--- The relevant code with added **comment**: #ifdef OSL_BIGENDIAN // currently unused static float GetSwapFloat( SvStream& rSt ) { float fTmp; sal_Int8* pPtr = (sal_Int8*)&fTmp + 3; rSt >> *pPtr-- >> *pPtr-- >> *pPtr-- >> *pPtr; // Little Endian <-> **line 180** return fTmp; } #endif
@sb: any comment would be appreciated. The #ifdef OSL_BIGENDIAN was introduced in rev1.30 to remove errors for Linux so I guess there is not a simple fix.
The following patch builds without warnings, but I have no idea what is the real right sequence of operations here, it just looks better logically to do the >> operation before decrementing (assuming left to right): - rSt >> *pPtr-- >> *pPtr-- >> *pPtr-- >> *pPtr; // Little Endian <-> Big Endian switch + rSt >> *pPtr >> --*pPtr >> --*pPtr >> --*pPtr; // Little Endian <-> Big Endian switch
Completely remove the multiple side-effects of decrementing pPtr: sal_Int8* pPtr = (sal_Int8*)&fTmp; rSt >> pPtr[3] >> pPtr[2] >> pPtr[1] >> pPtr[0];
Created attachment 40778 [details] remove pointer decrements
reassign and start
.
started
committed in cws_src680_jw3
reassign for qa
According to sj there is no easy way to test this code. Thus verified by code review.
Integrated in m196