basic/source/comp/buffer.cxx | 1 - sw/qa/core/macros-test.cxx | 4 ++-- sw/qa/core/text/text.cxx | 2 +- sw/qa/core/txtnode/txtnode.cxx | 4 ++-- sw/qa/core/uwriter.cxx | 14 +++++++------- sw/qa/extras/uiwriter/uiwriter2.cxx | 6 ++---- sw/qa/extras/uiwriter/uiwriter5.cxx | 3 ++- sw/qa/extras/uiwriter/uiwriter8.cxx | 3 ++- sw/qa/extras/ww8export/ww8export.cxx | 2 +- 9 files changed, 19 insertions(+), 20 deletions(-)
New commits: commit c66f655be6412910ad1dc041adb519d2c630fe8d Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Wed Aug 31 10:52:51 2022 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Wed Aug 31 13:13:43 2022 +0200 cid#1509223 Inefficient vector resizing with reserve. Change-Id: I12f215d60a7420676523c7cec85bfa5149683841 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139083 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/basic/source/comp/buffer.cxx b/basic/source/comp/buffer.cxx index ff6b5173f3fd..06dafe7a21d7 100644 --- a/basic/source/comp/buffer.cxx +++ b/basic/source/comp/buffer.cxx @@ -49,7 +49,6 @@ template <typename T> void SbiBuffer::append(T n) m_aBuf.clear(); return; } - m_aBuf.reserve(m_aBuf.size() + sizeof(n)); write(std::back_inserter(m_aBuf), n); } commit 38b7c85f59e8b4ea2a0ae19ababa4da9c7061e99 Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Tue Aug 30 18:41:51 2022 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Wed Aug 31 13:13:27 2022 +0200 use more SwPosition::Assign part of hiding the internals of SwPosition Change-Id: I4e50aa5c71f86ed0d06e4c42b84d11158579207f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139061 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sw/qa/core/macros-test.cxx b/sw/qa/core/macros-test.cxx index 51b6b4c3cc00..0df5ea55a44f 100644 --- a/sw/qa/core/macros-test.cxx +++ b/sw/qa/core/macros-test.cxx @@ -534,7 +534,7 @@ void SwMacrosTest::testFindReplace() opts, false, SwDocPositions::Curr, SwDocPositions::End, bCancel, FindRanges::InBody); CPPUNIT_ASSERT(bFound); CPPUNIT_ASSERT(pPaM->HasMark()); - CPPUNIT_ASSERT(pPaM->GetPoint()->nNode != pPaM->GetMark()->nNode); + CPPUNIT_ASSERT(pPaM->GetPoint()->GetNode() != pPaM->GetMark()->GetNode()); CPPUNIT_ASSERT_EQUAL(OUString(OUStringChar(CH_TXTATR_NEWLINE)), pPaM->GetText()); // now do another Find, inside the selection from the first Find @@ -543,7 +543,7 @@ void SwMacrosTest::testFindReplace() opts, false, SwDocPositions::Curr, SwDocPositions::End, bCancel, FindRanges::InSel); CPPUNIT_ASSERT(bFound); CPPUNIT_ASSERT(pPaM->HasMark()); - CPPUNIT_ASSERT(pPaM->GetPoint()->nNode != pPaM->GetMark()->nNode); + CPPUNIT_ASSERT(pPaM->GetPoint()->GetNode() != pPaM->GetMark()->GetNode()); CPPUNIT_ASSERT_EQUAL(OUString(OUStringChar(CH_TXTATR_NEWLINE)), pPaM->GetText()); rIDCO.ReplaceRange(*pPaM, " ", true); diff --git a/sw/qa/core/text/text.cxx b/sw/qa/core/text/text.cxx index 46d7c5156b12..50739240ad70 100644 --- a/sw/qa/core/text/text.cxx +++ b/sw/qa/core/text/text.cxx @@ -511,7 +511,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testAsCharImageDocModelFromViewPoint) // - Actual : SwNodeIndex (node 12) // i.e. the cursor position was the text node hosting the as-char image, not the graphic node of // the image. - CPPUNIT_ASSERT_EQUAL(aGraphicNode, pShellCursor->GetMark()->nNode); + CPPUNIT_ASSERT_EQUAL(aGraphicNode.GetIndex(), pShellCursor->GetMark()->GetNodeIndex()); } CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testRedlineDelete) diff --git a/sw/qa/core/txtnode/txtnode.cxx b/sw/qa/core/txtnode/txtnode.cxx index d975c32c10fd..510bcbb92284 100644 --- a/sw/qa/core/txtnode/txtnode.cxx +++ b/sw/qa/core/txtnode/txtnode.cxx @@ -79,11 +79,11 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testTextBoxCopyAnchor) SwPosition aDrawAnchor1 = *rFormats[0]->GetAnchor().GetContentAnchor(); SwPosition aFlyAnchor1 = *rFormats[1]->GetAnchor().GetContentAnchor(); - CPPUNIT_ASSERT_EQUAL(aFlyAnchor1.nNode, aDrawAnchor1.nNode); + CPPUNIT_ASSERT_EQUAL(aFlyAnchor1.GetNodeIndex(), aDrawAnchor1.GetNodeIndex()); SwPosition aDrawAnchor2 = *rFormats[2]->GetAnchor().GetContentAnchor(); SwPosition aFlyAnchor2 = *rFormats[3]->GetAnchor().GetContentAnchor(); // This also failed, aFlyAnchor2 was wrong, as it got out of sync with aDrawAnchor2. - CPPUNIT_ASSERT_EQUAL(aFlyAnchor2.nNode, aDrawAnchor2.nNode); + CPPUNIT_ASSERT_EQUAL(aFlyAnchor2.GetNodeIndex(), aDrawAnchor2.GetNodeIndex()); } CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testTextBoxNodeSplit) diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx index eed900880005..7b6089b50641 100644 --- a/sw/qa/core/uwriter.cxx +++ b/sw/qa/core/uwriter.cxx @@ -971,13 +971,13 @@ void SwDocTest::testGraphicAnchorDeletion() m_pDoc->getIDocumentContentOperations().AppendTextNode(*aPaM.GetPoint()); m_pDoc->getIDocumentContentOperations().InsertString(aPaM, "graphic anchor>><<graphic anchor"); - SwNodeIndex nPara2 = aPaM.GetPoint()->nNode; + SwNodeIndex nPara2(aPaM.GetPoint()->GetNode()); m_pDoc->getIDocumentContentOperations().AppendTextNode(*aPaM.GetPoint()); m_pDoc->getIDocumentContentOperations().InsertString(aPaM, "Paragraph 3"); - aPaM.GetPoint()->nNode = nPara2; - aPaM.GetPoint()->nContent.Assign(aPaM.GetPointContentNode(), RTL_CONSTASCII_LENGTH("graphic anchor>>")); + aPaM.GetPoint()->Assign(nPara2); + aPaM.GetPoint()->SetContent(RTL_CONSTASCII_LENGTH("graphic anchor>>")); //Insert a graphic at X of >>X<< in paragraph 2 SfxItemSet aFlySet(m_pDoc->GetAttrPool(), svl::Items<RES_FRMATR_BEGIN, RES_FRMATR_END-1>); @@ -990,12 +990,12 @@ void SwDocTest::testGraphicAnchorDeletion() CPPUNIT_ASSERT_EQUAL_MESSAGE("Should be 1 graphic", static_cast<size_t>(1), m_pDoc->GetFlyCount(FLYCNTTYPE_GRF)); //Delete >X< - aPaM.GetPoint()->nNode = nPara2; - aPaM.GetPoint()->nContent.Assign(aPaM.GetPointContentNode(), + aPaM.GetPoint()->Assign(nPara2); + aPaM.GetPoint()->SetContent( RTL_CONSTASCII_LENGTH("graphic anchor>><")+1); aPaM.SetMark(); - aPaM.GetPoint()->nNode = nPara2; - aPaM.GetPoint()->nContent.Assign(aPaM.GetPointContentNode(), RTL_CONSTASCII_LENGTH("graphic anchor>")); + aPaM.GetPoint()->Assign(nPara2); + aPaM.GetPoint()->SetContent(RTL_CONSTASCII_LENGTH("graphic anchor>")); m_pDoc->getIDocumentContentOperations().DeleteRange(aPaM); #ifdef DEBUG_AS_HTML diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index 89d5c0c9ff9f..7f536462e431 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -1673,8 +1673,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf109376_redline) pWrtShell->StartOfSection(false); SwPaM pam(*pWrtShell->GetCursor()->GetPoint()); pam.SetMark(); - pam.GetPoint()->nNode = *rTable.GetTableNode(); - pam.GetPoint()->nContent.Assign(nullptr, 0); + pam.GetPoint()->Assign(*rTable.GetTableNode()); pam.Exchange(); // same selection direction as in doc compare... IDocumentRedlineAccess& rIDRA(pDoc->getIDocumentRedlineAccess()); @@ -1724,8 +1723,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf109376) pWrtShell->StartOfSection(false); SwPaM pam(*pWrtShell->GetCursor()->GetPoint()); pam.SetMark(); - pam.GetPoint()->nNode = *rTable.GetTableNode(); - pam.GetPoint()->nContent.Assign(nullptr, 0); + pam.GetPoint()->Assign(*rTable.GetTableNode()); pam.Exchange(); // same selection direction as in doc compare... // this used to assert/crash with m_pAnchoredFlys mismatch because the diff --git a/sw/qa/extras/uiwriter/uiwriter5.cxx b/sw/qa/extras/uiwriter/uiwriter5.cxx index 4c0f776c7fc8..28f67d633b32 100644 --- a/sw/qa/extras/uiwriter/uiwriter5.cxx +++ b/sw/qa/extras/uiwriter/uiwriter5.cxx @@ -814,7 +814,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testCheckboxFormFieldInsertion) SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->StartOfSection(false); pWrtShell->SplitNode(); - CPPUNIT_ASSERT_EQUAL(pFieldmark->GetMarkPos().nNode, pFieldmark->GetOtherMarkPos().nNode); + CPPUNIT_ASSERT_EQUAL(pFieldmark->GetMarkPos().GetNodeIndex(), + pFieldmark->GetOtherMarkPos().GetNodeIndex()); CPPUNIT_ASSERT_EQUAL(sal_Int32(pFieldmark->GetMarkPos().GetContentIndex() + 1), pFieldmark->GetOtherMarkPos().GetContentIndex()); } diff --git a/sw/qa/extras/uiwriter/uiwriter8.cxx b/sw/qa/extras/uiwriter/uiwriter8.cxx index 8cef82d03ac7..698985b48d60 100644 --- a/sw/qa/extras/uiwriter/uiwriter8.cxx +++ b/sw/qa/extras/uiwriter/uiwriter8.cxx @@ -990,7 +990,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf130805) CPPUNIT_ASSERT(pTxAnch); CPPUNIT_ASSERT(pShpAnch); - CPPUNIT_ASSERT_EQUAL_MESSAGE("The textbox got apart!", pTxAnch->nNode, pShpAnch->nNode); + CPPUNIT_ASSERT_EQUAL_MESSAGE("The textbox got apart!", pTxAnch->GetNodeIndex(), + pShpAnch->GetNodeIndex()); } CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf107893) diff --git a/sw/qa/extras/ww8export/ww8export.cxx b/sw/qa/extras/ww8export/ww8export.cxx index 802717ad1ed5..a92d4899194b 100644 --- a/sw/qa/extras/ww8export/ww8export.cxx +++ b/sw/qa/extras/ww8export/ww8export.cxx @@ -764,7 +764,7 @@ DECLARE_WW8EXPORT_TEST( testTdf105570, "tdf105570.doc" ) SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); SwShellCursor* pShellCursor = pWrtShell->getShellCursor( false ); - SwNodeIndex aIdx = pShellCursor->Start()->nNode; + SwNodeIndex aIdx( pShellCursor->Start()->GetNode() ); // Find first table SwTableNode* pTableNd = aIdx.GetNode().FindTableNode();