summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2014-01-27 10:45:55 +0100
committerStephan Bergmann <sbergman@redhat.com>2014-01-27 10:47:33 +0100
commite344d2ac328332aeb0e326636a0a2cd61b812b6a (patch)
tree5563c5639c13810850253186cfd91aaf94488a57 /sal
parent65191cda819ee8f4d14f6cdf12568c35e46b5c66 (diff)
Let C++ inline functions return bool instead of sal_Bool
...to improve diagnosing misuses of boolean expressions in client code (cf. compilerplugins/clang/implicitboolconversion.cxx). This change should be transparent to client code. Change-Id: Ibf43c5ded609b489952e1cc666cac1e72ffa2386
Diffstat (limited to 'sal')
-rw-r--r--sal/qa/ByteSequence/ByteSequence.cxx24
-rw-r--r--sal/qa/osl/file/osl_File.cxx36
-rw-r--r--sal/qa/osl/module/osl_Module.cxx2
-rw-r--r--sal/qa/osl/mutex/osl_Mutex.cxx20
-rw-r--r--sal/qa/osl/process/osl_Thread.cxx6
-rw-r--r--sal/qa/osl/security/osl_Security.cxx6
6 files changed, 47 insertions, 47 deletions
diff --git a/sal/qa/ByteSequence/ByteSequence.cxx b/sal/qa/ByteSequence/ByteSequence.cxx
index 7ce6e465cff5..c742337748be 100644
--- a/sal/qa/ByteSequence/ByteSequence.cxx
+++ b/sal/qa/ByteSequence/ByteSequence.cxx
@@ -131,20 +131,20 @@ public:
void test_same0() {
rtl::ByteSequence s1;
rtl::ByteSequence s2;
- CPPUNIT_ASSERT_EQUAL(sal_True, s1 == s2);
- CPPUNIT_ASSERT_EQUAL(sal_True, s2 == s1);
- CPPUNIT_ASSERT_EQUAL(sal_False, s1 != s2);
- CPPUNIT_ASSERT_EQUAL(sal_False, s2 != s1);
+ CPPUNIT_ASSERT_EQUAL(true, s1 == s2);
+ CPPUNIT_ASSERT_EQUAL(true, s2 == s1);
+ CPPUNIT_ASSERT_EQUAL(false, s1 != s2);
+ CPPUNIT_ASSERT_EQUAL(false, s2 != s1);
}
void test_diffLen() {
sal_Int8 const a[5] = { 0, 1, 2, 3, 4 };
rtl::ByteSequence s1(a, 5);
rtl::ByteSequence s2(a, 4);
- CPPUNIT_ASSERT_EQUAL(sal_False, s1 == s2);
- CPPUNIT_ASSERT_EQUAL(sal_False, s2 == s1);
- CPPUNIT_ASSERT_EQUAL(sal_True, s1 != s2);
- CPPUNIT_ASSERT_EQUAL(sal_True, s2 != s1);
+ CPPUNIT_ASSERT_EQUAL(false, s1 == s2);
+ CPPUNIT_ASSERT_EQUAL(false, s2 == s1);
+ CPPUNIT_ASSERT_EQUAL(true, s1 != s2);
+ CPPUNIT_ASSERT_EQUAL(true, s2 != s1);
}
void test_diffElem() {
@@ -152,10 +152,10 @@ public:
rtl::ByteSequence s1(a1, 5);
sal_Int8 const a2[5] = { 0, 1, 10, 3, 4 };
rtl::ByteSequence s2(a2, 5);
- CPPUNIT_ASSERT_EQUAL(sal_False, s1 == s2);
- CPPUNIT_ASSERT_EQUAL(sal_False, s2 == s1);
- CPPUNIT_ASSERT_EQUAL(sal_True, s1 != s2);
- CPPUNIT_ASSERT_EQUAL(sal_True, s2 != s1);
+ CPPUNIT_ASSERT_EQUAL(false, s1 == s2);
+ CPPUNIT_ASSERT_EQUAL(false, s2 == s1);
+ CPPUNIT_ASSERT_EQUAL(true, s1 != s2);
+ CPPUNIT_ASSERT_EQUAL(true, s2 != s1);
}
CPPUNIT_TEST_SUITE(Test);
diff --git a/sal/qa/osl/file/osl_File.cxx b/sal/qa/osl/file/osl_File.cxx
index 1da398aeac71..76419a73f1a2 100644
--- a/sal/qa/osl/file/osl_File.cxx
+++ b/sal/qa/osl/file/osl_File.cxx
@@ -438,7 +438,7 @@ inline void deleteTestDirectory( const ::rtl::OUString dirname )
::osl::FileBase::getFileURLFromSystemPath( dirname, aPathURL ); //convert if not full qualified URL
::osl::Directory testDir( aPathURL );
- if ( testDir.isOpen() == sal_True )
+ if ( testDir.isOpen() )
testDir.close(); //close if still open.
nError = ::osl::Directory::remove( aPathURL );
@@ -1530,7 +1530,7 @@ namespace osl_VolumeInfo
sal_Int32 mask1 = osl_VolumeInfo_Mask_FreeSpace;
::osl::VolumeInfo aVolumeInfo1( mask1 );
nError1 = ::osl::Directory::getVolumeInfo( aRootURL, aVolumeInfo1 );
- CPPUNIT_ASSERT( sal_True == aVolumeInfo1.isValid( mask1 ) );
+ CPPUNIT_ASSERT( aVolumeInfo1.isValid( mask1 ) );
CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 );
sal_uInt64 uiTotalSpace1 = aVolumeInfo1.getTotalSpace();
@@ -1539,7 +1539,7 @@ namespace osl_VolumeInfo
sal_Int32 mask2 = osl_VolumeInfo_Mask_TotalSpace;
::osl::VolumeInfo aVolumeInfo2( mask2 );
nError2 = ::osl::Directory::getVolumeInfo( aRootURL, aVolumeInfo2 );
- CPPUNIT_ASSERT( sal_True == aVolumeInfo2.isValid( mask2 ) );
+ CPPUNIT_ASSERT( aVolumeInfo2.isValid( mask2 ) );
CPPUNIT_ASSERT( osl::FileBase::E_None == nError2 );
sal_uInt64 uiTotalSpace2 = aVolumeInfo2.getTotalSpace();
@@ -1588,7 +1588,7 @@ namespace osl_VolumeInfo
CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 );
CPPUNIT_ASSERT_MESSAGE( "test for isValid function: no fields specified.",
- sal_True == aVolumeInfo.isValid( mask ) );
+ aVolumeInfo.isValid( mask ) );
}
#if ( defined UNX )
@@ -1602,7 +1602,7 @@ namespace osl_VolumeInfo
CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 );
CPPUNIT_ASSERT_MESSAGE( "test for isValid function: all valid fields specified for a nfs volume.",
- sal_True == aVolumeInfo.isValid( mask ) );
+ aVolumeInfo.isValid( mask ) );
}
#else /// Windows version,here we can not determine whichvolume in Windows is serve as an nfs volume.
void isValid_002()
@@ -1908,7 +1908,7 @@ namespace osl_VolumeInfo
::osl::VolumeInfo aVolumeInfo( mask );
nError1 = ::osl::Directory::getVolumeInfo( aVolURL1, aVolumeInfo );
CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 );
- CPPUNIT_ASSERT( sal_True == aVolumeInfo.isValid( mask ) );
+ CPPUNIT_ASSERT( aVolumeInfo.isValid( mask ) );
sal_uInt64 uiTotalSpace = aVolumeInfo.getTotalSpace();
CPPUNIT_ASSERT_MESSAGE( "test for getTotalSpace function: get total space of Fixed disk volume mounted on /, it should not be 0",
@@ -1922,7 +1922,7 @@ namespace osl_VolumeInfo
::osl::VolumeInfo aVolumeInfo( mask );
nError1 = ::osl::Directory::getVolumeInfo( aVolURL3, aVolumeInfo );
CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 );
- CPPUNIT_ASSERT( sal_True == aVolumeInfo.isValid( mask ) );
+ CPPUNIT_ASSERT( aVolumeInfo.isValid( mask ) );
sal_uInt64 uiTotalSpace = aVolumeInfo.getTotalSpace();
CPPUNIT_ASSERT_MESSAGE( "test for getTotalSpace function: get total space of /proc, it should be 0",
@@ -1990,7 +1990,7 @@ namespace osl_VolumeInfo
::osl::VolumeInfo aVolumeInfo( mask );
nError1 = ::osl::Directory::getVolumeInfo( aVolURL1, aVolumeInfo );
CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 );
- CPPUNIT_ASSERT( sal_True == aVolumeInfo.isValid( mask ) );
+ CPPUNIT_ASSERT( aVolumeInfo.isValid( mask ) );
sal_uInt64 uiFreeSpace = aVolumeInfo.getFreeSpace();
CPPUNIT_ASSERT_MESSAGE( "test for getFreeSpace function: get free space of Fixed disk volume mounted on /, it should not be 0, suggestion: returned value, -1 is better, since some times the free space may be 0",
@@ -2004,7 +2004,7 @@ namespace osl_VolumeInfo
::osl::VolumeInfo aVolumeInfo( mask );
nError1 = ::osl::Directory::getVolumeInfo( aVolURL3, aVolumeInfo );
CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 );
- CPPUNIT_ASSERT( sal_True == aVolumeInfo.isValid( mask ) );
+ CPPUNIT_ASSERT( aVolumeInfo.isValid( mask ) );
sal_uInt64 uiFreeSpace = aVolumeInfo.getFreeSpace();
CPPUNIT_ASSERT_MESSAGE( "test for getFreeSpace function: get free space of /proc, it should be 0",
@@ -2072,7 +2072,7 @@ namespace osl_VolumeInfo
::osl::VolumeInfo aVolumeInfo( mask );
nError1 = ::osl::Directory::getVolumeInfo( aVolURL1, aVolumeInfo );
CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 );
- CPPUNIT_ASSERT( sal_True == aVolumeInfo.isValid( mask ) );
+ CPPUNIT_ASSERT( aVolumeInfo.isValid( mask ) );
sal_uInt64 uiUsedSpace = aVolumeInfo.getUsedSpace();
CPPUNIT_ASSERT_MESSAGE( "test for getUsedSpace function: get used space of Fixed disk volume mounted on /, it should not be 0, suggestion: returned value, -1 is better, since some times the used space may be 0",
@@ -2086,7 +2086,7 @@ namespace osl_VolumeInfo
::osl::VolumeInfo aVolumeInfo( mask );
nError1 = ::osl::Directory::getVolumeInfo( aVolURL3, aVolumeInfo );
CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 );
- CPPUNIT_ASSERT( sal_True == aVolumeInfo.isValid( mask ) );
+ CPPUNIT_ASSERT( aVolumeInfo.isValid( mask ) );
sal_uInt64 uiUsedSpace = aVolumeInfo.getUsedSpace();
CPPUNIT_ASSERT_MESSAGE( "test for getUsedSpace function: get used space of /proc, it should be 0",
@@ -2156,7 +2156,7 @@ namespace osl_VolumeInfo
::osl::VolumeInfo aVolumeInfo( mask );
nError1 = ::osl::Directory::getVolumeInfo( aVolURL1, aVolumeInfo );
CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 );
- CPPUNIT_ASSERT( sal_True == aVolumeInfo.isValid( mask ) );
+ CPPUNIT_ASSERT( aVolumeInfo.isValid( mask ) );
sal_uInt32 uiMaxNameLength = aVolumeInfo.getMaxNameLength();
CPPUNIT_ASSERT_MESSAGE( "test for getMaxNameLength function: get max name length of Fixed disk volume mounted on /, it should not be 0",
@@ -2178,7 +2178,7 @@ namespace osl_VolumeInfo
::osl::VolumeInfo aVolumeInfo( mask );
nError1 = ::osl::Directory::getVolumeInfo( aVolURL1, aVolumeInfo );
CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 );
- CPPUNIT_ASSERT( sal_True == aVolumeInfo.isValid( mask ) );
+ CPPUNIT_ASSERT( aVolumeInfo.isValid( mask ) );
sal_uInt64 uiMaxNameLength = aVolumeInfo.getMaxNameLength();
CPPUNIT_ASSERT_MESSAGE( "test for getMaxNameLength function: get max name length by hand, then compare with getMaxNameLength",
@@ -2216,7 +2216,7 @@ namespace osl_VolumeInfo
::osl::VolumeInfo aVolumeInfo( mask );
nError1 = ::osl::Directory::getVolumeInfo( aVolURL1, aVolumeInfo );
CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 );
- CPPUNIT_ASSERT( sal_True == aVolumeInfo.isValid( mask ) );
+ CPPUNIT_ASSERT( aVolumeInfo.isValid( mask ) );
sal_uInt32 uiMaxPathLength = aVolumeInfo.getMaxPathLength();
CPPUNIT_ASSERT_MESSAGE( "test for getMaxPathLength function: get max path length of Fixed disk volume mounted on /, it should not be 0",
@@ -2231,7 +2231,7 @@ namespace osl_VolumeInfo
::osl::VolumeInfo aVolumeInfo( mask );
nError1 = ::osl::Directory::getVolumeInfo( aVolURL1, aVolumeInfo );
CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 );
- CPPUNIT_ASSERT( sal_True == aVolumeInfo.isValid( mask ) );
+ CPPUNIT_ASSERT( aVolumeInfo.isValid( mask ) );
sal_uInt64 uiMaxPathLength = aVolumeInfo.getMaxPathLength();
CPPUNIT_ASSERT_MESSAGE( "test for getMaxPathLength function: get max path length by hand, then compare with getMaxPathLength",
@@ -2271,7 +2271,7 @@ namespace osl_VolumeInfo
::osl::VolumeInfo aVolumeInfo( mask );
nError1 = ::osl::Directory::getVolumeInfo( aVolURL1, aVolumeInfo );
CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 );
- CPPUNIT_ASSERT( sal_True == aVolumeInfo.isValid( mask ) );
+ CPPUNIT_ASSERT( aVolumeInfo.isValid( mask ) );
aUStr = aVolumeInfo.getFileSystemName();
CPPUNIT_ASSERT_MESSAGE( "test for getFileSystemName function: get file system name of Fixed disk volume mounted on /, it should not be empty string",
@@ -2595,7 +2595,7 @@ namespace osl_FileStatus
if ( compareFileName( rFileStatus.getFileName(), aFileName) == sal_True )
{
//printf("find the link file");
- if ( sal_True == rFileStatus.isValid( osl_FileStatus_Mask_LinkTargetURL ) )
+ if ( rFileStatus.isValid( osl_FileStatus_Mask_LinkTargetURL ) )
{
bOk = sal_True;
break;
@@ -4937,7 +4937,7 @@ namespace osl_DirectoryItem
CPPUNIT_ASSERT( FileBase::E_None == nError1 );
CPPUNIT_ASSERT_MESSAGE( "test for is function: use an uninitialized instance.",
- ( sal_True == rItem.is() ) );
+ rItem.is() );
}
CPPUNIT_TEST_SUITE( is );
diff --git a/sal/qa/osl/module/osl_Module.cxx b/sal/qa/osl/module/osl_Module.cxx
index d6358d4c692c..a5de11aacbfa 100644
--- a/sal/qa/osl/module/osl_Module.cxx
+++ b/sal/qa/osl/module/osl_Module.cxx
@@ -98,7 +98,7 @@ inline void deleteTestDirectory( const ::rtl::OUString dirname )
::osl::FileBase::getFileURLFromSystemPath( dirname, aPathURL ); //convert if not full qualified URL
::osl::Directory testDir( aPathURL );
- if ( testDir.isOpen( ) == sal_True )
+ if ( testDir.isOpen( ) )
{
testDir.close( ); //close if still open.
}
diff --git a/sal/qa/osl/mutex/osl_Mutex.cxx b/sal/qa/osl/mutex/osl_Mutex.cxx
index 0e9ce85f1f06..6eafeed26fd4 100644
--- a/sal/qa/osl/mutex/osl_Mutex.cxx
+++ b/sal/qa/osl/mutex/osl_Mutex.cxx
@@ -98,7 +98,7 @@ public:
~IncreaseThread( )
{
- CPPUNIT_ASSERT_MESSAGE( "#IncreaseThread does not shutdown properly.\n", sal_False == this -> isRunning( ) );
+ CPPUNIT_ASSERT_MESSAGE( "#IncreaseThread does not shutdown properly.\n", !isRunning( ) );
}
protected:
struct resource *pResource;
@@ -126,7 +126,7 @@ public:
~DecreaseThread( )
{
- CPPUNIT_ASSERT_MESSAGE( "#DecreaseThread does not shutdown properly.\n", sal_False == this -> isRunning( ) );
+ CPPUNIT_ASSERT_MESSAGE( "#DecreaseThread does not shutdown properly.\n", !isRunning( ) );
}
protected:
struct resource *pResource;
@@ -164,7 +164,7 @@ public:
~PutThread( )
{
- CPPUNIT_ASSERT_MESSAGE( "#PutThread does not shutdown properly.\n", sal_False == this -> isRunning( ) );
+ CPPUNIT_ASSERT_MESSAGE( "#PutThread does not shutdown properly.\n", !isRunning( ) );
}
protected:
struct chain* pChain;
@@ -202,7 +202,7 @@ public:
~HoldThread( )
{
- CPPUNIT_ASSERT_MESSAGE( "#HoldThread does not shutdown properly.\n", sal_False == this -> isRunning( ) );
+ CPPUNIT_ASSERT_MESSAGE( "#HoldThread does not shutdown properly.\n", !isRunning( ) );
}
protected:
Mutex* pMyMutex;
@@ -224,7 +224,7 @@ public:
~WaitThread( )
{
- CPPUNIT_ASSERT_MESSAGE( "#WaitThread does not shutdown properly.\n", sal_False == this -> isRunning( ) );
+ CPPUNIT_ASSERT_MESSAGE( "#WaitThread does not shutdown properly.\n", !isRunning( ) );
}
protected:
Mutex* pMyMutex;
@@ -248,7 +248,7 @@ public:
~GlobalMutexThread( )
{
- CPPUNIT_ASSERT_MESSAGE( "#GlobalMutexThread does not shutdown properly.\n", sal_False == this -> isRunning( ) );
+ CPPUNIT_ASSERT_MESSAGE( "#GlobalMutexThread does not shutdown properly.\n", !isRunning( ) );
}
protected:
void SAL_CALL run( )
@@ -573,7 +573,7 @@ public:
~GuardThread( )
{
- CPPUNIT_ASSERT_MESSAGE( "#GuardThread does not shutdown properly.\n", sal_False == this -> isRunning( ) );
+ CPPUNIT_ASSERT_MESSAGE( "#GuardThread does not shutdown properly.\n", !isRunning( ) );
}
protected:
Mutex* pMyMutex;
@@ -659,7 +659,7 @@ public:
~ClearGuardThread( )
{
- CPPUNIT_ASSERT_MESSAGE( "#ClearGuardThread does not shutdown properly.\n", sal_False == this -> isRunning( ) );
+ CPPUNIT_ASSERT_MESSAGE( "#ClearGuardThread does not shutdown properly.\n", !isRunning( ) );
}
protected:
Mutex* pMyMutex;
@@ -734,7 +734,7 @@ namespace osl_ClearableGuard
while (1)
{
- if (aMutex.tryToAcquire() == sal_True)
+ if (aMutex.tryToAcquire())
{
break;
}
@@ -801,7 +801,7 @@ public:
~ResetGuardThread( )
{
- CPPUNIT_ASSERT_MESSAGE( "#ResetGuardThread does not shutdown properly.\n", sal_False == this -> isRunning( ) );
+ CPPUNIT_ASSERT_MESSAGE( "#ResetGuardThread does not shutdown properly.\n", !isRunning( ) );
}
protected:
Mutex* pMyMutex;
diff --git a/sal/qa/osl/process/osl_Thread.cxx b/sal/qa/osl/process/osl_Thread.cxx
index 3e394aa57efd..b27e187eff5c 100644
--- a/sal/qa/osl/process/osl_Thread.cxx
+++ b/sal/qa/osl/process/osl_Thread.cxx
@@ -290,7 +290,7 @@ protected:
void SAL_CALL run()
{
/// if the thread should terminate, schedule return false
- while (m_aFlag.getValue() < 20 && schedule() == sal_True)
+ while (m_aFlag.getValue() < 20 && schedule())
{
m_aFlag.addValue(1);
ThreadHelper::thread_sleep_tenth_sec(1);
@@ -344,7 +344,7 @@ protected:
void SAL_CALL run()
{
//if the thread should terminate, schedule return false
- while (schedule() == sal_True)
+ while (schedule())
{
m_aFlag.addValue(1);
@@ -430,7 +430,7 @@ protected:
void SAL_CALL run()
{
//if the thread should terminate, schedule return false
- while (schedule() == sal_True)
+ while (schedule())
{
m_aFlag.addValue(1);
}
diff --git a/sal/qa/osl/security/osl_Security.cxx b/sal/qa/osl/security/osl_Security.cxx
index f24d404c4114..0d7fd4e9b5ca 100644
--- a/sal/qa/osl/security/osl_Security.cxx
+++ b/sal/qa/osl/security/osl_Security.cxx
@@ -247,15 +247,15 @@ namespace osl_Security
class getHandle : public CppUnit::TestFixture
{
public:
- sal_Bool bRes;
+ bool bRes;
void getHandle_001( )
{
::osl::Security aSec;
- bRes = aSec.isAdministrator( ) == osl_isAdministrator( aSec.getHandle( ) );
+ bRes = aSec.isAdministrator( ) == bool(osl_isAdministrator( aSec.getHandle( ) ));
CPPUNIT_ASSERT_MESSAGE( "#test comment#: use getHandle function to call C API.",
- bRes == sal_True );
+ bRes );
}
CPPUNIT_TEST_SUITE( getHandle );