[Libreoffice-commits] core.git: 14 commits - connectivity/source embeddedobj/source sw/source tools/source ucb/source uui/source vcl/source xmloff/source

Caolán McNamara caolanm at redhat.com
Sat Oct 11 09:34:26 PDT 2014


 connectivity/source/drivers/dbase/DTable.cxx       |   10 +++++++--
 embeddedobj/source/commonembedding/persistence.cxx |    3 --
 sw/source/uibase/docvw/PostItMgr.cxx               |    2 -
 sw/source/uibase/uiview/view2.cxx                  |    2 -
 sw/source/uibase/uiview/viewport.cxx               |    4 +--
 sw/source/uibase/wrtsh/wrtundo.cxx                 |    4 +--
 tools/source/generic/poly2.cxx                     |    6 ++---
 ucb/source/ucp/cmis/cmis_content.cxx               |    2 -
 ucb/source/ucp/cmis/cmis_content.hxx               |    3 +-
 ucb/source/ucp/cmis/cmis_repo_content.cxx          |    5 ++--
 uui/source/iahndl-ssl.cxx                          |    8 ++++---
 vcl/source/filter/wmf/wmfwr.cxx                    |   23 +++++++++++++--------
 vcl/source/window/menu.cxx                         |    2 -
 xmloff/source/draw/propimp0.cxx                    |   20 +++++++++++-------
 xmloff/source/draw/ximpshap.cxx                    |    2 -
 15 files changed, 58 insertions(+), 38 deletions(-)

New commits:
commit 9aad656156fbf76288e8a281760e60f1eccc6622
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Oct 11 17:14:53 2014 +0100

    coverity#703952 Unchecked return value
    
    originally return was checked in
    
    commit c37f4bb94a119e4031796c097a35c1217e221e6c
    Date:   Tue Nov 4 13:30:21 2003 +0000
        #112739# add breakLink method
    
    then use of bElExists was removed in
    
    commit aec29756d7e058b47dc8dcef79bc93c3e9c61928
    Date:   Fri Nov 14 14:24:28 2003 +0000
        #112923# ole implementation related changes
    
    at which point this line should have been removed, but it wasn't
    
    later at
    
    commit 00b1faf239dbf676178dcaa0d15a1678d1148a0d
    Author: Jens-Heiner Rechtien <hr at openoffice.org>
        INTEGRATION: CWS warnings01 (1.19.10); FILE MERGED
        2005/11/03 10:31:40 cd 1.19.10.1: #i55991# Warning free code for gcc
    
    this still wasn't removed, just bElExists commented out
    
    Change-Id: I1af2635558cd4f47da06e148e45489f522e0183f

diff --git a/embeddedobj/source/commonembedding/persistence.cxx b/embeddedobj/source/commonembedding/persistence.cxx
index 260cce0..2da05bc 100644
--- a/embeddedobj/source/commonembedding/persistence.cxx
+++ b/embeddedobj/source/commonembedding/persistence.cxx
@@ -1852,9 +1852,6 @@ void SAL_CALL OCommonEmbeddedObject::breakLink( const uno::Reference< embed::XSt
     if ( !xNameAccess.is() )
         throw uno::RuntimeException(); //TODO
 
-    // detect entry existence
-    /*sal_Bool bElExists =*/ xNameAccess->hasByName( sEntName );
-
     m_bReadOnly = false;
 
     if ( m_xParentStorage != xStorage || !m_aEntryName.equals( sEntName ) )
commit 9863f7db9196a9d04790887a4c1be09240cd3d72
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Oct 11 17:06:16 2014 +0100

    coverity#735621 Division or modulo by zero
    
    Change-Id: Ic92bb6946495124d50e57c2c84995cae6465af92

diff --git a/vcl/source/filter/wmf/wmfwr.cxx b/vcl/source/filter/wmf/wmfwr.cxx
index ddfa18f..2587823 100644
--- a/vcl/source/filter/wmf/wmfwr.cxx
+++ b/vcl/source/filter/wmf/wmfwr.cxx
@@ -1201,14 +1201,21 @@ void WMFWriter::WriteRecords( const GDIMetaFile & rMTF )
                     nLen = aTemp.getLength();
                     boost::scoped_array<long> pDXAry(nLen ? new long[ nLen ] : NULL);
                     nNormSize = pVirDev->GetTextArray( aTemp, pDXAry.get() );
-                    for ( i = 0; i < ( nLen - 1 ); i++ )
-                        pDXAry[ i ] = pDXAry[ i ] * (sal_Int32)pA->GetWidth() / nNormSize;
-                    if ( ( nLen <= 1 ) || ( (sal_Int32)pA->GetWidth() == nNormSize ) )
-                        pDXAry.reset();
-                    aSrcLineInfo = LineInfo();
-                    SetAllAttr();
-                    if ( !WMFRecord_Escape_Unicode( pA->GetPoint(), aTemp, pDXAry.get() ) )
-                        WMFRecord_ExtTextOut( pA->GetPoint(), aTemp, pDXAry.get() );
+                    if (nLen && nNormSize == 0)
+                    {
+                        OSL_FAIL("Impossible div by 0 action: MetaStretchTextAction!");
+                    }
+                    else
+                    {
+                        for ( i = 0; i < ( nLen - 1 ); i++ )
+                            pDXAry[ i ] = pDXAry[ i ] * (sal_Int32)pA->GetWidth() / nNormSize;
+                        if ( ( nLen <= 1 ) || ( (sal_Int32)pA->GetWidth() == nNormSize ) )
+                            pDXAry.reset();
+                        aSrcLineInfo = LineInfo();
+                        SetAllAttr();
+                        if ( !WMFRecord_Escape_Unicode( pA->GetPoint(), aTemp, pDXAry.get() ) )
+                            WMFRecord_ExtTextOut( pA->GetPoint(), aTemp, pDXAry.get() );
+                    }
                 }
                 break;
 
