[Libreoffice-commits] core.git: 8 commits - chart2/inc chart2/source i18npool/source include/sax sax/source sc/inc sc/source svx/source sw/source ucb/source

Caolán McNamara caolanm at redhat.com
Sat Feb 8 13:10:56 PST 2014


 chart2/inc/ChartView.hxx                 |    2 -
 chart2/source/view/main/ChartView.cxx    |    2 -
 i18npool/source/localedata/saxparser.cxx |   45 +++++++++++++++++++++++--------
 include/sax/fastparser.hxx               |    2 -
 sax/source/fastparser/fastparser.cxx     |    3 +-
 sc/inc/styleuno.hxx                      |    3 +-
 sc/source/ui/unoobj/styleuno.cxx         |    3 +-
 svx/source/svdraw/svdouno.cxx            |    2 -
 sw/source/core/text/itrtxt.hxx           |    9 ++++--
 sw/source/ui/ribbar/workctrl.cxx         |    6 ++--
 ucb/source/ucp/cmis/cmis_content.cxx     |    3 +-
 11 files changed, 55 insertions(+), 25 deletions(-)

New commits:
commit dec544be7c929a5c006008ddd3b901f18f4fbbe1
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Feb 8 21:07:58 2014 +0000

    coverity#169849 Uncaught exception
    
    Change-Id: I7c41fcd5be19ed9a0ba7e06920da4eadd0ea15a9

