[Libreoffice-commits] core.git: 9 commits - embeddedobj/source svtools/source svx/source sw/source
Caolán McNamara
caolanm at redhat.com
Fri Apr 4 12:59:13 PDT 2014
embeddedobj/source/general/dummyobject.cxx | 60 ++++++++++++++++-------------
embeddedobj/source/inc/dummyobject.hxx | 3 -
embeddedobj/source/inc/oleembobj.hxx | 2
embeddedobj/source/msole/olemisc.cxx | 2
embeddedobj/source/msole/olepersist.cxx | 2
svtools/source/control/stdmenu.cxx | 33 ++++++++-------
svx/source/gallery2/galtheme.cxx | 4 +
sw/source/core/layout/frmtool.cxx | 2
sw/source/core/layout/paintfrm.cxx | 2
sw/source/core/unocore/unochart.cxx | 3 +
sw/source/filter/ww8/wrtww8.cxx | 2
11 files changed, 66 insertions(+), 49 deletions(-)
New commits:
commit d4e4bcb2df3f12f7ee19c084a5deab6691f290f2
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Apr 4 20:56:23 2014 +0100
coverity#706511 Uncaught exception
Change-Id: I2822c35e60a93b86bdcb56f1e4782aa46e1ce8e0
diff --git a/embeddedobj/source/msole/olemisc.cxx b/embeddedobj/source/msole/olemisc.cxx
index 9215e10..96a0392 100644
--- a/embeddedobj/source/msole/olemisc.cxx
+++ b/embeddedobj/source/msole/olemisc.cxx
@@ -383,7 +383,7 @@ uno::Reference< util::XCloseable > SAL_CALL OleEmbeddedObject::getComponent()
if ( m_nObjectState == -1 ) // || m_nObjectState == embed::EmbedStates::LOADED )
{
// the object is still not running
- throw embed::WrongStateException( OUString( "The object is not loaded!\n" ),
+ throw uno::RuntimeException( OUString( "The object is not loaded!\n" ),
uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
}
commit 3140af0a32a862d4300790522ccbbb47b468698d
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Apr 4 20:53:56 2014 +0100
coverity#706508 Uncaught exception
and coverity#706509, coverity#706510
Change-Id: Ib160cc65ed50073f9302ac071b2e8970a7316a54
diff --git a/embeddedobj/source/general/dummyobject.cxx b/embeddedobj/source/general/dummyobject.cxx
index 5b3e72c..85f1843 100644
--- a/embeddedobj/source/general/dummyobject.cxx
+++ b/embeddedobj/source/general/dummyobject.cxx
@@ -38,7 +38,7 @@
using namespace ::com::sun::star;
-void ODummyEmbeddedObject::CheckInit()
+void ODummyEmbeddedObject::CheckInit_WrongState()
{
if ( m_bDisposed )
throw lang::DisposedException();
@@ -48,7 +48,15 @@ void ODummyEmbeddedObject::CheckInit()
uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
}
+void ODummyEmbeddedObject::CheckInit_Runtime()
+{
+ if ( m_bDisposed )
+ throw lang::DisposedException();
+ if ( m_nObjectState == -1 )
+ throw uno::RuntimeException( OUString( "The object has no persistence!\n" ),
+ uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
+}
void ODummyEmbeddedObject::PostEvent_Impl( const OUString& aEventName )
{
if ( m_pInterfaceContainer )
@@ -96,7 +104,7 @@ void SAL_CALL ODummyEmbeddedObject::changeState( sal_Int32 nNewState )
uno::RuntimeException, std::exception )
{
::osl::MutexGuard aGuard( m_aMutex );
- CheckInit();
+ CheckInit_WrongState();
if ( nNewState == embed::EmbedStates::LOADED )
return;
@@ -110,7 +118,7 @@ uno::Sequence< sal_Int32 > SAL_CALL ODummyEmbeddedObject::getReachableStates()
uno::RuntimeException, std::exception )
{
::osl::MutexGuard aGuard( m_aMutex );
- CheckInit();
+ CheckInit_WrongState();
uno::Sequence< sal_Int32 > aResult( 1 );
aResult[0] = embed::EmbedStates::LOADED;
@@ -124,7 +132,7 @@ sal_Int32 SAL_CALL ODummyEmbeddedObject::getCurrentState()
uno::RuntimeException, std::exception )
{
::osl::MutexGuard aGuard( m_aMutex );
- CheckInit();
+ CheckInit_WrongState();
return m_nObjectState;
}
@@ -138,7 +146,7 @@ void SAL_CALL ODummyEmbeddedObject::doVerb( sal_Int32 )
uno::RuntimeException, std::exception )
{
::osl::MutexGuard aGuard( m_aMutex );
- CheckInit();
+ CheckInit_WrongState();
// no supported verbs
}
@@ -149,7 +157,7 @@ uno::Sequence< embed::VerbDescriptor > SAL_CALL ODummyEmbeddedObject::getSupport
uno::RuntimeException, std::exception )
{
::osl::MutexGuard aGuard( m_aMutex );
- CheckInit();
+ CheckInit_WrongState();
return uno::Sequence< embed::VerbDescriptor >();
}
@@ -161,7 +169,7 @@ void SAL_CALL ODummyEmbeddedObject::setClientSite(
uno::RuntimeException, std::exception )
{
::osl::MutexGuard aGuard( m_aMutex );
- CheckInit();
+ CheckInit_WrongState();
m_xClientSite = xClient;
}
@@ -172,7 +180,7 @@ uno::Reference< embed::XEmbeddedClient > SAL_CALL ODummyEmbeddedObject::getClien
uno::RuntimeException, std::exception )
{
::osl::MutexGuard aGuard( m_aMutex );
- CheckInit();
+ CheckInit_WrongState();
return m_xClientSite;
}
@@ -184,7 +192,7 @@ void SAL_CALL ODummyEmbeddedObject::update()
uno::RuntimeException, std::exception )
{
::osl::MutexGuard aGuard( m_aMutex );
- CheckInit();
+ CheckInit_WrongState();
}
@@ -193,7 +201,7 @@ void SAL_CALL ODummyEmbeddedObject::setUpdateMode( sal_Int32 )
uno::RuntimeException, std::exception )
{
::osl::MutexGuard aGuard( m_aMutex );
- CheckInit();
+ CheckInit_WrongState();
}
@@ -202,7 +210,7 @@ sal_Int64 SAL_CALL ODummyEmbeddedObject::getStatus( sal_Int64 )
uno::RuntimeException, std::exception )
{
::osl::MutexGuard aGuard( m_aMutex );
- CheckInit();
+ CheckInit_WrongState();
return 0;
}
@@ -212,7 +220,7 @@ void SAL_CALL ODummyEmbeddedObject::setContainerName( const OUString& )
throw ( uno::RuntimeException, std::exception )
{
::osl::MutexGuard aGuard( m_aMutex );
- CheckInit();
+ CheckInit_Runtime();
}
@@ -223,7 +231,7 @@ void SAL_CALL ODummyEmbeddedObject::setVisualAreaSize( sal_Int64 nAspect, const
uno::RuntimeException, std::exception )
{
::osl::MutexGuard aGuard( m_aMutex );
- CheckInit();
+ CheckInit_WrongState();
OSL_ENSURE( nAspect != embed::Aspects::MSOLE_ICON, "For iconified objects no graphical replacement is required!\n" );
if ( nAspect == embed::Aspects::MSOLE_ICON )
@@ -244,7 +252,7 @@ awt::Size SAL_CALL ODummyEmbeddedObject::getVisualAreaSize( sal_Int64 nAspect )
uno::RuntimeException, std::exception )
{
::osl::MutexGuard aGuard( m_aMutex );
- CheckInit();
+ CheckInit_WrongState();
OSL_ENSURE( nAspect != embed::Aspects::MSOLE_ICON, "For iconified objects no graphical replacement is required!\n" );
if ( nAspect == embed::Aspects::MSOLE_ICON )
@@ -266,7 +274,7 @@ sal_Int32 SAL_CALL ODummyEmbeddedObject::getMapUnit( sal_Int64 nAspect )
uno::RuntimeException, std::exception)
{
::osl::MutexGuard aGuard( m_aMutex );
- CheckInit();
+ CheckInit_Runtime();
OSL_ENSURE( nAspect != embed::Aspects::MSOLE_ICON, "For iconified objects no graphical replacement is required!\n" );
if ( nAspect == embed::Aspects::MSOLE_ICON )
@@ -285,7 +293,7 @@ embed::VisualRepresentation SAL_CALL ODummyEmbeddedObject::getPreferredVisualRep
uno::RuntimeException, std::exception )
{
::osl::MutexGuard aGuard( m_aMutex );
- CheckInit();
+ CheckInit_WrongState();
// no representation can be retrieved
throw embed::WrongStateException( OUString( "Illegal call!\n" ),
@@ -371,7 +379,7 @@ void SAL_CALL ODummyEmbeddedObject::storeToEntry( const uno::Reference< embed::X
uno::RuntimeException, std::exception )
{
::osl::MutexGuard aGuard( m_aMutex );
- CheckInit();
+ CheckInit_WrongState();
if ( m_bWaitSaveCompleted )
throw embed::WrongStateException(
@@ -393,7 +401,7 @@ void SAL_CALL ODummyEmbeddedObject::storeAsEntry( const uno::Reference< embed::X
uno::RuntimeException, std::exception )
{
::osl::MutexGuard aGuard( m_aMutex );
- CheckInit();
+ CheckInit_WrongState();
if ( m_bWaitSaveCompleted )
throw embed::WrongStateException(
@@ -416,7 +424,7 @@ void SAL_CALL ODummyEmbeddedObject::saveCompleted( sal_Bool bUseNew )
uno::RuntimeException, std::exception )
{
::osl::MutexGuard aGuard( m_aMutex );
- CheckInit();
+ CheckInit_WrongState();
// it is allowed to call saveCompleted( false ) for nonstored objects
if ( !m_bWaitSaveCompleted && !bUseNew )
@@ -449,7 +457,7 @@ sal_Bool SAL_CALL ODummyEmbeddedObject::hasEntry()
uno::RuntimeException, std::exception )
{
::osl::MutexGuard aGuard( m_aMutex );
- CheckInit();
+ CheckInit_WrongState();
if ( m_bWaitSaveCompleted )
throw embed::WrongStateException(
@@ -468,7 +476,7 @@ OUString SAL_CALL ODummyEmbeddedObject::getEntryName()
uno::RuntimeException, std::exception )
{
::osl::MutexGuard aGuard( m_aMutex );
- CheckInit();
+ CheckInit_WrongState();
if ( m_bWaitSaveCompleted )
throw embed::WrongStateException(
@@ -486,7 +494,7 @@ void SAL_CALL ODummyEmbeddedObject::storeOwn()
uno::RuntimeException, std::exception )
{
::osl::MutexGuard aGuard( m_aMutex );
- CheckInit();
+ CheckInit_WrongState();
if ( m_bWaitSaveCompleted )
throw embed::WrongStateException(
@@ -503,7 +511,7 @@ sal_Bool SAL_CALL ODummyEmbeddedObject::isReadonly()
uno::RuntimeException, std::exception )
{
::osl::MutexGuard aGuard( m_aMutex );
- CheckInit();
+ CheckInit_WrongState();
if ( m_bWaitSaveCompleted )
throw embed::WrongStateException(
@@ -525,7 +533,7 @@ void SAL_CALL ODummyEmbeddedObject::reload(
uno::RuntimeException, std::exception )
{
::osl::MutexGuard aGuard( m_aMutex );
- CheckInit();
+ CheckInit_WrongState();
if ( m_bWaitSaveCompleted )
throw embed::WrongStateException(
@@ -540,7 +548,7 @@ uno::Sequence< sal_Int8 > SAL_CALL ODummyEmbeddedObject::getClassID()
throw ( uno::RuntimeException, std::exception )
{
::osl::MutexGuard aGuard( m_aMutex );
- CheckInit();
+ CheckInit_Runtime();
// currently the class ID is empty
// TODO/LATER: should a special class ID be used in this case?
@@ -572,7 +580,7 @@ uno::Reference< util::XCloseable > SAL_CALL ODummyEmbeddedObject::getComponent()
throw ( uno::RuntimeException, std::exception )
{
::osl::MutexGuard aGuard( m_aMutex );
- CheckInit();
+ CheckInit_Runtime();
return uno::Reference< util::XCloseable >();
}
diff --git a/embeddedobj/source/inc/dummyobject.hxx b/embeddedobj/source/inc/dummyobject.hxx
index 9c6163a..15b3dd7 100644
--- a/embeddedobj/source/inc/dummyobject.hxx
+++ b/embeddedobj/source/inc/dummyobject.hxx
@@ -68,7 +68,8 @@ class ODummyEmbeddedObject : public ::cppu::WeakImplHelper2
::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > m_xNewParentStorage;
protected:
- void CheckInit();
+ void CheckInit_WrongState(); //throw WrongStateException on m_nObjectState == -1
+ void CheckInit_Runtime(); //throw RuntimeException on m_nObjectState == -1
void PostEvent_Impl( const OUString& aEventName );
public:
commit dc72c62b31ae0fa32e340cb424ad5cc967f87661
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Apr 4 20:45:30 2014 +0100
coverity#706512 Uncaught exception
Change-Id: I6ec80c02ca8ef737297e77ccda2a0b5919fa66cb
diff --git a/embeddedobj/source/inc/oleembobj.hxx b/embeddedobj/source/inc/oleembobj.hxx
index ce8bb95..cfc8643 100644
--- a/embeddedobj/source/inc/oleembobj.hxx
+++ b/embeddedobj/source/inc/oleembobj.hxx
@@ -202,7 +202,7 @@ protected:
::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > GetNewFilledTempStream_Impl(
const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInStream )
- throw( ::com::sun::star::io::IOException );
+ throw( css::io::IOException, css::uno::RuntimeException );
#ifdef WNT
void SwitchComponentToRunningState_Impl();
#endif
diff --git a/embeddedobj/source/msole/olepersist.cxx b/embeddedobj/source/msole/olepersist.cxx
index 264b920..19044c4 100644
--- a/embeddedobj/source/msole/olepersist.cxx
+++ b/embeddedobj/source/msole/olepersist.cxx
@@ -262,7 +262,7 @@ void VerbExecutionController::UnlockNotification()
uno::Reference< io::XStream > OleEmbeddedObject::GetNewFilledTempStream_Impl( const uno::Reference< io::XInputStream >& xInStream )
- throw( io::IOException )
+ throw( io::IOException, uno::RuntimeException )
{
SAL_WARN_IF( !xInStream.is(), "embeddedobj.ole", "Wrong parameter is provided!" );
commit 94fccef699496a38d5d2474158bf11e2091ab5dc
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Apr 4 20:42:12 2014 +0100
coverity#704997 Explicit null dereferenced
Change-Id: I22e7872e45cca981a0b2c24ca8b0393ba1244612
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index b97f66d..343e47c 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -610,7 +610,7 @@ void WW8Export::ExportDopTypography(WW8DopTypography &rTypo)
OSL_ENSURE( nNoNeeded<=1, "Example of unexportable forbidden chars" );
rTypo.reserved1=nUseReserved;
- if (rTypo.iLevelOfKinsoku)
+ if (rTypo.iLevelOfKinsoku && pUseMe)
{
rTypo.cchFollowingPunct = msword_cast<sal_Int16>
(pUseMe->beginLine.getLength());
commit 9359f4747181ae93f777f224a9f64a832d5b806c
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Apr 4 20:39:45 2014 +0100
coverity#704951 Explicit null dereferenced
Change-Id: I0f1cf705d0eea78b5bf44e0d6b882f7c8636a6ac
diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx
index 8cd9821..4c6ab39 100644
--- a/sw/source/core/unocore/unochart.cxx
+++ b/sw/source/core/unocore/unochart.cxx
@@ -263,6 +263,9 @@ static OUString GetCellRangeName( SwFrmFmt &rTblFmt, SwUnoCrsr &rTblCrsr )
pEndBox = pTmpBox;
}
+ if (!pStartBox)
+ return aRes;
+
aRes = pStartBox->GetName();
aRes += ":";
if (pEndBox)
commit 1b7e435d9e2c0c2dae6ddabc31c92c8374f8ccab
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Apr 4 20:37:27 2014 +0100
coverity#704913 Explicit null dereferenced
Change-Id: Idfdeca8e19438081acabd51aa72d7f6322c4b31b
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 2371fcc..294977a 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -1184,7 +1184,7 @@ void SwSubsRects::PaintSubsidiary( OutputDevice *pOut,
case SUBCOL_SECT: pCol = &SwViewOption::GetSectionBoundColor(); break;
}
- if ( pOut->GetFillColor() != *pCol )
+ if (pCol && pOut->GetFillColor() != *pCol)
pOut->SetFillColor( *pCol );
pOut->DrawRect( rLRect.SVRect() );
commit 5a870b386c36b38384367e9009b3a21cc2fd8f25
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Apr 4 20:36:29 2014 +0100
coverity#704906 Explicit null dereferenced
Change-Id: I7cb047271af6ffa789c6e18a8dbd2a7dddcdc15c
diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx
index fdfb785..fe53067 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -2362,7 +2362,7 @@ SwFrm *SaveCntnt( SwLayoutFrm *pLay, SwFrm *pStart )
do
{
pSav = pTmp;
- pTmp = pSav->GetUpper() ? pSav->GetUpper()->FindSctFrm() : NULL;
+ pTmp = (pSav && pSav->GetUpper()) ? pSav->GetUpper()->FindSctFrm() : NULL;
} while ( pTmp != pSect );
}
commit 0d46e05cf26ee14793b50a00dbd64ffc68bc8435
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Apr 4 20:35:06 2014 +0100
coverity#704828 Explicit null dereferenced
Change-Id: I5e27241334cfeb4dffecbbf1d010abe94fbc52df
diff --git a/svtools/source/control/stdmenu.cxx b/svtools/source/control/stdmenu.cxx
index 3faca9c..af3546a 100644
--- a/svtools/source/control/stdmenu.cxx
+++ b/svtools/source/control/stdmenu.cxx
@@ -64,24 +64,27 @@ void FontNameMenu::Fill( const FontList* pList )
Clear();
// add fonts
- const vcl::I18nHelper& rI18nHelper = Application::GetSettings().GetUILocaleI18nHelper();
- // more than 100 fonts reduces the speed of opening the menu.
- // So only the first 100 fonts will be displayed.
- sal_uInt16 nFontCount = ::std::min( pList->GetFontNameCount(), static_cast< sal_uInt16 >(100) );
- for (sal_uInt16 i = 0; i < nFontCount; ++i)
+ if (pList)
{
- const OUString& rName = pList->GetFontName( i ).GetName();
-
- // sort with the I18nHelper
- sal_uInt16 j = GetItemCount();
- while ( j )
+ const vcl::I18nHelper& rI18nHelper = Application::GetSettings().GetUILocaleI18nHelper();
+ // more than 100 fonts reduces the speed of opening the menu.
+ // So only the first 100 fonts will be displayed.
+ sal_uInt16 nFontCount = ::std::min( pList->GetFontNameCount(), static_cast< sal_uInt16 >(100) );
+ for (sal_uInt16 i = 0; i < nFontCount; ++i)
{
- OUString aText = GetItemText( GetItemId( j-1 ) );
- if ( rI18nHelper.CompareString( rName, aText ) > 0 )
- break;
- j--;
+ const OUString& rName = pList->GetFontName( i ).GetName();
+
+ // sort with the I18nHelper
+ sal_uInt16 j = GetItemCount();
+ while ( j )
+ {
+ OUString aText = GetItemText( GetItemId( j-1 ) );
+ if ( rI18nHelper.CompareString( rName, aText ) > 0 )
+ break;
+ j--;
+ }
+ InsertItem( i+1, rName, MIB_RADIOCHECK | MIB_AUTOCHECK, OString(), j );
}
- InsertItem( i+1, rName, MIB_RADIOCHECK | MIB_AUTOCHECK, OString(), j );
}
SetCurName( maCurName );
commit 8aa12e6e62341698dadacbc7af75f14ed17d1b1d
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Apr 4 20:33:09 2014 +0100
coverity#704827 Explicit null dereferenced
Change-Id: Ibffeb1653c7424cd8f9e4dbbb66b203a571cf2ef
diff --git a/svx/source/gallery2/galtheme.cxx b/svx/source/gallery2/galtheme.cxx
index 20959e8..2650811 100644
--- a/svx/source/gallery2/galtheme.cxx
+++ b/svx/source/gallery2/galtheme.cxx
@@ -301,7 +301,9 @@ INetURLObject GalleryTheme::ImplCreateUniqueURL( SgaObjKind eObjKind, sal_uIntPt
OUString aFileName( "dd" );
aFileName += OUString::number( ++nNextNumber % 999999 );
- aFileName += OUString( pExt, strlen(pExt), RTL_TEXTENCODING_ASCII_US );
+
+ if (pExt)
+ aFileName += OUString( pExt, strlen(pExt), RTL_TEXTENCODING_ASCII_US );
aNewURL = aDir;
aNewURL.Append( aFileName );
More information about the Libreoffice-commits
mailing list