diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2018-01-12 20:27:56 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2018-01-12 20:27:56 +0100 |
commit | b088da2a7ab151710416f6d58a5cc6d6b908d546 (patch) | |
tree | d6f4430ea42e969a598351a78294545e5ab954aa /comphelper/qa | |
parent | f8558f844674c7ba541699708e95f509026c9407 (diff) |
More loplugin:cstylecast: comphelper
auto-rewrite with <https://gerrit.libreoffice.org/#/c/47798/> "Enable
loplugin:cstylecast for some more cases" plus
solenv/clang-format/reformat-formatted-files
Change-Id: I71a5092b344f206f2c7de606f2739d3b6e2cf0bb
Diffstat (limited to 'comphelper/qa')
-rw-r--r-- | comphelper/qa/container/comphelper_ifcontainer.cxx | 4 | ||||
-rw-r--r-- | comphelper/qa/string/test_string.cxx | 6 | ||||
-rw-r--r-- | comphelper/qa/unit/test_hash.cxx | 2 | ||||
-rw-r--r-- | comphelper/qa/unit/threadpooltest.cxx | 2 |
4 files changed, 7 insertions, 7 deletions
diff --git a/comphelper/qa/container/comphelper_ifcontainer.cxx b/comphelper/qa/container/comphelper_ifcontainer.cxx index 5a6cff89583d..caa54c55398f 100644 --- a/comphelper/qa/container/comphelper_ifcontainer.cxx +++ b/comphelper/qa/container/comphelper_ifcontainer.cxx @@ -112,8 +112,8 @@ namespace comphelper_ifcontainer std::vector< Reference< XInterface > > aElements = pContainer->getElements(); CPPUNIT_ASSERT_EQUAL_MESSAGE("query contents", - (int)aElements.size(), nTests); - if ((int)aElements.size() == nTests) + static_cast<int>(aElements.size()), nTests); + if (static_cast<int>(aElements.size()) == nTests) { for (i = 0; i < nTests; i++) { diff --git a/comphelper/qa/string/test_string.cxx b/comphelper/qa/string/test_string.cxx index 734828d047a6..32a3e7c45e2f 100644 --- a/comphelper/qa/string/test_string.cxx +++ b/comphelper/qa/string/test_string.cxx @@ -63,13 +63,13 @@ public: void TestString::testDecimalStringToNumber() { OUString s1("1234"); - CPPUNIT_ASSERT_EQUAL((sal_uInt32)1234, comphelper::string::decimalStringToNumber(s1)); + CPPUNIT_ASSERT_EQUAL(sal_uInt32(1234), comphelper::string::decimalStringToNumber(s1)); s1 += OUStringLiteral1(0x07C6); - CPPUNIT_ASSERT_EQUAL((sal_uInt32)12346, comphelper::string::decimalStringToNumber(s1)); + CPPUNIT_ASSERT_EQUAL(sal_uInt32(12346), comphelper::string::decimalStringToNumber(s1)); // Codepoints on 2 16bits words sal_uInt32 utf16String[] = { 0x1D7FE /* 8 */, 0x1D7F7 /* 1 */}; s1 = OUString(utf16String, 2); - CPPUNIT_ASSERT_EQUAL((sal_uInt32)81, comphelper::string::decimalStringToNumber(s1)); + CPPUNIT_ASSERT_EQUAL(sal_uInt32(81), comphelper::string::decimalStringToNumber(s1)); } void TestString::testIsdigitAsciiString() diff --git a/comphelper/qa/unit/test_hash.cxx b/comphelper/qa/unit/test_hash.cxx index 6ba1ac8225df..f83f91d3286a 100644 --- a/comphelper/qa/unit/test_hash.cxx +++ b/comphelper/qa/unit/test_hash.cxx @@ -38,7 +38,7 @@ std::string tostring(const std::vector<unsigned char>& a) std::stringstream aStrm; for (auto& i:a) { - aStrm << std::setw(2) << std::setfill('0') << std::hex << (int)i; + aStrm << std::setw(2) << std::setfill('0') << std::hex << static_cast<int>(i); } return aStrm.str(); diff --git a/comphelper/qa/unit/threadpooltest.cxx b/comphelper/qa/unit/threadpooltest.cxx index 8217abda4133..8148cce941e8 100644 --- a/comphelper/qa/unit/threadpooltest.cxx +++ b/comphelper/qa/unit/threadpooltest.cxx @@ -39,7 +39,7 @@ void ThreadPoolTest::testPreferredConcurrency() { setenv("MAX_CONCURRENCY", std::to_string(nThreads).c_str(), true); nThreads = comphelper::ThreadPool::getPreferredConcurrency(); CPPUNIT_ASSERT_MESSAGE("Expected no more than hardware threads", - nThreads <= (sal_Int32)std::thread::hardware_concurrency()); + nThreads <= static_cast<sal_Int32>(std::thread::hardware_concurrency())); // Revert and check. Again, nothing should change. unsetenv("MAX_CONCURRENCY"); |