diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-01-29 16:04:27 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-01-29 15:56:13 +0100 |
commit | 0b113d6ebbaf923e11ba576bed2691bb68e95ae6 (patch) | |
tree | 10badec3e417a58bfeee179ca12265742adfa17a /lotuswordpro | |
parent | 41a83d32079e1ee2a99aa8a2f959e0de96345079 (diff) |
tdf#129993 broken tables opening LWP file
regression from
commit e2080e70fe8b085f18e868e46340454720fa94ca
new compilerplugin returnbyref
The parts that fix this specific bug are in lwprowlayout.cxx and
lwprowlayout.cxx, but fix the other parts I messed up but not
understanding the semantics of assigning to reference variables.
Change-Id: I064cdd108c5b05da6092da0297dc7bcf487c7702
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87686
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'lotuswordpro')
-rw-r--r-- | lotuswordpro/source/filter/lwpfnlayout.cxx | 32 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwpfoundry.cxx | 8 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwplayout.cxx | 8 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwprowlayout.cxx | 32 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwptablelayout.cxx | 64 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwptoc.cxx | 16 |
6 files changed, 80 insertions, 80 deletions
diff --git a/lotuswordpro/source/filter/lwpfnlayout.cxx b/lotuswordpro/source/filter/lwpfnlayout.cxx index 6dc167ff8dda..f95a1eddb622 100644 --- a/lotuswordpro/source/filter/lwpfnlayout.cxx +++ b/lotuswordpro/source/filter/lwpfnlayout.cxx @@ -114,15 +114,15 @@ void LwpFnRowLayout::Read() void LwpFnRowLayout::RegisterStyle() { // register cells' style - LwpObjectID& rCellID = GetChildHead(); - LwpCellLayout * pCellLayout = dynamic_cast<LwpCellLayout *>(rCellID.obj().get()); + LwpObjectID* pCellID = &GetChildHead(); + LwpCellLayout * pCellLayout = dynamic_cast<LwpCellLayout *>(pCellID->obj().get()); while(pCellLayout) { pCellLayout->SetFoundry(m_pFoundry); pCellLayout->RegisterStyle(); - rCellID = pCellLayout->GetNext(); - pCellLayout = dynamic_cast<LwpCellLayout *>(rCellID.obj().get()); + pCellID = &pCellLayout->GetNext(); + pCellLayout = dynamic_cast<LwpCellLayout *>(pCellID->obj().get()); } } @@ -194,15 +194,15 @@ void LwpEndnoteLayout::Read() void LwpEndnoteLayout::RegisterStyle() { // register style of rows - LwpObjectID& rRowID = GetChildHead(); - LwpRowLayout * pRowLayout = dynamic_cast<LwpRowLayout *>(rRowID.obj().get()); + LwpObjectID* pRowID = &GetChildHead(); + LwpRowLayout * pRowLayout = dynamic_cast<LwpRowLayout *>(pRowID->obj().get()); while (pRowLayout) { pRowLayout->SetFoundry(m_pFoundry); pRowLayout->RegisterStyle(); - rRowID = pRowLayout->GetNext(); - pRowLayout = dynamic_cast<LwpRowLayout *>(rRowID.obj().get()); + pRowID = &pRowLayout->GetNext(); + pRowLayout = dynamic_cast<LwpRowLayout *>(pRowID->obj().get()); } } @@ -254,12 +254,12 @@ void LwpEnSuperTableLayout::XFConvert(XFContentContainer * /*pCont*/) */ LwpVirtualLayout* LwpEnSuperTableLayout::GetMainTableLayout() { - LwpObjectID& rID = GetChildTail(); + LwpObjectID *pID = &GetChildTail(); LwpVirtualLayout *pPrevLayout = nullptr; - while(!rID.IsNull()) + while(!pID->IsNull()) { - LwpVirtualLayout* pLayout = dynamic_cast<LwpVirtualLayout*>(rID.obj().get()); + LwpVirtualLayout* pLayout = dynamic_cast<LwpVirtualLayout*>(pID->obj().get()); if (!pLayout || pLayout == pPrevLayout) { break; @@ -268,7 +268,7 @@ LwpVirtualLayout* LwpEnSuperTableLayout::GetMainTableLayout() { return pLayout; } - rID = pLayout->GetPrevious(); + pID = &pLayout->GetPrevious(); pPrevLayout = pLayout; } @@ -312,11 +312,11 @@ void LwpFnSuperTableLayout::XFConvert(XFContentContainer * /*pCont*/) */ LwpVirtualLayout* LwpFnSuperTableLayout::GetMainTableLayout() { - LwpObjectID& rID = GetChildTail(); + LwpObjectID *pID = &GetChildTail(); - while(!rID.IsNull()) + while(pID && !pID->IsNull()) { - LwpVirtualLayout * pLayout = dynamic_cast<LwpVirtualLayout *>(rID.obj().get()); + LwpVirtualLayout * pLayout = dynamic_cast<LwpVirtualLayout *>(pID->obj().get()); if(!pLayout) { break; @@ -325,7 +325,7 @@ LwpVirtualLayout* LwpFnSuperTableLayout::GetMainTableLayout() { return pLayout; } - rID = pLayout->GetPrevious(); + pID = &pLayout->GetPrevious(); } return nullptr; diff --git a/lotuswordpro/source/filter/lwpfoundry.cxx b/lotuswordpro/source/filter/lwpfoundry.cxx index 40420d92244c..12226c95255c 100644 --- a/lotuswordpro/source/filter/lwpfoundry.cxx +++ b/lotuswordpro/source/filter/lwpfoundry.cxx @@ -216,15 +216,15 @@ LwpBookMark* LwpFoundry::GetBookMark(LwpObjectID objMarker) if (!pHeadHolder) return nullptr; - LwpObjectID& rObjID = pHeadHolder->GetHeadID(); - LwpBookMark* pBookMark = dynamic_cast<LwpBookMark*>(rObjID.obj().get()); + LwpObjectID* pObjID = &pHeadHolder->GetHeadID(); + LwpBookMark* pBookMark = dynamic_cast<LwpBookMark*>(pObjID->obj().get()); while (pBookMark) { if (pBookMark->IsRightMarker(objMarker)) return pBookMark; - rObjID = pBookMark->GetNext(); - pBookMark = dynamic_cast<LwpBookMark*>(rObjID.obj().get()); + pObjID = &pBookMark->GetNext(); + pBookMark = dynamic_cast<LwpBookMark*>(pObjID->obj().get()); } return nullptr; } diff --git a/lotuswordpro/source/filter/lwplayout.cxx b/lotuswordpro/source/filter/lwplayout.cxx index 9d8b33fa94b5..a393d50b4535 100644 --- a/lotuswordpro/source/filter/lwplayout.cxx +++ b/lotuswordpro/source/filter/lwplayout.cxx @@ -383,12 +383,12 @@ bool LwpVirtualLayout::IsStyleLayout() */ LwpVirtualLayout* LwpVirtualLayout::FindChildByType(LWP_LAYOUT_TYPE eType) { - LwpObjectID& rID = GetChildHead(); + LwpObjectID *pID = &GetChildHead(); LwpVirtualLayout* pPrevLayout = nullptr; - while(!rID.IsNull()) + while(pID && !pID->IsNull()) { - LwpVirtualLayout * pLayout = dynamic_cast<LwpVirtualLayout *>(rID.obj().get()); + LwpVirtualLayout * pLayout = dynamic_cast<LwpVirtualLayout *>(pID->obj().get()); if (!pLayout) break; @@ -403,7 +403,7 @@ LwpVirtualLayout* LwpVirtualLayout::FindChildByType(LWP_LAYOUT_TYPE eType) if (pLayout->GetLayoutType() == eType) return pLayout; - rID = pLayout->GetNext(); + pID = &pLayout->GetNext(); } return nullptr; diff --git a/lotuswordpro/source/filter/lwprowlayout.cxx b/lotuswordpro/source/filter/lwprowlayout.cxx index 4648d1ec00e4..287f8de65434 100644 --- a/lotuswordpro/source/filter/lwprowlayout.cxx +++ b/lotuswordpro/source/filter/lwprowlayout.cxx @@ -93,8 +93,8 @@ LwpRowLayout::~LwpRowLayout() */ void LwpRowLayout::SetRowMap() { - LwpObjectID& rCellID= GetChildHead(); - LwpCellLayout * pCellLayout = dynamic_cast<LwpCellLayout *>(rCellID.obj().get()); + LwpObjectID *pCellID= &GetChildHead(); + LwpCellLayout * pCellLayout = dynamic_cast<LwpCellLayout *>(pCellID->obj().get()); std::set<LwpCellLayout*> aSeen; while(pCellLayout) @@ -102,8 +102,8 @@ void LwpRowLayout::SetRowMap() aSeen.insert(pCellLayout); pCellLayout->SetCellMap(); - rCellID = pCellLayout->GetNext(); - pCellLayout = dynamic_cast<LwpCellLayout *>(rCellID.obj().get()); + pCellID = &pCellLayout->GetNext(); + pCellLayout = dynamic_cast<LwpCellLayout *>(pCellID->obj().get()); if (aSeen.find(pCellLayout) != aSeen.end()) throw std::runtime_error("loop in conversion"); } @@ -137,8 +137,8 @@ void LwpRowLayout::RegisterStyle() pTableLayout->GetTable(); } // register cells' style - LwpObjectID& rCellID= GetChildHead(); - LwpCellLayout * pCellLayout = dynamic_cast<LwpCellLayout *>(rCellID.obj().get()); + LwpObjectID *pCellID= &GetChildHead(); + LwpCellLayout * pCellLayout = dynamic_cast<LwpCellLayout *>(pCellID->obj().get()); std::set<LwpCellLayout*> aSeen; while (pCellLayout) @@ -147,8 +147,8 @@ void LwpRowLayout::RegisterStyle() pCellLayout->SetFoundry(m_pFoundry); pCellLayout->RegisterStyle(); - rCellID = pCellLayout->GetNext(); - pCellLayout = dynamic_cast<LwpCellLayout *>(rCellID.obj().get()); + pCellID = &pCellLayout->GetNext(); + pCellLayout = dynamic_cast<LwpCellLayout *>(pCellID->obj().get()); if (aSeen.find(pCellLayout) != aSeen.end()) throw std::runtime_error("loop in conversion"); @@ -387,8 +387,8 @@ void LwpRowLayout::ConvertCommonRow(rtl::Reference<XFTable> const & pXFTable, sa for (sal_uInt8 i = nStartCol; i < nEndCol ; i++) { // add row to table - LwpObjectID& rCellID= GetChildHead(); - LwpCellLayout * pCellLayout = dynamic_cast<LwpCellLayout *>(rCellID.obj().get()); + LwpObjectID *pCellID= &GetChildHead(); + LwpCellLayout * pCellLayout = dynamic_cast<LwpCellLayout *>(pCellID->obj().get()); nCellStartCol = i;//mark the begin position of cell nCellEndCol = i;//mark the end position of cell rtl::Reference<XFCell> xCell; @@ -405,8 +405,8 @@ void LwpRowLayout::ConvertCommonRow(rtl::Reference<XFTable> const & pXFTable, sa xCell = pCellLayout->DoConvertCell(pTable->GetObjectID(),crowid,i); break; } - rCellID = pCellLayout->GetNext(); - pCellLayout = dynamic_cast<LwpCellLayout *>(rCellID.obj().get()); + pCellID = &pCellLayout->GetNext(); + pCellLayout = dynamic_cast<LwpCellLayout *>(pCellID->obj().get()); } if (!pCellLayout) { @@ -436,8 +436,8 @@ void LwpRowLayout::ConvertCommonRow(rtl::Reference<XFTable> const & pXFTable, sa */ void LwpRowLayout::CollectMergeInfo() { - LwpObjectID& rCellID= GetChildHead(); - LwpCellLayout * pCellLayout = dynamic_cast<LwpCellLayout *>(rCellID.obj().get()); + LwpObjectID *pCellID= &GetChildHead(); + LwpCellLayout * pCellLayout = dynamic_cast<LwpCellLayout *>(pCellID->obj().get()); while(pCellLayout) { @@ -446,8 +446,8 @@ void LwpRowLayout::CollectMergeInfo() LwpConnectedCellLayout* pConnCell = static_cast<LwpConnectedCellLayout*>(pCellLayout); m_ConnCellList.push_back(pConnCell); } - rCellID = pCellLayout->GetNext(); - pCellLayout = dynamic_cast<LwpCellLayout *>(rCellID.obj().get()); + pCellID = &pCellLayout->GetNext(); + pCellLayout = dynamic_cast<LwpCellLayout *>(pCellID->obj().get()); } } /** diff --git a/lotuswordpro/source/filter/lwptablelayout.cxx b/lotuswordpro/source/filter/lwptablelayout.cxx index e1647dd34511..448599e5b2c5 100644 --- a/lotuswordpro/source/filter/lwptablelayout.cxx +++ b/lotuswordpro/source/filter/lwptablelayout.cxx @@ -109,11 +109,11 @@ void LwpSuperTableLayout::Read() */ LwpTableLayout* LwpSuperTableLayout::GetTableLayout() { - LwpObjectID& rID = GetChildTail(); + LwpObjectID *pID = &GetChildTail(); - while(!rID.IsNull()) + while(pID && !pID->IsNull()) { - LwpLayout* pLayout = dynamic_cast<LwpLayout*>(rID.obj().get()); + LwpLayout* pLayout = dynamic_cast<LwpLayout*>(pID->obj().get()); if (!pLayout) { break; @@ -122,7 +122,7 @@ LwpTableLayout* LwpSuperTableLayout::GetTableLayout() { return dynamic_cast<LwpTableLayout *>(pLayout); } - rID = pLayout->GetPrevious(); + pID = &pLayout->GetPrevious(); } return nullptr; @@ -133,11 +133,11 @@ LwpTableLayout* LwpSuperTableLayout::GetTableLayout() */ LwpTableHeadingLayout* LwpSuperTableLayout::GetTableHeadingLayout() { - LwpObjectID& rID = GetChildTail(); + LwpObjectID *pID = &GetChildTail(); - while(!rID.IsNull()) + while(pID && !pID->IsNull()) { - LwpLayout * pLayout = dynamic_cast<LwpLayout *>(rID.obj().get()); + LwpLayout * pLayout = dynamic_cast<LwpLayout *>(pID->obj().get()); if (!pLayout) { break; @@ -147,7 +147,7 @@ LwpTableHeadingLayout* LwpSuperTableLayout::GetTableHeadingLayout() { return dynamic_cast<LwpTableHeadingLayout *>(pLayout); } - rID = pLayout->GetPrevious(); + pID = &pLayout->GetPrevious(); } return nullptr; @@ -229,8 +229,8 @@ double LwpSuperTableLayout::GetTableWidth() for(sal_uInt16 i =0; i< nCol; i++) { - LwpObjectID& rColumnID = pTableLayout->GetColumnLayoutHead(); - LwpColumnLayout * pColumnLayout = dynamic_cast<LwpColumnLayout *>(rColumnID.obj().get()); + LwpObjectID *pColumnID = &pTableLayout->GetColumnLayoutHead(); + LwpColumnLayout * pColumnLayout = dynamic_cast<LwpColumnLayout *>(pColumnID->obj().get()); double dColumnWidth = dDefaultWidth; std::set<LwpColumnLayout*> aSeen; while (pColumnLayout) @@ -241,8 +241,8 @@ double LwpSuperTableLayout::GetTableWidth() dColumnWidth = pColumnLayout->GetWidth(); break; } - rColumnID = pColumnLayout->GetNext(); - pColumnLayout = dynamic_cast<LwpColumnLayout *>(rColumnID.obj().get()); + pColumnID = &pColumnLayout->GetNext(); + pColumnLayout = dynamic_cast<LwpColumnLayout *>(pColumnID->obj().get()); if (aSeen.find(pColumnLayout) != aSeen.end()) throw std::runtime_error("loop in conversion"); } @@ -450,8 +450,8 @@ void LwpTableLayout::TraverseTable() m_WordProCellsMap.insert(m_WordProCellsMap.end(), nCount, m_pDefaultCellLayout); // set value - LwpObjectID& rRowID = GetChildHead(); - LwpRowLayout * pRowLayout = dynamic_cast<LwpRowLayout *>(rRowID.obj().get()); + LwpObjectID* pRowID = &GetChildHead(); + LwpRowLayout * pRowLayout = dynamic_cast<LwpRowLayout *>(pRowID->obj().get()); std::set<LwpRowLayout*> aSeen; while (pRowLayout) { @@ -464,8 +464,8 @@ void LwpTableLayout::TraverseTable() pRowLayout->CollectMergeInfo(); // end for 's analysis - rRowID = pRowLayout->GetNext(); - pRowLayout = dynamic_cast<LwpRowLayout *>(rRowID.obj().get()); + pRowID = &pRowLayout->GetNext(); + pRowLayout = dynamic_cast<LwpRowLayout *>(pRowID->obj().get()); if (aSeen.find(pRowLayout) != aSeen.end()) throw std::runtime_error("loop in conversion"); } @@ -569,8 +569,8 @@ void LwpTableLayout::RegisterColumns() // Get total width of justifiable columns // NOTICE: all default columns are regarded as justifiable columns - LwpObjectID& rColumnID = GetColumnLayoutHead(); - LwpColumnLayout * pColumnLayout = dynamic_cast<LwpColumnLayout *>(rColumnID.obj().get()); + LwpObjectID* pColumnID = &GetColumnLayoutHead(); + LwpColumnLayout * pColumnLayout = dynamic_cast<LwpColumnLayout *>(pColumnID->obj().get()); std::set<LwpColumnLayout*> aSeen; while (pColumnLayout) { @@ -589,8 +589,8 @@ void LwpTableLayout::RegisterColumns() nJustifiableColumn --; } - rColumnID = pColumnLayout->GetNext(); - pColumnLayout = dynamic_cast<LwpColumnLayout *>(rColumnID.obj().get()); + pColumnID = &pColumnLayout->GetNext(); + pColumnLayout = dynamic_cast<LwpColumnLayout *>(pColumnID->obj().get()); if (aSeen.find(pColumnLayout) != aSeen.end()) throw std::runtime_error("loop in conversion"); @@ -670,15 +670,15 @@ void LwpTableLayout::RegisterRows() m_DefaultRowStyleName = pXFStyleManager->AddStyle(std::move(xRowStyle)).m_pStyle->GetStyleName(); // register style of rows - LwpObjectID& rRowID = GetChildHead(); - LwpRowLayout * pRowLayout = dynamic_cast<LwpRowLayout *>(rRowID.obj().get()); + LwpObjectID * pRowID = &GetChildHead(); + LwpRowLayout * pRowLayout = dynamic_cast<LwpRowLayout *>(pRowID->obj().get()); while (pRowLayout) { pRowLayout->SetFoundry(m_pFoundry); pRowLayout->RegisterStyle(); - rRowID = pRowLayout->GetNext(); - pRowLayout = dynamic_cast<LwpRowLayout *>(rRowID.obj().get()); + pRowID = &pRowLayout->GetNext(); + pRowLayout = dynamic_cast<LwpRowLayout *>(pRowID->obj().get()); } } /** @@ -1274,8 +1274,8 @@ void LwpTableLayout::ConvertColumn(rtl::Reference<XFTable> const & pXFTable, sal for (sal_uInt32 iLoop = 0; iLoop < static_cast<sal_uInt32>(nEndCol)-nStartCol; ++iLoop) { // add row to table - LwpObjectID& rColID = GetColumnLayoutHead(); - LwpColumnLayout * pColumnLayout = dynamic_cast<LwpColumnLayout *>(rColID.obj().get()); + LwpObjectID *pColID = &GetColumnLayoutHead(); + LwpColumnLayout * pColumnLayout = dynamic_cast<LwpColumnLayout *>(pColID->obj().get()); while (pColumnLayout) { if (pColumnLayout->GetColumnID() == (iLoop+nStartCol)) @@ -1283,8 +1283,8 @@ void LwpTableLayout::ConvertColumn(rtl::Reference<XFTable> const & pXFTable, sal pXFTable->SetColumnStyle(iLoop+1, pColumnLayout->GetStyleName()); break; } - rColID = pColumnLayout->GetNext(); - pColumnLayout = dynamic_cast<LwpColumnLayout *>(rColID.obj().get()); + pColID = &pColumnLayout->GetNext(); + pColumnLayout = dynamic_cast<LwpColumnLayout *>(pColID->obj().get()); } if (!pColumnLayout) { @@ -1417,15 +1417,15 @@ XFCell* LwpTableLayout::GetCellsMap(sal_uInt16 nRow,sal_uInt8 nCol) */ LwpRowLayout* LwpTableLayout::GetRowLayout(sal_uInt16 nRow) { - LwpObjectID& rRowID = GetChildHead(); - LwpRowLayout * pRowLayout = dynamic_cast<LwpRowLayout *>(rRowID.obj().get()); + LwpObjectID *pRowID = &GetChildHead(); + LwpRowLayout * pRowLayout = dynamic_cast<LwpRowLayout *>(pRowID->obj().get()); while (pRowLayout) { if(pRowLayout->GetRowID() == nRow) return pRowLayout; - rRowID = pRowLayout->GetNext(); - pRowLayout = dynamic_cast<LwpRowLayout *>(rRowID.obj().get()); + pRowID = &pRowLayout->GetNext(); + pRowLayout = dynamic_cast<LwpRowLayout *>(pRowID->obj().get()); } return nullptr; } diff --git a/lotuswordpro/source/filter/lwptoc.cxx b/lotuswordpro/source/filter/lwptoc.cxx index 4d429ddb258c..e81bf7039be4 100644 --- a/lotuswordpro/source/filter/lwptoc.cxx +++ b/lotuswordpro/source/filter/lwptoc.cxx @@ -393,8 +393,8 @@ sal_uInt16 LwpTocSuperLayout::GetSeparatorType(sal_uInt16 index) */ LwpTocLevelData * LwpTocSuperLayout::GetSearchLevelPtr(sal_uInt16 index) { - LwpObjectID& rID = m_SearchItems.GetHead(); - LwpTocLevelData * pObj = dynamic_cast<LwpTocLevelData *>(rID.obj().get()); + LwpObjectID * pID = &m_SearchItems.GetHead(); // not necessary to check pID NULL or not + LwpTocLevelData * pObj = dynamic_cast<LwpTocLevelData *>(pID->obj().get()); while(pObj) { @@ -403,8 +403,8 @@ LwpTocLevelData * LwpTocSuperLayout::GetSearchLevelPtr(sal_uInt16 index) return pObj; } - rID = pObj->GetNext(); - pObj = dynamic_cast<LwpTocLevelData *>(rID.obj().get()); + pID = &pObj->GetNext(); // not necessary to check pID NULL or not + pObj = dynamic_cast<LwpTocLevelData *>(pID->obj().get()); } return nullptr; @@ -417,8 +417,8 @@ LwpTocLevelData * LwpTocSuperLayout::GetSearchLevelPtr(sal_uInt16 index) */ LwpTocLevelData * LwpTocSuperLayout::GetNextSearchLevelPtr(sal_uInt16 index, LwpTocLevelData * pCurData) { - LwpObjectID& rID = pCurData->GetNext(); - LwpTocLevelData * pObj = dynamic_cast<LwpTocLevelData *>(rID.obj().get()); + LwpObjectID * pID = &pCurData->GetNext(); + LwpTocLevelData * pObj = dynamic_cast<LwpTocLevelData *>(pID->obj().get()); while(pObj) { @@ -427,8 +427,8 @@ LwpTocLevelData * LwpTocSuperLayout::GetNextSearchLevelPtr(sal_uInt16 index, Lwp return pObj; } - rID = pObj->GetNext(); - pObj = dynamic_cast<LwpTocLevelData *>(rID.obj().get()); + pID = &pObj->GetNext(); // not necessary to check pID NULL or not + pObj = dynamic_cast<LwpTocLevelData *>(pID->obj().get()); } return nullptr; |