coverity#738861 Uninitialized pointer field

Change-Id: I0c39ea58fd1f85471531490401a7b7e8ca7c2a17
This commit is contained in:
Caolán McNamara
2014-05-01 11:03:37 +01:00
parent 09ebcc26f6
commit 22f719aa96
5 changed files with 25 additions and 12 deletions

View File

@@ -61,7 +61,7 @@ VCL_DLLPUBLIC bool ReadWindowMetafile( SvStream& rStream, GDIMetaFile& rMTF, Fil
VCL_DLLPUBLIC bool ConvertGDIMetaFileToWMF( const GDIMetaFile & rMTF, SvStream & rTargetStream, FilterConfigItem* pConfigItem = NULL, bool bPlaceable = true );
bool ConvertGDIMetaFileToEMF( const GDIMetaFile & rMTF, SvStream & rTargetStream, FilterConfigItem* pConfigItem = NULL );
bool ConvertGDIMetaFileToEMF(const GDIMetaFile & rMTF, SvStream & rTargetStream);
VCL_DLLPUBLIC bool WriteWindowMetafileBits( SvStream& rStream, const GDIMetaFile& rMTF );

View File

@@ -1968,7 +1968,7 @@ sal_uInt16 GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString
else if ( aFilterName.equalsIgnoreAsciiCase( EXP_EMF ) )
{
// #i119735# just use GetGDIMetaFile, it will create a bufferd version of contained bitmap now automatically
if ( !ConvertGDIMetaFileToEMF( aGraphic.GetGDIMetaFile(), rOStm, &aConfigItem ) )
if ( !ConvertGDIMetaFileToEMF(aGraphic.GetGDIMetaFile(), rOStm))
nStatus = GRFILTER_FORMATERROR;
if( rOStm.GetError() )

View File

@@ -284,7 +284,7 @@ void EMFWriter::ImplWritePlusFillPolygonRecord( const Polygon& rPoly, const sal_
ImplEndCommentRecord();
}
bool EMFWriter::WriteEMF( const GDIMetaFile& rMtf, FilterConfigItem* pFilterConfigItem )
bool EMFWriter::WriteEMF(const GDIMetaFile& rMtf)
{
const sal_uLong nHeaderPos = m_rStm.Tell();
@@ -292,10 +292,9 @@ bool EMFWriter::WriteEMF( const GDIMetaFile& rMtf, FilterConfigItem* pFilterConf
maVDev.SetMapMode( rMtf.GetPrefMapMode() );
// don't work with pixel as destination map mode -> higher resolution preferrable
maDestMapMode.SetMapUnit( MAP_100TH_MM );
mpFilterConfigItem = pFilterConfigItem;
mpHandlesUsed = new bool[ MAXHANDLES ];
memset( mpHandlesUsed, 0, MAXHANDLES * sizeof( bool ) );
mnHandleCount = mnLastPercent = mnRecordCount = mnRecordPos = mnRecordPlusPos = 0;
mnHandleCount = mnRecordCount = mnRecordPos = mnRecordPlusPos = 0;
mbRecordOpen = mbRecordPlusOpen = false;
mbLineChanged = mbFillChanged = mbTextChanged = false;
mnLineHandle = mnFillHandle = mnTextHandle = HANDLE_INVALID;

View File

@@ -35,11 +35,9 @@ private:
VirtualDevice maVDev;
MapMode maDestMapMode;
FilterConfigItem* mpFilterConfigItem;
SvStream& m_rStm;
bool* mpHandlesUsed;
sal_uLong mnHandleCount;
sal_uLong mnLastPercent;
sal_uLong mnRecordCount;
sal_uLong mnRecordPos;
sal_uLong mnRecordPlusPos;
@@ -91,9 +89,26 @@ private:
public:
EMFWriter(SvStream &rStream) : m_rStm(rStream) {}
EMFWriter(SvStream &rStream)
: m_rStm(rStream)
, mpHandlesUsed(NULL)
, mnHandleCount(0)
, mnRecordCount(0)
, mnRecordPos(0)
, mnRecordPlusPos(0)
, mbRecordOpen(false)
, mbRecordPlusOpen(false)
, mbLineChanged(false)
, mnLineHandle(0)
, mbFillChanged(false)
, mnFillHandle(0)
, mbTextChanged(false)
, mnTextHandle(0)
, mnHorTextAlign(0)
{
}
bool WriteEMF( const GDIMetaFile& rMtf, FilterConfigItem* pConfigItem = NULL );
bool WriteEMF(const GDIMetaFile& rMtf);
};
#endif // INCLUDED_VCL_SOURCE_FILTER_WMF_EMFWR_HXX

View File

@@ -102,8 +102,7 @@ bool ConvertGDIMetaFileToWMF( const GDIMetaFile & rMTF, SvStream & rTargetStream
return aWMFWriter.WriteWMF( aGdiMetaFile, rTargetStream, pConfigItem, bPlaceable );
}
bool ConvertGDIMetaFileToEMF( const GDIMetaFile & rMTF, SvStream & rTargetStream,
FilterConfigItem* pConfigItem )
bool ConvertGDIMetaFileToEMF(const GDIMetaFile & rMTF, SvStream & rTargetStream)
{
EMFWriter aEMFWriter(rTargetStream);
GDIMetaFile aGdiMetaFile(rMTF);
@@ -116,7 +115,7 @@ bool ConvertGDIMetaFileToEMF( const GDIMetaFile & rMTF, SvStream & rTargetStream
clipMetafileContentAgainstOwnRegions(aGdiMetaFile);
}
return aEMFWriter.WriteEMF( aGdiMetaFile, pConfigItem );
return aEMFWriter.WriteEMF(aGdiMetaFile);
}
bool WriteWindowMetafileBits( SvStream& rStream, const GDIMetaFile& rMTF )