commit 88e1b0215b27c8897ca66509fa08b96d86023ef7
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Oct 11 16:58:11 2014 +0100

    coverity#735605 Division or modulo by zero
    
    Change-Id: Ic3680ae833ed325ff4afe96fdca02f784ccd7d71

diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx
index a98a54d..4c1bf02 100644
--- a/connectivity/source/drivers/dbase/DTable.cxx
+++ b/connectivity/source/drivers/dbase/DTable.cxx
@@ -532,8 +532,14 @@ void ODbaseTable::construct()
 
         sal_Size nFileSize = lcl_getFileSize(*m_pFileStream);
         m_pFileStream->Seek(STREAM_SEEK_TO_BEGIN);
-        if ( m_aHeader.db_anz == 0 && ((nFileSize-m_aHeader.db_kopf)/m_aHeader.db_slng) > 0) // seems to be empty or someone wrote bullshit into the dbase file
-            m_aHeader.db_anz = ((nFileSize-m_aHeader.db_kopf)/m_aHeader.db_slng);
+        // seems to be empty or someone wrote bullshit into the dbase file
+        // try and recover if m_aHeader.db_slng is sane
+        if (m_aHeader.db_anz == 0 && m_aHeader.db_slng)
+        {
+            sal_Size nRecords = (nFileSize-m_aHeader.db_kopf)/m_aHeader.db_slng;
+            if (nRecords > 0)
+                m_aHeader.db_anz = nRecords;
+        }
 
         // Buffersize dependent on the file size
         m_pFileStream->SetBufferSize(nFileSize > 1000000 ? 32768 :
commit 4e4080175abc712ce3e78c338cb8270cf2039cee
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Oct 11 16:47:59 2014 +0100

    coverity#735648 Division or modulo by zero
    
    Change-Id: Ib70d76a022916409750887e0062d84326f7caa18

diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx
index ae46103..fafcbcd 100644
--- a/sw/source/uibase/docvw/PostItMgr.cxx
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
@@ -992,7 +992,7 @@ bool SwPostItMgr::LayoutByPage(std::list<SwSidebarWin*> &aVisiblePostItList,cons
     bool            bScrollbars     = false;
 
     // do all necessary resizings
-    if (lVisibleHeight < lNeededHeight)
+    if (!aVisiblePostItList.empty() && lVisibleHeight < lNeededHeight)
     {
         // ok, now we have to really resize and adding scrollbars
         const long lAverageHeight = (lVisibleHeight - aVisiblePostItList.size()*GetSpaceBetween()) / aVisiblePostItList.size();
commit edc18edbdc727757ad672773998cdab31e3bc382
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Oct 11 16:44:23 2014 +0100

    coverity#704073 Unchecked return value
    
    Change-Id: I4fe24b6c91d7302835c3366ff490f5a4455fc58f

diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx
index cbb7a88..be0c94b 100644
--- a/sw/source/uibase/uiview/view2.cxx
+++ b/sw/source/uibase/uiview/view2.cxx
@@ -590,7 +590,7 @@ void SwView::Execute(SfxRequest &rReq)
                     SfxPasswordDialog aPasswdDlg( pParent );
                     aPasswdDlg.SetMinLen( 1 );
                     //#i69751# the result of Execute() can be ignored
-                    aPasswdDlg.Execute();
+                    (void)aPasswdDlg.Execute();
                     OUString sNewPasswd( aPasswdDlg.GetPassword() );
                     Sequence <sal_Int8> aNewPasswd = pIDRA->GetRedlinePassword();
                     SvPasswordHelper::GetHashPassword( aNewPasswd, sNewPasswd );
commit a5defe0dde638c7dd8e99cbef7e22bace572a7ff
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Oct 11 16:43:18 2014 +0100

    coverity#704074 Unchecked return value
    
    Change-Id: I636ede58f83d9faa851c21406d27b8246ec40ff9

diff --git a/sw/source/uibase/uiview/viewport.cxx b/sw/source/uibase/uiview/viewport.cxx
index 9090328..1002cdc 100644
--- a/sw/source/uibase/uiview/viewport.cxx
+++ b/sw/source/uibase/uiview/viewport.cxx
@@ -708,8 +708,8 @@ IMPL_LINK( SwView, ScrollHdl, SwScrollbar *, pScrollbar )
 
                     OUString sPageStr( GetPageStr( nPhNum, nVirtNum, sDisplay ));
                     SwContentAtPos aCnt( SwContentAtPos::SW_OUTLINE );
-                    m_pWrtShell->GetContentAtPos( aPos, aCnt );
-                    if( !aCnt.sStr.isEmpty() )
+                    bool bSuccess = m_pWrtShell->GetContentAtPos(aPos, aCnt);
+                    if (bSuccess && !aCnt.sStr.isEmpty())
                     {
                         sPageStr += "  - ";
                         sal_Int32 nChunkLen = std::min<sal_Int32>(aCnt.sStr.getLength(), 80);
commit d3a3fcbaa50c1de54a97d062c0eaa2a0c7e3648a
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Oct 11 16:41:36 2014 +0100

    coverity#704076 Unchecked return value
    
    Change-Id: I07aa768662ba13455e4d8074afc9749f838f3e82

diff --git a/sw/source/uibase/wrtsh/wrtundo.cxx b/sw/source/uibase/wrtsh/wrtundo.cxx
index 9b70e25..4ad06d4 100644
--- a/sw/source/uibase/wrtsh/wrtundo.cxx
+++ b/sw/source/uibase/wrtsh/wrtundo.cxx
@@ -102,11 +102,11 @@ OUString SwWrtShell::GetDoString( DoType eDoType ) const
     {
     case UNDO:
         nResStr = STR_UNDO;
-        GetLastUndoInfo(& aUndoStr, 0);
+        (void)GetLastUndoInfo(&aUndoStr, 0);
         break;
     case REDO:
         nResStr = STR_REDO;
-        GetFirstRedoInfo(& aUndoStr);
+        (void)GetFirstRedoInfo(&aUndoStr);
         break;
     default:;//prevent warning
     }
commit 157fb92164a4a779a12c6447fe5c90a45fd35437
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Oct 11 16:39:17 2014 +0100

    initialize nPolyCount
    
    Change-Id: I774f0ea2576063b7d1f7005e7df41ae52fa9037c

diff --git a/tools/source/generic/poly2.cxx b/tools/source/generic/poly2.cxx
index 3c172bf..f15759e 100644
--- a/tools/source/generic/poly2.cxx
+++ b/tools/source/generic/poly2.cxx
@@ -572,9 +572,9 @@ SvStream& ReadPolyPolygon( SvStream& rIStream, tools::PolyPolygon& rPolyPoly )
     DBG_ASSERTWARNING( rIStream.GetVersion(), "PolyPolygon::>> - Solar-Version not set on rIStream" );
 
     Polygon* pPoly;
-    sal_uInt16   nPolyCount;
+    sal_uInt16 nPolyCount(0);
 
-    // read number of polygons
+    // Read number of polygons
     rIStream.ReadUInt16( nPolyCount );
 
     if( nPolyCount )
@@ -621,7 +621,7 @@ void PolyPolygon::Read( SvStream& rIStream )
     DBG_ASSERTWARNING( rIStream.GetVersion(), "PolyPolygon::>> - Solar-Version not set on rIStream" );
 
     Polygon* pPoly;
-    sal_uInt16   nPolyCount;
+    sal_uInt16 nPolyCount(0);
 
     // Read number of polygons
     rIStream.ReadUInt16( nPolyCount );
commit f6047410e185056b45a28e0cdae94080261def47
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Oct 11 16:36:24 2014 +0100

    coverity#983990 Uncaught exception
    
    Change-Id: I78c58822cc92c8964e0b69f44d841c5cdb84b1bb

diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx
index 88b4784..039b438 100644
--- a/ucb/source/ucp/cmis/cmis_content.cxx
+++ b/ucb/source/ucp/cmis/cmis_content.cxx
@@ -422,7 +422,7 @@ namespace cmis
     }
 
 
-    libcmis::ObjectPtr Content::getObject( const uno::Reference< ucb::XCommandEnvironment >& xEnv ) throw (css::uno::RuntimeException, libcmis::Exception)
+    libcmis::ObjectPtr Content::getObject( const uno::Reference< ucb::XCommandEnvironment >& xEnv ) throw (css::uno::RuntimeException, css::ucb::CommandFailedException, libcmis::Exception)
     {
         // can't get the session for some reason
         // the recent file openning at start up is an example.
diff --git a/ucb/source/ucp/cmis/cmis_content.hxx b/ucb/source/ucp/cmis/cmis_content.hxx
index 559ce9a..37141dd 100644
--- a/ucb/source/ucp/cmis/cmis_content.hxx
+++ b/ucb/source/ucp/cmis/cmis_content.hxx
@@ -16,6 +16,7 @@
 #include <com/sun/star/io/XInputStream.hpp>
 #include <com/sun/star/io/XOutputStream.hpp>
 #include <com/sun/star/ucb/CheckinArgument.hpp>
+#include <com/sun/star/ucb/CommandFailedException.hpp>
 #include <com/sun/star/ucb/ContentCreationException.hpp>
 #include <com/sun/star/ucb/OpenCommandArgument2.hpp>
 #include <com/sun/star/ucb/TransferInfo.hpp>
@@ -205,7 +206,7 @@ public:
 
     virtual std::list< com::sun::star::uno::Reference< com::sun::star::ucb::XContent > > getChildren( ) SAL_OVERRIDE;
 
-    libcmis::ObjectPtr getObject( const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xEnv ) throw (css::uno::RuntimeException, libcmis::Exception);
+    libcmis::ObjectPtr getObject( const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xEnv ) throw (css::uno::RuntimeException, css::ucb::CommandFailedException, libcmis::Exception);
 };
 
 }
commit 7e3a84d1709a853e14a79398b4a17e3c09e43aa9
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Oct 11 16:05:35 2014 +0100

    coverity#1130163 Unchecked return value
    
    Change-Id: Iffc4ba146ac8f851239e93a1ace53c6b34234824

diff --git a/ucb/source/ucp/cmis/cmis_repo_content.cxx b/ucb/source/ucp/cmis/cmis_repo_content.cxx
index ea99c35..5dc1ae1 100644
--- a/ucb/source/ucp/cmis/cmis_repo_content.cxx
+++ b/ucb/source/ucp/cmis/cmis_repo_content.cxx
@@ -61,8 +61,9 @@ namespace cmis
         OUString sURL = m_xIdentifier->getContentIdentifier( );
         SAL_INFO( "ucb.ucp.cmis", "RepoContent::RepoContent() " << sURL );
 
-        m_sRepositoryId = m_aURL.getObjectPath( );
-        m_sRepositoryId.startsWith("/", &m_sRepositoryId);
+        m_sRepositoryId = m_aURL.getObjectPath();
+        if (!m_sRepositoryId.isEmpty() && m_sRepositoryId[0] == '/')
+            m_sRepositoryId = m_sRepositoryId.copy(1);
     }
 
     RepoContent::~RepoContent()
commit 279e9914a92fe5751cc3c0f466dc3198bc44c60b
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Oct 11 15:57:00 2014 +0100

    coverity#1242367 Unchecked return value
    
    Change-Id: I899f97df32d943e61d7f0a125ae9ccea88b5374b

diff --git a/uui/source/iahndl-ssl.cxx b/uui/source/iahndl-ssl.cxx
index 17eef02..6178536 100644
--- a/uui/source/iahndl-ssl.cxx
+++ b/uui/source/iahndl-ssl.cxx
@@ -231,9 +231,11 @@ executeSSLWarnDialog(
             }
 
             OUString aTitle;
-            ErrorResource(aResId).getString(
-                ERRCODE_AREA_UUI_UNKNOWNAUTH + failure + TITLE, aTitle);
-            xDialog->SetText( aTitle );
+            if (ErrorResource(aResId).getString(
+                ERRCODE_AREA_UUI_UNKNOWNAUTH + failure + TITLE, aTitle))
+            {
+                xDialog->SetText(aTitle);
+            }
         }
 
         return static_cast<bool>(xDialog->Execute());
