summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-10-13 08:47:47 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-10-14 08:26:14 +0200
commit9b5dad13b56bdde7c40970351af3da3a2c3c9350 (patch)
treeabfd4b02743a0e6a93c51c026f4c53f0e21100bc /sal
parentfa71320329999c968feb16ff65be328b5b8ff5e4 (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 'sal')
-rw-r--r--sal/osl/unx/file_misc.cxx2
-rw-r--r--sal/qa/osl/file/osl_File.cxx8
-rw-r--r--sal/rtl/uri.cxx2
3 files changed, 6 insertions, 6 deletions
diff --git a/sal/osl/unx/file_misc.cxx b/sal/osl/unx/file_misc.cxx
index ce9eee8ec1c0..7b6ec7457e94 100644
--- a/sal/osl/unx/file_misc.cxx
+++ b/sal/osl/unx/file_misc.cxx
@@ -841,7 +841,7 @@ static oslFileError oslDoCopy(const sal_Char* pszSourceFileName, const sal_Char*
{
//TODO: better pick a temp file name instead of adding .osl-tmp:
// use the destination file to avoid EXDEV /* Cross-device link */
- tmpDestFile = OString(pszDestFileName) + ".osl-tmp";
+ tmpDestFile = pszDestFileName + OStringLiteral(".osl-tmp");
if (rename(pszDestFileName, tmpDestFile.getStr()) != 0)
{
int e = errno;
diff --git a/sal/qa/osl/file/osl_File.cxx b/sal/qa/osl/file/osl_File.cxx
index cf8875b020ac..348b259bc4e0 100644
--- a/sal/qa/osl/file/osl_File.cxx
+++ b/sal/qa/osl/file/osl_File.cxx
@@ -262,7 +262,7 @@ static void deleteTestDirectory(const OUString& dirname)
nError = Directory::remove(aPathURL);
- OString strError = OString("In deleteTestDirectory function: remove Directory ") +
+ OString strError = "In deleteTestDirectory function: remove Directory " +
OUStringToOString(aPathURL, RTL_TEXTENCODING_ASCII_US);
CPPUNIT_ASSERT_MESSAGE(strError.getStr(), (osl::FileBase::E_None == nError) || (nError == osl::FileBase::E_NOENT));
}
@@ -370,8 +370,8 @@ static OString outputError(const OString & returnVal, const OString & rightVal,
if (returnVal == rightVal)
return OString();
- OString aString = OString(msg) +
- ": the returned value is '" +
+ OString aString = msg +
+ OStringLiteral(": the returned value is '") +
returnVal +
"', but the value should be '" +
rightVal +
@@ -4787,7 +4787,7 @@ namespace osl_Directory
osl_File_Attribute_OwnWrite |
osl_File_Attribute_OwnExe);
deleteTestDirectory(aTmpDir);
- sError = OString("test for create function: create a directory under '") +
+ sError = "test for create function: create a directory under '" +
OUStringToOString(aTmpDir, RTL_TEXTENCODING_ASCII_US) +
"' for access test.";
CPPUNIT_ASSERT_EQUAL_MESSAGE(sError.getStr(), osl::FileBase::E_ACCES, nError1);
diff --git a/sal/rtl/uri.cxx b/sal/rtl/uri.cxx
index 0504650b80fe..ae88e18b8774 100644
--- a/sal/rtl/uri.cxx
+++ b/sal/rtl/uri.cxx
@@ -792,7 +792,7 @@ sal_Bool SAL_CALL rtl_uriConvertRelToAbs(rtl_uString * pBaseUriRef,
rtl_uString_assign(
pException,
(OUString(
- "<" + OUString(pBaseUriRef)
+ "<" + OUString::unacquired(&pBaseUriRef)
+ "> does not start with a scheme component")
.pData));
return false;