diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-10-13 08:47:47 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-10-14 08:26:14 +0200 |
commit | 9b5dad13b56bdde7c40970351af3da3a2c3c9350 (patch) | |
tree | abfd4b02743a0e6a93c51c026f4c53f0e21100bc /svl | |
parent | fa71320329999c968feb16ff65be328b5b8ff5e4 (diff) |
loplugin:stringadd look for unnecessary temporaries
which defeat the *StringConcat optimisation.
Also make StringConcat conversions treat a nullptr as an empty string,
to match the O*String(char*) constructors.
Change-Id: If45f5b4b6a535c97bfeeacd9ec472a7603a52e5b
Reviewed-on: https://gerrit.libreoffice.org/80724
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svl')
-rw-r--r-- | svl/qa/unit/svl.cxx | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/svl/qa/unit/svl.cxx b/svl/qa/unit/svl.cxx index 04394af2090b..d61daae8dd30 100644 --- a/svl/qa/unit/svl.cxx +++ b/svl/qa/unit/svl.cxx @@ -1081,8 +1081,8 @@ void Test::checkDateInput( SvNumberFormatter& rFormatter, const char* pTimezone, sal_uInt32 nIndex = 0; double fVal = 0.0; bool bVal = rFormatter.IsNumberFormat( aDate, nIndex, fVal); - CPPUNIT_ASSERT_MESSAGE( OString("Date not recognized: " + - OString(pTimezone) + " " + OString(pIsoDate)).getStr(), bVal); + CPPUNIT_ASSERT_MESSAGE( OString(OStringLiteral("Date not recognized: ") + + pTimezone + " " + pIsoDate).getStr(), bVal); CPPUNIT_ASSERT_MESSAGE("Format parsed is not date.", (rFormatter.GetType(nIndex) & SvNumFormatType::DATE)); OUString aOutString; @@ -1152,7 +1152,7 @@ void checkSpecificNumberFormats( SvNumberFormatter& rFormatter, double fNumber = 0; OUString aString( OUString::fromUtf8( rVec[i].mpInput)); const bool bIsNumber = rFormatter.IsNumberFormat( aString, nIndex, fNumber); - CPPUNIT_ASSERT_EQUAL_MESSAGE( OString( OString(pName) + " " + OString::number(i) + + CPPUNIT_ASSERT_EQUAL_MESSAGE( OString( pName + OStringLiteral(" ") + OString::number(i) + (rVec[i].mbNumber ? " not recognized: " : " should not be recognized: ") + OUStringToOString( aString, RTL_TEXTENCODING_UTF8)).getStr(), rVec[i].mbNumber, bIsNumber); if (bIsNumber) @@ -1161,7 +1161,7 @@ void checkSpecificNumberFormats( SvNumberFormatter& rFormatter, nIndex = rVec[i].mnOutputIndex; Color* pColor; rFormatter.GetOutputString( fNumber, nIndex, aString, &pColor); - CPPUNIT_ASSERT_EQUAL_MESSAGE( OString( OString(pName) + " " + OString::number(i) + " mismatch").getStr(), + CPPUNIT_ASSERT_EQUAL_MESSAGE( OString( pName + OStringLiteral(" ") + OString::number(i) + " mismatch").getStr(), OUString::fromUtf8( rVec[i].mpOutput), aString); } } |