commit 41df2c5c8b32c8d8ec38be8d087ef9dbc221cccb
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Oct 11 15:36:17 2014 +0100

    coverity#1242425 Dereference after null check
    
    Change-Id: I638d1601ac6cb5e43ee60f60869f6128060e6d05

diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index cc34a1f..c925e99 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -2477,7 +2477,7 @@ vcl::Window* MenuBar::ImplCreate(vcl::Window* pParent, vcl::Window* pWindow, Men
     pMenu->pStartedFrom = 0;
     pMenu->pWindow = pWindow;
     pMenuBarWindow->SetMenu(pMenu);
-    long nHeight = pMenu->ImplCalcSize(pWindow).Height();
+    long nHeight = pWindow ? pMenu->ImplCalcSize(pWindow).Height() : 0;
 
     // depending on the native implementation or the displayable flag
     // the menubar windows is suppressed (ie, height=0)
commit 01c74f4319085a455898f01ce939a2679fdc9460
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Oct 11 15:32:54 2014 +0100

    coverity#735353 Unchecked return value
    
    Change-Id: Iab54019d07ac27b4d8247d789c29165d24e2288f

diff --git a/xmloff/source/draw/propimp0.cxx b/xmloff/source/draw/propimp0.cxx
index 8b7453f..0ac8bf3 100644
--- a/xmloff/source/draw/propimp0.cxx
+++ b/xmloff/source/draw/propimp0.cxx
@@ -48,15 +48,21 @@ bool XMLDurationPropertyHdl::importXML(
     const SvXMLUnitConverter& ) const
 {
     util::Duration aDuration;
-    ::sax::Converter::convertDuration(aDuration,  rStrImpValue);
 
-    const double fSeconds = ((aDuration.Days * 24 + aDuration.Hours) * 60
-                             + aDuration.Minutes) * 60
-                             + aDuration.Seconds
-                             + aDuration.NanoSeconds / static_cast<double>(::tools::Time::nanoSecPerSec);
-    rValue <<= fSeconds;
+    if (::sax::Converter::convertDuration(aDuration,  rStrImpValue))
+    {
+        const double fSeconds = ((aDuration.Days * 24 + aDuration.Hours) * 60
+                                 + aDuration.Minutes) * 60
+                                 + aDuration.Seconds
+                                 + aDuration.NanoSeconds / static_cast<double>(::tools::Time::nanoSecPerSec);
+        rValue <<= fSeconds;
 
-    return true;
+        return true;
+    }
+
+    SAL_WARN_IF(!rStrImpValue.isEmpty(), "xmloff", "Invalid duration: " << rStrImpValue);
+
+    return false;
 }
 
 bool XMLDurationPropertyHdl::exportXML(
commit c10548eaa93bbac36e1b361475d8676ebc4042a3
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Oct 11 15:29:13 2014 +0100

    coverity#704113 Unchecked return value
    
    Change-Id: If6537d84953c67801bc1959e17dd3662cd1face7

diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx
index c1aab2c..d247895 100644
--- a/xmloff/source/draw/ximpshap.cxx
+++ b/xmloff/source/draw/ximpshap.cxx
@@ -1912,7 +1912,7 @@ void SdXMLConnectorShapeContext::processAttribute( sal_uInt16 nPrefix, const OUS
         }
         if( IsXMLToken( rLocalName, XML_TYPE ) )
         {
-            SvXMLUnitConverter::convertEnum( mnType, rValue, aXML_ConnectionKind_EnumMap );
+            (void)SvXMLUnitConverter::convertEnum( mnType, rValue, aXML_ConnectionKind_EnumMap );
             return;
         }
         // #121965# draw:transform may be used in ODF1.2, e.g. exports from MS seem to use these


More information about the Libreoffice-commits mailing list