From ba1d2677af955e95d7aa673c21d8be961b88389a Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Tue, 28 Oct 2014 11:42:24 +0100 Subject: cid#738785 Uninitialized pointer field Change-Id: I2256682639084c8889d1137f087e34f7b0dab6e7 --- sc/inc/fillinfo.hxx | 22 +++++++--------------- sc/source/core/data/fillinfo.cxx | 6 +++--- sc/source/ui/view/output.cxx | 20 ++++++++++---------- 3 files changed, 20 insertions(+), 28 deletions(-) (limited to 'sc') diff --git a/sc/inc/fillinfo.hxx b/sc/inc/fillinfo.hxx index 1db76d9fb2df..45b4a643ead6 100644 --- a/sc/inc/fillinfo.hxx +++ b/sc/inc/fillinfo.hxx @@ -20,6 +20,10 @@ #ifndef INCLUDED_SC_INC_FILLINFO_HXX #define INCLUDED_SC_INC_FILLINFO_HXX +#include + +#include + #include #include "global.hxx" #include "colorscale.hxx" @@ -98,9 +102,9 @@ struct CellInfo : boost::noncopyable const ScPatternAttr* pPatternAttr; const SfxItemSet* pConditionSet; - const Color* pColorScale; - const ScDataBarInfo* pDataBar; - const ScIconSetInfo* pIconSet; + std::unique_ptr pColorScale; + std::unique_ptr pDataBar; + std::unique_ptr pIconSet; const SvxBrushItem* pBackground; @@ -131,18 +135,6 @@ struct CellInfo : boost::noncopyable bool bPrinted : 1; // when required (pagebreak mode) bool bHideGrid : 1; // output-internal bool bEditEngine : 1; // output-internal - - CellInfo(): - pColorScale(NULL), - pDataBar(NULL), - pIconSet(NULL) {} - - ~CellInfo() - { - delete pColorScale; - delete pDataBar; - delete pIconSet; - } }; const SCCOL SC_ROTMAX_NONE = SCCOL_MAX; diff --git a/sc/source/core/data/fillinfo.cxx b/sc/source/core/data/fillinfo.cxx index 294020c51301..b7be16289397 100644 --- a/sc/source/core/data/fillinfo.cxx +++ b/sc/source/core/data/fillinfo.cxx @@ -575,18 +575,18 @@ void ScDocument::FillInfo( } if(aData.pColorScale) { - pInfo->pColorScale = aData.pColorScale; + pInfo->pColorScale.reset(aData.pColorScale); bFound = true; } if(aData.pDataBar) { - pInfo->pDataBar = aData.pDataBar; + pInfo->pDataBar.reset(aData.pDataBar); bFound = true; } if(aData.pIconSet) { - pInfo->pIconSet = aData.pIconSet; + pInfo->pIconSet.reset(aData.pIconSet); bFound = true; } } diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx index 03048ad750a2..6fc29bb75369 100644 --- a/sc/source/ui/view/output.cxx +++ b/sc/source/ui/view/output.cxx @@ -736,16 +736,16 @@ static bool lcl_EqualBack( const RowInfo& rFirst, const RowInfo& rOther, for ( nX=nX1; nX<=nX2; nX++ ) { - const Color* pCol1 = rFirst.pCellInfo[nX+1].pColorScale; - const Color* pCol2 = rOther.pCellInfo[nX+1].pColorScale; + const Color* pCol1 = rFirst.pCellInfo[nX+1].pColorScale.get(); + const Color* pCol2 = rOther.pCellInfo[nX+1].pColorScale.get(); if( (pCol1 && !pCol2) || (!pCol1 && pCol2) ) return false; if (pCol1 && (*pCol1 != *pCol2)) return false; - const ScDataBarInfo* pInfo1 = rFirst.pCellInfo[nX+1].pDataBar; - const ScDataBarInfo* pInfo2 = rOther.pCellInfo[nX+1].pDataBar; + const ScDataBarInfo* pInfo1 = rFirst.pCellInfo[nX+1].pDataBar.get(); + const ScDataBarInfo* pInfo2 = rOther.pCellInfo[nX+1].pDataBar.get(); if( (pInfo1 && !pInfo2) || (!pInfo1 && pInfo2) ) return false; @@ -754,8 +754,8 @@ static bool lcl_EqualBack( const RowInfo& rFirst, const RowInfo& rOther, return false; // each cell with an icon set should be painted the same way - const ScIconSetInfo* pIconSet1 = rFirst.pCellInfo[nX+1].pIconSet; - const ScIconSetInfo* pIconSet2 = rOther.pCellInfo[nX+1].pIconSet; + const ScIconSetInfo* pIconSet1 = rFirst.pCellInfo[nX+1].pIconSet.get(); + const ScIconSetInfo* pIconSet2 = rOther.pCellInfo[nX+1].pIconSet.get(); if(pIconSet1 || pIconSet2) return false; @@ -1041,9 +1041,9 @@ void ScOutputData::DrawBackground() pBackground = lcl_FindBackground( mpDoc, nX, nY, nTab ); } - pColor = pInfo->pColorScale; - const ScDataBarInfo* pDataBarInfo = pInfo->pDataBar; - const ScIconSetInfo* pIconSetInfo = pInfo->pIconSet; + pColor = pInfo->pColorScale.get(); + const ScDataBarInfo* pDataBarInfo = pInfo->pDataBar.get(); + const ScIconSetInfo* pIconSetInfo = pInfo->pIconSet.get(); drawCells( pColor, pBackground, pOldColor, pOldBackground, aRect, nPosX, nSignedOneX, mpDev, pDataBarInfo, pOldDataBarInfo, pIconSetInfo, pOldIconSetInfo ); nPosX += pRowInfo[0].pCellInfo[nX+1].nWidth * nLayoutSign; @@ -1631,7 +1631,7 @@ void ScOutputData::DrawRotatedFrame( const Color* pForceColor ) else { Polygon aPoly( 4, aPoints ); - const Color* pColor = pInfo->pColorScale; + const Color* pColor = pInfo->pColorScale.get(); // ohne Pen wird bei DrawPolygon rechts und unten // ein Pixel weggelassen... -- cgit