[Libreoffice-commits] core.git: 13 commits - framework/source sc/inc sc/source starmath/source sw/source vcl/qa

Caolán McNamara caolanm at redhat.com
Sun Feb 9 13:08:09 PST 2014


 framework/source/services/modulemanager.cxx                       |   96 +++++-----
 framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx |    8 
 sc/inc/notesuno.hxx                                               |    7 
 sc/source/ui/unoobj/notesuno.cxx                                  |    5 
 starmath/source/parse.cxx                                         |    7 
 sw/source/core/layout/newfrm.cxx                                  |    1 
 sw/source/ui/dbui/mmaddressblockpage.cxx                          |    2 
 vcl/qa/cppunit/canvasbitmaptest.cxx                               |   31 ++-
 8 files changed, 94 insertions(+), 63 deletions(-)

New commits:
commit 0419524c57a7c18386c6cdc893a59fd95e589de9
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Feb 9 21:07:10 2014 +0000

    coverity#1130443 Improper use of negative value
    
    Change-Id: Ie56b1d5ceeb68bb3d7dffe6ad8949485a93e1fbb

diff --git a/sw/source/ui/dbui/mmaddressblockpage.cxx b/sw/source/ui/dbui/mmaddressblockpage.cxx
index 4bd2cf5..bdb0848 100644
--- a/sw/source/ui/dbui/mmaddressblockpage.cxx
+++ b/sw/source/ui/dbui/mmaddressblockpage.cxx
@@ -1342,7 +1342,7 @@ void AddressMultiLineEdit::SetText( const OUString& rStr )
         while(true)
         {
             sal_Int32 nStart = sPara.indexOf( '<', nIndex );
-            sal_Int32 nEnd = sPara.indexOf( '>', nStart );
+            sal_Int32 nEnd = nStart == -1 ? -1 : sPara.indexOf( '>', nStart );
             nIndex = nEnd;
             if(nStart != -1 && nEnd != -1)
                 pTextEngine->SetAttrib( aProtectAttr, nPara, nStart, nEnd + 1, sal_False );
commit 2c32e2f38366b4cfbdc56375cddaac188b80304e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Feb 9 21:04:50 2014 +0000

    coverity#1130459 Uncaught exception
    
    Change-Id: I1192f6326cc19c076386f0f426ebce911dba184b

diff --git a/vcl/qa/cppunit/canvasbitmaptest.cxx b/vcl/qa/cppunit/canvasbitmaptest.cxx
index a833767..16492d0 100644
--- a/vcl/qa/cppunit/canvasbitmaptest.cxx
+++ b/vcl/qa/cppunit/canvasbitmaptest.cxx
@@ -597,7 +597,8 @@ private:
     }
 
     virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromARGB( const uno::Sequence< rendering::ARGBColor >& ) throw (lang::IllegalArgumentException,
-                                                                                                                               uno::RuntimeException)
+                                                                                                                               uno::RuntimeException,
+                                  std::exception)
     {
         CPPUNIT_ASSERT_MESSAGE("convertIntegerFromARGB: method not implemented", false);
         return uno::Sequence< sal_Int8 >();
commit 7af08465168d49f072ec68c9544587c96861a92a
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Feb 9 21:04:12 2014 +0000

    coverity#1130460 Uncaught exception
    
    Change-Id: Iaf0bee84a358914e71f04b84e358a03a5a2cd970

diff --git a/vcl/qa/cppunit/canvasbitmaptest.cxx b/vcl/qa/cppunit/canvasbitmaptest.cxx
index ac20f1b..a833767 100644
--- a/vcl/qa/cppunit/canvasbitmaptest.cxx
+++ b/vcl/qa/cppunit/canvasbitmaptest.cxx
@@ -603,8 +603,10 @@ private:
         return uno::Sequence< sal_Int8 >();
     }
 
