summaryrefslogtreecommitdiff
path: root/comphelper
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2020-06-02 18:47:06 +0200
committerStephan Bergmann <sbergman@redhat.com>2020-06-03 09:18:55 +0200
commit8a9f358538e4321c64923706afeb4c594debc3eb (patch)
tree8672b452bec988566b02c52466831bed17521ce8 /comphelper
parent4209a4781071e778224c78fda498d09b3580448d (diff)
Upcoming loplugin:elidestringvar: comphelper
Change-Id: Id388af90ca2c3dff435a1a6261e3de0c3c0dbdbd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95376 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'comphelper')
-rw-r--r--comphelper/qa/string/test_string.cxx3
-rw-r--r--comphelper/qa/unit/syntaxhighlighttest.cxx15
-rw-r--r--comphelper/qa/unit/test_hash.cxx10
-rw-r--r--comphelper/qa/unit/variadictemplates.cxx6
-rw-r--r--comphelper/source/misc/backupfilehelper.cxx9
-rw-r--r--comphelper/source/xml/ofopxmlhelper.cxx3
6 files changed, 15 insertions, 31 deletions
diff --git a/comphelper/qa/string/test_string.cxx b/comphelper/qa/string/test_string.cxx
index 14bc3f7cebd3..abccec85691c 100644
--- a/comphelper/qa/string/test_string.cxx
+++ b/comphelper/qa/string/test_string.cxx
@@ -378,8 +378,7 @@ void TestString::testReverseString()
void TestString::testSplit()
{
- OUString aIn("CTRL+ALT+F1");
- std::vector<OUString> aRet = ::comphelper::string::split(aIn, '+');
+ std::vector<OUString> aRet = ::comphelper::string::split("CTRL+ALT+F1", '+');
CPPUNIT_ASSERT_EQUAL(size_t(3), aRet.size());
CPPUNIT_ASSERT_EQUAL(OUString("CTRL"), aRet[0]);
CPPUNIT_ASSERT_EQUAL(OUString("ALT"), aRet[1]);
diff --git a/comphelper/qa/unit/syntaxhighlighttest.cxx b/comphelper/qa/unit/syntaxhighlighttest.cxx
index 8a5b66ed2d08..c28941339085 100644
--- a/comphelper/qa/unit/syntaxhighlighttest.cxx
+++ b/comphelper/qa/unit/syntaxhighlighttest.cxx
@@ -37,9 +37,8 @@ public:
};
void SyntaxHighlightTest::testBasicString() {
- OUString s("\"foo\"");
std::vector<HighlightPortion> ps;
- SyntaxHighlighter(HighlighterLanguage::Basic).getHighlightPortions(s, ps);
+ SyntaxHighlighter(HighlighterLanguage::Basic).getHighlightPortions("\"foo\"", ps);
CPPUNIT_ASSERT_EQUAL(
static_cast<std::vector<HighlightPortion>::size_type>(1), ps.size());
CPPUNIT_ASSERT_EQUAL(sal_Int32(0), ps[0].nBegin);
@@ -48,9 +47,8 @@ void SyntaxHighlightTest::testBasicString() {
}
void SyntaxHighlightTest::testBasicComment() {
- OUString s("' foo");
std::vector<HighlightPortion> ps;
- SyntaxHighlighter(HighlighterLanguage::Basic).getHighlightPortions(s, ps);
+ SyntaxHighlighter(HighlighterLanguage::Basic).getHighlightPortions("' foo", ps);
CPPUNIT_ASSERT_EQUAL(
static_cast<std::vector<HighlightPortion>::size_type>(1), ps.size());
CPPUNIT_ASSERT_EQUAL(sal_Int32(0), ps[0].nBegin);
@@ -59,9 +57,8 @@ void SyntaxHighlightTest::testBasicComment() {
}
void SyntaxHighlightTest::testBasicCommentNewline() {
- OUString s("' foo\n");
std::vector<HighlightPortion> ps;
- SyntaxHighlighter(HighlighterLanguage::Basic).getHighlightPortions(s, ps);
+ SyntaxHighlighter(HighlighterLanguage::Basic).getHighlightPortions("' foo\n", ps);
CPPUNIT_ASSERT_EQUAL(
static_cast<std::vector<HighlightPortion>::size_type>(2), ps.size());
CPPUNIT_ASSERT_EQUAL(sal_Int32(0), ps[0].nBegin);
@@ -73,9 +70,8 @@ void SyntaxHighlightTest::testBasicCommentNewline() {
}
void SyntaxHighlightTest::testBasicEmptyComment() {
- OUString s("'");
std::vector<HighlightPortion> ps;
- SyntaxHighlighter(HighlighterLanguage::Basic).getHighlightPortions(s, ps);
+ SyntaxHighlighter(HighlighterLanguage::Basic).getHighlightPortions("'", ps);
CPPUNIT_ASSERT_EQUAL(
static_cast<std::vector<HighlightPortion>::size_type>(1), ps.size());
CPPUNIT_ASSERT_EQUAL(sal_Int32(0), ps[0].nBegin);
@@ -84,9 +80,8 @@ void SyntaxHighlightTest::testBasicEmptyComment() {
}
void SyntaxHighlightTest::testBasicEmptyCommentNewline() {
- OUString s("'\n");
std::vector<HighlightPortion> ps;
- SyntaxHighlighter(HighlighterLanguage::Basic).getHighlightPortions(s, ps);
+ SyntaxHighlighter(HighlighterLanguage::Basic).getHighlightPortions("'\n", ps);
CPPUNIT_ASSERT_EQUAL(
static_cast<std::vector<HighlightPortion>::size_type>(2), ps.size());
CPPUNIT_ASSERT_EQUAL(sal_Int32(0), ps[0].nBegin);
diff --git a/comphelper/qa/unit/test_hash.cxx b/comphelper/qa/unit/test_hash.cxx
index 99ce5bfd1751..8b6e5a393d23 100644
--- a/comphelper/qa/unit/test_hash.cxx
+++ b/comphelper/qa/unit/test_hash.cxx
@@ -120,13 +120,9 @@ void TestHash::testSHA512_NoSaltNoSpin()
// tdf#104250 https://bugs.documentfoundation.org/attachment.cgi?id=129104
void TestHash::testSHA512_saltspin()
{
- const OUString aPass("pwd");
- const OUString aAlgo("SHA-512");
- const OUString aSalt("876MLoKTq42+/DLp415iZQ==");
- const OUString aHash = comphelper::DocPasswordHelper::GetOoxHashAsBase64( aPass, aSalt, 100000,
- comphelper::Hash::IterCount::APPEND, aAlgo);
- const OUString aStr("5l3mgNHXpWiFaBPv5Yso1Xd/UifWvQWmlDnl/hsCYbFT2sJCzorjRmBCQ/3qeDu6Q/4+GIE8a1DsdaTwYh1q2g==");
- CPPUNIT_ASSERT_EQUAL(aStr, aHash);
+ const OUString aHash = comphelper::DocPasswordHelper::GetOoxHashAsBase64( "pwd", "876MLoKTq42+/DLp415iZQ==", 100000,
+ comphelper::Hash::IterCount::APPEND, "SHA-512");
+ CPPUNIT_ASSERT_EQUAL(OUString("5l3mgNHXpWiFaBPv5Yso1Xd/UifWvQWmlDnl/hsCYbFT2sJCzorjRmBCQ/3qeDu6Q/4+GIE8a1DsdaTwYh1q2g=="), aHash);
}
CPPUNIT_TEST_SUITE_REGISTRATION(TestHash);
diff --git a/comphelper/qa/unit/variadictemplates.cxx b/comphelper/qa/unit/variadictemplates.cxx
index c894cf1a7bb6..e729d76b24ed 100644
--- a/comphelper/qa/unit/variadictemplates.cxx
+++ b/comphelper/qa/unit/variadictemplates.cxx
@@ -90,8 +90,6 @@ void VariadicTemplatesTest::testUnwrapArgs() {
OUString tmp1 = "Test1";
sal_Int32 tmp2 = 42;
sal_uInt32 tmp3 = 42;
- OUString tmp4 = "Test2";
- OUString tmp5 = "Test3";
::com::sun::star::uno::Any tmp6(
::com::sun::star::uno::makeAny( tmp1 )
);
@@ -102,10 +100,10 @@ void VariadicTemplatesTest::testUnwrapArgs() {
::com::sun::star::uno::makeAny( tmp3 )
);
::com::sun::star::uno::Any tmp9(
- ::com::sun::star::uno::makeAny( tmp4 )
+ ::com::sun::star::uno::makeAny( OUString("Test2") )
);
::std::optional< ::com::sun::star::uno::Any > tmp10(
- ::com::sun::star::uno::makeAny( tmp5 )
+ ::com::sun::star::uno::makeAny( OUString("Test3") )
);
::std::optional< ::com::sun::star::uno::Any > tmp11(
::com::sun::star::uno::makeAny( tmp1 )
diff --git a/comphelper/source/misc/backupfilehelper.cxx b/comphelper/source/misc/backupfilehelper.cxx
index 4476e7f17717..6e21a27611c0 100644
--- a/comphelper/source/misc/backupfilehelper.cxx
+++ b/comphelper/source/misc/backupfilehelper.cxx
@@ -666,11 +666,10 @@ namespace
// first appearance to check
{
const OUString aUnoPackagReg(rUserConfigWorkURL + aRegPathFront + "bundle" + aRegPathBack);
- const OUString aTagToSearch("extension");
visitNodesXMLChangeOneCase(
aUnoPackagReg,
- aTagToSearch,
+ "extension",
rToBeEnabled,
rToBeDisabled);
}
@@ -678,11 +677,10 @@ namespace
// second appearance to check
{
const OUString aUnoPackagReg(rUserConfigWorkURL + aRegPathFront + "configuration" + aRegPathBack);
- const OUString aTagToSearch("configuration");
visitNodesXMLChangeOneCase(
aUnoPackagReg,
- aTagToSearch,
+ "configuration",
rToBeEnabled,
rToBeDisabled);
}
@@ -690,11 +688,10 @@ namespace
// third appearance to check
{
const OUString aUnoPackagReg(rUserConfigWorkURL + aRegPathFront + "script" + aRegPathBack);
- const OUString aTagToSearch("script");
visitNodesXMLChangeOneCase(
aUnoPackagReg,
- aTagToSearch,
+ "script",
rToBeEnabled,
rToBeDisabled);
}
diff --git a/comphelper/source/xml/ofopxmlhelper.cxx b/comphelper/source/xml/ofopxmlhelper.cxx
index bde7bb00280e..70df6fea96a6 100644
--- a/comphelper/source/xml/ofopxmlhelper.cxx
+++ b/comphelper/source/xml/ofopxmlhelper.cxx
@@ -91,8 +91,7 @@ uno::Sequence< uno::Sequence< beans::StringPair > > ReadContentTypeSequence(
const uno::Reference< io::XInputStream >& xInStream,
const uno::Reference< uno::XComponentContext >& rContext )
{
- OUString aStringID = "[Content_Types].xml";
- return ReadSequence_Impl( xInStream, aStringID, CONTENTTYPE_FORMAT, rContext );
+ return ReadSequence_Impl( xInStream, "[Content_Types].xml", CONTENTTYPE_FORMAT, rContext );
}
OUString GetContentTypeByName(