diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2017-05-16 16:49:03 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2017-05-16 16:49:03 +0200 |
commit | e85fcef1af0c96b0e8334bd7b6256e0b02810e43 (patch) | |
tree | 71685f34d0d18d4ec1c3a29d289aba9e6c43666b /sal/qa | |
parent | ea3ef1a2a06b7ac0fa9f618498f9caf48ebc40bd (diff) |
Try to fix loplugin:comparisonwithconstant's rewrite-with-macros issue
...that had plagued 2e293a731c1559c9869dfcb32491bc600fc18e4e "new
loplugin/rewriter comparisonwithconstant" (in sal/osl/unx/pipe.cxx), and
auto-rewrite the remaining occurrences in sal (that the mentioned commit had
failed to address, for whatever reason)
Change-Id: I3dc3bae8dd92ba8bf576f6e06e7c9ee21f883661
Diffstat (limited to 'sal/qa')
-rw-r--r-- | sal/qa/osl/file/osl_File.cxx | 28 | ||||
-rw-r--r-- | sal/qa/osl/file/osl_old_test_file.cxx | 6 | ||||
-rw-r--r-- | sal/qa/osl/pipe/osl_Pipe.cxx | 2 | ||||
-rw-r--r-- | sal/qa/osl/process/osl_process.cxx | 2 | ||||
-rw-r--r-- | sal/qa/osl/process/osl_process_child.cxx | 4 |
5 files changed, 21 insertions, 21 deletions
diff --git a/sal/qa/osl/file/osl_File.cxx b/sal/qa/osl/file/osl_File.cxx index 8a8294fc7847..4e635a1d559f 100644 --- a/sal/qa/osl/file/osl_File.cxx +++ b/sal/qa/osl/file/osl_File.cxx @@ -176,7 +176,7 @@ inline void createTestFile(const OUString& filename) File aFile(aPathURL); nError = aFile.open(osl_File_OpenFlag_Read | osl_File_OpenFlag_Write | osl_File_OpenFlag_Create); - if ((osl::FileBase::E_None != nError) && (nError != osl::FileBase::E_EXIST)) + if ((nError != osl::FileBase::E_None) && (nError != osl::FileBase::E_EXIST)) printf("createTestFile failed!\n"); aFile.close(); @@ -230,7 +230,7 @@ inline void createTestDirectory(const OUString& dirname) if (!isURL(dirname)) osl::FileBase::getFileURLFromSystemPath(dirname, aPathURL); // convert if not full qualified URL nError = Directory::create(aPathURL); - if ((osl::FileBase::E_None != nError) && (nError != osl::FileBase::E_EXIST)) + if ((nError != osl::FileBase::E_None) && (nError != osl::FileBase::E_EXIST)) printf("createTestDirectory failed!\n"); } @@ -287,7 +287,7 @@ enum class oslCheckMode { inline bool ifFileExist(const OUString & str) { File testFile(str); - return (osl::FileBase::E_None == testFile.open(osl_File_OpenFlag_Read)); + return (testFile.open(osl_File_OpenFlag_Read) == osl::FileBase::E_None); } /** check if the file can be written @@ -308,7 +308,7 @@ inline bool ifFileCanWrite(const OUString & str) // on UNX, just test if open success with osl_File_OpenFlag_Write #else File testFile(str); - bool bCheckResult = (osl::FileBase::E_None == testFile.open(osl_File_OpenFlag_Write)); + bool bCheckResult = (testFile.open(osl_File_OpenFlag_Write) == osl::FileBase::E_None); #endif return bCheckResult; } @@ -1221,7 +1221,7 @@ namespace osl_FileBase File testFile(*pUStr_FileURL); nError2 = testFile.open(osl_File_OpenFlag_Create); - if (osl::FileBase::E_EXIST == nError2) + if (nError2 == osl::FileBase::E_EXIST) { osl_closeFile(*pHandle); deleteTestFile(*pUStr_FileURL); @@ -1250,7 +1250,7 @@ namespace osl_FileBase osl::FileBase::E_EXIST, nError2); // check file if have the write permission - if (osl::FileBase::E_EXIST == nError2) + if (nError2 == osl::FileBase::E_EXIST) { bOK = ifFileCanWrite(*pUStr_FileURL); osl_closeFile(*pHandle); @@ -1500,7 +1500,7 @@ namespace osl_FileStatus { osl::FileBase::RC nError1 = testDirectory.getNextItem(rItem_link, 4); - if (osl::FileBase::E_None == nError1) + if (nError1 == osl::FileBase::E_None) { sal_uInt32 mask_link = osl_FileStatus_Mask_FileName | osl_FileStatus_Mask_LinkTargetURL; FileStatus rFileStatus(mask_link); @@ -2268,7 +2268,7 @@ namespace osl_File File testFile(aTestFile); nError1 = testFile.open(osl_File_OpenFlag_Create); - bool bOK = (File::E_ACCES == nError1); + bool bOK = (nError1 == File::E_ACCES); #ifdef _WIN32 bOK = true; /// in Windows, you can create file in c:\ any way. testFile.close(); @@ -4078,7 +4078,7 @@ namespace osl_Directory Directory testDirectory(aTmpName6); nError1 = testDirectory.open(); - if (osl::FileBase::E_None == nError1) + if (nError1 == osl::FileBase::E_None) { nError2 = testDirectory.close(); CPPUNIT_ASSERT_EQUAL(nError2, osl::FileBase::E_None); @@ -4093,7 +4093,7 @@ namespace osl_Directory Directory testDirectory(aUserDirectorySys); nError1 = testDirectory.open(); - if (osl::FileBase::E_None == nError1) + if (nError1 == osl::FileBase::E_None) { nError2 = testDirectory.close(); CPPUNIT_ASSERT_EQUAL(nError2, osl::FileBase::E_None); @@ -4108,7 +4108,7 @@ namespace osl_Directory Directory testDirectory(aTmpName4); nError1 = testDirectory.open(); - if (osl::FileBase::E_None == nError1) + if (nError1 == osl::FileBase::E_None) { nError2 = testDirectory.close(); CPPUNIT_ASSERT_EQUAL(nError2, osl::FileBase::E_None); @@ -4498,13 +4498,13 @@ namespace osl_Directory while (true) { nError1 = testDirectory.getNextItem(rItem, 4); - if (osl::FileBase::E_None == nError1) { + if (nError1 == osl::FileBase::E_None) { FileStatus rFileStatus(osl_FileStatus_Mask_FileName | osl_FileStatus_Mask_Type); rItem.getFileStatus(rFileStatus); if (compareFileName(rFileStatus.getFileName(), aFileName)) { bFoundOK = true; - if (FileStatus::Link == rFileStatus.getFileType()) + if (rFileStatus.getFileType() == FileStatus::Link) { bLnkOK = true; break; @@ -4831,7 +4831,7 @@ namespace osl_Directory Directory rDirectory(aTmpName3); nError2 = rDirectory.open(); - if (osl::FileBase::E_NOENT != nError2) + if (nError2 != osl::FileBase::E_NOENT) Directory::remove(aTmpName3); CPPUNIT_ASSERT_EQUAL_MESSAGE("test for remove function: remove a directory by its system path, and check its existence.", diff --git a/sal/qa/osl/file/osl_old_test_file.cxx b/sal/qa/osl/file/osl_old_test_file.cxx index 243dd6de89de..f093d5fe1bb8 100644 --- a/sal/qa/osl/file/osl_old_test_file.cxx +++ b/sal/qa/osl/file/osl_old_test_file.cxx @@ -91,7 +91,7 @@ void oldtestfile::test_file_001() OUString rel = OUString::createFromAscii( aSource1[i] ); oslFileError e = osl_getAbsoluteFileURL( base1.pData, rel.pData , &target.pData ); CPPUNIT_ASSERT_EQUAL_MESSAGE("failure #1", osl_File_E_None, e ); - if( osl_File_E_None == e ) + if( e == osl_File_E_None ) { CPPUNIT_ASSERT_MESSAGE("failure #1.1", target.equalsAscii( aSource1[i+1] ) ); } @@ -110,7 +110,7 @@ void oldtestfile::test_file_002() OUString rel = OUString::createFromAscii( aSource2[i] ); oslFileError e = osl_getAbsoluteFileURL( base2.pData, rel.pData , &target.pData ); CPPUNIT_ASSERT_EQUAL_MESSAGE("failure #2", osl_File_E_None, e ); - if( osl_File_E_None == e ) + if( e == osl_File_E_None ) { CPPUNIT_ASSERT_MESSAGE("failure #2.1", target.equalsAscii( aSource2[i+1] ) ); } @@ -129,7 +129,7 @@ void oldtestfile::test_file_004() OUString rel = OUString::createFromAscii( aSource1[i] ); oslFileError e = osl_getAbsoluteFileURL( base4.pData, rel.pData , &target.pData ); CPPUNIT_ASSERT_EQUAL_MESSAGE("failure #10", osl_File_E_None, e ); - if( osl_File_E_None == e ) + if( e == osl_File_E_None ) { CPPUNIT_ASSERT_MESSAGE("failure #10.1", target.equalsAscii( aSource1[i+1] ) ); } diff --git a/sal/qa/osl/pipe/osl_Pipe.cxx b/sal/qa/osl/pipe/osl_Pipe.cxx index 2505918e14f9..2d4336873112 100644 --- a/sal/qa/osl/pipe/osl_Pipe.cxx +++ b/sal/qa/osl/pipe/osl_Pipe.cxx @@ -817,7 +817,7 @@ namespace osl_StreamPipe { //start server and wait for connection. printf("accept\n"); - if ( osl_Pipe_E_None != aListenPipe.accept( aConnectionPipe ) ) + if ( aListenPipe.accept( aConnectionPipe ) != osl_Pipe_E_None ) { printf("pipe accept failed!"); return; diff --git a/sal/qa/osl/process/osl_process.cxx b/sal/qa/osl/process/osl_process.cxx index 52defec3279e..ff97d3a55357 100644 --- a/sal/qa/osl/process/osl_process.cxx +++ b/sal/qa/osl/process/osl_process.cxx @@ -121,7 +121,7 @@ private: sal_Int32 pos_equal_sign = env_var.indexOf('='); - if (-1 != pos_equal_sign) + if (pos_equal_sign != -1) return env_var.copy(0, pos_equal_sign); return OString(); diff --git a/sal/qa/osl/process/osl_process_child.cxx b/sal/qa/osl/process/osl_process_child.cxx index 4688f4883e9f..a1791c6f9b60 100644 --- a/sal/qa/osl/process/osl_process_child.cxx +++ b/sal/qa/osl/process/osl_process_child.cxx @@ -91,12 +91,12 @@ int main(int argc, char* argv[]) { if (argc > 2) { - if (0 == strcmp("-join", argv[1])) + if (strcmp("-join", argv[1]) == 0) { // coverity[tainted_data] - this is a build-time only test tool wait_for_seconds(argv[2]); } - else if (0 == strcmp("-env", argv[1])) + else if (strcmp("-env", argv[1]) == 0) dump_env(argv[2]); } |