diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-09-30 15:11:25 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-10-01 10:51:39 +0200 |
commit | b74c4b7c675883e23bea9fd52682ae89d36539f6 (patch) | |
tree | 6d2a521470e37ae99a7977aaa129700151c7f43b /sal | |
parent | 46c2a3688c9ee7f558f75cbe856c26c4b8849b7e (diff) |
loplugin:stringadd in package..sax
Change-Id: I1f8b626ae99bca6e31e7c4aa9c8a1fc016b76e5c
Reviewed-on: https://gerrit.libreoffice.org/79890
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sal')
-rw-r--r-- | sal/qa/osl/file/osl_File.cxx | 56 | ||||
-rw-r--r-- | sal/qa/osl/file/test_cpy_wrt_file.cxx | 6 |
2 files changed, 30 insertions, 32 deletions
diff --git a/sal/qa/osl/file/osl_File.cxx b/sal/qa/osl/file/osl_File.cxx index 1b32320803e9..cf8875b020ac 100644 --- a/sal/qa/osl/file/osl_File.cxx +++ b/sal/qa/osl/file/osl_File.cxx @@ -86,10 +86,9 @@ static OString errorToString(const osl::FileBase::RC _nError) static OString errorToStr(osl::FileBase::RC const& nError) { - OString suBuf; - suBuf += "The returned error is: " ; - suBuf += errorToString(nError); - suBuf += "!\n"; + OString suBuf = "The returned error is: " + + errorToString(nError) + + "!\n"; return suBuf; } @@ -263,8 +262,8 @@ static void deleteTestDirectory(const OUString& dirname) nError = Directory::remove(aPathURL); - OString strError ("In deleteTestDirectory function: remove Directory "); - strError += OUStringToOString(aPathURL, RTL_TEXTENCODING_ASCII_US); + OString strError = OString("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)); } @@ -368,16 +367,15 @@ static bool checkDirectory(const OUString& str, oslCheckMode nCheckMode) */ static OString outputError(const OString & returnVal, const OString & rightVal, const sal_Char * msg = "") { - OString aString; if (returnVal == rightVal) - return aString; - - aString += msg; - aString += ": the returned value is '"; - aString += returnVal; - aString += "', but the value should be '"; - aString += rightVal; - aString += "'."; + return OString(); + + OString aString = OString(msg) + + ": the returned value is '" + + returnVal + + "', but the value should be '" + + rightVal + + "'."; return aString; } @@ -969,9 +967,9 @@ namespace osl_FileBase bool bOk = compareFileName(aUStr, aUResultURL); - OString sError("test for getSystemPathFromFileURL(' "); - sError += OUStringToOString(aUNormalURL, RTL_TEXTENCODING_ASCII_US); - sError += " ') function:use an absolute file URL, "; + OString sError = "test for getSystemPathFromFileURL(' " + + OUStringToOString(aUNormalURL, RTL_TEXTENCODING_ASCII_US) + + " ') function:use an absolute file URL, "; sError += outputError(OUStringToOString(aUStr, RTL_TEXTENCODING_ASCII_US), OUStringToOString(aUResultURL, RTL_TEXTENCODING_ASCII_US)); @@ -992,9 +990,9 @@ namespace osl_FileBase bool bOk = compareFileName(aUStr, aUResultURL); - OString sError("test for getSystemPathFromFileURL(' "); - sError += OUStringToOString(aUNormalURL, RTL_TEXTENCODING_ASCII_US); - sError += " ') function:use a CJK coded absolute URL, "; + OString sError = "test for getSystemPathFromFileURL(' " + + OUStringToOString(aUNormalURL, RTL_TEXTENCODING_ASCII_US) + + " ') function:use a CJK coded absolute URL, "; sError += outputError(OUStringToOString(aUStr, RTL_TEXTENCODING_ASCII_US), OUStringToOString(aUResultURL, RTL_TEXTENCODING_ASCII_US)); deleteTestDirectory(aTmpName10); @@ -4773,9 +4771,9 @@ namespace osl_Directory CPPUNIT_ASSERT_EQUAL_MESSAGE("temp File removal failed", osl::FileBase::E_None, nError1); nError1 = Directory::create(aTmpDir); - OString sError("test for create function: create a directory '"); - sError += OUStringToOString(aTmpDir, RTL_TEXTENCODING_ASCII_US); - sError += "' and check its existence."; + OString sError = "test for create function: create a directory '" + + OUStringToOString(aTmpDir, RTL_TEXTENCODING_ASCII_US) + + "' and check its existence."; CPPUNIT_ASSERT_EQUAL_MESSAGE(sError.getStr(), osl::FileBase::E_None, nError1); osl_setFileAttributes(aTmpDir.pData, 0); // no access allowed now @@ -4789,9 +4787,9 @@ namespace osl_Directory osl_File_Attribute_OwnWrite | osl_File_Attribute_OwnExe); deleteTestDirectory(aTmpDir); - sError = OString("test for create function: create a directory under '"); - sError += OUStringToOString(aTmpDir, RTL_TEXTENCODING_ASCII_US); - sError += "' for access test."; + sError = OString("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); #endif } @@ -4888,8 +4886,8 @@ namespace osl_Directory nError1 = Directory::remove(aTmpName3); deleteTestFile(aTmpName4); deleteTestDirectory(aTmpName3); - OString sError = "test for remove function: try to remove a directory that is not empty."; - sError += errorToStr(nError1).getStr(); + OString sError = "test for remove function: try to remove a directory that is not empty." + + errorToStr(nError1); #if defined(__sun) // on UNX, the implementation uses rmdir(), which EEXIST is thrown on Solaris when the directory is not empty, refer to: 'man -s 2 rmdir', while on linux, ENOTEMPTY is thrown. // EEXIST The directory contains entries other than those for "." and "..". diff --git a/sal/qa/osl/file/test_cpy_wrt_file.cxx b/sal/qa/osl/file/test_cpy_wrt_file.cxx index 41e9f88c9fea..6843d10b362a 100644 --- a/sal/qa/osl/file/test_cpy_wrt_file.cxx +++ b/sal/qa/osl/file/test_cpy_wrt_file.cxx @@ -43,9 +43,9 @@ public: File tmp_file(aTmpFile); err = tmp_file.open(osl_File_OpenFlag_Write | osl_File_OpenFlag_Create); - OString sErrorMsg = "Expected that '"; - sErrorMsg += OUStringToOString(aTmpFile, RTL_TEXTENCODING_ASCII_US); - sErrorMsg += "' would exist!"; + OString sErrorMsg = "Expected that '" + + OUStringToOString(aTmpFile, RTL_TEXTENCODING_ASCII_US) + + "' would exist!"; CPPUNIT_ASSERT_EQUAL_MESSAGE(sErrorMsg.getStr(), FileBase::E_EXIST, err); char buffer[1]; |