diff --git a/sc/inc/styleuno.hxx b/sc/inc/styleuno.hxx
index 53507d6..ca20f18 100644
--- a/sc/inc/styleuno.hxx
+++ b/sc/inc/styleuno.hxx
@@ -325,7 +325,8 @@ public:
                                     ::com::sun::star::uno::RuntimeException);
     virtual void SAL_CALL   setPropertyToDefault( const OUString& PropertyName )
                                 throw(::com::sun::star::beans::UnknownPropertyException,
-                                    ::com::sun::star::uno::RuntimeException);
+                                      ::com::sun::star::uno::RuntimeException,
+                                      std::exception);
     virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault(
                                     const OUString& aPropertyName )
                                 throw(::com::sun::star::beans::UnknownPropertyException,
diff --git a/sc/source/ui/unoobj/styleuno.cxx b/sc/source/ui/unoobj/styleuno.cxx
index 8c2c60f..6205774 100644
--- a/sc/source/ui/unoobj/styleuno.cxx
+++ b/sc/source/ui/unoobj/styleuno.cxx
@@ -1252,7 +1252,8 @@ uno::Sequence<beans::PropertyState> SAL_CALL ScStyleObj::getPropertyStates(
 }
 
 void SAL_CALL ScStyleObj::setPropertyToDefault( const OUString& aPropertyName )
-                            throw(beans::UnknownPropertyException, uno::RuntimeException)
+    throw(beans::UnknownPropertyException, uno::RuntimeException,
+          std::exception)
 {
     SolarMutexGuard aGuard;
 
commit 120cd03989394896cdcc928303546254b1e956ac
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Feb 8 21:06:15 2014 +0000

    coverity#1169818 Dereference after null check
    
    Change-Id: Ie8afd01a36b797ef7733f1cdd36775ff086a278a

diff --git a/sw/source/core/text/itrtxt.hxx b/sw/source/core/text/itrtxt.hxx
index 5f3d27b..f56d10e 100644
--- a/sw/source/core/text/itrtxt.hxx
+++ b/sw/source/core/text/itrtxt.hxx
@@ -289,10 +289,13 @@ class SwTxtCursor : public SwTxtAdjuster
     void _GetCharRect(SwRect *, const sal_Int32, SwCrsrMoveState* );
 protected:
     void CtorInitTxtCursor( SwTxtFrm *pFrm, SwTxtSizeInfo *pInf );
-    inline SwTxtCursor(SwTxtNode* pTxtNode) : SwTxtAdjuster(pTxtNode) { }
+    SwTxtCursor(SwTxtNode* pTxtNode) : SwTxtAdjuster(pTxtNode) { }
 public:
-    inline SwTxtCursor( SwTxtFrm *pTxtFrm, SwTxtSizeInfo *pTxtSizeInf ) : SwTxtAdjuster(pTxtFrm!=NULL?pTxtFrm->GetTxtNode():NULL)
-           { CtorInitTxtCursor( pTxtFrm, pTxtSizeInf ); }
+    SwTxtCursor( SwTxtFrm *pTxtFrm, SwTxtSizeInfo *pTxtSizeInf )
+        : SwTxtAdjuster(pTxtFrm->GetTxtNode())
+    {
+        CtorInitTxtCursor(pTxtFrm, pTxtSizeInf);
+    }
     bool GetCharRect(SwRect *, const sal_Int32, SwCrsrMoveState* = 0,
         const long nMax = 0 );
     bool GetEndCharRect(SwRect *, const sal_Int32, SwCrsrMoveState* = 0,
commit f4e984edfa2f72d36f8e8db4de0d8ba49639b034
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Feb 8 20:58:40 2014 +0000

    coverity#1169810 Logically dead code
    
    Change-Id: I565b3fc948c66a7b8e9815cf746714f9a2a70267

diff --git a/svx/source/svdraw/svdouno.cxx b/svx/source/svdraw/svdouno.cxx
index 4a683c7..9a34dea 100644
--- a/svx/source/svdraw/svdouno.cxx
+++ b/svx/source/svdraw/svdouno.cxx
@@ -544,7 +544,7 @@ uno::Reference< awt::XControl > SdrUnoObj::GetUnoControl(const SdrView& _rView,
     if ( !pPageView || GetPage() != pPageView->GetPage() )
         return NULL;
 
-    SdrPageWindow* pPageWindow = pPageView ? pPageView->FindPageWindow( _rOut ) : NULL;
+    SdrPageWindow* pPageWindow = pPageView->FindPageWindow( _rOut );
     OSL_ENSURE( pPageWindow, "SdrUnoObj::GetUnoControl: did not find my SdrPageWindow!" );
     if ( !pPageWindow )
         return NULL;
commit e6242ef5bf398cb598b5eeac1141576e87b0baf3
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Feb 8 20:57:12 2014 +0000

    coverity#1169809 regression on long->bool
    
    regression since 04683f14883f4cd64febadd71b327639f1e7edcc
    apparently
    
    Change-Id: I35b154dafd9534fb8234a82683cb3e879e136834

diff --git a/sw/source/ui/ribbar/workctrl.cxx b/sw/source/ui/ribbar/workctrl.cxx
index 2833fef..0b449af 100644
--- a/sw/source/ui/ribbar/workctrl.cxx
+++ b/sw/source/ui/ribbar/workctrl.cxx
@@ -684,7 +684,7 @@ void    SwZoomBox_Impl::Select()
 
 bool SwZoomBox_Impl::Notify( NotifyEvent& rNEvt )
 {
-    bool nHandled = true;
+    bool bHandled = false;
 
     if ( rNEvt.GetType() == EVENT_KEYINPUT )
     {
@@ -698,7 +698,7 @@ bool SwZoomBox_Impl::Notify( NotifyEvent& rNEvt )
                 if ( KEY_TAB == nCode )
                     bRelease = false;
                 else
-                    nHandled = true;
+                    bHandled = true;
                 Select();
                 break;
             }
@@ -716,7 +716,7 @@ bool SwZoomBox_Impl::Notify( NotifyEvent& rNEvt )
             SetText( GetSavedValue() );
     }
 
-    return nHandled || ComboBox::Notify( rNEvt );
+    return bHandled || ComboBox::Notify( rNEvt );
 }
 
 void SwZoomBox_Impl::ReleaseFocus()
commit 12e0102f39ee3a0398a4369bbc4af4ea0f51ca14
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Feb 8 20:52:41 2014 +0000

    coverity#1130446 Uncaught exception
    
    Change-Id: I9225b4ffd507fa3d666862a55dae349c9a76e91d

diff --git a/include/sax/fastparser.hxx b/include/sax/fastparser.hxx
index 83fbe9d..12d5b4d 100644
--- a/include/sax/fastparser.hxx
+++ b/include/sax/fastparser.hxx
@@ -53,7 +53,7 @@ public:
     virtual ~FastSaxParser();
 
     // XFastParser
-    virtual void SAL_CALL parseStream( const ::com::sun::star::xml::sax::InputSource& aInputSource ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+    virtual void SAL_CALL parseStream( const ::com::sun::star::xml::sax::InputSource& aInputSource ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException, std::exception);
     virtual void SAL_CALL setFastDocumentHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastDocumentHandler >& Handler ) throw (::com::sun::star::uno::RuntimeException);
     virtual void SAL_CALL setTokenHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastTokenHandler >& Handler ) throw (::com::sun::star::uno::RuntimeException);
     virtual void SAL_CALL registerNamespace( const OUString& NamespaceURL, sal_Int32 NamespaceToken ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx
index 0361ba8..067b13a 100644
--- a/sax/source/fastparser/fastparser.cxx
+++ b/sax/source/fastparser/fastparser.cxx
@@ -1357,7 +1357,8 @@ FastSaxParser::~FastSaxParser()
 }
 
 void FastSaxParser::parseStream( const xml::sax::InputSource& aInputSource )
-    throw (xml::sax::SAXException, io::IOException, uno::RuntimeException)
+    throw (xml::sax::SAXException, io::IOException,
+           uno::RuntimeException, std::exception)
 {
     mpImpl->parseStream(aInputSource);
 }
commit 249cc89a292bb18e28d0f8447db70cd1adafcaad
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Feb 8 20:50:50 2014 +0000

    coverity#982486 Unchecked dynamic_cast
    
    Change-Id: I241300f05ab537f2ab89d15f06ce6c04ffec14b5

diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx
index f1e7f92..71f42a0 100644
--- a/ucb/source/ucp/cmis/cmis_content.cxx
+++ b/ucb/source/ucp/cmis/cmis_content.cxx
@@ -1679,7 +1679,8 @@ namespace cmis
                 else
                 {
                     libcmis::Folder* folder = dynamic_cast< libcmis::Folder* >( getObject( xEnv ).get() );
-                    folder->removeTree( );
+                    if (folder)
+                        folder->removeTree( );
                 }
             }
             catch ( const libcmis::Exception& e )
commit 6d43fd9c9ff5a55bc8c7be5750dae4dc8ec363bb
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Feb 8 20:48:27 2014 +0000

    coverity#737047 Uncaught exception
    
    Change-Id: Icdb50f632654f0e46c41fa3e98741a00dfbc0feb

diff --git a/chart2/inc/ChartView.hxx b/chart2/inc/ChartView.hxx
index f44d952..702bebf 100644
--- a/chart2/inc/ChartView.hxx
+++ b/chart2/inc/ChartView.hxx
@@ -165,7 +165,7 @@ public:
     virtual void SAL_CALL removeModeChangeApproveListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModeChangeApproveListener >& _rxListener ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
 
     // ::com::sun::star::util::XUpdatable
-    virtual void SAL_CALL update() throw (::com::sun::star::uno::RuntimeException);
+    virtual void SAL_CALL update() throw (::com::sun::star::uno::RuntimeException, std::exception);
 
     // ::com::sun::star::beans::XPropertySet
     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  ) throw (::com::sun::star::uno::RuntimeException);
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index 3bdf762..c972af0 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -2817,7 +2817,7 @@ void SAL_CALL ChartView::removeModeChangeApproveListener( const uno::Reference<
 }
 
 // ____ XUpdatable ____
