[Libreoffice-commits] core.git: 14 commits - accessibility/source filter/source framework/source idlc/source sal/rtl sd/source svtools/source sw/source vcl/generic vcl/source

Caolán McNamara caolanm at redhat.com
Fri Oct 3 01:08:25 PDT 2014


 accessibility/source/extended/AccessibleGridControlHeader.cxx |    5 -
 filter/source/msfilter/msdffimp.cxx                           |    4 -
 framework/source/fwe/classes/addonsoptions.cxx                |    3 
 idlc/source/parser.y                                          |    6 -
 sal/rtl/strtmpl.cxx                                           |   37 ++++------
 sd/source/ui/view/DocumentRenderer.cxx                        |    4 -
 svtools/source/uno/treecontrolpeer.cxx                        |    3 
 sw/source/filter/writer/writer.cxx                            |    9 +-
 sw/source/filter/ww8/ww8par5.cxx                              |   10 +-
 sw/source/uibase/shells/grfsh.cxx                             |    4 -
 vcl/generic/fontmanager/fontmanager.cxx                       |    4 -
 vcl/generic/print/genprnpsp.cxx                               |    4 -
 vcl/source/gdi/pngread.cxx                                    |    2 
 13 files changed, 47 insertions(+), 48 deletions(-)

New commits:
commit adf74f8287a626d5dbd40a65c87cc79702b482fb
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Oct 2 21:06:37 2014 +0100

    coverity#1241327 Dereference after null check
    
    Change-Id: I214884e9ee1d49dcc4db71f8744513468b912691

diff --git a/sal/rtl/strtmpl.cxx b/sal/rtl/strtmpl.cxx
index a990159..71a2fb2 100644
--- a/sal/rtl/strtmpl.cxx
+++ b/sal/rtl/strtmpl.cxx
@@ -1375,24 +1375,22 @@ void SAL_CALL IMPL_RTL_STRINGNAME( newFromLiteral )( IMPL_RTL_STRINGDATA** ppThi
 
     *ppThis = IMPL_RTL_STRINGNAME( ImplAlloc )( nLen + allocExtra );
     assert( *ppThis != NULL );
-    if ( (*ppThis) )
+
+    (*ppThis)->length = nLen; // fix after possible allocExtra != 0
+    (*ppThis)->buffer[nLen] = 0;
+    IMPL_RTL_STRCODE* pBuffer = (*ppThis)->buffer;
+    sal_Int32 nCount;
+    for( nCount = nLen; nCount > 0; --nCount )
     {
-        (*ppThis)->length = nLen; // fix after possible allocExtra != 0
-        (*ppThis)->buffer[nLen] = 0;
-        IMPL_RTL_STRCODE* pBuffer = (*ppThis)->buffer;
-        sal_Int32 nCount;
-        for( nCount = nLen; nCount > 0; --nCount )
-        {
-            /* Check ASCII range */
-            SAL_WARN_IF( ((unsigned char)*pCharStr) > 127, "rtl.string",
-                        "rtl_uString_newFromLiteral - Found char > 127" );
-            SAL_WARN_IF( ((unsigned char)*pCharStr) == '\0', "rtl.string",
-                        "rtl_uString_newFromLiteral - Found embedded \\0 character" );
-
-            *pBuffer = *pCharStr;
-            pBuffer++;
-            pCharStr++;
-        }
+        /* Check ASCII range */
+        SAL_WARN_IF( ((unsigned char)*pCharStr) > 127, "rtl.string",
+                    "rtl_uString_newFromLiteral - Found char > 127" );
+        SAL_WARN_IF( ((unsigned char)*pCharStr) == '\0', "rtl.string",
+                    "rtl_uString_newFromLiteral - Found embedded \\0 character" );
+
+        *pBuffer = *pCharStr;
+        pBuffer++;
+        pCharStr++;
     }
 
     RTL_LOG_STRING_NEW( *ppThis );
commit 898cb8b726128c98e44539ca3c24e72ceb1742c6
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Oct 2 21:04:58 2014 +0100

    coverity#982268 Copy-paste error
    
    Change-Id: I68e8e6a564356bae620647b385e16279ff212d32

diff --git a/idlc/source/parser.y b/idlc/source/parser.y
index e06b967..c239fba 100644
--- a/idlc/source/parser.y
+++ b/idlc/source/parser.y
@@ -2153,9 +2153,9 @@ at_least_one_scoped_name :
             $$ = $2;
         } else
         {
-            StringList* pNames = new StringList();
-            pNames->push_back(*$1);
-            $$ = pNames;
+            StringList* pScopedNames = new StringList();
+            pScopedNames->push_back(*$1);
+            $$ = pScopedNames;
         }
         delete($1);
     }
