diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2014-02-14 22:45:44 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-02-17 17:55:16 +0100 |
commit | d84cf2de01f17f2617846135081a819ce74dd87a (patch) | |
tree | 192bc83388393b8daefe0dd8b1610c50f111a7bd | |
parent | 6f69fb5d7d7f66d17b56eca5a5b3f494c597b97a (diff) |
sal: sal_Bool -> bool
Change-Id: I071a931660dafc1ee5950da527b042fb175255b8
30 files changed, 448 insertions, 458 deletions
diff --git a/sal/osl/unx/conditn.cxx b/sal/osl/unx/conditn.cxx index 1daea54b68e2..ddf483a97fb5 100644 --- a/sal/osl/unx/conditn.cxx +++ b/sal/osl/unx/conditn.cxx @@ -33,7 +33,7 @@ typedef struct _oslConditionImpl { pthread_cond_t m_Condition; pthread_mutex_t m_Lock; - sal_Bool m_State; + bool m_State; } oslConditionImpl; @@ -50,7 +50,7 @@ oslCondition SAL_CALL osl_createCondition() return 0; } - pCond->m_State = sal_False; + pCond->m_State = false; /* init condition variable with default attr. (PTHREAD_PROCESS_PRIVAT) */ nRet = pthread_cond_init(&pCond->m_Condition, PTHREAD_CONDATTR_DEFAULT); @@ -135,7 +135,7 @@ sal_Bool SAL_CALL osl_setCondition(oslCondition Condition) return sal_False; } - pCond->m_State = sal_True; + pCond->m_State = true; nRet = pthread_cond_broadcast(&pCond->m_Condition); if ( nRet != 0 ) { @@ -186,7 +186,7 @@ sal_Bool SAL_CALL osl_resetCondition(oslCondition Condition) return sal_False; } - pCond->m_State = sal_False; + pCond->m_State = false; nRet = pthread_mutex_unlock(&pCond->m_Lock); if ( nRet != 0 ) @@ -302,7 +302,7 @@ oslConditionResult SAL_CALL osl_waitCondition(oslCondition Condition, const Time sal_Bool SAL_CALL osl_checkCondition(oslCondition Condition) { - sal_Bool State; + bool State; oslConditionImpl* pCond; int nRet=0; diff --git a/sal/osl/unx/diagnose.cxx b/sal/osl/unx/diagnose.cxx index 871aa0a68006..188062cb8ad0 100644 --- a/sal/osl/unx/diagnose.cxx +++ b/sal/osl/unx/diagnose.cxx @@ -206,7 +206,7 @@ sal_Bool SAL_CALL osl_assertFailedLine ( // assertions are routed to some external instance static bool envAbort = isEnv( "SAL_DIAGNOSE_ABORT" ); static bool envBacktrace = isEnv( "SAL_DIAGNOSE_BACKTRACE" ); - sal_Bool const doAbort = envAbort && f == NULL; + bool const doAbort = envAbort && f == NULL; /* If there's a callback for detailed messages, use it */ if ( g_pDetailedDebugMessageFunc != NULL ) diff --git a/sal/osl/unx/file_misc.cxx b/sal/osl/unx/file_misc.cxx index 99b5a4d5add3..695b89d38c79 100644 --- a/sal/osl/unx/file_misc.cxx +++ b/sal/osl/unx/file_misc.cxx @@ -263,7 +263,7 @@ oslFileError SAL_CALL osl_closeDirectory( oslDirectory Directory ) * on request *********************************************/ -static struct dirent* osl_readdir_impl_(DIR* pdir, sal_Bool bFilterLocalAndParentDir) +static struct dirent* osl_readdir_impl_(DIR* pdir, bool bFilterLocalAndParentDir) { struct dirent* pdirent; @@ -300,7 +300,7 @@ oslFileError SAL_CALL osl_getNextDirectoryItem(oslDirectory Directory, oslDirect else #endif { - pEntry = osl_readdir_impl_(pDirImpl->pDirStruct, sal_True); + pEntry = osl_readdir_impl_(pDirImpl->pDirStruct, true); } if (NULL == pEntry) @@ -945,7 +945,7 @@ static int oslDoCopyFile(const sal_Char* pszSourceFileName, const sal_Char* pszD { size_t nToRead = std::min( sizeof(pBuffer), nRemains ); sal_uInt64 nRead; - sal_Bool succeeded; + bool succeeded; if ( osl_readFile( SourceFileFH, pBuffer, nToRead, &nRead ) != osl_File_E_None || nRead > nToRead || nRead == 0 ) break; diff --git a/sal/osl/unx/module.cxx b/sal/osl/unx/module.cxx index cc615bff7089..3020571b2a91 100644 --- a/sal/osl/unx/module.cxx +++ b/sal/osl/unx/module.cxx @@ -39,8 +39,8 @@ /* implemented in file.c */ extern "C" int UnicodeToText(char *, size_t, const sal_Unicode *, sal_Int32); -static sal_Bool getModulePathFromAddress(void * address, rtl_String ** path) { - sal_Bool result = sal_False; +static bool getModulePathFromAddress(void * address, rtl_String ** path) { + bool result = false; // We do want to have this functionality also in the // DISABLE_DYNLOADING case, I think? #if defined(AIX) @@ -90,22 +90,17 @@ static sal_Bool getModulePathFromAddress(void * address, rtl_String ** path) { Dl_info dl_info; #if defined(ANDROID) && !defined(DISABLE_DYNLOADING) - result = lo_dladdr(address, &dl_info); + result = lo_dladdr(address, &dl_info) != 0; #else - result = dladdr(address, &dl_info); + result = dladdr(address, &dl_info) != 0; #endif - if (result != 0) + if (result) { rtl_string_newFromStr(path, dl_info.dli_fname); #if defined(ANDROID) && !defined(DISABLE_DYNLOADING) free((void *) dl_info.dli_fname); #endif - result = sal_True; - } - else - { - result = sal_False; } #endif return result; @@ -304,7 +299,7 @@ osl_getFunctionSymbol(oslModule module, rtl_uString *puFunctionSymbolName) /*****************************************************************************/ sal_Bool SAL_CALL osl_getModuleURLFromAddress(void * addr, rtl_uString ** ppLibraryUrl) { - sal_Bool result = sal_False; + bool result = false; rtl_String * path = NULL; if (getModulePathFromAddress(addr, &path)) { @@ -326,11 +321,11 @@ sal_Bool SAL_CALL osl_getModuleURLFromAddress(void * addr, rtl_uString ** ppLibr osl_getAbsoluteFileURL(workDir, *ppLibraryUrl, ppLibraryUrl); rtl_uString_release(workDir); - result = sal_True; + result = true; } else { - result = sal_False; + result = false; } rtl_string_release(path); } diff --git a/sal/osl/unx/process.cxx b/sal/osl/unx/process.cxx index 24d0be6af678..a98e48a41186 100644 --- a/sal/osl/unx/process.cxx +++ b/sal/osl/unx/process.cxx @@ -905,10 +905,10 @@ struct osl_procStat unsigned long vm_lib; /* library size */ }; -sal_Bool osl_getProcStat(pid_t pid, struct osl_procStat* procstat) +bool osl_getProcStat(pid_t pid, struct osl_procStat* procstat) { int fd = 0; - sal_Bool bRet = sal_False; + bool bRet = false; char name[PATH_MAX + 1]; snprintf(name, sizeof(name), "/proc/%u/stat", pid); @@ -922,7 +922,7 @@ sal_Bool osl_getProcStat(pid_t pid, struct osl_procStat* procstat) close(fd); if (!bRet) - return sal_False; + return false; tmp = strrchr(prstatbuf, ')'); *tmp = '\0'; @@ -953,11 +953,11 @@ sal_Bool osl_getProcStat(pid_t pid, struct osl_procStat* procstat) return bRet; } -sal_Bool osl_getProcStatus(pid_t pid, struct osl_procStat* procstat) +bool osl_getProcStatus(pid_t pid, struct osl_procStat* procstat) { int fd = 0; char name[PATH_MAX + 1]; - sal_Bool bRet = sal_False; + bool bRet = false; snprintf(name, sizeof(name), "/proc/%u/status", pid); @@ -971,7 +971,7 @@ sal_Bool osl_getProcStatus(pid_t pid, struct osl_procStat* procstat) close(fd); if (!bRet) - return sal_False; + return false; tmp = strstr(prstatusbuf,"Uid:"); if(tmp) diff --git a/sal/osl/unx/uunxapi.hxx b/sal/osl/unx/uunxapi.hxx index f5fc477d3d1b..1a2fc4722feb 100644 --- a/sal/osl/unx/uunxapi.hxx +++ b/sal/osl/unx/uunxapi.hxx @@ -44,7 +44,7 @@ namespace osl @see realpath **********************************/ - inline sal_Bool realpath( + inline bool realpath( const rtl::OUString& ustrFileName, rtl::OUString& ustrResolvedName) { diff --git a/sal/qa/OStringBuffer/rtl_OStringBuffer.cxx b/sal/qa/OStringBuffer/rtl_OStringBuffer.cxx index 41477e92d56c..d81c463220a1 100644 --- a/sal/qa/OStringBuffer/rtl_OStringBuffer.cxx +++ b/sal/qa/OStringBuffer/rtl_OStringBuffer.cxx @@ -67,7 +67,7 @@ namespace rtl_OStringBuffer sal_Int32 nLenStrBuftmp = aStrBuftmp.getLength(); rtl::OString sStr(aStrBuftmp.getStr()); - sal_Bool res = aStrtmp.equals( sStr ); + bool res = aStrtmp.equals( sStr ); CPPUNIT_ASSERT_MESSAGE ( @@ -195,7 +195,7 @@ namespace rtl_OStringBuffer ::rtl::OStringBuffer aStrBuf1; ::rtl::OString aStr1; - sal_Bool lastRes = (aStrBuf1.makeStringAndClear() == aStr1 ); + bool lastRes = (aStrBuf1.makeStringAndClear() == aStr1 ); CPPUNIT_ASSERT_MESSAGE ( @@ -211,7 +211,7 @@ namespace rtl_OStringBuffer ::rtl::OStringBuffer aStrBuf2(26); ::rtl::OString aStr2; - sal_Bool lastRes = (aStrBuf2.makeStringAndClear() == aStr2 ); + bool lastRes = (aStrBuf2.makeStringAndClear() == aStr2 ); CPPUNIT_ASSERT_MESSAGE ( @@ -227,7 +227,7 @@ namespace rtl_OStringBuffer ::rtl::OStringBuffer aStrBuf3(*arrOUS[0]); ::rtl::OString aStr3(*arrOUS[0]); - sal_Bool lastRes = (aStrBuf3.makeStringAndClear() == aStr3 ); + bool lastRes = (aStrBuf3.makeStringAndClear() == aStr3 ); CPPUNIT_ASSERT_MESSAGE ( @@ -243,7 +243,7 @@ namespace rtl_OStringBuffer ::rtl::OStringBuffer aStrBuf4(*arrOUS[1]); ::rtl::OString aStr4(*arrOUS[1]); - sal_Bool lastRes = (aStrBuf4.makeStringAndClear() == aStr4 ); + bool lastRes = (aStrBuf4.makeStringAndClear() == aStr4 ); CPPUNIT_ASSERT_MESSAGE ( @@ -258,7 +258,7 @@ namespace rtl_OStringBuffer ::rtl::OStringBuffer aStrBuf5(*arrOUS[2]); ::rtl::OString aStr5(*arrOUS[2]); - sal_Bool lastRes = (aStrBuf5.makeStringAndClear() == aStr5 ); + bool lastRes = (aStrBuf5.makeStringAndClear() == aStr5 ); CPPUNIT_ASSERT_MESSAGE ( @@ -273,7 +273,7 @@ namespace rtl_OStringBuffer ::rtl::OStringBuffer aStrBuf6(*arrOUS[3]); ::rtl::OString aStr6(*arrOUS[3]); - sal_Bool lastRes = (aStrBuf6.makeStringAndClear() == aStr6 ); + bool lastRes = (aStrBuf6.makeStringAndClear() == aStr6 ); CPPUNIT_ASSERT_MESSAGE ( @@ -288,7 +288,7 @@ namespace rtl_OStringBuffer ::rtl::OStringBuffer aStrBuf7(*arrOUS[4]); ::rtl::OString aStr7(*arrOUS[4]); - sal_Bool lastRes = (aStrBuf7.makeStringAndClear() == aStr7 ); + bool lastRes = (aStrBuf7.makeStringAndClear() == aStr7 ); CPPUNIT_ASSERT_MESSAGE ( @@ -303,7 +303,7 @@ namespace rtl_OStringBuffer ::rtl::OStringBuffer aStrBuf8(*arrOUS[5]); ::rtl::OString aStr8(*arrOUS[5]); - sal_Bool lastRes = (aStrBuf8.makeStringAndClear() == aStr8 ); + bool lastRes = (aStrBuf8.makeStringAndClear() == aStr8 ); CPPUNIT_ASSERT_MESSAGE ( @@ -2760,7 +2760,7 @@ namespace rtl_OStringBuffer { OString expVal( kTestStr45 ); ::rtl::OStringBuffer aStrBuf( *arrOUS[0] ); - sal_Bool input = sal_True; + bool input = true; aStrBuf.append( input ); @@ -2776,7 +2776,7 @@ namespace rtl_OStringBuffer { OString expVal( kTestStr46 ); ::rtl::OStringBuffer aStrBuf( *arrOUS[0] ); - sal_Bool input = sal_False; + bool input = false; aStrBuf.append( input ); @@ -2792,7 +2792,7 @@ namespace rtl_OStringBuffer { OString expVal( kTestStr47 ); ::rtl::OStringBuffer aStrBuf( *arrOUS[1] ); - sal_Bool input = sal_True; + bool input = true; aStrBuf.append( input ); @@ -2808,7 +2808,7 @@ namespace rtl_OStringBuffer { OString expVal( kTestStr48 ); ::rtl::OStringBuffer aStrBuf( *arrOUS[1] ); - sal_Bool input = sal_False; + bool input = false; aStrBuf.append( input ); @@ -2824,7 +2824,7 @@ namespace rtl_OStringBuffer { OString expVal( kTestStr47 ); ::rtl::OStringBuffer aStrBuf( *arrOUS[2] ); - sal_Bool input = sal_True; + bool input = true; aStrBuf.append( input ); @@ -2840,7 +2840,7 @@ namespace rtl_OStringBuffer { OString expVal( kTestStr48 ); ::rtl::OStringBuffer aStrBuf( *arrOUS[2] ); - sal_Bool input = sal_False; + bool input = false; aStrBuf.append( input ); @@ -2856,7 +2856,7 @@ namespace rtl_OStringBuffer { OString expVal( kTestStr47 ); ::rtl::OStringBuffer aStrBuf( *arrOUS[3] ); - sal_Bool input = sal_True; + bool input = true; aStrBuf.append( input ); @@ -2872,7 +2872,7 @@ namespace rtl_OStringBuffer { OString expVal( kTestStr48 ); ::rtl::OStringBuffer aStrBuf( *arrOUS[3] ); - sal_Bool input = sal_False; + bool input = false; aStrBuf.append( input ); @@ -2888,7 +2888,7 @@ namespace rtl_OStringBuffer { OString expVal( kTestStr49 ); ::rtl::OStringBuffer aStrBuf( *arrOUS[4] ); - sal_Bool input = sal_True; + bool input = true; aStrBuf.append( input ); @@ -2904,7 +2904,7 @@ namespace rtl_OStringBuffer { OString expVal( kTestStr50 ); ::rtl::OStringBuffer aStrBuf( *arrOUS[4] ); - sal_Bool input = sal_False; + bool input = false; aStrBuf.append( input ); @@ -14224,7 +14224,7 @@ namespace rtl_OStringBuffer aStrBuf.append( input ); - sal_Bool bRes = expVal.equals( aStrBuf.getStr() ); + bool bRes = expVal.equals( aStrBuf.getStr() ); CPPUNIT_ASSERT_MESSAGE ( "input Int64 -9223372036854775808 and return OStringBuffer[0]+(-9223372036854775808)", diff --git a/sal/qa/OStringBuffer/rtl_String_Utils.cxx b/sal/qa/OStringBuffer/rtl_String_Utils.cxx index 53a1f18a575f..1b5cf71c7d0b 100644 --- a/sal/qa/OStringBuffer/rtl_String_Utils.cxx +++ b/sal/qa/OStringBuffer/rtl_String_Utils.cxx @@ -78,7 +78,7 @@ sal_Char* cpynstr( sal_Char* dst, const sal_Char* src, sal_uInt32 cnt ) } //------------------------------------------------------------------------ -sal_Bool cmpstr( const sal_Char* str1, const sal_Char* str2, sal_uInt32 len ) +bool cmpstr( const sal_Char* str1, const sal_Char* str2, sal_uInt32 len ) { const sal_Char* pBuf1 = str1; const sal_Char* pBuf2 = str2; @@ -93,11 +93,11 @@ sal_Bool cmpstr( const sal_Char* str1, const sal_Char* str2, sal_uInt32 len ) return( i == len ); } //----------------------------------------------------------------------- -sal_Bool cmpstr( const sal_Char* str1, const sal_Char* str2 ) +bool cmpstr( const sal_Char* str1, const sal_Char* str2 ) { const sal_Char* pBuf1 = str1; const sal_Char* pBuf2 = str2; - sal_Bool res = sal_True; + bool res = true; while ( (*pBuf1 == *pBuf2) && *pBuf1 !='\0' && *pBuf2 != '\0') { @@ -105,13 +105,13 @@ sal_Bool cmpstr( const sal_Char* str1, const sal_Char* str2 ) (pBuf2)++; } if (*pBuf1 == '\0' && *pBuf2 == '\0') - res = sal_True; + res = true; else - res = sal_False; + res = false; return (res); } //------------------------------------------------------------------------ -sal_Bool cmpustr( const sal_Unicode* str1, const sal_Unicode* str2, sal_uInt32 len ) +bool cmpustr( const sal_Unicode* str1, const sal_Unicode* str2, sal_uInt32 len ) { const sal_Unicode* pBuf1 = str1; const sal_Unicode* pBuf2 = str2; @@ -127,11 +127,11 @@ sal_Bool cmpustr( const sal_Unicode* str1, const sal_Unicode* str2, sal_uInt32 l } //----------------------------------------------------------------------- -sal_Bool cmpustr( const sal_Unicode* str1, const sal_Unicode* str2 ) +bool cmpustr( const sal_Unicode* str1, const sal_Unicode* str2 ) { const sal_Unicode* pBuf1 = str1; const sal_Unicode* pBuf2 = str2; - sal_Bool res = sal_True; + bool res = true; while ( (*pBuf1 == *pBuf2) && *pBuf1 !='\0' && *pBuf2 != '\0') { @@ -139,9 +139,9 @@ sal_Bool cmpustr( const sal_Unicode* str1, const sal_Unicode* str2 ) (pBuf2)++; } if (*pBuf1 == '\0' && *pBuf2 == '\0') - res = sal_True; + res = true; else - res = sal_False; + res = false; return (res); } diff --git a/sal/qa/OStringBuffer/rtl_String_Utils.hxx b/sal/qa/OStringBuffer/rtl_String_Utils.hxx index a824ef9f5270..75e0bf6a9d4a 100644 --- a/sal/qa/OStringBuffer/rtl_String_Utils.hxx +++ b/sal/qa/OStringBuffer/rtl_String_Utils.hxx @@ -32,10 +32,10 @@ sal_Char* cpystr( sal_Char* dst, const sal_Char* src ); sal_Char* cpynstr( sal_Char* dst, const sal_Char* src, sal_uInt32 cnt ); -sal_Bool cmpstr( const sal_Char* str1, const sal_Char* str2, sal_uInt32 len ); -sal_Bool cmpstr( const sal_Char* str1, const sal_Char* str2 ); -sal_Bool cmpustr( const sal_Unicode* str1, const sal_Unicode* str2, sal_uInt32 len ); -sal_Bool cmpustr( const sal_Unicode* str1, const sal_Unicode* str2 ); +bool cmpstr( const sal_Char* str1, const sal_Char* str2, sal_uInt32 len ); +bool cmpstr( const sal_Char* str1, const sal_Char* str2 ); +bool cmpustr( const sal_Unicode* str1, const sal_Unicode* str2, sal_uInt32 len ); +bool cmpustr( const sal_Unicode* str1, const sal_Unicode* str2 ); sal_Char* createName( sal_Char* dst, const sal_Char* src, sal_uInt32 cnt ); @@ -44,7 +44,7 @@ sal_uInt32 AStringLen( const sal_Char *pAStr ); //------------------------------------------------------------------------ -sal_Bool AStringNIsValid( const sal_Char *pAStr, +bool AStringNIsValid( const sal_Char *pAStr, const sal_uInt32 nStrLen ); diff --git a/sal/qa/osl/condition/osl_Condition.cxx b/sal/qa/osl/condition/osl_Condition.cxx index ab51d83ff586..470ffaf4dae4 100644 --- a/sal/qa/osl/condition/osl_Condition.cxx +++ b/sal/qa/osl/condition/osl_Condition.cxx @@ -34,10 +34,10 @@ using namespace rtl; /** print Boolean value. */ -inline void printBool( sal_Bool bOk ) +inline void printBool( bool bOk ) { printf("#printBool# " ); - ( sal_True == bOk ) ? printf("TRUE!\n" ): printf("FALSE!\n" ); + bOk ? printf("TRUE!\n" ): printf("FALSE!\n" ); } /** print a UNI_CODE String. @@ -106,7 +106,7 @@ namespace osl_Condition class ctors : public CppUnit::TestFixture { public: - sal_Bool bRes, bRes1; + bool bRes, bRes1; void ctors_001( ) { @@ -114,7 +114,7 @@ namespace osl_Condition bRes = aCond.check( ); CPPUNIT_ASSERT_MESSAGE( "#test comment#: create a condition its initial check state should be sal_False.", - sal_False == bRes ); + !bRes ); } void ctors_002( ) @@ -124,7 +124,7 @@ namespace osl_Condition bRes = aCond.check( ); CPPUNIT_ASSERT_MESSAGE( "#test comment#: create a condition and set it.", - sal_True == bRes ); + bRes ); } CPPUNIT_TEST_SUITE( ctors ); @@ -140,7 +140,7 @@ namespace osl_Condition class set : public CppUnit::TestFixture { public: - sal_Bool bRes, bRes1, bRes2; + bool bRes, bRes1, bRes2; void set_001( ) { @@ -149,7 +149,7 @@ namespace osl_Condition bRes = aCond.check( ); CPPUNIT_ASSERT_MESSAGE( "#test comment#: check state should be sal_True after set.", - sal_True == bRes ); + bRes ); } void set_002( ) @@ -168,7 +168,7 @@ namespace osl_Condition myThread2.join( ); CPPUNIT_ASSERT_MESSAGE( "#test comment#: use one thread to set the condition in order to release another thread.", - sal_True == bRes && sal_False == bRes1 && sal_True == bRes2 ); + bRes && !bRes1 && bRes2 ); } @@ -185,7 +185,7 @@ namespace osl_Condition class reset : public CppUnit::TestFixture { public: - sal_Bool bRes, bRes1, bRes2; + bool bRes, bRes1, bRes2; void reset_001( ) { @@ -202,7 +202,7 @@ namespace osl_Condition bRes1 = myThread.isRunning( ); CPPUNIT_ASSERT_MESSAGE( "#test comment#: wait will cause a reset thread block, use set to release it.", - sal_True == bRes && sal_False == bRes1 && sal_False == bRes2 ); + bRes && !bRes1 && !bRes2 ); } void reset_002( ) @@ -214,7 +214,7 @@ namespace osl_Condition bRes1 = aCond.check( ); CPPUNIT_ASSERT_MESSAGE( "#test comment#: create a condition and reset/set it.", - ( sal_False == bRes && sal_True == bRes1 ) ); + !bRes && bRes1 ); } CPPUNIT_TEST_SUITE( reset ); @@ -230,7 +230,7 @@ namespace osl_Condition class wait : public CppUnit::TestFixture { public: - sal_Bool bRes, bRes1, bRes2; + bool bRes, bRes1, bRes2; TimeValue *tv1; void setUp( ) @@ -280,7 +280,7 @@ namespace osl_Condition bRes1 = aCond.check( ); CPPUNIT_ASSERT_MESSAGE( "#test comment#: wait a condition after set/reset.", - ( sal_False == bRes ) && ( sal_True == bRes1 ) && + !bRes && bRes1 && ( ::osl::Condition::result_timeout == wRes ) && ( ::osl::Condition::result_ok == wRes1 ) ); } @@ -298,7 +298,7 @@ namespace osl_Condition class check : public CppUnit::TestFixture { public: - sal_Bool bRes, bRes1, bRes2; + bool bRes, bRes1, bRes2; void check_001( ) { @@ -310,7 +310,7 @@ namespace osl_Condition bRes1 = aCond.check( ); CPPUNIT_ASSERT_MESSAGE( "#test comment#: check the condition states.", - ( sal_False == bRes && sal_True == bRes1 ) ); + !bRes && bRes1 ); } void check_002( ) @@ -329,7 +329,7 @@ namespace osl_Condition bRes1 = aCond.check( ); CPPUNIT_ASSERT_MESSAGE( "#test comment#: use threads to set/reset Condition and check it in main routine.", - ( sal_True == bRes && sal_False == bRes1 ) ); + bRes && !bRes1 ); } CPPUNIT_TEST_SUITE( check ); diff --git a/sal/qa/osl/file/osl_File.cxx b/sal/qa/osl/file/osl_File.cxx index b682500bbf59..48fab3d84afd 100644 --- a/sal/qa/osl/file/osl_File.cxx +++ b/sal/qa/osl/file/osl_File.cxx @@ -194,10 +194,10 @@ inline void printInt( sal_uInt64 i ) /** print Boolean value. */ -inline void printBool( sal_Bool bOk ) +inline void printBool( bool bOk ) { printf( "#printBool# " ); - ( sal_True == bOk ) ? printf( "YES!\n" ): printf( "NO!\n" ); + bOk ? printf( "YES!\n" ): printf( "NO!\n" ); } /** print struct TimeValue in local time format. @@ -254,7 +254,7 @@ inline sal_Int64 t_abs64(sal_Int64 _nValue) return _nValue; } -inline sal_Bool t_compareTime( TimeValue *m_aEndTime, TimeValue *m_aStartTime, sal_Int32 nDelta) +inline bool t_compareTime( TimeValue *m_aEndTime, TimeValue *m_aStartTime, sal_Int32 nDelta) { // sal_uInt64 uTimeValue; // sal_Int64 iTimeValue; @@ -276,9 +276,9 @@ inline sal_Bool t_compareTime( TimeValue *m_aEndTime, TimeValue *m_aStartTime, /** compare two OUString file name. */ -inline sal_Bool compareFileName( const ::rtl::OUString & ustr1, const ::rtl::OUString & ustr2 ) +inline bool compareFileName( const ::rtl::OUString & ustr1, const ::rtl::OUString & ustr2 ) { - sal_Bool bOk; + bool bOk; //on Windows, the separator is '\', so here change to '/', then compare #if defined (WNT ) ::rtl::OUString ustr1new,ustr2new; @@ -301,11 +301,11 @@ inline sal_Bool compareFileName( const ::rtl::OUString & ustr1, const ::rtl::OUS /** compare a OUString and an ASCII file name. */ -inline sal_Bool compareFileName( const ::rtl::OUString & ustr, const sal_Char *astr ) +inline bool compareFileName( const ::rtl::OUString & ustr, const sal_Char *astr ) { (void)ustr; ::rtl::OUString ustr1 = rtl::OUString::createFromAscii( astr ); - sal_Bool bOk = ustr1.equalsIgnoreAsciiCase( ustr1 ); // TODO: does it really compare with the same var? + bool bOk = ustr1.equalsIgnoreAsciiCase( ustr1 ); // TODO: does it really compare with the same var? return bOk; } @@ -313,7 +313,7 @@ inline sal_Bool compareFileName( const ::rtl::OUString & ustr, const sal_Char *a /** simple version to judge if a file name or directory name is a URL or a system path, just to see if it is start with "file:///";. */ -inline sal_Bool isURL( const sal_Char *pathname ) +inline bool isURL( const sal_Char *pathname ) { return ( 0 == strncmp( pathname, FILE_PREFIX, sizeof( FILE_PREFIX ) - 1 ) ); } @@ -469,13 +469,13 @@ typedef enum { } oslCheckMode; // not used here -inline sal_Bool checkFile( const ::rtl::OUString & str, oslCheckMode nCheckMode ) +inline bool checkFile( const ::rtl::OUString & str, oslCheckMode nCheckMode ) { ::osl::FileBase::RC nError1, nError2; ::osl::File testFile( str ); - sal_Bool bCheckResult; + bool bCheckResult; - bCheckResult = sal_False; + bCheckResult = false; nError1 = testFile.open ( osl_File_OpenFlag_Read ); if ( ( ::osl::FileBase::E_NOENT != nError1 ) && ( ::osl::FileBase::E_ACCES != nError1 ) ){ @@ -483,12 +483,12 @@ inline sal_Bool checkFile( const ::rtl::OUString & str, oslCheckMode nCheckMode case osl_Check_Mode_Exist: /// check if the file is exist. if ( ::osl::FileBase::E_None == nError1 ) - bCheckResult = sal_True; + bCheckResult = true; break; case osl_Check_Mode_OpenAccess: /// check if the file is openable. if ( ::osl::FileBase::E_None == nError1 ) - bCheckResult = sal_True; + bCheckResult = true; break; case osl_Check_Mode_WriteAccess: /// check the file name and whether it can be written. @@ -496,11 +496,11 @@ inline sal_Bool checkFile( const ::rtl::OUString & str, oslCheckMode nCheckMode sal_uInt64 nCount_write; nError2 = testFile.write( pBuffer_Char, 10, nCount_write ); if ( ::osl::FileBase::E_None == nError2 ) - bCheckResult = sal_True; + bCheckResult = true; break; default: - bCheckResult = sal_False; + bCheckResult = false; }/// swith nError2 = testFile.close(); @@ -512,16 +512,16 @@ inline sal_Bool checkFile( const ::rtl::OUString & str, oslCheckMode nCheckMode } //check if the file exist -inline sal_Bool ifFileExist( const ::rtl::OUString & str ) +inline bool ifFileExist( const ::rtl::OUString & str ) { ::osl::File testFile( str ); return ( osl::FileBase::E_None == testFile.open( osl_File_OpenFlag_Read ) ); } //check if the file can be written -inline sal_Bool ifFileCanWrite( const ::rtl::OUString & str ) +inline bool ifFileCanWrite( const ::rtl::OUString & str ) { - sal_Bool bCheckResult = sal_False; + bool bCheckResult = false; //on Windows, the file has no write right, but can be written #ifdef WNT ::rtl::OUString aUStr = str.copy( 0 ); @@ -540,12 +540,12 @@ inline sal_Bool ifFileCanWrite( const ::rtl::OUString & str ) return bCheckResult; } -inline sal_Bool checkDirectory( const ::rtl::OUString & str, oslCheckMode nCheckMode ) +inline bool checkDirectory( const ::rtl::OUString & str, oslCheckMode nCheckMode ) { rtl::OUString aUString; DirectoryItem rItem; FileBase::RC rc; - sal_Bool bCheckResult= sal_False; + bool bCheckResult= false; //::std::auto_ptr<Directory> pDir( new Directory( str ) ); Directory aDir( str ); @@ -556,36 +556,36 @@ inline sal_Bool checkDirectory( const ::rtl::OUString & str, oslCheckMode nCheck switch ( nCheckMode ) { case osl_Check_Mode_Exist: if ( rc == ::osl::FileBase::E_None ) - bCheckResult = sal_True; + bCheckResult = true; break; case osl_Check_Mode_OpenAccess: if ( rc == ::osl::FileBase::E_None ) - bCheckResult = sal_True; + bCheckResult = true; break; case osl_Check_Mode_ReadAccess: //rc = pDir->getNextItem( rItem, 0 ); rc = aDir.getNextItem( rItem, 0 ); if ( ( rc == ::osl::FileBase::E_None ) || ( rc == ::osl::FileBase::E_NOENT ) ) - bCheckResult = sal_True; + bCheckResult = true; else - bCheckResult = sal_False; + bCheckResult = false; break; case osl_Check_Mode_WriteAccess: ( ( aUString += str ) += aSlashURL ) += aTmpName2; //if ( ( rc = pDir->create( aUString ) ) == ::osl::FileBase::E_None ) if ( ( rc = Directory::create( aUString ) ) == ::osl::FileBase::E_None ) { - bCheckResult = sal_True; + bCheckResult = true; //rc = pDir->remove( aUString ); rc = Directory::remove( aUString ); CPPUNIT_ASSERT( rc == ::osl::FileBase::E_None ); } else - bCheckResult = sal_False; + bCheckResult = false; break; default: - bCheckResult = sal_False; + bCheckResult = false; }// switch rc = aDir.close(); @@ -701,8 +701,8 @@ namespace osl_FileBase CPPUNIT_ASSERT_MESSAGE( "Assumption is wrong: error number is wrong", nError == _nAssumeError ); if ( nError == ::osl::FileBase::E_None ) { - sal_Bool bStrAreEqual = _suAssumeResultStr.equals( suResultURL ); - CPPUNIT_ASSERT_MESSAGE( "Assumption is wrong: ResultURL is not equal to expected URL ", bStrAreEqual == sal_True ); + bool bStrAreEqual = _suAssumeResultStr.equals( suResultURL ); + CPPUNIT_ASSERT_MESSAGE( "Assumption is wrong: ResultURL is not equal to expected URL ", bStrAreEqual ); } } @@ -813,7 +813,7 @@ namespace osl_FileBase // ::osl::FileBase::RC nError; //void check_getSystemPathFromFileURL(rtl::OString const& _sURL, ::osl::FileBase::RC _nAssumeError, rtl::OString const& _sAssumeResultStr); - void check_SystemPath_FileURL(rtl::OString const& _sSource, ::osl::FileBase::RC _nAssumeError, rtl::OString const& _sAssumeResultStr, sal_Bool bDirection = sal_True ); + void check_SystemPath_FileURL(rtl::OString const& _sSource, ::osl::FileBase::RC _nAssumeError, rtl::OString const& _sAssumeResultStr, bool bDirection = true ); void checkWNTBehaviour_getSystemPathFromFileURL(rtl::OString const& _sURL, ::osl::FileBase::RC _nAssumeError, rtl::OString const& _sWNTAssumeResultString ); void checkUNXBehaviour_getSystemPathFromFileURL(rtl::OString const& _sURL, ::osl::FileBase::RC _nAssumeError, rtl::OString const& _sUnixAssumeResultString ); void checkWNTBehaviour_getFileURLFromSystemPath(rtl::OString const& _sSysPath, ::osl::FileBase::RC _nAssumeError, rtl::OString const& _sWNTAssumeResultString); @@ -887,14 +887,14 @@ namespace osl_FileBase // if bDirection==sal_True, check getSystemPathFromFileURL // if bDirection==sal_False, check getFileURLFromSystemPath - void SystemPath_FileURL::check_SystemPath_FileURL(rtl::OString const& _sSource, ::osl::FileBase::RC _nAssumeError, rtl::OString const& _sAssumeResultStr, sal_Bool bDirection) + void SystemPath_FileURL::check_SystemPath_FileURL(rtl::OString const& _sSource, ::osl::FileBase::RC _nAssumeError, rtl::OString const& _sAssumeResultStr, bool bDirection) { // PRE: URL as String rtl::OUString suSource; rtl::OUString suStr; suSource = rtl::OStringToOUString(_sSource, RTL_TEXTENCODING_UTF8); ::osl::FileBase::RC nError; - if ( bDirection == sal_True ) + if ( bDirection ) nError = osl::FileBase::getSystemPathFromFileURL( suSource, suStr ); else nError = osl::FileBase::getFileURLFromSystemPath( suSource, suStr ); @@ -903,7 +903,7 @@ namespace osl_FileBase // we check also this string rtl::OString sStr = rtl::OUStringToOString(suStr, RTL_TEXTENCODING_UTF8); rtl::OString sError = errorToString(nError); - if ( bDirection == sal_True ) + if ( bDirection ) printf("getSystemPathFromFileURL('%s') deliver system path: '%s', error '%s'\n", _sSource.getStr(), sStr.getStr(), sError.getStr() ); else printf("getFileURLFromSystemPath('%s') deliver File URL: '%s', error '%s'\n", _sSource.getStr(), sStr.getStr(), sError.getStr() ); @@ -914,9 +914,9 @@ namespace osl_FileBase if (!_sAssumeResultStr.isEmpty()) { - sal_Bool bStrAreEqual = _sAssumeResultStr.equals(sStr); + bool bStrAreEqual = _sAssumeResultStr.equals(sStr); CPPUNIT_ASSERT_MESSAGE( "Assumption is wrong", - nError == _nAssumeError && bStrAreEqual == sal_True ); + nError == _nAssumeError && bStrAreEqual ); } else { @@ -959,7 +959,7 @@ namespace osl_FileBase void SystemPath_FileURL::checkUNXBehaviour_getFileURLFromSystemPath(rtl::OString const& _sSysPath, ::osl::FileBase::RC _nAssumeError, rtl::OString const& _sUnixAssumeResultString) { #if ( defined UNX ) - check_SystemPath_FileURL(_sSysPath, _nAssumeError, _sUnixAssumeResultString, sal_False ); + check_SystemPath_FileURL(_sSysPath, _nAssumeError, _sUnixAssumeResultString, false ); #else (void)_sSysPath; (void)_nAssumeError; @@ -1119,7 +1119,7 @@ namespace osl_FileBase ::rtl::OUString aUResultURL ( aSysPath4 ); ::osl::FileBase::RC nError = osl::FileBase::getSystemPathFromFileURL( aUNormalURL, aUStr ); - sal_Bool bOk = compareFileName( aUStr, aUResultURL ); + bool bOk = compareFileName( aUStr, aUResultURL ); ::rtl::OString sError("test for getSystemPathFromFileURL(' "); sError += ::rtl::OUStringToOString( aUNormalURL, RTL_TEXTENCODING_ASCII_US ); @@ -1127,7 +1127,7 @@ namespace osl_FileBase sError += outputError(::rtl::OUStringToOString( aUStr, RTL_TEXTENCODING_ASCII_US ), ::rtl::OUStringToOString( aUResultURL, RTL_TEXTENCODING_ASCII_US )); - CPPUNIT_ASSERT_MESSAGE(sError.getStr(), ( osl::FileBase::E_None == nError ) && ( sal_True == bOk ) ); + CPPUNIT_ASSERT_MESSAGE(sError.getStr(), ( osl::FileBase::E_None == nError ) && bOk ); } @@ -1141,7 +1141,7 @@ namespace osl_FileBase ::osl::FileBase::RC nError = osl::FileBase::getSystemPathFromFileURL( aUNormalURL, aUStr ); - sal_Bool bOk = compareFileName( aUStr, aUResultURL ); + bool bOk = compareFileName( aUStr, aUResultURL ); ::rtl::OString sError("test for getSystemPathFromFileURL(' "); sError += ::rtl::OUStringToOString( aUNormalURL, RTL_TEXTENCODING_ASCII_US ); @@ -1150,7 +1150,7 @@ namespace osl_FileBase ::rtl::OUStringToOString( aUResultURL, RTL_TEXTENCODING_ASCII_US )); deleteTestDirectory( aTmpName10 ); - CPPUNIT_ASSERT_MESSAGE( sError.getStr(), ( osl::FileBase::E_None == nError ) && ( sal_True == bOk ) ); + CPPUNIT_ASSERT_MESSAGE( sError.getStr(), ( osl::FileBase::E_None == nError ) && bOk ); } void SystemPath_FileURL::getFileURLFromSystemPath_001() @@ -1232,17 +1232,17 @@ namespace osl_FileBase { /* search file is passed by system filename */ nError1 = ::osl::FileBase::searchFileURL( aTempDirectorySys, aRootSys, aUStr ); - sal_Bool bOk1 = compareFileName( aUStr, aTempDirectoryURL ); + bool bOk1 = compareFileName( aUStr, aTempDirectoryURL ); /* search file is passed by full qualified file URL */ nError2 = ::osl::FileBase::searchFileURL( aTempDirectoryURL, aRootSys, aUStr ); - sal_Bool bOk2 = compareFileName( aUStr, aTempDirectoryURL ); + bool bOk2 = compareFileName( aUStr, aTempDirectoryURL ); /* search file is passed by relative file path */ nError3 = ::osl::FileBase::searchFileURL( aRelURL5, aRootSys, aUStr ); - sal_Bool bOk3 = compareFileName( aUStr, aTempDirectoryURL ); + bool bOk3 = compareFileName( aUStr, aTempDirectoryURL ); /* search file is passed by an exist file */ createTestFile( aCanURL1 ); nError4 = ::osl::FileBase::searchFileURL( aCanURL4, aUserDirectorySys, aUStr ); - sal_Bool bOk4 = compareFileName( aUStr, aCanURL1 ); + bool bOk4 = compareFileName( aUStr, aCanURL1 ); deleteTestFile( aCanURL1 ); CPPUNIT_ASSERT_MESSAGE( "test for searchFileURL function: system filename/URL filename/relative path, system directory, searched file already exist.", @@ -1250,10 +1250,7 @@ namespace osl_FileBase ( osl::FileBase::E_None == nError2 ) && ( osl::FileBase::E_None == nError3 ) && ( osl::FileBase::E_None == nError4 ) && - ( sal_True == bOk1 ) && - ( sal_True == bOk2 ) && - ( sal_True == bOk3 ) && - ( sal_True == bOk4 ) ); + bOk1 && bOk2 && bOk3 && bOk4 ); } @@ -1261,29 +1258,29 @@ namespace osl_FileBase { OSLTEST_DECLARE( SystemPathList, TEST_PLATFORM_ROOT ":" TEST_PLATFORM_ROOT TEST_PLATFORM_TEMP ":" TEST_PLATFORM_ROOT "system/path" ); nError1 = ::osl::FileBase::searchFileURL( aUserDirectoryURL, aSystemPathList, aUStr ); - sal_Bool bOk = compareFileName( aUStr, aUserDirectoryURL ); + bool bOk = compareFileName( aUStr, aUserDirectoryURL ); CPPUNIT_ASSERT_MESSAGE( "test for searchFileURL function: search directory is a list of system paths", ( osl::FileBase::E_None == nError1 ) && - ( sal_True == bOk ) ); + bOk ); } void searchFileURL_004() { OSLTEST_DECLARE( SystemPathList, TEST_PLATFORM_ROOT PATH_LIST_DELIMITER TEST_PLATFORM_ROOT TEST_PLATFORM_TEMP PATH_LIST_DELIMITER TEST_PLATFORM_ROOT "system/path/../name" ); nError1 = ::osl::FileBase::searchFileURL( aUserDirectoryURL, aSystemPathList, aUStr ); - sal_Bool bOk = compareFileName( aUStr, aUserDirectoryURL ); + bool bOk = compareFileName( aUStr, aUserDirectoryURL ); CPPUNIT_ASSERT_MESSAGE( "test for searchFileURL function: search directory is a list of system paths", ( osl::FileBase::E_None == nError1 ) && - ( sal_True == bOk ) ); + bOk ); } void searchFileURL_005() { nError1 = ::osl::FileBase::searchFileURL( aUserDirectoryURL, aNullURL, aUStr ); - sal_Bool bOk = compareFileName( aUStr, aUserDirectoryURL ); + bool bOk = compareFileName( aUStr, aUserDirectoryURL ); CPPUNIT_ASSERT_MESSAGE( "test for searchFileURL function: search directory is NULL", ( osl::FileBase::E_None == nError1 ) && - ( sal_True == bOk ) ); + bOk ); } CPPUNIT_TEST_SUITE( searchFileURL ); @@ -1351,7 +1348,7 @@ namespace osl_FileBase { //::osl::FileBase aFileBase; ::osl::FileBase::RC nError1, nError2; - sal_Bool bOK; + bool bOK; oslFileHandle *pHandle; ::rtl::OUString *pUStr_DirURL; @@ -1393,7 +1390,7 @@ namespace osl_FileBase void createTempFile_002() { - bOK = sal_False; + bOK = false; nError1 = FileBase::createTempFile( pUStr_DirURL, pHandle, pUStr_FileURL ); ::osl::File testFile( *pUStr_FileURL ); nError2 = testFile.open( osl_File_OpenFlag_Create ); @@ -1410,7 +1407,7 @@ namespace osl_FileBase } CPPUNIT_ASSERT_MESSAGE( "test for open and write access rights, in (W32), it did not have write access right, but it should be writtenable.", - ( sal_True == bOK ) ); + bOK ); } void createTempFile_003() @@ -1418,11 +1415,11 @@ namespace osl_FileBase nError1 = FileBase::createTempFile( pUStr_DirURL, pHandle, 0 ); //the temp file will be removed when return from createTempFile bOK = (pHandle != NULL && nError1 == osl::FileBase::E_None); - if ( sal_True == bOK ) + if ( bOK ) osl_closeFile( *pHandle ); CPPUNIT_ASSERT_MESSAGE( "test for createTempFile function: set pUStrFileURL to 0 to let it remove the file after call.", - ( ::osl::FileBase::E_None == nError1 ) &&( sal_True == bOK ) ); + ( ::osl::FileBase::E_None == nError1 ) && bOK ); } void createTempFile_004() { @@ -1432,7 +1429,7 @@ namespace osl_FileBase nError2 = testFile.open( osl_File_OpenFlag_Create ); deleteTestFile( *pUStr_FileURL ); CPPUNIT_ASSERT_MESSAGE( "createTempFile function: create a temp file, but it does not exist", - ( osl::FileBase::E_None == nError1 ) && ( osl::FileBase::E_EXIST == nError2 ) &&( sal_True == bOK ) ); + ( osl::FileBase::E_None == nError1 ) && ( osl::FileBase::E_EXIST == nError2 ) && bOK ); } @@ -1495,7 +1492,7 @@ namespace osl_VolumeInfo CPPUNIT_ASSERT_MESSAGE( "test for ctors function: mask is empty", ( 0 == uiTotalSpace ) && ( 0 == uiMaxPathLength ) && - sal_True == compareFileName( aUStr, aNullURL ) ); + compareFileName( aUStr, aNullURL ) ); } #if ( defined UNX ) @@ -1514,7 +1511,7 @@ namespace osl_VolumeInfo CPPUNIT_ASSERT_MESSAGE( "test for ctors function: mask is specified as certain valid fields, and get the masked fields", ( 0 != uiTotalSpace ) && ( 0 != uiUsedSpace ) && - sal_True == compareFileName( aUStr, "nfs" ) ); + compareFileName( aUStr, "nfs" ) ); } #else /// Windows version,here we can not determine whichvolume in Windows is serve as an nfs volume. void ctors_002() @@ -1546,7 +1543,7 @@ namespace osl_VolumeInfo CPPUNIT_ASSERT_MESSAGE( "test for ctors function: mask is specified as certain valid fields, but get unmasked fields, use mask to FreeSpace, but I can get TotalSpace, did not pass in (UNX)(W32)", ( 0 == uiTotalSpace1 ) && ( 0 != uiTotalSpace2 ) && - sal_True == compareFileName( aUStr, aNullURL ) ); + compareFileName( aUStr, aNullURL ) ); } CPPUNIT_TEST_SUITE( ctors ); @@ -1619,14 +1616,14 @@ namespace osl_VolumeInfo ::osl::VolumeInfo aVolumeInfo( mask ); nError1 = ::osl::Directory::getVolumeInfo( aVolURL1, aVolumeInfo ); CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 ); - sal_Bool bOk1 = aVolumeInfo.isValid( mask ); + bool bOk1 = aVolumeInfo.isValid( mask ); nError1 = ::osl::Directory::getVolumeInfo( aVolURL2, aVolumeInfo ); CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 ); - sal_Bool bOk2 = aVolumeInfo.isValid( mask ); + bool bOk2 = aVolumeInfo.isValid( mask ); CPPUNIT_ASSERT_MESSAGE( "test for isValid function: osl_VolumeInfo_Mask_Attributes, it should be valid for some volume such as /, floppy, cdrom, etc. but it did not pass", - ( sal_True == bOk1 ) && ( sal_True == bOk2 ) ); + bOk1 && bOk2 ); } CPPUNIT_TEST_SUITE( isValid ); @@ -1655,10 +1652,10 @@ namespace osl_VolumeInfo ::osl::VolumeInfo aVolumeInfo( mask ); nError1 = ::osl::Directory::getVolumeInfo( aVolURL1, aVolumeInfo ); CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 ); - sal_Bool bOk = aVolumeInfo.getRemoteFlag(); + bool bOk = aVolumeInfo.getRemoteFlag(); CPPUNIT_ASSERT_MESSAGE( "test for getRemoteFlag function: get a volume device which is not remote.", - ( sal_False == bOk ) ); + !bOk ); } #if ( defined UNX ) //remote Volume is different in Solaris and Windows @@ -1668,10 +1665,10 @@ namespace osl_VolumeInfo ::osl::VolumeInfo aVolumeInfo( mask ); nError1 = ::osl::Directory::getVolumeInfo( aVolURL4, aVolumeInfo ); CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 ); - sal_Bool bOk = aVolumeInfo.getRemoteFlag(); + bool bOk = aVolumeInfo.getRemoteFlag(); CPPUNIT_ASSERT_MESSAGE( "test for getRemoteFlag function: get a volume device which is remote( Solaris version ).", - ( sal_True == bOk ) ); + bOk ); } #else //Windows version void getRemoteFlag_002() @@ -1704,10 +1701,10 @@ namespace osl_VolumeInfo ::osl::VolumeInfo aVolumeInfo( mask ); nError1 = ::osl::Directory::getVolumeInfo( aVolURL1, aVolumeInfo ); CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 ); - sal_Bool bOk = aVolumeInfo.getRemoveableFlag(); + bool bOk = aVolumeInfo.getRemoveableFlag(); CPPUNIT_ASSERT_MESSAGE( "test for getRemoveableFlag function: get a volume device which is not removable.", - sal_False == bOk ); + !bOk ); } void getRemoveableFlag_002() @@ -1716,10 +1713,10 @@ namespace osl_VolumeInfo ::osl::VolumeInfo aVolumeInfo( mask ); nError1 = ::osl::Directory::getVolumeInfo( aVolURL2, aVolumeInfo ); CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 ); - sal_Bool bOk = aVolumeInfo.getRemoveableFlag(); + bool bOk = aVolumeInfo.getRemoveableFlag(); CPPUNIT_ASSERT_MESSAGE( "test for getRemoveableFlag function: get a volume device which is removable, not sure, here we use floppy disk, but it did not pass.", - sal_True == bOk ); + bOk ); } CPPUNIT_TEST_SUITE( getRemoveableFlag ); CPPUNIT_TEST( getRemoveableFlag_001 ); @@ -1745,10 +1742,10 @@ namespace osl_VolumeInfo ::osl::VolumeInfo aVolumeInfo( mask ); nError1 = ::osl::Directory::getVolumeInfo( aVolURL1, aVolumeInfo ); CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 ); - sal_Bool bOk = aVolumeInfo.getCompactDiscFlag(); + bool bOk = aVolumeInfo.getCompactDiscFlag(); CPPUNIT_ASSERT_MESSAGE( "test for getCompactDiscFlag function: get a volume device which is not a cdrom.", - ( sal_False == bOk ) ); + !bOk ); } void getCompactDiscFlag_002() @@ -1757,10 +1754,10 @@ namespace osl_VolumeInfo ::osl::VolumeInfo aVolumeInfo( mask ); nError1 = ::osl::Directory::getVolumeInfo( aVolURL6, aVolumeInfo ); CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 ); - sal_Bool bOk = aVolumeInfo.getCompactDiscFlag(); + bool bOk = aVolumeInfo.getCompactDiscFlag(); CPPUNIT_ASSERT_MESSAGE( "test for getCompactDiscFlag function: get a cdrom volume device flag, it did not pass.", - ( sal_True == bOk ) ); + bOk ); } CPPUNIT_TEST_SUITE( getCompactDiscFlag ); CPPUNIT_TEST( getCompactDiscFlag_001 ); @@ -1786,10 +1783,10 @@ namespace osl_VolumeInfo ::osl::VolumeInfo aVolumeInfo( mask ); nError1 = ::osl::Directory::getVolumeInfo( aVolURL1, aVolumeInfo ); CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 ); - sal_Bool bOk = aVolumeInfo.getFloppyDiskFlag(); + bool bOk = aVolumeInfo.getFloppyDiskFlag(); CPPUNIT_ASSERT_MESSAGE( "test for getFloppyDiskFlag function: get a volume device which is not a floppy disk.", - ( sal_False == bOk ) ); + !bOk ); } void getFloppyDiskFlag_002() @@ -1798,10 +1795,10 @@ namespace osl_VolumeInfo ::osl::VolumeInfo aVolumeInfo( mask ); nError1 = ::osl::Directory::getVolumeInfo( aVolURL2, aVolumeInfo ); CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 ); - sal_Bool bOk = aVolumeInfo.getFloppyDiskFlag(); + bool bOk = aVolumeInfo.getFloppyDiskFlag(); CPPUNIT_ASSERT_MESSAGE( "test for getFloppyDiskFlag function: get a floppy volume device flag, it did not pass.", - ( sal_True == bOk ) ); + bOk ); } CPPUNIT_TEST_SUITE( getFloppyDiskFlag ); CPPUNIT_TEST( getFloppyDiskFlag_001 ); @@ -1827,10 +1824,10 @@ namespace osl_VolumeInfo ::osl::VolumeInfo aVolumeInfo( mask ); nError1 = ::osl::Directory::getVolumeInfo( aVolURL2, aVolumeInfo ); CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 ); - sal_Bool bOk = aVolumeInfo.getFixedDiskFlag(); + bool bOk = aVolumeInfo.getFixedDiskFlag(); CPPUNIT_ASSERT_MESSAGE( "test for getFixedDiskFlag function: get a volume device which is not a fixed disk.", - ( sal_False == bOk ) ); + !bOk ); } void getFixedDiskFlag_002() @@ -1839,10 +1836,10 @@ namespace osl_VolumeInfo ::osl::VolumeInfo aVolumeInfo( mask ); nError1 = ::osl::Directory::getVolumeInfo( aVolURL1, aVolumeInfo ); CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 ); - sal_Bool bOk = aVolumeInfo.getFixedDiskFlag(); + bool bOk = aVolumeInfo.getFixedDiskFlag(); CPPUNIT_ASSERT_MESSAGE( "test for getFixedDiskFlag function: get a fixed disk volume device flag, it did not pass.", - ( sal_True == bOk ) ); + bOk ); } CPPUNIT_TEST_SUITE( getFixedDiskFlag ); CPPUNIT_TEST( getFixedDiskFlag_001 ); @@ -1867,10 +1864,10 @@ namespace osl_VolumeInfo ::osl::VolumeInfo aVolumeInfo( mask ); nError1 = ::osl::Directory::getVolumeInfo( aVolURL1, aVolumeInfo ); CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 ); - sal_Bool bOk = aVolumeInfo.getRAMDiskFlag(); + bool bOk = aVolumeInfo.getRAMDiskFlag(); CPPUNIT_ASSERT_MESSAGE( "test for getRAMDiskFlag function: get a volume device which is not a RAM disk.", - ( sal_False == bOk ) ); + !bOk ); } void getRAMDiskFlag_002() @@ -1879,10 +1876,10 @@ namespace osl_VolumeInfo ::osl::VolumeInfo aVolumeInfo( mask ); nError1 = ::osl::Directory::getVolumeInfo( aVolURL1, aVolumeInfo ); CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 ); - sal_Bool bOk = aVolumeInfo.getRAMDiskFlag(); + bool bOk = aVolumeInfo.getRAMDiskFlag(); CPPUNIT_ASSERT_MESSAGE( "test for getRAMDiskFlag function: FIX ME, don't know how to get a RAM disk flag, perhaps Windows 98 boot disk can create a RAM disk, it did not pass in (UNX)(W32).", - ( sal_True == bOk ) ); + bOk ); } CPPUNIT_TEST_SUITE( getRAMDiskFlag ); CPPUNIT_TEST( getRAMDiskFlag_001 ); @@ -2275,7 +2272,7 @@ namespace osl_VolumeInfo 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", - sal_False == compareFileName( aNullURL, aUStr ) ); + !compareFileName( aNullURL, aUStr ) ); } @@ -2333,10 +2330,10 @@ namespace osl_VolumeInfo CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 ); ::osl::VolumeDevice aVolumeDevice1( aVolumeInfo.getDeviceHandle() ); - sal_Bool bOk = compareFileName( aNullURL, aVolumeDevice1.getMountPath() ); + bool bOk = compareFileName( aNullURL, aVolumeDevice1.getMountPath() ); CPPUNIT_ASSERT_MESSAGE( "test for getDeviceHandle function: get device handle of Fixed disk volume mounted on /, it should not be NULL, it did not pass in (W32) (UNX).", - ( sal_False == bOk ) ); + !bOk ); } CPPUNIT_TEST_SUITE( getDeviceHandle ); @@ -2422,7 +2419,7 @@ namespace osl_FileStatus aUStr = rFileStatus.getFileName(); CPPUNIT_ASSERT_MESSAGE( "test for ctors function: mask all and see the file name", - sal_True == compareFileName( aUStr, aTmpName2) ); + compareFileName( aUStr, aTmpName2) ); } void ctors_002() @@ -2433,7 +2430,7 @@ namespace osl_FileStatus aUStr = rFileStatus.getFileName(); CPPUNIT_ASSERT_MESSAGE( "test for ctors function: mask is empty", - sal_True == compareFileName( aUStr, aNullURL) ); + compareFileName( aUStr, aNullURL) ); } CPPUNIT_TEST_SUITE( ctors ); @@ -2487,10 +2484,10 @@ namespace osl_FileStatus ::osl::FileStatus rFileStatus( mask ); ::osl::FileBase::RC nError1 = rItem_file.getFileStatus( rFileStatus ); CPPUNIT_ASSERT( ::osl::FileBase::E_None == nError1 ); - sal_Bool bOk = rFileStatus.isValid( mask ); + bool bOk = rFileStatus.isValid( mask ); CPPUNIT_ASSERT_MESSAGE( "test for isValid function: no fields specified", - ( sal_True == bOk ) ); + bOk ); } void check_FileStatus(::osl::FileStatus const& _aStatus) @@ -2585,19 +2582,19 @@ namespace osl_FileStatus ::osl::Directory testDirectory( aTmpName3 ); ::osl::FileBase::RC nError1 = testDirectory.open(); ::rtl::OUString aFileName ("link.file"); - sal_Bool bOk = sal_False; + bool bOk = false; while (true) { nError1 = testDirectory.getNextItem( rItem_link, 4 ); if (::osl::FileBase::E_None == nError1) { sal_uInt32 mask_link = osl_FileStatus_Mask_FileName | osl_FileStatus_Mask_LinkTargetURL; ::osl::FileStatus rFileStatus( mask_link ); rItem_link.getFileStatus( rFileStatus ); - if ( compareFileName( rFileStatus.getFileName(), aFileName) == sal_True ) + if ( compareFileName( rFileStatus.getFileName(), aFileName) ) { //printf("find the link file"); if ( rFileStatus.isValid( osl_FileStatus_Mask_LinkTargetURL ) ) { - bOk = sal_True; + bOk = true; break; } } @@ -2610,7 +2607,7 @@ namespace osl_FileStatus CPPUNIT_ASSERT( fd == 0 ); CPPUNIT_ASSERT_MESSAGE("test for isValid function: link file, check for LinkTargetURL", - ( sal_True == bOk ) ); + bOk); #endif } @@ -2707,7 +2704,7 @@ namespace osl_FileStatus void check_FileType(osl::FileStatus const& _rFileStatus ) { - sal_Bool bOK = sal_False; + bool bOK = false; if ( _rFileStatus.isValid(osl_FileStatus_Mask_FileName)) { rtl::OUString suFilename = _rFileStatus.getFileName(); @@ -2716,19 +2713,19 @@ namespace osl_FileStatus { osl::FileStatus::Type eType = _rFileStatus.getFileType(); - if ( compareFileName( suFilename, aTmpName2) == sal_True ) + if ( compareFileName( suFilename, aTmpName2) ) { // regular bOK = ( eType == osl::FileStatus::Regular ); } - if ( compareFileName( suFilename, aTmpName1) == sal_True ) + if ( compareFileName( suFilename, aTmpName1) ) { // directory bOK = ( eType == ::osl::FileStatus::Directory ); } CPPUNIT_ASSERT_MESSAGE( "test for getFileType function: ", - ( bOK == sal_True ) ); + bOK ); } } // LLA: it's not a bug, if a FileStatus not exist, so no else @@ -2945,17 +2942,17 @@ namespace osl_FileStatus ::osl::FileStatus rFileStatus( osl_FileStatus_Mask_AccessTime ); nError = rItem.getFileStatus( rFileStatus ); - sal_Bool bOk = osl_getSystemTime( pTV_current ); - CPPUNIT_ASSERT( sal_True == bOk && nError == FileBase::E_None ); + bool bOk = osl_getSystemTime( pTV_current ); + CPPUNIT_ASSERT( bOk && nError == FileBase::E_None ); *pTV_access = rFileStatus.getAccessTime(); - sal_Bool bOK = t_compareTime( pTV_access, pTV_current, delta ); + bool bOK = t_compareTime( pTV_access, pTV_current, delta ); free( pTV_current ); free( pTV_access ); CPPUNIT_ASSERT_MESSAGE( "test for getAccessTime function: This test turns out that UNX pricision is no more than 1 sec, don't know how to test this function, in Windows test, it lost hour min sec, only have date time. ", - sal_True == bOK ); + bOK ); } CPPUNIT_TEST_SUITE( getAccessTime ); @@ -2989,8 +2986,8 @@ namespace osl_FileStatus createTestFile( aTypeURL ); //get current time - sal_Bool bOk = osl_getSystemTime( pTV_current ); - CPPUNIT_ASSERT( sal_True == bOk ); + bool bOk = osl_getSystemTime( pTV_current ); + CPPUNIT_ASSERT( bOk ); //get instance item and filestatus nError = ::osl::DirectoryItem::get( aTypeURL, rItem ); @@ -3004,13 +3001,13 @@ namespace osl_FileStatus CPPUNIT_ASSERT( ( pTV_modify = ( TimeValue* )malloc( sizeof( TimeValue ) ) ) != NULL ); *pTV_modify = rFileStatus.getModifyTime(); - sal_Bool bOK = t_compareTime( pTV_modify, pTV_current, delta ); + bool bOK = t_compareTime( pTV_modify, pTV_current, delta ); //delete file deleteTestFile( aTypeURL ); free( pTV_current ); CPPUNIT_ASSERT_MESSAGE( "test for getModifyTime function: This test turns out that UNX pricision is no more than 1 sec, don't know how to improve this function. ", - sal_True == bOK ); + bOK ); } CPPUNIT_TEST_SUITE( getModifyTime ); @@ -3122,7 +3119,7 @@ namespace osl_FileStatus ::rtl::OUString aFileName = rFileStatus.getFileName(); CPPUNIT_ASSERT_MESSAGE( "test for getFileName function: name compare with specify", - sal_True == compareFileName( aFileName, aTmpName2 ) ); + compareFileName( aFileName, aTmpName2 ) ); } CPPUNIT_TEST_SUITE( getFileName ); @@ -3166,7 +3163,7 @@ namespace osl_FileStatus ::rtl::OUString aFileURL = rFileStatus.getFileURL(); CPPUNIT_ASSERT_MESSAGE( "test for getFileURL function: ", - sal_True == compareFileName( aFileURL, aTmpName6 ) ); + compareFileName( aFileURL, aTmpName6 ) ); } CPPUNIT_TEST_SUITE( getFileURL ); @@ -3231,7 +3228,7 @@ namespace osl_FileStatus CPPUNIT_ASSERT_MESSAGE( "in deleting link file", fd == 0 ); CPPUNIT_ASSERT_MESSAGE( "test for getLinkTargetURL function: Solaris version, creat a file, and a link file link to it, get its LinkTargetURL and compare", - sal_True == compareFileName( aFileURL, aTypeURL ) ); + compareFileName( aFileURL, aTypeURL ) ); } #else void getLinkTargetURL_001() @@ -3389,7 +3386,7 @@ namespace osl_File ::osl::File testFile( aTestFile ); nError1 = testFile.open( osl_File_OpenFlag_Create ); - sal_Bool bOK = ( File::E_ACCES == nError1 ); + bool bOK = ( File::E_ACCES == nError1 ); #if defined (WNT ) bOK = sal_True; /// in Windows, you can create file in c:/ any way. testFile.close(); @@ -3397,7 +3394,7 @@ namespace osl_File #endif CPPUNIT_ASSERT_MESSAGE( "test for open function: create an illegal file", - bOK == sal_True ); + bOK ); } void open_005() @@ -4655,8 +4652,8 @@ namespace osl_File CPPUNIT_ASSERT( ( pTV_modify = ( TimeValue* )malloc( sizeof( TimeValue ) ) ) != NULL ); //get current time - sal_Bool bOk = osl_getSystemTime( pTV_current ); - CPPUNIT_ASSERT( sal_True == bOk ); + bool bOk = osl_getSystemTime( pTV_current ); + CPPUNIT_ASSERT( bOk ); //set the file time nError2 = ::osl::File::setTime( aTmpName6, *pTV_current, *pTV_current, *pTV_current ); @@ -4682,7 +4679,7 @@ namespace osl_File *pTV_modify = rFileStatus2.getModifyTime(); CPPUNIT_ASSERT_MESSAGE( "test for setTime function: set access time then get it. time precision is still a problem for it cut off the nanosec.", - sal_True == t_compareTime( pTV_access, pTV_current, delta ) ); + t_compareTime( pTV_access, pTV_current, delta ) ); #if defined ( WNT ) //Unfortunately there is no way to get the creation time of a file under Unix (its a Windows only feature). //That means the flag osl_FileStatus_Mask_CreationTime should be deprecated under Unix. @@ -4690,7 +4687,7 @@ namespace osl_File sal_True == t_compareTime( pTV_creation, pTV_current, delta ) ) ; #endif CPPUNIT_ASSERT_MESSAGE( "test for setTime function: set modify time then get it. ", - sal_True == t_compareTime( pTV_modify, pTV_current, delta ) ); + t_compareTime( pTV_modify, pTV_current, delta ) ); free( pTV_current ); free( pTV_creation ); free( pTV_access ); @@ -4871,7 +4868,7 @@ namespace osl_DirectoryItem CPPUNIT_ASSERT( nError1 == FileBase::E_None ); CPPUNIT_ASSERT_MESSAGE( "test for copy_assin_Ctors function: use copy constructor to get an item and check filename.", - ( sal_True == compareFileName( rFileStatus.getFileName(), aTmpName2 ) ) ); + compareFileName( rFileStatus.getFileName(), aTmpName2 ) ); } void copy_assin_Ctors_002() @@ -4888,7 +4885,7 @@ namespace osl_DirectoryItem CPPUNIT_ASSERT( nError1 == FileBase::E_None ); CPPUNIT_ASSERT_MESSAGE( "test for copy_assin_Ctors function: test assinment operator here since it is same as copy constructor in test way.", - ( sal_True == compareFileName( rFileStatus.getFileName(), aTmpName2 ) ) ); + compareFileName( rFileStatus.getFileName(), aTmpName2 ) ); } CPPUNIT_TEST_SUITE( copy_assin_Ctors ); @@ -4983,7 +4980,7 @@ namespace osl_DirectoryItem CPPUNIT_ASSERT_MESSAGE( "test for get function: use copy constructor to get an item and check filename.", ( ::osl::FileBase::E_None == nError2 ) && - ( sal_True == compareFileName( rFileStatus.getFileName(), aTmpName2 ) ) ); + compareFileName( rFileStatus.getFileName(), aTmpName2 ) ); } void get_002() @@ -5052,7 +5049,7 @@ namespace osl_DirectoryItem CPPUNIT_ASSERT_MESSAGE( "test for getFileStatus function: get file status and check filename", ( ::osl::FileBase::E_None == nError2 ) && - ( sal_True == compareFileName( rFileStatus.getFileName(), aTmpName2 ) ) ); + compareFileName( rFileStatus.getFileName(), aTmpName2 ) ); } void getFileStatus_002() @@ -5082,7 +5079,7 @@ namespace osl_DirectoryItem CPPUNIT_ASSERT_MESSAGE( "test for getFileStatus function: get directory information", ( ::osl::FileBase::E_None == nError2 ) && - ( sal_True == compareFileName( rFileStatus.getFileName(), aTmpName1 ) ) ); + compareFileName( rFileStatus.getFileName(), aTmpName1 ) ); } @@ -5205,12 +5202,12 @@ namespace osl_Directory //open a directory nError1 = testDirectory.open(); //check if directory is opened. - sal_Bool bOk = testDirectory.isOpen(); + bool bOk = testDirectory.isOpen(); //close a directory nError2 = testDirectory.close(); CPPUNIT_ASSERT_MESSAGE( "test for open function: open a directory and check for open", - ( sal_True == bOk ) && + bOk && ( ::osl::FileBase::E_None == nError1 ) && ( ::osl::FileBase::E_None == nError2 ) ); } @@ -5304,12 +5301,12 @@ namespace osl_Directory //open a directory nError1 = testDirectory.open(); //check if directory is opened. - sal_Bool bOk = testDirectory.isOpen(); + bool bOk = testDirectory.isOpen(); //close a directory nError2 = testDirectory.close(); CPPUNIT_ASSERT_MESSAGE( "test for isOpen function: open a directory and check for open", - ( sal_True == bOk ) ); + bOk ); } void isOpen_002() @@ -5317,10 +5314,10 @@ namespace osl_Directory ::osl::Directory testDirectory( aTmpName3 ); //constructor //check if directory is opened. - sal_Bool bOk = testDirectory.isOpen(); + bool bOk = testDirectory.isOpen(); CPPUNIT_ASSERT_MESSAGE( "test for isOpen function: do not open a directory and check for open", - !( sal_True == bOk ) ); + !bOk ); } CPPUNIT_TEST_SUITE( isOpen ); @@ -5362,10 +5359,10 @@ namespace osl_Directory //close a directory nError2 = testDirectory.close(); //check if directory is opened. - sal_Bool bOk = testDirectory.isOpen(); + bool bOk = testDirectory.isOpen(); CPPUNIT_ASSERT_MESSAGE( "test for isOpen function: close a directory and check for open", - !( sal_True == bOk ) ); + !bOk ); } void close_002() @@ -5451,13 +5448,13 @@ namespace osl_Directory nError1 = testDirectory.close(); CPPUNIT_ASSERT( ::osl::FileBase::E_None == nError1 ); - sal_Bool bOK1,bOK2,bOK3; + bool bOK1,bOK2,bOK3; bOK1 = compareFileName( rFileStatus.getFileName(), aTmpName2 ); bOK2 = compareFileName( rFileStatus.getFileName(), aHidURL1 ); bOK3 = compareFileName( rFileStatus.getFileName(), rFileStatusFirst.getFileName() ); CPPUNIT_ASSERT_MESSAGE( "test for reset function: get two directory item, reset it, then get again, check the filename", ( ::osl::FileBase::E_None == nError2 ) && - ( sal_True == bOK1 || bOK2 || bOK3 ) ); + ( bOK1 || bOK2 || bOK3 ) ); } void reset_002() @@ -5545,9 +5542,9 @@ namespace osl_Directory CPPUNIT_ASSERT( ::osl::FileBase::E_None == nError1 ); //check the file name - sal_Bool bOk1 = sal_False; - sal_Bool bOk2 = sal_False; - sal_Bool bOk3 = sal_False; + bool bOk1 = false; + bool bOk2 = false; + bool bOk3 = false; ::osl::FileStatus rFileStatus( osl_FileStatus_Mask_FileName ); for ( int nCount = 0; nCount < 3; nCount++ ) { @@ -5559,19 +5556,19 @@ namespace osl_Directory // a special order is not guaranteed. So any file may occur on any time. // But every file name should occur only once. - if ( bOk1 == sal_False && compareFileName( rFileStatus.getFileName(), aTmpName1 ) ) + if ( !bOk1 && compareFileName( rFileStatus.getFileName(), aTmpName1 ) ) { - bOk1 = sal_True; + bOk1 = true; } - if ( bOk2 == sal_False && compareFileName( rFileStatus.getFileName(), aTmpName2 ) ) + if ( !bOk2 && compareFileName( rFileStatus.getFileName(), aTmpName2 ) ) { - bOk2 = sal_True; + bOk2 = true; } - if ( bOk3 == sal_False && compareFileName( rFileStatus.getFileName(), aHidURL1 ) ) + if ( !bOk3 && compareFileName( rFileStatus.getFileName(), aHidURL1 ) ) { - bOk3 = sal_True; + bOk3 = true; } } @@ -5580,7 +5577,7 @@ namespace osl_Directory CPPUNIT_ASSERT( ::osl::FileBase::E_None == nError1 ); CPPUNIT_ASSERT_MESSAGE( "test for getNextItem function: retrieve three items and check their names.", - ( sal_True == bOk1 ) && ( sal_True == bOk2 ) && ( sal_True == bOk3 ) ); + bOk1 && bOk2 && bOk3 ); } void getNextItem_002() @@ -5617,8 +5614,8 @@ namespace osl_Directory { //create a link file(can not on Windows), then check if getNextItem can get it. #ifdef UNX - sal_Bool bLnkOK = sal_False; - sal_Bool bFoundOK = sal_False; + bool bLnkOK = false; + bool bFoundOK = false; ::rtl::OUString aUStr_LnkFileSys( aTempDirectorySys ), aUStr_SrcFileSys( aTempDirectorySys ); ( aUStr_LnkFileSys += aSlashURL ) += ::rtl::OUString("/tmpdir/link.file"); @@ -5643,12 +5640,12 @@ namespace osl_Directory if (::osl::FileBase::E_None == nError1) { ::osl::FileStatus rFileStatus( osl_FileStatus_Mask_FileName | osl_FileStatus_Mask_Type ); rItem.getFileStatus( rFileStatus ); - if ( compareFileName( rFileStatus.getFileName(), aFileName) == sal_True ) + if ( compareFileName( rFileStatus.getFileName(), aFileName) ) { - bFoundOK = sal_True; + bFoundOK = true; if ( FileStatus::Link == rFileStatus.getFileType()) { - bLnkOK = sal_True; + bLnkOK = true; break; } } @@ -5659,9 +5656,9 @@ namespace osl_Directory fd = std::remove( strLinkFileName.getStr() ); CPPUNIT_ASSERT_MESSAGE( "remove link file failed", fd == 0 ); CPPUNIT_ASSERT_MESSAGE( "test for getNextItem function: check if can retrieve the link file name", - ( bFoundOK == sal_True ) ); + bFoundOK ); CPPUNIT_ASSERT_MESSAGE( "test for getNextItem function: check if link file has file type link", - ( bLnkOK == sal_True ) ); + bLnkOK ); #endif } @@ -5693,19 +5690,19 @@ namespace osl_Directory ::rtl::OUString aFileSysName( aNullURL ); aFileSysName = _aVolumeInfo.getFileSystemName(); - sal_Bool bRes2 = compareFileName( aFileSysName, aNullURL ); + bool bRes2 = compareFileName( aFileSysName, aNullURL ); CPPUNIT_ASSERT_MESSAGE( "test for getVolumeInfo function: getVolumeInfo of root directory.", ( osl::FileBase::E_None == nError1 ) && - ( sal_False == bRes2 ) ); + !bRes2 ); } if (_nMask == osl_VolumeInfo_Mask_Attributes) { - sal_Bool b1 = _aVolumeInfo.getRemoteFlag(); - sal_Bool b2 = _aVolumeInfo.getRemoveableFlag(); - sal_Bool b3 = _aVolumeInfo.getCompactDiscFlag(); - sal_Bool b4 = _aVolumeInfo.getFloppyDiskFlag(); - sal_Bool b5 = _aVolumeInfo.getFixedDiskFlag(); - sal_Bool b6 = _aVolumeInfo.getRAMDiskFlag(); + bool b1 = _aVolumeInfo.getRemoteFlag(); + bool b2 = _aVolumeInfo.getRemoveableFlag(); + bool b3 = _aVolumeInfo.getCompactDiscFlag(); + bool b4 = _aVolumeInfo.getFloppyDiskFlag(); + bool b5 = _aVolumeInfo.getFixedDiskFlag(); + bool b6 = _aVolumeInfo.getRAMDiskFlag(); rtl::OString sAttr; if (b1) sAttr = "Remote"; @@ -5988,13 +5985,13 @@ namespace osl_Directory void remove_004() { createTestFile( aTmpName6 ); - sal_Bool bExist = ifFileExist( aTmpName6 ); + bool bExist = ifFileExist( aTmpName6 ); //try to remove file. nError1 = ::osl::Directory::remove( aTmpName6 ); deleteTestFile( aTmpName6 ); CPPUNIT_ASSERT_MESSAGE( "test for remove function: try to remove a file but not directory.", - bExist == sal_True &&(( osl::FileBase::E_NOTDIR == nError1 ) || ( osl::FileBase::E_NOENT == nError1 )) ); + bExist &&(( osl::FileBase::E_NOTDIR == nError1 ) || ( osl::FileBase::E_NOENT == nError1 )) ); } void remove_005() diff --git a/sal/qa/osl/module/osl_Module.cxx b/sal/qa/osl/module/osl_Module.cxx index c11df5dccb81..1ffb63cb5bd0 100644 --- a/sal/qa/osl/module/osl_Module.cxx +++ b/sal/qa/osl/module/osl_Module.cxx @@ -34,11 +34,10 @@ using ::rtl::OString; /** print Boolean value. */ -inline void printBool( sal_Bool bOk ) +inline void printBool( bool bOk ) { printf("#printBool# " ); - ( sal_True == bOk ) ? printf( "TRUE!\n" ) - : printf( "FALSE!\n" ); + bOk ? printf( "TRUE!\n" ) : printf( "FALSE!\n" ); } /** print a UNI_CODE String. @@ -108,21 +107,21 @@ inline void deleteTestDirectory( const ::rtl::OUString dirname ) } //check if the file exist -inline sal_Bool ifFileExist( const ::rtl::OUString & str ) +inline bool ifFileExist( const ::rtl::OUString & str ) { ::rtl::OUString aUStr; if ( isURL( str ) ) ::osl::FileBase::getSystemPathFromFileURL( str, aUStr ); else - return sal_False; + return false; ::osl::File strFile( aUStr ); ::osl::FileBase::RC nError = strFile.open( osl_File_OpenFlag_Read ); if ( ::File::E_NOENT == nError ) - return sal_False; + return false; else{ strFile.close( ); - return sal_True; + return true; } } @@ -171,7 +170,7 @@ namespace osl_Module class ctors : public CppUnit::TestFixture { public: - sal_Bool bRes, bRes1; + bool bRes, bRes1; void ctors_none( ) { @@ -179,7 +178,7 @@ namespace osl_Module bRes = aMod.is(); CPPUNIT_ASSERT_MESSAGE( "#test comment#: test constructor without parameter.", - sal_False == bRes ); + !bRes ); } void ctors_name_mode( ) @@ -197,7 +196,7 @@ namespace osl_Module aMod.unload( ); CPPUNIT_ASSERT_MESSAGE( "#test comment#: test constructor with load action.", - sal_True == bRes ); + bRes ); } CPPUNIT_TEST_SUITE( ctors ); @@ -213,7 +212,7 @@ namespace osl_Module class getUrlFromAddress : public CppUnit::TestFixture { public: - sal_Bool bRes, bRes1; + bool bRes, bRes1; void getUrlFromAddress_001( ) { @@ -225,7 +224,7 @@ namespace osl_Module } CPPUNIT_ASSERT_MESSAGE( "#test comment#: test get Module URL from address.", - sal_True == bRes && 0 < aFileURL.lastIndexOf('/') ); + bRes && 0 < aFileURL.lastIndexOf('/') ); } void getUrlFromAddress_002( ) @@ -244,7 +243,7 @@ namespace osl_Module aMod.unload( ); CPPUNIT_ASSERT_MESSAGE( "#test comment#: load an external library, get its function address and get its URL.", - sal_True == bRes && 0 < aFileURL.lastIndexOf('/') && aFileURL.equalsIgnoreAsciiCase( getDllURL( ) ) ); + bRes && 0 < aFileURL.lastIndexOf('/') && aFileURL.equalsIgnoreAsciiCase( getDllURL( ) ) ); #endif } @@ -264,7 +263,7 @@ namespace osl_Module class load : public CppUnit::TestFixture { public: - sal_Bool bRes, bRes1; + bool bRes, bRes1; void load_001( ) { @@ -277,7 +276,7 @@ namespace osl_Module aMod1.unload( ); CPPUNIT_ASSERT_MESSAGE( "#test comment#: load function should do the same thing as constructor with library name.", - sal_True == bRes ); + bRes ); } CPPUNIT_TEST_SUITE( load ); @@ -292,7 +291,7 @@ namespace osl_Module class unload : public CppUnit::TestFixture { public: - sal_Bool bRes, bRes1; + bool bRes, bRes1; void unload_001( ) { @@ -302,7 +301,7 @@ namespace osl_Module bRes = oslModule(aMod) ==NULL; CPPUNIT_ASSERT_MESSAGE( "#test comment#: unload function should do the same thing as destructor.", - sal_True == bRes ); + bRes ); } CPPUNIT_TEST_SUITE( unload ); @@ -317,7 +316,7 @@ namespace osl_Module class is : public CppUnit::TestFixture { public: - sal_Bool bRes, bRes1; + bool bRes, bRes1; void is_001( ) { @@ -335,7 +334,7 @@ namespace osl_Module aMod.unload( ); CPPUNIT_ASSERT_MESSAGE( "#test comment#: test if a module is a loaded module.", - sal_False == bRes && sal_True == bRes1); + !bRes && bRes1 ); } CPPUNIT_TEST_SUITE( is ); CPPUNIT_TEST( is_001 ); @@ -349,7 +348,7 @@ namespace osl_Module class getSymbol : public CppUnit::TestFixture { public: - sal_Bool bRes; + bool bRes; void getSymbol_001( ) { @@ -357,13 +356,13 @@ namespace osl_Module // TODO: Find out why this fails on Mac OS X ::osl::Module aMod( getDllURL( ) ); FuncPtr pFunc = ( FuncPtr ) aMod.getSymbol( rtl::OUString("firstfunc") ); - bRes = sal_False; + bRes = false; if ( pFunc ) bRes = pFunc( bRes ); aMod.unload(); CPPUNIT_ASSERT_MESSAGE( "#test comment#: load a dll and call one function in it.", - sal_True == bRes ); + bRes ); #endif } @@ -379,7 +378,7 @@ namespace osl_Module class optr_oslModule : public CppUnit::TestFixture { public: - sal_Bool bRes, bRes1; + bool bRes, bRes1; void optr_oslModule_001( ) { @@ -394,7 +393,7 @@ namespace osl_Module aMod.unload( ); CPPUNIT_ASSERT_MESSAGE( "#test comment#: the m_Module of a Module instance will be NULL when is not loaded, it will not be NULL after loaded.", - sal_True == bRes && sal_True == bRes1); + bRes && bRes1 ); #endif } @@ -406,14 +405,14 @@ namespace osl_Module ::rtl::OUString funcName( "firstfunc" ); FuncPtr pFunc = ( FuncPtr ) osl_getSymbol( (oslModule)aMod, funcName.pData ); - bRes = sal_False; + bRes = false; if ( pFunc ) bRes = pFunc( bRes ); aMod.unload(); CPPUNIT_ASSERT_MESSAGE( "#test comment#: use m_Module to call osl_getSymbol() function.", - sal_True == bRes ); + bRes ); #endif } @@ -429,7 +428,7 @@ namespace osl_Module class getFunctionSymbol : public CppUnit::TestFixture { public: - sal_Bool bRes, bRes1; + bool bRes, bRes1; void getFunctionSymbol_001( ) { @@ -441,7 +440,7 @@ namespace osl_Module bRes = ::osl::Module::getUrlFromAddress( oslFunc, aLibraryURL); aMod.unload(); CPPUNIT_ASSERT_MESSAGE( "#test comment#: load a dll and get its function addr and get its URL.", - sal_True == bRes && aLibraryURL.equalsIgnoreAsciiCase( getDllURL() ) ); + bRes && aLibraryURL.equalsIgnoreAsciiCase( getDllURL() ) ); #endif } diff --git a/sal/qa/osl/mutex/osl_Mutex.cxx b/sal/qa/osl/mutex/osl_Mutex.cxx index c4df983ca7fd..1e26c62ae85e 100644 --- a/sal/qa/osl/mutex/osl_Mutex.cxx +++ b/sal/qa/osl/mutex/osl_Mutex.cxx @@ -47,10 +47,10 @@ inline void printUString( const ::rtl::OUString & str ) /** print Boolean value. */ -inline void printBool( sal_Bool bOk ) +inline void printBool( bool bOk ) { printf("#printBool# " ); - ( sal_True == bOk ) ? printf("YES!\n" ): printf("NO!\n" ); + bOk ? printf("YES!\n" ): printf("NO!\n" ); } /** pause nSec seconds helper function. @@ -307,7 +307,7 @@ namespace osl_Mutex myThread1.join( ); myThread2.join( ); - sal_Bool bRes = sal_False; + bool bRes = false; // every 5 datas should the same // LLA: this is not a good check, it's too fix @@ -319,13 +319,13 @@ namespace osl_Mutex m_Data.buffer[6] == m_Data.buffer[7] && m_Data.buffer[7] == m_Data.buffer[8] && m_Data.buffer[8] == m_Data.buffer[9]) - bRes = sal_True; + bRes = true; /*for (sal_Int8 i=0; i<BUFFER_SIZE; i++) printf("#data in buffer is %d\n", m_Data.buffer[i]); */ - CPPUNIT_ASSERT_MESSAGE("Mutex ctor", bRes == sal_True); + CPPUNIT_ASSERT_MESSAGE("Mutex ctor", bRes); } @@ -346,13 +346,13 @@ namespace osl_Mutex myThread1.join( ); myThread2.join( ); - sal_Bool bRes = sal_False; + bool bRes = false; // every 5 datas should the same if ( ( m_Res.data1 == 0 ) && ( m_Res.data2 == 3 ) ) - bRes = sal_True; + bRes = true; - CPPUNIT_ASSERT_MESSAGE( "test Mutex ctor function: increase and decrease a number 3 times without interrupt.", bRes == sal_True ); + CPPUNIT_ASSERT_MESSAGE( "test Mutex ctor function: increase and decrease a number 3 times without interrupt.", bRes ); } CPPUNIT_TEST_SUITE( ctor ); @@ -375,7 +375,7 @@ namespace osl_Mutex { Mutex aMutex; //acquire here - sal_Bool bRes = aMutex.acquire( ); + bool bRes = aMutex.acquire( ); // pass the pointer of mutex to child thread HoldThread myThread( &aMutex ); myThread.create( ); @@ -383,16 +383,15 @@ namespace osl_Mutex ThreadHelper::thread_sleep_tenth_sec( 2 ); // if acquire in myThread does not work, 2 secs is long enough, // myThread should terminate now, and bRes1 should be sal_False - sal_Bool bRes1 = myThread.isRunning( ); + bool bRes1 = myThread.isRunning( ); aMutex.release( ); ThreadHelper::thread_sleep_tenth_sec( 1 ); // after release mutex, myThread stops blocking and will terminate immediately - sal_Bool bRes2 = myThread.isRunning( ); + bool bRes2 = myThread.isRunning( ); myThread.join( ); - CPPUNIT_ASSERT_MESSAGE( "Mutex acquire", - bRes == sal_True && bRes1 == sal_True && bRes2 == sal_False ); + CPPUNIT_ASSERT_MESSAGE( "Mutex acquire", bRes && bRes1 && !bRes2 ); } //in the same thread, acquire twice should success @@ -400,15 +399,14 @@ namespace osl_Mutex { Mutex aMutex; //acquire here - sal_Bool bRes = aMutex.acquire(); - sal_Bool bRes1 = aMutex.acquire(); + bool bRes = aMutex.acquire(); + bool bRes1 = aMutex.acquire(); - sal_Bool bRes2 = aMutex.tryToAcquire(); + bool bRes2 = aMutex.tryToAcquire(); aMutex.release(); - CPPUNIT_ASSERT_MESSAGE("Mutex acquire", - bRes == sal_True && bRes1 == sal_True && bRes2 == sal_True); + CPPUNIT_ASSERT_MESSAGE("Mutex acquire", bRes && bRes1 && bRes2); } @@ -436,20 +434,19 @@ namespace osl_Mutex // ensure the child thread acquire the mutex ThreadHelper::thread_sleep_tenth_sec(1); - sal_Bool bRes1 = aMutex.tryToAcquire(); + bool bRes1 = aMutex.tryToAcquire(); - if (bRes1 == sal_True) + if (bRes1) aMutex.release(); // wait the child thread terminate myThread.join(); - sal_Bool bRes2 = aMutex.tryToAcquire(); + bool bRes2 = aMutex.tryToAcquire(); - if (bRes2 == sal_True) + if (bRes2) aMutex.release(); - CPPUNIT_ASSERT_MESSAGE("Try to acquire Mutex", - bRes1 == sal_False && bRes2 == sal_True); + CPPUNIT_ASSERT_MESSAGE("Try to acquire Mutex", !bRes1 && bRes2); } CPPUNIT_TEST_SUITE(tryToAcquire); @@ -474,18 +471,18 @@ namespace osl_Mutex // ensure the child thread acquire the mutex ThreadHelper::thread_sleep_tenth_sec( 1 ); - sal_Bool bRunning = myThread.isRunning( ); - sal_Bool bRes1 = aMutex.tryToAcquire( ); + bool bRunning = myThread.isRunning( ); + bool bRes1 = aMutex.tryToAcquire( ); // wait the child thread terminate myThread.join( ); - sal_Bool bRes2 = aMutex.tryToAcquire( ); + bool bRes2 = aMutex.tryToAcquire( ); - if ( bRes2 == sal_True ) + if ( bRes2 ) aMutex.release( ); CPPUNIT_ASSERT_MESSAGE( "release Mutex: try to acquire before and after the mutex has been released", - bRes1 == sal_False && bRes2 == sal_True && bRunning == sal_True ); + !bRes1 && bRes2 && bRunning ); } @@ -518,20 +515,19 @@ namespace osl_Mutex myThread.create(); ThreadHelper::thread_sleep_tenth_sec(1); - sal_Bool bRes1 = myThread.isRunning(); + bool bRes1 = myThread.isRunning(); pGlobalMutex->release(); ThreadHelper::thread_sleep_tenth_sec(1); // after release mutex, myThread stops blocking and will terminate immediately - sal_Bool bRes2 = myThread.isRunning(); + bool bRes2 = myThread.isRunning(); - CPPUNIT_ASSERT_MESSAGE("Global Mutex works", - bRes1 == sal_True && bRes2 == sal_False); + CPPUNIT_ASSERT_MESSAGE("Global Mutex works", bRes1 && !bRes2); } void getGlobalMutex_002( ) { - sal_Bool bRes; + bool bRes; Mutex *pGlobalMutex; pGlobalMutex = Mutex::getGlobalMutex( ); @@ -543,7 +539,7 @@ namespace osl_Mutex } CPPUNIT_ASSERT_MESSAGE( "Global Mutex works: if the code between {} get the different mutex as the former one, it will return false when release.", - bRes == sal_True ); + bRes ); } CPPUNIT_TEST_SUITE(getGlobalMutex); @@ -600,15 +596,15 @@ namespace osl_Guard myThread.create(); ThreadHelper::thread_sleep_tenth_sec(1); - sal_Bool bRes = aMutex.tryToAcquire(); + bool bRes = aMutex.tryToAcquire(); // after 1 second, the mutex has been guarded, and the child thread should be running - sal_Bool bRes1 = myThread.isRunning(); + bool bRes1 = myThread.isRunning(); myThread.join(); - sal_Bool bRes2 = aMutex.tryToAcquire(); + bool bRes2 = aMutex.tryToAcquire(); CPPUNIT_ASSERT_MESSAGE("GuardThread constructor", - bRes == sal_False && bRes1 == sal_True && bRes2 == sal_True); + !bRes && bRes1 && bRes2); } void ctor_002( ) @@ -624,14 +620,14 @@ namespace osl_Guard /// is it still blocking? ThreadHelper::thread_sleep_tenth_sec( 2 ); - sal_Bool bRes = myThread.isRunning( ); + bool bRes = myThread.isRunning( ); /// oh, release him. aMutex.release( ); myThread.join( ); CPPUNIT_ASSERT_MESSAGE("GuardThread constructor: reference initialization, acquire the mutex before running the thread, then check if it is blocking.", - bRes == sal_True); + bRes); } CPPUNIT_TEST_SUITE(ctor); @@ -692,10 +688,10 @@ namespace osl_ClearableGuard ClearableMutexGuard myMutexGuard( &aMutex ); /// it will return sal_False if the aMutex has not been Guarded. - sal_Bool bRes = aMutex.release( ); + bool bRes = aMutex.release( ); CPPUNIT_ASSERT_MESSAGE("ClearableMutexGuard constructor, test the acquire operation when initilized.", - bRes == sal_True ); + bRes); } void ctor_002( ) @@ -706,10 +702,10 @@ namespace osl_ClearableGuard ClearableMutexGuard myMutexGuard( aMutex ); /// it will return sal_False if the aMutex has not been Guarded. - sal_Bool bRes = aMutex.release( ); + bool bRes = aMutex.release( ); CPPUNIT_ASSERT_MESSAGE("ClearableMutexGuard constructor, test the acquire operation when initilized, we use reference constructor this time.", - bRes == sal_True ); + bRes); } CPPUNIT_TEST_SUITE(ctor); @@ -764,15 +760,15 @@ namespace osl_ClearableGuard /// is it blocking? ThreadHelper::thread_sleep_tenth_sec( 4 ); - sal_Bool bRes = myThread.isRunning( ); + bool bRes = myThread.isRunning( ); /// use clear to release. myMutexGuard.clear( ); myThread.join( ); - sal_Bool bRes1 = myThread.isRunning( ); + bool bRes1 = myThread.isRunning( ); CPPUNIT_ASSERT_MESSAGE( "ClearableGuard method: clear, control the HoldThread's running status!", - ( sal_True == bRes ) && ( sal_False == bRes1 ) ); + bRes && !bRes1 ); } CPPUNIT_TEST_SUITE( clear ); @@ -831,10 +827,10 @@ namespace osl_ResettableGuard ResettableMutexGuard myMutexGuard( &aMutex ); /// it will return sal_False if the aMutex has not been Guarded. - sal_Bool bRes = aMutex.release( ); + bool bRes = aMutex.release( ); CPPUNIT_ASSERT_MESSAGE("ResettableMutexGuard constructor, test the acquire operation when initilized.", - bRes == sal_True ); + bRes); } void ctor_002( ) @@ -845,10 +841,10 @@ namespace osl_ResettableGuard ResettableMutexGuard myMutexGuard( aMutex ); /// it will return sal_False if the aMutex has not been Guarded. - sal_Bool bRes = aMutex.release( ); + bool bRes = aMutex.release( ); CPPUNIT_ASSERT_MESSAGE( "ResettableMutexGuard constructor, test the acquire operation when initilized, we use reference constructor this time.", - bRes == sal_True ); + bRes); } @@ -869,17 +865,17 @@ namespace osl_ResettableGuard myThread.create( ); /// is it running? and clear done? - sal_Bool bRes = myThread.isRunning( ); + bool bRes = myThread.isRunning( ); myMutexGuard.clear( ); ThreadHelper::thread_sleep_tenth_sec( 1 ); /// if reset is not success, the release will return sal_False myMutexGuard.reset( ); - sal_Bool bRes1 = aMutex.release( ); + bool bRes1 = aMutex.release( ); myThread.join( ); CPPUNIT_ASSERT_MESSAGE( "ResettableMutexGuard method: reset", - ( sal_True == bRes ) && ( sal_True == bRes1 ) ); + bRes && bRes1 ); } void reset_002( ) @@ -889,14 +885,14 @@ namespace osl_ResettableGuard /// shouldn't release after clear; myMutexGuard.clear( ); - sal_Bool bRes = aMutex.release( ); + bool bRes = aMutex.release( ); /// can release after reset. myMutexGuard.reset( ); - sal_Bool bRes1 = aMutex.release( ); + bool bRes1 = aMutex.release( ); CPPUNIT_ASSERT_MESSAGE( "ResettableMutexGuard method: reset, release after clear and reset, on Solaris, the mutex can be release without acquire, so it can not passed on (SOLARIS), but not the reason for reset_002", - ( sal_False == bRes ) && ( sal_True == bRes1 ) ); + !bRes && bRes1 ); } CPPUNIT_TEST_SUITE(reset); diff --git a/sal/qa/osl/process/osl_Thread.cxx b/sal/qa/osl/process/osl_Thread.cxx index 6874751292ca..c45b554ad3c6 100644 --- a/sal/qa/osl/process/osl_Thread.cxx +++ b/sal/qa/osl/process/osl_Thread.cxx @@ -327,11 +327,11 @@ class OSuspendThread : public Thread { ThreadSafeValue<sal_Int32> m_aFlag; public: - OSuspendThread(){ m_bSuspend = sal_False; } + OSuspendThread(){ m_bSuspend = false; } sal_Int32 getValue() { return m_aFlag.getValue(); } void setSuspend() { - m_bSuspend = sal_True; + m_bSuspend = true; } virtual void SAL_CALL suspend() { @@ -340,7 +340,7 @@ public: m_aFlag.release(); } protected: - sal_Bool m_bSuspend; + bool m_bSuspend; void SAL_CALL run() { //if the thread should terminate, schedule return false @@ -349,10 +349,10 @@ protected: m_aFlag.addValue(1); ThreadHelper::thread_sleep_tenth_sec(1); - if (m_bSuspend == sal_True) + if (m_bSuspend) { suspend(); - m_bSuspend = sal_False; + m_bSuspend = false; } } } @@ -508,11 +508,11 @@ namespace osl_Thread void create_001() { myThread* newthread = new myThread(); - sal_Bool bRes = newthread->create(); - CPPUNIT_ASSERT_MESSAGE("Can not creates a new thread!\n", bRes == sal_True ); + bool bRes = newthread->create(); + CPPUNIT_ASSERT_MESSAGE("Can not creates a new thread!\n", bRes); ThreadHelper::thread_sleep_tenth_sec(1); // wait short - sal_Bool isRunning = newthread->isRunning(); // check if thread is running + bool isRunning = newthread->isRunning(); // check if thread is running /// wait for the new thread to assure it has run ThreadHelper::thread_sleep_tenth_sec(3); sal_Int32 nValue = newthread->getValue(); @@ -521,11 +521,11 @@ namespace osl_Thread delete newthread; t_print(" nValue = %d\n", (int) nValue); - t_print("isRunning = %s\n", isRunning == sal_True ? "true" : "false"); + t_print("isRunning = %s\n", isRunning ? "true" : "false"); CPPUNIT_ASSERT_MESSAGE( "Creates a new thread", - nValue >= 1 && isRunning == sal_True + nValue >= 1 && isRunning ); } @@ -535,8 +535,8 @@ namespace osl_Thread void create_002() { myThread* newthread = new myThread(); - sal_Bool res1 = newthread->create(); - sal_Bool res2 = newthread->create(); + bool res1 = newthread->create(); + bool res2 = newthread->create(); t_print("In non pro, an assertion should occurred. This behaviour is right.\n"); termAndJoinThread(newthread); delete newthread; @@ -577,11 +577,11 @@ namespace osl_Thread void createSuspended_001() { myThread* newthread = new myThread(); - sal_Bool bRes = newthread->createSuspended(); - CPPUNIT_ASSERT_MESSAGE("Can not creates a new thread!", bRes == sal_True ); + bool bRes = newthread->createSuspended(); + CPPUNIT_ASSERT_MESSAGE("Can not creates a new thread!", bRes); ThreadHelper::thread_sleep_tenth_sec(1); - sal_Bool isRunning = newthread->isRunning(); + bool isRunning = newthread->isRunning(); ThreadHelper::thread_sleep_tenth_sec(3); sal_Int32 nValue = newthread->getValue(); @@ -599,8 +599,8 @@ namespace osl_Thread void createSuspended_002() { myThread* newthread = new myThread(); - sal_Bool res1 = newthread->createSuspended(); - sal_Bool res2 = newthread->createSuspended(); + bool res1 = newthread->createSuspended(); + bool res2 = newthread->createSuspended(); resumeAndWaitThread(newthread); @@ -660,8 +660,8 @@ namespace osl_Thread void suspend_001() { OCountThread* aCountThread = new OCountThread(); - sal_Bool bRes = aCountThread->create(); - CPPUNIT_ASSERT_MESSAGE ( "Can't start thread!", bRes == sal_True ); + bool bRes = aCountThread->create(); + CPPUNIT_ASSERT_MESSAGE ( "Can't start thread!", bRes ); // the thread run for some seconds, but not terminate suspendCountThread( aCountThread ); @@ -679,7 +679,7 @@ namespace osl_Thread CPPUNIT_ASSERT_MESSAGE( "Suspend the thread", - bRes == sal_True && nValue == nLaterValue + bRes && nValue == nLaterValue ); } @@ -689,8 +689,8 @@ namespace osl_Thread void suspend_002() { OSuspendThread* aThread = new OSuspendThread(); - sal_Bool bRes = aThread->create(); - CPPUNIT_ASSERT_MESSAGE ( "Can't start thread!", bRes == sal_True ); + bool bRes = aThread->create(); + CPPUNIT_ASSERT_MESSAGE ( "Can't start thread!", bRes ); // first the thread run for some seconds, but not terminate sal_Int32 nValue = 0; //while (1) @@ -720,7 +720,7 @@ namespace osl_Thread CPPUNIT_ASSERT_MESSAGE( "Suspend the thread", - bRes == sal_True && nValue == nLaterValue + bRes && nValue == nLaterValue ); } @@ -754,8 +754,8 @@ namespace osl_Thread void resume_001() { OCountThread* pCountThread = new OCountThread(); - sal_Bool bRes = pCountThread->create(); - CPPUNIT_ASSERT_MESSAGE ( "Can't start thread!", bRes == sal_True ); + bool bRes = pCountThread->create(); + CPPUNIT_ASSERT_MESSAGE ( "Can't start thread!", bRes ); suspendCountThread(pCountThread); @@ -792,8 +792,8 @@ namespace osl_Thread void resume_002() { myThread* newthread = new myThread(); - sal_Bool bRes = newthread->createSuspended(); - CPPUNIT_ASSERT_MESSAGE ( "Can't create thread!", bRes == sal_True ); + bool bRes = newthread->createSuspended(); + CPPUNIT_ASSERT_MESSAGE ( "Can't create thread!", bRes ); newthread->resume(); ThreadHelper::thread_sleep_tenth_sec(2); @@ -838,8 +838,8 @@ namespace osl_Thread void terminate_001() { OCountThread* aCountThread = new OCountThread(); - sal_Bool bRes = aCountThread->create(); - CPPUNIT_ASSERT_MESSAGE ( "Can't start thread!", bRes == sal_True ); + bool bRes = aCountThread->create(); + CPPUNIT_ASSERT_MESSAGE ( "Can't start thread!", bRes ); ThreadHelper::thread_sleep_tenth_sec(2); sal_Int32 nValue = aCountThread->getValue(); @@ -848,7 +848,7 @@ namespace osl_Thread sal_Int32 nLaterValue = aCountThread->getValue(); // isRunning should be false after terminate - sal_Bool isRunning = aCountThread->isRunning(); + bool isRunning = aCountThread->isRunning(); aCountThread->join(); delete aCountThread; @@ -857,7 +857,7 @@ namespace osl_Thread CPPUNIT_ASSERT_MESSAGE( "Terminate the thread", - isRunning == sal_False && nLaterValue >= nValue + !isRunning && nLaterValue >= nValue ); } /** Check if a suspended thread will terminate after call terminate, different on w32 and on UNX @@ -865,8 +865,8 @@ namespace osl_Thread void terminate_002() { OCountThread* aCountThread = new OCountThread(); - sal_Bool bRes = aCountThread->create(); - CPPUNIT_ASSERT_MESSAGE ( "Can't start thread!", bRes == sal_True ); + bool bRes = aCountThread->create(); + CPPUNIT_ASSERT_MESSAGE ( "Can't start thread!", bRes ); ThreadHelper::thread_sleep_tenth_sec(1); suspendCountThread(aCountThread); @@ -919,8 +919,8 @@ namespace osl_Thread void join_001() { OCountThread *aCountThread = new OCountThread(); - sal_Bool bRes = aCountThread->create(); - CPPUNIT_ASSERT_MESSAGE ( "Can't start thread!", bRes == sal_True ); + bool bRes = aCountThread->create(); + CPPUNIT_ASSERT_MESSAGE ( "Can't start thread!", bRes ); StopWatch aStopWatch; aStopWatch.start(); @@ -954,8 +954,8 @@ namespace osl_Thread void join_002() { OCountThread *aCountThread = new OCountThread(); - sal_Bool bRes = aCountThread->create(); - CPPUNIT_ASSERT_MESSAGE ( "Can't start thread!", bRes == sal_True ); + bool bRes = aCountThread->create(); + CPPUNIT_ASSERT_MESSAGE ( "Can't start thread!", bRes ); //record the time when the running begin // TimeValue aTimeVal_befor; @@ -1006,19 +1006,19 @@ namespace osl_Thread void isRunning_001() { OCountThread *aCountThread = new OCountThread(); - sal_Bool bRes = aCountThread->create(); - CPPUNIT_ASSERT_MESSAGE ( "Can't start thread!", bRes == sal_True ); + bool bRes = aCountThread->create(); + CPPUNIT_ASSERT_MESSAGE ( "Can't start thread!", bRes ); - sal_Bool bRun = aCountThread->isRunning(); + bool bRun = aCountThread->isRunning(); ThreadHelper::thread_sleep_tenth_sec(2); termAndJoinThread(aCountThread); - sal_Bool bTer = aCountThread->isRunning(); + bool bTer = aCountThread->isRunning(); delete aCountThread; CPPUNIT_ASSERT_MESSAGE( "Test isRunning", - bRun == sal_True && bTer == sal_False + bRun && !bTer ); } /** check the value of isRunning when suspending and after resume @@ -1026,29 +1026,25 @@ namespace osl_Thread void isRunning_002() { OCountThread *aCountThread = new OCountThread(); - sal_Bool bRes = aCountThread->create(); - CPPUNIT_ASSERT_MESSAGE ( "Can't start thread!", bRes == sal_True ); + bool bRes = aCountThread->create(); + CPPUNIT_ASSERT_MESSAGE ( "Can't start thread!", bRes ); // sal_Bool bRunning = aCountThread->isRunning(); // sal_Int32 nValue = 0; suspendCountThread(aCountThread); - sal_Bool bRunning_sup = aCountThread->isRunning(); + bool bRunning_sup = aCountThread->isRunning(); ThreadHelper::thread_sleep_tenth_sec(2); aCountThread->resume(); ThreadHelper::thread_sleep_tenth_sec(2); - sal_Bool bRunning_res = aCountThread->isRunning(); + bool bRunning_res = aCountThread->isRunning(); termAndJoinThread(aCountThread); - sal_Bool bRunning_ter = aCountThread->isRunning(); + bool bRunning_ter = aCountThread->isRunning(); delete aCountThread; CPPUNIT_ASSERT_MESSAGE( "Test isRunning", - bRes == sal_True && - bRunning_sup == sal_True && - bRunning_res == sal_True && - bRunning_ter == sal_False - ); + bRes && bRunning_sup && bRunning_res && !bRunning_ter ); } @@ -1674,8 +1670,8 @@ namespace osl_Thread sal_Int32 nWaitSec = 5; aCountThread->setWait(nWaitSec); // thread runs at least 5 seconds. - sal_Bool bRes = aCountThread->create(); - CPPUNIT_ASSERT_MESSAGE ( "Can't start thread!", bRes == sal_True ); + bool bRes = aCountThread->create(); + CPPUNIT_ASSERT_MESSAGE ( "Can't start thread!", bRes ); //record the time when the running begin StopWatch aStopWatch; @@ -1762,8 +1758,8 @@ namespace osl_Thread void schedule_001() { OAddThread* aThread = new OAddThread(); - sal_Bool bRes = aThread->create(); - CPPUNIT_ASSERT_MESSAGE ( "Can't start thread!", bRes == sal_True ); + bool bRes = aThread->create(); + CPPUNIT_ASSERT_MESSAGE ( "Can't start thread!", bRes ); ThreadHelper::thread_sleep_tenth_sec(2); aThread->suspend(); @@ -1810,8 +1806,8 @@ namespace osl_Thread void schedule_002() { ONoScheduleThread aThread; // this thread runs 10 sec. (no schedule() used) - sal_Bool bRes = aThread.create(); - CPPUNIT_ASSERT_MESSAGE ( "Can't start thread!", bRes == sal_True ); + bool bRes = aThread.create(); + CPPUNIT_ASSERT_MESSAGE ( "Can't start thread!", bRes ); ThreadHelper::thread_sleep_tenth_sec(2); aThread.suspend(); diff --git a/sal/qa/osl/security/TODO.h b/sal/qa/osl/security/TODO.h new file mode 100644 index 000000000000..082c54633074 --- /dev/null +++ b/sal/qa/osl/security/TODO.h @@ -0,0 +1,8 @@ +#include "sal/types.h" +#define T1(x) do { x; } while (0) +#define T2(x) do { x; } while (sal_False) +#define T3(x) do { x; } while (false) +#define T4(x, y) do { x; } while (y) +#define T5(x) T4(x, 0) +#define T6(x) T4(x, sal_False) +#define T7(x) T4(x, false) diff --git a/sal/qa/osl/security/osl_Security.cxx b/sal/qa/osl/security/osl_Security.cxx index b7befbcee48b..3e6ddf5261e5 100644 --- a/sal/qa/osl/security/osl_Security.cxx +++ b/sal/qa/osl/security/osl_Security.cxx @@ -39,10 +39,10 @@ using namespace rtl; /** print Boolean value. */ -inline void printBool( sal_Bool bOk ) +inline void printBool( bool bOk ) { //t_print("#printBool# " ); - ( sal_True == bOk ) ? t_print("TRUE!\n" ): t_print("FALSE!\n" ); + bOk ? t_print("TRUE!\n" ): t_print("FALSE!\n" ); } /** print a UNI_CODE String. @@ -70,7 +70,7 @@ namespace osl_Security class ctors : public CppUnit::TestFixture { public: - sal_Bool bRes, bRes1; + bool bRes, bRes1; void ctors_001( ) { @@ -96,7 +96,7 @@ namespace osl_Security class logonUser : public CppUnit::TestFixture { public: - sal_Bool bRes; + bool bRes; void logonUser_user_pwd( ) { @@ -104,7 +104,7 @@ namespace osl_Security bRes = aSec.logonUser( aLogonUser, aLogonPasswd ); CPPUNIT_ASSERT_MESSAGE( "#test comment#: check logon user through forwarded user name, pwd, passed in (UNX), failed in (W32).", - ( sal_True == bRes ) ); + bRes ); } void logonUser_user_pwd_server( ) @@ -113,7 +113,7 @@ namespace osl_Security bRes = aSec.logonUser( aLogonUser, aLogonPasswd, aFileServer ); CPPUNIT_ASSERT_MESSAGE( "#test comment#: check logon user through forwarded user name, pwd and server name, failed in (UNX)(W32).", - ( sal_True == bRes ) ); + bRes ); } @@ -138,7 +138,7 @@ namespace osl_Security class getUserIdent : public CppUnit::TestFixture { public: - sal_Bool bRes, bRes1; + bool bRes, bRes1; void getUserIdent_001( ) { @@ -154,7 +154,7 @@ namespace osl_Security aMessage.append(", bRes: "); aMessage.append(bRes); - CPPUNIT_ASSERT_MESSAGE( aMessage.getStr(), strUserID.equals(strID) && (bRes == sal_True)); + CPPUNIT_ASSERT_MESSAGE( aMessage.getStr(), strUserID.equals(strID) && bRes ); } CPPUNIT_TEST_SUITE( getUserIdent ); @@ -169,7 +169,7 @@ namespace osl_Security class getUserName : public CppUnit::TestFixture { public: - sal_Bool bRes, bRes1; + bool bRes, bRes1; void getUserName_001( ) { @@ -187,7 +187,7 @@ namespace osl_Security nPos = strGetName.indexOf(strName); } CPPUNIT_ASSERT_MESSAGE( "#test comment#: get UserName and compare it with names got at the beginning of the test.", - ( nPos >= 0 ) && ( sal_True == bRes ) ); + ( nPos >= 0 ) && bRes ); } CPPUNIT_TEST_SUITE( getUserName ); @@ -202,7 +202,7 @@ namespace osl_Security class getConfigDir : public CppUnit::TestFixture { public: - sal_Bool bRes, bRes1; + bool bRes, bRes1; void getConfigDir_001( ) { @@ -210,8 +210,7 @@ namespace osl_Security ::rtl::OUString strConfig; bRes = aSec.getConfigDir( strConfig ); - CPPUNIT_ASSERT_MESSAGE( "failed to find a ConfigDir!", - ( sal_True == bRes )); + CPPUNIT_ASSERT_MESSAGE( "failed to find a ConfigDir!", bRes ); } CPPUNIT_TEST_SUITE( getConfigDir ); @@ -225,7 +224,7 @@ namespace osl_Security class isAdministrator : public CppUnit::TestFixture { public: - sal_Bool bRes; + bool bRes; void isAdministrator_001( ) { @@ -271,9 +270,9 @@ namespace osl_Security void loadUserProfile( ) { ::osl::Security aSec; - sal_Bool bValue = osl_loadUserProfile(aSec.getHandle()); + bool bValue = osl_loadUserProfile(aSec.getHandle()); - CPPUNIT_ASSERT_MESSAGE( "empty function.", bValue == sal_False ); + CPPUNIT_ASSERT_MESSAGE( "empty function.", !bValue ); } void unloadUserProfile( ) @@ -378,7 +377,7 @@ void MyTestPlugInImpl::initialize( CPPUNIT_NS::TestFactoryRegistry *, /// is administrator; if( !getuid( ) ) - isAdmin = sal_True; + isAdmin = true; #endif #if defined ( WNT ) @@ -616,7 +615,7 @@ void MyTestPlugInImpl::initialize( CPPUNIT_NS::TestFactoryRegistry *, printUString( strUserID ); t_print("Current User is: "); - if ( isAdmin == sal_False ) + if ( !isAdmin ) t_print("NOT Administrator.\n" ); else t_print("Administrator.\n" ); diff --git a/sal/qa/osl/security/osl_Security_Const.h b/sal/qa/osl/security/osl_Security_Const.h index f1a9979d5aed..17e8c1a33df7 100644 --- a/sal/qa/osl/security/osl_Security_Const.h +++ b/sal/qa/osl/security/osl_Security_Const.h @@ -51,7 +51,7 @@ const char pTestString[17] = "Sun Microsystems"; ::rtl::OUString strUserName, strComputerName, strHomeDirectory; ::rtl::OUString strConfigDirectory, strUserID; -sal_Bool isAdmin = sal_False; +bool isAdmin = sal_False; #endif /* _OSL_SECURITY_CONST_H_ */ diff --git a/sal/qa/rtl/locale/rtl_locale.cxx b/sal/qa/rtl/locale/rtl_locale.cxx index 5494a18f9c52..85941d9b9e3a 100644 --- a/sal/qa/rtl/locale/rtl_locale.cxx +++ b/sal/qa/rtl/locale/rtl_locale.cxx @@ -275,10 +275,10 @@ public: rtl_Locale* pData1 = rtl_locale_register(rtl::OUString("en").getStr(), rtl::OUString("US").getStr(), rtl::OUString().getStr()); rtl_Locale* pData2 = rtl_locale_register(rtl::OUString("en").getStr(), rtl::OUString("US").getStr(), rtl::OUString().getStr()); - sal_Bool bLocaleAreEqual = sal_False; + bool bLocaleAreEqual = false; bLocaleAreEqual = (pData1 == pData2); - CPPUNIT_ASSERT_MESSAGE("check operator ==()", bLocaleAreEqual == sal_True); + CPPUNIT_ASSERT_MESSAGE("check operator ==()", bLocaleAreEqual); } void equals_002() diff --git a/sal/qa/rtl/oustring/rtl_OUString2.cxx b/sal/qa/rtl/oustring/rtl_OUString2.cxx index f4f25670f71a..2654e3dc0f3e 100644 --- a/sal/qa/rtl/oustring/rtl_OUString2.cxx +++ b/sal/qa/rtl/oustring/rtl_OUString2.cxx @@ -61,8 +61,8 @@ namespace rtl_OUString memset(pBuffer, 0, 2 * 8); free(pBuffer); - sal_Bool bResult = aStrToTest == "a String"; - CPPUNIT_ASSERT_MESSAGE("String must not be empty", bResult == sal_True); + bool bResult = aStrToTest == "a String"; + CPPUNIT_ASSERT_MESSAGE("String must not be empty", bResult); } // Change the following lines only, if you add, remove or rename diff --git a/sal/qa/rtl/strings/test_oustring_endswith.cxx b/sal/qa/rtl/strings/test_oustring_endswith.cxx index 2b4978dd39ca..dfdeebcc797c 100644 --- a/sal/qa/rtl/strings/test_oustring_endswith.cxx +++ b/sal/qa/rtl/strings/test_oustring_endswith.cxx @@ -100,7 +100,7 @@ void test::oustring::EndsWith::endsWith() RTL_CONSTASCII_STRINGPARAM(".endsWithIgnoreAsciiCaseAsciiL(")); appendString(msg, rtl::OString(data[i].str2, data[i].str2Len)); msg.append(RTL_CONSTASCII_STRINGPARAM(") == ")); - msg.append(static_cast< sal_Bool >(data[i].endsWith)); + msg.append(data[i].endsWith); CPPUNIT_ASSERT_MESSAGE( msg.getStr(), rtl::OUString( diff --git a/sal/qa/rtl/textenc/rtl_tencinfo.cxx b/sal/qa/rtl/textenc/rtl_tencinfo.cxx index 241e06763dc6..dd1e24490a19 100644 --- a/sal/qa/rtl/textenc/rtl_tencinfo.cxx +++ b/sal/qa/rtl/textenc/rtl_tencinfo.cxx @@ -1540,31 +1540,31 @@ namespace rtl_TextEncodingInfo aInfo1, aInfo2, aInfo3, aInfo4, aInfo5; aInfo1.StructSize = 4; // not implemented - sal_Bool bRes1 = rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_ARABIC, &aInfo1 ); + bool bRes1 = rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_ARABIC, &aInfo1 ); // implemented - sal_Bool bRes11 = rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_CYRILLIC, &aInfo1 ); - CPPUNIT_ASSERT_MESSAGE("should return sal_False.", bRes1 == sal_False && bRes11 == sal_False ); + bool bRes11 = rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_CYRILLIC, &aInfo1 ); + CPPUNIT_ASSERT_MESSAGE("should return sal_False.", !bRes1 && !bRes11); aInfo2.StructSize = 5; - sal_Bool bRes2 = rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_ARABIC, &aInfo2 ); - sal_Bool bRes21 = rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_CYRILLIC, &aInfo2 ); - CPPUNIT_ASSERT_MESSAGE("StructSize<6 should return sal_True", bRes2 == sal_True && bRes21 == sal_True && aInfo2.MinimumCharSize >=1 ); + bool bRes2 = rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_ARABIC, &aInfo2 ); + bool bRes21 = rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_CYRILLIC, &aInfo2 ); + CPPUNIT_ASSERT_MESSAGE("StructSize<6 should return sal_True", bRes2 && bRes21 && aInfo2.MinimumCharSize >=1 ); aInfo3.StructSize = 6; - sal_Bool bRes3 = rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_ARABIC, &aInfo3 ); - sal_Bool bRes31 = rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_CYRILLIC, &aInfo3 ); - CPPUNIT_ASSERT_MESSAGE("StructSize<6 should return sal_True", bRes3 == sal_True && bRes31 == sal_True ); + bool bRes3 = rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_ARABIC, &aInfo3 ); + bool bRes31 = rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_CYRILLIC, &aInfo3 ); + CPPUNIT_ASSERT_MESSAGE("StructSize<6 should return sal_True", bRes3 && bRes31); //&& aInfo2.MinimumCharSize >=1 ); aInfo4.StructSize = 8; - sal_Bool bRes4 = rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_ARABIC, &aInfo4 ); - sal_Bool bRes41 = rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_CYRILLIC, &aInfo4); - CPPUNIT_ASSERT_MESSAGE("StructSize<6 should return sal_True", bRes4 == sal_True && bRes41 == sal_True); + bool bRes4 = rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_ARABIC, &aInfo4 ); + bool bRes41 = rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_CYRILLIC, &aInfo4); + CPPUNIT_ASSERT_MESSAGE("StructSize<6 should return sal_True", bRes4 && bRes41); // && aInfo2.MinimumCharSize >=1 ); aInfo5.StructSize = sizeof aInfo5; - sal_Bool bRes5 = rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_ARABIC, &aInfo5 ); - CPPUNIT_ASSERT_MESSAGE("StructSize<6 should return sal_True", bRes5 == sal_False && aInfo5.Flags == 0); + bool bRes5 = rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_ARABIC, &aInfo5 ); + CPPUNIT_ASSERT_MESSAGE("StructSize<6 should return sal_True", !bRes5 && aInfo5.Flags == 0); } CPPUNIT_TEST_SUITE(testTextEncodingInfo); diff --git a/sal/qa/rtl/uuid/rtl_Uuid.cxx b/sal/qa/rtl/uuid/rtl_Uuid.cxx index 6082d47e9e42..df41381ed549 100644 --- a/sal/qa/rtl/uuid/rtl_Uuid.cxx +++ b/sal/qa/rtl/uuid/rtl_Uuid.cxx @@ -94,21 +94,21 @@ public: { rtl_createUuid( aNode[i], 0, sal_False ); } - sal_Bool bRes = sal_True; + bool bRes = true; for( i = 0 ; i < TEST_UUID ; i ++ ) { for( i2 = i+1 ; i2 < TEST_UUID ; i2 ++ ) { if ( rtl_compareUuid( aNode[i] , aNode[i2] ) == 0 ) { - bRes = sal_False; + bRes = false; break; } } - if ( bRes == sal_False ) + if ( !bRes ) break; } - CPPUNIT_ASSERT_MESSAGE("createUuid: every uuid must be different.", bRes == sal_True ); + CPPUNIT_ASSERT_MESSAGE("createUuid: every uuid must be different.", bRes); } /* void createUuid_002() diff --git a/sal/rtl/bootstrap.cxx b/sal/rtl/bootstrap.cxx index 27d8d52befb6..43275c37d55c 100644 --- a/sal/rtl/bootstrap.cxx +++ b/sal/rtl/bootstrap.cxx @@ -158,7 +158,7 @@ namespace { //---------------------------------------------------------------------------- -static sal_Bool getFromCommandLineArgs( +static bool getFromCommandLineArgs( rtl::OUString const & key, rtl::OUString * value ) { OSL_ASSERT(value != NULL); @@ -202,7 +202,7 @@ static sal_Bool getFromCommandLineArgs( pNameValueList = &nameValueList; } - sal_Bool found = sal_False; + bool found = false; for( NameValueList::iterator ii = pNameValueList->begin() ; ii != pNameValueList->end() ; @@ -211,7 +211,7 @@ static sal_Bool getFromCommandLineArgs( if( (*ii).sName.equals(key) ) { *value = (*ii).sValue; - found = sal_True; + found = true; break; } } @@ -761,7 +761,7 @@ sal_Bool SAL_CALL rtl_bootstrap_get_from_handle( { osl::MutexGuard guard( osl::Mutex::getGlobalMutex() ); - sal_Bool found = sal_False; + bool found = false; if(ppValue && pName) { if (handle == 0) diff --git a/sal/rtl/byteseq.cxx b/sal/rtl/byteseq.cxx index dfc0d96158be..10f2546fa024 100644 --- a/sal/rtl/byteseq.cxx +++ b/sal/rtl/byteseq.cxx @@ -234,10 +234,10 @@ sal_Bool SAL_CALL rtl_byte_sequence_equals( sal_Sequence *pSequence1 , sal_Seque { return sal_False; } - return (sal_Bool) - (memcmp( + return + memcmp( pSequence1->elements, pSequence2->elements, pSequence1->nElements ) - == 0); + == 0; } diff --git a/sal/rtl/random.cxx b/sal/rtl/random.cxx index 447ded5a23c6..53cce865e822 100644 --- a/sal/rtl/random.cxx +++ b/sal/rtl/random.cxx @@ -76,7 +76,7 @@ struct RandomPool_Impl /** __rtl_random_initPool. */ -static sal_Bool __rtl_random_initPool ( +static bool __rtl_random_initPool ( RandomPool_Impl *pImpl); /** __rtl_random_seedPool. @@ -108,7 +108,7 @@ static double __rtl_random_data (RandomData_Impl *pImpl) /* * __rtl_random_initPool. */ -static sal_Bool __rtl_random_initPool (RandomPool_Impl *pImpl) +static bool __rtl_random_initPool (RandomPool_Impl *pImpl) { pImpl->m_hDigest = rtl_digest_create (RTL_RANDOM_DIGEST); if (pImpl->m_hDigest) @@ -148,9 +148,9 @@ static sal_Bool __rtl_random_initPool (RandomPool_Impl *pImpl) seed = __rtl_random_data (&rd); __rtl_random_seedPool (pImpl, (sal_uInt8*)&seed, sizeof(seed)); } - return sal_True; + return true; } - return sal_False; + return false; } /* diff --git a/sal/rtl/strimp.cxx b/sal/rtl/strimp.cxx index da728ae4fb17..db554644f6a9 100644 --- a/sal/rtl/strimp.cxx +++ b/sal/rtl/strimp.cxx @@ -31,22 +31,22 @@ sal_Int16 rtl_ImplGetDigit( sal_Unicode ch, sal_Int16 nRadix ) return (n < nRadix) ? n : -1; } -sal_Bool rtl_ImplIsWhitespace( sal_Unicode c ) +bool rtl_ImplIsWhitespace( sal_Unicode c ) { /* Space or Control character? */ if ( (c <= 32) && c ) - return sal_True; + return true; /* Only in the General Punctuation area Space or Control characters are included? */ if ( (c < 0x2000) || (c > 0x206F) ) - return sal_False; + return false; if ( ((c >= 0x2000) && (c <= 0x200B)) || /* All Spaces */ (c == 0x2028) || /* LINE SEPARATOR */ (c == 0x2029) ) /* PARAGRAPH SEPARATOR */ - return sal_True; + return true; - return sal_False; + return false; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sal/rtl/strimp.hxx b/sal/rtl/strimp.hxx index 997d72c4c814..e31717c39539 100644 --- a/sal/rtl/strimp.hxx +++ b/sal/rtl/strimp.hxx @@ -48,7 +48,7 @@ sal_Int16 rtl_ImplGetDigit( sal_Unicode ch, sal_Int16 nRadix ); -sal_Bool rtl_ImplIsWhitespace( sal_Unicode c ); +bool rtl_ImplIsWhitespace( sal_Unicode c ); // string lifetime instrumentation / diagnostics #if USE_SDT_PROBES diff --git a/sal/rtl/string.cxx b/sal/rtl/string.cxx index 32ef07753560..9a651b65617a 100644 --- a/sal/rtl/string.cxx +++ b/sal/rtl/string.cxx @@ -173,12 +173,12 @@ static int rtl_ImplGetFastUTF8ByteLen( const sal_Unicode* pStr, sal_Int32 nLen ) /* ----------------------------------------------------------------------- */ -sal_Bool SAL_CALL rtl_impl_convertUStringToString(rtl_String ** pTarget, +bool SAL_CALL rtl_impl_convertUStringToString(rtl_String ** pTarget, sal_Unicode const * pSource, sal_Int32 nLength, rtl_TextEncoding nEncoding, sal_uInt32 nFlags, - sal_Bool bCheckErrors) + bool bCheckErrors) { OSL_ASSERT(pTarget != NULL && (pSource != NULL || nLength == 0) @@ -225,7 +225,7 @@ sal_Bool SAL_CALL rtl_impl_convertUStringToString(rtl_String ** pTarget, nLength--; } while ( nLength ); - return sal_True; + return true; } nMaxCharLen = 4; @@ -260,7 +260,7 @@ sal_Bool SAL_CALL rtl_impl_convertUStringToString(rtl_String ** pTarget, { rtl_freeMemory(pTemp); rtl_destroyUnicodeToTextConverter(hConverter); - return sal_False; + return false; } if ((nInfo & RTL_UNICODETOTEXT_INFO_DESTBUFFERTOSMALL) == 0) @@ -301,7 +301,7 @@ sal_Bool SAL_CALL rtl_impl_convertUStringToString(rtl_String ** pTarget, if ( pTemp && !nDestBytes ) rtl_string_new( pTarget ); } - return sal_True; + return true; } void SAL_CALL rtl_uString2String( rtl_String** ppThis, @@ -312,7 +312,7 @@ void SAL_CALL rtl_uString2String( rtl_String** ppThis, SAL_THROW_EXTERN_C() { rtl_impl_convertUStringToString(ppThis, pUStr, nULen, eTextEncoding, - nCvtFlags, sal_False); + nCvtFlags, false); } sal_Bool SAL_CALL rtl_convertUStringToString(rtl_String ** pTarget, @@ -323,7 +323,7 @@ sal_Bool SAL_CALL rtl_convertUStringToString(rtl_String ** pTarget, SAL_THROW_EXTERN_C() { return rtl_impl_convertUStringToString(pTarget, pSource, nLength, nEncoding, - nFlags, sal_True); + nFlags, true); } void rtl_string_newReplaceFirst( diff --git a/sal/rtl/strtmpl.cxx b/sal/rtl/strtmpl.cxx index f2eac10bf217..a9eb665e9216 100644 --- a/sal/rtl/strtmpl.cxx +++ b/sal/rtl/strtmpl.cxx @@ -898,7 +898,7 @@ namespace { sal_Int16 nRadix ) { BOOST_STATIC_ASSERT(std::numeric_limits<T>::is_signed); - sal_Bool bNeg; + bool bNeg; sal_Int16 nDigit; U n = 0; @@ -911,14 +911,14 @@ namespace { if ( *pStr == '-' ) { - bNeg = sal_True; + bNeg = true; pStr++; } else { if ( *pStr == '+' ) pStr++; - bNeg = sal_False; + bNeg = false; } T nDiv; diff --git a/sal/rtl/ustring.cxx b/sal/rtl/ustring.cxx index d31d6bc592dc..8c9760c8bb60 100644 --- a/sal/rtl/ustring.cxx +++ b/sal/rtl/ustring.cxx @@ -1026,7 +1026,7 @@ sal_Bool rtl_convertStringToUString( { sal_uInt32 info; rtl_string2UString_status(target, source, length, encoding, flags, &info); - return (sal_Bool) ((info & RTL_TEXTTOUNICODE_INFO_ERROR) == 0); + return (info & RTL_TEXTTOUNICODE_INFO_ERROR) == 0; } void rtl_uString_newReplaceFirst( |