sw/source/core/docnode/ndtbl1.cxx |   14 +++++++-------
 sw/source/core/text/portxt.cxx    |   14 +++++++-------
 2 files changed, 14 insertions(+), 14 deletions(-)

New commits:
commit a853ff78e0e3311bc521bb2c1a2ad9f6f633869b
Author:     Caolán McNamara <[email protected]>
AuthorDate: Fri Dec 5 09:40:14 2025 +0000
Commit:     Caolán McNamara <[email protected]>
CommitDate: Sat Dec 6 12:12:15 2025 +0100

    lcl_CalcCellFit always dereferences its first argument
    
    Change-Id: I4fb7ae6e39617f74413cd1399bfc0a08f67be4ec
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195071
    Reviewed-by: Caolán McNamara <[email protected]>
    Tested-by: Jenkins

diff --git a/sw/source/core/docnode/ndtbl1.cxx 
b/sw/source/core/docnode/ndtbl1.cxx
index 958ce825f6c8..a507ac6fa7c8 100644
--- a/sw/source/core/docnode/ndtbl1.cxx
+++ b/sw/source/core/docnode/ndtbl1.cxx
@@ -1415,11 +1415,11 @@ sal_uInt16 SwDoc::GetBoxAlign( const SwCursor& rCursor )
     return nAlign;
 }
 
-static sal_uInt16 lcl_CalcCellFit( const SwLayoutFrame *pCell )
+static sal_uInt16 lcl_CalcCellFit(const SwLayoutFrame& rCell)
 {
     SwTwips nRet = 0;
-    const SwFrame *pFrame = pCell->Lower(); // The whole Line
-    SwRectFnSet aRectFnSet(*pCell);
+    const SwFrame *pFrame = rCell.Lower(); // The whole Line
+    SwRectFnSet aRectFnSet(rCell);
     while ( pFrame )
     {
         const SwTwips nAdd = aRectFnSet.GetWidth(pFrame->getFrameArea()) -
@@ -1434,8 +1434,8 @@ static sal_uInt16 lcl_CalcCellFit( const SwLayoutFrame 
*pCell )
         pFrame = pFrame->GetNext();
     }
     // Surrounding border as well as left and Right Border also need to be 
respected
-    nRet += aRectFnSet.GetWidth(pCell->getFrameArea()) -
-            aRectFnSet.GetWidth(pCell->getFramePrintArea());
+    nRet += aRectFnSet.GetWidth(rCell.getFrameArea()) -
+            aRectFnSet.GetWidth(rCell.getFramePrintArea());
 
     // To compensate for the accuracy of calculation later on in 
SwTable::SetTabCols
     // we keep adding up a little.
@@ -1461,7 +1461,7 @@ static void lcl_CalcSubColValues( std::vector<sal_uInt16> 
&rToFill, const SwTabC
                               bool bWishValues )
 {
     const sal_uInt16 nWish = bWishValues ?
-                    ::lcl_CalcCellFit( pCell ) :
+                    ::lcl_CalcCellFit(*pCell) :
                     MINLAY + sal_uInt16(pCell->getFrameArea().Width() - 
pCell->getFramePrintArea().Width());
 
     SwRectFnSet aRectFnSet(*pTab);
@@ -1579,7 +1579,7 @@ static void lcl_CalcColValues( std::vector<sal_uInt16> 
&rToFill, const SwTabCols
                         bNotInCols = false;
                         if ( bWishValues )
                         {
-                            const sal_uInt16 nWish = ::lcl_CalcCellFit( pCell 
);
+                            const sal_uInt16 nWish = ::lcl_CalcCellFit(*pCell);
                             if ( nWish > nFit )
                                 nFit = nWish;
                         }
commit 6ac875f9cae982c3846fa442ac08db178ac00dce
Author:     Caolán McNamara <[email protected]>
AuthorDate: Fri Dec 5 10:05:44 2025 +0000
Commit:     Caolán McNamara <[email protected]>
CommitDate: Sat Dec 6 12:12:04 2025 +0100

    once set, these never change
    
    Change-Id: I93c9293e624a21b29a4605d504c2c75eac2bc9da
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195074
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <[email protected]>

diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx
index 784d33207900..4049124403aa 100644
--- a/sw/source/core/text/portxt.cxx
+++ b/sw/source/core/text/portxt.cxx
@@ -539,12 +539,12 @@ bool SwTextPortion::Format_( SwTextFormatInfo &rInf )
     // adjusted line by shrinking spaces using the know space count from the 
first Guess() call
     SvxAdjustItem aAdjustItem = 
rInf.GetTextFrame()->GetTextNodeForParaProps()->GetSwAttrSet().GetAdjust();
     const SvxAdjust aAdjust = aAdjustItem.GetAdjust();
-    bool bFullJustified = bFull && aAdjust == SvxAdjust::Block &&
+    const bool bFullJustified = bFull && aAdjust == SvxAdjust::Block &&
          pGuess->BreakPos() != TextFrameIndex(COMPLETE_STRING);
-    bool bInteropSmartJustify = bFullJustified &&
+    const bool bInteropSmartJustify = bFullJustified &&
             rInf.GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(
                     DocumentSettingId::JUSTIFY_LINES_WITH_SHRINKING);
-    bool bNoWordSpacing = aAdjustItem.GetPropWordSpacing() == 100 &&
+    const bool bNoWordSpacing = aAdjustItem.GetPropWordSpacing() == 100 &&
                     aAdjustItem.GetPropWordSpacingMinimum() == 100 &&
                     aAdjustItem.GetPropWordSpacingMaximum() == 100 &&
                     aAdjustItem.GetPropScaleWidthMinimum() == 100 &&
@@ -552,11 +552,11 @@ bool SwTextPortion::Format_( SwTextFormatInfo &rInf )
                     aAdjustItem.GetPropLetterSpacingMinimum() == 0 &&
                     aAdjustItem.GetPropLetterSpacingMaximum() == 0;
     // support old ODT documents, where only JustifyLinesWithShrinking was set
-    bool bOldInterop = bInteropSmartJustify && bNoWordSpacing;
-    bool bWordSpacing = bFullJustified && (!bNoWordSpacing || bOldInterop);
-    bool bWordSpacingMaximum = bWordSpacing && !bOldInterop &&
+    const bool bOldInterop = bInteropSmartJustify && bNoWordSpacing;
+    const bool bWordSpacing = bFullJustified && (!bNoWordSpacing || 
bOldInterop);
+    const bool bWordSpacingMaximum = bWordSpacing && !bOldInterop &&
            aAdjustItem.GetPropWordSpacingMaximum() > 
aAdjustItem.GetPropWordSpacing();
-    bool bWordSpacingMinimum = bWordSpacing && ( bOldInterop ||
+    const bool bWordSpacingMinimum = bWordSpacing && ( bOldInterop ||
            aAdjustItem.GetPropWordSpacingMinimum() < 
aAdjustItem.GetPropWordSpacing() );
 
     if ( ( bInteropSmartJustify || bWordSpacing || bWordSpacingMaximum || 
bWordSpacingMinimum ) &&

Reply via email to