summaryrefslogtreecommitdiff
path: root/sw/qa/extras/rtfexport
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2021-05-21 17:44:32 +0200
committerMiklos Vajna <vmiklos@collabora.com>2021-05-21 21:09:57 +0200
commit2634bc59092b24217d984a5845365d703bdb08d2 (patch)
treea3b7324d54aefb57d5f012c7aeb1b80d07fce75b /sw/qa/extras/rtfexport
parentc912c4b02b2dc4cd5aa62d77e92e1731c6cbde65 (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/qa/extras/rtfexport')
-rw-r--r--sw/qa/extras/rtfexport/rtfexport.cxx4
-rw-r--r--sw/qa/extras/rtfexport/rtfexport3.cxx2
2 files changed, 3 insertions, 3 deletions
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx
index 049c78bd7f6b..75c4382324e5 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -1135,8 +1135,8 @@ DECLARE_RTFEXPORT_TEST(testCustomDocProps, "custom-doc-props.rtf")
// Test roundtrip of date in general, and year/month/day in particular.
util::DateTime aDate = getProperty<util::DateTime>(xUserDefinedProperties, "d");
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(2016), aDate.Year);
- CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(1), aDate.Month);
- CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(30), aDate.Day);
+ CPPUNIT_ASSERT_EQUAL(o3tl::narrowing<sal_uInt16>(1), aDate.Month);
+ CPPUNIT_ASSERT_EQUAL(o3tl::narrowing<sal_uInt16>(30), aDate.Day);
// Test real number.
CPPUNIT_ASSERT_EQUAL(3.14, getProperty<double>(xUserDefinedProperties, "pi"));
diff --git a/sw/qa/extras/rtfexport/rtfexport3.cxx b/sw/qa/extras/rtfexport/rtfexport3.cxx
index 4468a97650b5..efbb7c806477 100644
--- a/sw/qa/extras/rtfexport/rtfexport3.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport3.cxx
@@ -187,7 +187,7 @@ DECLARE_ODFEXPORT_TEST(testArabicZeroNumbering, "arabic-zero-numbering.rtf")
// - Expected: 64
// - Actual : 4
// i.e. numbering type was ARABIC, not ARABIC_ZERO.
- CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(style::NumberingType::ARABIC_ZERO),
+ CPPUNIT_ASSERT_EQUAL(o3tl::narrowing<sal_uInt16>(style::NumberingType::ARABIC_ZERO),
aMap["NumberingType"].get<sal_uInt16>());
}