basic/source/inc/namecont.hxx | 11 +++++++++ basic/source/uno/namecont.cxx | 29 +++++++++++++++++--------- i18npool/source/collator/collator_unicode.cxx | 5 ++++ 3 files changed, 36 insertions(+), 9 deletions(-)
New commits: commit 414540aecae90774e12390cfcf8f0a37e10684b4 Author: Caolán McNamara <caol...@redhat.com> Date: Wed Jul 2 12:35:11 2014 +0100 allow build with icu 4.2 Change-Id: I4bbcff7963520426d4c04e15d2239431aff65b56 diff --git a/i18npool/source/collator/collator_unicode.cxx b/i18npool/source/collator/collator_unicode.cxx index 2960f03..d0aef3f 100644 --- a/i18npool/source/collator/collator_unicode.cxx +++ b/i18npool/source/collator/collator_unicode.cxx @@ -333,6 +333,10 @@ Collator_Unicode::loadCollatorAlgorithm(const OUString& rAlgorithm, const lang:: if (func && funclen) { const sal_uInt8* ruleImage=func(); size_t ruleImageSize = funclen(); + +#if (U_ICU_VERSION_MAJOR_NUM == 4) && (U_ICU_VERSION_MINOR_NUM <= 2) + uca_base = new RuleBasedCollator(static_cast<UChar*>(NULL), status); +#else // Not only changed ICU 53.1 the API behavior that a negative // length (ruleImageSize) now leads to failure, but also that // the base RuleBasedCollator passed as uca_base here needs to @@ -344,6 +348,7 @@ Collator_Unicode::loadCollatorAlgorithm(const OUString& rAlgorithm, const lang:: // NULL (default) locale does not. uca_base = static_cast<RuleBasedCollator*>(icu::Collator::createInstance( icu::Locale::getRoot(), status)); +#endif if (! U_SUCCESS(status)) throw RuntimeException(); collator = new RuleBasedCollator( reinterpret_cast<const uint8_t*>(ruleImage), ruleImageSize, uca_base, status); commit c80be30203b842c7b6d3145200b120cefb452cb8 Author: Caolán McNamara <caol...@redhat.com> Date: Wed Jul 2 14:30:18 2014 +0100 coverity#706241 Uncaught exception we've already checked to see if the element exists, so we know that its not there. Change-Id: I538c0d48a883d478e4c748d222b21958d083c049 diff --git a/basic/source/inc/namecont.hxx b/basic/source/inc/namecont.hxx index 6355549..bcbd245 100644 --- a/basic/source/inc/namecont.hxx +++ b/basic/source/inc/namecont.hxx @@ -96,6 +96,17 @@ public: void setEventSource( ::com::sun::star::uno::XInterface* pxEventSource ) { mpxEventSource = pxEventSource; } + void insertCheck(const OUString& aName, const css::uno::Any& aElement) + throw (css::lang::IllegalArgumentException, + css::container::ElementExistException, + css::lang::WrappedTargetException, + css::uno::RuntimeException, std::exception); + + void insertNoCheck(const OUString& aName, const css::uno::Any& aElement) + throw (css::lang::IllegalArgumentException, + css::lang::WrappedTargetException, + css::uno::RuntimeException, std::exception); + // Methods XElementAccess virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx index de2b91a..ac35350 100644 --- a/basic/source/uno/namecont.cxx +++ b/basic/source/uno/namecont.cxx @@ -186,21 +186,25 @@ void NameContainer::replaceByName( const OUString& aName, const Any& aElement ) } } - -// Methods XNameContainer -void NameContainer::insertByName( const OUString& aName, const Any& aElement ) +void NameContainer::insertCheck(const OUString& aName, const Any& aElement) throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException, std::exception) { + NameContainerNameMap::iterator aIt = mHashMap.find(aName); + if( aIt != mHashMap.end() ) + { + throw ElementExistException(); + } + insertNoCheck(aName, aElement); +} + +void NameContainer::insertNoCheck(const OUString& aName, const Any& aElement) + throw(IllegalArgumentException, WrappedTargetException, RuntimeException, std::exception) +{ Type aAnyType = aElement.getValueType(); if( mType != aAnyType ) { throw IllegalArgumentException(); } - NameContainerNameMap::iterator aIt = mHashMap.find( aName ); - if( aIt != mHashMap.end() ) - { - throw ElementExistException(); - } sal_Int32 nCount = mNames.getLength(); mNames.realloc( nCount + 1 ); @@ -236,6 +240,13 @@ void NameContainer::insertByName( const OUString& aName, const Any& aElement ) } } +// Methods XNameContainer +void NameContainer::insertByName( const OUString& aName, const Any& aElement ) + throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException, std::exception) +{ + insertCheck(aName, aElement); +} + void NameContainer::removeByName( const OUString& aName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException, std::exception) { @@ -2492,7 +2503,7 @@ void SAL_CALL SfxLibraryContainer::loadLibrary( const OUString& Name ) } else { - pImplLib->maNameContainer.insertByName( aElementName, aAny ); + pImplLib->maNameContainer.insertNoCheck(aElementName, aAny); } } pImplLib->implSetModified( false );
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits