diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-11-01 12:44:54 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-11-01 13:14:08 +0000 |
commit | 5346394e9fb82c4a15ca7202f5d7ca6d27165aff (patch) | |
tree | e74878c17ccdaf7fbbfe3589ca3d4c254b5ddcd7 | |
parent | 57fb462cea757a2757aee8fba3144e68839fcaff (diff) |
valgrind: Conditional jump or move depends on uninitialised value
Change-Id: I7b59ddc4f9170c33e948f30194a662f27b871fcc
-rw-r--r-- | sw/source/core/layout/laycache.cxx | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/sw/source/core/layout/laycache.cxx b/sw/source/core/layout/laycache.cxx index f639d7a818a2..8752828b7d70 100644 --- a/sw/source/core/layout/laycache.cxx +++ b/sw/source/core/layout/laycache.cxx @@ -114,19 +114,19 @@ sal_Bool SwLayCacheImpl::Read( SvStream& rStream ) // height of fly frames bUseFlyCache = aIo.GetMinorVersion() >= 1; - sal_uInt8 cFlags; - sal_uInt32 nIndex, nOffset; - aIo.OpenRec( SW_LAYCACHE_IO_REC_PAGES ); aIo.OpenFlagRec(); aIo.CloseFlagRec(); while( aIo.BytesLeft() && !aIo.HasError() ) { + sal_uInt32 nIndex(0), nOffset(0); + switch( aIo.Peek() ) { case SW_LAYCACHE_IO_REC_PARA: + { aIo.OpenRec( SW_LAYCACHE_IO_REC_PARA ); - cFlags = aIo.OpenFlagRec(); + sal_uInt8 cFlags = aIo.OpenFlagRec(); aIo.GetStream() >> nIndex; if( (cFlags & 0x01) != 0 ) aIo.GetStream() >> nOffset; @@ -136,6 +136,7 @@ sal_Bool SwLayCacheImpl::Read( SvStream& rStream ) Insert( SW_LAYCACHE_IO_REC_PARA, nIndex, (xub_StrLen)nOffset ); aIo.CloseRec( SW_LAYCACHE_IO_REC_PARA ); break; + } case SW_LAYCACHE_IO_REC_TABLE: aIo.OpenRec( SW_LAYCACHE_IO_REC_TABLE ); aIo.OpenFlagRec(); @@ -150,8 +151,8 @@ sal_Bool SwLayCacheImpl::Read( SvStream& rStream ) aIo.OpenRec( SW_LAYCACHE_IO_REC_FLY ); aIo.OpenFlagRec(); aIo.CloseFlagRec(); - sal_Int32 nX, nY, nW, nH; - sal_uInt16 nPgNum; + sal_Int32 nX(0), nY(0), nW(0), nH(0); + sal_uInt16 nPgNum(0); aIo.GetStream() >> nPgNum >> nIndex >> nX >> nY >> nW >> nH; SwFlyCache* pFly = new SwFlyCache( nPgNum, nIndex, nX, nY, nW, nH ); @@ -1188,7 +1189,7 @@ sal_Bool SwLayCacheIoImpl::OpenRec( sal_uInt8 cType ) } else { - sal_uInt32 nVal; + sal_uInt32 nVal(0); *pStream >> nVal; sal_uInt8 cRecTyp = (sal_uInt8)nVal; if( !nVal || cRecTyp != cType || @@ -1266,7 +1267,7 @@ sal_uInt32 SwLayCacheIoImpl::BytesLeft() sal_uInt8 SwLayCacheIoImpl::Peek() { - sal_uInt8 c = 0; + sal_uInt8 c(0); if( !bError ) { sal_uInt32 nPos = pStream->Tell(); @@ -1292,7 +1293,7 @@ void SwLayCacheIoImpl::SkipRec() sal_uInt8 SwLayCacheIoImpl::OpenFlagRec() { OSL_ENSURE( !bWriteMode, "OpenFlagRec illegal in write mode" ); - sal_uInt8 cFlags; + sal_uInt8 cFlags(0); *pStream >> cFlags; nFlagRecEnd = pStream->Tell() + ( cFlags & 0x0F ); return (cFlags >> 4); |