[Libreoffice-commits] core.git: editeng/source include/editeng

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Sun Mar 21 19:46:57 UTC 2021


 editeng/source/editeng/editobj.cxx  |    5 +----
 editeng/source/editeng/impedit5.cxx |    5 +----
 editeng/source/uno/unoedhlp.cxx     |    8 ++------
 include/editeng/editdata.hxx        |    6 ++++++
 4 files changed, 10 insertions(+), 14 deletions(-)

New commits:
commit eb8b769f8e5ee6383e04e08cfde4aa345a24e4c1
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sun Mar 21 14:50:21 2021 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Sun Mar 21 20:46:06 2021 +0100

    cid#1473926 Uninitialized scalar variable
    
    Change-Id: I794d2b58aa65f7eeb3aa32fa50e827ebf32b35ab
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112843
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/editeng/source/editeng/editobj.cxx b/editeng/source/editeng/editobj.cxx
index af80e2845bd6..2cb69858510b 100644
--- a/editeng/source/editeng/editobj.cxx
+++ b/editeng/source/editeng/editobj.cxx
@@ -715,10 +715,7 @@ void EditTextObjectImpl::GetCharAttribs( sal_Int32 nPara, std::vector<EECharAttr
     for (const auto & aAttrib : rC.maCharAttribs)
     {
         const XEditAttribute& rAttr = *aAttrib;
-        EECharAttrib aEEAttr;
-        aEEAttr.pAttr = rAttr.GetItem();
-        aEEAttr.nStart = rAttr.GetStart();
-        aEEAttr.nEnd = rAttr.GetEnd();
+        EECharAttrib aEEAttr(rAttr.GetStart(), rAttr.GetEnd(), rAttr.GetItem());
         rLst.push_back(aEEAttr);
     }
 }
diff --git a/editeng/source/editeng/impedit5.cxx b/editeng/source/editeng/impedit5.cxx
index 248d78455dc4..3db8903650d1 100644
--- a/editeng/source/editeng/impedit5.cxx
+++ b/editeng/source/editeng/impedit5.cxx
@@ -744,10 +744,7 @@ void ImpEditEngine::GetCharAttribs( sal_Int32 nPara, std::vector<EECharAttrib>&
     for (const auto & i : rAttrs)
     {
         const EditCharAttrib& rAttr = *i;
-        EECharAttrib aEEAttr;
-        aEEAttr.pAttr = rAttr.GetItem();
-        aEEAttr.nStart = rAttr.GetStart();
-        aEEAttr.nEnd = rAttr.GetEnd();
+        EECharAttrib aEEAttr(rAttr.GetStart(), rAttr.GetEnd(), rAttr.GetItem());
         rLst.push_back(aEEAttr);
     }
 }
diff --git a/editeng/source/uno/unoedhlp.cxx b/editeng/source/uno/unoedhlp.cxx
index 19e14fcfc50a..9b5b98fc6df2 100644
--- a/editeng/source/uno/unoedhlp.cxx
+++ b/editeng/source/uno/unoedhlp.cxx
@@ -100,9 +100,7 @@ void SvxEditSourceHelper::GetAttributeRun( sal_Int32& nStartIndex, sal_Int32& nE
         {
             if (nIndex2 < aTempCharAttribs[nAttr].nStart)
             {
-                EECharAttrib aEEAttr;
-                aEEAttr.nStart = nIndex2;
-                aEEAttr.nEnd = aTempCharAttribs[nAttr].nStart;
+                EECharAttrib aEEAttr(nIndex2, aTempCharAttribs[nAttr].nStart);
                 aCharAttribs.insert(aCharAttribs.begin() + nAttr, aEEAttr);
             }
             nIndex2 = aTempCharAttribs[nAttr].nEnd;
@@ -110,9 +108,7 @@ void SvxEditSourceHelper::GetAttributeRun( sal_Int32& nStartIndex, sal_Int32& nE
         }
         if ( nIndex2 != nParaLen )
         {
-            EECharAttrib aEEAttr;
-            aEEAttr.nStart = nIndex2;
-            aEEAttr.nEnd = nParaLen;
+            EECharAttrib aEEAttr(nIndex2, nParaLen);
             aCharAttribs.push_back(aEEAttr);
         }
     }
diff --git a/include/editeng/editdata.hxx b/include/editeng/editdata.hxx
index 40c74cb2b8c6..5ed618fc7b80 100644
--- a/include/editeng/editdata.hxx
+++ b/include/editeng/editdata.hxx
@@ -274,6 +274,12 @@ struct EECharAttrib
 
     sal_Int32           nStart;
     sal_Int32           nEnd;
+    EECharAttrib(sal_Int32 nSt, sal_Int32 nE, const SfxPoolItem* pA = nullptr)
+        : pAttr(pA)
+        , nStart(nSt)
+        , nEnd(nE)
+    {
+    }
 };
 
 struct MoveParagraphsInfo


More information about the Libreoffice-commits mailing list