diff options
Diffstat (limited to 'tools/source/fsys/dirent.cxx')
-rw-r--r-- | tools/source/fsys/dirent.cxx | 146 |
1 files changed, 73 insertions, 73 deletions
diff --git a/tools/source/fsys/dirent.cxx b/tools/source/fsys/dirent.cxx index 1bd43bffc4e7..b38d510322ac 100644 --- a/tools/source/fsys/dirent.cxx +++ b/tools/source/fsys/dirent.cxx @@ -130,11 +130,11 @@ int Sys2SolarError_Impl( int nSysErr ) #ifndef BOOTSTRAP FSysRedirector* FSysRedirector::_pRedirector = 0; -BOOL FSysRedirector::_bEnabled = TRUE; +sal_Bool FSysRedirector::_bEnabled = sal_True; #ifdef UNX -BOOL bInRedirection = TRUE; +sal_Bool bInRedirection = sal_True; #else -BOOL bInRedirection = FALSE; +sal_Bool bInRedirection = sal_False; #endif static NAMESPACE_VOS( OMutex )* pRedirectMutex = 0; @@ -172,7 +172,7 @@ void FSysRedirector::DoRedirect( String &rPath ) return; // dont redirect on nested calls - bInRedirection = TRUE; + bInRedirection = sal_True; // convert to URL #ifndef UNX @@ -186,7 +186,7 @@ void FSysRedirector::DoRedirect( String &rPath ) // do redirection Redirector(); - bInRedirection = FALSE; + bInRedirection = sal_False; return; } @@ -293,7 +293,7 @@ ByteString ImplCutPath( const ByteString& rStr, USHORT nMax, char cAccDel ) { USHORT nMaxPathLen = nMax; ByteString aCutPath( rStr ); - BOOL bInsertPrefix = FALSE; + sal_Bool bInsertPrefix = sal_False; USHORT nBegin = aCutPath.Search( cAccDel ); if( nBegin == STRING_NOTFOUND ) @@ -310,7 +310,7 @@ ByteString ImplCutPath( const ByteString& rStr, USHORT nMax, char cAccDel ) { nCount = nEnd - nBegin; aCutPath.Erase( nBegin, nCount ); - bInsertPrefix = TRUE; + bInsertPrefix = sal_True; } else break; @@ -1010,7 +1010,7 @@ DirEntry* DirEntry::ImpGetPreTopPtr() |* *************************************************************************/ -DirEntry* DirEntry::ImpChangeParent( DirEntry* pNewParent, BOOL bNormalize ) +DirEntry* DirEntry::ImpChangeParent( DirEntry* pNewParent, sal_Bool bNormalize ) { DBG_CHKTHIS( DirEntry, ImpCheckDirEntry ); @@ -1037,14 +1037,14 @@ DirEntry* DirEntry::ImpChangeParent( DirEntry* pNewParent, BOOL bNormalize ) |* *************************************************************************/ -BOOL DirEntry::Exists( FSysAccess nAccess ) const +sal_Bool DirEntry::Exists( FSysAccess nAccess ) const { #ifndef BOOTSTRAP static NAMESPACE_VOS(OMutex) aLocalMutex; NAMESPACE_VOS(OGuard) aGuard( aLocalMutex ); #endif if ( !IsValid() ) - return FALSE; + return sal_False; #if defined WNT || defined OS2 // spezielle Filenamen sind vom System da @@ -1060,14 +1060,14 @@ BOOL DirEntry::Exists( FSysAccess nAccess ) const aName.CompareIgnoreCaseToAscii("LPT3") == COMPARE_EQUAL || aName.CompareIgnoreCaseToAscii("NUL") == COMPARE_EQUAL || aName.CompareIgnoreCaseToAscii("PRN") == COMPARE_EQUAL ) ) - return TRUE; + return sal_True; #endif FSysFailOnErrorImpl(); DirEntryKind eKind = FileStat( *this, nAccess ).GetKind(); if ( eKind & ( FSYS_KIND_FILE | FSYS_KIND_DIR ) ) { - return TRUE; + return sal_True; } #if defined WNT || defined OS2 @@ -1090,7 +1090,7 @@ BOOL DirEntry::Exists( FSysAccess nAccess ) const |* *************************************************************************/ -BOOL DirEntry::First() +sal_Bool DirEntry::First() { FSysFailOnErrorImpl(); @@ -1120,12 +1120,12 @@ BOOL DirEntry::First() { aName = aFound; closedir( pDir ); - return TRUE; + return sal_True; } } closedir( pDir ); } - return FALSE; + return sal_False; } /************************************************************************* @@ -1138,7 +1138,7 @@ BOOL DirEntry::First() |* *************************************************************************/ -String DirEntry::GetFull( FSysPathStyle eStyle, BOOL bWithDelimiter, +String DirEntry::GetFull( FSysPathStyle eStyle, sal_Bool bWithDelimiter, USHORT nMaxChars ) const { DBG_CHKTHIS( DirEntry, ImpCheckDirEntry ); @@ -1463,18 +1463,18 @@ StringCompare DirEntry::NameCompare( const DirEntry &rWith ) const |* *************************************************************************/ -BOOL DirEntry::operator==( const DirEntry& rEntry ) const +sal_Bool DirEntry::operator==( const DirEntry& rEntry ) const { DBG_CHKTHIS( DirEntry, ImpCheckDirEntry ); // test wheather the contents are textual the same if ( nError && ( nError == rEntry.nError ) ) - return TRUE; + return sal_True; if ( nError || rEntry.nError || ( eFlag == FSYS_FLAG_INVALID ) || ( rEntry.eFlag == FSYS_FLAG_INVALID ) ) - return FALSE; + return sal_False; #ifndef OS2 const @@ -1547,10 +1547,10 @@ DirEntry DirEntry::operator+( const DirEntry& rEntry ) const { DBG_CHKTHIS( DirEntry, ImpCheckDirEntry ); #ifdef DBG_UTIL - static BOOL bTested = FALSE; + static sal_Bool bTested = sal_False; if ( !bTested ) { - bTested = TRUE; + bTested = sal_True; FSysTest(); } #endif @@ -1572,7 +1572,7 @@ DirEntry DirEntry::operator+( const DirEntry& rEntry ) const (eFlag == FSYS_FLAG_RELROOT && !aName.Len()) || ( (pEntryTop->aName.Len() || - ((rEntry.Level()>1)?(rEntry[rEntry.Level()-2].aName.CompareIgnoreCaseToAscii(RFS_IDENTIFIER)==COMPARE_EQUAL):FALSE)) + ((rEntry.Level()>1)?(rEntry[rEntry.Level()-2].aName.CompareIgnoreCaseToAscii(RFS_IDENTIFIER)==COMPARE_EQUAL):sal_False)) && (pEntryTop->eFlag == FSYS_FLAG_ABSROOT || pEntryTop->eFlag == FSYS_FLAG_RELROOT || @@ -1767,14 +1767,14 @@ void DirEntry::SetName( const String& rName, FSysPathStyle eFormatter ) |* Letzte Aenderung MA 02.12.91 |* *************************************************************************/ -BOOL DirEntry::Find( const String& rPfad, char cDelim ) +sal_Bool DirEntry::Find( const String& rPfad, char cDelim ) { DBG_CHKTHIS( DirEntry, ImpCheckDirEntry ); if ( ImpGetTopPtr()->eFlag == FSYS_FLAG_ABSROOT ) - return TRUE; + return sal_True; - BOOL bWild = aName.Search( '*' ) != STRING_NOTFOUND || + sal_Bool bWild = aName.Search( '*' ) != STRING_NOTFOUND || aName.Search( '?' ) != STRING_NOTFOUND; if ( !cDelim ) cDelim = SEARCHDELIM(DEFSTYLE)[0]; @@ -1797,11 +1797,11 @@ BOOL DirEntry::Find( const String& rPfad, char cDelim ) ( ( !bWild && aEntry.Exists() ) || ( bWild && aEntry.First() ) ) ) { (*this) = aEntry; - return TRUE; + return sal_True; } } } - return FALSE; + return sal_False; } /************************************************************************* @@ -1814,7 +1814,7 @@ BOOL DirEntry::Find( const String& rPfad, char cDelim ) |* *************************************************************************/ -BOOL DirEntry::ImpToRel( String aCurStr ) +sal_Bool DirEntry::ImpToRel( String aCurStr ) { DBG_CHKTHIS( DirEntry, ImpCheckDirEntry ); @@ -1840,7 +1840,7 @@ BOOL DirEntry::ImpToRel( String aCurStr ) { // dann ist der relative Pfad das aktuelle Verzeichnis *this = DirEntry(); - return TRUE; + return sal_True; } // Sonderfall, die DirEntries sind total verschieden @@ -1848,7 +1848,7 @@ BOOL DirEntry::ImpToRel( String aCurStr ) { // dann ist der relativste Pfad absolut *this = aThis; - return FALSE; + return sal_False; } // sonst nehmen wir die identischen Einzelteile vorne weg @@ -1864,7 +1864,7 @@ BOOL DirEntry::ImpToRel( String aCurStr ) // das ist dann unser relativer Pfad *this = DirEntry( aThisStr, FSYS_STYLE_HPFS ); - return TRUE; + return sal_True; } /************************************************************************* @@ -1917,7 +1917,7 @@ USHORT DirEntry::CutRelParents() |* *************************************************************************/ -BOOL DirEntry::ToRel() +sal_Bool DirEntry::ToRel() { DBG_CHKTHIS( DirEntry, ImpCheckDirEntry ); @@ -1936,7 +1936,7 @@ BOOL DirEntry::ToRel() |* *************************************************************************/ -BOOL DirEntry::ToRel( const DirEntry& rStart ) +sal_Bool DirEntry::ToRel( const DirEntry& rStart ) { DBG_CHKTHIS( DirEntry, ImpCheckDirEntry ); @@ -2075,7 +2075,7 @@ const DirEntry& DirEntry::SetTempNameBase( const String &rBase ) { // Create the directory and only on success give all rights to // everyone. Use mkdir instead of DirEntry::MakeDir because - // this returns TRUE even if directory already exists. + // this returns sal_True even if directory already exists. if ( !mkdir( aName.GetBuffer(), S_IRWXU | S_IRWXG | S_IRWXO ) ) chmod( aName.GetBuffer(), S_IRWXU | S_IRWXG | S_IRWXO ); @@ -2427,11 +2427,11 @@ ErrCode CreateEntry_Impl( const DirEntry &rPath, DirEntryKind eKind ) return eErr; } -BOOL IsValidEntry_Impl( const DirEntry &rPath, +sal_Bool IsValidEntry_Impl( const DirEntry &rPath, const String &rLongName, DirEntryKind eKind, - BOOL bIsShortened, - BOOL bUseDelim ) + sal_Bool bIsShortened, + sal_Bool bUseDelim ) { // Parameter-Pr"uefung DBG_ASSERT( eKind == FSYS_KIND_NONE || eKind == FSYS_KIND_ALL || @@ -2445,16 +2445,16 @@ BOOL IsValidEntry_Impl( const DirEntry &rPath, DirEntry aPath(rPath); DirEntry aName(rLongName, eStyle); if ( !aName.IsValid() || aName.Level() != 1 ) - return FALSE; + return sal_False; aPath += aName; if ( 1 == aPath.Level() ) - return FALSE; + return sal_False; if ( eStyle == FSYS_STYLE_FAT || eStyle == FSYS_STYLE_NWFS || eStyle == FSYS_STYLE_UNKNOWN ) { DirEntry aDosEntry( rLongName, FSYS_STYLE_FAT ); if ( !aDosEntry.IsValid() ) - return FALSE; + return sal_False; } // Pfad-Trenner sind nicht erlaubt (bei ungek"urzten auch nicht FSYS_SHORTNAME_DELIMITER) @@ -2464,12 +2464,12 @@ BOOL IsValidEntry_Impl( const DirEntry &rPath, (!bIsShortened && rLongName.Search(cDelim) != STRING_NOTFOUND) ) { - return FALSE; + return sal_False; } // MI: Abfrage nach 'CON:' etc. wird jetzt in Exists() mitgemacht if ( aPath.Exists() ) - return FALSE; + return sal_False; return (ERRCODE_NONE == CreateEntry_Impl( aPath, eKind )); } @@ -2488,8 +2488,8 @@ BOOL IsValidEntry_Impl( const DirEntry &rPath, #define MAX_LEN_MAX 255 #define INVALID_CHARS_DEF "\\/\"':|^<>?*" -BOOL DirEntry::MakeShortName( const String& rLongName, DirEntryKind eKind, - BOOL bUseDelim, FSysPathStyle eStyle ) +sal_Bool DirEntry::MakeShortName( const String& rLongName, DirEntryKind eKind, + sal_Bool bUseDelim, FSysPathStyle eStyle ) { String aLongName(rLongName); @@ -2525,10 +2525,10 @@ BOOL DirEntry::MakeShortName( const String& rLongName, DirEntryKind eKind, } // ist der Langname direkt verwendbar? - if ( IsValidEntry_Impl( *this, aLongName, eKind, FALSE, bUseDelim ) ) + if ( IsValidEntry_Impl( *this, aLongName, eKind, sal_False, bUseDelim ) ) { operator+=( DirEntry(aLongName) ); - return TRUE; + return sal_True; } // max L"angen feststellen @@ -2604,11 +2604,11 @@ BOOL DirEntry::MakeShortName( const String& rLongName, DirEntryKind eKind, operator+=( DirEntry(String(aNewName, osl_getThreadTextEncoding())) ); if ( FSYS_KIND_ALL == eKind && CMP_LOWER(aName) == aOldName ) if ( FSYS_KIND_ALL == eKind && CMP_LOWER(ByteString(GetName(), osl_getThreadTextEncoding())) == aOldName ) - return TRUE; + return sal_True; // kann der gek"urzte Name direkt verwendet werden? if ( !Exists() && (ERRCODE_NONE == CreateEntry_Impl( *this, eKind )) ) - return TRUE; + return sal_True; // darf '?##' verwendet werden, um eindeutigen Name zu erzeugen? if ( bUseDelim ) @@ -2639,7 +2639,7 @@ BOOL DirEntry::MakeShortName( const String& rLongName, DirEntryKind eKind, // keine ## mehr frei / ?## soll nicht verwendet werden nError = ERRCODE_IO_ALREADYEXISTS; - return FALSE; + return sal_False; } /************************************************************************* @@ -2652,34 +2652,34 @@ BOOL DirEntry::MakeShortName( const String& rLongName, DirEntryKind eKind, |* *************************************************************************/ -BOOL DirEntry::MakeDir( BOOL bSloppy ) const +sal_Bool DirEntry::MakeDir( sal_Bool bSloppy ) const { DBG_CHKTHIS( DirEntry, ImpCheckDirEntry ); // Schnellpruefung, ob vorhanden if ( FileStat( *this ).IsKind( FSYS_KIND_DIR ) ) - return TRUE; + return sal_True; if ( bSloppy && pParent ) if ( FileStat( *pParent ).IsKind( FSYS_KIND_DIR ) ) - return TRUE; + return sal_True; const DirEntry *pNewDir = bSloppy ? pParent : this; if ( pNewDir ) { // den Path zum Dir erzeugen - if ( pNewDir->pParent && !pNewDir->pParent->MakeDir(FALSE) ) - return FALSE; + if ( pNewDir->pParent && !pNewDir->pParent->MakeDir(sal_False) ) + return sal_False; // das Dir selbst erzeugen if ( pNewDir->eFlag == FSYS_FLAG_ABSROOT || pNewDir->eFlag == FSYS_FLAG_ABSROOT || pNewDir->eFlag == FSYS_FLAG_VOLUME ) - return TRUE; + return sal_True; else { //? nError = ??? if ( FileStat( *pNewDir ).IsKind( FSYS_KIND_DIR ) ) - return TRUE; + return sal_True; else { FSysFailOnErrorImpl(); @@ -2693,7 +2693,7 @@ BOOL DirEntry::MakeDir( BOOL bSloppy ) const #ifdef WIN32 SetLastError(0); #endif - BOOL bResult = (0 == _mkdir( (char*) bDirName.GetBuffer() )); + sal_Bool bResult = (0 == _mkdir( (char*) bDirName.GetBuffer() )); if ( !bResult ) { // Wer hat diese Methode const gemacht ? @@ -2708,7 +2708,7 @@ BOOL DirEntry::MakeDir( BOOL bSloppy ) const } } } - return TRUE; + return sal_True; } /************************************************************************* @@ -2820,7 +2820,7 @@ FSysError DirEntry::MoveTo( const DirEntry& rNewName ) const // ja, also intra-device-move mit MoveFile MoveFile( bFrom.GetBuffer(), bTo.GetBuffer() ); // MoveFile ist buggy bei cross-device operationen. - // Der R?ckgabewert ist auch dann TRUE, wenn nur ein Teil der Operation geklappt hat. + // Der R?ckgabewert ist auch dann sal_True, wenn nur ein Teil der Operation geklappt hat. // Zudem zeigt MoveFile unterschiedliches Verhalten bei unterschiedlichen NT-Versionen. return Sys2SolarError_Impl( GetLastError() ); } @@ -2942,10 +2942,10 @@ FSysError DirEntry::Kill( FSysAction nActions ) const pName[bTmpName.Len()+1] = (char) 0; //read-only files sollen auch geloescht werden koennen - BOOL isReadOnly = FileStat::GetReadOnlyFlag(*this); + sal_Bool isReadOnly = FileStat::GetReadOnlyFlag(*this); if (isReadOnly) { - FileStat::SetReadOnlyFlag(*this, FALSE); + FileStat::SetReadOnlyFlag(*this, sal_False); } // directory? @@ -3058,7 +3058,7 @@ FSysError DirEntry::Kill( FSysAction nActions ) const |* *************************************************************************/ -BOOL DirEntry::Contains( const DirEntry &rSubEntry ) const +sal_Bool DirEntry::Contains( const DirEntry &rSubEntry ) const { DBG_ASSERT( IsAbs() && rSubEntry.IsAbs(), "must be absolute entries" ); @@ -3068,10 +3068,10 @@ BOOL DirEntry::Contains( const DirEntry &rSubEntry ) const { for ( ; nThisLevel; --nThisLevel, --nSubLevel ) if ( (*this)[nThisLevel-1] != rSubEntry[nSubLevel-1] ) - return FALSE; - return TRUE; + return sal_False; + return sal_True; } - return FALSE; + return sal_False; } /************************************************************************* @@ -3139,7 +3139,7 @@ String DirEntry::ConvertSystemToName( const String &rName ) |* *************************************************************************/ -BOOL DirEntry::IsValid() const +sal_Bool DirEntry::IsValid() const { return (nError == FSYS_ERR_OK); } @@ -3154,9 +3154,9 @@ BOOL DirEntry::IsValid() const |* *************************************************************************/ -BOOL DirEntry::IsRFSAvailable() +sal_Bool DirEntry::IsRFSAvailable() { - return FALSE; + return sal_False; } /************************************************************************* @@ -3171,14 +3171,14 @@ BOOL DirEntry::IsRFSAvailable() |* *************************************************************************/ -BOOL DirEntry::IsLongNameOnFAT() const +sal_Bool DirEntry::IsLongNameOnFAT() const { // FAT-System? DirEntry aTempDirEntry(*this); aTempDirEntry.ToAbs(); if (DirEntry::GetPathStyle(aTempDirEntry.GetDevice().GetName().GetChar(0)) != FSYS_STYLE_FAT) { - return FALSE; // nein, also false + return sal_False; // nein, also false } // DirEntry-Kette auf lange Dateinamen pr?fen @@ -3190,15 +3190,15 @@ BOOL DirEntry::IsLongNameOnFAT() const if (aBase.Len()>8) // Name > 8? { - return TRUE; + return sal_True; } if (aExtension.Len()>3) // Extension > 3? { - return TRUE; + return sal_True; } } - return FALSE; + return sal_False; } //======================================================================== |