-void SAL_CALL ChartView::update() throw (uno::RuntimeException)
+void SAL_CALL ChartView::update() throw (uno::RuntimeException, std::exception)
 {
     impl_updateView();
 
commit d67bc9b3e6a30748c78e541ac882c2dd426b003d
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Feb 8 20:46:54 2014 +0000

    coverity#705400 Argument cannot be negative
    
    Change-Id: Idfd95810f929d6485263c0a4fb1e24bfa31c48f8

diff --git a/i18npool/source/localedata/saxparser.cxx b/i18npool/source/localedata/saxparser.cxx
index 00f0bab..0749a1c 100644
--- a/i18npool/source/localedata/saxparser.cxx
+++ b/i18npool/source/localedata/saxparser.cxx
@@ -111,21 +111,44 @@ public:
 Reference< XInputStream > createStreamFromFile(
     const char *pcFile )
 {
-    FILE *f = fopen( pcFile , "rb" );
     Reference<  XInputStream >  r;
 
-    if( f ) {
-        fseek( f , 0 , SEEK_END );
-        size_t nLength = ftell( f );
-        fseek( f , 0 , SEEK_SET );
+    FILE *f = fopen( pcFile , "rb" );
 
-        Sequence<sal_Int8> seqIn(nLength);
-        if (fread( seqIn.getArray() , nLength , 1 , f ) == 1)
-            r = Reference< XInputStream > ( new OInputStream( seqIn ) );
-        else
-            fprintf(stderr, "failure reading %s\n", pcFile);
-        fclose( f );
+    if (!f)
+    {
+        fprintf(stderr, "failure opening %s\n", pcFile);
+        return r;
+    }
+
+    if (fseek( f , 0 , SEEK_END ) == -1)
+    {
+        fprintf(stderr, "failure fseeking %s\n", pcFile);
+        fclose(f);
+        return r;
     }
+
+    long nLength = ftell( f );
+    if (nLength == -1)
+    {
+        fprintf(stderr, "failure ftelling %s\n", pcFile);
+        fclose(f);
+        return r;
+    }
+
+    if (fseek( f , 0 , SEEK_SET ) == -1)
+    {
+        fprintf(stderr, "failure fseeking %s\n", pcFile);
+        fclose(f);
+        return r;
+    }
+
+    Sequence<sal_Int8> seqIn(nLength);
+    if (fread( seqIn.getArray(), nLength , 1 , f ) == 1)
+        r = Reference< XInputStream > ( new OInputStream( seqIn ) );
+    else
+        fprintf(stderr, "failure reading %s\n", pcFile);
+    fclose( f );
     return r;
 }
 


More information about the Libreoffice-commits mailing list