From 855bf4d68865ef046c8f527bf19e3ec78c7b033a Mon Sep 17 00:00:00 2001 From: Nalini Prasad Dash Date: Wed, 23 Nov 2022 17:09:55 +0530 Subject: [PATCH] tdf#114441 - Convert use of sal_uLong to better integer types The variable type of nHeight was changed as the return type of pFontHeightItem->GetHeight() is sal_uInt32.Also nBit was assigned the underlying datatype of LB(int) as it was checked against LB::LAST(Value converted to underlying datatype of LB) in the for loop . Change-Id: I657d545ac7af1786edd61569ba43b42e55d1f47b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143145 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- cui/source/tabpages/swpossizetabpage.cxx | 3 ++- forms/source/richtext/rtattributehandler.cxx | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cui/source/tabpages/swpossizetabpage.cxx b/cui/source/tabpages/swpossizetabpage.cxx index e8a1e4eb9df4..060f7b44ce9f 100644 --- a/cui/source/tabpages/swpossizetabpage.cxx +++ b/cui/source/tabpages/swpossizetabpage.cxx @@ -19,6 +19,7 @@ #include #include +#include #include #include #include @@ -1696,7 +1697,7 @@ void SvxSwPosSizeTabPage::FillRelLB(FrmMap const *pMap, sal_uInt16 nMapPos, sal_ nLBRelations = pMap[nMapPos].nLBRelations; } - for (sal_uLong nBit = 1; nBit < sal_uLong(LB::LAST); nBit <<= 1) + for (std::underlying_type_t nBit = 1; nBit < o3tl::to_underlying(LB::LAST) ; nBit <<= 1) { if (nLBRelations & static_cast(nBit)) { diff --git a/forms/source/richtext/rtattributehandler.cxx b/forms/source/richtext/rtattributehandler.cxx index 582b451a8423..b5cfb55b7820 100644 --- a/forms/source/richtext/rtattributehandler.cxx +++ b/forms/source/richtext/rtattributehandler.cxx @@ -320,7 +320,7 @@ namespace frm if ( pFontHeightItem ) { // by definition, the item should have the unit twip - sal_uLong nHeight = pFontHeightItem->GetHeight(); + sal_uInt32 nHeight = pFontHeightItem->GetHeight(); if ( _rAttribs.GetPool()->GetMetric( getWhich() ) != MapUnit::MapTwip ) { nHeight = OutputDevice::LogicToLogic( @@ -347,7 +347,7 @@ namespace frm if ( !pFontHeightItem ) return; - sal_uLong nHeight = pFontHeightItem->GetHeight(); + sal_uInt32 nHeight = pFontHeightItem->GetHeight(); if ( _rNewAttribs.GetPool()->GetMetric( getWhich() ) != MapUnit::MapTwip ) { nHeight = OutputDevice::LogicToLogic(