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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Tue Jun 8 11:25:16 UTC 2021


 editeng/source/rtf/svxrtf.cxx |   14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

New commits:
commit de9b6e3deeeffa2405fe890946714c2e439e1583
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Jun 8 09:37:40 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Jun 8 13:24:29 2021 +0200

    cid#1485166 silence Uninitialized scalar variable
    
    seeing as there are no warnings about
    SvxRTFItemStackType::SetStartPos
    try that pattern
    
    Change-Id: Icad28503047323b01d8e048061c6b037bcdcb83c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116817
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/editeng/source/rtf/svxrtf.cxx b/editeng/source/rtf/svxrtf.cxx
index 661a6cb11163..e94159e29e77 100644
--- a/editeng/source/rtf/svxrtf.cxx
+++ b/editeng/source/rtf/svxrtf.cxx
@@ -935,12 +935,17 @@ SvxRTFItemStackType::SvxRTFItemStackType(
         const EditPosition& rPos )
     : aAttrSet( rPool, pWhichRange )
     , mxStartNodeIdx(rPos.MakeNodeIdx())
-    // coverity[read_parm_fld : FALSE] - difficulty with std::optional leading to bogus 'Uninitialized scalar variable'
+#if !defined(__COVERITY__)
+    // coverity 2020 has difficulty wrt std::optional leading to bogus 'Uninitialized scalar variable'
     , mxEndNodeIdx(mxStartNodeIdx)
+#endif
     , nSttCnt(rPos.GetCntIdx())
     , nEndCnt(nSttCnt)
     , nStyleNo(0)
 {
+#if defined(__COVERITY__)
+    mxEndNodeIdx = mxStartNodeIdx;
+#endif
 }
 
 SvxRTFItemStackType::SvxRTFItemStackType(
@@ -949,12 +954,17 @@ SvxRTFItemStackType::SvxRTFItemStackType(
         bool const bCopyAttr )
     : aAttrSet( *rCpy.aAttrSet.GetPool(), rCpy.aAttrSet.GetRanges() )
     , mxStartNodeIdx(rPos.MakeNodeIdx())
-    // coverity[read_parm_fld : FALSE] - difficulty with std::optional leading to bogus 'Uninitialized scalar variable'
+#if !defined(__COVERITY__)
+    // coverity 2020 has difficulty wrt std::optional leading to bogus 'Uninitialized scalar variable'
     , mxEndNodeIdx(mxStartNodeIdx)
+#endif
     , nSttCnt(rPos.GetCntIdx())
     , nEndCnt(nSttCnt)
     , nStyleNo(rCpy.nStyleNo)
 {
+#if defined(__COVERITY__)
+    mxEndNodeIdx = mxStartNodeIdx;
+#endif
     aAttrSet.SetParent( &rCpy.aAttrSet );
     if( bCopyAttr )
         aAttrSet.Put( rCpy.aAttrSet );


More information about the Libreoffice-commits mailing list