-    virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromPARGB( const uno::Sequence< rendering::ARGBColor >& ) throw (lang::IllegalArgumentException,
-                                                                                                                                uno::RuntimeException)
+    virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromPARGB( const uno::Sequence< rendering::ARGBColor >& )
+        throw (lang::IllegalArgumentException,
+        uno::RuntimeException,
+        std::exception)
     {
         CPPUNIT_ASSERT_MESSAGE("convertIntegerFromPARGB: method not implemented", false);
         return uno::Sequence< sal_Int8 >();
commit 5267fc5e8a01953c8f55d53a470a414f510efcb5
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Feb 9 21:02:56 2014 +0000

    coverity#1130461 Uncaught exception
    
    Change-Id: I6054816a63ec5a60e1c782001e8f5c115e40554f

diff --git a/vcl/qa/cppunit/canvasbitmaptest.cxx b/vcl/qa/cppunit/canvasbitmaptest.cxx
index 85e1ecb..ac20f1b 100644
--- a/vcl/qa/cppunit/canvasbitmaptest.cxx
+++ b/vcl/qa/cppunit/canvasbitmaptest.cxx
@@ -488,8 +488,10 @@ private:
     }
 
     virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertToIntegerColorSpace( const uno::Sequence< ::sal_Int8 >& ,
-                                                                             const uno::Reference< rendering::XIntegerBitmapColorSpace >& ) throw (lang::IllegalArgumentException,
-                                                                                                                                                   uno::RuntimeException)
+                                                                             const uno::Reference< rendering::XIntegerBitmapColorSpace >& )
+        throw (lang::IllegalArgumentException,
+               uno::RuntimeException,
+               std::exception)
     {
         CPPUNIT_ASSERT_MESSAGE("convertToIntegerColorSpace: method not implemented", false);
         return uno::Sequence< sal_Int8 >();
commit 3bba85609504c0a89f4330a6c8520930fedf0939
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Feb 9 21:02:11 2014 +0000

    coverity#1130462 Uncaught exception
    
    Change-Id: I3f266f46085c840e8e1809799699efa163a53d6e

diff --git a/vcl/qa/cppunit/canvasbitmaptest.cxx b/vcl/qa/cppunit/canvasbitmaptest.cxx
index 973d149..85e1ecb 100644
--- a/vcl/qa/cppunit/canvasbitmaptest.cxx
+++ b/vcl/qa/cppunit/canvasbitmaptest.cxx
@@ -478,8 +478,10 @@ private:
     }
 
     virtual uno::Sequence< double > SAL_CALL convertFromIntegerColorSpace( const uno::Sequence< ::sal_Int8 >& ,
-                                                                           const uno::Reference< rendering::XColorSpace >& ) throw (lang::IllegalArgumentException,
-                                                                                                                                    uno::RuntimeException)
+                                                                           const uno::Reference< rendering::XColorSpace >& )
+        throw (lang::IllegalArgumentException,
+               uno::RuntimeException,
+               std::exception)
     {
         CPPUNIT_ASSERT_MESSAGE("convertFromIntegerColorSpace: method not implemented", false);
         return uno::Sequence< double >();
commit da797ff3ad827dad6549c6713b67c1db71427bb0
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Feb 9 21:01:06 2014 +0000

    coverity#1130463 Uncaught exception
    
    Change-Id: I4c81275d217a0fa500a7ffdff3b9ade73dbface0

diff --git a/vcl/qa/cppunit/canvasbitmaptest.cxx b/vcl/qa/cppunit/canvasbitmaptest.cxx
index 7360de6..973d149 100644
--- a/vcl/qa/cppunit/canvasbitmaptest.cxx
+++ b/vcl/qa/cppunit/canvasbitmaptest.cxx
@@ -257,8 +257,11 @@ private:
 
     // XIntegerReadOnlyBitmap
     virtual uno::Sequence< ::sal_Int8 > SAL_CALL getData( rendering::IntegerBitmapLayout&     bitmapLayout,
-                                                          const geometry::IntegerRectangle2D& rect ) throw (lang::IndexOutOfBoundsException,
-                                                                                                            rendering::VolatileContentDestroyedException, uno::RuntimeException)
+                                                          const geometry::IntegerRectangle2D& rect )
+        throw (lang::IndexOutOfBoundsException,
+               rendering::VolatileContentDestroyedException,
+               uno::RuntimeException,
+               std::exception)
     {
         CPPUNIT_ASSERT_MESSAGE( "X1 out of bounds", rect.X1 >= 0 );
         CPPUNIT_ASSERT_MESSAGE( "Y1 out of bounds", rect.Y1 >= 0 );
commit 4051ed660873d6026c4c2a37a62d338fd63b8b81
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Feb 9 20:59:30 2014 +0000

    coverity#1130468 Uncaught exception
    
    Change-Id: I167b5a5cd83f7edb6814f0ca6d14de9f5a0c5a4c

diff --git a/sc/inc/notesuno.hxx b/sc/inc/notesuno.hxx
index 8c9d303..db2fbe4 100644
--- a/sc/inc/notesuno.hxx
+++ b/sc/inc/notesuno.hxx
@@ -89,7 +89,9 @@ public:
                                     throw(::com::sun::star::uno::RuntimeException);
     virtual OUString SAL_CALL getAuthor() throw(::com::sun::star::uno::RuntimeException);
     virtual OUString SAL_CALL getDate() throw(::com::sun::star::uno::RuntimeException);
-    virtual sal_Bool SAL_CALL getIsVisible() throw(::com::sun::star::uno::RuntimeException);
+    virtual sal_Bool SAL_CALL getIsVisible()
+                                    throw(::com::sun::star::uno::RuntimeException,
+                                          std::exception);
     virtual void SAL_CALL setIsVisible( sal_Bool bIsVisible )
                                     throw(::com::sun::star::uno::RuntimeException);
 
diff --git a/sc/source/ui/unoobj/notesuno.cxx b/sc/source/ui/unoobj/notesuno.cxx
index ac83dc7..0d77c38 100644
--- a/sc/source/ui/unoobj/notesuno.cxx
+++ b/sc/source/ui/unoobj/notesuno.cxx
@@ -210,7 +210,7 @@ OUString SAL_CALL ScAnnotationObj::getDate() throw(uno::RuntimeException)
     return pNote ? pNote->GetDate() : OUString();
 }
 
