From a93c71a97975c0b3f8fceae86fa2bd598a9eae59 Mon Sep 17 00:00:00 2001 From: "Caio B. Silva" Date: Mon, 23 Jul 2018 09:37:59 -0300 Subject: tdf#114441 Replacing sal_uLong with most appropriate integer types Change-Id: I4ba636e9b882c0c0958420037768fd596fdecef9 Reviewed-on: https://gerrit.libreoffice.org/57845 Tested-by: Jenkins Reviewed-by: Michael Stahl --- .../source/uielement/fontsizemenucontroller.cxx | 6 +++--- include/svtools/ctrltool.hxx | 14 +++++++------- svtools/source/control/ctrlbox.cxx | 10 +++++----- svtools/source/control/ctrltool.cxx | 20 ++++++++++---------- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/framework/source/uielement/fontsizemenucontroller.cxx b/framework/source/uielement/fontsizemenucontroller.cxx index 6dd31f3ea1ac..a2c7f049caac 100644 --- a/framework/source/uielement/fontsizemenucontroller.cxx +++ b/framework/source/uielement/fontsizemenucontroller.cxx @@ -175,11 +175,11 @@ void FontSizeMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu > co if ( pAry == FontList::GetStdSizeAry() ) { // for scalable fonts all font size names - sal_uLong nCount = aFontSizeNames.Count(); - for( sal_uLong i = 0; i < nCount; i++ ) + sal_Int32 nCount = aFontSizeNames.Count(); + for( sal_Int32 i = 0; i < nCount; i++ ) { OUString aSizeName = aFontSizeNames.GetIndexName( i ); - long nSize = aFontSizeNames.GetIndexSize( i ); + sal_Int32 nSize = aFontSizeNames.GetIndexSize( i ); m_pHeightArray[nPos] = nSize; nPos++; // Id is nPos+1 pVCLPopupMenu->InsertItem( nPos, aSizeName, MenuItemBits::RADIOCHECK | MenuItemBits::AUTOCHECK ); diff --git a/include/svtools/ctrltool.hxx b/include/svtools/ctrltool.hxx index da7be4b3c770..6d9a1e4f764b 100644 --- a/include/svtools/ctrltool.hxx +++ b/include/svtools/ctrltool.hxx @@ -150,7 +150,7 @@ private: VclPtr mpDev2; std::vector> m_Entries; - SVT_DLLPRIVATE ImplFontListNameInfo* ImplFind( const OUString& rSearchName, sal_uLong* pIndex ) const; + SVT_DLLPRIVATE ImplFontListNameInfo* ImplFind( const OUString& rSearchName, sal_uInt32* pIndex ) const; SVT_DLLPRIVATE ImplFontListNameInfo* ImplFindByName( const OUString& rStr ) const; SVT_DLLPRIVATE void ImplInsertFonts(OutputDevice* pDev, bool bInsertData); @@ -198,19 +198,19 @@ class SVT_DLLPUBLIC FontSizeNames { private: const struct ImplFSNameItem* mpArray; - sal_uLong mnElem; + sal_Int32 mnElem; public: FontSizeNames( LanguageType eLanguage /* = LANGUAGE_DONTKNOW */ ); - sal_uLong Count() const { return mnElem; } + sal_Int32 Count() const { return mnElem; } bool IsEmpty() const { return !mnElem; } - long Name2Size( const OUString& ) const; - OUString Size2Name( long ) const; + sal_Int32 Name2Size( const OUString& ) const; + OUString Size2Name( sal_Int32 ) const; - OUString GetIndexName( sal_uLong nIndex ) const; - long GetIndexSize( sal_uLong nIndex ) const; + OUString GetIndexName( sal_Int32 nIndex ) const; + sal_Int32 GetIndexSize( sal_Int32 nIndex ) const; }; #endif // INCLUDED_SVTOOLS_CTRLTOOL_HXX diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx index 6f1494d9c9d8..27b0dd71d304 100644 --- a/svtools/source/control/ctrlbox.cxx +++ b/svtools/source/control/ctrlbox.cxx @@ -747,10 +747,10 @@ void FontNameBox::Fill( const FontList* pList ) for ( sal_uInt16 i = 0; i < nFontCount; i++ ) { const FontMetric& rFontMetric = pList->GetFontName( i ); - sal_uLong nIndex = InsertEntry( rFontMetric.GetFamilyName() ); + sal_Int32 nIndex = InsertEntry( rFontMetric.GetFamilyName() ); if ( nIndex != LISTBOX_ERROR ) { - if ( nIndex < mpFontList->size() ) { + if ( nIndex < static_cast(mpFontList->size()) ) { ImplFontList::iterator it = mpFontList->begin(); ::std::advance( it, nIndex ); mpFontList->insert( it, rFontMetric ); @@ -1526,11 +1526,11 @@ void FontSizeBox::Fill( const FontMetric* pFontMetric, const FontList* pList ) if ( pAry == FontList::GetStdSizeAry() ) { // for scalable fonts all font size names - sal_uLong nCount = aFontSizeNames.Count(); - for( sal_uLong i = 0; i < nCount; i++ ) + sal_Int32 nCount = aFontSizeNames.Count(); + for( sal_Int32 i = 0; i < nCount; i++ ) { OUString aSizeName = aFontSizeNames.GetIndexName( i ); - sal_IntPtr nSize = aFontSizeNames.GetIndexSize( i ); + sal_Int32 nSize = aFontSizeNames.GetIndexSize( i ); ComboBox::InsertEntry( aSizeName, nPos ); ComboBox::SetEntryData( nPos, reinterpret_cast(-nSize) ); // mark as special nPos++; diff --git a/svtools/source/control/ctrltool.cxx b/svtools/source/control/ctrltool.cxx index 83e3897d9569..708f4ef8aa14 100644 --- a/svtools/source/control/ctrltool.cxx +++ b/svtools/source/control/ctrltool.cxx @@ -163,7 +163,7 @@ static OUString ImplMakeSearchStringFromName(const OUString& rStr) return ImplMakeSearchString(rStr.getToken( 0, ';' )); } -ImplFontListNameInfo* FontList::ImplFind(const OUString& rSearchName, sal_uLong* pIndex) const +ImplFontListNameInfo* FontList::ImplFind(const OUString& rSearchName, sal_uInt32* pIndex) const { // Append if there is no entry in the list or if the entry is larger // then the last one. We only compare to the last entry as the list of VCL @@ -172,7 +172,7 @@ ImplFontListNameInfo* FontList::ImplFind(const OUString& rSearchName, sal_uLong* if (m_Entries.empty()) { if ( pIndex ) - *pIndex = ULONG_MAX; + *pIndex = SAL_MAX_UINT32; return nullptr; } else @@ -182,7 +182,7 @@ ImplFontListNameInfo* FontList::ImplFind(const OUString& rSearchName, sal_uLong* if (nComp > 0) { if ( pIndex ) - *pIndex = ULONG_MAX; + *pIndex = SAL_MAX_UINT32; return nullptr; } else if (nComp == 0) @@ -261,7 +261,7 @@ void FontList::ImplInsertFonts(OutputDevice* pDevice, bool bInsertData) FontMetric aFontMetric = pDevice->GetDevFont( i ); OUString aSearchName(aFontMetric.GetFamilyName()); ImplFontListNameInfo* pData; - sal_uLong nIndex; + sal_uInt32 nIndex; aSearchName = ImplMakeSearchString(aSearchName); pData = ImplFind( aSearchName, &nIndex ); @@ -274,7 +274,7 @@ void FontList::ImplInsertFonts(OutputDevice* pDevice, bool bInsertData) pData->mpFirst = pNewInfo; pNewInfo->mpNext = nullptr; - if (nIndex < m_Entries.size()) + if (nIndex < static_cast(m_Entries.size())) m_Entries.insert(m_Entries.begin()+nIndex, std::unique_ptr(pData)); else @@ -784,7 +784,7 @@ const sal_IntPtr* FontList::GetSizeAry( const FontMetric& rInfo ) const struct ImplFSNameItem { - long mnSize; + sal_Int32 mnSize; const char* mszUtf8Name; }; @@ -828,7 +828,7 @@ FontSizeNames::FontSizeNames( LanguageType eLanguage ) } } -long FontSizeNames::Name2Size( const OUString& rName ) const +sal_Int32 FontSizeNames::Name2Size( const OUString& rName ) const { if ( mnElem ) { @@ -844,7 +844,7 @@ long FontSizeNames::Name2Size( const OUString& rName ) const return 0; } -OUString FontSizeNames::Size2Name( long nValue ) const +OUString FontSizeNames::Size2Name( sal_Int32 nValue ) const { OUString aStr; @@ -866,7 +866,7 @@ OUString FontSizeNames::Size2Name( long nValue ) const return aStr; } -OUString FontSizeNames::GetIndexName( sal_uLong nIndex ) const +OUString FontSizeNames::GetIndexName( sal_Int32 nIndex ) const { OUString aStr; @@ -876,7 +876,7 @@ OUString FontSizeNames::GetIndexName( sal_uLong nIndex ) const return aStr; } -long FontSizeNames::GetIndexSize( sal_uLong nIndex ) const +sal_Int32 FontSizeNames::GetIndexSize( sal_Int32 nIndex ) const { if ( nIndex >= mnElem ) return 0; -- cgit