diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-04-09 20:39:48 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-04-09 20:40:29 +0100 |
commit | 3ac0778c0a2b2f693a1029b7b05c1be4f71944a9 (patch) | |
tree | 19ddf69f3e5869cd321b363473b558f685281d62 | |
parent | 656f639dc3664437a491fa8dd5ecf44fd430fa27 (diff) |
coverity#738785 reorg to silence Uninitialized pointer field
Change-Id: If2225e77215e2a6fb6b9e9dfc6021a2c20babe50
-rw-r--r-- | sc/inc/fillinfo.hxx | 31 | ||||
-rw-r--r-- | sc/source/core/data/fillinfo.cxx | 72 |
2 files changed, 52 insertions, 51 deletions
diff --git a/sc/inc/fillinfo.hxx b/sc/inc/fillinfo.hxx index a52e6a188f1d..d35bb8e42df5 100644 --- a/sc/inc/fillinfo.hxx +++ b/sc/inc/fillinfo.hxx @@ -96,7 +96,36 @@ struct ScIconSetInfo struct CellInfo { - CellInfo() = default; + CellInfo() + : pPatternAttr(nullptr) + , pConditionSet(nullptr) + , pBackground(nullptr) // TODO: omit? + , pLinesAttr(nullptr) + , mpTLBRLine(nullptr) + , mpBLTRLine(nullptr) + , pShadowAttr(nullptr) + , pHShadowOrigin(nullptr) + , pVShadowOrigin(nullptr) + , eHShadowPart(SC_SHADOW_HSTART) + , eVShadowPart(SC_SHADOW_HSTART) + , nClipMark(SC_CLIPMARK_NONE) + , nWidth(0) + , nRotateDir(SC_ROTDIR_NONE) + , bMarked(false) + , bEmptyCellText(false) + , bMerged(false) + , bHOverlapped(false) + , bVOverlapped(false) + , bAutoFilter(false) + , bPivotButton(false) + , bPivotPopupButton(false) + , bFilterActive(false) + , bPrinted(false) // view-internal + , bHideGrid(false) // view-internal + , bEditEngine(false) // view-internal + { + } + ~CellInfo() = default; CellInfo(const CellInfo&) = delete; const CellInfo& operator=(const CellInfo&) = delete; diff --git a/sc/source/core/data/fillinfo.cxx b/sc/source/core/data/fillinfo.cxx index 53f0bceed060..ffeb066e63c2 100644 --- a/sc/source/core/data/fillinfo.cxx +++ b/sc/source/core/data/fillinfo.cxx @@ -157,11 +157,11 @@ class RowInfoFiller { alignArray(nRow); - RowInfo* pThisRowInfo = &mpRowInfo[mnArrY]; - CellInfo* pInfo = &pThisRowInfo->pCellInfo[mnArrX]; - pInfo->maCell = rCell; - pThisRowInfo->bEmptyText = false; - pInfo->bEmptyCellText = false; + RowInfo& rThisRowInfo = mpRowInfo[mnArrY]; + CellInfo& rInfo = rThisRowInfo.pCellInfo[mnArrX]; + rInfo.maCell = rCell; + rThisRowInfo.bEmptyText = false; + rInfo.bEmptyCellText = false; ++mnArrY; } @@ -266,55 +266,27 @@ void initCellInfo(RowInfo* pRowInfo, SCSIZE nArrCount, SCCOL nRotMax, bool bPain const SvxShadowItem* pDefShadow, SCROW nBlockStartY, SCROW nBlockEndY, SCCOL nBlockStartX, SCCOL nBlockEndX) { - for (SCSIZE nArrRow = 0; nArrRow < nArrCount; nArrRow++) + for (SCSIZE nArrRow = 0; nArrRow < nArrCount; ++nArrRow) { - RowInfo* pThisRowInfo = &pRowInfo[nArrRow]; - SCROW nY = pThisRowInfo->nRowNo; - pThisRowInfo->pCellInfo = new CellInfo[ nRotMax+1+2 ]; // to delete the caller! + RowInfo& rThisRowInfo = pRowInfo[nArrRow]; + SCROW nY = rThisRowInfo.nRowNo; + rThisRowInfo.pCellInfo = new CellInfo[nRotMax + 1 + 2]; // to delete the caller! - for (SCCOL nArrCol = 0; nArrCol <= nRotMax+2; nArrCol++) // Preassign cell info + for (SCCOL nArrCol = 0; nArrCol <= nRotMax+2; ++nArrCol) // Preassign cell info { - SCCOL nX; - if (nArrCol>0) - nX = nArrCol-1; - else - nX = MAXCOL+1; // invalid - - CellInfo* pInfo = &pThisRowInfo->pCellInfo[nArrCol]; - pInfo->bEmptyCellText = true; - pInfo->maCell.clear(); + CellInfo& rInfo = rThisRowInfo.pCellInfo[nArrCol]; if (bPaintMarks) - pInfo->bMarked = ( nX >= nBlockStartX && nX <= nBlockEndX - && nY >= nBlockStartY && nY <= nBlockEndY ); - else - pInfo->bMarked = false; - pInfo->nWidth = 0; - - pInfo->nClipMark = SC_CLIPMARK_NONE; - pInfo->bMerged = false; - pInfo->bHOverlapped = false; - pInfo->bVOverlapped = false; - pInfo->bAutoFilter = false; - pInfo->bPivotButton = false; - pInfo->bPivotPopupButton = false; - pInfo->bFilterActive = false; - pInfo->nRotateDir = SC_ROTDIR_NONE; - - pInfo->bPrinted = false; // view-internal - pInfo->bHideGrid = false; // view-internal - pInfo->bEditEngine = false; // view-internal - - pInfo->pBackground = nullptr; //TODO: omit? - pInfo->pPatternAttr = nullptr; - pInfo->pConditionSet= nullptr; - - pInfo->pLinesAttr = nullptr; - pInfo->mpTLBRLine = nullptr; - pInfo->mpBLTRLine = nullptr; - - pInfo->pShadowAttr = pDefShadow; - pInfo->pHShadowOrigin = nullptr; - pInfo->pVShadowOrigin = nullptr; + { + SCCOL nX; + if (nArrCol>0) + nX = nArrCol-1; + else + nX = MAXCOL+1; // invalid + rInfo.bMarked = (nX >= nBlockStartX && nX <= nBlockEndX && + nY >= nBlockStartY && nY <= nBlockEndY); + } + rInfo.bEmptyCellText = true; + rInfo.pShadowAttr = pDefShadow; } } } |