-sal_Bool SAL_CALL ScAnnotationObj::getIsVisible() throw(uno::RuntimeException)
+sal_Bool SAL_CALL ScAnnotationObj::getIsVisible() throw(uno::RuntimeException, std::exception)
 {
     SolarMutexGuard aGuard;
     const ScPostIt* pNote = ImplGetNote();
commit 2d0b7b67c1730768f72601e1243d837b2f59ed4c
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Feb 9 20:58:28 2014 +0000

    coverity#1130469 Uncaught exception
    
    Change-Id: I27d58c5cc9b20e9a4315019df2626ac03b496d41

diff --git a/sc/inc/notesuno.hxx b/sc/inc/notesuno.hxx
index 992f196..8c9d303 100644
--- a/sc/inc/notesuno.hxx
+++ b/sc/inc/notesuno.hxx
@@ -96,7 +96,8 @@ public:
                             /// XSheetAnnotationShapeSupplier
     virtual ::com::sun::star::uno::Reference < ::com::sun::star::drawing::XShape > SAL_CALL
                             getAnnotationShape()
-                                throw(::com::sun::star::uno::RuntimeException);
+                                throw(::com::sun::star::uno::RuntimeException,
+                                      std::exception);
 
                             /// XServiceInfo
     virtual OUString SAL_CALL getImplementationName()
diff --git a/sc/source/ui/unoobj/notesuno.cxx b/sc/source/ui/unoobj/notesuno.cxx
index f9c8286..ac83dc7 100644
--- a/sc/source/ui/unoobj/notesuno.cxx
+++ b/sc/source/ui/unoobj/notesuno.cxx
@@ -227,7 +227,8 @@ void SAL_CALL ScAnnotationObj::setIsVisible( sal_Bool bIsVisible ) throw(uno::Ru
 
 // XSheetAnnotationShapeSupplier
 uno::Reference < drawing::XShape > SAL_CALL ScAnnotationObj::getAnnotationShape()
-                                throw(::com::sun::star::uno::RuntimeException)
+                                throw(::com::sun::star::uno::RuntimeException,
+                                      std::exception)
 {
     SolarMutexGuard aGuard;
     uno::Reference < drawing::XShape > xShape;
commit 8328eb4ecb72c2e4ce6e09b4659ab49f3feeb86b
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Feb 9 20:57:03 2014 +0000

    coverity#1130470 Uncaught exception
    
    Change-Id: I9a306abd77d3ab8ff421dcc29d2ef08a9dca8d0d

diff --git a/vcl/qa/cppunit/canvasbitmaptest.cxx b/vcl/qa/cppunit/canvasbitmaptest.cxx
index 0ab344d..7360de6 100644
--- a/vcl/qa/cppunit/canvasbitmaptest.cxx
+++ b/vcl/qa/cppunit/canvasbitmaptest.cxx
@@ -362,7 +362,8 @@ private:
                                           ::sal_Bool,
                                           ::sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException,
                                                                       lang::IllegalArgumentException,
-                                                                      uno::RuntimeException)
+                                                                      uno::RuntimeException,
+                                                                      std::exception)
     {
         CPPUNIT_ASSERT_MESSAGE( "Got palette setIndex interface call without handing out palette",
                                 getPalette().is());
commit 3eee2ded1bb4fb4f94d8f262ffe98be5d8a00c7c
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Feb 9 20:55:02 2014 +0000

    coverity#1130483 Uninitialized pointer field
    
    Change-Id: I55bf498f031319b5f8975dfe9fc05d1ec7848751

diff --git a/sw/source/core/layout/newfrm.cxx b/sw/source/core/layout/newfrm.cxx
index 6634e37..d1156b0 100644
--- a/sw/source/core/layout/newfrm.cxx
+++ b/sw/source/core/layout/newfrm.cxx
@@ -486,6 +486,7 @@ SwRootFrm::SwRootFrm( SwFrmFmt *pFmt, SwViewShell * pSh ) :
     pLastPage( 0 ),
     pCurrShell( pSh ),
     pWaitingCurrShell( 0 ),
+    pCurrShells(NULL),
     pDrawPage( 0 ),
     pDestroy( 0 ),
     nPhyPageNums( 0 ),
commit 99f50cd8e2ceae421de3f5274dcd5619053bb27f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Feb 9 20:43:29 2014 +0000

    coverity#1169846 Uncaught exception
    
    Change-Id: Iae590d7b9ca2701a6917823524f819d18cb5676f

diff --git a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
index 028ab82..981e6c6 100644
--- a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
+++ b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
@@ -36,6 +36,7 @@
 #include <com/sun/star/ui/XUIConfigurationPersistence.hpp>
 #include <com/sun/star/ui/XModuleUIConfigurationManager2.hpp>
 #include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/embed/ElementModes.hpp>
 #include <com/sun/star/embed/XTransactedObject.hpp>
@@ -1058,9 +1059,12 @@ void SAL_CALL ModuleUIConfigurationManager::reset() throw (::com::sun::star::uno
                     impl_resetElementTypeData( rUserElementType, rDefaultElementType, aRemoveEventNotifyContainer, aReplaceEventNotifyContainer );
                     rUserElementType.bModified = false;
                 }
-                catch ( const Exception& )
+                catch (const Exception& e)
                 {
-                    throw IOException();
+                    css::uno::Any a(e);
+                    throw css::lang::WrappedTargetRuntimeException(
+                            OUString("ModuleUIConfigurationManager::reset exception"),
+                            css::uno::Reference<css::uno::XInterface>(*this), a);
                 }
             }
 
commit b0a7722ebfa720255b6ce1e383a3aacae0ce5e9f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Feb 9 20:35:57 2014 +0000

    coverity#1169848 Uncaught exception
    
    Change-Id: I27903e8b6bbf28a33601d793719ac5bcd3309db0

diff --git a/framework/source/services/modulemanager.cxx b/framework/source/services/modulemanager.cxx
index 572fa9f..d275e0a 100644
--- a/framework/source/services/modulemanager.cxx
+++ b/framework/source/services/modulemanager.cxx
@@ -278,55 +278,65 @@ void SAL_CALL ModuleManager::replaceByName(const OUString& sName ,
            css::lang::WrappedTargetException     ,
            css::uno::RuntimeException            )
 {
-    ::comphelper::SequenceAsHashMap lProps(aValue);
-    if (lProps.empty() )
+    try
     {
-        throw css::lang::IllegalArgumentException(
-                OUString("No properties given to replace part of module."),
-                static_cast< cppu::OWeakObject * >(this),
-                2);
-    }
+        ::comphelper::SequenceAsHashMap lProps(aValue);
+        if (lProps.empty() )
+        {
+            throw css::lang::IllegalArgumentException(
+                    OUString("No properties given to replace part of module."),
+                    static_cast< cppu::OWeakObject * >(this),
+                    2);
+        }
 
-    // SAFE -> ----------------------------------
-    ReadGuard aReadLock(m_aLock);
-    css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext;
-    aReadLock.unlock();
-    // <- SAFE ----------------------------------
+        // SAFE -> ----------------------------------
+        ReadGuard aReadLock(m_aLock);
+        css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext;
+        aReadLock.unlock();
+        // <- SAFE ----------------------------------
+
+        // get access to the element
+        // Note: Dont use impl_getConfig() method here. Because it creates a readonly access only, further
+        // it cache it as a member of this module manager instance. If we change some props there ... but dont
+        // flush changes (because an error occurred) we will read them later. If we use a different config access
+        // we can close it without a flush ... and our read data wont be affected .-)
+        css::uno::Reference< css::uno::XInterface >         xCfg      = ::comphelper::ConfigurationHelper::openConfig(
+                                                                            xContext,
+                                                                            OUString(CFGPATH_FACTORIES),
+                                                                            ::comphelper::ConfigurationHelper::E_STANDARD);
+        css::uno::Reference< css::container::XNameAccess >  xModules (xCfg, css::uno::UNO_QUERY_THROW);
+        css::uno::Reference< css::container::XNameReplace > xModule  ;
+
+        xModules->getByName(sName) >>= xModule;
+        if (!xModule.is())
+        {
+            throw css::uno::RuntimeException(
+                    OUString("Was not able to get write access to the requested module entry inside configuration."),
+                    static_cast< cppu::OWeakObject * >(this));
+        }
 
-    // get access to the element
-    // Note: Dont use impl_getConfig() method here. Because it creates a readonly access only, further
-    // it cache it as a member of this module manager instance. If we change some props there ... but dont
-    // flush changes (because an error occurred) we will read them later. If we use a different config access
-    // we can close it without a flush ... and our read data wont be affected .-)
-    css::uno::Reference< css::uno::XInterface >         xCfg      = ::comphelper::ConfigurationHelper::openConfig(
-                                                                        xContext,
-                                                                        OUString(CFGPATH_FACTORIES),
-                                                                        ::comphelper::ConfigurationHelper::E_STANDARD);
-    css::uno::Reference< css::container::XNameAccess >  xModules (xCfg, css::uno::UNO_QUERY_THROW);
-    css::uno::Reference< css::container::XNameReplace > xModule  ;
-
-    xModules->getByName(sName) >>= xModule;
-    if (!xModule.is())
-    {
-        throw css::uno::RuntimeException(
-                OUString("Was not able to get write access to the requested module entry inside configuration."),
-                static_cast< cppu::OWeakObject * >(this));
-    }
+        ::comphelper::SequenceAsHashMap::const_iterator pProp;
+        for (  pProp  = lProps.begin();
+               pProp != lProps.end()  ;
+             ++pProp                  )
+        {
+            const OUString& sPropName  = pProp->first;
+            const css::uno::Any&   aPropValue = pProp->second;
 
-    ::comphelper::SequenceAsHashMap::const_iterator pProp;
-    for (  pProp  = lProps.begin();
-           pProp != lProps.end()  ;
-         ++pProp                  )
-    {
-        const OUString& sPropName  = pProp->first;
-        const css::uno::Any&   aPropValue = pProp->second;
+            // let "NoSuchElementException" out ! We support the same API ...
+            // and without a flush() at the end all changed data before will be ignored !
+            xModule->replaceByName(sPropName, aPropValue);
+        }
 
-        // let "NoSuchElementException" out ! We support the same API ...
-        // and without a flush() at the end all changed data before will be ignored !
-        xModule->replaceByName(sPropName, aPropValue);
+        ::comphelper::ConfigurationHelper::flush(xCfg);
+    }
+    catch (const css::beans::IllegalTypeException& e)
+    {
+        css::uno::Any a(e);
+        throw css::lang::WrappedTargetException(
+                OUString("ModuleManager::replaceByName: IllegalType exception"),
+                css::uno::Reference<css::uno::XInterface>(*this), a);
     }
-
-    ::comphelper::ConfigurationHelper::flush(xCfg);
 }
 
 css::uno::Any SAL_CALL ModuleManager::getByName(const OUString& sName)
commit 2234f541176cad8c7dcc3d732a898f701af979b4
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Feb 9 20:28:53 2014 +0000

    fix debug=2 build
    
    Change-Id: I0163fe1668d35b3b108f9b57653fa490ae174ee0

diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx
index 635cf38..1ab966b0 100644
--- a/starmath/source/parse.cxx
+++ b/starmath/source/parse.cxx
@@ -328,12 +328,13 @@ static const sal_Unicode aDelimiterTable[] =
 bool SmParser::IsDelimiter( const OUString &rTxt, sal_Int32 nPos )
     // returns 'true' iff cChar is '\0' or a delimiter
 {
-    OSL_ENSURE( nPos <= rTxt.getLength(), "index out of range" );
+    assert(nPos <= rTxt.getLength()); //index out of range
 
-    sal_Unicode cChar = rTxt[nPos];
-    if(!cChar)
+    if (nPos == rTxt.getLength())
         return true;
 
+    sal_Unicode cChar = rTxt[nPos];
+
     // check if 'cChar' is in the delimiter table
     const sal_Unicode *pDelim = &aDelimiterTable[0];
     for ( ;  *pDelim != 0;  pDelim++)


More information about the Libreoffice-commits mailing list