diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2021-05-21 17:44:32 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2021-05-21 21:09:57 +0200 |
commit | 2634bc59092b24217d984a5845365d703bdb08d2 (patch) | |
tree | a3b7324d54aefb57d5f012c7aeb1b80d07fce75b /sw/source/ui/misc/outline.cxx | |
parent | c912c4b02b2dc4cd5aa62d77e92e1731c6cbde65 (diff) |
sw: replace most static_cast<sal_uInt16>() calls with o3tl::narrowing()
o3tl::narrowing() is a better way to handle this, as that way the
integer conversion is still implicit, which allows detecting integer
truncation at runtime (with suitable compiler flags).
Change-Id: I499abda3be6943e8c111c56df390e72939586221
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115948
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'sw/source/ui/misc/outline.cxx')
-rw-r--r-- | sw/source/ui/misc/outline.cxx | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sw/source/ui/misc/outline.cxx b/sw/source/ui/misc/outline.cxx index 8c03aef47a4e..f01b6386901e 100644 --- a/sw/source/ui/misc/outline.cxx +++ b/sw/source/ui/misc/outline.cxx @@ -92,7 +92,7 @@ void SwNumNamesDlg::SetUserNames(const OUString *pList[]) nSelect++; } } - m_xFormBox->select(std::min(nSelect, static_cast<sal_uInt16>(m_xFormBox->n_children() - 1))); + m_xFormBox->select(std::min(nSelect, o3tl::narrowing<sal_uInt16>(m_xFormBox->n_children() - 1))); SelectHdl(*m_xFormBox); } @@ -666,7 +666,7 @@ IMPL_LINK( SwOutlineSettingsTabPage, StartModified, weld::SpinButton&, rEdit, vo if(nActLevel & nMask) { SwNumFormat aNumFormat(pNumRule->Get(i)); - aNumFormat.SetStart(static_cast<sal_uInt16>(rEdit.get_value())); + aNumFormat.SetStart(o3tl::narrowing<sal_uInt16>(rEdit.get_value())); pNumRule->Set(i, aNumFormat); } nMask <<= 1; @@ -767,7 +767,7 @@ void SwOutlineSettingsTabPage::SetWrtShell(SwWrtShell* pShell) int nTmp = 0; if(nOutlinePos != SwOutlineNodes::npos) { - nTmp = static_cast<sal_uInt16>(pSh->getIDocumentOutlineNodesAccess()->getOutlineLevel(nOutlinePos)); + nTmp = o3tl::narrowing<sal_uInt16>(pSh->getIDocumentOutlineNodesAccess()->getOutlineLevel(nOutlinePos)); } m_xLevelLB->select(nTmp-1); |