commit 9a65df25138750915f9c6e1e1fa09988a2d11434
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Oct 2 21:00:22 2014 +0100

    coverity#1078526 Logically dead code
    
    Change-Id: I203511fcb1e740d7d371821d49a7c13a72e6fc3b

diff --git a/framework/source/fwe/classes/addonsoptions.cxx b/framework/source/fwe/classes/addonsoptions.cxx
index 27891a4..550112c 100644
--- a/framework/source/fwe/classes/addonsoptions.cxx
+++ b/framework/source/fwe/classes/addonsoptions.cxx
@@ -1451,8 +1451,7 @@ AddonsOptions_Impl::ImageEntry* AddonsOptions_Impl::ReadImageData( const OUStrin
 
             SubstituteVariables( aImageURL );
 
-            pEntry->addImage(i == OFFSET_IMAGES_SMALL ? IMGSIZE_SMALL : IMGSIZE_BIG,
-                             Image(), aImageURL);
+            pEntry->addImage(IMGSIZE_BIG, Image(), aImageURL);
         }
     }
 
commit c7ee74cedaaac2951849852546d653ee8c4c4135
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Oct 2 20:56:39 2014 +0100

    coverity#1093225 Dereference after null check
    
    Change-Id: I34a7b79b4a7b5d86c3d39fd995ed3bd998eeeab8

diff --git a/vcl/source/gdi/pngread.cxx b/vcl/source/gdi/pngread.cxx
index 8a17b16..2bbfede 100644
--- a/vcl/source/gdi/pngread.cxx
+++ b/vcl/source/gdi/pngread.cxx
@@ -1619,6 +1619,8 @@ void PNGReaderImpl::ImplSetAlphaPixel( sal_uInt32 nY, sal_uInt32 nX,
     nX >>= mnPreviewShift;
 
     mpAcc->SetPixel( nY, nX, rBitmapColor );
+    if (!mpMaskAcc)
+        return;
     mpMaskAcc->SetPixelIndex( nY, nX, ~nAlpha );
 }
 
commit 6b1d355988c0c51e3c6d8acd32184d79a8ea5011
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Oct 2 20:54:16 2014 +0100

    coverity#1241080 Dereference after null check
    
    Change-Id: I82113fcd4182f9557ba0e7258498b5d4e798bf03

