valgrind: use of uninitialized values

Change-Id: I5b8c6d4d4576fd88dbffdfc710cbd9b2e9429942
This commit is contained in:
Caolán McNamara
2017-03-28 14:45:00 +01:00
parent b012e83e1c
commit b7152aff51

View File

@@ -1938,9 +1938,8 @@ void DffPropertyReader::ApplyCustomShapeGeometryAttributes( SvStream& rIn, SfxIt
for ( sal_uInt16 i = 0; i < nNumElem; i++ ) for ( sal_uInt16 i = 0; i < nNumElem; i++ )
{ {
PropVec aHandlePropVec; PropVec aHandlePropVec;
sal_uInt32 nFlagsTmp; sal_uInt32 nFlagsTmp(0);
SvxMSDffHandleFlags nFlags; sal_Int32 nPositionX(0), nPositionY(0), nCenterX(0), nCenterY(0), nRangeXMin(0), nRangeXMax(0), nRangeYMin(0), nRangeYMax(0);
sal_Int32 nPositionX, nPositionY, nCenterX, nCenterY, nRangeXMin, nRangeXMax, nRangeYMin, nRangeYMax;
rIn.ReadUInt32( nFlagsTmp ) rIn.ReadUInt32( nFlagsTmp )
.ReadInt32( nPositionX ) .ReadInt32( nPositionX )
.ReadInt32( nPositionY ) .ReadInt32( nPositionY )
@@ -1950,7 +1949,7 @@ void DffPropertyReader::ApplyCustomShapeGeometryAttributes( SvStream& rIn, SfxIt
.ReadInt32( nRangeXMax ) .ReadInt32( nRangeXMax )
.ReadInt32( nRangeYMin ) .ReadInt32( nRangeYMin )
.ReadInt32( nRangeYMax ); .ReadInt32( nRangeYMax );
nFlags = static_cast<SvxMSDffHandleFlags>(nFlagsTmp); SvxMSDffHandleFlags nFlags = static_cast<SvxMSDffHandleFlags>(nFlagsTmp);
if ( nPositionX == 2 ) // replacing center position with absolute value if ( nPositionX == 2 ) // replacing center position with absolute value
nPositionX = nCoordWidth / 2; nPositionX = nCoordWidth / 2;
if ( nPositionY == 2 ) if ( nPositionY == 2 )
@@ -2207,7 +2206,6 @@ void DffPropertyReader::ApplyCustomShapeGeometryAttributes( SvStream& rIn, SfxIt
{ {
css::uno::Sequence< css::drawing::EnhancedCustomShapeSegment > aSegments; css::uno::Sequence< css::drawing::EnhancedCustomShapeSegment > aSegments;
sal_uInt16 i, nTmp;
sal_uInt16 nNumElemSeg = 0; sal_uInt16 nNumElemSeg = 0;
if ( SeekToContent( DFF_Prop_pSegmentInfo, rIn ) ) if ( SeekToContent( DFF_Prop_pSegmentInfo, rIn ) )
@@ -2224,14 +2222,13 @@ void DffPropertyReader::ApplyCustomShapeGeometryAttributes( SvStream& rIn, SfxIt
} }
if ( nNumElemSeg ) if ( nNumElemSeg )
{ {
sal_Int16 nCommand;
sal_Int16 nCnt;
aSegments.realloc( nNumElemSeg ); aSegments.realloc( nNumElemSeg );
for ( i = 0; i < nNumElemSeg; i++ ) for (sal_uInt16 i = 0; i < nNumElemSeg; ++i)
{ {
sal_uInt16 nTmp(0);
rIn.ReadUInt16( nTmp ); rIn.ReadUInt16( nTmp );
nCommand = EnhancedCustomShapeSegmentCommand::UNKNOWN; sal_Int16 nCommand = EnhancedCustomShapeSegmentCommand::UNKNOWN;
nCnt = (sal_Int16)( nTmp & 0x1fff );//Last 13 bits for segment points number sal_Int16 nCnt = (sal_Int16)( nTmp & 0x1fff );//Last 13 bits for segment points number
switch( nTmp >> 13 )//First 3 bits for command type switch( nTmp >> 13 )//First 3 bits for command type
{ {
case 0x0: case 0x0:
@@ -3199,7 +3196,7 @@ bool SvxMSDffManager::SeekToShape( SvStream& rSt, void* /* pClientData */, sal_u
if ( !maFidcls.empty() ) if ( !maFidcls.empty() )
{ {
sal_uInt32 nMerk = rSt.Tell(); sal_uInt32 nMerk = rSt.Tell();
sal_uInt32 nShapeId, nSec = ( nId >> 10 ) - 1; sal_uInt32 nSec = ( nId >> 10 ) - 1;
if ( nSec < mnIdClusters ) if ( nSec < mnIdClusters )
{ {
OffsetMap::const_iterator it = maDgOffsetTable.find( maFidcls[ nSec ].dgid ); OffsetMap::const_iterator it = maDgOffsetTable.find( maFidcls[ nSec ].dgid );
@@ -3222,6 +3219,7 @@ bool SvxMSDffManager::SeekToShape( SvStream& rSt, void* /* pClientData */, sal_u
DffRecordHeader aShapeHd; DffRecordHeader aShapeHd;
if ( SeekToRec( rSt, DFF_msofbtSp, aEscherObjListHd.GetRecEndFilePos(), &aShapeHd ) ) if ( SeekToRec( rSt, DFF_msofbtSp, aEscherObjListHd.GetRecEndFilePos(), &aShapeHd ) )
{ {
sal_uInt32 nShapeId(0);
rSt.ReadUInt32( nShapeId ); rSt.ReadUInt32( nShapeId );
if ( nId == nShapeId ) if ( nId == nShapeId )
{ {
@@ -4230,7 +4228,7 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
aObjData.bChildAnchor = maShapeRecords.SeekToContent( rSt, DFF_msofbtChildAnchor, SEEK_FROM_CURRENT_AND_RESTART ); aObjData.bChildAnchor = maShapeRecords.SeekToContent( rSt, DFF_msofbtChildAnchor, SEEK_FROM_CURRENT_AND_RESTART );
if ( aObjData.bChildAnchor ) if ( aObjData.bChildAnchor )
{ {
sal_Int32 l, o, r, u; sal_Int32 l(0), o(0), r(0), u(0);
rSt.ReadInt32( l ).ReadInt32( o ).ReadInt32( r ).ReadInt32( u ); rSt.ReadInt32( l ).ReadInt32( o ).ReadInt32( r ).ReadInt32( u );
Scale( l ); Scale( l );
Scale( o ); Scale( o );
@@ -4862,14 +4860,14 @@ Rectangle SvxMSDffManager::GetGlobalChildAnchor( const DffRecordHeader& rHd, SvS
{ {
if ( GetSvxMSDffSettings() & SVXMSDFF_SETTINGS_IMPORT_PPT ) if ( GetSvxMSDffSettings() & SVXMSDFF_SETTINGS_IMPORT_PPT )
{ {
sal_Int32 l, t, r, b; sal_Int32 l(0), t(0), r(0), b(0);
if ( aShapeAtom.nRecLen == 16 ) if ( aShapeAtom.nRecLen == 16 )
{ {
rSt.ReadInt32( l ).ReadInt32( t ).ReadInt32( r ).ReadInt32( b ); rSt.ReadInt32( l ).ReadInt32( t ).ReadInt32( r ).ReadInt32( b );
} }
else else
{ {
sal_Int16 ls, ts, rs, bs; sal_Int16 ls(0), ts(0), rs(0), bs(0);
rSt.ReadInt16( ts ).ReadInt16( ls ).ReadInt16( rs ).ReadInt16( bs ); // the order of coordinates is a bit strange... rSt.ReadInt16( ts ).ReadInt16( ls ).ReadInt16( rs ).ReadInt16( bs ); // the order of coordinates is a bit strange...
l = ls; l = ls;
t = ts; t = ts;
@@ -4895,7 +4893,7 @@ Rectangle SvxMSDffManager::GetGlobalChildAnchor( const DffRecordHeader& rHd, SvS
} }
else if ( aShapeAtom.nRecType == DFF_msofbtChildAnchor ) else if ( aShapeAtom.nRecType == DFF_msofbtChildAnchor )
{ {
sal_Int32 l, o, r, u; sal_Int32 l(0), o(0), r(0), u(0);
rSt.ReadInt32( l ).ReadInt32( o ).ReadInt32( r ).ReadInt32( u ); rSt.ReadInt32( l ).ReadInt32( o ).ReadInt32( r ).ReadInt32( u );
Scale( l ); Scale( l );
Scale( o ); Scale( o );
@@ -4941,7 +4939,7 @@ void SvxMSDffManager::GetGroupAnchors( const DffRecordHeader& rHd, SvStream& rSt
break; break;
if ( aShapeAtom.nRecType == DFF_msofbtChildAnchor ) if ( aShapeAtom.nRecType == DFF_msofbtChildAnchor )
{ {
sal_Int32 l, o, r, u; sal_Int32 l(0), o(0), r(0), u(0);
rSt.ReadInt32( l ).ReadInt32( o ).ReadInt32( r ).ReadInt32( u ); rSt.ReadInt32( l ).ReadInt32( o ).ReadInt32( r ).ReadInt32( u );
Scale( l ); Scale( l );
Scale( o ); Scale( o );
@@ -6058,12 +6056,13 @@ bool SvxMSDffManager::GetShapeContainerData( SvStream& rSt,
// We've found the Property Table: // We've found the Property Table:
// search for the Blip Property! // search for the Blip Property!
sal_uLong nPropRead = 0; sal_uLong nPropRead = 0;
sal_uInt16 nPropId;
sal_uInt32 nPropVal;
nLenShapePropTbl = nLength; nLenShapePropTbl = nLength;
long nStartShapePropTbl = rSt.Tell(); long nStartShapePropTbl = rSt.Tell();
do do
{ {
sal_uInt16 nPropId(0);
sal_uInt32 nPropVal(0);
rSt.ReadUInt16( nPropId ) rSt.ReadUInt16( nPropId )
.ReadUInt32( nPropVal ); .ReadUInt32( nPropVal );
nPropRead += 6; nPropRead += 6;
@@ -6352,7 +6351,7 @@ bool SvxMSDffManager::GetBLIPDirect( SvStream& rBLIPStream, Graphic& rData, Rect
rBLIPStream.SeekRel( nSkip + 20 ); rBLIPStream.SeekRel( nSkip + 20 );
// read in size of metafile in EMUS // read in size of metafile in EMUS
sal_Int32 width, height; sal_Int32 width(0), height(0);
rBLIPStream.ReadInt32( width ).ReadInt32( height ); rBLIPStream.ReadInt32( width ).ReadInt32( height );
aMtfSize100.Width() = width; aMtfSize100.Width() = width;
aMtfSize100.Height() = height; aMtfSize100.Height() = height;
@@ -6718,16 +6717,16 @@ bool SvxMSDffManager::ConvertToOle2( SvStream& rStm, sal_uInt32 nReadLen,
if( xOle10Stm->GetError() ) if( xOle10Stm->GetError() )
return false; return false;
sal_uInt32 nType;
sal_uInt32 nRecType;
sal_uInt32 nStrLen;
OUString aSvrName; OUString aSvrName;
sal_uInt32 nDummy0; sal_uInt32 nDummy0;
sal_uInt32 nDummy1; sal_uInt32 nDummy1;
sal_uInt32 nDataLen;
sal_uInt32 nBytesRead = 0; sal_uInt32 nBytesRead = 0;
do do
{ {
sal_uInt32 nType(0);
sal_uInt32 nRecType(0);
sal_uInt32 nStrLen(0);
rStm.ReadUInt32( nType ); rStm.ReadUInt32( nType );
rStm.ReadUInt32( nRecType ); rStm.ReadUInt32( nRecType );
rStm.ReadUInt32( nStrLen ); rStm.ReadUInt32( nStrLen );
@@ -6744,6 +6743,7 @@ bool SvxMSDffManager::ConvertToOle2( SvStream& rStm, sal_uInt32 nReadLen,
} }
rStm.ReadUInt32( nDummy0 ); rStm.ReadUInt32( nDummy0 );
rStm.ReadUInt32( nDummy1 ); rStm.ReadUInt32( nDummy1 );
sal_uInt32 nDataLen(0);
rStm.ReadUInt32( nDataLen ); rStm.ReadUInt32( nDataLen );
nBytesRead += 6 * sizeof( sal_uInt32 ) + nStrLen + nDataLen; nBytesRead += 6 * sizeof( sal_uInt32 ) + nStrLen + nDataLen;
@@ -7163,7 +7163,7 @@ SdrOle2Obj* SvxMSDffManager::CreateSdrOLEFromStorage(
} }
else if( pDataStrm ) else if( pDataStrm )
{ {
sal_uInt32 nLen, nDummy; sal_uInt32 nLen(0), nDummy(0);
pDataStrm->ReadUInt32( nLen ).ReadUInt32( nDummy ); pDataStrm->ReadUInt32( nLen ).ReadUInt32( nDummy );
if( SVSTREAM_OK != pDataStrm->GetError() || if( SVSTREAM_OK != pDataStrm->GetError() ||
// Id in BugDoc - exist there other Ids? // Id in BugDoc - exist there other Ids?