diff options
-rw-r--r-- | hwpfilter/source/hwpfile.cxx | 27 | ||||
-rw-r--r-- | i18nlangtag/source/isolang/inunx.cxx | 80 | ||||
-rw-r--r-- | idl/source/objects/slot.cxx | 47 | ||||
-rw-r--r-- | idlc/source/astdeclaration.cxx | 51 | ||||
-rw-r--r-- | idlc/source/astenum.cxx | 60 | ||||
-rw-r--r-- | idlc/source/astscope.cxx | 51 | ||||
-rw-r--r-- | idlc/source/options.cxx | 74 | ||||
-rw-r--r-- | include/basegfx/range/basicrange.hxx | 26 | ||||
-rw-r--r-- | include/canvas/canvastools.hxx | 32 | ||||
-rw-r--r-- | include/comphelper/traceevent.hxx | 96 | ||||
-rw-r--r-- | include/cppuhelper/proptypehlp.hxx | 151 | ||||
-rw-r--r-- | include/salhelper/dynload.hxx | 3 |
12 files changed, 346 insertions, 352 deletions
diff --git a/hwpfilter/source/hwpfile.cxx b/hwpfilter/source/hwpfile.cxx index 171b7e1a9e8d..5f32a38c0633 100644 --- a/hwpfilter/source/hwpfile.cxx +++ b/hwpfilter/source/hwpfile.cxx @@ -596,23 +596,20 @@ void HWPFile::AddFBoxStyle(FBoxStyle * fbstyle) int HWPFile::compareCharShape(CharShape const *shape) { int count = cslist.size(); - if( count > 0 ) + for(int i = 0; i< count; i++) { - for(int i = 0; i< count; i++) + CharShape *cshape = getCharShape(i); + + if( shape->size == cshape->size && + shape->font[0] == cshape->font[0] && + shape->ratio[0] == cshape->ratio[0] && + shape->space[0] == cshape->space[0] && + shape->color[1] == cshape->color[1] && + shape->color[0] == cshape->color[0] && + shape->shade == cshape->shade && + shape->attr == cshape->attr ) { - CharShape *cshape = getCharShape(i); - - if( shape->size == cshape->size && - shape->font[0] == cshape->font[0] && - shape->ratio[0] == cshape->ratio[0] && - shape->space[0] == cshape->space[0] && - shape->color[1] == cshape->color[1] && - shape->color[0] == cshape->color[0] && - shape->shade == cshape->shade && - shape->attr == cshape->attr ) - { - return cshape->index; - } + return cshape->index; } } return 0; diff --git a/i18nlangtag/source/isolang/inunx.cxx b/i18nlangtag/source/isolang/inunx.cxx index e8ad10059d24..4dd4cdb3531b 100644 --- a/i18nlangtag/source/isolang/inunx.cxx +++ b/i18nlangtag/source/isolang/inunx.cxx @@ -88,60 +88,60 @@ static void getPlatformSystemLanguageImpl( LanguageType& rSystemLanguage, { /* get the language from the user environment */ LanguageType nLang = rSystemLanguage; + if ( nLang != LANGUAGE_DONTKNOW ) + return; + + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex()); + nLang = rSystemLanguage; if ( nLang == LANGUAGE_DONTKNOW ) { - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex()); - nLang = rSystemLanguage; - if ( nLang == LANGUAGE_DONTKNOW ) - { #ifdef MACOSX - rtl_Locale *procLocale; - (void) pGetLangFromEnv; /* unused */ + rtl_Locale *procLocale; + (void) pGetLangFromEnv; /* unused */ - if ( osl_getProcessLocale(&procLocale) == osl_Process_E_None ) - { - nLang = LanguageTag( *procLocale ).makeFallback().getLanguageType(); - OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER(); - rSystemLanguage = nLang; + if ( osl_getProcessLocale(&procLocale) == osl_Process_E_None ) + { + nLang = LanguageTag( *procLocale ).makeFallback().getLanguageType(); + OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER(); + rSystemLanguage = nLang; #ifdef DEBUG - if ( rSystemLanguage == LANGUAGE_DONTKNOW ) - fprintf( stderr, "intnunx.cxx: failed to convert osl_getProcessLocale() language to system language.\n" ); + if ( rSystemLanguage == LANGUAGE_DONTKNOW ) + fprintf( stderr, "intnunx.cxx: failed to convert osl_getProcessLocale() language to system language.\n" ); #endif - } + } #else /* MACOSX */ - bool bColonList = false; - OString aUnxLang( pGetLangFromEnv( bColonList)); - if (bColonList) + bool bColonList = false; + OString aUnxLang( pGetLangFromEnv( bColonList)); + if (bColonList) + { + // Only a very simple "take first". If empty try second or keep empty. + sal_Int32 n = aUnxLang.indexOf(':'); + if (n >= 0) { - // Only a very simple "take first". If empty try second or keep empty. - sal_Int32 n = aUnxLang.indexOf(':'); - if (n >= 0) + sal_Int32 s = 0; + if (n == 0 && aUnxLang.getLength() > 1) { - sal_Int32 s = 0; - if (n == 0 && aUnxLang.getLength() > 1) + n = aUnxLang.indexOf(':', 1); + if (n < 0) + n = aUnxLang.getLength(); + if (n < 2) + s = n = 0; + else { - n = aUnxLang.indexOf(':', 1); - if (n < 0) - n = aUnxLang.getLength(); - if (n < 2) - s = n = 0; - else - { - s = 1; - --n; - } + s = 1; + --n; } - aUnxLang = aUnxLang.copy(s,n); } + aUnxLang = aUnxLang.copy(s,n); } - nLang = MsLangId::convertUnxByteStringToLanguage( aUnxLang ); - OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER(); - rSystemLanguage = nLang; -#endif /* MACOSX */ - } - else { - OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER(); } + nLang = MsLangId::convertUnxByteStringToLanguage( aUnxLang ); + OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER(); + rSystemLanguage = nLang; +#endif /* MACOSX */ + } + else { + OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER(); } } diff --git a/idl/source/objects/slot.cxx b/idl/source/objects/slot.cxx index df4cebf9c8e0..6b4c65a1bcac 100644 --- a/idl/source/objects/slot.cxx +++ b/idl/source/objects/slot.cxx @@ -570,33 +570,32 @@ void SvMetaSlot::WriteSlot( std::string_view rShellName, sal_uInt16 nCount, sal_uInt16 SvMetaSlot::WriteSlotParamArray( SvIdlDataBase & rBase, SvStream & rOutStm ) const { - if( IsMethod() ) - { - SvMetaType * pType = GetType(); + if( !IsMethod() ) + return 0; - if( !SvIdlDataBase::FindType( pType, rBase.aUsedTypes ) ) - rBase.aUsedTypes.push_back( pType ); + SvMetaType * pType = GetType(); - const SvRefMemberList<SvMetaAttribute *>& rList = - pType->GetAttrList(); - for( size_t n = 0; n < rList.size(); n++ ) - { - SvMetaAttribute * pPar = rList[n]; - SvMetaType * pPType = pPar->GetType(); - WriteTab( rOutStm, 1 ); - rOutStm.WriteCharPtr("{ (const SfxType*) &a") - // item type - .WriteOString(pPType->GetName()).WriteCharPtr("_Impl, ") - // parameter name - .WriteCharPtr("\"").WriteOString(pPar->GetName()).WriteCharPtr("\", ") - // slot id - .WriteOString(pPar->GetSlotId().getString()).WriteCharPtr(" },") << endl; - if( !SvIdlDataBase::FindType( pPType, rBase.aUsedTypes ) ) - rBase.aUsedTypes.push_back( pPType ); - } - return static_cast<sal_uInt16>(rList.size()); + if( !SvIdlDataBase::FindType( pType, rBase.aUsedTypes ) ) + rBase.aUsedTypes.push_back( pType ); + + const SvRefMemberList<SvMetaAttribute *>& rList = + pType->GetAttrList(); + for( size_t n = 0; n < rList.size(); n++ ) + { + SvMetaAttribute * pPar = rList[n]; + SvMetaType * pPType = pPar->GetType(); + WriteTab( rOutStm, 1 ); + rOutStm.WriteCharPtr("{ (const SfxType*) &a") + // item type + .WriteOString(pPType->GetName()).WriteCharPtr("_Impl, ") + // parameter name + .WriteCharPtr("\"").WriteOString(pPar->GetName()).WriteCharPtr("\", ") + // slot id + .WriteOString(pPar->GetSlotId().getString()).WriteCharPtr(" },") << endl; + if( !SvIdlDataBase::FindType( pPType, rBase.aUsedTypes ) ) + rBase.aUsedTypes.push_back( pPType ); } - return 0; + return static_cast<sal_uInt16>(rList.size()); } sal_uInt16 SvMetaSlot::WriteSlotMap( std::string_view rShellName, sal_uInt16 nCount, diff --git a/idlc/source/astdeclaration.cxx b/idlc/source/astdeclaration.cxx index 58939868aac3..8ef76cc1f50e 100644 --- a/idlc/source/astdeclaration.cxx +++ b/idlc/source/astdeclaration.cxx @@ -125,38 +125,37 @@ bool AstDeclaration::hasAncestor(AstDeclaration* pDecl) bool AstDeclaration::dump(RegistryKey& rKey) { AstScope* pScope = declAsScope(this); - bool bRet = true; + if ( !pScope ) + return true; - if ( pScope ) + bool bRet = true; + DeclList::const_iterator iter = pScope->getIteratorBegin(); + DeclList::const_iterator end = pScope->getIteratorEnd(); + AstDeclaration* pDecl = nullptr; + while ( iter != end && bRet) { - DeclList::const_iterator iter = pScope->getIteratorBegin(); - DeclList::const_iterator end = pScope->getIteratorEnd(); - AstDeclaration* pDecl = nullptr; - while ( iter != end && bRet) + pDecl = *iter; + if ( pDecl->isInMainfile() ) { - pDecl = *iter; - if ( pDecl->isInMainfile() ) + switch ( pDecl->getNodeType() ) { - switch ( pDecl->getNodeType() ) - { - case NT_module: - case NT_constants: - case NT_interface: - case NT_struct: - case NT_exception: - case NT_enum: - case NT_typedef: - case NT_service: - case NT_singleton: - bRet = pDecl->dump(rKey); - break; - default: - break; - } + case NT_module: + case NT_constants: + case NT_interface: + case NT_struct: + case NT_exception: + case NT_enum: + case NT_typedef: + case NT_service: + case NT_singleton: + bRet = pDecl->dump(rKey); + break; + default: + break; } - - ++iter; } + + ++iter; } return bRet; } diff --git a/idlc/source/astenum.cxx b/idlc/source/astenum.cxx index 54324337de6d..7dff49d36c06 100644 --- a/idlc/source/astenum.cxx +++ b/idlc/source/astenum.cxx @@ -66,37 +66,37 @@ bool AstEnum::dump(RegistryKey& rKey) } sal_uInt16 nConst = getNodeCount(NT_enum_val); - if ( nConst > 0 ) + if ( nConst <= 0 ) + return true; + + typereg::Writer aBlob( + m_bPublished ? TYPEREG_VERSION_1 : TYPEREG_VERSION_0, + getDocumentation(), "", RT_TYPE_ENUM, m_bPublished, + OStringToOUString(getRelativName(), RTL_TEXTENCODING_UTF8), 0, + nConst, 0, 0); + + DeclList::const_iterator iter = getIteratorBegin(); + DeclList::const_iterator end = getIteratorEnd(); + sal_uInt16 index = 0; + while ( iter != end ) { - typereg::Writer aBlob( - m_bPublished ? TYPEREG_VERSION_1 : TYPEREG_VERSION_0, - getDocumentation(), "", RT_TYPE_ENUM, m_bPublished, - OStringToOUString(getRelativName(), RTL_TEXTENCODING_UTF8), 0, - nConst, 0, 0); - - DeclList::const_iterator iter = getIteratorBegin(); - DeclList::const_iterator end = getIteratorEnd(); - sal_uInt16 index = 0; - while ( iter != end ) - { - AstDeclaration* pDecl = *iter; - if ( pDecl->getNodeType() == NT_enum_val ) - static_cast<AstConstant*>(pDecl)->dumpBlob(aBlob, index++, false); - - ++iter; - } - - sal_uInt32 aBlobSize; - void const * pBlob = aBlob.getBlob(&aBlobSize); - - if (localKey.setValue("", RegValueType::BINARY, - const_cast<RegValue>(pBlob), aBlobSize) != RegError::NO_ERROR) - { - fprintf(stderr, "%s: warning, could not set value of key \"%s\" in %s\n", - idlc()->getOptions()->getProgramName().getStr(), - getFullName().getStr(), OUStringToOString(localKey.getRegistryName(), RTL_TEXTENCODING_UTF8).getStr()); - return false; - } + AstDeclaration* pDecl = *iter; + if ( pDecl->getNodeType() == NT_enum_val ) + static_cast<AstConstant*>(pDecl)->dumpBlob(aBlob, index++, false); + + ++iter; + } + + sal_uInt32 aBlobSize; + void const * pBlob = aBlob.getBlob(&aBlobSize); + + if (localKey.setValue("", RegValueType::BINARY, + const_cast<RegValue>(pBlob), aBlobSize) != RegError::NO_ERROR) + { + fprintf(stderr, "%s: warning, could not set value of key \"%s\" in %s\n", + idlc()->getOptions()->getProgramName().getStr(), + getFullName().getStr(), OUStringToOString(localKey.getRegistryName(), RTL_TEXTENCODING_UTF8).getStr()); + return false; } return true; diff --git a/idlc/source/astscope.cxx b/idlc/source/astscope.cxx index ca6214129c87..0795df6eeb2c 100644 --- a/idlc/source/astscope.cxx +++ b/idlc/source/astscope.cxx @@ -151,37 +151,36 @@ AstDeclaration* AstScope::lookupByName(const OString& scopedName) } } - if ( bFindFirstScope && (firstScope != scopedName) ) + if ( !bFindFirstScope || (firstScope == scopedName) ) + return pDecl; + + sal_Int32 i = 0; + sal_Int32 nOffset = 2; + do { - sal_Int32 i = 0; - sal_Int32 nOffset = 2; - do + pScope = declAsScope(pDecl); + if( pScope ) { - pScope = declAsScope(pDecl); - if( pScope ) - { - pDecl = pScope->lookupByNameLocal(scopedName.getToken(nOffset, ':', i )); - nOffset = 1; - } - if( !pDecl ) - break; - } while( i != -1 ); + pDecl = pScope->lookupByNameLocal(scopedName.getToken(nOffset, ':', i )); + nOffset = 1; + } + if( !pDecl ) + break; + } while( i != -1 ); - if ( !pDecl ) + if ( !pDecl ) + { + // last try if is not the global scope and the scopeName isn't specify global too + pDecl = scopeAsDecl(this); + if ( pDecl && !pDecl->getLocalName().isEmpty() ) { - // last try if is not the global scope and the scopeName isn't specify global too - pDecl = scopeAsDecl(this); - if ( pDecl && !pDecl->getLocalName().isEmpty() ) - { - pScope = pDecl->getScope(); - if ( pScope ) - pDecl = pScope->lookupByName(scopedName); - } else - { - pDecl = nullptr; - } + pScope = pDecl->getScope(); + if ( pScope ) + pDecl = pScope->lookupByName(scopedName); + } else + { + pDecl = nullptr; } - } return pDecl; diff --git a/idlc/source/options.cxx b/idlc/source/options.cxx index 2418e13afdf0..9f020777d54d 100644 --- a/idlc/source/options.cxx +++ b/idlc/source/options.cxx @@ -56,53 +56,53 @@ bool Options::checkArgument (std::vector< std::string > & rArgs, char const * ar { bool result = ((arg != nullptr) && (len > 0)); OSL_PRECOND(result, "idlc::Options::checkArgument(): invalid arguments"); - if (result) + if (!result) + return false; + + switch(arg[0]) { - switch(arg[0]) + case '@': + result = len > 1; + if (result) { - case '@': - result = len > 1; - if (result) - { - // "@<cmdfile>" - result = Options::checkCommandFile (rArgs, &(arg[1])); - } - break; - case '-': - result = len > 1; - if (result) + // "@<cmdfile>" + result = Options::checkCommandFile (rArgs, &(arg[1])); + } + break; + case '-': + result = len > 1; + if (result) + { + // "-<option>" + switch (arg[1]) { - // "-<option>" - switch (arg[1]) + case 'O': + case 'M': + case 'I': + case 'D': { - case 'O': - case 'M': - case 'I': - case 'D': + // "-<option>[<param>] + std::string option(&(arg[0]), 2); + rArgs.push_back(option); + if (len > 2) { - // "-<option>[<param>] - std::string option(&(arg[0]), 2); - rArgs.push_back(option); - if (len > 2) - { - // "-<option><param>" - std::string param(&(arg[2]), len - 2); - rArgs.push_back(param); - } - break; + // "-<option><param>" + std::string param(&(arg[2]), len - 2); + rArgs.push_back(param); } - default: - // "-<option>" ([long] option, w/o param) - rArgs.emplace_back(arg, len); break; } + default: + // "-<option>" ([long] option, w/o param) + rArgs.emplace_back(arg, len); + break; } - break; - default: - // "<param>" - rArgs.emplace_back(arg, len); - break; } + break; + default: + // "<param>" + rArgs.emplace_back(arg, len); + break; } return result; } diff --git a/include/basegfx/range/basicrange.hxx b/include/basegfx/range/basicrange.hxx index 99d7b02c0bef..319891832d17 100644 --- a/include/basegfx/range/basicrange.hxx +++ b/include/basegfx/range/basicrange.hxx @@ -225,23 +225,23 @@ namespace basegfx void grow(T nValue) { - if(!isEmpty()) + if(isEmpty()) + return; + + bool bLessThanZero(nValue < 0); + + if(nValue > 0 || bLessThanZero) { - bool bLessThanZero(nValue < 0); + mnMinimum -= nValue; + mnMaximum += nValue; - if(nValue > 0 || bLessThanZero) + if(bLessThanZero) { - mnMinimum -= nValue; - mnMaximum += nValue; - - if(bLessThanZero) + // test if range did collapse + if(mnMinimum > mnMaximum) { - // test if range did collapse - if(mnMinimum > mnMaximum) - { - // if yes, collapse to center - mnMinimum = mnMaximum = (mnMinimum + mnMaximum) / 2; - } + // if yes, collapse to center + mnMinimum = mnMaximum = (mnMinimum + mnMaximum) / 2; } } } diff --git a/include/canvas/canvastools.hxx b/include/canvas/canvastools.hxx index 56e230f4d5a6..63aea62392bb 100644 --- a/include/canvas/canvastools.hxx +++ b/include/canvas/canvastools.hxx @@ -461,24 +461,24 @@ namespace canvas SAL_WARN("canvas", "ValueMap::ValueMap(): Key is not lowercase " << pMap->maKey); } - if( mnEntries > 1 ) + if( mnEntries <= 1 ) + return; + + for( ::std::size_t i=0; i<mnEntries-1; ++i, ++pMap ) { - for( ::std::size_t i=0; i<mnEntries-1; ++i, ++pMap ) + if( !mapComparator(pMap[0], pMap[1]) && + mapComparator(pMap[1], pMap[0]) ) + { + SAL_WARN("canvas", "ValueMap::ValueMap(): Map is not sorted, keys are wrong, " + << pMap[0].maKey << " and " << pMap[1].maKey); + OSL_FAIL( "ValueMap::ValueMap(): Map is not sorted" ); + } + + const OString aStr2( pMap[1].maKey ); + if( !mbCaseSensitive && + aStr2 != aStr2.toAsciiLowerCase() ) { - if( !mapComparator(pMap[0], pMap[1]) && - mapComparator(pMap[1], pMap[0]) ) - { - SAL_WARN("canvas", "ValueMap::ValueMap(): Map is not sorted, keys are wrong, " - << pMap[0].maKey << " and " << pMap[1].maKey); - OSL_FAIL( "ValueMap::ValueMap(): Map is not sorted" ); - } - - const OString aStr2( pMap[1].maKey ); - if( !mbCaseSensitive && - aStr2 != aStr2.toAsciiLowerCase() ) - { - SAL_WARN("canvas", "ValueMap::ValueMap(): Key is not lowercase" << pMap[1].maKey); - } + SAL_WARN("canvas", "ValueMap::ValueMap(): Key is not lowercase" << pMap[1].maKey); } } #endif diff --git a/include/comphelper/traceevent.hxx b/include/comphelper/traceevent.hxx index 1c032de69698..665118636ca1 100644 --- a/include/comphelper/traceevent.hxx +++ b/include/comphelper/traceevent.hxx @@ -148,58 +148,58 @@ class COMPHELPER_DLLPUBLIC AsyncEvent : public NamedEvent, , m_nId(nId) , m_bBeginRecorded(false) { - if (s_bRecording) - { - long long nNow = getNow(); - - // Generate a "Start" (type S) event - TraceEvent::addRecording("{" - "\"name\":\"" - + OUString(m_sName, strlen(m_sName), RTL_TEXTENCODING_UTF8) - + "\"," - "\"ph\":\"S\"" - "," - "\"id\":" - + OUString::number(m_nId) + m_sArgs - + "," - "\"ts\":" - + OUString::number(nNow) - + "," - "\"pid\":" - + OUString::number(m_nPid) - + "," - "\"tid\":" - + OUString::number(osl_getThreadIdentifier(nullptr)) + "},"); - m_bBeginRecorded = true; - } + if (!s_bRecording) + return; + + long long nNow = getNow(); + + // Generate a "Start" (type S) event + TraceEvent::addRecording("{" + "\"name\":\"" + + OUString(m_sName, strlen(m_sName), RTL_TEXTENCODING_UTF8) + + "\"," + "\"ph\":\"S\"" + "," + "\"id\":" + + OUString::number(m_nId) + m_sArgs + + "," + "\"ts\":" + + OUString::number(nNow) + + "," + "\"pid\":" + + OUString::number(m_nPid) + + "," + "\"tid\":" + + OUString::number(osl_getThreadIdentifier(nullptr)) + "},"); + m_bBeginRecorded = true; } void generateEnd() { - if (m_bBeginRecorded) - { - m_bBeginRecorded = false; - - long long nNow = getNow(); - // Generate a "Finish" (type F) event - TraceEvent::addRecording("{" - "\"name\":\"" - + OUString(m_sName, strlen(m_sName), RTL_TEXTENCODING_UTF8) - + "\"," - "\"ph\":\"F\"" - "," - "\"id\":" - + OUString::number(m_nId) + m_sArgs - + "," - "\"ts\":" - + OUString::number(nNow) - + "," - "\"pid\":" - + OUString::number(m_nPid) - + "," - "\"tid\":" - + OUString::number(osl_getThreadIdentifier(nullptr)) + "},"); - } + if (!m_bBeginRecorded) + return; + + m_bBeginRecorded = false; + + long long nNow = getNow(); + // Generate a "Finish" (type F) event + TraceEvent::addRecording("{" + "\"name\":\"" + + OUString(m_sName, strlen(m_sName), RTL_TEXTENCODING_UTF8) + + "\"," + "\"ph\":\"F\"" + "," + "\"id\":" + + OUString::number(m_nId) + m_sArgs + + "," + "\"ts\":" + + OUString::number(nNow) + + "," + "\"pid\":" + + OUString::number(m_nPid) + + "," + "\"tid\":" + + OUString::number(osl_getThreadIdentifier(nullptr)) + "},"); } public: diff --git a/include/cppuhelper/proptypehlp.hxx b/include/cppuhelper/proptypehlp.hxx index e5fe4914528c..339c3910e2a7 100644 --- a/include/cppuhelper/proptypehlp.hxx +++ b/include/cppuhelper/proptypehlp.hxx @@ -42,36 +42,37 @@ inline void SAL_CALL convertPropertyValue( target &value , const css::uno::Any void convertPropertyValue(bool & b, const css::uno::Any & a) { - if( !(a >>= b) ) { - switch( a.getValueType().getTypeClass() ) { - case css::uno::TypeClass_BYTE: - b = a.get<sal_Int8>() != 0; - break; - case css::uno::TypeClass_SHORT: - b = a.get<sal_Int16>() != 0; - break; - case css::uno::TypeClass_UNSIGNED_SHORT: - { - sal_uInt16 i16 = 0; - a >>= i16; - b = i16 != 0; - break; - } - case css::uno::TypeClass_LONG: - b = a.get<sal_Int32>() != 0; + if( a >>= b ) + return; + + switch( a.getValueType().getTypeClass() ) { + case css::uno::TypeClass_BYTE: + b = a.get<sal_Int8>() != 0; + break; + case css::uno::TypeClass_SHORT: + b = a.get<sal_Int16>() != 0; + break; + case css::uno::TypeClass_UNSIGNED_SHORT: + { + sal_uInt16 i16 = 0; + a >>= i16; + b = i16 != 0; break; - case css::uno::TypeClass_UNSIGNED_LONG: - b = a.get<sal_uInt32>() != 0; + } + case css::uno::TypeClass_LONG: + b = a.get<sal_Int32>() != 0; + break; + case css::uno::TypeClass_UNSIGNED_LONG: + b = a.get<sal_uInt32>() != 0; + break; + case css::uno::TypeClass_CHAR: + { + sal_Unicode c = *static_cast<sal_Unicode const *>(a.getValue()); + b = c != 0; break; - case css::uno::TypeClass_CHAR: - { - sal_Unicode c = *static_cast<sal_Unicode const *>(a.getValue()); - b = c != 0; - break; - } - default: - throw css::lang::IllegalArgumentException(); } + default: + throw css::lang::IllegalArgumentException(); } } @@ -217,62 +218,64 @@ inline void SAL_CALL convertPropertyValue( sal_Int8 & i , const css::uno::Any & inline void SAL_CALL convertPropertyValue( float &f , const css::uno::Any &a ) { - if( !(a >>= f) ) { - switch( a.getValueType().getTypeClass() ) { - case css::uno::TypeClass_BOOLEAN: - f = static_cast<float>(a.get<bool>()); - break; - case css::uno::TypeClass_LONG: - f = static_cast<float>(a.get<sal_Int32>()); - break; - case css::uno::TypeClass_UNSIGNED_LONG: - f = static_cast<float>(a.get<sal_uInt32>()); - break; - case css::uno::TypeClass_HYPER: - f = static_cast<float>(a.get<sal_Int64>()); - break; - case css::uno::TypeClass_UNSIGNED_HYPER: - f = static_cast<float>(a.get<sal_uInt64>()); - break; - case css::uno::TypeClass_DOUBLE: - f = static_cast<float>(a.get<double>()); + if( a >>= f ) + return; + + switch( a.getValueType().getTypeClass() ) { + case css::uno::TypeClass_BOOLEAN: + f = static_cast<float>(a.get<bool>()); + break; + case css::uno::TypeClass_LONG: + f = static_cast<float>(a.get<sal_Int32>()); + break; + case css::uno::TypeClass_UNSIGNED_LONG: + f = static_cast<float>(a.get<sal_uInt32>()); + break; + case css::uno::TypeClass_HYPER: + f = static_cast<float>(a.get<sal_Int64>()); + break; + case css::uno::TypeClass_UNSIGNED_HYPER: + f = static_cast<float>(a.get<sal_uInt64>()); + break; + case css::uno::TypeClass_DOUBLE: + f = static_cast<float>(a.get<double>()); + break; + case css::uno::TypeClass_CHAR: + { + sal_Unicode c; + c = *static_cast<sal_Unicode const *>(a.getValue()); + f = static_cast<float>(c); break; - case css::uno::TypeClass_CHAR: - { - sal_Unicode c; - c = *static_cast<sal_Unicode const *>(a.getValue()); - f = static_cast<float>(c); - break; - } - default: - throw css::lang::IllegalArgumentException(); } + default: + throw css::lang::IllegalArgumentException(); } } inline void SAL_CALL convertPropertyValue( double &d , const css::uno::Any &a ) { - if( !(a >>= d) ) { - switch( a.getValueType().getTypeClass() ) { - case css::uno::TypeClass_BOOLEAN: - d = static_cast<double>(a.get<bool>()); - break; - case css::uno::TypeClass_HYPER: - d = static_cast<double>(a.get<sal_Int64>()); - break; - case css::uno::TypeClass_UNSIGNED_HYPER: - d = static_cast<double>(a.get<sal_uInt64>()); + if( a >>= d ) + return; + + switch( a.getValueType().getTypeClass() ) { + case css::uno::TypeClass_BOOLEAN: + d = static_cast<double>(a.get<bool>()); + break; + case css::uno::TypeClass_HYPER: + d = static_cast<double>(a.get<sal_Int64>()); + break; + case css::uno::TypeClass_UNSIGNED_HYPER: + d = static_cast<double>(a.get<sal_uInt64>()); + break; + case css::uno::TypeClass_CHAR: + { + sal_Unicode c; + c = *static_cast<sal_Unicode const *>(a.getValue()); + d = static_cast<double>(c); break; - case css::uno::TypeClass_CHAR: - { - sal_Unicode c; - c = *static_cast<sal_Unicode const *>(a.getValue()); - d = static_cast<double>(c); - break; - } - default: - throw css::lang::IllegalArgumentException(); } + default: + throw css::lang::IllegalArgumentException(); } } diff --git a/include/salhelper/dynload.hxx b/include/salhelper/dynload.hxx index b4ae693ea894..c360b0ce0688 100644 --- a/include/salhelper/dynload.hxx +++ b/include/salhelper/dynload.hxx @@ -150,9 +150,6 @@ public: /// Destructor, decrease the reference count and unload the library if it is the last instance. ~ODynamicLoader() { - if( m_pLoader ) - if (m_pLoader->release()==0) - m_pStaticLoader = NULL; } /// Assign operator |