From afad4eeaffcad716f135de2bd111bd0aca68e07f Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Fri, 6 May 2016 13:46:03 +0200 Subject: svtools: FontList loops with > 2^16 fonts Change-Id: Idfe5d76ee384dff3280f81686cbf408c2f675dc6 --- svtools/source/control/ctrltool.cxx | 14 ++++++-------- svtools/source/control/stdmenu.cxx | 4 ++-- 2 files changed, 8 insertions(+), 10 deletions(-) (limited to 'svtools/source/control') diff --git a/svtools/source/control/ctrltool.cxx b/svtools/source/control/ctrltool.cxx index ccbb3a13ef5f..7702add7dc35 100644 --- a/svtools/source/control/ctrltool.cxx +++ b/svtools/source/control/ctrltool.cxx @@ -249,9 +249,8 @@ void FontList::ImplInsertFonts( OutputDevice* pDevice, bool bAll, nType = FontListFontNameType::PRINTER; // inquire all fonts from the device - int n = pDevice->GetDevFontCount(); - sal_uInt16 i; - for( i = 0; i < n; i++ ) + int const n = pDevice->GetDevFontCount(); + for (int i = 0; i < n; ++i) { FontMetric aFontMetric = pDevice->GetDevFont( i ); @@ -387,7 +386,7 @@ FontList::~FontList() FontList* FontList::Clone() const { FontList* pReturn = new FontList( - mpDev, mpDev2, GetFontNameCount() == mpDev->GetDevFontCount()); + mpDev, mpDev2, sal::static_int_cast(GetFontNameCount()) == mpDev->GetDevFontCount()); return pReturn; } @@ -696,7 +695,7 @@ bool FontList::IsAvailable(const OUString& rName) const return (ImplFindByName( rName ) != nullptr); } -const FontMetric& FontList::GetFontName( sal_uInt16 nFont ) const +const FontMetric& FontList::GetFontName(size_t const nFont) const { DBG_ASSERT( nFont < GetFontNameCount(), "FontList::GetFontName(): nFont >= Count" ); @@ -752,11 +751,10 @@ const sal_IntPtr* FontList::GetSizeAry( const FontMetric& rInfo ) const MapMode aMap( MAP_10TH_INCH, Point(), Fraction( 1, 72 ), Fraction( 1, 72 ) ); pDevice->SetMapMode( aMap ); - sal_uInt16 i; - sal_uInt16 nRealCount = 0; + int nRealCount = 0; long nOldHeight = 0; const_cast(this)->mpSizeAry = new sal_IntPtr[nDevSizeCount+1]; - for ( i = 0; i < nDevSizeCount; i++ ) + for (int i = 0; i < nDevSizeCount; ++i) { Size aSize = pDevice->GetDevFontSize( rInfo, i ); if ( aSize.Height() != nOldHeight ) diff --git a/svtools/source/control/stdmenu.cxx b/svtools/source/control/stdmenu.cxx index 6e0e55e8f4a9..d2e972e2eec0 100644 --- a/svtools/source/control/stdmenu.cxx +++ b/svtools/source/control/stdmenu.cxx @@ -54,8 +54,8 @@ void FontNameMenu::Fill( const FontList* pList ) 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) + size_t nFontCount = ::std::min(pList->GetFontNameCount(), 100); + for (size_t i = 0; i < nFontCount; ++i) { const OUString& rName = pList->GetFontName( i ).GetFamilyName(); -- cgit