diff --git a/sal/rtl/strtmpl.cxx b/sal/rtl/strtmpl.cxx
index c50309e..a990159 100644
--- a/sal/rtl/strtmpl.cxx
+++ b/sal/rtl/strtmpl.cxx
@@ -1768,9 +1768,8 @@ void SAL_CALL IMPL_RTL_STRINGNAME( newTrim )( IMPL_RTL_STRINGDATA** ppThis,
     {
         nLen -= nPostSpaces+nPreSpaces;
         *ppThis = IMPL_RTL_STRINGNAME( ImplAlloc )( nLen );
-        OSL_ASSERT(*ppThis != NULL);
-        if ( *ppThis )
-            rtl_str_ImplCopy( (*ppThis)->buffer, pStr->buffer+nPreSpaces, nLen );
+        assert(*ppThis);
+        rtl_str_ImplCopy( (*ppThis)->buffer, pStr->buffer+nPreSpaces, nLen );
     }
 
     RTL_LOG_STRING_NEW( *ppThis );
commit 5e0b8b7980e26c66985abe9ade7e471266d91bae
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Oct 2 20:43:07 2014 +0100

    coverity#704994 Dereference after null check
    
    Change-Id: I19f98152b5bd8c9b2cdfacb560d13fc0c1f8c4be

diff --git a/sw/source/filter/writer/writer.cxx b/sw/source/filter/writer/writer.cxx
index 700d18b..ce8aaa6 100644
--- a/sw/source/filter/writer/writer.cxx
+++ b/sw/source/filter/writer/writer.cxx
@@ -207,11 +207,10 @@ Writer::NewSwPaM(SwDoc & rDoc, sal_uLong const nStartIdx, sal_uLong const nEndId
     SwPaM* pNew = new SwPaM( aStt );
     pNew->SetMark();
     aStt = nEndIdx;
-    if( 0 == (pCNode = aStt.GetNode().GetCntntNode()) &&
-        0 == (pCNode = pNds->GoPrevious( &aStt )) )
-    {
-        OSL_FAIL( "No more ContentNode at StartPos" );
-    }
+    pCNode = aStt.GetNode().GetCntntNode();
+    if (!pCNode)
+        pCNode = pNds->GoPrevious(&aStt);
+    assert(pCNode && "No more ContentNode at StartPos");
     pCNode->MakeEndIndex( &pNew->GetPoint()->nContent );
     pNew->GetPoint()->nNode = aStt;
     return pNew;
commit 9d6c648d5478c2c45eb9333adad098d6768a91c2
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Oct 2 20:38:26 2014 +0100

    coverity#704318 Logically dead code
    
    Change-Id: I591188e0323bb75c55cad9a078eea188f79b3a03

diff --git a/svtools/source/uno/treecontrolpeer.cxx b/svtools/source/uno/treecontrolpeer.cxx
index 39ca76b..4100b40 100644
--- a/svtools/source/uno/treecontrolpeer.cxx
+++ b/svtools/source/uno/treecontrolpeer.cxx
@@ -1385,9 +1385,6 @@ Any TreeControlPeer::getProperty( const OUString& PropertyName ) throw(RuntimeEx
         UnoTreeListBoxImpl& rTree = getTreeListBoxOrThrow();
         switch(nPropId)
         {
-        case BASEPROPERTY_HIDEINACTIVESELECTION:
-            return Any( ( rTree.GetStyle() & WB_HIDESELECTION ) != 0 ? sal_True : sal_False );
-
         case BASEPROPERTY_TREE_SELECTIONTYPE:
         {
             SelectionType eSelectionType;
commit 233a2fe441461645392d10077a230ca19bd1a924
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Oct 2 20:28:34 2014 +0100

    coverity#736943 try swapping arguments around as an experiment
    
    Change-Id: I89f0cfc9049503318955d58dde3f9a3e1197c45d

diff --git a/vcl/generic/fontmanager/fontmanager.cxx b/vcl/generic/fontmanager/fontmanager.cxx
index e79c1d4..2737076 100644
--- a/vcl/generic/fontmanager/fontmanager.cxx
+++ b/vcl/generic/fontmanager/fontmanager.cxx
@@ -844,9 +844,9 @@ bool PrintFontManager::analyzeFontFile( int nDirID, const OString& rFontFile, ::
             //a sane starting point
             //http://processingjs.nihongoresources.com/the_smallest_font/
             //https://github.com/grzegorzrolek/null-ttf
-            int nMaxFontsPossible = fileSize / 528;
+            const int nMaxFontsPossible = fileSize / 528;
 
-            nLength = std::min(nLength, nMaxFontsPossible);
+            nLength = std::min(nMaxFontsPossible, nLength);
 
             for( int i = 0; i < nLength; i++ )
             {
commit a0bd9fdadc02903a551f48cc1711069b33f1ab20
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Oct 2 17:13:14 2014 +0100

    coverity#1242449 Identical code for different branches
    
    Change-Id: I0cffc9df6d971393ae874060a8c306e12966370c

diff --git a/accessibility/source/extended/AccessibleGridControlHeader.cxx b/accessibility/source/extended/AccessibleGridControlHeader.cxx
index f114bb5..bfb5a21 100644
--- a/accessibility/source/extended/AccessibleGridControlHeader.cxx
+++ b/accessibility/source/extended/AccessibleGridControlHeader.cxx
@@ -104,10 +104,7 @@ AccessibleGridControlHeader::getAccessibleAtPoint( const awt::Point& rPoint )
 
     sal_Int32 nRow = 0;
     sal_Int32 nColumnPos = 0;
-    bool bConverted = isRowBar() ?
-    m_aTable.ConvertPointToCellAddress( nRow, nColumnPos, VCLPoint( rPoint ) ) :
-    m_aTable.ConvertPointToCellAddress( nRow, nColumnPos, VCLPoint( rPoint ) );
-
+    bool bConverted = m_aTable.ConvertPointToCellAddress(nRow, nColumnPos, VCLPoint(rPoint));
     return bConverted ? implGetChild( nRow, nColumnPos ) : Reference< XAccessible >();
 }
 
commit c5401e88b46dcfe1f05edcf3e764f1588692f44e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Oct 2 17:08:35 2014 +0100

    coverity#1242521 silence Arguments in wrong order
    
    Change-Id: I30b61fa17a941b785a4f148e2ce6c912dbd3c645

diff --git a/sw/source/uibase/shells/grfsh.cxx b/sw/source/uibase/shells/grfsh.cxx
index e9e6510..d705801 100644
--- a/sw/source/uibase/shells/grfsh.cxx
+++ b/sw/source/uibase/shells/grfsh.cxx
@@ -834,7 +834,9 @@ void SwGrfShell::ExecuteRotation(SfxRequest &rReq)
     rShell.ReRead(OUString(), OUString(), (const Graphic*) &aGraphic);
 
     SwFlyFrmAttrMgr aManager(false, &rShell, rShell.IsFrmSelected() ? FRMMGR_TYPE_NONE : FRMMGR_TYPE_GRF);
-    Size aSize(aManager.GetSize().Height(), aManager.GetSize().Width());
+    const long nRotatedWidth = aManager.GetSize().Height();
+    const long nRotatedHeight = aManager.GetSize().Width();
+    Size aSize(nRotatedWidth, nRotatedHeight);
     aManager.SetSize(aSize);
     aManager.UpdateFlyFrm();
 
commit 9b68625a9d27d3c125a3e2d581862f997ff6f3b3
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Oct 2 17:05:02 2014 +0100

    coverity#1242529 silence Arguments in wrong order
    
    Change-Id: I662c89e6e3e0917b51e8084bc50a9ea38d6c0838

diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index 5b4599e..c3efb0a 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -4009,7 +4009,9 @@ SdrObject* SvxMSDffManager::ImportGroup( const DffRecordHeader& rHd, SvStream& r
                 sal_Int32 nHalfHeight = ( aClientRect.GetHeight() + 1 ) >> 1;
                 Point aTopLeft( aClientRect.Left() + nHalfWidth - nHalfHeight,
                                 aClientRect.Top() + nHalfHeight - nHalfWidth );
-                Size aNewSize( aClientRect.GetHeight(), aClientRect.GetWidth() );
+                const long nRotatedWidth = aClientRect.GetHeight();
+                const long nRotatedHeight = aClientRect.GetWidth();
+                Size aNewSize(nRotatedWidth, nRotatedHeight);
                 Rectangle aNewRect( aTopLeft, aNewSize );
                 aClientRect = aNewRect;
             }
commit 73fe3fb9f8dd2f8e70fd34cf340778b5017a54bb
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Oct 2 16:57:19 2014 +0100

    coverity#1242530 silence Arguments in wrong order
    
    Change-Id: I809e771e4f052ad64300b09174a1bdbc769e15d3

diff --git a/vcl/generic/print/genprnpsp.cxx b/vcl/generic/print/genprnpsp.cxx
index d0dfb28..3b11ec6 100644
--- a/vcl/generic/print/genprnpsp.cxx
+++ b/vcl/generic/print/genprnpsp.cxx
@@ -989,7 +989,9 @@ struct PDFNewJobParameters
 
     bool operator==(const PDFNewJobParameters& rComp ) const
     {
-        Size aCompLSSize( rComp.maPageSize.Height(), rComp.maPageSize.Width() );
+        const long nRotatedWidth = rComp.maPageSize.Height();
+        const long nRotatedHeight = rComp.maPageSize.Width();
+        Size aCompLSSize(nRotatedWidth, nRotatedHeight);
         return
             (maPageSize == rComp.maPageSize || maPageSize == aCompLSSize)
         &&  mnPaperBin == rComp.mnPaperBin
commit f3259873e18f9ead3de00739735620bd941b04a4
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Oct 2 16:54:29 2014 +0100

    coverity#1242533 silence Arguments in wrong order
    
    Change-Id: I7031e7408f5bcd9ae85fc50952253e14d2fb2edf

diff --git a/sd/source/ui/view/DocumentRenderer.cxx b/sd/source/ui/view/DocumentRenderer.cxx
index 3e67f53..f61224f 100644
--- a/sd/source/ui/view/DocumentRenderer.cxx
+++ b/sd/source/ui/view/DocumentRenderer.cxx
@@ -1618,8 +1618,10 @@ private:
             Size aPaperSize( rInfo.mpPrinter->PixelToLogic( rInfo.mpPrinter->GetPaperSizePixel(), MapMode( MAP_100TH_MM ) ) );
             maPrintSize.Width  = aPaperSize.Height();
             maPrintSize.Height = aPaperSize.Width();
+            const long nRotatedWidth = aOutRect.GetHeight();
+            const long nRotatedHeight = aOutRect.GetWidth();
             aOutRect = Rectangle( Point( aPageOfs.Y(), aPageOfs.X() ),
-                                  Size( aOutRect.GetHeight(), aOutRect.GetWidth() ) );
+                                  Size( nRotatedWidth, nRotatedHeight ) );
         }
 
         Link aOldLink;
commit b0e3e11c263eb41054643bc34a1de3816444951a
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Oct 2 16:51:24 2014 +0100

    coverity#1242532 Arguments in wrong order
    
    I don't think this actually matters
    
    Change-Id: Ia7190f436eeb47888b1aace1391cf0b5aef9f9f0

diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index 40c6fee..7c1887f 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -2214,11 +2214,11 @@ eF_ResT SwWW8ImplReader::Read_F_Macro( WW8FieldDesc*, OUString& rStr)
 
 WW8PostProcessAttrsInfo::WW8PostProcessAttrsInfo(WW8_CP nCpStart, WW8_CP nCpEnd,
                                                  SwPaM & rPaM)
-: mbCopy(false),
-  mnCpStart(nCpStart),
-  mnCpEnd(nCpEnd),
-  mPaM(*rPaM.GetPoint(), *rPaM.GetMark()),
-  mItemSet(rPaM.GetDoc()->GetAttrPool(), RES_CHRATR_BEGIN, RES_PARATR_END - 1)
+    : mbCopy(false)
+    , mnCpStart(nCpStart)
+    , mnCpEnd(nCpEnd)
+    , mPaM(*rPaM.GetMark(), *rPaM.GetPoint())
+    , mItemSet(rPaM.GetDoc()->GetAttrPool(), RES_CHRATR_BEGIN, RES_PARATR_END - 1)
 {
 }
 


More information about the Libreoffice-commits mailing list