cui/source/tabpages/labdlg.cxx | 5 +++-- cui/source/tabpages/numpages.cxx | 3 ++- cui/source/tabpages/tpbitmap.cxx | 9 +++++---- cui/source/tabpages/tpline.cxx | 5 +++-- cui/source/tabpages/tptrans.cxx | 5 +++-- sd/source/ui/dlg/BulletAndPositionDlg.cxx | 3 ++- sd/source/ui/dlg/dlgsnap.cxx | 5 +++-- svx/source/sidebar/shadow/ShadowPropertyPanel.cxx | 5 +++-- sw/source/ui/table/tabledlg.cxx | 3 ++- 9 files changed, 26 insertions(+), 17 deletions(-)
New commits: commit d5937c56f54d2089e172ac7e56d9895100c18527 Author: Caolán McNamara <[email protected]> AuthorDate: Sat Oct 25 14:46:43 2025 +0100 Commit: Caolán McNamara <[email protected]> CommitDate: Sun Oct 26 22:30:21 2025 +0100 cid#1667048 silence Overflowed constant and cid#1667049 Overflowed constant cid#1667052 Overflowed constant cid#1667058 Overflowed constant cid#1667060 Overflowed constant cid#1667061 Overflowed constant cid#1667066 Overflowed constant cid#1667067 Overflowed constant cid#1667072 Overflowed constant cid#1667081 Overflowed constant cid#1667090 Overflowed constant cid#1667100 Overflowed constant cid#1667103 Overflowed constant Change-Id: I9d43fabfe0047c64f3cd6c10e50571fa21b2c8dc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192973 Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Jenkins diff --git a/cui/source/tabpages/labdlg.cxx b/cui/source/tabpages/labdlg.cxx index 0c851972a099..9ab89ed68a40 100644 --- a/cui/source/tabpages/labdlg.cxx +++ b/cui/source/tabpages/labdlg.cxx @@ -18,6 +18,7 @@ */ #include <swpossizetabpage.hxx> +#include <o3tl/untaint.hxx> #include <svtools/unitconv.hxx> #include <svx/svddef.hxx> @@ -248,14 +249,14 @@ void SvxCaptionTabPage::Reset( const SfxItemSet* ) eUnit = pPool->GetMetric( nWhich ); nLineLen = static_cast<const SdrCaptionLineLenItem&>( rOutAttrs.Get( nWhich ) ).GetValue(); SetMetricValue( *m_xMF_LENGTH, nLineLen, eUnit ); - nLineLen = m_xMF_LENGTH->get_value(FieldUnit::NONE); + nLineLen = o3tl::sanitizing_cast<sal_Int32>(m_xMF_LENGTH->get_value(FieldUnit::NONE)); //------- distance to box ---------- nWhich = GetWhich( SDRATTR_CAPTIONGAP ); eUnit = pPool->GetMetric( nWhich ); nGap = static_cast<const SdrCaptionGapItem&>( rOutAttrs.Get( nWhich ) ).GetValue(); SetMetricValue( *m_xMF_SPACING, nGap, eUnit ); - nGap = m_xMF_SPACING->get_value(FieldUnit::NONE); + nGap = o3tl::sanitizing_cast<sal_Int32>(m_xMF_SPACING->get_value(FieldUnit::NONE)); nCaptionType = rOutAttrs.Get( GetWhich( SDRATTR_CAPTIONTYPE ) ).GetValue(); bFitLineLen = static_cast<const SfxBoolItem&>( rOutAttrs.Get( GetWhich( SDRATTR_CAPTIONFITLINELEN ) ) ).GetValue(); diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx index 2624c7abd417..6383a96b8f27 100644 --- a/cui/source/tabpages/numpages.cxx +++ b/cui/source/tabpages/numpages.cxx @@ -21,6 +21,7 @@ #include <numpages.hxx> #include <dialmgr.hxx> +#include <o3tl/untaint.hxx> #include <tools/mapunit.hxx> #include <i18nlangtag/languagetag.hxx> #include <editeng/numitem.hxx> @@ -1945,7 +1946,7 @@ IMPL_LINK(SvxNumOptionsTabPage, BulColorHdl_Impl, ColorListBox&, rColorBox, void IMPL_LINK(SvxNumOptionsTabPage, BulRelSizeHdl_Impl, weld::MetricSpinButton&, rField, void) { - sal_uInt16 nRelSize = rField.get_value(FieldUnit::PERCENT); + sal_uInt16 nRelSize = o3tl::sanitizing_cast<sal_uInt16>(rField.get_value(FieldUnit::PERCENT)); sal_uInt16 nMask = 1; for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++) diff --git a/cui/source/tabpages/tpbitmap.cxx b/cui/source/tabpages/tpbitmap.cxx index 16d716554b5b..7f5d869bd7cf 100644 --- a/cui/source/tabpages/tpbitmap.cxx +++ b/cui/source/tabpages/tpbitmap.cxx @@ -19,6 +19,7 @@ #include <memory> #include <stdlib.h> +#include <o3tl/untaint.hxx> #include <tools/urlobj.hxx> #include <svx/drawitem.hxx> #include <svx/xbtmpit.hxx> @@ -702,8 +703,8 @@ IMPL_LINK_NOARG( SvxBitmapTabPage, ModifyBitmapStyleHdl, weld::ComboBox&, void ) { if (m_xTsbScale->get_sensitive() && m_xTsbScale->get_state() == TRISTATE_TRUE) { - aSetBitmapSize.setWidth(-m_xBitmapWidth->get_value(FieldUnit::NONE)); - aSetBitmapSize.setHeight(-m_xBitmapHeight->get_value(FieldUnit::NONE)); + aSetBitmapSize.setWidth(o3tl::saturating_toggle_sign(m_xBitmapWidth->get_value(FieldUnit::NONE))); + aSetBitmapSize.setHeight(o3tl::saturating_toggle_sign(m_xBitmapHeight->get_value(FieldUnit::NONE))); } else { @@ -751,10 +752,10 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ModifyTileOffsetHdl, weld::MetricSpinButton&, sal_uInt16 nTileYOff = 0; if(m_xTileOffLB->get_active() == static_cast<sal_Int32>(ROW)) - nTileXOff = m_xTileOffset->get_value(FieldUnit::PERCENT); + nTileXOff = o3tl::sanitizing_cast<sal_uInt16>(m_xTileOffset->get_value(FieldUnit::PERCENT)); if(m_xTileOffLB->get_active() == static_cast<sal_Int32>(COLUMN)) - nTileYOff = m_xTileOffset->get_value(FieldUnit::PERCENT); + nTileYOff = o3tl::sanitizing_cast<sal_uInt16>(m_xTileOffset->get_value(FieldUnit::PERCENT)); m_rXFSet.Put( XFillBmpTileOffsetXItem(nTileXOff) ); m_rXFSet.Put( XFillBmpTileOffsetYItem(nTileYOff) ); diff --git a/cui/source/tabpages/tpline.cxx b/cui/source/tabpages/tpline.cxx index 81a4a713887f..469bf31ae479 100644 --- a/cui/source/tabpages/tpline.cxx +++ b/cui/source/tabpages/tpline.cxx @@ -19,6 +19,7 @@ #include <memory> #include <editeng/sizeitem.hxx> +#include <o3tl/untaint.hxx> #include <osl/file.hxx> #include <tools/urlobj.hxx> @@ -777,7 +778,7 @@ void SvxLineTabPage::FillXLSet_Impl() m_rXLSet.Put( XLineEndCenterItem( false ) ); // Transparency - sal_uInt16 nVal = m_xMtrTransparent->get_value(FieldUnit::PERCENT); + sal_uInt16 nVal = o3tl::sanitizing_cast<sal_uInt16>(m_xMtrTransparent->get_value(FieldUnit::PERCENT)); m_rXLSet.Put( XLineTransparenceItem( nVal ) ); m_aCtlPreview.SetLineAttributes(m_aXLineAttr.GetItemSet()); @@ -1359,7 +1360,7 @@ IMPL_LINK_NOARG(SvxLineTabPage, ChangeEndModifyHdl_Impl, weld::MetricSpinButton& IMPL_LINK_NOARG(SvxLineTabPage, ChangeTransparentHdl_Impl, weld::MetricSpinButton&, void) { - sal_uInt16 nVal = m_xMtrTransparent->get_value(FieldUnit::PERCENT); + sal_uInt16 nVal = o3tl::sanitizing_cast<sal_uInt16>(m_xMtrTransparent->get_value(FieldUnit::PERCENT)); m_rXLSet.Put(XLineTransparenceItem(nVal)); diff --git a/cui/source/tabpages/tptrans.cxx b/cui/source/tabpages/tptrans.cxx index 842af80df238..c52d6a6e6754 100644 --- a/cui/source/tabpages/tptrans.cxx +++ b/cui/source/tabpages/tptrans.cxx @@ -28,6 +28,7 @@ #include <svx/xflbckit.hxx> #include <svx/sdshtitm.hxx> #include <svx/xfltrit.hxx> +#include <o3tl/untaint.hxx> #include <cuitabarea.hxx> #include <svl/intitem.hxx> @@ -93,7 +94,7 @@ void SvxTransparenceTabPage::ActivateLinear(bool bActivate) IMPL_LINK_NOARG(SvxTransparenceTabPage, ModifyTransparentHdl_Impl, weld::MetricSpinButton&, void) { - sal_uInt16 nPos = m_xMtrTransparent->get_value(FieldUnit::PERCENT); + sal_uInt16 nPos = o3tl::sanitizing_cast<sal_uInt16>(m_xMtrTransparent->get_value(FieldUnit::PERCENT)); rXFSet.Put(XFillTransparenceItem(nPos)); // preview @@ -260,7 +261,7 @@ bool SvxTransparenceTabPage::FillItemSet(SfxItemSet* rAttrs) if (m_xMtrTransparent->get_sensitive()) { // linear transparence - sal_uInt16 nPos = m_xMtrTransparent->get_value(FieldUnit::PERCENT); + sal_uInt16 nPos = o3tl::sanitizing_cast<sal_uInt16>(m_xMtrTransparent->get_value(FieldUnit::PERCENT)); if (m_xMtrTransparent->get_value_changed_from_saved() || !bLinearActive) { XFillTransparenceItem aItem(nPos); diff --git a/sd/source/ui/dlg/BulletAndPositionDlg.cxx b/sd/source/ui/dlg/BulletAndPositionDlg.cxx index 921d33d1f869..b6715e34a438 100644 --- a/sd/source/ui/dlg/BulletAndPositionDlg.cxx +++ b/sd/source/ui/dlg/BulletAndPositionDlg.cxx @@ -17,6 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <o3tl/untaint.hxx> #include <tools/mapunit.hxx> #include <tools/urlobj.hxx> #include <editeng/numitem.hxx> @@ -793,7 +794,7 @@ IMPL_LINK(SvxBulletAndPositionDlg, BulColorHdl_Impl, ColorListBox&, rColorBox, v IMPL_LINK(SvxBulletAndPositionDlg, BulRelSizeHdl_Impl, weld::MetricSpinButton&, rField, void) { - sal_uInt16 nRelSize = rField.get_value(FieldUnit::PERCENT); + sal_uInt16 nRelSize = o3tl::sanitizing_cast<sal_uInt16>(rField.get_value(FieldUnit::PERCENT)); sal_uInt16 nMask = 1; for (sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++) diff --git a/sd/source/ui/dlg/dlgsnap.cxx b/sd/source/ui/dlg/dlgsnap.cxx index ee147dc465a5..3fcefda1552f 100644 --- a/sd/source/ui/dlg/dlgsnap.cxx +++ b/sd/source/ui/dlg/dlgsnap.cxx @@ -17,6 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <o3tl/untaint.hxx> #include <svx/svxids.hrc> #include <svx/svdpagv.hxx> #include <svl/intitem.hxx> @@ -161,7 +162,7 @@ void SdSnapLineDlg::SetInputFields(bool bEnableX, bool bEnableY) } else if (m_xMtrFldX->get_sensitive()) { - nXValue = m_xMtrFldX->get_value(FieldUnit::NONE); + nXValue = o3tl::sanitizing_cast<int>(m_xMtrFldX->get_value(FieldUnit::NONE)); m_xMtrFldX->set_text(OUString()); m_xMtrFldX->set_sensitive(false); m_xFtX->set_sensitive(false); @@ -175,7 +176,7 @@ void SdSnapLineDlg::SetInputFields(bool bEnableX, bool bEnableY) } else if (m_xMtrFldY->get_sensitive()) { - nYValue = m_xMtrFldY->get_value(FieldUnit::NONE); + nYValue = o3tl::sanitizing_cast<int>(m_xMtrFldY->get_value(FieldUnit::NONE)); m_xMtrFldY->set_text(OUString()); m_xMtrFldY->set_sensitive(false); m_xFtY->set_sensitive(false); diff --git a/svx/source/sidebar/shadow/ShadowPropertyPanel.cxx b/svx/source/sidebar/shadow/ShadowPropertyPanel.cxx index d106133a9dd8..b7dd3193404b 100644 --- a/svx/source/sidebar/shadow/ShadowPropertyPanel.cxx +++ b/svx/source/sidebar/shadow/ShadowPropertyPanel.cxx @@ -8,6 +8,7 @@ */ #include "ShadowPropertyPanel.hxx" +#include <o3tl/untaint.hxx> #include <vcl/settings.hxx> #include <vcl/svapp.hxx> #include <svx/colorbox.hxx> @@ -137,7 +138,7 @@ IMPL_LINK_NOARG(ShadowPropertyPanel, ModifyShadowColorHdl, ColorListBox&, void) IMPL_LINK_NOARG(ShadowPropertyPanel, ModifyShadowTransMetricHdl, weld::MetricSpinButton&, void) { - sal_uInt16 nVal = mxShadowTransMetric->get_value(FieldUnit::PERCENT); + sal_uInt16 nVal = o3tl::sanitizing_cast<sal_uInt16>(mxShadowTransMetric->get_value(FieldUnit::PERCENT)); SetTransparencyValue(nVal); SdrPercentItem aItem( makeSdrShadowTransparenceItem(nVal) ); GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_SHADOW_TRANSPARENCE, @@ -177,7 +178,7 @@ void ShadowPropertyPanel::ModifyShadowDistance() switch (nAngle) { case 0: nX = nXY; nY = 0; break; - case 45: nX = nXY; nY = -nXY; break; + case 45: nX = nXY; nY = o3tl::saturating_toggle_sign(nXY); break; case 90: nX = 0; nY = - nXY; break; case 135: nX = nY = -nXY; break; case 180: nX = -nXY; nY = 0; break; diff --git a/sw/source/ui/table/tabledlg.cxx b/sw/source/ui/table/tabledlg.cxx index 27556a2dfe96..5363a25126d0 100644 --- a/sw/source/ui/table/tabledlg.cxx +++ b/sw/source/ui/table/tabledlg.cxx @@ -18,6 +18,7 @@ */ #include <hintids.hxx> +#include <o3tl/untaint.hxx> #include <vcl/svapp.hxx> #include <vcl/weld.hxx> #include <svl/stritem.hxx> @@ -646,7 +647,7 @@ DeactivateRC SwFormatTablePage::DeactivatePage( SfxItemSet* _pSet ) if (m_xRelWidthCB->get_active() && m_xRelWidthCB->get_sensitive()) { lWidth = m_pTableData->GetSpace() - lRight - lLeft; - const sal_uInt16 nPercentWidth = m_xWidthMF->get_value(FieldUnit::PERCENT); + const sal_uInt16 nPercentWidth = o3tl::sanitizing_cast<sal_uInt16>(m_xWidthMF->get_value(FieldUnit::PERCENT)); if(m_pTableData->GetWidthPercent() != nPercentWidth) { m_pTableData->SetWidthPercent(nPercentWidth);
