diff options
author | Noel Grandin <noel@peralex.com> | 2015-11-20 09:54:21 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-11-20 11:24:17 +0200 |
commit | 9c5060a6f9c8e94965178dc44bae6ce744d1eb7c (patch) | |
tree | a173cc7f96690bcd9bbfde83c17100008c85423b /unotools | |
parent | ab9add5c96490801a7e1761306c41131468db703 (diff) |
attempt to fix tdf#95935 - CRASH on startup in o3tl vcl code
I suspect that the problem is the shift and that converting it
"1UL <<"
will fix it
Change-Id: I4808b833453a544aeb732192758d323f358c3ab0
Diffstat (limited to 'unotools')
-rw-r--r-- | unotools/source/config/fontcfg.cxx | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/unotools/source/config/fontcfg.cxx b/unotools/source/config/fontcfg.cxx index 0409768ed543..d3434500769e 100644 --- a/unotools/source/config/fontcfg.cxx +++ b/unotools/source/config/fontcfg.cxx @@ -988,28 +988,27 @@ FontWidth FontSubstConfiguration::getSubstWidth( const css::uno::Reference< XNam ImplFontAttrs FontSubstConfiguration::getSubstType( const css::uno::Reference< XNameAccess >& rFont, const OUString& rType ) const { - unsigned long type = 0; + sal_uLong type = 0; try { Any aAny = rFont->getByName( rType ); - if( aAny.getValueTypeClass() == TypeClass_STRING ) + if( aAny.getValueTypeClass() != TypeClass_STRING ) + return ImplFontAttrs::None; + const OUString* pLine = static_cast<const OUString*>(aAny.getValue()); + if( pLine->isEmpty() ) + return ImplFontAttrs::None; + sal_Int32 nIndex = 0; + while( nIndex != -1 ) { - const OUString* pLine = static_cast<const OUString*>(aAny.getValue()); - if( !pLine->isEmpty() ) - { - sal_Int32 nIndex = 0; - while( nIndex != -1 ) + OUString aToken( pLine->getToken( 0, ',', nIndex ) ); + for( int k = 0; k < 32; k++ ) + if( aToken.equalsIgnoreAsciiCaseAscii( pAttribNames[k] ) ) { - OUString aToken( pLine->getToken( 0, ',', nIndex ) ); - for( int k = 0; k < 32; k++ ) - if( aToken.equalsIgnoreAsciiCaseAscii( pAttribNames[k] ) ) - { - type |= 1 << k; - break; - } + type |= 1UL << k; + break; } - } } + assert(((type & ~o3tl::typed_flags<ImplFontAttrs>::mask) == 0) && "invalid font attributes"); } catch (const NoSuchElementException&) { |