diff options
author | Xiaofei Zhang <Zhangxiaofei@openoffice.org> | 2010-07-29 10:56:19 +0800 |
---|---|---|
committer | Xiaofei Zhang <Zhangxiaofei@openoffice.org> | 2010-07-29 10:56:19 +0800 |
commit | d210c6ccc30466e98240c1409df0550514668d68 (patch) | |
tree | 0c94d52ecaebd283a92275cb372d5ddf926f5131 /sot/source | |
parent | 7f0993d43019a0ccb7f89c11fc23704c063b902f (diff) |
#i112600#: clean up l10ntools, rsc, sot, svl, tools and unotools
Diffstat (limited to 'sot/source')
24 files changed, 1401 insertions, 1401 deletions
diff --git a/sot/source/base/exchange.cxx b/sot/source/base/exchange.cxx index 67c2b64f105f..2b51162df3a0 100644 --- a/sot/source/base/exchange.cxx +++ b/sot/source/base/exchange.cxx @@ -237,11 +237,11 @@ static List& InitFormats_Impl() |* |* Beschreibung CLIP.SDW *************************************************************************/ -ULONG SotExchange::RegisterFormatName( const String& rName ) +sal_uIntPtr SotExchange::RegisterFormatName( const String& rName ) { const DataFlavorRepresentation *pFormatArray_Impl = FormatArray_Impl::get(); // teste zuerst die Standard - Name - ULONG i, nMax = SOT_FORMAT_FILE_LIST; + sal_uIntPtr i, nMax = SOT_FORMAT_FILE_LIST; for( i = SOT_FORMAT_STRING; i <= nMax; ++i ) if( COMPARE_EQUAL == rName.CompareToAscii( pFormatArray_Impl[ i ].pName ) ) return i; @@ -277,11 +277,11 @@ ULONG SotExchange::RegisterFormatName( const String& rName ) return nMax + SOT_FORMATSTR_ID_USER_END + 1; } -ULONG SotExchange::RegisterFormatMimeType( const String& rMimeType ) +sal_uIntPtr SotExchange::RegisterFormatMimeType( const String& rMimeType ) { const DataFlavorRepresentation *pFormatArray_Impl = FormatArray_Impl::get(); // teste zuerst die Standard - Name - ULONG i, nMax = SOT_FORMAT_FILE_LIST; + sal_uIntPtr i, nMax = SOT_FORMAT_FILE_LIST; for( i = SOT_FORMAT_STRING; i <= nMax; ++i ) if( rMimeType.EqualsAscii( pFormatArray_Impl[ i ].pMimeType ) ) return i; @@ -318,9 +318,9 @@ ULONG SotExchange::RegisterFormatMimeType( const String& rMimeType ) |* |* Beschreibung CLIP.SDW *************************************************************************/ -ULONG SotExchange::RegisterFormat( const DataFlavor& rFlavor ) +sal_uIntPtr SotExchange::RegisterFormat( const DataFlavor& rFlavor ) { - ULONG nRet = GetFormat( rFlavor ); + sal_uIntPtr nRet = GetFormat( rFlavor ); if( !nRet ) { @@ -338,7 +338,7 @@ ULONG SotExchange::RegisterFormat( const DataFlavor& rFlavor ) |* *************************************************************************/ -sal_Bool SotExchange::GetFormatDataFlavor( ULONG nFormat, DataFlavor& rFlavor ) +sal_Bool SotExchange::GetFormatDataFlavor( sal_uIntPtr nFormat, DataFlavor& rFlavor ) { sal_Bool bRet; @@ -376,11 +376,11 @@ sal_Bool SotExchange::GetFormatDataFlavor( ULONG nFormat, DataFlavor& rFlavor ) /************************************************************************* |* -|* SotExchange::GetFormatMimeType( ULONG nFormat ) +|* SotExchange::GetFormatMimeType( sal_uIntPtr nFormat ) |* *************************************************************************/ -String SotExchange::GetFormatMimeType( ULONG nFormat ) +String SotExchange::GetFormatMimeType( sal_uIntPtr nFormat ) { String sMimeType; if( SOT_FORMATSTR_ID_USER_END >= nFormat ) @@ -406,10 +406,10 @@ String SotExchange::GetFormatMimeType( ULONG nFormat ) |* *************************************************************************/ -ULONG SotExchange::GetFormatIdFromMimeType( const String& rMimeType ) +sal_uIntPtr SotExchange::GetFormatIdFromMimeType( const String& rMimeType ) { const DataFlavorRepresentation *pFormatArray_Impl = FormatArray_Impl::get(); - ULONG i, nMax = SOT_FORMAT_FILE_LIST; + sal_uIntPtr i, nMax = SOT_FORMAT_FILE_LIST; for( i = SOT_FORMAT_STRING; i <= nMax; ++i ) if( rMimeType.EqualsAscii( pFormatArray_Impl[ i ].pMimeType ) ) return i; @@ -443,12 +443,12 @@ ULONG SotExchange::GetFormatIdFromMimeType( const String& rMimeType ) |* |* Beschreibung CLIP.SDW *************************************************************************/ -ULONG SotExchange::GetFormat( const DataFlavor& rFlavor ) +sal_uIntPtr SotExchange::GetFormat( const DataFlavor& rFlavor ) { // teste zuerst die Standard - Name const ::rtl::OUString& rMimeType = rFlavor.MimeType; const String aMimeType( rMimeType ); - ULONG i, nMax = SOT_FORMAT_FILE_LIST; + sal_uIntPtr i, nMax = SOT_FORMAT_FILE_LIST; const DataFlavorRepresentation *pFormatArray_Impl = FormatArray_Impl::get(); for( i = SOT_FORMAT_STRING; i <= nMax; ++i ) if( aMimeType.EqualsAscii( pFormatArray_Impl[ i ].pMimeType ) ) @@ -482,7 +482,7 @@ ULONG SotExchange::GetFormat( const DataFlavor& rFlavor ) |* |* Beschreibung CLIP.SDW *************************************************************************/ -String SotExchange::GetFormatName( ULONG nFormat ) +String SotExchange::GetFormatName( sal_uIntPtr nFormat ) { DataFlavor aFlavor; String aRet; @@ -493,7 +493,7 @@ String SotExchange::GetFormatName( ULONG nFormat ) return aRet; } -BOOL SotExchange::IsInternal( const SvGlobalName& rName ) +sal_Bool SotExchange::IsInternal( const SvGlobalName& rName ) { if ( rName == SvGlobalName(SO3_SW_CLASSID_60) || rName == SvGlobalName(SO3_SC_CLASSID_60) || @@ -503,6 +503,6 @@ BOOL SotExchange::IsInternal( const SvGlobalName& rName ) rName == SvGlobalName(SO3_SM_CLASSID_60) || rName == SvGlobalName(SO3_SWWEB_CLASSID_60) || rName == SvGlobalName(SO3_SWGLOB_CLASSID_60) ) - return TRUE; - return FALSE; + return sal_True; + return sal_False; } diff --git a/sot/source/base/factory.cxx b/sot/source/base/factory.cxx index 4934f99e78c6..5c4757188f38 100644 --- a/sot/source/base/factory.cxx +++ b/sot/source/base/factory.cxx @@ -96,10 +96,10 @@ void SotFactory::DeInit() aStr += " Count: "; aStr += p->GetRefCount(); DBG_TRACE( "\tReferences:" ); - p->TestObjRef( FALSE ); + p->TestObjRef( sal_False ); #ifdef TEST_INVARIANT DBG_TRACE( "\tInvariant:" ); - p->TestInvariant( TRUE ); + p->TestInvariant( sal_True ); #endif p = pObjList->Next(); } @@ -129,7 +129,7 @@ void SotFactory::DeInit() if( pSotData->pDataFlavorList ) { - for( ULONG i = 0, nMax = pSotData->pDataFlavorList->Count(); i < nMax; i++ ) + for( sal_uIntPtr i = 0, nMax = pSotData->pDataFlavorList->Count(); i < nMax; i++ ) delete (::com::sun::star::datatransfer::DataFlavor*) pSotData->pDataFlavorList->GetObject( i ); delete pSotData->pDataFlavorList; pSotData->pDataFlavorList = NULL; @@ -194,7 +194,7 @@ SotFactory::~SotFactory() |* |* Beschreibung Zugriffsmethoden auf SotData_Impl-Daten *************************************************************************/ -UINT32 SotFactory::GetSvObjectCount() +sal_uInt32 SotFactory::GetSvObjectCount() { return SOTDATA()->nSvObjCount; } @@ -295,10 +295,10 @@ void SotFactory::TestInvariant() SotData_Impl * pSotData = SOTDATA(); if( pSotData->pObjectList ) { - ULONG nCount = pSotData->pObjectList->Count(); - for( ULONG i = 0; i < nCount ; i++ ) + sal_uIntPtr nCount = pSotData->pObjectList->Count(); + for( sal_uIntPtr i = 0; i < nCount ; i++ ) { - pSotData->pObjectList->GetObject( i )->TestInvariant( FALSE ); + pSotData->pObjectList->GetObject( i )->TestInvariant( sal_False ); } } #endif @@ -388,17 +388,17 @@ void * SotFactory::AggCastAndAddRef |* |* Beschreibung *************************************************************************/ -BOOL SotFactory::Is( const SotFactory * pSuperCl ) const +sal_Bool SotFactory::Is( const SotFactory * pSuperCl ) const { if( this == pSuperCl ) - return TRUE; + return sal_True; - for( USHORT i = 0; i < nSuperCount; i++ ) + for( sal_uInt16 i = 0; i < nSuperCount; i++ ) { if( pSuperClasses[ i ]->Is( pSuperCl ) ) - return TRUE; + return sal_True; } - return FALSE; + return sal_False; } diff --git a/sot/source/base/filelist.cxx b/sot/source/base/filelist.cxx index 4f854add304d..80828e596538 100644 --- a/sot/source/base/filelist.cxx +++ b/sot/source/base/filelist.cxx @@ -61,8 +61,8 @@ FileList::~FileList() void FileList::ClearAll( void ) { // Strings in der Liste loeschen - ULONG nCount = pStrList->Count(); - for( ULONG i = 0 ; i < nCount ; i++ ) + sal_uIntPtr nCount = pStrList->Count(); + for( sal_uIntPtr i = 0 ; i < nCount ; i++ ) delete pStrList->GetObject( i ); // Liste loeschen @@ -81,8 +81,8 @@ FileList& FileList::operator=( const FileList& rFileList ) *pStrList = *rFileList.pStrList; // Strings in der Liste kopieren - ULONG nCount = pStrList->Count(); - for( ULONG i = 0 ; i < nCount ; i++ ) + sal_uIntPtr nCount = pStrList->Count(); + for( sal_uIntPtr i = 0 ; i < nCount ; i++ ) pStrList->Replace( new String( *rFileList.pStrList->GetObject( i ) ), i ); return *this; @@ -94,7 +94,7 @@ FileList& FileList::operator=( const FileList& rFileList ) |* \*************************************************************************/ -ULONG FileList::GetFormat() +sal_uIntPtr FileList::GetFormat() { return FORMAT_FILE_LIST; } @@ -184,7 +184,7 @@ void FileList::AppendFile( const String& rStr ) pStrList->Insert( new String( rStr ) , pStrList->Count() ); } -String FileList::GetFile( ULONG i ) const +String FileList::GetFile( sal_uIntPtr i ) const { String aStr; if( i < pStrList->Count() ) @@ -192,7 +192,7 @@ String FileList::GetFile( ULONG i ) const return aStr; } -ULONG FileList::Count( void ) const +sal_uIntPtr FileList::Count( void ) const { return pStrList->Count(); } diff --git a/sot/source/base/formats.cxx b/sot/source/base/formats.cxx index baddde6e716f..10b6958ca4ac 100644 --- a/sot/source/base/formats.cxx +++ b/sot/source/base/formats.cxx @@ -46,9 +46,9 @@ using namespace::com::sun::star::datatransfer; struct SotAction_Impl { - ULONG nFormatId; // Clipboard Id - USHORT nAction; // Action Id - BYTE nContextCheckId; // additional check of content in clipboard + sal_uIntPtr nFormatId; // Clipboard Id + sal_uInt16 nAction; // Action Id + sal_uInt8 nContextCheckId; // additional check of content in clipboard }; @@ -68,7 +68,7 @@ struct SotAction_Impl struct SotDestinationEntry_Impl { - USHORT nDestination; + sal_uInt16 nDestination; const SotAction_Impl* aDefaultActions; const SotAction_Impl* aMoveActions; const SotAction_Impl* aCopyActions; @@ -1283,7 +1283,7 @@ static SotDestinationEntry_Impl __READONLY_DATA aDestinationArray[] = \ // - new style GetExchange methods - // --------------------------------- -sal_Bool IsFormatSupported( const DataFlavorExVector& rDataFlavorExVector, ULONG nId ) +sal_Bool IsFormatSupported( const DataFlavorExVector& rDataFlavorExVector, sal_uIntPtr nId ) { DataFlavorExVector::iterator aIter( ( (DataFlavorExVector&) rDataFlavorExVector ).begin() ); DataFlavorExVector::iterator aEnd( ( (DataFlavorExVector&) rDataFlavorExVector ).end() ); @@ -1303,14 +1303,14 @@ sal_Bool IsFormatSupported( const DataFlavorExVector& rDataFlavorExVector, ULONG // ----------------------------------------------------------------------------- -static BOOL CheckTransferableContext_Impl( const Reference< XTransferable >* pxTransferable, const SotAction_Impl& +static sal_Bool CheckTransferableContext_Impl( const Reference< XTransferable >* pxTransferable, const SotAction_Impl& #ifdef WNT rEntry #endif ) { DataFlavor aFlavor; - BOOL bRet = TRUE; + sal_Bool bRet = sal_True; try { @@ -1323,7 +1323,7 @@ rEntry { case FILEGRPDSC_ONLY_URL: { - bRet = FALSE; + bRet = sal_False; if( SotExchange::GetFormatDataFlavor( SOT_FORMATSTR_ID_FILECONTENT, aFlavor ) && (*pxTransferable)->isDataFlavorSupported( aFlavor ) && @@ -1367,11 +1367,11 @@ rEntry // ----------------------------------------------------------------------------- -static USHORT GetTransferableAction_Impl( +static sal_uInt16 GetTransferableAction_Impl( const DataFlavorExVector& rDataFlavorExVector, const SotAction_Impl* pArray, - ULONG& rFormat, - ULONG nOnlyTestFormat, + sal_uIntPtr& rFormat, + sal_uIntPtr nOnlyTestFormat, const Reference< XTransferable >* pxTransferable ) { try @@ -1380,11 +1380,11 @@ static USHORT GetTransferableAction_Impl( { DataFlavor aFlavor; const SotAction_Impl* pArrayStart = pArray; - ULONG nId = pArray->nFormatId; + sal_uIntPtr nId = pArray->nFormatId; #if OSL_DEBUG_LEVEL > 1 // used for testing a specific format - change in the debugger the value - static ULONG nChkFormat = 0; + static sal_uIntPtr nChkFormat = 0; if( nChkFormat ) { for( ; 0xffff != pArray->nFormatId && @@ -1454,13 +1454,13 @@ static USHORT GetTransferableAction_Impl( // ----------------------------------------------------------------------------- -USHORT SotExchange::GetExchangeAction( const DataFlavorExVector& rDataFlavorExVector, - USHORT nDestination, - USHORT nSourceOptions, - USHORT nUserAction, - ULONG& rFormat, - USHORT& rDefaultAction, - ULONG nOnlyTestFormat, +sal_uInt16 SotExchange::GetExchangeAction( const DataFlavorExVector& rDataFlavorExVector, + sal_uInt16 nDestination, + sal_uInt16 nSourceOptions, + sal_uInt16 nUserAction, + sal_uIntPtr& rFormat, + sal_uInt16& rDefaultAction, + sal_uIntPtr nOnlyTestFormat, const Reference< XTransferable >* pxTransferable ) { // hier wird jetzt die oben definierte Tabelle "implementiert" @@ -1568,11 +1568,11 @@ USHORT SotExchange::GetExchangeAction( const DataFlavorExVector& rDataFlavorExVe // ----------------------------------------------------------------------------- -USHORT SotExchange::GetExchangeAction( +sal_uInt16 SotExchange::GetExchangeAction( const Reference< XTransferable >& rxTransferable, - USHORT nDestination, USHORT nSourceOptions, - USHORT nUserAction, ULONG& rFormat, - USHORT& rDefaultAction, ULONG nOnlyTestFormat ) + sal_uInt16 nDestination, sal_uInt16 nSourceOptions, + sal_uInt16 nUserAction, sal_uIntPtr& rFormat, + sal_uInt16& rDefaultAction, sal_uIntPtr nOnlyTestFormat ) { DataFlavorExVector aVector; @@ -1625,9 +1625,9 @@ USHORT SotExchange::GetExchangeAction( nOnlyTestFormat, &rxTransferable ) ); } -USHORT SotExchange::IsChart( const SvGlobalName& rName ) +sal_uInt16 SotExchange::IsChart( const SvGlobalName& rName ) { - USHORT nRet=0; + sal_uInt16 nRet=0; // if ( rName == SvGlobalName( SO3_SCH_CLASSID_8 ) ) // nRet = SOFFICE_FILEFORMAT_8; // else @@ -1643,9 +1643,9 @@ USHORT SotExchange::IsChart( const SvGlobalName& rName ) return nRet; } -USHORT SotExchange::IsMath( const SvGlobalName& rName ) +sal_uInt16 SotExchange::IsMath( const SvGlobalName& rName ) { - USHORT nRet=0; + sal_uInt16 nRet=0; // if ( rName == SvGlobalName( SO3_SM_CLASSID_8 ) ) // nRet = SOFFICE_FILEFORMAT_8; // else diff --git a/sot/source/base/object.cxx b/sot/source/base/object.cxx index 403a1c6bb61d..bdd3862d8d52 100644 --- a/sot/source/base/object.cxx +++ b/sot/source/base/object.cxx @@ -63,7 +63,7 @@ SO2_IMPL_INVARIANT(SotObject) |* |* Beschreibung: *************************************************************************/ -void SotObject::TestMemberObjRef( BOOL /*bFree*/ ) +void SotObject::TestMemberObjRef( sal_Bool /*bFree*/ ) { } @@ -73,7 +73,7 @@ void SotObject::TestMemberObjRef( BOOL /*bFree*/ ) |* Beschreibung: *************************************************************************/ #ifdef TEST_INVARIANT -void SotObject::TestMemberInvariant( BOOL /*bPrint*/ ) +void SotObject::TestMemberInvariant( sal_Bool /*bPrint*/ ) { } #endif @@ -87,9 +87,9 @@ SotObject::SotObject() : pAggList ( NULL ) , nStrongLockCount( 0 ) , nOwnerLockCount( 0 ) - , bOwner ( TRUE ) - , bSVObject ( FALSE ) - , bInClose ( FALSE ) + , bOwner ( sal_True ) + , bSVObject ( sal_False ) + , bInClose ( sal_False ) { SotFactory::IncSvObjectCount( this ); } @@ -123,7 +123,7 @@ IUnknown * SotObject::GetInterface( const SvGlobalName & ) |* |* Beschreibung *************************************************************************/ -BOOL SotObject::IsSvObject() const +sal_Bool SotObject::IsSvObject() const { return Owner() || bSVObject; } @@ -138,20 +138,20 @@ BOOL SotObject::IsSvObject() const |* Objekte um 1 erhoeht, muss dies bei der Berechnung |* des 0-RefCounts beruecksichtigt werden. *************************************************************************/ -BOOL SotObject::ShouldDelete() +sal_Bool SotObject::ShouldDelete() { if( !pAggList ) - return TRUE; + return sal_True; SvAggregate & rMO = pAggList->GetObject( 0 ); if( rMO.bMainObj ) { AddRef(); pAggList->GetObject( 0 ).pObj->ReleaseRef(); - return FALSE; + return sal_False; } - ULONG i; + sal_uIntPtr i; for( i = 1; i < pAggList->Count(); i++ ) { SvAggregate & rAgg = pAggList->GetObject( i ); @@ -162,7 +162,7 @@ BOOL SotObject::ShouldDelete() AddRef(); // einen Aggregierten runterzaehlen rAgg.pObj->ReleaseRef(); - return FALSE; + return sal_False; } } AddNextRef(); // rekursion stoppen @@ -175,7 +175,7 @@ BOOL SotObject::ShouldDelete() delete pAggList; pAggList = NULL; // und zerstoeren, dies ist unabhaengig vom RefCount - return TRUE; + return sal_True; } /************************************************************************* @@ -212,7 +212,7 @@ SvAggregateMemberList & SotObject::GetAggList() |* |* Beschreibung *************************************************************************/ -void SotObject::RemoveInterface( ULONG nPos ) +void SotObject::RemoveInterface( sal_uIntPtr nPos ) { SvAggregate & rAgg = pAggList->GetObject( nPos ); if( !rAgg.bFactory ) @@ -238,7 +238,7 @@ void SotObject::RemoveInterface( SotObject * pObjP ) { DBG_ASSERT( pObjP, "null pointer" ); DBG_ASSERT( pAggList, "no aggregation list" ); - ULONG i; + sal_uIntPtr i; for( i = 0; i < pAggList->Count(); i++ ) { SvAggregate & rAgg = pAggList->GetObject( i ); @@ -257,12 +257,12 @@ void SotObject::AddInterface( SotObject * pObjP ) { pObjP->AddRef(); // Objekt festhalten GetAggList(); - pAggList->Append( SvAggregate( pObjP, FALSE ) ); + pAggList->Append( SvAggregate( pObjP, sal_False ) ); // sich selbst als Typecast-Verwalter eintragen SvAggregateMemberList & rAList = pObjP->GetAggList(); DBG_ASSERT( !rAList.GetObject( 0 ).bMainObj, "try to aggregate twice" ); - rAList[ 0 ] = SvAggregate( this, TRUE ); + rAList[ 0 ] = SvAggregate( this, sal_True ); } /************************************************************************* @@ -298,7 +298,7 @@ void * SotObject::DownAggCast( const SotFactory * pFact ) // geht den Pfad nur Richtung aggregierte Objekte if( pAggList ) { - for( ULONG i = 1; !pCast || i < pAggList->Count(); i++ ) + for( sal_uIntPtr i = 1; !pCast || i < pAggList->Count(); i++ ) { SvAggregate & rAgg = pAggList->GetObject( i ); if( rAgg.bFactory ) @@ -307,14 +307,14 @@ void * SotObject::DownAggCast( const SotFactory * pFact ) { // On-Demand erzeugen, wenn Typ gebraucht SotObjectRef aObj( CreateAggObj( rAgg.pFact ) ); - rAgg.bFactory = FALSE; + rAgg.bFactory = sal_False; rAgg.pObj = aObj; rAgg.pObj->AddRef(); // sich selbst als Typecast-Verwalter eintragen SvAggregateMemberList & rAList = rAgg.pObj->GetAggList(); DBG_ASSERT( !rAList.GetObject( 0 ).bMainObj, "try to aggregate twice" ); - rAList[ 0 ] = SvAggregate( this, TRUE ); + rAList[ 0 ] = SvAggregate( this, sal_True ); } } if( !rAgg.bFactory ) @@ -382,23 +382,23 @@ SotObject * SotObject::GetMainObj() const } //========================================================================= -USHORT SotObject::FuzzyLock +sal_uInt16 SotObject::FuzzyLock ( - BOOL bLock, /* TRUE, lock. FALSE, unlock. */ - BOOL /*bIntern*/, /* TRUE, es handelt sich um einen internen Lock. - FALSE, der Lock kam von aussen (Ole2, Ipc2) */ - BOOL bClose /* TRUE, Close aufrufen wenn letzte Lock */ + sal_Bool bLock, /* sal_True, lock. sal_False, unlock. */ + sal_Bool /*bIntern*/, /* sal_True, es handelt sich um einen internen Lock. + sal_False, der Lock kam von aussen (Ole2, Ipc2) */ + sal_Bool bClose /* sal_True, Close aufrufen wenn letzte Lock */ ) /* [Beschreibung] Erlaubte Parameterkombinationen: - ( TRUE, TRUE, * ) -> interner Lock. - ( FALSE, TRUE, TRUE ) -> interner Unlock mit Close, + ( sal_True, sal_True, * ) -> interner Lock. + ( sal_False, sal_True, sal_True ) -> interner Unlock mit Close, wenn LockCount() == 0 - ( TRUE, FALSE, * ) -> externer Lock. - ( FALSE, FALSE, TRUE ) -> externer Unlock mit Close, + ( sal_True, sal_False, * ) -> externer Lock. + ( sal_False, sal_False, sal_True ) -> externer Unlock mit Close, wenn LockCount() == 0 - ( FALSE, FALSE, FALSE ) -> externer Unlock + ( sal_False, sal_False, sal_False ) -> externer Unlock F"ur !Owner() wird der Aufruf an das externe Objekt weitergeleitet. F"ur diese muss das <IOleItemContainer>-Interface zur Vef"ugung stehen. @@ -411,7 +411,7 @@ USHORT SotObject::FuzzyLock */ { SotObjectRef xHoldAlive( this ); - USHORT nRet; + sal_uInt16 nRet; if( bLock ) { AddRef(); @@ -431,7 +431,7 @@ USHORT SotObject::FuzzyLock //========================================================================= void SotObject::OwnerLock ( - BOOL bLock /* TRUE, lock. FALSE, unlock. */ + sal_Bool bLock /* sal_True, lock. sal_False, unlock. */ ) /* [Beschreibung] @@ -467,23 +467,23 @@ void SotObject::RemoveOwnerLock() } //========================================================================= -BOOL SotObject::DoClose() +sal_Bool SotObject::DoClose() { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( !bInClose ) { SotObjectRef xHoldAlive( this ); - bInClose = TRUE; + bInClose = sal_True; bRet = Close(); - bInClose = FALSE; + bInClose = sal_False; } return bRet; } //========================================================================= -BOOL SotObject::Close() +sal_Bool SotObject::Close() { - return TRUE; + return sal_True; } diff --git a/sot/source/sdstor/stg.cxx b/sot/source/sdstor/stg.cxx index 1c749aa05cb8..5adfb735d47b 100644 --- a/sot/source/sdstor/stg.cxx +++ b/sot/source/sdstor/stg.cxx @@ -66,7 +66,7 @@ TYPEINIT1( BaseStorageStream, StorageBase ); TYPEINIT1( BaseStorage, StorageBase ); StorageBase::StorageBase() - : m_bAutoCommit( FALSE ) + : m_bAutoCommit( sal_False ) { m_nMode = STREAM_READ; m_nError = SVSTREAM_OK; @@ -79,14 +79,14 @@ StorageBase::~StorageBase() // The following three methods are declared as const, since they // may be called from within a const method. -ULONG StorageBase::GetError() const +sal_uIntPtr StorageBase::GetError() const { - ULONG n = m_nError; + sal_uIntPtr n = m_nError; ((StorageBase*) this)->m_nError = SVSTREAM_OK; return n; } -void StorageBase::SetError( ULONG n ) const +void StorageBase::SetError( sal_uIntPtr n ) const { if( !m_nError ) ((StorageBase*) this)->m_nError = n; @@ -133,20 +133,20 @@ OLEStorageBase::~OLEStorageBase() // Validate the instance for I/O -BOOL OLEStorageBase::Validate_Impl( BOOL bWrite ) const +sal_Bool OLEStorageBase::Validate_Impl( sal_Bool bWrite ) const { if( pEntry && !pEntry->bInvalid && ( !bWrite || !pEntry->bDirect || ( nStreamMode & STREAM_WRITE ) ) ) - return TRUE; - return FALSE; + return sal_True; + return sal_False; } -BOOL OLEStorageBase::ValidateMode_Impl( StreamMode m, StgDirEntry* p ) const +sal_Bool OLEStorageBase::ValidateMode_Impl( StreamMode m, StgDirEntry* p ) const { if( m == INTERNAL_MODE ) - return TRUE; - USHORT nCurMode = ( p && p->nRefCnt ) ? p->nMode : 0xFFFF; + return sal_True; + sal_uInt16 nCurMode = ( p && p->nRefCnt ) ? p->nMode : 0xFFFF; if( ( m & 3 ) == STREAM_READ ) { // only SHARE_DENYWRITE or SHARE_DENYALL allowed @@ -154,7 +154,7 @@ BOOL OLEStorageBase::ValidateMode_Impl( StreamMode m, StgDirEntry* p ) const && ( nCurMode & STREAM_SHARE_DENYWRITE ) ) || ( ( m & STREAM_SHARE_DENYALL ) && ( nCurMode & STREAM_SHARE_DENYALL ) ) ) - return TRUE; + return sal_True; } else { @@ -163,9 +163,9 @@ BOOL OLEStorageBase::ValidateMode_Impl( StreamMode m, StgDirEntry* p ) const // the commit may fail if( ( m & STREAM_SHARE_DENYALL ) && ( nCurMode & STREAM_SHARE_DENYALL ) ) - return TRUE; + return sal_True; } - return FALSE; + return sal_False; } @@ -199,18 +199,18 @@ StorageStream::~StorageStream() pEntry->Commit(); } -BOOL StorageStream::Equals( const BaseStorageStream& rStream ) const +sal_Bool StorageStream::Equals( const BaseStorageStream& rStream ) const { const StorageStream* pOther = PTR_CAST( StorageStream, &rStream ); return pOther && ( pOther->pEntry == pEntry ); } -ULONG StorageStream::Read( void* pData, ULONG nSize ) +sal_uIntPtr StorageStream::Read( void* pData, sal_uIntPtr nSize ) { if( Validate() ) { pEntry->Seek( nPos ); - nSize = pEntry->Read( pData, (INT32) nSize ); + nSize = pEntry->Read( pData, (sal_Int32) nSize ); pIo->MoveError( *this ); nPos += nSize; } @@ -219,12 +219,12 @@ ULONG StorageStream::Read( void* pData, ULONG nSize ) return nSize; } -ULONG StorageStream::Write( const void* pData, ULONG nSize ) +sal_uIntPtr StorageStream::Write( const void* pData, sal_uIntPtr nSize ) { - if( Validate( TRUE ) ) + if( Validate( sal_True ) ) { pEntry->Seek( nPos ); - nSize = pEntry->Write( pData, (INT32) nSize ); + nSize = pEntry->Write( pData, (sal_Int32) nSize ); pIo->MoveError( *this ); nPos += nSize; } @@ -233,7 +233,7 @@ ULONG StorageStream::Write( const void* pData, ULONG nSize ) return nSize; } -ULONG StorageStream::Seek( ULONG n ) +sal_uIntPtr StorageStream::Seek( sal_uIntPtr n ) { if( Validate() ) return nPos = pEntry->Seek( n ); @@ -247,26 +247,26 @@ void StorageStream::Flush() Commit(); } -BOOL StorageStream::SetSize( ULONG nNewSize ) +sal_Bool StorageStream::SetSize( sal_uIntPtr nNewSize ) { - if( Validate( TRUE ) ) + if( Validate( sal_True ) ) { - BOOL b = pEntry->SetSize( (INT32) nNewSize ); + sal_Bool b = pEntry->SetSize( (sal_Int32) nNewSize ); pIo->MoveError( *this ); return b; } else - return FALSE; + return sal_False; } -BOOL StorageStream::Commit() +sal_Bool StorageStream::Commit() { if( !Validate() ) - return FALSE; + return sal_False; if( !( m_nMode & STREAM_WRITE ) ) { SetError( SVSTREAM_ACCESS_DENIED ); - return FALSE; + return sal_False; } else { @@ -276,22 +276,22 @@ BOOL StorageStream::Commit() } } -BOOL StorageStream::Revert() +sal_Bool StorageStream::Revert() { pEntry->Revert(); pIo->MoveError( *this ); return Good(); } -BOOL StorageStream::CopyTo( BaseStorageStream* pDest ) +sal_Bool StorageStream::CopyTo( BaseStorageStream* pDest ) { - if( !Validate() || !pDest->Validate( TRUE ) || Equals( *pDest ) ) - return FALSE; + if( !Validate() || !pDest->Validate( sal_True ) || Equals( *pDest ) ) + return sal_False; pEntry->Copy( *pDest ); pDest->Commit(); pIo->MoveError( *this ); SetError( pDest->GetError() ); - return BOOL( Good() && pDest->Good() ); + return sal_Bool( Good() && pDest->Good() ); } const SvStream* StorageStream::GetSvStream() const @@ -299,25 +299,25 @@ const SvStream* StorageStream::GetSvStream() const return GetSvStream_Impl(); } -BOOL StorageStream::Validate( BOOL bValidate ) const +sal_Bool StorageStream::Validate( sal_Bool bValidate ) const { - BOOL bRet = Validate_Impl( bValidate ); + sal_Bool bRet = Validate_Impl( bValidate ); if ( !bRet ) SetError( SVSTREAM_ACCESS_DENIED ); return bRet; } -BOOL StorageStream::ValidateMode( StreamMode nMode ) const +sal_Bool StorageStream::ValidateMode( StreamMode nMode ) const { - BOOL bRet = ValidateMode_Impl( nMode, NULL ); + sal_Bool bRet = ValidateMode_Impl( nMode, NULL ); if ( !bRet ) SetError( SVSTREAM_ACCESS_DENIED ); return bRet; } -BOOL StorageStream::ValidateMode( StreamMode nMode, StgDirEntry* p ) const +sal_Bool StorageStream::ValidateMode( StreamMode nMode, StgDirEntry* p ) const { - BOOL bRet = ValidateMode_Impl( nMode, p ); + sal_Bool bRet = ValidateMode_Impl( nMode, p ); if ( !bRet ) SetError( SVSTREAM_ACCESS_DENIED ); return bRet; @@ -328,26 +328,26 @@ BOOL StorageStream::ValidateMode( StreamMode nMode, StgDirEntry* p ) const SvStorageInfo::SvStorageInfo( const StgDirEntry& rE ) { rE.aEntry.GetName( aName ); - bStorage = BOOL( rE.aEntry.GetType() == STG_STORAGE ); - bStream = BOOL( rE.aEntry.GetType() == STG_STREAM ); + bStorage = sal_Bool( rE.aEntry.GetType() == STG_STORAGE ); + bStream = sal_Bool( rE.aEntry.GetType() == STG_STREAM ); nSize = bStorage ? 0 : rE.aEntry.GetSize(); } /////////////////////////// class Storage //////////////////////////////// -BOOL Storage::IsStorageFile( const String & rFileName ) +sal_Bool Storage::IsStorageFile( const String & rFileName ) { StgIo aIo; if( aIo.Open( rFileName, STREAM_STD_READ ) ) return aIo.Load(); - return FALSE; + return sal_False; } -BOOL Storage::IsStorageFile( SvStream* pStream ) +sal_Bool Storage::IsStorageFile( SvStream* pStream ) { StgHeader aHdr; - ULONG nPos = pStream->Tell(); - BOOL bRet = ( aHdr.Load( *pStream ) && aHdr.Check() ); + sal_uIntPtr nPos = pStream->Tell(); + sal_Bool bRet = ( aHdr.Load( *pStream ) && aHdr.Check() ); // It's not a stream error if it is too small for a OLE storage header if ( pStream->GetErrorCode() == ERRCODE_IO_CANTSEEK ) @@ -361,21 +361,21 @@ BOOL Storage::IsStorageFile( SvStream* pStream ) TYPEINIT1( Storage, BaseStorage ); -Storage::Storage( const String& rFile, StreamMode m, BOOL bDirect ) - : OLEStorageBase( new StgIo, NULL, m_nMode ), aName( rFile ), bIsRoot( FALSE ) +Storage::Storage( const String& rFile, StreamMode m, sal_Bool bDirect ) + : OLEStorageBase( new StgIo, NULL, m_nMode ), aName( rFile ), bIsRoot( sal_False ) { - BOOL bTemp = FALSE; + sal_Bool bTemp = sal_False; if( !aName.Len() ) { // no name = temporary name! aName = TempFile::CreateTempName(); - bTemp = TRUE; + bTemp = sal_True; } // the root storage creates the I/O system m_nMode = m; if( pIo->Open( aName, m ) ) { - Init( BOOL( ( m & ( STREAM_TRUNC | STREAM_NOCREATE ) ) == STREAM_TRUNC ) ); + Init( sal_Bool( ( m & ( STREAM_TRUNC | STREAM_NOCREATE ) ) == STREAM_TRUNC ) ); if( pEntry ) { pEntry->bDirect = bDirect; @@ -392,19 +392,19 @@ Storage::Storage( const String& rFile, StreamMode m, BOOL bDirect ) // Create a storage on a given stream. -Storage::Storage( SvStream& r, BOOL bDirect ) - : OLEStorageBase( new StgIo, NULL, m_nMode ), bIsRoot( FALSE ) +Storage::Storage( SvStream& r, sal_Bool bDirect ) + : OLEStorageBase( new StgIo, NULL, m_nMode ), bIsRoot( sal_False ) { m_nMode = STREAM_READ; if( r.IsWritable() ) m_nMode = STREAM_READ | STREAM_WRITE; if( r.GetError() == SVSTREAM_OK ) { - pIo->SetStrm( &r, FALSE ); - ULONG nSize = r.Seek( STREAM_SEEK_TO_END ); + pIo->SetStrm( &r, sal_False ); + sal_uIntPtr nSize = r.Seek( STREAM_SEEK_TO_END ); r.Seek( 0L ); // Initializing is OK if the stream is empty - Init( BOOL( nSize == 0 ) ); + Init( sal_Bool( nSize == 0 ) ); if( pEntry ) { pEntry->bDirect = bDirect; @@ -420,8 +420,8 @@ Storage::Storage( SvStream& r, BOOL bDirect ) } -Storage::Storage( UCBStorageStream& rStrm, BOOL bDirect ) - : OLEStorageBase( new StgIo, NULL, m_nMode ), bIsRoot( FALSE ) +Storage::Storage( UCBStorageStream& rStrm, sal_Bool bDirect ) + : OLEStorageBase( new StgIo, NULL, m_nMode ), bIsRoot( sal_False ) { m_nMode = STREAM_READ; @@ -435,7 +435,7 @@ Storage::Storage( UCBStorageStream& rStrm, BOOL bDirect ) SvStream* pStream = rStrm.GetModifySvStream(); if ( !pStream ) { - OSL_ENSURE( FALSE, "UCBStorageStream can not provide SvStream implementation!\n" ); + OSL_ENSURE( sal_False, "UCBStorageStream can not provide SvStream implementation!\n" ); SetError( SVSTREAM_GENERALERROR ); pEntry = NULL; return; @@ -446,10 +446,10 @@ Storage::Storage( UCBStorageStream& rStrm, BOOL bDirect ) pIo->SetStrm( &rStrm ); - ULONG nSize = pStream->Seek( STREAM_SEEK_TO_END ); + sal_uIntPtr nSize = pStream->Seek( STREAM_SEEK_TO_END ); pStream->Seek( 0L ); // Initializing is OK if the stream is empty - Init( BOOL( nSize == 0 ) ); + Init( sal_Bool( nSize == 0 ) ); if( pEntry ) { pEntry->bDirect = bDirect; @@ -462,14 +462,14 @@ Storage::Storage( UCBStorageStream& rStrm, BOOL bDirect ) // Perform common code for both ctors above. -void Storage::Init( BOOL bCreate ) +void Storage::Init( sal_Bool bCreate ) { pEntry = NULL; - BOOL bHdrLoaded = FALSE; - bIsRoot = TRUE; + sal_Bool bHdrLoaded = sal_False; + bIsRoot = sal_True; if( pIo->Good() ) { - ULONG nSize = pIo->GetStrm()->Seek( STREAM_SEEK_TO_END ); + sal_uIntPtr nSize = pIo->GetStrm()->Seek( STREAM_SEEK_TO_END ); pIo->GetStrm()->Seek( 0L ); if( nSize ) { @@ -498,7 +498,7 @@ void Storage::Init( BOOL bCreate ) // Internal ctor Storage::Storage( StgIo* p, StgDirEntry* q, StreamMode m ) - : OLEStorageBase( p, q, m_nMode ), bIsRoot( FALSE ) + : OLEStorageBase( p, q, m_nMode ), bIsRoot( sal_False ) { if( q ) q->aEntry.GetName( aName ); @@ -561,7 +561,7 @@ void Storage::FillInfoList( SvStorageInfoList* pList ) const // Open or create a substorage -BaseStorage* Storage::OpenUCBStorage( const String& rName, StreamMode m, BOOL bDirect ) +BaseStorage* Storage::OpenUCBStorage( const String& rName, StreamMode m, sal_Bool bDirect ) { DBG_ERROR("Not supported!"); /* @@ -572,20 +572,20 @@ BaseStorage* Storage::OpenUCBStorage( const String& rName, StreamMode m, BOOL bD return OpenStorage( rName, m, bDirect ); } -BaseStorage* Storage::OpenOLEStorage( const String& rName, StreamMode m, BOOL bDirect ) +BaseStorage* Storage::OpenOLEStorage( const String& rName, StreamMode m, sal_Bool bDirect ) { return OpenStorage( rName, m, bDirect ); } -BaseStorage* Storage::OpenStorage( const String& rName, StreamMode m, BOOL bDirect ) +BaseStorage* Storage::OpenStorage( const String& rName, StreamMode m, sal_Bool bDirect ) { if( !Validate() || !ValidateMode( m ) ) return new Storage( pIo, NULL, m ); - BOOL bSetAutoCommit = FALSE; + sal_Bool bSetAutoCommit = sal_False; if( bDirect && !pEntry->bDirect ) { - bSetAutoCommit = TRUE; - bDirect = FALSE; + bSetAutoCommit = sal_True; + bDirect = sal_False; } StgDirEntry* p = pIo->pTOC->Find( *pEntry, rName ); @@ -593,14 +593,14 @@ BaseStorage* Storage::OpenStorage( const String& rName, StreamMode m, BOOL bDire { if( !( m & STREAM_NOCREATE ) ) { - BOOL bTemp = FALSE; + sal_Bool bTemp = sal_False; // create a new storage String aNewName = rName; if( !aNewName.Len() ) { aNewName.AssignAscii( "Temp Stg " ); aNewName.Append( String::CreateFromInt32( ++nTmpCount ) ); - bTemp = TRUE; + bTemp = sal_True; } p = pIo->pTOC->Create( *pEntry, aNewName, STG_STORAGE ); if( p ) @@ -630,13 +630,13 @@ BaseStorage* Storage::OpenStorage( const String& rName, StreamMode m, BOOL bDire } Storage* pStg = new Storage( pIo, p, m ); pIo->MoveError( *pStg ); - if( m & STREAM_WRITE ) pStg->m_bAutoCommit = TRUE; + if( m & STREAM_WRITE ) pStg->m_bAutoCommit = sal_True; return pStg; } // Open a stream -BaseStorageStream* Storage::OpenStream( const String& rName, StreamMode m, BOOL, +BaseStorageStream* Storage::OpenStream( const String& rName, StreamMode m, sal_Bool, const ByteString* #ifdef DBG_UTIL pB @@ -648,7 +648,7 @@ pB if( !Validate() || !ValidateMode( m ) ) return new StorageStream( pIo, NULL, m ); StgDirEntry* p = pIo->pTOC->Find( *pEntry, rName ); - BOOL bTemp = FALSE; + sal_Bool bTemp = sal_False; if( !p ) { if( !( m & STREAM_NOCREATE ) ) @@ -660,7 +660,7 @@ pB { aNewName.AssignAscii( "Temp Strm " ); aNewName.Append( String::CreateFromInt32( ++nTmpCount ) ); - bTemp = TRUE; + bTemp = sal_True; } p = pIo->pTOC->Create( *pEntry, aNewName, STG_STREAM ); } @@ -682,50 +682,50 @@ pB } StorageStream* pStm = new StorageStream( pIo, p, m ); if( p && !p->bDirect ) - pStm->SetAutoCommit( TRUE ); + pStm->SetAutoCommit( sal_True ); pIo->MoveError( *pStm ); return pStm; } // Delete a stream or substorage by setting the temp bit. -BOOL Storage::Remove( const String& rName ) +sal_Bool Storage::Remove( const String& rName ) { - if( !Validate( TRUE ) ) - return FALSE; + if( !Validate( sal_True ) ) + return sal_False; StgDirEntry* p = pIo->pTOC->Find( *pEntry, rName ); if( p ) { - p->Invalidate( TRUE ); - return TRUE; + p->Invalidate( sal_True ); + return sal_True; } else { SetError( SVSTREAM_FILE_NOT_FOUND ); - return FALSE; + return sal_False; } } // Rename a storage element -BOOL Storage::Rename( const String& rOld, const String& rNew ) +sal_Bool Storage::Rename( const String& rOld, const String& rNew ) { - if( Validate( TRUE ) ) + if( Validate( sal_True ) ) { - BOOL b = pIo->pTOC->Rename( *pEntry, rOld, rNew ); + sal_Bool b = pIo->pTOC->Rename( *pEntry, rOld, rNew ); pIo->MoveError( *this ); return b; } else - return FALSE; + return sal_False; } // Copy one element -BOOL Storage::CopyTo( const String& rElem, BaseStorage* pDest, const String& rNew ) +sal_Bool Storage::CopyTo( const String& rElem, BaseStorage* pDest, const String& rNew ) { - if( !Validate() || !pDest || !pDest->Validate( TRUE ) ) - return FALSE; + if( !Validate() || !pDest || !pDest->Validate( sal_True ) ) + return sal_False; StgDirEntry* pElem = pIo->pTOC->Find( *pEntry, rElem ); if( pElem ) { @@ -734,7 +734,7 @@ BOOL Storage::CopyTo( const String& rElem, BaseStorage* pDest, const String& rNe if( !pElem->IsContained( pDest->pEntry ) ) { SetError( SVSTREAM_ACCESS_DENIED ); - return FALSE; + return sal_False; } */ if( pElem->aEntry.GetType() == STG_STORAGE ) @@ -743,7 +743,7 @@ BOOL Storage::CopyTo( const String& rElem, BaseStorage* pDest, const String& rNe BaseStorage* p1 = OpenStorage( rElem, INTERNAL_MODE ); BaseStorage* p2 = pDest->OpenOLEStorage( rNew, STREAM_WRITE | STREAM_SHARE_DENYALL, pEntry->bDirect ); - ULONG nTmpErr = p2->GetError(); + sal_uIntPtr nTmpErr = p2->GetError(); if( !nTmpErr ) { p2->SetClassId( p1->GetClassId() ); @@ -761,7 +761,7 @@ BOOL Storage::CopyTo( const String& rElem, BaseStorage* pDest, const String& rNe delete p1; delete p2; - return BOOL( Good() && pDest->Good() ); + return sal_Bool( Good() && pDest->Good() ); } else { @@ -769,7 +769,7 @@ BOOL Storage::CopyTo( const String& rElem, BaseStorage* pDest, const String& rNe BaseStorageStream* p1 = OpenStream( rElem, INTERNAL_MODE ); BaseStorageStream* p2 = pDest->OpenStream( rNew, STREAM_WRITE | STREAM_SHARE_DENYALL, pEntry->bDirect ); - ULONG nTmpErr = p2->GetError(); + sal_uIntPtr nTmpErr = p2->GetError(); if( !nTmpErr ) { p1->CopyTo( p2 ); @@ -786,58 +786,58 @@ BOOL Storage::CopyTo( const String& rElem, BaseStorage* pDest, const String& rNe delete p1; delete p2; - return BOOL( Good() && pDest->Good() ); + return sal_Bool( Good() && pDest->Good() ); } } SetError( SVSTREAM_FILE_NOT_FOUND ); - return FALSE; + return sal_False; } -BOOL Storage::CopyTo( BaseStorage* pDest ) const +sal_Bool Storage::CopyTo( BaseStorage* pDest ) const { - if( !Validate() || !pDest || !pDest->Validate( TRUE ) || Equals( *pDest ) ) + if( !Validate() || !pDest || !pDest->Validate( sal_True ) || Equals( *pDest ) ) { SetError( SVSTREAM_ACCESS_DENIED ); - return FALSE; + return sal_False; } Storage* pThis = (Storage*) this; /* if( !pThis->pEntry->IsContained( pDest->pEntry ) ) { SetError( SVSTREAM_ACCESS_DENIED ); - return FALSE; + return sal_False; } */ pDest->SetClassId( GetClassId() ); pDest->SetDirty(); SvStorageInfoList aList; FillInfoList( &aList ); - BOOL bRes = TRUE; - for( USHORT i = 0; i < aList.Count() && bRes; i++ ) + sal_Bool bRes = sal_True; + for( sal_uInt16 i = 0; i < aList.Count() && bRes; i++ ) { SvStorageInfo& rInfo = aList.GetObject( i ); bRes = pThis->CopyTo( rInfo.GetName(), pDest, rInfo.GetName() ); } if( !bRes ) SetError( pDest->GetError() ); - return BOOL( Good() && pDest->Good() ); + return sal_Bool( Good() && pDest->Good() ); } // Move one element -BOOL Storage::MoveTo( const String& rElem, BaseStorage* pODest, const String& rNew ) +sal_Bool Storage::MoveTo( const String& rElem, BaseStorage* pODest, const String& rNew ) { - if( !Validate() || !pODest || !pODest->Validate( TRUE ) || Equals( *pODest ) ) + if( !Validate() || !pODest || !pODest->Validate( sal_True ) || Equals( *pODest ) ) { SetError( SVSTREAM_ACCESS_DENIED ); - return FALSE; + return sal_False; } StgDirEntry* pElem = pIo->pTOC->Find( *pEntry, rElem ); if( pElem ) { // Simplest case: both storages share the same file - BOOL bRes; + sal_Bool bRes; Storage *pOther = PTR_CAST( Storage, pODest ); if( pOther && pIo == pOther->pIo && rElem == rNew ) { @@ -848,14 +848,14 @@ BOOL Storage::MoveTo( const String& rElem, BaseStorage* pODest, const String& rN { // cyclic move SetError( SVSTREAM_ACCESS_DENIED ); - return FALSE; + return sal_False; } bRes = pIo->pTOC->Move( *pEntry, *pDest->pEntry, rNew ); if( !bRes ) { pIo->MoveError( *this ); pDest->pIo->MoveError( *pDest ); - ULONG nErr = GetError(); + sal_uIntPtr nErr = GetError(); if( !nErr ) nErr = pDest->GetError(); SetError( nErr ); @@ -873,51 +873,51 @@ BOOL Storage::MoveTo( const String& rElem, BaseStorage* pODest, const String& rN return bRes; } SetError( SVSTREAM_FILE_NOT_FOUND ); - return FALSE; + return sal_False; } -BOOL Storage::IsStorage( const String& rName ) const +sal_Bool Storage::IsStorage( const String& rName ) const { if( Validate() ) { StgDirEntry* p = pIo->pTOC->Find( *pEntry, rName ); if( p ) - return BOOL( p->aEntry.GetType() == STG_STORAGE ); + return sal_Bool( p->aEntry.GetType() == STG_STORAGE ); } - return FALSE; + return sal_False; } -BOOL Storage::IsStream( const String& rName ) const +sal_Bool Storage::IsStream( const String& rName ) const { if( Validate() ) { StgDirEntry* p = pIo->pTOC->Find( *pEntry, rName ); if( p ) - return BOOL( p->aEntry.GetType() == STG_STREAM ); + return sal_Bool( p->aEntry.GetType() == STG_STREAM ); } - return FALSE; + return sal_False; } -BOOL Storage::IsContained( const String& rName ) const +sal_Bool Storage::IsContained( const String& rName ) const { if( Validate() ) - return BOOL( pIo->pTOC->Find( *pEntry, rName ) != NULL ); + return sal_Bool( pIo->pTOC->Find( *pEntry, rName ) != NULL ); else - return FALSE; + return sal_False; } // Commit all sub-elements within this storage. If this is // the root, commit the FAT, the TOC and the header as well. -BOOL Storage::Commit() +sal_Bool Storage::Commit() { - BOOL bRes = TRUE; + sal_Bool bRes = sal_True; if( !Validate() ) - return FALSE; + return sal_False; if( !( m_nMode & STREAM_WRITE ) ) { SetError( SVSTREAM_ACCESS_DENIED ); - return FALSE; + return sal_False; } else { @@ -936,9 +936,9 @@ BOOL Storage::Commit() return bRes; } -BOOL Storage::Revert() +sal_Bool Storage::Revert() { - return TRUE; + return sal_True; } ///////////////////////////// OLE Support //////////////////////////////// @@ -946,16 +946,16 @@ BOOL Storage::Revert() // Set the storage type void Storage::SetClass( const SvGlobalName & rClass, - ULONG nOriginalClipFormat, + sal_uIntPtr nOriginalClipFormat, const String & rUserTypeName ) { - if( Validate( TRUE ) ) + if( Validate( sal_True ) ) { // set the class name in the root entry pEntry->aEntry.SetClassId( (const ClsId&) rClass.GetCLSID() ); pEntry->SetDirty(); // then create the streams - StgCompObjStream aCompObj( *this, TRUE ); + StgCompObjStream aCompObj( *this, sal_True ); aCompObj.GetClsId() = (const ClsId&) rClass.GetCLSID(); aCompObj.GetCbFormat() = nOriginalClipFormat; aCompObj.GetUserName() = rUserTypeName; @@ -973,14 +973,14 @@ void Storage::SetClass( const SvGlobalName & rClass, } void Storage::SetConvertClass( const SvGlobalName & rConvertClass, - ULONG nOriginalClipFormat, + sal_uIntPtr nOriginalClipFormat, const String & rUserTypeName ) { - if( Validate( TRUE ) ) + if( Validate( sal_True ) ) { SetClass( rConvertClass, nOriginalClipFormat, rUserTypeName ); // plus the convert flag: - StgOleStream aOle( *this, TRUE ); + StgOleStream aOle( *this, sal_True ); aOle.GetFlags() |= 4; if( !aOle.Store() ) SetError( aOle.GetError() ); @@ -989,7 +989,7 @@ void Storage::SetConvertClass( const SvGlobalName & rConvertClass, SvGlobalName Storage::GetClassName() { - StgCompObjStream aCompObj( *this, FALSE ); + StgCompObjStream aCompObj( *this, sal_False ); if( aCompObj.Load() ) return SvGlobalName( (const CLSID&) aCompObj.GetClsId() ); pIo->ResetError(); @@ -1000,9 +1000,9 @@ SvGlobalName Storage::GetClassName() return SvGlobalName(); } -ULONG Storage::GetFormat() +sal_uIntPtr Storage::GetFormat() { - StgCompObjStream aCompObj( *this, FALSE ); + StgCompObjStream aCompObj( *this, sal_False ); if( aCompObj.Load() ) return aCompObj.GetCbFormat(); pIo->ResetError(); @@ -1011,26 +1011,26 @@ ULONG Storage::GetFormat() String Storage::GetUserName() { - StgCompObjStream aCompObj( *this, FALSE ); + StgCompObjStream aCompObj( *this, sal_False ); if( aCompObj.Load() ) return aCompObj.GetUserName(); pIo->ResetError(); return String(); } -BOOL Storage::ShouldConvert() +sal_Bool Storage::ShouldConvert() { - StgOleStream aOle( *this, FALSE ); + StgOleStream aOle( *this, sal_False ); if( aOle.Load() ) - return BOOL( ( aOle.GetFlags() & 4 ) != 0 ); + return sal_Bool( ( aOle.GetFlags() & 4 ) != 0 ); else { pIo->ResetError(); - return FALSE; + return sal_False; } } -BOOL Storage::ValidateFAT() +sal_Bool Storage::ValidateFAT() { Link aLink = StgIo::GetErrorLink(); ErrCode nErr = pIo->ValidateFATs(); @@ -1058,31 +1058,31 @@ const SvStream* Storage::GetSvStream() const return GetSvStream_Impl(); } -BOOL Storage::Validate( BOOL bValidate ) const +sal_Bool Storage::Validate( sal_Bool bValidate ) const { - BOOL bRet = Validate_Impl( bValidate ); + sal_Bool bRet = Validate_Impl( bValidate ); if ( !bRet ) SetError( SVSTREAM_ACCESS_DENIED ); return bRet; } -BOOL Storage::ValidateMode( StreamMode nMode ) const +sal_Bool Storage::ValidateMode( StreamMode nMode ) const { - BOOL bRet = ValidateMode_Impl( nMode ); + sal_Bool bRet = ValidateMode_Impl( nMode ); if ( !bRet ) SetError( SVSTREAM_ACCESS_DENIED ); return bRet; } -BOOL Storage::ValidateMode( StreamMode nMode, StgDirEntry* p ) const +sal_Bool Storage::ValidateMode( StreamMode nMode, StgDirEntry* p ) const { - BOOL bRet = ValidateMode_Impl( nMode, p ); + sal_Bool bRet = ValidateMode_Impl( nMode, p ); if ( !bRet ) SetError( SVSTREAM_ACCESS_DENIED ); return bRet; } -BOOL Storage::Equals( const BaseStorage& rStorage ) const +sal_Bool Storage::Equals( const BaseStorage& rStorage ) const { const Storage* pOther = PTR_CAST( Storage, &rStorage ); return pOther && ( pOther->pEntry == pEntry ); diff --git a/sot/source/sdstor/stgavl.cxx b/sot/source/sdstor/stgavl.cxx index 3542a965da33..ad400f85dee5 100644 --- a/sot/source/sdstor/stgavl.cxx +++ b/sot/source/sdstor/stgavl.cxx @@ -212,7 +212,7 @@ StgAvlNode* StgAvlNode::RotRL() // Remove a tree element. Return the removed element or NULL. -StgAvlNode* StgAvlNode::Rem( StgAvlNode** p, StgAvlNode* pDel, BOOL bPtrs ) +StgAvlNode* StgAvlNode::Rem( StgAvlNode** p, StgAvlNode* pDel, sal_Bool bPtrs ) { if( *p ) { @@ -279,21 +279,21 @@ void StgAvlNode::StgEnum( short& n ) } // Add node to AVL tree. -// Return FALSE if the element already exists. +// Return sal_False if the element already exists. -BOOL StgAvlNode::Insert( StgAvlNode** pRoot, StgAvlNode* pIns ) +sal_Bool StgAvlNode::Insert( StgAvlNode** pRoot, StgAvlNode* pIns ) { StgAvlNode* pPivot, *pHeavy, *pNewRoot, *pParent, *pPrev; // special case - empty tree if( *pRoot == NULL ) { *pRoot = pIns; - return TRUE; + return sal_True; } // find insertion point and return if already present short nRes = (*pRoot)->Locate( pIns, &pPivot, &pParent, &pPrev ); if( !nRes ) - return FALSE; + return sal_False; // add new node if( nRes < 0 ) pPrev->pLeft = pIns; @@ -323,19 +323,19 @@ BOOL StgAvlNode::Insert( StgAvlNode** pRoot, StgAvlNode* pIns ) else if( pPivot == pParent->pRight ) pParent->pRight = pNewRoot; } - return TRUE; + return sal_True; } -// Remove node from tree. Returns TRUE is found and removed. +// Remove node from tree. Returns sal_True is found and removed. // Actually delete if bDel -BOOL StgAvlNode::Remove( StgAvlNode** pRoot, StgAvlNode* pDel, BOOL bDel ) +sal_Bool StgAvlNode::Remove( StgAvlNode** pRoot, StgAvlNode* pDel, sal_Bool bDel ) { // special case - empty tree if( *pRoot == NULL ) - return FALSE; + return sal_False; // delete the element - pDel = Rem( pRoot, pDel, FALSE ); + pDel = Rem( pRoot, pDel, sal_False ); if( pDel ) { if( bDel ) @@ -345,30 +345,30 @@ BOOL StgAvlNode::Remove( StgAvlNode** pRoot, StgAvlNode* pDel, BOOL bDel ) /* StgAvlNode* pNew = NULL; while( *pRoot ) { - StgAvlNode* p = Rem( pRoot, *pRoot, FALSE ); + StgAvlNode* p = Rem( pRoot, *pRoot, sal_False ); Insert( &pNew, p ); } *pRoot = pNew;*/ - return TRUE; + return sal_True; } else - return FALSE; + return sal_False; } -// Move node to a different tree. Returns TRUE is found and moved. This routine +// Move node to a different tree. Returns sal_True is found and moved. This routine // may be called when the key has changed. -BOOL StgAvlNode::Move +sal_Bool StgAvlNode::Move ( StgAvlNode** pRoot1, StgAvlNode** pRoot2, StgAvlNode* pMove ) { // special case - empty tree if( *pRoot1 == NULL ) - return FALSE; - pMove = Rem( pRoot1, pMove, FALSE ); + return sal_False; + pMove = Rem( pRoot1, pMove, sal_False ); if( pMove ) return Insert( pRoot2, pMove ); else - return FALSE; + return sal_False; } ////////////////////////// class AvlIterator ///////////////////////// diff --git a/sot/source/sdstor/stgavl.hxx b/sot/source/sdstor/stgavl.hxx index 66f424888e6d..29b33ae81109 100644 --- a/sot/source/sdstor/stgavl.hxx +++ b/sot/source/sdstor/stgavl.hxx @@ -46,7 +46,7 @@ private: StgAvlNode* RotRR(); StgAvlNode* RotRL(); void StgEnum( short& ); - static StgAvlNode* Rem( StgAvlNode**, StgAvlNode*, BOOL ); + static StgAvlNode* Rem( StgAvlNode**, StgAvlNode*, sal_Bool ); protected: short nId; // iterator ID short nBalance; // indicates tree balance @@ -55,9 +55,9 @@ protected: public: virtual ~StgAvlNode(); StgAvlNode* Find( StgAvlNode* ); - static BOOL Insert( StgAvlNode**, StgAvlNode* ); - static BOOL Remove( StgAvlNode**, StgAvlNode*, BOOL bDel = TRUE ); - static BOOL Move( StgAvlNode**, StgAvlNode**, StgAvlNode* ); + static sal_Bool Insert( StgAvlNode**, StgAvlNode* ); + static sal_Bool Remove( StgAvlNode**, StgAvlNode*, sal_Bool bDel = sal_True ); + static sal_Bool Move( StgAvlNode**, StgAvlNode**, StgAvlNode* ); virtual short Compare( const StgAvlNode* ) const = 0; }; diff --git a/sot/source/sdstor/stgcache.cxx b/sot/source/sdstor/stgcache.cxx index 88a8187ee9dd..6a0d1117f934 100644 --- a/sot/source/sdstor/stgcache.cxx +++ b/sot/source/sdstor/stgcache.cxx @@ -52,10 +52,10 @@ //----------------------------------------------------------------------------- typedef std::hash_map < - INT32, + sal_Int32, StgPage *, - std::hash< INT32 >, - NAMESPACE_STD(equal_to)< INT32 > + std::hash< sal_Int32 >, + NAMESPACE_STD(equal_to)< sal_Int32 > > UsrStgPagePtr_Impl; #ifdef _MSC_VER #pragma warning( disable: 4786 ) @@ -73,9 +73,9 @@ StgPage::StgPage( StgCache* p, short n ) { pCache = p; nData = n; - bDirty = FALSE; + bDirty = sal_False; nPage = 0; - pData = new BYTE[ nData ]; + pData = new sal_uInt8[ nData ]; pNext1 = pNext2 = pLast1 = @@ -88,15 +88,15 @@ StgPage::~StgPage() delete [] pData; } -void StgPage::SetPage( short nOff, INT32 nVal ) +void StgPage::SetPage( short nOff, sal_Int32 nVal ) { - if( ( nOff < (short) ( nData / sizeof( INT32 ) ) ) && nOff >= 0 ) + if( ( nOff < (short) ( nData / sizeof( sal_Int32 ) ) ) && nOff >= 0 ) { #ifdef OSL_BIGENDIAN nVal = SWAPLONG(nVal); #endif - ((INT32*) pData )[ nOff ] = nVal; - bDirty = TRUE; + ((sal_Int32*) pData )[ nOff ] = nVal; + bDirty = sal_True; } } @@ -105,7 +105,7 @@ void StgPage::SetPage( short nOff, INT32 nVal ) // The disk cache holds the cached sectors. The sector type differ according // to their purpose. -INT32 lcl_GetPageCount( ULONG nFileSize, short nPageSize ) +sal_Int32 lcl_GetPageCount( sal_uIntPtr nFileSize, short nPageSize ) { // return (nFileSize >= 512) ? (nFileSize - 512) / nPageSize : 0; // #i61980# reallife: last page may be incomplete, return number of *started* pages @@ -119,8 +119,8 @@ StgCache::StgCache() pCur = pElem1 = NULL; nPageSize = 512; nError = SVSTREAM_OK; - bMyStream = FALSE; - bFile = FALSE; + bMyStream = sal_False; + bFile = sal_False; pLRUCache = NULL; pStorageStream = NULL; } @@ -128,15 +128,15 @@ StgCache::StgCache() StgCache::~StgCache() { Clear(); - SetStrm( NULL, FALSE ); + SetStrm( NULL, sal_False ); delete (UsrStgPagePtr_Impl*)pLRUCache; } void StgCache::SetPhysPageSize( short n ) { nPageSize = n; - ULONG nPos = pStrm->Tell(); - ULONG nFileSize = pStrm->Seek( STREAM_SEEK_TO_END ); + sal_uIntPtr nPos = pStrm->Tell(); + sal_uIntPtr nFileSize = pStrm->Seek( STREAM_SEEK_TO_END ); nPages = lcl_GetPageCount( nFileSize, nPageSize ); pStrm->Seek( nPos ); } @@ -144,7 +144,7 @@ void StgCache::SetPhysPageSize( short n ) // Create a new cache element // pCur points to this element -StgPage* StgCache::Create( INT32 nPg ) +StgPage* StgCache::Create( sal_Int32 nPg ) { StgPage* pElem = new StgPage( this, nPageSize ); pElem->nPage = nPg; @@ -227,7 +227,7 @@ void StgCache::Clear() // Look for a cached page -StgPage* StgCache::Find( INT32 nPage ) +StgPage* StgCache::Find( sal_Int32 nPage ) { if( !pLRUCache ) return NULL; @@ -255,7 +255,7 @@ StgPage* StgCache::Find( INT32 nPage ) // Load a page into the cache -StgPage* StgCache::Get( INT32 nPage, BOOL bForce ) +StgPage* StgCache::Get( sal_Int32 nPage, sal_Bool bForce ) { StgPage* p = Find( nPage ); if( !p ) @@ -275,7 +275,7 @@ StgPage* StgCache::Get( INT32 nPage, BOOL bForce ) // to duplicate an existing stream or to create new entries. // The new page is initially marked dirty. No owner is copied. -StgPage* StgCache::Copy( INT32 nNew, INT32 nOld ) +StgPage* StgCache::Copy( sal_Int32 nNew, sal_Int32 nOld ) { StgPage* p = Find( nNew ); if( !p ) @@ -283,7 +283,7 @@ StgPage* StgCache::Copy( INT32 nNew, INT32 nOld ) if( nOld >= 0 ) { // old page: we must have this data! - StgPage* q = Get( nOld, TRUE ); + StgPage* q = Get( nOld, sal_True ); if( q ) memcpy( p->pData, q->pData, p->nData ); } @@ -293,17 +293,17 @@ StgPage* StgCache::Copy( INT32 nNew, INT32 nOld ) // Flush the cache whose owner is given. NULL flushes all. -BOOL StgCache::Commit( StgDirEntry* ) +sal_Bool StgCache::Commit( StgDirEntry* ) { StgPage* p = pElem1; if( p ) do { if( p->bDirty ) { - BOOL b = Write( p->nPage, p->pData, 1 ); + sal_Bool b = Write( p->nPage, p->pData, 1 ); if( !b ) - return FALSE; - p->bDirty = FALSE; + return sal_False; + p->bDirty = sal_False; } p = p->pNext2; } while( p != pElem1 ); @@ -316,10 +316,10 @@ BOOL StgCache::Commit( StgDirEntry* ) if( p->bDirty ) { ErrorBox( NULL, WB_OK, String("SO2: Dirty Block in Ordered List") ).Execute(); - BOOL b = Write( p->nPage, p->pData, 1 ); + sal_Bool b = Write( p->nPage, p->pData, 1 ); if( !b ) - return FALSE; - p->bDirty = FALSE; + return sal_False; + p->bDirty = sal_False; } p = p->pNext2; } while( p != pElem1 ); @@ -329,15 +329,15 @@ BOOL StgCache::Commit( StgDirEntry* ) if( p->bDirty ) { ErrorBox( NULL, WB_OK, String("SO2: Dirty Block in LRU List") ).Execute(); - BOOL b = Write( p->nPage, p->pData, 1 ); + sal_Bool b = Write( p->nPage, p->pData, 1 ); if( !b ) - return FALSE; - p->bDirty = FALSE; + return sal_False; + p->bDirty = sal_False; } p = p->pNext1; } while( p != pElem1 ); #endif - return TRUE; + return sal_True; } void StgCache::Revert( StgDirEntry* ) @@ -345,7 +345,7 @@ void StgCache::Revert( StgDirEntry* ) // Set a stream -void StgCache::SetStrm( SvStream* p, BOOL bMy ) +void StgCache::SetStrm( SvStream* p, sal_Bool bMy ) { if( pStorageStream ) { @@ -376,34 +376,34 @@ void StgCache::SetStrm( UCBStorageStream* pStgStream ) pStrm = pStorageStream->GetModifySvStream(); } - bMyStream = FALSE; + bMyStream = sal_False; } // Open/close the disk file -BOOL StgCache::Open( const String& rName, StreamMode nMode ) +sal_Bool StgCache::Open( const String& rName, StreamMode nMode ) { // do not open in exclusive mode! if( nMode & STREAM_SHARE_DENYALL ) nMode = ( ( nMode & ~STREAM_SHARE_DENYALL ) | STREAM_SHARE_DENYWRITE ); SvFileStream* pFileStrm = new SvFileStream( rName, nMode ); // SvStream "Feature" Write Open auch erfolgreich, wenns nicht klappt - BOOL bAccessDenied = FALSE; + sal_Bool bAccessDenied = sal_False; if( ( nMode & STREAM_WRITE ) && !pFileStrm->IsWritable() ) { pFileStrm->Close(); - bAccessDenied = TRUE; + bAccessDenied = sal_True; } - SetStrm( pFileStrm, TRUE ); + SetStrm( pFileStrm, sal_True ); if( pFileStrm->IsOpen() ) { - ULONG nFileSize = pStrm->Seek( STREAM_SEEK_TO_END ); + sal_uIntPtr nFileSize = pStrm->Seek( STREAM_SEEK_TO_END ); nPages = lcl_GetPageCount( nFileSize, nPageSize ); pStrm->Seek( 0L ); } else nPages = 0; - bFile = TRUE; + bFile = sal_True; SetError( bAccessDenied ? ERRCODE_IO_ACCESSDENIED : pStrm->GetError() ); return Good(); } @@ -419,7 +419,7 @@ void StgCache::Close() // low level I/O -BOOL StgCache::Read( INT32 nPage, void* pBuf, INT32 nPg ) +sal_Bool StgCache::Read( sal_Int32 nPage, void* pBuf, sal_Int32 nPg ) { if( Good() ) { @@ -431,9 +431,9 @@ BOOL StgCache::Read( INT32 nPage, void* pBuf, INT32 nPg ) SetError( SVSTREAM_READ_ERROR ); else if ( nPage < nPages ) { - ULONG nPos = Page2Pos( nPage ); - INT32 nPg2 = ( ( nPage + nPg ) > nPages ) ? nPages - nPage : nPg; - ULONG nBytes = nPg2 * nPageSize; + sal_uIntPtr nPos = Page2Pos( nPage ); + sal_Int32 nPg2 = ( ( nPage + nPg ) > nPages ) ? nPages - nPage : nPg; + sal_uIntPtr nBytes = nPg2 * nPageSize; // fixed address and size for the header if( nPage == -1 ) { @@ -458,12 +458,12 @@ BOOL StgCache::Read( INT32 nPage, void* pBuf, INT32 nPg ) return Good(); } -BOOL StgCache::Write( INT32 nPage, void* pBuf, INT32 nPg ) +sal_Bool StgCache::Write( sal_Int32 nPage, void* pBuf, sal_Int32 nPg ) { if( Good() ) { - ULONG nPos = Page2Pos( nPage ); - ULONG nBytes = nPg * nPageSize; + sal_uIntPtr nPos = Page2Pos( nPage ); + sal_uIntPtr nBytes = nPg * nPageSize; // fixed address and size for the header if( nPage == -1 ) nPos = 0L, nBytes = 512; @@ -475,16 +475,16 @@ BOOL StgCache::Write( INT32 nPage, void* pBuf, INT32 nPg ) #endif } } - ULONG nRes = pStrm->Write( pBuf, nBytes ); + sal_uIntPtr nRes = pStrm->Write( pBuf, nBytes ); if( nRes != nBytes ) SetError( SVSTREAM_WRITE_ERROR ); else SetError( pStrm->GetError() ); #ifdef READ_AFTER_WRITE - BYTE cBuf[ 512 ]; + sal_uInt8 cBuf[ 512 ]; pStrm->Flush(); pStrm->Seek( nPos ); - BOOL bRes = ( pStrm->Read( cBuf, 512 ) == 512 ); + sal_Bool bRes = ( pStrm->Read( cBuf, 512 ) == 512 ); if( bRes ) bRes = !memcmp( cBuf, pBuf, 512 ); if( !bRes ) @@ -499,10 +499,10 @@ BOOL StgCache::Write( INT32 nPage, void* pBuf, INT32 nPg ) // set the file size in pages -BOOL StgCache::SetSize( INT32 n ) +sal_Bool StgCache::SetSize( sal_Int32 n ) { // Add the file header - INT32 nSize = n * nPageSize + 512; + sal_Int32 nSize = n * nPageSize + 512; pStrm->SetStreamSize( nSize ); SetError( pStrm->GetError() ); if( !nError ) @@ -510,7 +510,7 @@ BOOL StgCache::SetSize( INT32 n ) return Good(); } -void StgCache::SetError( ULONG n ) +void StgCache::SetError( sal_uIntPtr n ) { if( n && !nError ) nError = n; @@ -533,13 +533,13 @@ void StgCache::MoveError( StorageBase& r ) // Utility functions -INT32 StgCache::Page2Pos( INT32 nPage ) +sal_Int32 StgCache::Page2Pos( sal_Int32 nPage ) { if( nPage < 0 ) nPage = 0; return( nPage * nPageSize ) + nPageSize; } -INT32 StgCache::Pos2Page( INT32 nPos ) +sal_Int32 StgCache::Pos2Page( sal_Int32 nPos ) { return ( ( nPos + nPageSize - 1 ) / nPageSize ) * nPageSize - 1; } diff --git a/sot/source/sdstor/stgcache.hxx b/sot/source/sdstor/stgcache.hxx index 5379f837b8b1..0c1fc3eab1ff 100644 --- a/sot/source/sdstor/stgcache.hxx +++ b/sot/source/sdstor/stgcache.hxx @@ -47,9 +47,9 @@ class StorageBase; class StgCache { StgPage* pCur; // top of LRU list StgPage* pElem1; // top of ordered list - ULONG nError; // error code - INT32 nPages; // size of data area in pages - USHORT nRef; // reference count + sal_uIntPtr nError; // error code + sal_Int32 nPages; // size of data area in pages + sal_uInt16 nRef; // reference count void * pLRUCache; // hash table of cached objects short nPageSize; // page size of the file UCBStorageStream* pStorageStream; // holds reference to UCB storage stream @@ -57,40 +57,40 @@ class StgCache { void Erase( StgPage* ); // delete a cache element void InsertToLRU( StgPage* ); // insert into LRU list void InsertToOrdered( StgPage* ); // insert into ordered list - StgPage* Create( INT32 ); // create a cached page + StgPage* Create( sal_Int32 ); // create a cached page protected: SvStream* pStrm; // physical stream - BOOL bMyStream; // TRUE: delete stream in dtor - BOOL bFile; // TRUE: file stream - INT32 Page2Pos( INT32 ); // page address --> file position - INT32 Pos2Page( INT32 ); // file position --> page address + sal_Bool bMyStream; // sal_True: delete stream in dtor + sal_Bool bFile; // sal_True: file stream + sal_Int32 Page2Pos( sal_Int32 ); // page address --> file position + sal_Int32 Pos2Page( sal_Int32 ); // file position --> page address public: StgCache(); ~StgCache(); void IncRef() { nRef++; } - USHORT DecRef() { return --nRef; } + sal_uInt16 DecRef() { return --nRef; } void SetPhysPageSize( short ); - INT32 GetPhysPages() { return nPages; } + sal_Int32 GetPhysPages() { return nPages; } short GetPhysPageSize() { return nPageSize; } SvStream* GetStrm() { return pStrm; } - void SetStrm( SvStream*, BOOL ); + void SetStrm( SvStream*, sal_Bool ); void SetStrm( UCBStorageStream* ); - BOOL IsWritable() { return pStrm->IsWritable(); } - BOOL Good() { return BOOL( nError == SVSTREAM_OK ); } - BOOL Bad() { return BOOL( nError != SVSTREAM_OK ); } - ULONG GetError() { return nError; } + sal_Bool IsWritable() { return pStrm->IsWritable(); } + sal_Bool Good() { return sal_Bool( nError == SVSTREAM_OK ); } + sal_Bool Bad() { return sal_Bool( nError != SVSTREAM_OK ); } + sal_uIntPtr GetError() { return nError; } void MoveError( StorageBase& ); - void SetError( ULONG ); + void SetError( sal_uIntPtr ); void ResetError(); - BOOL Open( const String& rName, StreamMode ); + sal_Bool Open( const String& rName, StreamMode ); void Close(); - BOOL Read( INT32 nPage, void* pBuf, INT32 nPages ); - BOOL Write( INT32 nPage, void* pBuf, INT32 nPages ); - BOOL SetSize( INT32 nPages ); - StgPage* Find( INT32 ); // find a cached page - StgPage* Get( INT32, BOOL ); // get a cached page - StgPage* Copy( INT32, INT32=STG_FREE ); // copy a page - BOOL Commit( StgDirEntry* = NULL ); // flush all pages + sal_Bool Read( sal_Int32 nPage, void* pBuf, sal_Int32 nPages ); + sal_Bool Write( sal_Int32 nPage, void* pBuf, sal_Int32 nPages ); + sal_Bool SetSize( sal_Int32 nPages ); + StgPage* Find( sal_Int32 ); // find a cached page + StgPage* Get( sal_Int32, sal_Bool ); // get a cached page + StgPage* Copy( sal_Int32, sal_Int32=STG_FREE ); // copy a page + sal_Bool Commit( StgDirEntry* = NULL ); // flush all pages void Revert( StgDirEntry* = NULL ); // revert dirty pages void Clear(); // clear the cache }; @@ -101,32 +101,32 @@ class StgPage { StgPage *pNext1, *pLast1; // LRU chain StgPage *pNext2, *pLast2; // ordered chain StgDirEntry* pOwner; // owner - INT32 nPage; // page # - BYTE* pData; // nPageSize characters + sal_Int32 nPage; // page # + sal_uInt8* pData; // nPageSize characters short nData; // size of this page - BOOL bDirty; // dirty flag + sal_Bool bDirty; // dirty flag StgPage( StgCache*, short ); ~StgPage(); public: - void SetDirty() { bDirty = TRUE; } - INT32 GetPage() { return nPage; } + void SetDirty() { bDirty = sal_True; } + sal_Int32 GetPage() { return nPage; } void* GetData() { return pData; } short GetSize() { return nData; } void SetOwner( StgDirEntry* p ) { pOwner = p; } // routines for accessing FAT pages // Assume that the data is a FAT page and get/put FAT data. - INT32 GetPage( short nOff ) + sal_Int32 GetPage( short nOff ) { - if( ( nOff >= (short) ( nData / sizeof( INT32 ) ) ) || nOff < 0 ) + if( ( nOff >= (short) ( nData / sizeof( sal_Int32 ) ) ) || nOff < 0 ) return -1; - INT32 n = ((INT32*) pData )[ nOff ]; + sal_Int32 n = ((sal_Int32*) pData )[ nOff ]; #ifdef OSL_BIGENDIAN return SWAPLONG(n); #else return n; #endif } - void SetPage( short, INT32 ); // put an element + void SetPage( short, sal_Int32 ); // put an element }; #endif diff --git a/sot/source/sdstor/stgdir.cxx b/sot/source/sdstor/stgdir.cxx index f093dc60cbe7..0b1cf2582501 100644 --- a/sot/source/sdstor/stgdir.cxx +++ b/sot/source/sdstor/stgdir.cxx @@ -54,7 +54,7 @@ // Problem der Implementation: Keine Hierarchischen commits. Daher nur // insgesamt transaktionsorientert oder direkt. -StgDirEntry::StgDirEntry( const void* pFrom, BOOL * pbOk ) : StgAvlNode() +StgDirEntry::StgDirEntry( const void* pFrom, sal_Bool * pbOk ) : StgAvlNode() { *pbOk = aEntry.Load( pFrom ); @@ -81,14 +81,14 @@ void StgDirEntry::InitMembers() nEntry = nRefCnt = 0; nMode = STREAM_READ; - bDirect = TRUE; + bDirect = sal_True; bInvalid = bCreated = bRenamed = bRemoved = bTemp = bDirty = - bZombie = FALSE; + bZombie = sal_False; } StgDirEntry::~StgDirEntry() @@ -113,9 +113,9 @@ short StgDirEntry::Compare( const StgAvlNode* p ) const // the TOC tree into the TOC stream. Remember that aSave is // stored, not aEntry. -void StgDirEntry::Enum( INT32& n ) +void StgDirEntry::Enum( sal_Int32& n ) { - INT32 nLeft = STG_FREE, nRight = STG_FREE, nDown = STG_FREE; + sal_Int32 nLeft = STG_FREE, nRight = STG_FREE, nDown = STG_FREE; nEntry = n++; if( pLeft ) { @@ -137,17 +137,17 @@ void StgDirEntry::Enum( INT32& n ) // Delete all temporary entries before writing the TOC stream. // Until now Deltem is never called with bForce True -void StgDirEntry::DelTemp( BOOL bForce ) +void StgDirEntry::DelTemp( sal_Bool bForce ) { if( pLeft ) - ((StgDirEntry*) pLeft)->DelTemp( FALSE ); + ((StgDirEntry*) pLeft)->DelTemp( sal_False ); if( pRight ) - ((StgDirEntry*) pRight)->DelTemp( FALSE ); + ((StgDirEntry*) pRight)->DelTemp( sal_False ); if( pDown ) { // If the storage is dead, of course all elements are dead, too if( bInvalid && aEntry.GetType() == STG_STORAGE ) - bForce = TRUE; + bForce = sal_True; pDown->DelTemp( bForce ); } if( ( bForce || bInvalid ) @@ -157,12 +157,12 @@ void StgDirEntry::DelTemp( BOOL bForce ) if( pUp ) { // this deletes the element if refcnt == 0! - BOOL bDel = nRefCnt == 0; + sal_Bool bDel = nRefCnt == 0; StgAvlNode::Remove( (StgAvlNode**) &pUp->pDown, this, bDel ); if( !bDel ) { pLeft = pRight = pDown = 0; - bInvalid = bZombie = TRUE; + bInvalid = bZombie = sal_True; } } } @@ -170,26 +170,26 @@ void StgDirEntry::DelTemp( BOOL bForce ) // Save the tree into the given dir stream -BOOL StgDirEntry::Store( StgDirStrm& rStrm ) +sal_Bool StgDirEntry::Store( StgDirStrm& rStrm ) { - void* pEntry = rStrm.GetEntry( nEntry, TRUE ); + void* pEntry = rStrm.GetEntry( nEntry, sal_True ); if( !pEntry ) - return FALSE; + return sal_False; // Do not store the current (maybe not commited) entry aSave.Store( pEntry ); if( pLeft ) if( !((StgDirEntry*) pLeft)->Store( rStrm ) ) - return FALSE; + return sal_False; if( pRight ) if( !((StgDirEntry*) pRight)->Store( rStrm ) ) - return FALSE; + return sal_False; if( pDown ) if( !pDown->Store( rStrm ) ) - return FALSE; - return TRUE; + return sal_False; + return sal_True; } -BOOL StgDirEntry::StoreStream( StgIo& rIo ) +sal_Bool StgDirEntry::StoreStream( StgIo& rIo ) { if( aEntry.GetType() == STG_STREAM || aEntry.GetType() == STG_ROOT ) { @@ -206,27 +206,27 @@ BOOL StgDirEntry::StoreStream( StgIo& rIo ) } // or write the data stream else if( !Tmp2Strm() ) - return FALSE; + return sal_False; } - return TRUE; + return sal_True; } // Save all dirty streams -BOOL StgDirEntry::StoreStreams( StgIo& rIo ) +sal_Bool StgDirEntry::StoreStreams( StgIo& rIo ) { if( !StoreStream( rIo ) ) - return FALSE; + return sal_False; if( pLeft ) if( !((StgDirEntry*) pLeft)->StoreStreams( rIo ) ) - return FALSE; + return sal_False; if( pRight ) if( !((StgDirEntry*) pRight)->StoreStreams( rIo ) ) - return FALSE; + return sal_False; if( pDown ) if( !pDown->StoreStreams( rIo ) ) - return FALSE; - return TRUE; + return sal_False; + return sal_True; } // Revert all directory entries after failure to write the TOC stream @@ -244,24 +244,24 @@ void StgDirEntry::RevertAll() // Look if any element of the tree is dirty -BOOL StgDirEntry::IsDirty() +sal_Bool StgDirEntry::IsDirty() { if( bDirty || bInvalid ) - return TRUE; + return sal_True; if( pLeft && ((StgDirEntry*) pLeft)->IsDirty() ) - return TRUE; + return sal_True; if( pRight && ((StgDirEntry*) pRight)->IsDirty() ) - return TRUE; + return sal_True; if( pDown && pDown->IsDirty() ) - return TRUE; - return FALSE; + return sal_True; + return sal_False; } // Set up a stream. -void StgDirEntry::OpenStream( StgIo& rIo, BOOL bForceBig ) +void StgDirEntry::OpenStream( StgIo& rIo, sal_Bool bForceBig ) { - INT32 nThreshold = (USHORT) rIo.aHdr.GetThreshold(); + sal_Int32 nThreshold = (sal_uInt16) rIo.aHdr.GetThreshold(); delete pStgStrm; if( !bForceBig && aEntry.GetSize() < nThreshold ) pStgStrm = new StgSmallStrm( rIo, this ); @@ -271,7 +271,7 @@ void StgDirEntry::OpenStream( StgIo& rIo, BOOL bForceBig ) { // This entry has invalid data, so delete that data SetSize( 0L ); -// bRemoved = bInvalid = FALSE; +// bRemoved = bInvalid = sal_False; } nPos = 0; } @@ -291,9 +291,9 @@ void StgDirEntry::Close() // Get the current stream size -INT32 StgDirEntry::GetSize() +sal_Int32 StgDirEntry::GetSize() { - INT32 n; + sal_Int32 n; if( pTmpStrm ) n = pTmpStrm->GetSize(); else if( pCurStrm ) @@ -304,14 +304,14 @@ INT32 StgDirEntry::GetSize() // Set the stream size. This means also creating a temp stream. -BOOL StgDirEntry::SetSize( INT32 nNewSize ) +sal_Bool StgDirEntry::SetSize( sal_Int32 nNewSize ) { if ( !( nMode & STREAM_WRITE ) || (!bDirect && !pTmpStrm && !Strm2Tmp()) ) { - return FALSE; + return sal_False; } if( nNewSize < nPos ) @@ -320,26 +320,26 @@ BOOL StgDirEntry::SetSize( INT32 nNewSize ) { pTmpStrm->SetSize( nNewSize ); pStgStrm->GetIo().SetError( pTmpStrm->GetError() ); - return BOOL( pTmpStrm->GetError() == SVSTREAM_OK ); + return sal_Bool( pTmpStrm->GetError() == SVSTREAM_OK ); } else { - BOOL bRes = FALSE; + sal_Bool bRes = sal_False; StgIo& rIo = pStgStrm->GetIo(); - INT32 nThreshold = rIo.aHdr.GetThreshold(); + sal_Int32 nThreshold = rIo.aHdr.GetThreshold(); // ensure the correct storage stream! StgStrm* pOld = NULL; - USHORT nOldSize = 0; + sal_uInt16 nOldSize = 0; if( nNewSize >= nThreshold && pStgStrm->IsSmallStrm() ) { pOld = pStgStrm; - nOldSize = (USHORT) pOld->GetSize(); + nOldSize = (sal_uInt16) pOld->GetSize(); pStgStrm = new StgDataStrm( rIo, STG_EOF, 0 ); } else if( nNewSize < nThreshold && !pStgStrm->IsSmallStrm() ) { pOld = pStgStrm; - nOldSize = (USHORT) nNewSize; + nOldSize = (sal_uInt16) nNewSize; pStgStrm = new StgSmallStrm( rIo, STG_EOF, 0 ); } // now set the new size @@ -351,16 +351,16 @@ BOOL StgDirEntry::SetSize( INT32 nNewSize ) // if so, we probably need to copy the old data if( nOldSize ) { - void* pBuf = new BYTE[ nOldSize ]; + void* pBuf = new sal_uInt8[ nOldSize ]; pOld->Pos2Page( 0L ); pStgStrm->Pos2Page( 0L ); if( pOld->Read( pBuf, nOldSize ) && pStgStrm->Write( pBuf, nOldSize ) ) - bRes = TRUE; - delete[] static_cast<BYTE*>(pBuf); + bRes = sal_True; + delete[] static_cast<sal_uInt8*>(pBuf); } else - bRes = TRUE; + bRes = sal_True; if( bRes ) { pOld->SetSize( 0 ); @@ -378,7 +378,7 @@ BOOL StgDirEntry::SetSize( INT32 nNewSize ) else { pStgStrm->Pos2Page( nPos ); - bRes = TRUE; + bRes = sal_True; } } return bRes; @@ -387,7 +387,7 @@ BOOL StgDirEntry::SetSize( INT32 nNewSize ) // Seek. On negative values, seek to EOF. -INT32 StgDirEntry::Seek( INT32 nNew ) +sal_Int32 StgDirEntry::Seek( sal_Int32 nNew ) { if( pTmpStrm ) { @@ -403,7 +403,7 @@ INT32 StgDirEntry::Seek( INT32 nNew ) } else { - INT32 nSize = aEntry.GetSize(); + sal_Int32 nSize = aEntry.GetSize(); if( nNew < 0 ) nNew = nSize; @@ -427,7 +427,7 @@ INT32 StgDirEntry::Seek( INT32 nNew ) // Read -INT32 StgDirEntry::Read( void* p, INT32 nLen ) +sal_Int32 StgDirEntry::Read( void* p, sal_Int32 nLen ) { if( nLen <= 0 ) return 0; @@ -443,7 +443,7 @@ INT32 StgDirEntry::Read( void* p, INT32 nLen ) // Write -INT32 StgDirEntry::Write( const void* p, INT32 nLen ) +sal_Int32 StgDirEntry::Write( const void* p, sal_Int32 nLen ) { if( nLen <= 0 || !( nMode & STREAM_WRITE ) ) return 0; @@ -461,7 +461,7 @@ INT32 StgDirEntry::Write( const void* p, INT32 nLen ) } else { - INT32 nNew = nPos + nLen; + sal_Int32 nNew = nPos + nLen; if( nNew > pStgStrm->GetSize() ) { if( !SetSize( nNew ) ) @@ -478,16 +478,16 @@ INT32 StgDirEntry::Write( const void* p, INT32 nLen ) void StgDirEntry::Copy( StgDirEntry& rDest ) { - INT32 n = GetSize(); + sal_Int32 n = GetSize(); if( rDest.SetSize( n ) && n ) { - BYTE aTempBytes[ 4096 ]; + sal_uInt8 aTempBytes[ 4096 ]; void* p = static_cast<void*>( aTempBytes ); Seek( 0L ); rDest.Seek( 0L ); while( n ) { - INT32 nn = n; + sal_Int32 nn = n; if( nn > 4096 ) nn = 4096; if( Read( p, nn ) != nn ) @@ -501,22 +501,22 @@ void StgDirEntry::Copy( StgDirEntry& rDest ) void StgDirEntry::Copy( BaseStorageStream& rDest ) { - INT32 n = GetSize(); + sal_Int32 n = GetSize(); if( rDest.SetSize( n ) && n ) { - ULONG Pos = rDest.Tell(); - BYTE aTempBytes[ 4096 ]; + sal_uIntPtr Pos = rDest.Tell(); + sal_uInt8 aTempBytes[ 4096 ]; void* p = static_cast<void*>( aTempBytes ); Seek( 0L ); rDest.Seek( 0L ); while( n ) { - INT32 nn = n; + sal_Int32 nn = n; if( nn > 4096 ) nn = 4096; if( Read( p, nn ) != nn ) break; - if( sal::static_int_cast<INT32>(rDest.Write( p, nn )) != nn ) + if( sal::static_int_cast<sal_Int32>(rDest.Write( p, nn )) != nn ) break; n -= nn; } @@ -526,12 +526,12 @@ void StgDirEntry::Copy( BaseStorageStream& rDest ) // Commit this entry -BOOL StgDirEntry::Commit() +sal_Bool StgDirEntry::Commit() { // OSL_ENSURE( nMode & STREAM_WRITE, "Trying to commit readonly stream!" ); aSave = aEntry; - BOOL bRes = TRUE; + sal_Bool bRes = sal_True; if( aEntry.GetType() == STG_STREAM ) { if( pTmpStrm ) @@ -552,7 +552,7 @@ BOOL StgDirEntry::Commit() // Revert the entry -BOOL StgDirEntry::Revert() +sal_Bool StgDirEntry::Revert() { aEntry = aSave; switch( aEntry.GetType() ) @@ -563,24 +563,24 @@ BOOL StgDirEntry::Revert() break; case STG_STORAGE: { - BOOL bSomeRenamed = FALSE; + sal_Bool bSomeRenamed = sal_False; StgIterator aOIter( *this ); StgDirEntry* op = aOIter.First(); while( op ) { op->aEntry = op->aSave; - op->bDirty = FALSE; - bSomeRenamed = BOOL( bSomeRenamed | op->bRenamed ); + op->bDirty = sal_False; + bSomeRenamed = sal_Bool( bSomeRenamed | op->bRenamed ); // Remove any new entries if( op->bCreated ) { - op->bCreated = FALSE; + op->bCreated = sal_False; op->Close(); - op->bInvalid = TRUE; + op->bInvalid = sal_True; } // Reactivate any removed entries else if( op->bRemoved ) - op->bRemoved = op->bInvalid = op->bTemp = FALSE; + op->bRemoved = op->bInvalid = op->bTemp = sal_False; op = aOIter.Next(); } // Resort all renamed entries @@ -595,12 +595,12 @@ BOOL StgDirEntry::Revert() StgAvlNode::Move ( (StgAvlNode**) &p->pUp->pDown, (StgAvlNode**) &p->pUp->pDown, p ); - p->bRenamed = FALSE; + p->bRenamed = sal_False; } p = aIter.Next(); } } - DelTemp( FALSE ); + DelTemp( sal_False ); break; } case STG_EMPTY: @@ -609,22 +609,22 @@ BOOL StgDirEntry::Revert() case STG_ROOT: break; } - return TRUE; + return sal_True; } // Copy the stg stream to the temp stream -BOOL StgDirEntry::Strm2Tmp() +sal_Bool StgDirEntry::Strm2Tmp() { if( !pTmpStrm ) { - ULONG n = 0; + sal_uIntPtr n = 0; if( pCurStrm ) { // It was already commited once pTmpStrm = new StgTmpStrm; if( pTmpStrm->GetError() == SVSTREAM_OK && pTmpStrm->Copy( *pCurStrm ) ) - return TRUE; + return sal_True; n = 1; // indicates error } else @@ -635,15 +635,15 @@ BOOL StgDirEntry::Strm2Tmp() { if( n ) { - BYTE aTempBytes[ 4096 ]; + sal_uInt8 aTempBytes[ 4096 ]; void* p = static_cast<void*>( aTempBytes ); pStgStrm->Pos2Page( 0L ); while( n ) { - ULONG nn = n; + sal_uIntPtr nn = n; if( nn > 4096 ) nn = 4096; - if( (ULONG) pStgStrm->Read( p, nn ) != nn ) + if( (sal_uIntPtr) pStgStrm->Read( p, nn ) != nn ) break; if( pTmpStrm->Write( p, nn ) != nn ) break; @@ -661,41 +661,41 @@ BOOL StgDirEntry::Strm2Tmp() pStgStrm->GetIo().SetError( pTmpStrm->GetError() ); delete pTmpStrm; pTmpStrm = NULL; - return FALSE; + return sal_False; } } - return TRUE; + return sal_True; } // Copy the temp stream to the stg stream during the final commit -BOOL StgDirEntry::Tmp2Strm() +sal_Bool StgDirEntry::Tmp2Strm() { // We did commit once, but have not written since then if( !pTmpStrm ) pTmpStrm = pCurStrm, pCurStrm = NULL; if( pTmpStrm ) { - ULONG n = pTmpStrm->GetSize(); + sal_uIntPtr n = pTmpStrm->GetSize(); StgStrm* pNewStrm; StgIo& rIo = pStgStrm->GetIo(); - ULONG nThreshold = (ULONG) rIo.aHdr.GetThreshold(); + sal_uIntPtr nThreshold = (sal_uIntPtr) rIo.aHdr.GetThreshold(); if( n < nThreshold ) pNewStrm = new StgSmallStrm( rIo, STG_EOF, 0 ); else pNewStrm = new StgDataStrm( rIo, STG_EOF, 0 ); if( pNewStrm->SetSize( n ) ) { - BYTE p[ 4096 ]; + sal_uInt8 p[ 4096 ]; pTmpStrm->Seek( 0L ); while( n ) { - ULONG nn = n; + sal_uIntPtr nn = n; if( nn > 4096 ) nn = 4096; if( pTmpStrm->Read( p, nn ) != nn ) break; - if( (ULONG) pNewStrm->Write( p, nn ) != nn ) + if( (sal_uIntPtr) pNewStrm->Write( p, nn ) != nn ) break; n -= nn; } @@ -704,7 +704,7 @@ BOOL StgDirEntry::Tmp2Strm() pTmpStrm->Seek( nPos ); pStgStrm->GetIo().SetError( pTmpStrm->GetError() ); delete pNewStrm; - return FALSE; + return sal_False; } else { @@ -720,12 +720,12 @@ BOOL StgDirEntry::Tmp2Strm() } } } - return TRUE; + return sal_True; } // Check if the given entry is contained in this entry -BOOL StgDirEntry::IsContained( StgDirEntry* pStg ) +sal_Bool StgDirEntry::IsContained( StgDirEntry* pStg ) { if( aEntry.GetType() == STG_STORAGE ) { @@ -734,25 +734,25 @@ BOOL StgDirEntry::IsContained( StgDirEntry* pStg ) while( p ) { if( !p->aEntry.Compare( pStg->aEntry ) ) - return FALSE; + return sal_False; if( p->aEntry.GetType() == STG_STORAGE ) if( !p->IsContained( pStg ) ) - return FALSE; + return sal_False; p = aIter.Next(); } } - return TRUE; + return sal_True; } // Invalidate all open entries by setting the RefCount to 0. If the bDel // flag is set, also set the invalid flag to indicate deletion during the // next dir stream flush. -void StgDirEntry::Invalidate( BOOL bDel ) +void StgDirEntry::Invalidate( sal_Bool bDel ) { // nRefCnt = 0; if( bDel ) - bRemoved = bInvalid = TRUE; + bRemoved = bInvalid = sal_True; switch( aEntry.GetType() ) { case STG_STORAGE: @@ -807,12 +807,12 @@ StgDirStrm::~StgDirStrm() // Recursively parse the directory tree during reading the TOC stream -void StgDirStrm::SetupEntry( INT32 n, StgDirEntry* pUpper ) +void StgDirStrm::SetupEntry( sal_Int32 n, StgDirEntry* pUpper ) { void* p = ( n == STG_FREE ) ? NULL : GetEntry( n ); if( p ) { - BOOL bOk(FALSE); + sal_Bool bOk(sal_False); StgDirEntry* pCur = new StgDirEntry( p, &bOk ); if( !bOk ) @@ -827,10 +827,10 @@ void StgDirStrm::SetupEntry( INT32 n, StgDirEntry* pUpper ) if( !pUpper ) pCur->aEntry.SetType( STG_ROOT ); - INT32 nLeft = pCur->aEntry.GetLeaf( STG_LEFT ); - INT32 nRight = pCur->aEntry.GetLeaf( STG_RIGHT ); + sal_Int32 nLeft = pCur->aEntry.GetLeaf( STG_LEFT ); + sal_Int32 nRight = pCur->aEntry.GetLeaf( STG_RIGHT ); // substorage? - INT32 nLeaf = STG_FREE; + sal_Int32 nLeaf = STG_FREE; if( pCur->aEntry.GetType() == STG_STORAGE || pCur->aEntry.GetType() == STG_ROOT ) { nLeaf = pCur->aEntry.GetLeaf( STG_CHILD ); @@ -865,7 +865,7 @@ void StgDirStrm::SetupEntry( INT32 n, StgDirEntry* pUpper ) // Extend or shrink the directory stream. -BOOL StgDirStrm::SetSize( INT32 nBytes ) +sal_Bool StgDirStrm::SetSize( sal_Int32 nBytes ) { // Always allocate full pages nBytes = ( ( nBytes + nPageSize - 1 ) / nPageSize ) * nPageSize; @@ -874,72 +874,72 @@ BOOL StgDirStrm::SetSize( INT32 nBytes ) // Save the TOC stream into a new substream after saving all data streams -BOOL StgDirStrm::Store() +sal_Bool StgDirStrm::Store() { if( !pRoot->IsDirty() ) - return TRUE; + return sal_True; if( !pRoot->StoreStreams( rIo ) ) - return FALSE; + return sal_False; // After writing all streams, the data FAT stream has changed, // so we have to commit the root again pRoot->Commit(); // We want a completely new stream, so fake an empty stream - INT32 nOldStart = nStart; // save for later deletion - INT32 nOldSize = nSize; + sal_Int32 nOldStart = nStart; // save for later deletion + sal_Int32 nOldSize = nSize; nStart = nPage = STG_EOF; nSize = nPos = 0; nOffset = 0; // Delete all temporary entries - pRoot->DelTemp( FALSE ); + pRoot->DelTemp( sal_False ); // set the entry numbers - INT32 n = 0; + sal_Int32 n = 0; pRoot->Enum( n ); if( !SetSize( n * STGENTRY_SIZE ) ) { nStart = nOldStart; nSize = nOldSize; pRoot->RevertAll(); - return FALSE; + return sal_False; } // set up the cache elements for the new stream if( !Copy( STG_FREE, nSize ) ) { pRoot->RevertAll(); - return FALSE; + return sal_False; } // Write the data to the new stream if( !pRoot->Store( *this ) ) { pRoot->RevertAll(); - return FALSE; + return sal_False; } // fill any remaining entries with empty data - INT32 ne = nSize / STGENTRY_SIZE; + sal_Int32 ne = nSize / STGENTRY_SIZE; StgEntry aEmpty; aEmpty.Init(); while( n < ne ) { - void* p = GetEntry( n++, TRUE ); + void* p = GetEntry( n++, sal_True ); if( !p ) { pRoot->RevertAll(); - return FALSE; + return sal_False; } aEmpty.Store( p ); } // Now we can release the old stream - pFat->FreePages( nOldStart, TRUE ); + pFat->FreePages( nOldStart, sal_True ); rIo.aHdr.SetTOCStart( nStart ); - return TRUE; + return sal_True; } // Get a dir entry. -void* StgDirStrm::GetEntry( INT32 n, BOOL bDirty ) +void* StgDirStrm::GetEntry( sal_Int32 n, sal_Bool bDirty ) { n *= STGENTRY_SIZE; if( n >= nSize ) return NULL; - return GetPtr( n, TRUE, bDirty ); + return GetPtr( n, sal_True, bDirty ); } // Find a dir entry. @@ -986,9 +986,9 @@ StgDirEntry* StgDirStrm::Create } pRes->bInvalid = pRes->bRemoved = - pRes->bTemp = FALSE; + pRes->bTemp = sal_False; pRes->bCreated = - pRes->bDirty = TRUE; + pRes->bDirty = sal_True; } else { @@ -998,7 +998,7 @@ StgDirEntry* StgDirStrm::Create pRes->pUp = &rStg; pRes->ppRoot = &pRoot; pRes->bCreated = - pRes->bDirty = TRUE; + pRes->bDirty = sal_True; } else { @@ -1011,44 +1011,44 @@ StgDirEntry* StgDirStrm::Create // Rename the given entry. -BOOL StgDirStrm::Rename( StgDirEntry& rStg, const String& rOld, const String& rNew ) +sal_Bool StgDirStrm::Rename( StgDirEntry& rStg, const String& rOld, const String& rNew ) { StgDirEntry* p = Find( rStg, rOld ); if( p ) { - if( !StgAvlNode::Remove( (StgAvlNode**) &rStg.pDown, p, FALSE ) ) - return FALSE; + if( !StgAvlNode::Remove( (StgAvlNode**) &rStg.pDown, p, sal_False ) ) + return sal_False; p->aEntry.SetName( rNew ); if( !StgAvlNode::Insert( (StgAvlNode**) &rStg.pDown, p ) ) - return FALSE; - p->bRenamed = p->bDirty = TRUE; - return TRUE; + return sal_False; + p->bRenamed = p->bDirty = sal_True; + return sal_True; } else { rIo.SetError( SVSTREAM_FILE_NOT_FOUND ); - return FALSE; + return sal_False; } } // Move the given entry to a different storage. -BOOL StgDirStrm::Move( StgDirEntry& rStg1, StgDirEntry& rStg2, const String& rName ) +sal_Bool StgDirStrm::Move( StgDirEntry& rStg1, StgDirEntry& rStg2, const String& rName ) { StgDirEntry* p = Find( rStg1, rName ); if( p ) { if( !StgAvlNode::Move ( (StgAvlNode**) &rStg1.pDown, (StgAvlNode**) &rStg2.pDown, p ) ) - return FALSE; - p->bDirty = TRUE; - return TRUE; + return sal_False; + p->bDirty = sal_True; + return sal_True; } else { rIo.SetError( SVSTREAM_FILE_NOT_FOUND ); - return FALSE; + return sal_False; } } diff --git a/sot/source/sdstor/stgdir.hxx b/sot/source/sdstor/stgdir.hxx index 3ef510a12e50..e3cf2cb78072 100644 --- a/sot/source/sdstor/stgdir.hxx +++ b/sot/source/sdstor/stgdir.hxx @@ -49,52 +49,52 @@ class StgDirEntry : public StgAvlNode StgStrm* pStgStrm; // storage stream StgTmpStrm* pTmpStrm; // temporary stream StgTmpStrm* pCurStrm; // temp stream after commit - INT32 nEntry; // entry # in TOC stream (temp) - INT32 nPos; // current position - BOOL bDirty; // dirty directory entry - BOOL bCreated; // newly created entry - BOOL bRemoved; // removed per Invalidate() - BOOL bRenamed; // renamed + sal_Int32 nEntry; // entry # in TOC stream (temp) + sal_Int32 nPos; // current position + sal_Bool bDirty; // dirty directory entry + sal_Bool bCreated; // newly created entry + sal_Bool bRemoved; // removed per Invalidate() + sal_Bool bRenamed; // renamed void InitMembers(); // ctor helper virtual short Compare( const StgAvlNode* ) const; - BOOL StoreStream( StgIo& ); // store the stream - BOOL StoreStreams( StgIo& ); // store all streams + sal_Bool StoreStream( StgIo& ); // store the stream + sal_Bool StoreStreams( StgIo& ); // store all streams void RevertAll(); // revert the whole tree - BOOL Strm2Tmp(); // copy stgstream to temp file - BOOL Tmp2Strm(); // copy temp file to stgstream + sal_Bool Strm2Tmp(); // copy stgstream to temp file + sal_Bool Tmp2Strm(); // copy temp file to stgstream public: StgEntry aEntry; // entry data - INT32 nRefCnt; // reference count + sal_Int32 nRefCnt; // reference count StreamMode nMode; // open mode - BOOL bTemp; // TRUE: delete on dir flush - BOOL bDirect; // TRUE: direct mode - BOOL bZombie; // TRUE: Removed From StgIo - BOOL bInvalid; // TRUE: invalid entry - StgDirEntry( const void*, BOOL * pbOk ); + sal_Bool bTemp; // sal_True: delete on dir flush + sal_Bool bDirect; // sal_True: direct mode + sal_Bool bZombie; // sal_True: Removed From StgIo + sal_Bool bInvalid; // sal_True: invalid entry + StgDirEntry( const void*, sal_Bool * pbOk ); StgDirEntry( const StgEntry& ); ~StgDirEntry(); - void Invalidate( BOOL=FALSE ); // invalidate all open entries - void Enum( INT32& ); // enumerate entries for iteration - void DelTemp( BOOL ); // delete temporary entries - BOOL Store( StgDirStrm& ); // save entry into dir strm - BOOL IsContained( StgDirEntry* ); // check if subentry + void Invalidate( sal_Bool=sal_False ); // invalidate all open entries + void Enum( sal_Int32& ); // enumerate entries for iteration + void DelTemp( sal_Bool ); // delete temporary entries + sal_Bool Store( StgDirStrm& ); // save entry into dir strm + sal_Bool IsContained( StgDirEntry* ); // check if subentry - void SetDirty() { bDirty = TRUE; } - BOOL IsDirty(); + void SetDirty() { bDirty = sal_True; } + sal_Bool IsDirty(); void ClearDirty(); - BOOL Commit(); - BOOL Revert(); + sal_Bool Commit(); + sal_Bool Revert(); - void OpenStream( StgIo&, BOOL=FALSE ); // set up an approbiate stream + void OpenStream( StgIo&, sal_Bool=sal_False ); // set up an approbiate stream void Close(); - INT32 GetSize(); - BOOL SetSize( INT32 ); - INT32 Seek( INT32 ); - INT32 Tell() { return nPos; } - INT32 Read( void*, INT32 ); - INT32 Write( const void*, INT32 ); + sal_Int32 GetSize(); + sal_Bool SetSize( sal_Int32 ); + sal_Int32 Seek( sal_Int32 ); + sal_Int32 Tell() { return nPos; } + sal_Int32 Read( void*, sal_Int32 ); + sal_Int32 Write( const void*, sal_Int32 ); void Copy( StgDirEntry& ); void Copy( BaseStorageStream& ); }; @@ -104,19 +104,19 @@ class StgDirStrm : public StgDataStrm friend class StgIterator; StgDirEntry* pRoot; // root of dir tree short nEntries; // entries per page - void SetupEntry( INT32, StgDirEntry* ); + void SetupEntry( sal_Int32, StgDirEntry* ); public: StgDirStrm( StgIo& ); ~StgDirStrm(); - virtual BOOL SetSize( INT32 ); // change the size - BOOL Store(); - void* GetEntry( INT32 n, BOOL=FALSE );// get an entry + virtual sal_Bool SetSize( sal_Int32 ); // change the size + sal_Bool Store(); + void* GetEntry( sal_Int32 n, sal_Bool=sal_False );// get an entry StgDirEntry* GetRoot() { return pRoot; } StgDirEntry* Find( StgDirEntry&, const String& ); StgDirEntry* Create( StgDirEntry&, const String&, StgEntryType ); - BOOL Remove( StgDirEntry&, const String& ); - BOOL Rename( StgDirEntry&, const String&, const String& ); - BOOL Move( StgDirEntry&, StgDirEntry&, const String& ); + sal_Bool Remove( StgDirEntry&, const String& ); + sal_Bool Rename( StgDirEntry&, const String&, const String& ); + sal_Bool Move( StgDirEntry&, StgDirEntry&, const String& ); }; class StgIterator : public StgAvlIterator diff --git a/sot/source/sdstor/stgelem.cxx b/sot/source/sdstor/stgelem.cxx index 46d7f1803140..917a4c2adb61 100644 --- a/sot/source/sdstor/stgelem.cxx +++ b/sot/source/sdstor/stgelem.cxx @@ -39,7 +39,7 @@ #include "stgdir.hxx" #include "stgio.hxx" -static BYTE cStgSignature[ 8 ] = { 0xD0,0xCF,0x11,0xE0,0xA1,0xB1,0x1A,0xE1 }; +static sal_uInt8 cStgSignature[ 8 ] = { 0xD0,0xCF,0x11,0xE0,0xA1,0xB1,0x1A,0xE1 }; ////////////////////////////// struct ClsId ///////////////////////////// @@ -62,17 +62,17 @@ SvStream& operator >>( SvStream& r, ClsId& rId ) SvStream& operator <<( SvStream& r, const ClsId& rId ) { return - r << (INT32) rId.n1 - << (INT16) rId.n2 - << (INT16) rId.n3 - << (UINT8) rId.n4 - << (UINT8) rId.n5 - << (UINT8) rId.n6 - << (UINT8) rId.n7 - << (UINT8) rId.n8 - << (UINT8) rId.n9 - << (UINT8) rId.n10 - << (UINT8) rId.n11; + r << (sal_Int32) rId.n1 + << (sal_Int16) rId.n2 + << (sal_Int16) rId.n3 + << (sal_uInt8) rId.n4 + << (sal_uInt8) rId.n5 + << (sal_uInt8) rId.n6 + << (sal_uInt8) rId.n7 + << (sal_uInt8) rId.n8 + << (sal_uInt8) rId.n9 + << (sal_uInt8) rId.n10 + << (sal_uInt8) rId.n11; } ///////////////////////////// class StgHeader //////////////////////////// @@ -99,14 +99,14 @@ void StgHeader::Init() SetFATPage( i, STG_FREE ); } -BOOL StgHeader::Load( StgIo& rIo ) +sal_Bool StgHeader::Load( StgIo& rIo ) { SvStream& r = *rIo.GetStrm(); Load( r ); return rIo.Good(); } -BOOL StgHeader::Load( SvStream& r ) +sal_Bool StgHeader::Load( SvStream& r ) { r.Seek( 0L ); r.Read( cSignature, 8 ); @@ -129,10 +129,10 @@ BOOL StgHeader::Load( SvStream& r ) return r.GetErrorCode() == ERRCODE_NONE; } -BOOL StgHeader::Store( StgIo& rIo ) +sal_Bool StgHeader::Store( StgIo& rIo ) { if( !bDirty ) - return TRUE; + return sal_True; SvStream& r = *rIo.GetStrm(); r.Seek( 0L ); r.Write( cSignature, 8 + 16 ); @@ -140,7 +140,7 @@ BOOL StgHeader::Store( StgIo& rIo ) << nByteOrder // 1C Unicode byte order indicator << nPageSize // 1E 1 << nPageSize = block size << nDataPageSize // 20 1 << this size == data block size - << (INT32) 0 << (INT32) 0 << (INT16) 0 + << (sal_Int32) 0 << (sal_Int32) 0 << (sal_Int16) 0 << nFATSize // 2C total number of FAT pages << nTOCstrm // 30 starting page for the TOC stream << nReserved // 34 @@ -152,7 +152,7 @@ BOOL StgHeader::Store( StgIo& rIo ) for( short i = 0; i < 109; i++ ) r << nMasterFAT[ i ]; bDirty = !rIo.Good(); - return BOOL( !bDirty ); + return sal_Bool( !bDirty ); } static bool lcl_wontoverflow(short shift) @@ -161,15 +161,15 @@ static bool lcl_wontoverflow(short shift) } // Perform thorough checks also on unknown variables -BOOL StgHeader::Check() +sal_Bool StgHeader::Check() { - return BOOL( memcmp( cSignature, cStgSignature, 8 ) == 0 + return sal_Bool( memcmp( cSignature, cStgSignature, 8 ) == 0 && (short) ( nVersion >> 16 ) == 3 ) && lcl_wontoverflow(nPageSize) && lcl_wontoverflow(nDataPageSize); } -INT32 StgHeader::GetFATPage( short n ) const +sal_Int32 StgHeader::GetFATPage( short n ) const { if( n >= 0 && n < 109 ) return nMasterFAT[ n ]; @@ -177,50 +177,50 @@ INT32 StgHeader::GetFATPage( short n ) const return STG_EOF; } -void StgHeader::SetFATPage( short n, INT32 nb ) +void StgHeader::SetFATPage( short n, sal_Int32 nb ) { if( n >= 0 && n < 109 ) { if( nMasterFAT[ n ] != nb ) - bDirty = TRUE, nMasterFAT[ n ] = nb; + bDirty = sal_True, nMasterFAT[ n ] = nb; } } void StgHeader::SetClassId( const ClsId& r ) { if( memcmp( &aClsId, &r, sizeof( ClsId ) ) ) - bDirty = TRUE, memcpy( &aClsId, &r, sizeof( ClsId ) ); + bDirty = sal_True, memcpy( &aClsId, &r, sizeof( ClsId ) ); } -void StgHeader::SetTOCStart( INT32 n ) +void StgHeader::SetTOCStart( sal_Int32 n ) { - if( n != nTOCstrm ) bDirty = TRUE, nTOCstrm = n; + if( n != nTOCstrm ) bDirty = sal_True, nTOCstrm = n; } -void StgHeader::SetDataFATStart( INT32 n ) +void StgHeader::SetDataFATStart( sal_Int32 n ) { - if( n != nDataFAT ) bDirty = TRUE, nDataFAT = n; + if( n != nDataFAT ) bDirty = sal_True, nDataFAT = n; } -void StgHeader::SetDataFATSize( INT32 n ) +void StgHeader::SetDataFATSize( sal_Int32 n ) { - if( n != nDataFATSize ) bDirty = TRUE, nDataFATSize = n; + if( n != nDataFATSize ) bDirty = sal_True, nDataFATSize = n; } -void StgHeader::SetFATSize( INT32 n ) +void StgHeader::SetFATSize( sal_Int32 n ) { - if( n != nFATSize ) bDirty = TRUE, nFATSize = n; + if( n != nFATSize ) bDirty = sal_True, nFATSize = n; } -void StgHeader::SetFATChain( INT32 n ) +void StgHeader::SetFATChain( sal_Int32 n ) { if( n != nMasterChain ) - bDirty = TRUE, nMasterChain = n; + bDirty = sal_True, nMasterChain = n; } -void StgHeader::SetMasters( INT32 n ) +void StgHeader::SetMasters( sal_Int32 n ) { - if( n != nMaster ) bDirty = TRUE, nMaster = n; + if( n != nMaster ) bDirty = sal_True, nMaster = n; } ///////////////////////////// class StgEntry ///////////////////////////// @@ -237,11 +237,11 @@ void ToUnicode_Impl( String& rName ) rName.Erase( 32 ); rName.Convert( ::GetSystemCharSet(), CHARSET_ANSI ); // brute force is OK - BYTE* p = (BYTE*) rName.GetCharStr(); - for( USHORT i = 0; i < rName.Len(); i++, p++ ) + sal_uInt8* p = (sal_uInt8*) rName.GetCharStr(); + for( sal_uInt16 i = 0; i < rName.Len(); i++, p++ ) { // check each character and substitute blanks for illegal ones - BYTE cChar = *p; + sal_uInt8 cChar = *p; if( cChar == '!' || cChar == ':' || cChar == '\\' || cChar == '/' ) *p = ' '; } @@ -253,14 +253,14 @@ static void FromUnicode( String& rName ) rName.Convert( CHARSET_ANSI, ::GetSystemCharSet() ); } */ -BOOL StgEntry::Init() +sal_Bool StgEntry::Init() { memset( this, 0, sizeof (StgEntry) - sizeof( String ) ); SetLeaf( STG_LEFT, STG_FREE ); SetLeaf( STG_RIGHT, STG_FREE ); SetLeaf( STG_CHILD, STG_FREE ); SetLeaf( STG_DATA, STG_EOF ); - return TRUE; + return sal_True; } static String ToUpperUnicode( const String & rStr ) @@ -278,7 +278,7 @@ static String ToUpperUnicode( const String & rStr ) } -BOOL StgEntry::SetName( const String& rName ) +sal_Bool StgEntry::SetName( const String& rName ) { // I don't know the locale, so en_US is hopefully fine aName = ToUpperUnicode( rName ); @@ -290,12 +290,12 @@ BOOL StgEntry::SetName( const String& rName ) while( i < 32 ) nName[ i++ ] = 0; nNameLen = ( aName.Len() + 1 ) << 1; - return TRUE; + return sal_True; } -INT32 StgEntry::GetLeaf( StgEntryRef eRef ) const +sal_Int32 StgEntry::GetLeaf( StgEntryRef eRef ) const { - INT32 n = -1; + sal_Int32 n = -1; switch( eRef ) { case STG_LEFT: n = nLeft; break; @@ -306,7 +306,7 @@ INT32 StgEntry::GetLeaf( StgEntryRef eRef ) const return n; } -void StgEntry::SetLeaf( StgEntryRef eRef, INT32 nPage ) +void StgEntry::SetLeaf( StgEntryRef eRef, sal_Int32 nPage ) { switch( eRef ) { @@ -317,12 +317,12 @@ void StgEntry::SetLeaf( StgEntryRef eRef, INT32 nPage ) } } -const INT32* StgEntry::GetTime( StgEntryTime eTime ) const +const sal_Int32* StgEntry::GetTime( StgEntryTime eTime ) const { return( eTime == STG_MODIFIED ) ? nMtime : nAtime; } -void StgEntry::SetTime( StgEntryTime eTime, INT32* pTime ) +void StgEntry::SetTime( StgEntryTime eTime, sal_Int32* pTime ) { if( eTime == STG_MODIFIED ) nMtime[ 0 ] = *pTime++, nMtime[ 1 ] = *pTime; @@ -337,7 +337,7 @@ void StgEntry::SetClassId( const ClsId& r ) void StgEntry::GetName( String& rName ) const { - UINT16 n = nNameLen; + sal_uInt16 n = nNameLen; if( n ) n = ( n >> 1 ) - 1; rName = String( nName, n ); @@ -362,7 +362,7 @@ short StgEntry::Compare( const StgEntry& r ) const // These load/store operations are a bit more complicated, // since they have to copy their contents into a packed structure. -BOOL StgEntry::Load( const void* pFrom ) +sal_Bool StgEntry::Load( const void* pFrom ) { SvMemoryStream r( (sal_Char*) pFrom, 128, STREAM_READ ); for( short i = 0; i < 32; i++ ) @@ -383,14 +383,14 @@ BOOL StgEntry::Load( const void* pFrom ) >> nSize // 78 file size >> nUnknown; // 7C unknown - UINT16 n = nNameLen; + sal_uInt16 n = nNameLen; if( n ) n = ( n >> 1 ) - 1; if( n > 31 || (nSize < 0 && cType != STG_STORAGE) ) { // the size makes no sence for the substorage // TODO/LATER: actually the size should be an unsigned value, but in this case it would mean a stream of more than 2Gb - return FALSE; + return sal_False; } aName = String( nName, n ); @@ -398,7 +398,7 @@ BOOL StgEntry::Load( const void* pFrom ) aName = ToUpperUnicode( aName ); aName.Erase( 31 ); - return TRUE; + return sal_True; } void StgEntry::Store( void* pTo ) diff --git a/sot/source/sdstor/stgelem.hxx b/sot/source/sdstor/stgelem.hxx index 7a5b7bc52b26..8b7d547ca416 100644 --- a/sot/source/sdstor/stgelem.hxx +++ b/sot/source/sdstor/stgelem.hxx @@ -46,51 +46,51 @@ SvStream& operator<<( SvStream&, const ClsId& ); class StgHeader { - BYTE cSignature[ 8 ]; // 00 signature (see below) + sal_uInt8 cSignature[ 8 ]; // 00 signature (see below) ClsId aClsId; // 08 Class ID - INT32 nVersion; // 18 version number - UINT16 nByteOrder; // 1C Unicode byte order indicator - INT16 nPageSize; // 1E 1 << nPageSize = block size - INT16 nDataPageSize; // 20 1 << this size == data block size - BYTE bDirty; // 22 internal dirty flag - BYTE cReserved[ 9 ]; // 23 - INT32 nFATSize; // 2C total number of FAT pages - INT32 nTOCstrm; // 30 starting page for the TOC stream - INT32 nReserved; // 34 - INT32 nThreshold; // 38 minimum file size for big data - INT32 nDataFAT; // 3C page # of 1st data FAT block - INT32 nDataFATSize; // 40 # of data fat blocks - INT32 nMasterChain; // 44 chain to the next master block - INT32 nMaster; // 48 # of additional master blocks - INT32 nMasterFAT[ 109 ]; // 4C first 109 master FAT pages + sal_Int32 nVersion; // 18 version number + sal_uInt16 nByteOrder; // 1C Unicode byte order indicator + sal_Int16 nPageSize; // 1E 1 << nPageSize = block size + sal_Int16 nDataPageSize; // 20 1 << this size == data block size + sal_uInt8 bDirty; // 22 internal dirty flag + sal_uInt8 cReserved[ 9 ]; // 23 + sal_Int32 nFATSize; // 2C total number of FAT pages + sal_Int32 nTOCstrm; // 30 starting page for the TOC stream + sal_Int32 nReserved; // 34 + sal_Int32 nThreshold; // 38 minimum file size for big data + sal_Int32 nDataFAT; // 3C page # of 1st data FAT block + sal_Int32 nDataFATSize; // 40 # of data fat blocks + sal_Int32 nMasterChain; // 44 chain to the next master block + sal_Int32 nMaster; // 48 # of additional master blocks + sal_Int32 nMasterFAT[ 109 ]; // 4C first 109 master FAT pages public: StgHeader(); void Init(); // initialize the header - BOOL Load( StgIo& ); - BOOL Load( SvStream& ); - BOOL Store( StgIo& ); - BOOL Check(); // check the signature and version + sal_Bool Load( StgIo& ); + sal_Bool Load( SvStream& ); + sal_Bool Store( StgIo& ); + sal_Bool Check(); // check the signature and version short GetByteOrder() const { return nByteOrder; } - INT32 GetTOCStart() const { return nTOCstrm; } - void SetTOCStart( INT32 n ); - INT32 GetDataFATStart() const { return nDataFAT; } - void SetDataFATStart( INT32 n ); - INT32 GetDataFATSize() const { return nDataFATSize; } - void SetDataFATSize( INT32 n ); - INT32 GetThreshold() const { return nThreshold; } + sal_Int32 GetTOCStart() const { return nTOCstrm; } + void SetTOCStart( sal_Int32 n ); + sal_Int32 GetDataFATStart() const { return nDataFAT; } + void SetDataFATStart( sal_Int32 n ); + sal_Int32 GetDataFATSize() const { return nDataFATSize; } + void SetDataFATSize( sal_Int32 n ); + sal_Int32 GetThreshold() const { return nThreshold; } short GetPageSize() const { return nPageSize; } short GetDataPageSize() const { return nDataPageSize; } - INT32 GetFATSize() const { return nFATSize; } - void SetFATSize( INT32 n ); - INT32 GetFATChain() const { return nMasterChain; } - void SetFATChain( INT32 n ); - INT32 GetMasters() const { return nMaster; } - void SetMasters( INT32 n ); + sal_Int32 GetFATSize() const { return nFATSize; } + void SetFATSize( sal_Int32 n ); + sal_Int32 GetFATChain() const { return nMasterChain; } + void SetFATChain( sal_Int32 n ); + sal_Int32 GetMasters() const { return nMaster; } + void SetMasters( sal_Int32 n ); short GetFAT1Size() const { return 109; } const ClsId& GetClassId() const { return aClsId; } void SetClassId( const ClsId& ); - INT32 GetFATPage( short ) const; - void SetFATPage( short, INT32 ); + sal_Int32 GetFATPage( short ) const; + void SetFATPage( short, sal_Int32 ); }; enum StgEntryType { // dir entry types: @@ -119,42 +119,42 @@ class StgStream; #define STGENTRY_SIZE 128 class StgEntry { // directory enty - UINT16 nName[ 32 ]; // 00 name as WCHAR - INT16 nNameLen; // 40 size of name in bytes including 00H - BYTE cType; // 42 entry type - BYTE cFlags; // 43 0 or 1 (tree balance?) - INT32 nLeft; // 44 left node entry - INT32 nRight; // 48 right node entry - INT32 nChild; // 4C 1st child entry if storage + sal_uInt16 nName[ 32 ]; // 00 name as WCHAR + sal_Int16 nNameLen; // 40 size of name in bytes including 00H + sal_uInt8 cType; // 42 entry type + sal_uInt8 cFlags; // 43 0 or 1 (tree balance?) + sal_Int32 nLeft; // 44 left node entry + sal_Int32 nRight; // 48 right node entry + sal_Int32 nChild; // 4C 1st child entry if storage ClsId aClsId; // 50 class ID (optional) - INT32 nFlags; // 60 state flags(?) - INT32 nMtime[ 2 ]; // 64 modification time - INT32 nAtime[ 2 ]; // 6C creation and access time - INT32 nPage1; // 74 starting block (either direct or translated) - INT32 nSize; // 78 file size - INT32 nUnknown; // 7C unknown + sal_Int32 nFlags; // 60 state flags(?) + sal_Int32 nMtime[ 2 ]; // 64 modification time + sal_Int32 nAtime[ 2 ]; // 6C creation and access time + sal_Int32 nPage1; // 74 starting block (either direct or translated) + sal_Int32 nSize; // 78 file size + sal_Int32 nUnknown; // 7C unknown String aName; // Name as Compare String (ascii, upper) public: - BOOL Init(); // initialize the data - BOOL SetName( const String& ); // store a name (ASCII, up to 32 chars) + sal_Bool Init(); // initialize the data + sal_Bool SetName( const String& ); // store a name (ASCII, up to 32 chars) void GetName( String& rName ) const; // fill in the name short Compare( const StgEntry& ) const; // compare two entries - BOOL Load( const void* ); + sal_Bool Load( const void* ); void Store( void* ); StgEntryType GetType() const { return (StgEntryType) cType; } - INT32 GetStartPage() const { return nPage1; } - void SetType( StgEntryType t ) { cType = (BYTE) t; } - BYTE GetFlags() const { return cFlags; } - void SetFlags( BYTE c ) { cFlags = c; } - INT32 GetSize() const { return nSize; } - void SetSize( INT32 n ) { nSize = n; } + sal_Int32 GetStartPage() const { return nPage1; } + void SetType( StgEntryType t ) { cType = (sal_uInt8) t; } + sal_uInt8 GetFlags() const { return cFlags; } + void SetFlags( sal_uInt8 c ) { cFlags = c; } + sal_Int32 GetSize() const { return nSize; } + void SetSize( sal_Int32 n ) { nSize = n; } const ClsId& GetClassId() const { return aClsId; } void SetClassId( const ClsId& ); - INT32 GetLeaf( StgEntryRef ) const; - void SetLeaf( StgEntryRef, INT32 ); - const INT32* GetTime( StgEntryTime ) const; - void SetTime( StgEntryTime, INT32* ); + sal_Int32 GetLeaf( StgEntryRef ) const; + void SetLeaf( StgEntryRef, sal_Int32 ); + const sal_Int32* GetTime( StgEntryTime ) const; + void SetTime( StgEntryTime, sal_Int32* ); }; diff --git a/sot/source/sdstor/stgio.cxx b/sot/source/sdstor/stgio.cxx index 00dd454233e2..580a3ddad4a6 100644 --- a/sot/source/sdstor/stgio.cxx +++ b/sot/source/sdstor/stgio.cxx @@ -46,7 +46,7 @@ StgIo::StgIo() : StgCache() pDataFAT = NULL; pDataStrm = NULL; pFAT = NULL; - bCopied = FALSE; + bCopied = sal_False; } StgIo::~StgIo() @@ -59,7 +59,7 @@ StgIo::~StgIo() // Load the header. Do not set an error code if the header is invalid. -BOOL StgIo::Load() +sal_Bool StgIo::Load() { if( pStrm ) { @@ -68,7 +68,7 @@ BOOL StgIo::Load() if( aHdr.Check() ) SetupStreams(); else - return FALSE; + return sal_False; } } return Good(); @@ -76,7 +76,7 @@ BOOL StgIo::Load() // Set up an initial, empty storage -BOOL StgIo::Init() +sal_Bool StgIo::Init() { aHdr.Init(); SetupStreams(); @@ -122,7 +122,7 @@ short StgIo::GetDataPageSize() // Commit everything -BOOL StgIo::CommitAll() +sal_Bool StgIo::CommitAll() { // Store the data (all streams and the TOC) if( pTOC->Store() ) @@ -135,81 +135,81 @@ BOOL StgIo::CommitAll() if( aHdr.Store( *this ) ) { pStrm->Flush(); - ULONG n = pStrm->GetError(); + sal_uIntPtr n = pStrm->GetError(); SetError( n ); #ifdef DBG_UTIL if( n==0 ) ValidateFATs(); #endif - return BOOL( n == 0 ); + return sal_Bool( n == 0 ); } } } SetError( SVSTREAM_WRITE_ERROR ); - return FALSE; + return sal_False; } class EasyFat { - INT32 *pFat; - BOOL *pFree; - INT32 nPages; - INT32 nPageSize; + sal_Int32 *pFat; + sal_Bool *pFree; + sal_Int32 nPages; + sal_Int32 nPageSize; public: - EasyFat( StgIo & rIo, StgStrm *pFatStream, INT32 nPSize ); + EasyFat( StgIo & rIo, StgStrm *pFatStream, sal_Int32 nPSize ); ~EasyFat() { delete pFat; delete pFree; } - INT32 GetPageSize() { return nPageSize; } - INT32 Count() { return nPages; } - INT32 operator[]( INT32 nOffset ) { return pFat[ nOffset ]; } + sal_Int32 GetPageSize() { return nPageSize; } + sal_Int32 Count() { return nPages; } + sal_Int32 operator[]( sal_Int32 nOffset ) { return pFat[ nOffset ]; } - ULONG Mark( INT32 nPage, INT32 nCount, INT32 nExpect ); - BOOL HasUnrefChains(); + sal_uIntPtr Mark( sal_Int32 nPage, sal_Int32 nCount, sal_Int32 nExpect ); + sal_Bool HasUnrefChains(); }; -EasyFat::EasyFat( StgIo& rIo, StgStrm* pFatStream, INT32 nPSize ) +EasyFat::EasyFat( StgIo& rIo, StgStrm* pFatStream, sal_Int32 nPSize ) { nPages = pFatStream->GetSize() >> 2; nPageSize = nPSize; - pFat = new INT32[ nPages ]; - pFree = new BOOL[ nPages ]; + pFat = new sal_Int32[ nPages ]; + pFree = new sal_Bool[ nPages ]; StgPage *pPage = NULL; - INT32 nFatPageSize = (1 << rIo.aHdr.GetPageSize()) - 2; + sal_Int32 nFatPageSize = (1 << rIo.aHdr.GetPageSize()) - 2; - for( INT32 nPage = 0; nPage < nPages; nPage++ ) + for( sal_Int32 nPage = 0; nPage < nPages; nPage++ ) { if( ! (nPage % nFatPageSize) ) { pFatStream->Pos2Page( nPage << 2 ); - INT32 nPhysPage = pFatStream->GetPage(); - pPage = rIo.Get( nPhysPage, TRUE ); + sal_Int32 nPhysPage = pFatStream->GetPage(); + pPage = rIo.Get( nPhysPage, sal_True ); } pFat[ nPage ] = pPage->GetPage( short( nPage % nFatPageSize ) ); - pFree[ nPage ] = TRUE; + pFree[ nPage ] = sal_True; } } -BOOL EasyFat::HasUnrefChains() +sal_Bool EasyFat::HasUnrefChains() { - for( INT32 nPage = 0; nPage < nPages; nPage++ ) + for( sal_Int32 nPage = 0; nPage < nPages; nPage++ ) { if( pFree[ nPage ] && pFat[ nPage ] != -1 ) - return TRUE; + return sal_True; } - return FALSE; + return sal_False; } -ULONG EasyFat::Mark( INT32 nPage, INT32 nCount, INT32 nExpect ) +sal_uIntPtr EasyFat::Mark( sal_Int32 nPage, sal_Int32 nCount, sal_Int32 nExpect ) { if( nCount > 0 ) --nCount /= GetPageSize(), nCount++; - INT32 nCurPage = nPage; + sal_Int32 nCurPage = nPage; while( nCount != 0 ) { - pFree[ nCurPage ] = FALSE; + pFree[ nCurPage ] = sal_False; nCurPage = pFat[ nCurPage ]; //Stream zu lang if( nCurPage != nExpect && nCount == 1 ) @@ -231,22 +231,22 @@ ULONG EasyFat::Mark( INT32 nPage, INT32 nCount, INT32 nExpect ) class Validator { - ULONG nError; + sal_uIntPtr nError; EasyFat aSmallFat; EasyFat aFat; StgIo &rIo; - ULONG ValidateMasterFATs(); - ULONG ValidateDirectoryEntries(); - ULONG FindUnrefedChains(); - ULONG MarkAll( StgDirEntry *pEntry ); + sal_uIntPtr ValidateMasterFATs(); + sal_uIntPtr ValidateDirectoryEntries(); + sal_uIntPtr FindUnrefedChains(); + sal_uIntPtr MarkAll( StgDirEntry *pEntry ); public: Validator( StgIo &rIo ); - BOOL IsError() { return nError != 0; } + sal_Bool IsError() { return nError != 0; } }; Validator::Validator( StgIo &rIoP ) @@ -254,7 +254,7 @@ Validator::Validator( StgIo &rIoP ) aFat( rIoP, rIoP.pFAT, 1 << rIoP.aHdr.GetPageSize() ), rIo( rIoP ) { - ULONG nErr = nError = FAT_OK; + sal_uIntPtr nErr = nError = FAT_OK; if( ( nErr = ValidateMasterFATs() ) != FAT_OK ) nError = nErr; @@ -264,13 +264,13 @@ Validator::Validator( StgIo &rIoP ) nError = nErr; } -ULONG Validator::ValidateMasterFATs() +sal_uIntPtr Validator::ValidateMasterFATs() { - INT32 nCount = rIo.aHdr.GetFATSize(); - ULONG nErr; - for( INT32 i = 0; i < nCount; i++ ) + sal_Int32 nCount = rIo.aHdr.GetFATSize(); + sal_uIntPtr nErr; + for( sal_Int32 i = 0; i < nCount; i++ ) { - if( ( nErr = aFat.Mark(rIo.pFAT->GetPage( short(i), FALSE ), aFat.GetPageSize(), -3 )) != FAT_OK ) + if( ( nErr = aFat.Mark(rIo.pFAT->GetPage( short(i), sal_False ), aFat.GetPageSize(), -3 )) != FAT_OK ) return nErr; } if( rIo.aHdr.GetMasters() ) @@ -279,10 +279,10 @@ ULONG Validator::ValidateMasterFATs() return FAT_OK; } -ULONG Validator::MarkAll( StgDirEntry *pEntry ) +sal_uIntPtr Validator::MarkAll( StgDirEntry *pEntry ) { StgIterator aIter( *pEntry ); - ULONG nErr = FAT_OK; + sal_uIntPtr nErr = FAT_OK; for( StgDirEntry* p = aIter.First(); p ; p = aIter.Next() ) { if( p->aEntry.GetType() == STG_STORAGE ) @@ -293,7 +293,7 @@ ULONG Validator::MarkAll( StgDirEntry *pEntry ) } else { - INT32 nSize = p->aEntry.GetSize(); + sal_Int32 nSize = p->aEntry.GetSize(); if( nSize < rIo.aHdr.GetThreshold() ) nErr = aSmallFat.Mark( p->aEntry.GetStartPage(),nSize, -2 ); else @@ -305,10 +305,10 @@ ULONG Validator::MarkAll( StgDirEntry *pEntry ) return FAT_OK; } -ULONG Validator::ValidateDirectoryEntries() +sal_uIntPtr Validator::ValidateDirectoryEntries() { // Normale DirEntries - ULONG nErr = MarkAll( rIo.pTOC->GetRoot() ); + sal_uIntPtr nErr = MarkAll( rIo.pTOC->GetRoot() ); if( nErr != FAT_OK ) return nErr; // Small Data @@ -328,7 +328,7 @@ ULONG Validator::ValidateDirectoryEntries() return nErr; } -ULONG Validator::FindUnrefedChains() +sal_uIntPtr Validator::FindUnrefedChains() { if( aSmallFat.HasUnrefChains() || aFat.HasUnrefChains() ) @@ -349,12 +349,12 @@ const Link& StgIo::GetErrorLink() return ErrorLink::get(); } -ULONG StgIo::ValidateFATs() +sal_uIntPtr StgIo::ValidateFATs() { if( bFile ) { Validator *pV = new Validator( *this ); - BOOL bRet1 = !pV->IsError(), bRet2 = TRUE ; + sal_Bool bRet1 = !pV->IsError(), bRet2 = sal_True ; delete pV; SvFileStream *pFileStrm = ( SvFileStream *) GetStrm(); StgIo aIo; @@ -367,7 +367,7 @@ ULONG StgIo::ValidateFATs() delete pV; } - ULONG nErr; + sal_uIntPtr nErr; if( bRet1 != bRet2 ) nErr = bRet1 ? FAT_ONFILEERROR : FAT_INMEMORYERROR; else nErr = bRet1 ? FAT_OK : FAT_BOTHERROR; @@ -377,7 +377,7 @@ ULONG StgIo::ValidateFATs() aArg.aFile = pFileStrm->GetFileName(); aArg.nErr = nErr; ErrorLink::get().Call( &aArg ); - bCopied = TRUE; + bCopied = sal_True; } // DBG_ASSERT( nErr == FAT_OK ,"Storage kaputt"); return nErr; diff --git a/sot/source/sdstor/stgio.hxx b/sot/source/sdstor/stgio.hxx index db1c00b8d521..43f72ebefd59 100644 --- a/sot/source/sdstor/stgio.hxx +++ b/sot/source/sdstor/stgio.hxx @@ -53,12 +53,12 @@ enum FAT_ERROR struct StgLinkArg { String aFile; - ULONG nErr; + sal_uIntPtr nErr; }; class StgIo : public StgCache { void SetupStreams(); // load all internal streams - BOOL bCopied; + sal_Bool bCopied; public: StgIo(); ~StgIo(); @@ -68,13 +68,13 @@ public: StgDataStrm* pDataFAT; // small data FAT stream StgDataStrm* pDataStrm; // small data stream short GetDataPageSize(); // get the logical data page size - BOOL Load(); // load a storage file - BOOL Init(); // set up an empty file - BOOL CommitAll(); // commit everything (root commit) + sal_Bool Load(); // load a storage file + sal_Bool Init(); // set up an empty file + sal_Bool CommitAll(); // commit everything (root commit) static void SetErrorLink( const Link& ); static const Link& GetErrorLink(); - ULONG ValidateFATs( ); + sal_uIntPtr ValidateFATs( ); }; #endif diff --git a/sot/source/sdstor/stgole.cxx b/sot/source/sdstor/stgole.cxx index 148f1e87585c..e3d02bc597ab 100644 --- a/sot/source/sdstor/stgole.cxx +++ b/sot/source/sdstor/stgole.cxx @@ -40,10 +40,10 @@ ///////////////////////// class StgInternalStream //////////////////////// StgInternalStream::StgInternalStream - ( BaseStorage& rStg, const String& rName, BOOL bWr ) + ( BaseStorage& rStg, const String& rName, sal_Bool bWr ) { - bIsWritable = TRUE; - USHORT nMode = bWr + bIsWritable = sal_True; + sal_uInt16 nMode = bWr ? STREAM_WRITE | STREAM_SHARE_DENYALL : STREAM_READ | STREAM_SHARE_DENYWRITE | STREAM_NOCREATE; pStrm = rStg.OpenStream( rName, nMode ); @@ -58,7 +58,7 @@ StgInternalStream::~StgInternalStream() delete pStrm; } -ULONG StgInternalStream::GetData( void* pData, ULONG nSize ) +sal_uIntPtr StgInternalStream::GetData( void* pData, sal_uIntPtr nSize ) { if( pStrm ) { @@ -70,7 +70,7 @@ ULONG StgInternalStream::GetData( void* pData, ULONG nSize ) return 0; } -ULONG StgInternalStream::PutData( const void* pData, ULONG nSize ) +sal_uIntPtr StgInternalStream::PutData( const void* pData, sal_uIntPtr nSize ) { if( pStrm ) { @@ -82,7 +82,7 @@ ULONG StgInternalStream::PutData( const void* pData, ULONG nSize ) return 0; } -ULONG StgInternalStream::SeekPos( ULONG nPos ) +sal_uIntPtr StgInternalStream::SeekPos( sal_uIntPtr nPos ) { return pStrm ? pStrm->Seek( nPos ) : 0; } @@ -104,43 +104,43 @@ void StgInternalStream::Commit() ///////////////////////// class StgCompObjStream ///////////////////////// -StgCompObjStream::StgCompObjStream( BaseStorage& rStg, BOOL bWr ) +StgCompObjStream::StgCompObjStream( BaseStorage& rStg, sal_Bool bWr ) : StgInternalStream( rStg, String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "\1CompObj" ) ), bWr ) { memset( &aClsId, 0, sizeof( ClsId ) ); nCbFormat = 0; } -BOOL StgCompObjStream::Load() +sal_Bool StgCompObjStream::Load() { memset( &aClsId, 0, sizeof( ClsId ) ); nCbFormat = 0; aUserName.Erase(); if( GetError() != SVSTREAM_OK ) - return FALSE; + return sal_False; Seek( 8L ); // skip the first part - INT32 nMarker = 0; + sal_Int32 nMarker = 0; *this >> nMarker; if( nMarker == -1L ) { *this >> aClsId; - INT32 nLen1 = 0; + sal_Int32 nLen1 = 0; *this >> nLen1; // higher bits are ignored nLen1 &= 0xFFFF; - sal_Char* p = new sal_Char[ (USHORT) nLen1 ]; - if( Read( p, nLen1 ) == (ULONG) nLen1 ) + sal_Char* p = new sal_Char[ (sal_uInt16) nLen1 ]; + if( Read( p, nLen1 ) == (sal_uIntPtr) nLen1 ) { aUserName = nLen1 ? String( p, gsl_getSystemTextEncoding() ) : String(); /* // Now we can read the CB format - INT32 nLen2 = 0; + sal_Int32 nLen2 = 0; *this >> nLen2; if( nLen2 > 0 ) { // get a string name if( nLen2 > nLen1 ) delete p, p = new char[ nLen2 ]; - if( Read( p, nLen2 ) == (ULONG) nLen2 && nLen2 ) + if( Read( p, nLen2 ) == (sal_uIntPtr) nLen2 && nLen2 ) nCbFormat = Exchange::RegisterFormatName( String( p ) ); else SetError( SVSTREAM_GENERALERROR ); @@ -158,73 +158,73 @@ BOOL StgCompObjStream::Load() SetError( SVSTREAM_GENERALERROR ); delete [] p; } - return BOOL( GetError() == SVSTREAM_OK ); + return sal_Bool( GetError() == SVSTREAM_OK ); } -BOOL StgCompObjStream::Store() +sal_Bool StgCompObjStream::Store() { if( GetError() != SVSTREAM_OK ) - return FALSE; + return sal_False; Seek( 0L ); ByteString aAsciiUserName( aUserName, RTL_TEXTENCODING_ASCII_US ); - *this << (INT16) 1 // Version? - << (INT16) -2 // 0xFFFE = Byte Order Indicator - << (INT32) 0x0A03 // Windows 3.10 - << (INT32) -1L + *this << (sal_Int16) 1 // Version? + << (sal_Int16) -2 // 0xFFFE = Byte Order Indicator + << (sal_Int32) 0x0A03 // Windows 3.10 + << (sal_Int32) -1L << aClsId // Class ID - << (INT32) (aAsciiUserName.Len() + 1) + << (sal_Int32) (aAsciiUserName.Len() + 1) << (const char *)aAsciiUserName.GetBuffer() - << (UINT8) 0; // string terminator + << (sal_uInt8) 0; // string terminator /* // determine the clipboard format string String aCbFmt; if( nCbFormat > FORMAT_GDIMETAFILE ) aCbFmt = Exchange::GetFormatName( nCbFormat ); if( aCbFmt.Len() ) - *this << (INT32) aCbFmt.Len() + 1 + *this << (sal_Int32) aCbFmt.Len() + 1 << (const char*) aCbFmt - << (UINT8) 0; + << (sal_uInt8) 0; else if( nCbFormat ) - *this << (INT32) -1 // for Windows - << (INT32) nCbFormat; + *this << (sal_Int32) -1 // for Windows + << (sal_Int32) nCbFormat; else - *this << (INT32) 0; // no clipboard format + *this << (sal_Int32) 0; // no clipboard format */ WriteClipboardFormat( *this, nCbFormat ); - *this << (INT32) 0; // terminator + *this << (sal_Int32) 0; // terminator Commit(); - return BOOL( GetError() == SVSTREAM_OK ); + return sal_Bool( GetError() == SVSTREAM_OK ); } /////////////////////////// class StgOleStream /////////////////////////// -StgOleStream::StgOleStream( BaseStorage& rStg, BOOL bWr ) +StgOleStream::StgOleStream( BaseStorage& rStg, sal_Bool bWr ) : StgInternalStream( rStg, String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "\1Ole" ) ), bWr ) { nFlags = 0; } -BOOL StgOleStream::Load() +sal_Bool StgOleStream::Load() { nFlags = 0; if( GetError() != SVSTREAM_OK ) - return FALSE; - INT32 version = 0; + return sal_False; + sal_Int32 version = 0; Seek( 0L ); *this >> version >> nFlags; - return BOOL( GetError() == SVSTREAM_OK ); + return sal_Bool( GetError() == SVSTREAM_OK ); } -BOOL StgOleStream::Store() +sal_Bool StgOleStream::Store() { if( GetError() != SVSTREAM_OK ) - return FALSE; + return sal_False; Seek( 0L ); - *this << (INT32) 0x02000001 // OLE version, format - << (INT32) nFlags // Object flags - << (INT32) 0 // Update Options - << (INT32) 0 // reserved - << (INT32) 0; // Moniker 1 + *this << (sal_Int32) 0x02000001 // OLE version, format + << (sal_Int32) nFlags // Object flags + << (sal_Int32) 0 // Update Options + << (sal_Int32) 0 // reserved + << (sal_Int32) 0; // Moniker 1 Commit(); - return BOOL( GetError() == SVSTREAM_OK ); + return sal_Bool( GetError() == SVSTREAM_OK ); } diff --git a/sot/source/sdstor/stgole.hxx b/sot/source/sdstor/stgole.hxx index 346f21035f06..b8c569c81ded 100644 --- a/sot/source/sdstor/stgole.hxx +++ b/sot/source/sdstor/stgole.hxx @@ -36,12 +36,12 @@ class StgInternalStream : public SvStream { BaseStorageStream* pStrm; - virtual ULONG GetData( void* pData, ULONG nSize ); - virtual ULONG PutData( const void* pData, ULONG nSize ); - virtual ULONG SeekPos( ULONG nPos ); + virtual sal_uIntPtr GetData( void* pData, sal_uIntPtr nSize ); + virtual sal_uIntPtr PutData( const void* pData, sal_uIntPtr nSize ); + virtual sal_uIntPtr SeekPos( sal_uIntPtr nPos ); virtual void FlushData(); public: - StgInternalStream( BaseStorage&, const String&, BOOL ); + StgInternalStream( BaseStorage&, const String&, sal_Bool ); ~StgInternalStream(); void Commit(); }; @@ -52,14 +52,14 @@ class StgCompObjStream : public StgInternalStream { ClsId aClsId; String aUserName; - ULONG nCbFormat; + sal_uIntPtr nCbFormat; public: - StgCompObjStream( BaseStorage&, BOOL ); + StgCompObjStream( BaseStorage&, sal_Bool ); ClsId& GetClsId() { return aClsId; } String& GetUserName() { return aUserName; } - ULONG& GetCbFormat() { return nCbFormat; } - BOOL Load(); - BOOL Store(); + sal_uIntPtr& GetCbFormat() { return nCbFormat; } + sal_Bool Load(); + sal_Bool Store(); }; // standard stream "\1Ole" @@ -68,10 +68,10 @@ class StgOleStream : public StgInternalStream { sal_uInt32 nFlags; public: - StgOleStream( BaseStorage&, BOOL ); + StgOleStream( BaseStorage&, sal_Bool ); sal_uInt32& GetFlags() { return nFlags; } - BOOL Load(); - BOOL Store(); + sal_Bool Load(); + sal_Bool Store(); }; #endif diff --git a/sot/source/sdstor/stgstrms.cxx b/sot/source/sdstor/stgstrms.cxx index 07711133bf4b..74e21903f087 100644 --- a/sot/source/sdstor/stgstrms.cxx +++ b/sot/source/sdstor/stgstrms.cxx @@ -52,10 +52,10 @@ ///////////////////////////// class StgFAT /////////////////////////////// // The FAT class performs FAT operations on an underlying storage stream. -// This stream is either the master FAT stream (m == TRUE ) or a normal +// This stream is either the master FAT stream (m == sal_True ) or a normal // storage stream, which then holds the FAT for small data allocations. -StgFAT::StgFAT( StgStrm& r, BOOL m ) : rStrm( r ) +StgFAT::StgFAT( StgStrm& r, sal_Bool m ) : rStrm( r ) { bPhys = m; nPageSize = rStrm.GetIo().GetPhysPageSize(); @@ -67,7 +67,7 @@ StgFAT::StgFAT( StgStrm& r, BOOL m ) : rStrm( r ) // Retrieve the physical page for a given byte offset. -StgPage* StgFAT::GetPhysPage( INT32 nByteOff ) +StgPage* StgFAT::GetPhysPage( sal_Int32 nByteOff ) { StgPage* pPg = NULL; // Position within the underlying stream @@ -75,16 +75,16 @@ StgPage* StgFAT::GetPhysPage( INT32 nByteOff ) if( rStrm.Pos2Page( nByteOff ) ) { nOffset = rStrm.GetOffset(); - INT32 nPhysPage = rStrm.GetPage(); + sal_Int32 nPhysPage = rStrm.GetPage(); // get the physical page (must be present) - pPg = rStrm.GetIo().Get( nPhysPage, TRUE ); + pPg = rStrm.GetIo().Get( nPhysPage, sal_True ); } return pPg; } // Get the follow page for a certain FAT page. -INT32 StgFAT::GetNextPage( INT32 nPg ) +sal_Int32 StgFAT::GetNextPage( sal_Int32 nPg ) { if( nPg >= 0 ) { @@ -100,16 +100,16 @@ INT32 StgFAT::GetNextPage( INT32 nPg ) // underlying stream size. It is treated as a recommendation // to abort the search to inhibit excessive file growth. -INT32 StgFAT::FindBlock( INT32& nPgs ) +sal_Int32 StgFAT::FindBlock( sal_Int32& nPgs ) { - INT32 nMinStart = STG_EOF, nMinLen = 0; - INT32 nMaxStart = STG_EOF, nMaxLen = 0x7FFFFFFFL; - INT32 nTmpStart = STG_EOF, nTmpLen = 0; - INT32 nPages = rStrm.GetSize() >> 2; - BOOL bFound = FALSE; + sal_Int32 nMinStart = STG_EOF, nMinLen = 0; + sal_Int32 nMaxStart = STG_EOF, nMaxLen = 0x7FFFFFFFL; + sal_Int32 nTmpStart = STG_EOF, nTmpLen = 0; + sal_Int32 nPages = rStrm.GetSize() >> 2; + sal_Bool bFound = sal_False; StgPage* pPg = NULL; short nEntry = 0; - for( INT32 i = 0; i < nPages; i++, nEntry++ ) + for( sal_Int32 i = 0; i < nPages; i++, nEntry++ ) { if( !( nEntry % nEntries ) ) { @@ -119,7 +119,7 @@ INT32 StgFAT::FindBlock( INT32& nPgs ) if( !pPg ) return STG_EOF; } - INT32 nCur = pPg->GetPage( nEntry ); + sal_Int32 nCur = pPg->GetPage( nEntry ); if( nCur == STG_FREE ) { // count the size of this area @@ -137,12 +137,12 @@ INT32 StgFAT::FindBlock( INT32& nPgs ) { if( nTmpLen > nPgs && nTmpLen < nMaxLen ) // block > requested size - nMaxLen = nTmpLen, nMaxStart = nTmpStart, bFound = TRUE; + nMaxLen = nTmpLen, nMaxStart = nTmpStart, bFound = sal_True; else if( nTmpLen >= nMinLen ) { // block < requested size nMinLen = nTmpLen, nMinStart = nTmpStart; - bFound = TRUE; + bFound = sal_True; if( nTmpLen == nPgs ) break; } @@ -163,8 +163,8 @@ INT32 StgFAT::FindBlock( INT32& nPgs ) if( nMinStart != STG_EOF && nMaxStart != STG_EOF ) { // two areas found; return the best fit area - INT32 nMinDiff = nPgs - nMinLen; - INT32 nMaxDiff = nMaxLen - nPgs; + sal_Int32 nMinDiff = nPgs - nMinLen; + sal_Int32 nMaxDiff = nMaxLen - nPgs; if( nMinDiff > nMaxDiff ) nMinStart = STG_EOF; } @@ -180,19 +180,19 @@ INT32 StgFAT::FindBlock( INT32& nPgs ) // Set up the consecutive chain for a given block. -BOOL StgFAT::MakeChain( INT32 nStart, INT32 nPgs ) +sal_Bool StgFAT::MakeChain( sal_Int32 nStart, sal_Int32 nPgs ) { - INT32 nPos = nStart << 2; + sal_Int32 nPos = nStart << 2; StgPage* pPg = GetPhysPage( nPos ); if( !pPg || !nPgs ) - return FALSE; + return sal_False; while( --nPgs ) { if( nOffset >= nPageSize ) { pPg = GetPhysPage( nPos ); if( !pPg ) - return FALSE; + return sal_False; } pPg->SetPage( nOffset >> 2, ++nStart ); nOffset += 4; @@ -202,22 +202,22 @@ BOOL StgFAT::MakeChain( INT32 nStart, INT32 nPgs ) { pPg = GetPhysPage( nPos ); if( !pPg ) - return FALSE; + return sal_False; } pPg->SetPage( nOffset >> 2, STG_EOF ); - return TRUE; + return sal_True; } // Allocate a block of data from the given page number on. // It the page number is != STG_EOF, chain the block. -INT32 StgFAT::AllocPages( INT32 nBgn, INT32 nPgs ) +sal_Int32 StgFAT::AllocPages( sal_Int32 nBgn, sal_Int32 nPgs ) { - INT32 nOrig = nBgn; - INT32 nLast = nBgn; - INT32 nBegin = STG_EOF; - INT32 nAlloc; - INT32 nPages = rStrm.GetSize() >> 2; + sal_Int32 nOrig = nBgn; + sal_Int32 nLast = nBgn; + sal_Int32 nBegin = STG_EOF; + sal_Int32 nAlloc; + sal_Int32 nPages = rStrm.GetSize() >> 2; short nPasses = 0; // allow for two passes while( nPasses < 2 ) @@ -253,7 +253,7 @@ INT32 StgFAT::AllocPages( INT32 nBgn, INT32 nPgs ) if( !rStrm.SetSize( ( nPages + nPgs ) << 2 ) ) return STG_EOF; if( !bPhys && !InitNew( nPages ) ) - return FALSE; + return sal_False; nPages = rStrm.GetSize() >> 2; nPasses++; } @@ -273,9 +273,9 @@ INT32 StgFAT::AllocPages( INT32 nBgn, INT32 nPgs ) // It can be assumed that the stream size is always on // a page boundary -BOOL StgFAT::InitNew( INT32 nPage1 ) +sal_Bool StgFAT::InitNew( sal_Int32 nPage1 ) { - INT32 n = ( ( rStrm.GetSize() >> 2 ) - nPage1 ) / nEntries; + sal_Int32 n = ( ( rStrm.GetSize() >> 2 ) - nPage1 ) / nEntries; while( n-- ) { StgPage* pPg = NULL; @@ -285,29 +285,29 @@ BOOL StgFAT::InitNew( INT32 nPage1 ) // Initialize the page pPg = rStrm.GetIo().Copy( rStrm.GetPage(), STG_FREE ); if ( !pPg ) - return FALSE; + return sal_False; for( short i = 0; i < nEntries; i++ ) pPg->SetPage( i, STG_FREE ); nPage1++; } - return TRUE; + return sal_True; } // Release a chain -BOOL StgFAT::FreePages( INT32 nStart, BOOL bAll ) +sal_Bool StgFAT::FreePages( sal_Int32 nStart, sal_Bool bAll ) { while( nStart >= 0 ) { StgPage* pPg = GetPhysPage( nStart << 2 ); if( !pPg ) - return FALSE; + return sal_False; nStart = pPg->GetPage( nOffset >> 2 ); // The first released page is either set to EOF or FREE pPg->SetPage( nOffset >> 2, bAll ? STG_FREE : STG_EOF ); - bAll = TRUE; + bAll = sal_True; } - return TRUE; + return sal_True; } ///////////////////////////// class StgStrm //////////////////////////////// @@ -345,21 +345,21 @@ void StgStrm::SetEntry( StgDirEntry& r ) // If the position is behind the size, set the stream right // behind the EOF. -BOOL StgStrm::Pos2Page( INT32 nBytePos ) +sal_Bool StgStrm::Pos2Page( sal_Int32 nBytePos ) { - INT32 nRel, nBgn; + sal_Int32 nRel, nBgn; // Values < 0 seek to the end if( nBytePos < 0 || nBytePos >= nSize ) nBytePos = nSize; // Adjust the position back to offset 0 nPos -= nOffset; - INT32 nMask = ~( nPageSize - 1 ); - INT32 nOld = nPos & nMask; - INT32 nNew = nBytePos & nMask; + sal_Int32 nMask = ~( nPageSize - 1 ); + sal_Int32 nOld = nPos & nMask; + sal_Int32 nNew = nBytePos & nMask; nOffset = (short) ( nBytePos & ~nMask ); nPos = nBytePos; if( nOld == nNew ) - return TRUE; + return sal_True; if( nNew > nOld ) { // the new position is behind the current, so an incremental @@ -376,7 +376,7 @@ BOOL StgStrm::Pos2Page( INT32 nBytePos ) } // now, traverse the FAT chain. nRel /= nPageSize; - INT32 nLast = STG_EOF; + sal_Int32 nLast = STG_EOF; while( nRel && nBgn >= 0 ) { nLast = nBgn; @@ -394,12 +394,12 @@ BOOL StgStrm::Pos2Page( INT32 nBytePos ) nOffset = nPageSize; } nPage = nBgn; - return BOOL( nRel == 0 && nPage >= 0 ); + return sal_Bool( nRel == 0 && nPage >= 0 ); } // Retrieve the physical page for a given byte offset. -StgPage* StgStrm::GetPhysPage( INT32 nBytePos, BOOL bForce ) +StgPage* StgStrm::GetPhysPage( sal_Int32 nBytePos, sal_Bool bForce ) { if( !Pos2Page( nBytePos ) ) return NULL; @@ -409,16 +409,16 @@ StgPage* StgStrm::GetPhysPage( INT32 nBytePos, BOOL bForce ) // Copy an entire stream. Both streams are allocated in the FAT. // The target stream is this stream. -BOOL StgStrm::Copy( INT32 nFrom, INT32 nBytes ) +sal_Bool StgStrm::Copy( sal_Int32 nFrom, sal_Int32 nBytes ) { - INT32 nTo = nStart; - INT32 nPgs = ( nBytes + nPageSize - 1 ) / nPageSize; + sal_Int32 nTo = nStart; + sal_Int32 nPgs = ( nBytes + nPageSize - 1 ) / nPageSize; while( nPgs-- ) { if( nTo < 0 ) { rIo.SetError( SVSTREAM_FILEFORMAT_ERROR ); - return FALSE; + return sal_False; } rIo.Copy( nTo, nFrom ); if( nFrom >= 0 ) @@ -427,34 +427,34 @@ BOOL StgStrm::Copy( INT32 nFrom, INT32 nBytes ) if( nFrom < 0 ) { rIo.SetError( SVSTREAM_FILEFORMAT_ERROR ); - return FALSE; + return sal_False; } } nTo = pFat->GetNextPage( nTo ); } - return TRUE; + return sal_True; } -BOOL StgStrm::SetSize( INT32 nBytes ) +sal_Bool StgStrm::SetSize( sal_Int32 nBytes ) { // round up to page size - INT32 nOld = ( ( nSize + nPageSize - 1 ) / nPageSize ) * nPageSize; - INT32 nNew = ( ( nBytes + nPageSize - 1 ) / nPageSize ) * nPageSize; + sal_Int32 nOld = ( ( nSize + nPageSize - 1 ) / nPageSize ) * nPageSize; + sal_Int32 nNew = ( ( nBytes + nPageSize - 1 ) / nPageSize ) * nPageSize; if( nNew > nOld ) { if( !Pos2Page( nSize ) ) - return FALSE; - INT32 nBgn = pFat->AllocPages( nPage, ( nNew - nOld ) / nPageSize ); + return sal_False; + sal_Int32 nBgn = pFat->AllocPages( nPage, ( nNew - nOld ) / nPageSize ); if( nBgn == STG_EOF ) - return FALSE; + return sal_False; if( nStart == STG_EOF ) nStart = nPage = nBgn; } else if( nNew < nOld ) { - BOOL bAll = BOOL( nBytes == 0 ); + sal_Bool bAll = sal_Bool( nBytes == 0 ); if( !Pos2Page( nBytes ) || !pFat->FreePages( nPage, bAll ) ) - return FALSE; + return sal_False; if( bAll ) nStart = nPage = STG_EOF; } @@ -468,12 +468,12 @@ BOOL StgStrm::SetSize( INT32 nBytes ) } nSize = nBytes; pFat->SetLimit( GetPages() ); - return TRUE; + return sal_True; } // Return the # of allocated pages -INT32 StgStrm::GetPages() +sal_Int32 StgStrm::GetPages() { return ( nSize + nPageSize - 1 ) / nPageSize; } @@ -486,11 +486,11 @@ INT32 StgStrm::GetPages() StgFATStrm::StgFATStrm( StgIo& r ) : StgStrm( r ) { - pFat = new StgFAT( *this, TRUE ); + pFat = new StgFAT( *this, sal_True ); nSize = rIo.aHdr.GetFATSize() * nPageSize; } -BOOL StgFATStrm::Pos2Page( INT32 nBytePos ) +sal_Bool StgFATStrm::Pos2Page( sal_Int32 nBytePos ) { // Values < 0 seek to the end if( nBytePos < 0 || nBytePos >= nSize ) @@ -498,38 +498,38 @@ BOOL StgFATStrm::Pos2Page( INT32 nBytePos ) nPage = nBytePos / nPageSize; nOffset = (short) ( nBytePos % nPageSize ); nPos = nBytePos; - nPage = GetPage( (short) nPage, FALSE ); - return BOOL( nPage >= 0 ); + nPage = GetPage( (short) nPage, sal_False ); + return sal_Bool( nPage >= 0 ); } // Retrieve the physical page for a given byte offset. // Since Pos2Page() already has computed the physical offset, // use the byte offset directly. -StgPage* StgFATStrm::GetPhysPage( INT32 nBytePos, BOOL bForce ) +StgPage* StgFATStrm::GetPhysPage( sal_Int32 nBytePos, sal_Bool bForce ) { return rIo.Get( nBytePos / ( nPageSize >> 2 ), bForce ); } // Get the page number entry for the given page offset. -INT32 StgFATStrm::GetPage( short nOff, BOOL bMake, USHORT *pnMasterAlloc ) +sal_Int32 StgFATStrm::GetPage( short nOff, sal_Bool bMake, sal_uInt16 *pnMasterAlloc ) { if( pnMasterAlloc ) *pnMasterAlloc = 0; if( nOff < rIo.aHdr.GetFAT1Size() ) return rIo.aHdr.GetFATPage( nOff ); - INT32 nMaxPage = nSize >> 2; + sal_Int32 nMaxPage = nSize >> 2; nOff = nOff - rIo.aHdr.GetFAT1Size(); // Anzahl der Masterpages, durch die wir iterieren muessen - USHORT nMasterCount = ( nPageSize >> 2 ) - 1; - USHORT nBlocks = nOff / nMasterCount; + sal_uInt16 nMasterCount = ( nPageSize >> 2 ) - 1; + sal_uInt16 nBlocks = nOff / nMasterCount; // Offset in letzter Masterpage nOff = nOff % nMasterCount; StgPage* pOldPage = 0; StgPage* pMaster = 0; - INT32 nFAT = rIo.aHdr.GetFATChain(); - for( USHORT nCount = 0; nCount <= nBlocks; nCount++ ) + sal_Int32 nFAT = rIo.aHdr.GetFATChain(); + for( sal_uInt16 nCount = 0; nCount <= nBlocks; nCount++ ) { if( nFAT == STG_EOF || nFAT == STG_FREE ) { @@ -556,7 +556,7 @@ INT32 StgFATStrm::GetPage( short nOff, BOOL bMake, USHORT *pnMasterAlloc ) { if( !Pos2Page( nFAT << 2 ) ) return STG_EOF; - StgPage* pPg = rIo.Get( nPage, TRUE ); + StgPage* pPg = rIo.Get( nPage, sal_True ); if( !pPg ) return STG_EOF; pPg->SetPage( nOffset >> 2, STG_MASTER ); @@ -570,7 +570,7 @@ INT32 StgFATStrm::GetPage( short nOff, BOOL bMake, USHORT *pnMasterAlloc ) } else { - pMaster = rIo.Get( nFAT, TRUE ); + pMaster = rIo.Get( nFAT, sal_True ); if ( pMaster ) { nFAT = pMaster->GetPage( nMasterCount ); @@ -587,30 +587,30 @@ INT32 StgFATStrm::GetPage( short nOff, BOOL bMake, USHORT *pnMasterAlloc ) // Set the page number entry for the given page offset. -BOOL StgFATStrm::SetPage( short nOff, INT32 nNewPage ) +sal_Bool StgFATStrm::SetPage( short nOff, sal_Int32 nNewPage ) { - BOOL bRes = TRUE; + sal_Bool bRes = sal_True; if( nOff < rIo.aHdr.GetFAT1Size() ) rIo.aHdr.SetFATPage( nOff, nNewPage ); else { nOff = nOff - rIo.aHdr.GetFAT1Size(); // Anzahl der Masterpages, durch die wir iterieren muessen - USHORT nMasterCount = ( nPageSize >> 2 ) - 1; - USHORT nBlocks = nOff / nMasterCount; + sal_uInt16 nMasterCount = ( nPageSize >> 2 ) - 1; + sal_uInt16 nBlocks = nOff / nMasterCount; // Offset in letzter Masterpage nOff = nOff % nMasterCount; StgPage* pMaster = 0; - INT32 nFAT = rIo.aHdr.GetFATChain(); - for( USHORT nCount = 0; nCount <= nBlocks; nCount++ ) + sal_Int32 nFAT = rIo.aHdr.GetFATChain(); + for( sal_uInt16 nCount = 0; nCount <= nBlocks; nCount++ ) { if( nFAT == STG_EOF || nFAT == STG_FREE ) { pMaster = 0; break; } - pMaster = rIo.Get( nFAT, TRUE ); + pMaster = rIo.Get( nFAT, sal_True ); if ( pMaster ) nFAT = pMaster->GetPage( nMasterCount ); } @@ -619,7 +619,7 @@ BOOL StgFATStrm::SetPage( short nOff, INT32 nNewPage ) else { rIo.SetError( SVSTREAM_GENERALERROR ); - bRes = FALSE; + bRes = sal_False; } } @@ -627,16 +627,16 @@ BOOL StgFATStrm::SetPage( short nOff, INT32 nNewPage ) if( bRes ) { Pos2Page( nNewPage << 2 ); - StgPage* pPg = rIo.Get( nPage, TRUE ); + StgPage* pPg = rIo.Get( nPage, sal_True ); if( pPg ) pPg->SetPage( nOffset >> 2, STG_FAT ); else - bRes = FALSE; + bRes = sal_False; } return bRes; } -BOOL StgFATStrm::SetSize( INT32 nBytes ) +sal_Bool StgFATStrm::SetSize( sal_Int32 nBytes ) { // Set the number of entries to a multiple of the page size short nOld = (short) ( ( nSize + ( nPageSize - 1 ) ) / nPageSize ); @@ -654,17 +654,17 @@ BOOL StgFATStrm::SetSize( INT32 nBytes ) { // allocate master pages // find a free master page slot - INT32 nPg = 0; - USHORT nMasterAlloc = 0; - nPg = GetPage( nOld, TRUE, &nMasterAlloc ); + sal_Int32 nPg = 0; + sal_uInt16 nMasterAlloc = 0; + nPg = GetPage( nOld, sal_True, &nMasterAlloc ); if( nPg == STG_EOF ) - return FALSE; + return sal_False; // 4 Bytes have been used for Allocation of each MegaMasterPage nBytes += nMasterAlloc << 2; // find a free page using the FAT allocator - INT32 n = 1; - INT32 nNewPage = pFat->FindBlock( n ); + sal_Int32 n = 1; + sal_Int32 nNewPage = pFat->FindBlock( n ); if( nNewPage == STG_EOF ) { // no free pages found; create a new page @@ -677,12 +677,12 @@ BOOL StgFATStrm::SetSize( INT32 nBytes ) // adjust the file size if necessary if( nNewPage >= rIo.GetPhysPages() ) if( !rIo.SetSize( nNewPage + 1 ) ) - return FALSE; + return sal_False; } // Set up the page with empty entries StgPage* pPg = rIo.Copy( nNewPage, STG_FREE ); if ( !pPg ) - return FALSE; + return sal_False; for( short j = 0; j < ( nPageSize >> 2 ); j++ ) pPg->SetPage( j, STG_FREE ); @@ -693,22 +693,22 @@ BOOL StgFATStrm::SetSize( INT32 nBytes ) // MegaMasterPages were created, mark it them as used - UINT32 nMax = rIo.aHdr.GetMasters( ); - UINT32 nFAT = rIo.aHdr.GetFATChain(); + sal_uInt32 nMax = rIo.aHdr.GetMasters( ); + sal_uInt32 nFAT = rIo.aHdr.GetFATChain(); if( nMasterAlloc ) - for( USHORT nCount = 0; nCount < nMax; nCount++ ) + for( sal_uInt16 nCount = 0; nCount < nMax; nCount++ ) { if( !Pos2Page( nFAT << 2 ) ) - return FALSE; + return sal_False; if( nMax - nCount <= nMasterAlloc ) { - StgPage* piPg = rIo.Get( nPage, TRUE ); + StgPage* piPg = rIo.Get( nPage, sal_True ); if( !piPg ) - return FALSE; + return sal_False; piPg->SetPage( nOffset >> 2, STG_MASTER ); } - StgPage* pPage = rIo.Get( nFAT, TRUE ); - if( !pPage ) return FALSE; + StgPage* pPage = rIo.Get( nFAT, sal_True ); + if( !pPage ) return sal_False; nFAT = pPage->GetPage( (nPageSize >> 2 ) - 1 ); } @@ -721,7 +721,7 @@ BOOL StgFATStrm::SetSize( INT32 nBytes ) } nSize = nNew * nPageSize; rIo.aHdr.SetFATSize( nNew ); - return TRUE; + return sal_True; } /////////////////////////// class StgDataStrm ////////////////////////////// @@ -731,7 +731,7 @@ BOOL StgFATStrm::SetSize( INT32 nBytes ) // The stream has a size increment which normally is 1, but which can be // set to any value is you want the size to be incremented by certain values. -StgDataStrm::StgDataStrm( StgIo& r, INT32 nBgn, INT32 nLen ) : StgStrm( r ) +StgDataStrm::StgDataStrm( StgIo& r, sal_Int32 nBgn, sal_Int32 nLen ) : StgStrm( r ) { Init( nBgn, nLen ); } @@ -743,9 +743,9 @@ StgDataStrm::StgDataStrm( StgIo& r, StgDirEntry* p ) : StgStrm( r ) p->aEntry.GetSize() ); } -void StgDataStrm::Init( INT32 nBgn, INT32 nLen ) +void StgDataStrm::Init( sal_Int32 nBgn, sal_Int32 nLen ) { - pFat = new StgFAT( *rIo.pFAT, TRUE ); + pFat = new StgFAT( *rIo.pFAT, sal_True ); nStart = nPage = nBgn; nSize = nLen; nIncr = 1; @@ -755,7 +755,7 @@ void StgDataStrm::Init( INT32 nBgn, INT32 nLen ) // determine the actual size of the stream by scanning // the FAT chain and counting the # of pages allocated nSize = 0; - INT32 nOldBgn = -1; + sal_Int32 nOldBgn = -1; while( nBgn >= 0 && nBgn != nOldBgn ) { nOldBgn = nBgn; @@ -769,18 +769,18 @@ void StgDataStrm::Init( INT32 nBgn, INT32 nLen ) // Set the size of a physical stream. -BOOL StgDataStrm::SetSize( INT32 nBytes ) +sal_Bool StgDataStrm::SetSize( sal_Int32 nBytes ) { nBytes = ( ( nBytes + nIncr - 1 ) / nIncr ) * nIncr; - INT32 nOldSz = nSize; + sal_Int32 nOldSz = nSize; if( ( nOldSz != nBytes ) ) { if( !StgStrm::SetSize( nBytes ) ) - return FALSE; - INT32 nMaxPage = pFat->GetMaxPage(); + return sal_False; + sal_Int32 nMaxPage = pFat->GetMaxPage(); if( nMaxPage > rIo.GetPhysPages() ) if( !rIo.SetSize( nMaxPage ) ) - return FALSE; + return sal_False; // If we only allocated one page or less, create this // page in the cache for faster throughput. The current // position is the former EOF point. @@ -791,14 +791,14 @@ BOOL StgDataStrm::SetSize( INT32 nBytes ) rIo.Copy( nPage, STG_FREE ); } } - return TRUE; + return sal_True; } // Get the address of the data byte at a specified offset. -// If bForce = TRUE, a read of non-existent data causes +// If bForce = sal_True, a read of non-existent data causes // a read fault. -void* StgDataStrm::GetPtr( INT32 Pos, BOOL bForce, BOOL bDirty ) +void* StgDataStrm::GetPtr( sal_Int32 Pos, sal_Bool bForce, sal_Bool bDirty ) { if( Pos2Page( Pos ) ) { @@ -808,7 +808,7 @@ void* StgDataStrm::GetPtr( INT32 Pos, BOOL bForce, BOOL bDirty ) pPg->SetOwner( pEntry ); if( bDirty ) pPg->SetDirty(); - return ((BYTE *)pPg->GetData()) + nOffset; + return ((sal_uInt8 *)pPg->GetData()) + nOffset; } } return NULL; @@ -818,24 +818,24 @@ void* StgDataStrm::GetPtr( INT32 Pos, BOOL bForce, BOOL bDirty ) // the amount of consecutable blocks before doing a read. The result // is the number of bytes read. No error is generated on EOF. -INT32 StgDataStrm::Read( void* pBuf, INT32 n ) +sal_Int32 StgDataStrm::Read( void* pBuf, sal_Int32 n ) { if ( n < 0 ) return 0; if( ( nPos + n ) > nSize ) n = nSize - nPos; - INT32 nDone = 0; + sal_Int32 nDone = 0; while( n ) { short nBytes = nPageSize - nOffset; short nRes; StgPage* pPg; - if( (INT32) nBytes > n ) + if( (sal_Int32) nBytes > n ) nBytes = (short) n; if( nBytes ) { - void *p = (BYTE *) pBuf + nDone; + void *p = (sal_uInt8 *) pBuf + nDone; if( nBytes == nPageSize ) { pPg = rIo.Find( nPage ); @@ -853,11 +853,11 @@ INT32 StgDataStrm::Read( void* pBuf, INT32 n ) else { // partial block read thru the cache. - pPg = rIo.Get( nPage, FALSE ); + pPg = rIo.Get( nPage, sal_False ); if( !pPg ) break; pPg->SetOwner( pEntry ); - memcpy( p, (BYTE*)pPg->GetData() + nOffset, nBytes ); + memcpy( p, (sal_uInt8*)pPg->GetData() + nOffset, nBytes ); nRes = nBytes; } nDone += nRes; @@ -874,14 +874,14 @@ INT32 StgDataStrm::Read( void* pBuf, INT32 n ) return nDone; } -INT32 StgDataStrm::Write( const void* pBuf, INT32 n ) +sal_Int32 StgDataStrm::Write( const void* pBuf, sal_Int32 n ) { - INT32 nDone = 0; + sal_Int32 nDone = 0; if( ( nPos + n ) > nSize ) { - INT32 nOld = nPos; + sal_Int32 nOld = nPos; if( !SetSize( nPos + n ) ) - return FALSE; + return sal_False; Pos2Page( nOld ); } while( n ) @@ -889,11 +889,11 @@ INT32 StgDataStrm::Write( const void* pBuf, INT32 n ) short nBytes = nPageSize - nOffset; short nRes; StgPage* pPg; - if( (INT32) nBytes > n ) + if( (sal_Int32) nBytes > n ) nBytes = (short) n; if( nBytes ) { - const void *p = (const BYTE *) pBuf + nDone; + const void *p = (const sal_uInt8 *) pBuf + nDone; if( nBytes == nPageSize ) { pPg = rIo.Find( nPage ); @@ -912,11 +912,11 @@ INT32 StgDataStrm::Write( const void* pBuf, INT32 n ) else { // partial block read thru the cache. - pPg = rIo.Get( nPage, FALSE ); + pPg = rIo.Get( nPage, sal_False ); if( !pPg ) break; pPg->SetOwner( pEntry ); - memcpy( (BYTE*)pPg->GetData() + nOffset, p, nBytes ); + memcpy( (sal_uInt8*)pPg->GetData() + nOffset, p, nBytes ); pPg->SetDirty(); nRes = nBytes; } @@ -941,7 +941,7 @@ INT32 StgDataStrm::Write( const void* pBuf, INT32 n ) // is also a StgStream. The start of the FAT is in the header at DataRootPage, // the stream itself is pointed to by the root entry (it holds start & size). -StgSmallStrm::StgSmallStrm( StgIo& r, INT32 nBgn, INT32 nLen ) : StgStrm( r ) +StgSmallStrm::StgSmallStrm( StgIo& r, sal_Int32 nBgn, sal_Int32 nLen ) : StgStrm( r ) { Init( nBgn, nLen ); } @@ -953,9 +953,9 @@ StgSmallStrm::StgSmallStrm( StgIo& r, StgDirEntry* p ) : StgStrm( r ) p->aEntry.GetSize() ); } -void StgSmallStrm::Init( INT32 nBgn, INT32 nLen ) +void StgSmallStrm::Init( sal_Int32 nBgn, sal_Int32 nLen ) { - pFat = new StgFAT( *rIo.pDataFAT, FALSE ); + pFat = new StgFAT( *rIo.pDataFAT, sal_False ); pData = rIo.pDataStrm; nPageSize = rIo.GetDataPageSize(); nStart = @@ -967,7 +967,7 @@ void StgSmallStrm::Init( INT32 nBgn, INT32 nLen ) // the amount of consecutable blocks before doing a read. The result // is the number of bytes read. No error is generated on EOF. -INT32 StgSmallStrm::Read( void* pBuf, INT32 n ) +sal_Int32 StgSmallStrm::Read( void* pBuf, sal_Int32 n ) { // We can safely assume that reads are not huge, since the // small stream is likely to be < 64 KBytes. @@ -977,14 +977,14 @@ INT32 StgSmallStrm::Read( void* pBuf, INT32 n ) while( n ) { short nBytes = nPageSize - nOffset; - if( (INT32) nBytes > n ) + if( (sal_Int32) nBytes > n ) nBytes = (short) n; if( nBytes ) { if( !pData->Pos2Page( nPage * nPageSize + nOffset ) ) break; // all reading thru the stream - short nRes = (short) pData->Read( (BYTE*)pBuf + nDone, nBytes ); + short nRes = (short) pData->Read( (sal_uInt8*)pBuf + nDone, nBytes ); nDone = nDone + nRes; nPos += nRes; n -= nRes; @@ -1000,33 +1000,33 @@ INT32 StgSmallStrm::Read( void* pBuf, INT32 n ) return nDone; } -INT32 StgSmallStrm::Write( const void* pBuf, INT32 n ) +sal_Int32 StgSmallStrm::Write( const void* pBuf, sal_Int32 n ) { // you can safely assume that reads are not huge, since the // small stream is likely to be < 64 KBytes. short nDone = 0; if( ( nPos + n ) > nSize ) { - INT32 nOld = nPos; + sal_Int32 nOld = nPos; if( !SetSize( nPos + n ) ) - return FALSE; + return sal_False; Pos2Page( nOld ); } while( n ) { short nBytes = nPageSize - nOffset; - if( (INT32) nBytes > n ) + if( (sal_Int32) nBytes > n ) nBytes = (short) n; if( nBytes ) { // all writing goes thru the stream - INT32 nDataPos = nPage * nPageSize + nOffset; + sal_Int32 nDataPos = nPage * nPageSize + nOffset; if( pData->GetSize() < ( nDataPos + nBytes ) ) if( !pData->SetSize( nDataPos + nBytes ) ) break; if( !pData->Pos2Page( nDataPos ) ) break; - short nRes = (short) pData->Write( (BYTE*)pBuf + nDone, nBytes ); + short nRes = (short) pData->Write( (sal_uInt8*)pBuf + nDone, nBytes ); nDone = nDone + nRes; nPos += nRes; n -= nRes; @@ -1049,7 +1049,7 @@ INT32 StgSmallStrm::Write( const void* pBuf, INT32 n ) #define THRESHOLD 32768L -StgTmpStrm::StgTmpStrm( ULONG nInitSize ) +StgTmpStrm::StgTmpStrm( sal_uIntPtr nInitSize ) : SvMemoryStream( nInitSize > THRESHOLD ? 16 : ( nInitSize ? nInitSize : 16 ), 4096 ) @@ -1061,19 +1061,19 @@ StgTmpStrm::StgTmpStrm( ULONG nInitSize ) SetSize( nInitSize ); } -BOOL StgTmpStrm::Copy( StgTmpStrm& rSrc ) +sal_Bool StgTmpStrm::Copy( StgTmpStrm& rSrc ) { - ULONG n = rSrc.GetSize(); - ULONG nCur = rSrc.Tell(); + sal_uIntPtr n = rSrc.GetSize(); + sal_uIntPtr nCur = rSrc.Tell(); SetSize( n ); if( GetError() == SVSTREAM_OK ) { - BYTE* p = new BYTE[ 4096 ]; + sal_uInt8* p = new sal_uInt8[ 4096 ]; rSrc.Seek( 0L ); Seek( 0L ); while( n ) { - ULONG nn = n; + sal_uIntPtr nn = n; if( nn > 4096 ) nn = 4096; if( rSrc.Read( p, nn ) != nn ) @@ -1085,10 +1085,10 @@ BOOL StgTmpStrm::Copy( StgTmpStrm& rSrc ) delete [] p; rSrc.Seek( nCur ); Seek( nCur ); - return BOOL( n == 0 ); + return sal_Bool( n == 0 ); } else - return FALSE; + return sal_False; } StgTmpStrm::~StgTmpStrm() @@ -1101,12 +1101,12 @@ StgTmpStrm::~StgTmpStrm() } } -ULONG StgTmpStrm::GetSize() const +sal_uIntPtr StgTmpStrm::GetSize() const { - ULONG n; + sal_uIntPtr n; if( pStrm ) { - ULONG old = pStrm->Tell(); + sal_uIntPtr old = pStrm->Tell(); n = pStrm->Seek( STREAM_SEEK_TO_END ); pStrm->Seek( old ); } @@ -1115,7 +1115,7 @@ ULONG StgTmpStrm::GetSize() const return n; } -void StgTmpStrm::SetSize( ULONG n ) +void StgTmpStrm::SetSize( sal_uIntPtr n ) { if( pStrm ) pStrm->SetStreamSize( n ); @@ -1125,15 +1125,15 @@ void StgTmpStrm::SetSize( ULONG n ) { aName = TempFile::CreateTempName(); SvFileStream* s = new SvFileStream( aName, STREAM_READWRITE ); - ULONG nCur = Tell(); - ULONG i = nEndOfData; + sal_uIntPtr nCur = Tell(); + sal_uIntPtr i = nEndOfData; if( i ) { - BYTE* p = new BYTE[ 4096 ]; + sal_uInt8* p = new sal_uInt8[ 4096 ]; Seek( 0L ); while( i ) { - ULONG nb = ( i > 4096 ) ? 4096 : i; + sal_uIntPtr nb = ( i > 4096 ) ? 4096 : i; if( Read( p, nb ) == nb && s->Write( p, nb ) == nb ) i -= nb; @@ -1169,9 +1169,9 @@ void StgTmpStrm::SetSize( ULONG n ) { if( n > nEndOfData ) { - ULONG nCur = Tell(); + sal_uIntPtr nCur = Tell(); Seek( nEndOfData - 1 ); - *this << (BYTE) 0; + *this << (sal_uInt8) 0; Seek( nCur ); } else @@ -1180,7 +1180,7 @@ void StgTmpStrm::SetSize( ULONG n ) } } -ULONG StgTmpStrm::GetData( void* pData, ULONG n ) +sal_uIntPtr StgTmpStrm::GetData( void* pData, sal_uIntPtr n ) { if( pStrm ) { @@ -1192,10 +1192,10 @@ ULONG StgTmpStrm::GetData( void* pData, ULONG n ) return SvMemoryStream::GetData( (sal_Char *)pData, n ); } -ULONG StgTmpStrm::PutData( const void* pData, ULONG n ) +sal_uIntPtr StgTmpStrm::PutData( const void* pData, sal_uIntPtr n ) { - UINT32 nCur = Tell(); - UINT32 nNew = nCur + n; + sal_uInt32 nCur = Tell(); + sal_uInt32 nNew = nCur + n; if( nNew > THRESHOLD && !pStrm ) { SetSize( nNew ); @@ -1212,7 +1212,7 @@ ULONG StgTmpStrm::PutData( const void* pData, ULONG n ) return nNew; } -ULONG StgTmpStrm::SeekPos( ULONG n ) +sal_uIntPtr StgTmpStrm::SeekPos( sal_uIntPtr n ) { if( n == STREAM_SEEK_TO_END ) n = GetSize(); diff --git a/sot/source/sdstor/stgstrms.hxx b/sot/source/sdstor/stgstrms.hxx index 9b09f51db43f..1ececadae35e 100644 --- a/sot/source/sdstor/stgstrms.hxx +++ b/sot/source/sdstor/stgstrms.hxx @@ -38,29 +38,29 @@ class StgPage; class StgDirEntry; // The FAT class performs FAT operations on an underlying storage stream. -// This stream is either the physical FAT stream (bPhys == TRUE ) or a normal +// This stream is either the physical FAT stream (bPhys == sal_True ) or a normal // storage stream, which then holds the FAT for small data allocations. class StgFAT { // FAT allocator StgStrm& rStrm; // underlying stream - INT32 nMaxPage; // highest page allocated so far + sal_Int32 nMaxPage; // highest page allocated so far short nPageSize; // physical page size short nEntries; // FAT entries per page short nOffset; // current offset within page - INT32 nLimit; // search limit recommendation - BOOL bPhys; // TRUE: physical FAT - StgPage* GetPhysPage( INT32 nPage ); - BOOL MakeChain( INT32 nStart, INT32 nPages ); - BOOL InitNew( INT32 nPage1 ); + sal_Int32 nLimit; // search limit recommendation + sal_Bool bPhys; // sal_True: physical FAT + StgPage* GetPhysPage( sal_Int32 nPage ); + sal_Bool MakeChain( sal_Int32 nStart, sal_Int32 nPages ); + sal_Bool InitNew( sal_Int32 nPage1 ); public: - StgFAT( StgStrm& rStrm, BOOL bMark ); - INT32 FindBlock( INT32& nPages ); - INT32 GetNextPage( INT32 nPg ); - INT32 AllocPages( INT32 nStart, INT32 nPages ); - BOOL FreePages( INT32 nStart, BOOL bAll ); - INT32 GetMaxPage() { return nMaxPage; } - void SetLimit( INT32 n ) { nLimit = n; } + StgFAT( StgStrm& rStrm, sal_Bool bMark ); + sal_Int32 FindBlock( sal_Int32& nPages ); + sal_Int32 GetNextPage( sal_Int32 nPg ); + sal_Int32 AllocPages( sal_Int32 nStart, sal_Int32 nPages ); + sal_Bool FreePages( sal_Int32 nStart, sal_Bool bAll ); + sal_Int32 GetMaxPage() { return nMaxPage; } + void SetLimit( sal_Int32 n ) { nLimit = n; } }; // The base stream class provides basic functionality for seeking @@ -72,31 +72,31 @@ protected: StgIo& rIo; // I/O system StgFAT* pFat; // FAT stream for allocations StgDirEntry* pEntry; // dir entry (for ownership) - INT32 nStart; // 1st data page - INT32 nSize; // stream size in bytes - INT32 nPos; // current byte position - INT32 nPage; // current logical page + sal_Int32 nStart; // 1st data page + sal_Int32 nSize; // stream size in bytes + sal_Int32 nPos; // current byte position + sal_Int32 nPage; // current logical page short nOffset; // offset into current page short nPageSize; // logical page size - BOOL Copy( INT32 nFrom, INT32 nBytes ); + sal_Bool Copy( sal_Int32 nFrom, sal_Int32 nBytes ); StgStrm( StgIo& ); public: virtual ~StgStrm(); StgIo& GetIo() { return rIo; } - INT32 GetPos() { return nPos; } - INT32 GetStart() { return nStart; } - INT32 GetSize() { return nSize; } - INT32 GetPage() { return nPage; } + sal_Int32 GetPos() { return nPos; } + sal_Int32 GetStart() { return nStart; } + sal_Int32 GetSize() { return nSize; } + sal_Int32 GetPage() { return nPage; } short GetPageSize() { return nPageSize; } - INT32 GetPages(); + sal_Int32 GetPages(); short GetOffset() { return nOffset;} void SetEntry( StgDirEntry& ); - virtual BOOL SetSize( INT32 ); - virtual BOOL Pos2Page( INT32 nBytePos ); - virtual INT32 Read( void*, INT32 ) { return 0; } - virtual INT32 Write( const void*, INT32 ) { return 0; } - virtual StgPage* GetPhysPage( INT32 nBytePos, BOOL bForce = FALSE ); - virtual BOOL IsSmallStrm() { return FALSE; } + virtual sal_Bool SetSize( sal_Int32 ); + virtual sal_Bool Pos2Page( sal_Int32 nBytePos ); + virtual sal_Int32 Read( void*, sal_Int32 ) { return 0; } + virtual sal_Int32 Write( const void*, sal_Int32 ) { return 0; } + virtual StgPage* GetPhysPage( sal_Int32 nBytePos, sal_Bool bForce = sal_False ); + virtual sal_Bool IsSmallStrm() { return sal_False; } }; // The FAT stream class provides physical access to the master FAT. @@ -104,15 +104,15 @@ public: // FAT allocator. class StgFATStrm : public StgStrm { // the master FAT stream - virtual BOOL Pos2Page( INT32 nBytePos ); - BOOL SetPage( short, INT32 ); + virtual sal_Bool Pos2Page( sal_Int32 nBytePos ); + sal_Bool SetPage( short, sal_Int32 ); public: StgFATStrm( StgIo& ); virtual ~StgFATStrm() {} using StgStrm::GetPage; - INT32 GetPage( short, BOOL, USHORT *pnMasterAlloc = 0); - virtual BOOL SetSize( INT32 ); - virtual StgPage* GetPhysPage( INT32 nBytePos, BOOL bForce = FALSE ); + sal_Int32 GetPage( short, sal_Bool, sal_uInt16 *pnMasterAlloc = 0); + virtual sal_Bool SetSize( sal_Int32 ); + virtual StgPage* GetPhysPage( sal_Int32 nBytePos, sal_Bool bForce = sal_False ); }; // The stream has a size increment which normally is 1, but which can be @@ -121,15 +121,15 @@ public: class StgDataStrm : public StgStrm // a physical data stream { short nIncr; // size adjust increment - void Init( INT32 nBgn, INT32 nLen ); + void Init( sal_Int32 nBgn, sal_Int32 nLen ); public: - StgDataStrm( StgIo&, INT32 nBgn, INT32 nLen=-1 ); + StgDataStrm( StgIo&, sal_Int32 nBgn, sal_Int32 nLen=-1 ); StgDataStrm( StgIo&, StgDirEntry* ); - void* GetPtr( INT32 nPos, BOOL bForce, BOOL bDirty ); + void* GetPtr( sal_Int32 nPos, sal_Bool bForce, sal_Bool bDirty ); void SetIncrement( short n ) { nIncr = n ; } - virtual BOOL SetSize( INT32 ); - virtual INT32 Read( void*, INT32 ); - virtual INT32 Write( const void*, INT32 ); + virtual sal_Bool SetSize( sal_Int32 ); + virtual sal_Int32 Read( void*, sal_Int32 ); + virtual sal_Int32 Write( const void*, sal_Int32 ); }; // The small stream class provides access to streams with a size < 4096 bytes. @@ -140,13 +140,13 @@ public: class StgSmallStrm : public StgStrm // a logical data stream { StgStrm* pData; // the data stream - void Init( INT32 nBgn, INT32 nLen ); + void Init( sal_Int32 nBgn, sal_Int32 nLen ); public: - StgSmallStrm( StgIo&, INT32 nBgn, INT32 nLen ); + StgSmallStrm( StgIo&, sal_Int32 nBgn, sal_Int32 nLen ); StgSmallStrm( StgIo&, StgDirEntry* ); - virtual INT32 Read( void*, INT32 ); - virtual INT32 Write( const void*, INT32 ); - virtual BOOL IsSmallStrm() { return TRUE; } + virtual sal_Int32 Read( void*, sal_Int32 ); + virtual sal_Int32 Write( const void*, sal_Int32 ); + virtual sal_Bool IsSmallStrm() { return sal_True; } }; class StgTmpStrm : public SvMemoryStream @@ -154,17 +154,17 @@ class StgTmpStrm : public SvMemoryStream String aName; SvFileStream* pStrm; using SvMemoryStream::GetData; - virtual ULONG GetData( void* pData, ULONG nSize ); - virtual ULONG PutData( const void* pData, ULONG nSize ); - virtual ULONG SeekPos( ULONG nPos ); + virtual sal_uIntPtr GetData( void* pData, sal_uIntPtr nSize ); + virtual sal_uIntPtr PutData( const void* pData, sal_uIntPtr nSize ); + virtual sal_uIntPtr SeekPos( sal_uIntPtr nPos ); virtual void FlushData(); public: - StgTmpStrm( ULONG=16 ); + StgTmpStrm( sal_uIntPtr=16 ); ~StgTmpStrm(); - BOOL Copy( StgTmpStrm& ); - void SetSize( ULONG ); - ULONG GetSize() const; + sal_Bool Copy( StgTmpStrm& ); + void SetSize( sal_uIntPtr ); + sal_uIntPtr GetSize() const; }; #endif diff --git a/sot/source/sdstor/storage.cxx b/sot/source/sdstor/storage.cxx index 136abb29a98e..9b5d3a95b92f 100644 --- a/sot/source/sdstor/storage.cxx +++ b/sot/source/sdstor/storage.cxx @@ -75,12 +75,12 @@ SO2_IMPL_BASIC_CLASS1_DLL(SotStorageStream,SotStorageStreamFactory,SotObject, SO2_IMPL_INVARIANT(SotStorageStream) -void SotStorageStream::TestMemberObjRef( BOOL /*bFree*/ ) +void SotStorageStream::TestMemberObjRef( sal_Bool /*bFree*/ ) { } #ifdef TEST_INVARIANT -void SotStorageStream::TestMemberInvariant( BOOL /*bPrint*/ ) +void SotStorageStream::TestMemberInvariant( sal_Bool /*bPrint*/ ) { } #endif @@ -96,12 +96,12 @@ SvLockBytesRef MakeLockBytes_Impl( const String & rName, StreamMode nMode ) if( rName.Len() ) { SvStream * pFileStm = new SvFileStream( rName, nMode ); - xLB = new SvLockBytes( pFileStm, TRUE ); + xLB = new SvLockBytes( pFileStm, sal_True ); } else { SvStream * pCacheStm = new SvCacheStream(); - xLB = new SvLockBytes( pCacheStm, TRUE ); + xLB = new SvLockBytes( pCacheStm, sal_True ); } return xLB; } @@ -116,9 +116,9 @@ SotStorageStream::SotStorageStream( const String & rName, StreamMode nMode, , pOwnStm( NULL ) { if( nMode & STREAM_WRITE ) - bIsWritable = TRUE; + bIsWritable = sal_True; else - bIsWritable = FALSE; + bIsWritable = sal_False; DBG_ASSERT( !nStorageMode,"StorageModes ignored" ); } @@ -128,9 +128,9 @@ SotStorageStream::SotStorageStream( BaseStorageStream * pStm ) if( pStm ) { if( STREAM_WRITE & pStm->GetMode() ) - bIsWritable = TRUE; + bIsWritable = sal_True; else - bIsWritable = FALSE; + bIsWritable = sal_False; pOwnStm = pStm; SetError( pStm->GetError() ); @@ -139,7 +139,7 @@ SotStorageStream::SotStorageStream( BaseStorageStream * pStm ) else { pOwnStm = NULL; - bIsWritable = TRUE; + bIsWritable = sal_True; SetError( SVSTREAM_INVALID_PARAMETER ); } } @@ -148,7 +148,7 @@ SotStorageStream::SotStorageStream() : pOwnStm( NULL ) { // ??? wenn Init virtuell ist, entsprechen setzen - bIsWritable = TRUE; + bIsWritable = sal_True; } /************************************************************************ @@ -170,7 +170,7 @@ SotStorageStream::~SotStorageStream() *************************************************************************/ void SotStorageStream::SyncSvStream() { - ULONG nPos = 0; + sal_uIntPtr nPos = 0; if( pOwnStm ) { pOwnStm->Flush(); @@ -197,9 +197,9 @@ void SotStorageStream::ResetError() |* |* Beschreibung *************************************************************************/ -ULONG SotStorageStream::GetData( void* pData, ULONG nSize ) +sal_uIntPtr SotStorageStream::GetData( void* pData, sal_uIntPtr nSize ) { - ULONG nRet = 0; + sal_uIntPtr nRet = 0; if( pOwnStm ) { @@ -216,9 +216,9 @@ ULONG SotStorageStream::GetData( void* pData, ULONG nSize ) |* |* Beschreibung *************************************************************************/ -ULONG SotStorageStream::PutData( const void* pData, ULONG nSize ) +sal_uIntPtr SotStorageStream::PutData( const void* pData, sal_uIntPtr nSize ) { - ULONG nRet = 0; + sal_uIntPtr nRet = 0; if( pOwnStm ) { @@ -235,9 +235,9 @@ ULONG SotStorageStream::PutData( const void* pData, ULONG nSize ) |* |* Beschreibung *************************************************************************/ -ULONG SotStorageStream::SeekPos( ULONG nPos ) +sal_uIntPtr SotStorageStream::SeekPos( sal_uIntPtr nPos ) { - ULONG nRet = 0; + sal_uIntPtr nRet = 0; if( pOwnStm ) { @@ -270,9 +270,9 @@ void SotStorageStream::FlushData() |* |* Beschreibung *************************************************************************/ -void SotStorageStream::SetSize( ULONG nNewSize ) +void SotStorageStream::SetSize( sal_uIntPtr nNewSize ) { - ULONG nPos = Tell(); + sal_uIntPtr nPos = Tell(); if( pOwnStm ) { pOwnStm->SetSize( nNewSize ); @@ -295,11 +295,11 @@ void SotStorageStream::SetSize( ULONG nNewSize ) |* Beschreibung |* *************************************************************************/ -UINT32 SotStorageStream::GetSize() const +sal_uInt32 SotStorageStream::GetSize() const { - ULONG nPos = Tell(); + sal_uIntPtr nPos = Tell(); ((SotStorageStream *)this)->Seek( STREAM_SEEK_TO_END ); - ULONG nSize = Tell(); + sal_uIntPtr nSize = Tell(); ((SotStorageStream *)this)->Seek( nPos ); return nSize; } @@ -309,19 +309,19 @@ UINT32 SotStorageStream::GetSize() const |* |* Beschreibung *************************************************************************/ -BOOL SotStorageStream::CopyTo( SotStorageStream * pDestStm ) +sal_Bool SotStorageStream::CopyTo( SotStorageStream * pDestStm ) { Flush(); // alle Daten schreiben pDestStm->ClearBuffer(); if( !pOwnStm || !pDestStm->pOwnStm ) { // Wenn Ole2 oder nicht nur eigene StorageStreams - ULONG nPos = Tell(); // Position merken + sal_uIntPtr nPos = Tell(); // Position merken Seek( 0L ); pDestStm->SetSize( 0 ); // Ziel-Stream leeren - void * pMem = new BYTE[ 8192 ]; - ULONG nRead; + void * pMem = new sal_uInt8[ 8192 ]; + sal_uIntPtr nRead; while( 0 != (nRead = Read( pMem, 8192 )) ) { if( nRead != pDestStm->Write( pMem, nRead ) ) @@ -330,7 +330,7 @@ BOOL SotStorageStream::CopyTo( SotStorageStream * pDestStm ) break; } } - delete [] static_cast<BYTE*>(pMem); + delete [] static_cast<sal_uInt8*>(pMem); // Position setzen pDestStm->Seek( nPos ); Seek( nPos ); @@ -361,7 +361,7 @@ BOOL SotStorageStream::CopyTo( SotStorageStream * pDestStm ) |* |* Beschreibung *************************************************************************/ -BOOL SotStorageStream::Commit() +sal_Bool SotStorageStream::Commit() { if( pOwnStm ) { @@ -373,7 +373,7 @@ BOOL SotStorageStream::Commit() return GetError() == SVSTREAM_OK; } -BOOL SotStorageStream::Revert() +sal_Bool SotStorageStream::Revert() { if( !pOwnStm ) { @@ -383,7 +383,7 @@ BOOL SotStorageStream::Revert() return GetError() == SVSTREAM_OK; } -BOOL SotStorageStream::SetProperty( const String& rName, const ::com::sun::star::uno::Any& rValue ) +sal_Bool SotStorageStream::SetProperty( const String& rName, const ::com::sun::star::uno::Any& rValue ) { UCBStorageStream* pStg = PTR_CAST( UCBStorageStream, pOwnStm ); if ( pStg ) @@ -393,11 +393,11 @@ BOOL SotStorageStream::SetProperty( const String& rName, const ::com::sun::star: else { DBG_ERROR("Not implemented!"); - return FALSE; + return sal_False; } } -BOOL SotStorageStream::GetProperty( const String& rName, ::com::sun::star::uno::Any& rValue ) +sal_Bool SotStorageStream::GetProperty( const String& rName, ::com::sun::star::uno::Any& rValue ) { UCBStorageStream* pStg = PTR_CAST( UCBStorageStream, pOwnStm ); if ( pStg ) @@ -407,7 +407,7 @@ BOOL SotStorageStream::GetProperty( const String& rName, ::com::sun::star::uno:: else { DBG_ERROR("Not implemented!"); - return FALSE; + return sal_False; } } @@ -454,12 +454,12 @@ SO2_IMPL_INVARIANT(SotStorage) |* |* Beschreibung *************************************************************************/ -void SotStorage::TestMemberObjRef( BOOL /*bFree*/ ) +void SotStorage::TestMemberObjRef( sal_Bool /*bFree*/ ) { } #ifdef TEST_INVARIANT -void SotStorage::TestMemberInvariant( BOOL /*bPrint*/ ) +void SotStorage::TestMemberInvariant( sal_Bool /*bPrint*/ ) { } #endif @@ -471,7 +471,7 @@ void SotStorage::TestMemberInvariant( BOOL /*bPrint*/ ) |* Beschreibung Es muss ein I... Objekt an SvObject uebergeben |* werden, da es sonst selbst ein IUnknown anlegt und |* festlegt, dass alle weiteren I... Objekte mit -|* delete zerstoert werden (Owner() == TRUE). +|* delete zerstoert werden (Owner() == sal_True). |* Es werden aber nur IStorage Objekte benutzt und nicht |* selbst implementiert, deshalb wird so getan, als ob |* das IStorage Objekt von aussen kam und es wird mit @@ -491,8 +491,8 @@ void SotStorage::TestMemberInvariant( BOOL /*bPrint*/ ) : m_pOwnStg( NULL ) \ , m_pStorStm( NULL ) \ , m_nError( SVSTREAM_OK ) \ - , m_bIsRoot( FALSE ) \ - , m_bDelStm( FALSE ) \ + , m_bIsRoot( sal_False ) \ + , m_bDelStm( sal_False ) \ , m_nVersion( SOFFICE_FILEFORMAT_CURRENT ) SotStorage::SotStorage() @@ -510,7 +510,7 @@ SotStorage::SotStorage( const ::ucbhelper::Content& rContent, const String & rNa INIT_SotStorage() { m_aName = rName; // Namen merken - m_pOwnStg = new UCBStorage( rContent, m_aName, nMode, (nStorageMode & STORAGE_TRANSACTED) ? FALSE : TRUE ); + m_pOwnStg = new UCBStorage( rContent, m_aName, nMode, (nStorageMode & STORAGE_TRANSACTED) ? sal_False : sal_True ); SetError( m_pOwnStg->GetError() ); @@ -524,12 +524,12 @@ SotStorage::SotStorage( const String & rName, StreamMode nMode, StorageMode nSto INIT_SotStorage() { m_aName = rName; // Namen merken - CreateStorage( TRUE, nMode, nStorageMode ); + CreateStorage( sal_True, nMode, nStorageMode ); if ( IsOLEStorage() ) m_nVersion = SOFFICE_FILEFORMAT_50; } -void SotStorage::CreateStorage( BOOL bForceUCBStorage, StreamMode nMode, StorageMode nStorageMode ) +void SotStorage::CreateStorage( sal_Bool bForceUCBStorage, StreamMode nMode, StorageMode nStorageMode ) { DBG_ASSERT( !m_pStorStm && !m_pOwnStg, "Use only in ctor!" ); if( m_aName.Len() ) @@ -555,11 +555,11 @@ void SotStorage::CreateStorage( BOOL bForceUCBStorage, StreamMode nMode, Storage if ( aURL.Len() ) { ::ucbhelper::Content aContent( aURL, ::com::sun::star::uno::Reference < ::com::sun::star::ucb::XCommandEnvironment >() ); - m_pOwnStg = new UCBStorage( aContent, aURL, nMode, FALSE ); + m_pOwnStg = new UCBStorage( aContent, aURL, nMode, sal_False ); } else { - m_pOwnStg = new Storage( m_aName, nMode, (nStorageMode & STORAGE_TRANSACTED) ? FALSE : TRUE ); + m_pOwnStg = new Storage( m_aName, nMode, (nStorageMode & STORAGE_TRANSACTED) ? sal_False : sal_True ); SetError( ERRCODE_IO_NOTSUPPORTED ); } } @@ -573,7 +573,7 @@ void SotStorage::CreateStorage( BOOL bForceUCBStorage, StreamMode nMode, Storage if ( m_pStorStm ) { // try as UCBStorage, next try as OLEStorage - BOOL bIsUCBStorage = UCBStorage::IsStorageFile( m_pStorStm ); + sal_Bool bIsUCBStorage = UCBStorage::IsStorageFile( m_pStorStm ); if ( !bIsUCBStorage && bForceUCBStorage ) // if UCBStorage has priority, it should not be used only if it is really an OLEStorage bIsUCBStorage = !Storage::IsStorageFile( m_pStorStm ); @@ -583,8 +583,8 @@ void SotStorage::CreateStorage( BOOL bForceUCBStorage, StreamMode nMode, Storage if ( UCBStorage::GetLinkedFile( *m_pStorStm ).Len() ) { // detect special unpacked storages - m_pOwnStg = new UCBStorage( *m_pStorStm, (nStorageMode & STORAGE_TRANSACTED) ? FALSE : TRUE ); - m_bDelStm = TRUE; + m_pOwnStg = new UCBStorage( *m_pStorStm, (nStorageMode & STORAGE_TRANSACTED) ? sal_False : sal_True ); + m_bDelStm = sal_True; } else { @@ -594,24 +594,24 @@ void SotStorage::CreateStorage( BOOL bForceUCBStorage, StreamMode nMode, Storage // UCBStorage always works directly on the UCB content, so discard the stream first DELETEZ( m_pStorStm ); - m_pOwnStg = new UCBStorage( m_aName, nMode, (nStorageMode & STORAGE_TRANSACTED) ? FALSE : TRUE ); + m_pOwnStg = new UCBStorage( m_aName, nMode, (nStorageMode & STORAGE_TRANSACTED) ? sal_False : sal_True ); } } else { // OLEStorage can be opened with a stream - m_pOwnStg = new Storage( *m_pStorStm, (nStorageMode & STORAGE_TRANSACTED) ? FALSE : TRUE ); - m_bDelStm = TRUE; + m_pOwnStg = new Storage( *m_pStorStm, (nStorageMode & STORAGE_TRANSACTED) ? sal_False : sal_True ); + m_bDelStm = sal_True; } } else if ( bForceUCBStorage ) { - m_pOwnStg = new UCBStorage( m_aName, nMode, (nStorageMode & STORAGE_TRANSACTED) ? FALSE : TRUE ); + m_pOwnStg = new UCBStorage( m_aName, nMode, (nStorageMode & STORAGE_TRANSACTED) ? sal_False : sal_True ); SetError( ERRCODE_IO_NOTSUPPORTED ); } else { - m_pOwnStg = new Storage( m_aName, nMode, (nStorageMode & STORAGE_TRANSACTED) ? FALSE : TRUE ); + m_pOwnStg = new Storage( m_aName, nMode, (nStorageMode & STORAGE_TRANSACTED) ? sal_False : sal_True ); SetError( ERRCODE_IO_NOTSUPPORTED ); } } @@ -620,9 +620,9 @@ void SotStorage::CreateStorage( BOOL bForceUCBStorage, StreamMode nMode, Storage { // temporary storage if ( bForceUCBStorage ) - m_pOwnStg = new UCBStorage( m_aName, nMode, (nStorageMode & STORAGE_TRANSACTED) ? FALSE : TRUE ); + m_pOwnStg = new UCBStorage( m_aName, nMode, (nStorageMode & STORAGE_TRANSACTED) ? sal_False : sal_True ); else - m_pOwnStg = new Storage( m_aName, nMode, (nStorageMode & STORAGE_TRANSACTED) ? FALSE : TRUE ); + m_pOwnStg = new Storage( m_aName, nMode, (nStorageMode & STORAGE_TRANSACTED) ? sal_False : sal_True ); m_aName = m_pOwnStg->GetName(); } @@ -631,7 +631,7 @@ void SotStorage::CreateStorage( BOOL bForceUCBStorage, StreamMode nMode, Storage SignAsRoot( m_pOwnStg->IsRoot() ); } -SotStorage::SotStorage( BOOL bUCBStorage, const String & rName, StreamMode nMode, StorageMode nStorageMode ) +SotStorage::SotStorage( sal_Bool bUCBStorage, const String & rName, StreamMode nMode, StorageMode nStorageMode ) INIT_SotStorage() { m_aName = rName; @@ -651,22 +651,22 @@ SotStorage::SotStorage( BaseStorage * pStor ) } m_pOwnStg = pStor; - ULONG nErr = m_pOwnStg ? m_pOwnStg->GetError() : SVSTREAM_CANNOT_MAKE; + sal_uIntPtr nErr = m_pOwnStg ? m_pOwnStg->GetError() : SVSTREAM_CANNOT_MAKE; SetError( nErr ); if ( IsOLEStorage() ) m_nVersion = SOFFICE_FILEFORMAT_50; } -SotStorage::SotStorage( BOOL bUCBStorage, SvStream & rStm ) +SotStorage::SotStorage( sal_Bool bUCBStorage, SvStream & rStm ) INIT_SotStorage() { SetError( rStm.GetError() ); // try as UCBStorage, next try as OLEStorage if ( UCBStorage::IsStorageFile( &rStm ) || bUCBStorage ) - m_pOwnStg = new UCBStorage( rStm, FALSE ); + m_pOwnStg = new UCBStorage( rStm, sal_False ); else - m_pOwnStg = new Storage( rStm, FALSE ); + m_pOwnStg = new Storage( rStm, sal_False ); SetError( m_pOwnStg->GetError() ); @@ -683,9 +683,9 @@ SotStorage::SotStorage( SvStream & rStm ) // try as UCBStorage, next try as OLEStorage if ( UCBStorage::IsStorageFile( &rStm ) ) - m_pOwnStg = new UCBStorage( rStm, FALSE ); + m_pOwnStg = new UCBStorage( rStm, sal_False ); else - m_pOwnStg = new Storage( rStm, FALSE ); + m_pOwnStg = new Storage( rStm, sal_False ); SetError( m_pOwnStg->GetError() ); @@ -695,16 +695,16 @@ SotStorage::SotStorage( SvStream & rStm ) SignAsRoot( m_pOwnStg->IsRoot() ); } -SotStorage::SotStorage( SvStream * pStm, BOOL bDelete ) +SotStorage::SotStorage( SvStream * pStm, sal_Bool bDelete ) INIT_SotStorage() { SetError( pStm->GetError() ); // try as UCBStorage, next try as OLEStorage if ( UCBStorage::IsStorageFile( pStm ) ) - m_pOwnStg = new UCBStorage( *pStm, FALSE ); + m_pOwnStg = new UCBStorage( *pStm, sal_False ); else - m_pOwnStg = new Storage( *pStm, FALSE ); + m_pOwnStg = new Storage( *pStm, sal_False ); SetError( m_pOwnStg->GetError() ); @@ -798,7 +798,7 @@ uno::Reference< embed::XStorage > SotStorage::GetUNOAPIDuplicate( const String& UCBStorage* pChildUCBStg = PTR_CAST( UCBStorage, pChildStorage->m_pOwnStg ); if ( pChildUCBStg ) { - UCBStorage* pTempStorage = new UCBStorage( pTempFile->GetURL(), STREAM_WRITE, FALSE, TRUE ); + UCBStorage* pTempStorage = new UCBStorage( pTempFile->GetURL(), STREAM_WRITE, sal_False, sal_True ); if ( pTempStorage ) { pChildUCBStg->CopyTo( pTempStorage ); @@ -896,7 +896,7 @@ SvMemoryStream * SotStorage::CreateMemoryStream() |* |* Beschreibung *************************************************************************/ -BOOL SotStorage::IsStorageFile( const String & rFileName ) +sal_Bool SotStorage::IsStorageFile( const String & rFileName ) { String aName( rFileName ); INetURLObject aObj( aName ); @@ -909,25 +909,25 @@ BOOL SotStorage::IsStorageFile( const String & rFileName ) } SvStream * pStm = ::utl::UcbStreamHelper::CreateStream( aName, STREAM_STD_READ ); - BOOL bRet = SotStorage::IsStorageFile( pStm ); + sal_Bool bRet = SotStorage::IsStorageFile( pStm ); delete pStm; return bRet; } -BOOL SotStorage::IsStorageFile( SvStream* pStream ) +sal_Bool SotStorage::IsStorageFile( SvStream* pStream ) { /** code for new storages must come first! **/ if ( pStream ) { long nPos = pStream->Tell(); - BOOL bRet = UCBStorage::IsStorageFile( pStream ); + sal_Bool bRet = UCBStorage::IsStorageFile( pStream ); if ( !bRet ) bRet = Storage::IsStorageFile( pStream ); pStream->Seek( nPos ); return bRet; } else - return FALSE; + return sal_False; } /************************************************************************* |* SotStorage::GetStorage() @@ -973,7 +973,7 @@ void SotStorage::ResetError() |* Beschreibung *************************************************************************/ void SotStorage::SetClass( const SvGlobalName & rName, - ULONG nOriginalClipFormat, + sal_uIntPtr nOriginalClipFormat, const String & rUserTypeName ) { DBG_ASSERT( Owner(), "must be owner" ); @@ -984,7 +984,7 @@ void SotStorage::SetClass( const SvGlobalName & rName, } void SotStorage::SetConvertClass( const SvGlobalName & rName, - ULONG nOriginalClipFormat, + sal_uIntPtr nOriginalClipFormat, const String & rUserTypeName ) { DBG_ASSERT( Owner(), "must be owner" ); @@ -1013,9 +1013,9 @@ SvGlobalName SotStorage::GetClassName() return aGN; } -ULONG SotStorage::GetFormat() +sal_uIntPtr SotStorage::GetFormat() { - ULONG nFormat = 0; + sal_uIntPtr nFormat = 0; DBG_ASSERT( Owner(), "must be owner" ); if( m_pOwnStg ) nFormat = m_pOwnStg->GetFormat(); @@ -1035,14 +1035,14 @@ String SotStorage::GetUserName() return aName; } -BOOL SotStorage::ShouldConvert() +sal_Bool SotStorage::ShouldConvert() { DBG_ASSERT( Owner(), "must be owner" ); if( m_pOwnStg ) return m_pOwnStg->ShouldConvert(); else SetError( SVSTREAM_GENERALERROR ); - return FALSE; + return sal_False; } /************************************************************************* @@ -1062,7 +1062,7 @@ void SotStorage::FillInfoList( SvStorageInfoList * pFillList ) const |* |* Beschreibung *************************************************************************/ -BOOL SotStorage::CopyTo( SotStorage * pDestStg ) +sal_Bool SotStorage::CopyTo( SotStorage * pDestStg ) { DBG_ASSERT( Owner(), "must be owner" ); DBG_ASSERT( pDestStg->Owner(), "must be owner" ); @@ -1083,7 +1083,7 @@ BOOL SotStorage::CopyTo( SotStorage * pDestStg ) |* |* Beschreibung *************************************************************************/ -BOOL SotStorage::Commit() +sal_Bool SotStorage::Commit() { DBG_ASSERT( Owner(), "must be owner" ); if( m_pOwnStg ) @@ -1101,7 +1101,7 @@ BOOL SotStorage::Commit() |* |* Beschreibung *************************************************************************/ -BOOL SotStorage::Revert() +sal_Bool SotStorage::Revert() { DBG_ASSERT( Owner(), "must be owner" ); if( m_pOwnStg ) @@ -1133,7 +1133,7 @@ SotStorageStream * SotStorage::OpenEncryptedSotStream( const String & rEleName, nMode |= STREAM_SHARE_DENYALL; ErrCode nE = m_pOwnStg->GetError(); BaseStorageStream* p = m_pOwnStg->OpenStream( rEleName, nMode, - (nStorageMode & STORAGE_TRANSACTED) ? FALSE : TRUE, &rKey ); + (nStorageMode & STORAGE_TRANSACTED) ? sal_False : sal_True, &rKey ); pStm = new SotStorageStream( p ); if( !nE ) @@ -1160,7 +1160,7 @@ SotStorageStream * SotStorage::OpenSotStream( const String & rEleName, nMode |= STREAM_SHARE_DENYALL; ErrCode nE = m_pOwnStg->GetError(); BaseStorageStream * p = m_pOwnStg->OpenStream( rEleName, nMode, - (nStorageMode & STORAGE_TRANSACTED) ? FALSE : TRUE ); + (nStorageMode & STORAGE_TRANSACTED) ? sal_False : sal_True ); pStm = new SotStorageStream( p ); if( !nE ) @@ -1189,7 +1189,7 @@ SotStorage * SotStorage::OpenSotStorage( const String & rEleName, nMode |= STREAM_SHARE_DENYALL; ErrCode nE = m_pOwnStg->GetError(); BaseStorage * p = m_pOwnStg->OpenStorage( rEleName, nMode, - (nStorageMode & STORAGE_TRANSACTED) ? FALSE : TRUE ); + (nStorageMode & STORAGE_TRANSACTED) ? sal_False : sal_True ); if( p ) { pStor = new SotStorage( p ); @@ -1216,7 +1216,7 @@ SotStorage * SotStorage::OpenUCBStorage( const String & rEleName, nMode |= STREAM_SHARE_DENYALL; ErrCode nE = m_pOwnStg->GetError(); BaseStorage * p = m_pOwnStg->OpenUCBStorage( rEleName, nMode, - (nStorageMode & STORAGE_TRANSACTED) ? FALSE : TRUE ); + (nStorageMode & STORAGE_TRANSACTED) ? sal_False : sal_True ); pStor = new SotStorage( p ); if( !nE ) m_pOwnStg->ResetError(); // kein Fehler setzen @@ -1237,7 +1237,7 @@ SotStorage * SotStorage::OpenOLEStorage( const String & rEleName, nMode |= STREAM_SHARE_DENYALL; ErrCode nE = m_pOwnStg->GetError(); BaseStorage * p = m_pOwnStg->OpenOLEStorage( rEleName, nMode, - (nStorageMode & STORAGE_TRANSACTED) ? FALSE : TRUE ); + (nStorageMode & STORAGE_TRANSACTED) ? sal_False : sal_True ); pStor = new SotStorage( p ); if( !nE ) m_pOwnStg->ResetError(); // kein Fehler setzen @@ -1254,31 +1254,31 @@ SotStorage * SotStorage::OpenOLEStorage( const String & rEleName, |* |* Beschreibung *************************************************************************/ -BOOL SotStorage::IsStorage( const String & rEleName ) const +sal_Bool SotStorage::IsStorage( const String & rEleName ) const { DBG_ASSERT( Owner(), "must be owner" ); // ein bisschen schneller if( m_pOwnStg ) return m_pOwnStg->IsStorage( rEleName ); - return FALSE; + return sal_False; } -BOOL SotStorage::IsStream( const String & rEleName ) const +sal_Bool SotStorage::IsStream( const String & rEleName ) const { DBG_ASSERT( Owner(), "must be owner" ); // ein bisschen schneller if( m_pOwnStg ) return m_pOwnStg->IsStream( rEleName ); - return FALSE; + return sal_False; } -BOOL SotStorage::IsContained( const String & rEleName ) const +sal_Bool SotStorage::IsContained( const String & rEleName ) const { DBG_ASSERT( Owner(), "must be owner" ); // ein bisschen schneller if( m_pOwnStg ) return m_pOwnStg->IsContained( rEleName ); - return FALSE; + return sal_False; } /************************************************************************* @@ -1286,7 +1286,7 @@ BOOL SotStorage::IsContained( const String & rEleName ) const |* |* Beschreibung *************************************************************************/ -BOOL SotStorage::Remove( const String & rEleName ) +sal_Bool SotStorage::Remove( const String & rEleName ) { DBG_ASSERT( Owner(), "must be owner" ); if( m_pOwnStg ) @@ -1304,7 +1304,7 @@ BOOL SotStorage::Remove( const String & rEleName ) |* |* Beschreibung *************************************************************************/ -BOOL SotStorage::Rename( const String & rEleName, const String & rNewName ) +sal_Bool SotStorage::Rename( const String & rEleName, const String & rNewName ) { DBG_ASSERT( Owner(), "must be owner" ); if( m_pOwnStg ) @@ -1322,7 +1322,7 @@ BOOL SotStorage::Rename( const String & rEleName, const String & rNewName ) |* |* Beschreibung *************************************************************************/ -BOOL SotStorage::CopyTo( const String & rEleName, +sal_Bool SotStorage::CopyTo( const String & rEleName, SotStorage * pNewSt, const String & rNewName ) { DBG_ASSERT( Owner(), "must be owner" ); @@ -1343,7 +1343,7 @@ BOOL SotStorage::CopyTo( const String & rEleName, |* |* Beschreibung *************************************************************************/ -BOOL SotStorage::MoveTo( const String & rEleName, +sal_Bool SotStorage::MoveTo( const String & rEleName, SotStorage * pNewSt, const String & rNewName ) { DBG_ASSERT( Owner(), "must be owner" ); @@ -1378,16 +1378,16 @@ SvStream* SotStorage::GetTargetSvStream() const } -BOOL SotStorage::Validate() +sal_Bool SotStorage::Validate() { DBG_ASSERT( m_bIsRoot, "Validate nur an Rootstorage" ); if( m_pOwnStg ) return m_pOwnStg->ValidateFAT(); else - return TRUE; + return sal_True; } -BOOL SotStorage::SetProperty( const String& rName, const ::com::sun::star::uno::Any& rValue ) +sal_Bool SotStorage::SetProperty( const String& rName, const ::com::sun::star::uno::Any& rValue ) { UCBStorage* pStg = PTR_CAST( UCBStorage, m_pOwnStg ); if ( pStg ) @@ -1397,11 +1397,11 @@ BOOL SotStorage::SetProperty( const String& rName, const ::com::sun::star::uno:: else { DBG_WARNING("W1:Not implemented!"); - return FALSE; + return sal_False; } } -BOOL SotStorage::GetProperty( const String& rName, ::com::sun::star::uno::Any& rValue ) +sal_Bool SotStorage::GetProperty( const String& rName, ::com::sun::star::uno::Any& rValue ) { UCBStorage* pStg = PTR_CAST( UCBStorage, m_pOwnStg ); if ( pStg ) @@ -1411,20 +1411,20 @@ BOOL SotStorage::GetProperty( const String& rName, ::com::sun::star::uno::Any& r else if ( rName.CompareToAscii("MediaType") == COMPARE_EQUAL ) { String aStr = SotExchange::GetFormatMimeType( GetFormat() ); - USHORT nPos = aStr.Search(';'); + sal_uInt16 nPos = aStr.Search(';'); if ( nPos != STRING_NOTFOUND ) aStr = aStr.Copy( 0, nPos ); rValue <<= (::rtl::OUString) aStr; - return TRUE; + return sal_True; } else { DBG_WARNING("W1:Not implemented!"); - return FALSE; + return sal_False; } } -BOOL SotStorage::GetProperty( const String& rEleName, const String& rName, ::com::sun::star::uno::Any& rValue ) +sal_Bool SotStorage::GetProperty( const String& rEleName, const String& rName, ::com::sun::star::uno::Any& rValue ) { UCBStorage* pStg = PTR_CAST( UCBStorage, m_pOwnStg ); if ( pStg ) @@ -1434,22 +1434,22 @@ BOOL SotStorage::GetProperty( const String& rEleName, const String& rName, ::com else { DBG_WARNING("W1:Not implemented!"); - return FALSE; + return sal_False; } } -BOOL SotStorage::IsOLEStorage() const +sal_Bool SotStorage::IsOLEStorage() const { UCBStorage* pStg = PTR_CAST( UCBStorage, m_pOwnStg ); return !pStg; } -BOOL SotStorage::IsOLEStorage( const String & rFileName ) +sal_Bool SotStorage::IsOLEStorage( const String & rFileName ) { return Storage::IsStorageFile( rFileName ); } -BOOL SotStorage::IsOLEStorage( SvStream* pStream ) +sal_Bool SotStorage::IsOLEStorage( SvStream* pStream ) { return Storage::IsStorageFile( pStream ); } @@ -1506,7 +1506,7 @@ SotStorage* SotStorage::OpenOLEStorage( const com::sun::star::uno::Reference < c pStream->SetError( ERRCODE_IO_GENERAL ); } - return new SotStorage( pStream, TRUE ); + return new SotStorage( pStream, sal_True ); } sal_Int32 SotStorage::GetFormatID( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& xStorage ) diff --git a/sot/source/sdstor/storinfo.cxx b/sot/source/sdstor/storinfo.cxx index 2aaaadd5a151..f326025fd0ac 100644 --- a/sot/source/sdstor/storinfo.cxx +++ b/sot/source/sdstor/storinfo.cxx @@ -39,7 +39,7 @@ PRV_SV_IMPL_OWNER_LIST(SvStorageInfoList,SvStorageInfo) const SvStorageInfo * SvStorageInfoList::Get( const String & rEleName ) { - for( ULONG i = 0; i < Count(); i++ ) + for( sal_uIntPtr i = 0; i < Count(); i++ ) { const SvStorageInfo & rType = GetObject( i ); if( rType.GetName() == rEleName ) @@ -50,10 +50,10 @@ const SvStorageInfo * SvStorageInfoList::Get( const String & rEleName ) /************** class SvStorageInfo ************************************** *************************************************************************/ -ULONG ReadClipboardFormat( SvStream & rStm ) +sal_uIntPtr ReadClipboardFormat( SvStream & rStm ) { sal_uInt32 nFormat = 0; - INT32 nLen = 0; + sal_Int32 nLen = 0; rStm >> nLen; if( rStm.IsEof() ) rStm.SetError( SVSTREAM_GENERALERROR ); @@ -61,7 +61,7 @@ ULONG ReadClipboardFormat( SvStream & rStm ) { // get a string name sal_Char * p = new sal_Char[ nLen ]; - if( rStm.Read( p, nLen ) == (ULONG) nLen ) + if( rStm.Read( p, nLen ) == (sal_uIntPtr) nLen ) { nFormat = SotExchange::RegisterFormatName( String::CreateFromAscii( p, short(nLen-1) ) ); } @@ -88,7 +88,7 @@ ULONG ReadClipboardFormat( SvStream & rStm ) return nFormat; } -void WriteClipboardFormat( SvStream & rStm, ULONG nFormat ) +void WriteClipboardFormat( SvStream & rStm, sal_uIntPtr nFormat ) { // determine the clipboard format string String aCbFmt; @@ -97,15 +97,15 @@ void WriteClipboardFormat( SvStream & rStm, ULONG nFormat ) if( aCbFmt.Len() ) { ByteString aAsciiCbFmt( aCbFmt, RTL_TEXTENCODING_ASCII_US ); - rStm << (INT32) (aAsciiCbFmt.Len() + 1); + rStm << (sal_Int32) (aAsciiCbFmt.Len() + 1); rStm << (const char *)aAsciiCbFmt.GetBuffer(); - rStm << (UINT8) 0; + rStm << (sal_uInt8) 0; } else if( nFormat ) - rStm << (INT32) -1 // for Windows - << (INT32) nFormat; + rStm << (sal_Int32) -1 // for Windows + << (sal_Int32) nFormat; else - rStm << (INT32) 0; // no clipboard format + rStm << (sal_Int32) 0; // no clipboard format } diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx index ea3b656272db..ede41ec3aec9 100644 --- a/sot/source/sdstor/ucbstorage.cxx +++ b/sot/source/sdstor/ucbstorage.cxx @@ -443,10 +443,10 @@ class UCBStorageStream_Impl : public SvRefBase, public SvStream ~UCBStorageStream_Impl(); public: - virtual ULONG GetData( void* pData, ULONG nSize ); - virtual ULONG PutData( const void* pData, ULONG nSize ); - virtual ULONG SeekPos( ULONG nPos ); - virtual void SetSize( ULONG nSize ); + virtual sal_uIntPtr GetData( void* pData, sal_uIntPtr nSize ); + virtual sal_uIntPtr PutData( const void* pData, sal_uIntPtr nSize ); + virtual sal_uIntPtr SeekPos( sal_uIntPtr nPos ); + virtual void SetSize( sal_uIntPtr nSize ); virtual void FlushData(); virtual void ResetError(); @@ -466,35 +466,35 @@ public: RepresentModes m_nRepresentMode; // should it be used as XInputStream or as SvStream long m_nError; StreamMode m_nMode; // open mode ( read/write/trunc/nocreate/sharing ) - BOOL m_bSourceRead; // Source still contains useful information - BOOL m_bModified; // only modified streams will be sent to the original content - BOOL m_bCommited; // sending the streams is coordinated by the root storage of the package - BOOL m_bDirect; // the storage and its streams are opened in direct mode; for UCBStorages + sal_Bool m_bSourceRead; // Source still contains useful information + sal_Bool m_bModified; // only modified streams will be sent to the original content + sal_Bool m_bCommited; // sending the streams is coordinated by the root storage of the package + sal_Bool m_bDirect; // the storage and its streams are opened in direct mode; for UCBStorages // this means that the root storage does an autocommit when its external // reference is destroyed - BOOL m_bIsOLEStorage;// an OLEStorage on a UCBStorageStream makes this an Autocommit-stream + sal_Bool m_bIsOLEStorage;// an OLEStorage on a UCBStorageStream makes this an Autocommit-stream - UCBStorageStream_Impl( const String&, StreamMode, UCBStorageStream*, BOOL, const ByteString* pKey=0, BOOL bRepair = FALSE, Reference< XProgressHandler > xProgress = Reference< XProgressHandler >() ); + UCBStorageStream_Impl( const String&, StreamMode, UCBStorageStream*, sal_Bool, const ByteString* pKey=0, sal_Bool bRepair = sal_False, Reference< XProgressHandler > xProgress = Reference< XProgressHandler >() ); void Free(); - BOOL Init(); - BOOL Clear(); + sal_Bool Init(); + sal_Bool Clear(); sal_Int16 Commit(); // if modified and commited: transfer an XInputStream to the content - BOOL Revert(); // discard all changes + sal_Bool Revert(); // discard all changes BaseStorage* CreateStorage();// create an OLE Storage on the UCBStorageStream - ULONG GetSize(); + sal_uIntPtr GetSize(); - ULONG ReadSourceWriteTemporary( ULONG aLength ); // read aLength from source and copy to temporary, + sal_uIntPtr ReadSourceWriteTemporary( sal_uIntPtr aLength ); // read aLength from source and copy to temporary, // no seeking is produced - ULONG ReadSourceWriteTemporary(); // read source till the end and copy to temporary, + sal_uIntPtr ReadSourceWriteTemporary(); // read source till the end and copy to temporary, // no seeking is produced #if 0 - ULONG CopySourceToTemporary( ULONG aLength ); // same as ReadSourceWriteToTemporary( aLength ) + sal_uIntPtr CopySourceToTemporary( sal_uIntPtr aLength ); // same as ReadSourceWriteToTemporary( aLength ) // but the writing is done at the end of temporary // pointer position is not changed #endif - ULONG CopySourceToTemporary(); // same as ReadSourceWriteToTemporary() + sal_uIntPtr CopySourceToTemporary(); // same as ReadSourceWriteToTemporary() // but the writing is done at the end of temporary // pointer position is not changed Reference<XInputStream> GetXInputStream(); // return XInputStream, after that @@ -527,34 +527,34 @@ public: //SvStream* m_pStream; // the corresponding editable stream, only for storage on a stream long m_nError; StreamMode m_nMode; // open mode ( read/write/trunc/nocreate/sharing ) - BOOL m_bModified; // only modified elements will be sent to the original content - BOOL m_bCommited; // sending the streams is coordinated by the root storage of the package - BOOL m_bDirect; // the storage and its streams are opened in direct mode; for UCBStorages + sal_Bool m_bModified; // only modified elements will be sent to the original content + sal_Bool m_bCommited; // sending the streams is coordinated by the root storage of the package + sal_Bool m_bDirect; // the storage and its streams are opened in direct mode; for UCBStorages // this means that the root storage does an autocommit when its external // reference is destroyed - BOOL m_bIsRoot; // marks this storage as root storages that manages all oommits and reverts - BOOL m_bDirty; // ??? - BOOL m_bIsLinked; - BOOL m_bListCreated; - ULONG m_nFormat; + sal_Bool m_bIsRoot; // marks this storage as root storages that manages all oommits and reverts + sal_Bool m_bDirty; // ??? + sal_Bool m_bIsLinked; + sal_Bool m_bListCreated; + sal_uIntPtr m_nFormat; String m_aUserTypeName; SvGlobalName m_aClassId; UCBStorageElementList_Impl m_aChildrenList; - BOOL m_bRepairPackage; + sal_Bool m_bRepairPackage; Reference< XProgressHandler > m_xProgressHandler; UNOStorageHolderList* m_pUNOStorageHolderList; - UCBStorage_Impl( const ::ucbhelper::Content&, const String&, StreamMode, UCBStorage*, BOOL, BOOL, BOOL = FALSE, Reference< XProgressHandler > = Reference< XProgressHandler >() ); - UCBStorage_Impl( const String&, StreamMode, UCBStorage*, BOOL, BOOL, BOOL = FALSE, Reference< XProgressHandler > = Reference< XProgressHandler >() ); - UCBStorage_Impl( SvStream&, UCBStorage*, BOOL ); + UCBStorage_Impl( const ::ucbhelper::Content&, const String&, StreamMode, UCBStorage*, sal_Bool, sal_Bool, sal_Bool = sal_False, Reference< XProgressHandler > = Reference< XProgressHandler >() ); + UCBStorage_Impl( const String&, StreamMode, UCBStorage*, sal_Bool, sal_Bool, sal_Bool = sal_False, Reference< XProgressHandler > = Reference< XProgressHandler >() ); + UCBStorage_Impl( SvStream&, UCBStorage*, sal_Bool ); void Init(); sal_Int16 Commit(); - BOOL Revert(); - BOOL Insert( ::ucbhelper::Content *pContent ); - UCBStorage_Impl* OpenStorage( UCBStorageElement_Impl* pElement, StreamMode nMode, BOOL bDirect ); - UCBStorageStream_Impl* OpenStream( UCBStorageElement_Impl*, StreamMode, BOOL, const ByteString* pKey=0 ); + sal_Bool Revert(); + sal_Bool Insert( ::ucbhelper::Content *pContent ); + UCBStorage_Impl* OpenStorage( UCBStorageElement_Impl* pElement, StreamMode nMode, sal_Bool bDirect ); + UCBStorageStream_Impl* OpenStream( UCBStorageElement_Impl*, StreamMode, sal_Bool, const ByteString* pKey=0 ); void SetProps( const Sequence < Sequence < PropertyValue > >& rSequence, const String& ); void GetProps( sal_Int32&, Sequence < Sequence < PropertyValue > >& rSequence, const String& ); sal_Int32 GetObjectCount(); @@ -589,32 +589,32 @@ struct UCBStorageElement_Impl { String m_aName; // the actual URL relative to the root "folder" String m_aOriginalName;// the original name in the content - ULONG m_nSize; - BOOL m_bIsFolder; // Only TRUE when it is a UCBStorage ! - BOOL m_bIsStorage; // Also TRUE when it is an OLEStorage ! - BOOL m_bIsRemoved; // element will be removed on commit - BOOL m_bIsInserted; // element will be removed on revert + sal_uIntPtr m_nSize; + sal_Bool m_bIsFolder; // Only sal_True when it is a UCBStorage ! + sal_Bool m_bIsStorage; // Also sal_True when it is an OLEStorage ! + sal_Bool m_bIsRemoved; // element will be removed on commit + sal_Bool m_bIsInserted; // element will be removed on revert UCBStorage_ImplRef m_xStorage; // reference to the "real" storage UCBStorageStream_ImplRef m_xStream; // reference to the "real" stream UCBStorageElement_Impl( const ::rtl::OUString& rName, - BOOL bIsFolder = FALSE, ULONG nSize = 0 ) + sal_Bool bIsFolder = sal_False, sal_uIntPtr nSize = 0 ) : m_aName( rName ) , m_aOriginalName( rName ) , m_nSize( nSize ) , m_bIsFolder( bIsFolder ) , m_bIsStorage( bIsFolder ) - , m_bIsRemoved( FALSE ) - , m_bIsInserted( FALSE ) + , m_bIsRemoved( sal_False ) + , m_bIsInserted( sal_False ) { } ::ucbhelper::Content* GetContent(); - BOOL IsModified(); + sal_Bool IsModified(); String GetContentType(); void SetContentType( const String& ); String GetOriginalContentType(); - BOOL IsLoaded() + sal_Bool IsLoaded() { return m_xStream.Is() || m_xStorage.Is(); } }; @@ -664,9 +664,9 @@ String UCBStorageElement_Impl::GetOriginalContentType() return String(); } -BOOL UCBStorageElement_Impl::IsModified() +sal_Bool UCBStorageElement_Impl::IsModified() { - BOOL bModified = m_bIsRemoved || m_bIsInserted || m_aName != m_aOriginalName; + sal_Bool bModified = m_bIsRemoved || m_bIsInserted || m_aName != m_aOriginalName; if ( bModified ) { if ( m_xStream.Is() ) @@ -678,7 +678,7 @@ BOOL UCBStorageElement_Impl::IsModified() return bModified; } -UCBStorageStream_Impl::UCBStorageStream_Impl( const String& rName, StreamMode nMode, UCBStorageStream* pStream, BOOL bDirect, const ByteString* pKey, BOOL bRepair, Reference< XProgressHandler > xProgress ) +UCBStorageStream_Impl::UCBStorageStream_Impl( const String& rName, StreamMode nMode, UCBStorageStream* pStream, sal_Bool bDirect, const ByteString* pKey, sal_Bool bRepair, Reference< XProgressHandler > xProgress ) : m_pAntiImpl( pStream ) , m_aURL( rName ) , m_pContent( NULL ) @@ -687,10 +687,10 @@ UCBStorageStream_Impl::UCBStorageStream_Impl( const String& rName, StreamMode nM , m_nError( 0 ) , m_nMode( nMode ) , m_bSourceRead( !( nMode & STREAM_TRUNC ) ) - , m_bModified( FALSE ) - , m_bCommited( FALSE ) + , m_bModified( sal_False ) + , m_bCommited( sal_False ) , m_bDirect( bDirect ) - , m_bIsOLEStorage( FALSE ) + , m_bIsOLEStorage( sal_False ) { // name is last segment in URL INetURLObject aObj( rName ); @@ -775,7 +775,7 @@ Reference<XInputStream> UCBStorageStream_Impl::GetXInputStream() CopySourceToTemporary(); // owner transfer of stream to wrapper - aResult = new ::utl::OInputStreamWrapper( m_pStream, TRUE ); + aResult = new ::utl::OInputStreamWrapper( m_pStream, sal_True ); m_pStream->Seek(0); if( aResult.is() ) @@ -812,13 +812,13 @@ Reference<XInputStream> UCBStorageStream_Impl::GetXInputStream() return aResult; } -BOOL UCBStorageStream_Impl::Init() +sal_Bool UCBStorageStream_Impl::Init() { if( m_nRepresentMode == xinputstream ) { DBG_ERROR( "XInputStream misuse!" ); SetError( ERRCODE_IO_ACCESSDENIED ); - return FALSE; + return sal_False; } if( !m_pStream ) @@ -840,7 +840,7 @@ BOOL UCBStorageStream_Impl::Init() { DBG_ERROR( "Suspicious temporary stream creation!" ); SetError( SVSTREAM_CANNOT_MAKE ); - return FALSE; + return sal_False; } SetError( m_pStream->GetError() ); @@ -871,12 +871,12 @@ BOOL UCBStorageStream_Impl::Init() catch( BufferSizeExceededException& ) { // the temporary stream already contain all the data - m_bSourceRead = FALSE; + m_bSourceRead = sal_False; } catch( Exception& ) { // something is really wrong - m_bSourceRead = FALSE; + m_bSourceRead = sal_False; DBG_ERROR( "Can not operate original stream!" ); SetError( SVSTREAM_CANNOT_MAKE ); } @@ -886,7 +886,7 @@ BOOL UCBStorageStream_Impl::Init() else { // if the new file is edited than no source exist - m_bSourceRead = FALSE; + m_bSourceRead = sal_False; //SetError( SVSTREAM_CANNOT_MAKE ); } } @@ -896,12 +896,12 @@ BOOL UCBStorageStream_Impl::Init() return sal_True; } -ULONG UCBStorageStream_Impl::ReadSourceWriteTemporary() +sal_uIntPtr UCBStorageStream_Impl::ReadSourceWriteTemporary() { // read source stream till the end and copy all the data to // the current position of the temporary stream - ULONG aResult = 0; + sal_uIntPtr aResult = 0; if( m_bSourceRead ) { @@ -909,7 +909,7 @@ ULONG UCBStorageStream_Impl::ReadSourceWriteTemporary() try { - ULONG aReaded; + sal_uIntPtr aReaded; do { aReaded = m_rSource->readBytes( aData, 32000 ); @@ -919,7 +919,7 @@ ULONG UCBStorageStream_Impl::ReadSourceWriteTemporary() #if OSL_DEBUG_LEVEL > 1 catch( Exception & e ) { - OSL_ENSURE( FALSE, ::rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US ).getStr() ); + OSL_ENSURE( sal_False, ::rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US ).getStr() ); #else catch( Exception & ) { @@ -927,18 +927,18 @@ ULONG UCBStorageStream_Impl::ReadSourceWriteTemporary() } } - m_bSourceRead = FALSE; + m_bSourceRead = sal_False; return aResult; } -ULONG UCBStorageStream_Impl::ReadSourceWriteTemporary( ULONG aLength ) +sal_uIntPtr UCBStorageStream_Impl::ReadSourceWriteTemporary( sal_uIntPtr aLength ) { // read aLength bite from the source stream and copy them to the current // position of the temporary stream - ULONG aResult = 0; + sal_uIntPtr aResult = 0; if( m_bSourceRead ) { @@ -947,22 +947,22 @@ ULONG UCBStorageStream_Impl::ReadSourceWriteTemporary( ULONG aLength ) try { - ULONG aReaded = 32000; + sal_uIntPtr aReaded = 32000; - for( ULONG pInd = 0; pInd < aLength && aReaded == 32000 ; pInd += 32000 ) + for( sal_uIntPtr pInd = 0; pInd < aLength && aReaded == 32000 ; pInd += 32000 ) { - ULONG aToCopy = min( aLength - pInd, 32000 ); + sal_uIntPtr aToCopy = min( aLength - pInd, 32000 ); aReaded = m_rSource->readBytes( aData, aToCopy ); aResult += m_pStream->Write( aData.getArray(), aReaded ); } if( aResult < aLength ) - m_bSourceRead = FALSE; + m_bSourceRead = sal_False; } #if OSL_DEBUG_LEVEL > 1 catch( Exception & e ) { - OSL_ENSURE( FALSE, ::rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US ).getStr() ); + OSL_ENSURE( sal_False, ::rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US ).getStr() ); #else catch( Exception & ) { @@ -973,14 +973,14 @@ ULONG UCBStorageStream_Impl::ReadSourceWriteTemporary( ULONG aLength ) return aResult; } -ULONG UCBStorageStream_Impl::CopySourceToTemporary() +sal_uIntPtr UCBStorageStream_Impl::CopySourceToTemporary() { // current position of the temporary stream is not changed - ULONG aResult = 0; + sal_uIntPtr aResult = 0; if( m_bSourceRead ) { - ULONG aPos = m_pStream->Tell(); + sal_uIntPtr aPos = m_pStream->Tell(); m_pStream->Seek( STREAM_SEEK_TO_END ); aResult = ReadSourceWriteTemporary(); m_pStream->Seek( aPos ); @@ -991,14 +991,14 @@ ULONG UCBStorageStream_Impl::CopySourceToTemporary() } #if 0 -ULONG UCBStorageStream_Impl::CopySourceToTemporary( ULONG aLength ) +sal_uIntPtr UCBStorageStream_Impl::CopySourceToTemporary( sal_uIntPtr aLength ) { // current position of the temporary stream is not changed - ULONG aResult = 0; + sal_uIntPtr aResult = 0; if( m_bSourceRead ) { - ULONG aPos = m_pStream->Tell(); + sal_uIntPtr aPos = m_pStream->Tell(); m_pStream->Seek( STREAM_SEEK_TO_END ); aResult = ReadSourceWriteTemporary( aLength ); m_pStream->Seek( aPos ); @@ -1011,9 +1011,9 @@ ULONG UCBStorageStream_Impl::CopySourceToTemporary( ULONG aLength ) // UCBStorageStream_Impl must have a SvStream interface, because it then can be used as underlying stream // of an OLEStorage; so every write access caused by storage operations marks the UCBStorageStream as modified -ULONG UCBStorageStream_Impl::GetData( void* pData, ULONG nSize ) +sal_uIntPtr UCBStorageStream_Impl::GetData( void* pData, sal_uIntPtr nSize ) { - ULONG aResult = 0; + sal_uIntPtr aResult = 0; if( !Init() ) return 0; @@ -1026,20 +1026,20 @@ ULONG UCBStorageStream_Impl::GetData( void* pData, ULONG nSize ) // read the tail of the data from original stream // copy this tail to the temporary stream - ULONG aToRead = nSize - aResult; + sal_uIntPtr aToRead = nSize - aResult; pData = (void*)( (char*)pData + aResult ); try { Sequence<sal_Int8> aData( aToRead ); - ULONG aReaded = m_rSource->readBytes( aData, aToRead ); + sal_uIntPtr aReaded = m_rSource->readBytes( aData, aToRead ); aResult += m_pStream->Write( (void*)aData.getArray(), aReaded ); memcpy( pData, aData.getArray(), aReaded ); } #if OSL_DEBUG_LEVEL > 1 catch( Exception & e ) { - OSL_ENSURE( FALSE, ::rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US ).getStr() ); + OSL_ENSURE( sal_False, ::rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US ).getStr() ); #else catch( Exception & ) { @@ -1047,13 +1047,13 @@ ULONG UCBStorageStream_Impl::GetData( void* pData, ULONG nSize ) } if( aResult < nSize ) - m_bSourceRead = FALSE; + m_bSourceRead = sal_False; } return aResult; } -ULONG UCBStorageStream_Impl::PutData( const void* pData, ULONG nSize ) +sal_uIntPtr UCBStorageStream_Impl::PutData( const void* pData, sal_uIntPtr nSize ) { if ( !(m_nMode & STREAM_WRITE) ) { @@ -1064,7 +1064,7 @@ ULONG UCBStorageStream_Impl::PutData( const void* pData, ULONG nSize ) if( !nSize || !Init() ) return 0; - ULONG aResult = m_pStream->Write( pData, nSize ); + sal_uIntPtr aResult = m_pStream->Write( pData, nSize ); m_bModified = aResult > 0; @@ -1072,12 +1072,12 @@ ULONG UCBStorageStream_Impl::PutData( const void* pData, ULONG nSize ) } -ULONG UCBStorageStream_Impl::SeekPos( ULONG nPos ) +sal_uIntPtr UCBStorageStream_Impl::SeekPos( sal_uIntPtr nPos ) { if( !Init() ) return 0; - ULONG aResult; + sal_uIntPtr aResult; if( nPos == STREAM_SEEK_TO_END ) { @@ -1108,7 +1108,7 @@ ULONG UCBStorageStream_Impl::SeekPos( ULONG nPos ) { aResult += ReadSourceWriteTemporary( nPos - aResult ); if( aResult < nPos ) - m_bSourceRead = FALSE; + m_bSourceRead = sal_False; DBG_ASSERT( aResult == m_pStream->Tell(), "Error in stream arithmetic!\n" ); } @@ -1129,7 +1129,7 @@ ULONG UCBStorageStream_Impl::SeekPos( ULONG nPos ) return aResult; } -void UCBStorageStream_Impl::SetSize( ULONG nSize ) +void UCBStorageStream_Impl::SetSize( sal_uIntPtr nSize ) { if ( !(m_nMode & STREAM_WRITE) ) { @@ -1140,11 +1140,11 @@ void UCBStorageStream_Impl::SetSize( ULONG nSize ) if( !Init() ) return; - m_bModified = TRUE; + m_bModified = sal_True; if( m_bSourceRead ) { - ULONG aPos = m_pStream->Tell(); + sal_uIntPtr aPos = m_pStream->Tell(); m_pStream->Seek( STREAM_SEEK_TO_END ); if( m_pStream->Tell() < nSize ) ReadSourceWriteTemporary( nSize - m_pStream->Tell() ); @@ -1152,7 +1152,7 @@ void UCBStorageStream_Impl::SetSize( ULONG nSize ) } m_pStream->SetStreamSize( nSize ); - m_bSourceRead = FALSE; + m_bSourceRead = sal_False; } void UCBStorageStream_Impl::FlushData() @@ -1163,7 +1163,7 @@ void UCBStorageStream_Impl::FlushData() m_pStream->Flush(); } - m_bCommited = TRUE; + m_bCommited = sal_True; } void UCBStorageStream_Impl::SetError( sal_uInt32 nErr ) @@ -1184,15 +1184,15 @@ void UCBStorageStream_Impl::ResetError() m_pAntiImpl->ResetError(); } -ULONG UCBStorageStream_Impl::GetSize() +sal_uIntPtr UCBStorageStream_Impl::GetSize() { if( !Init() ) return 0; - ULONG nPos = m_pStream->Tell(); + sal_uIntPtr nPos = m_pStream->Tell(); m_pStream->Seek( STREAM_SEEK_TO_END ); ReadSourceWriteTemporary(); - ULONG nRet = m_pStream->Tell(); + sal_uIntPtr nRet = m_pStream->Tell(); m_pStream->Seek( nPos ); return nRet; @@ -1252,8 +1252,8 @@ sal_Int16 UCBStorageStream_Impl::Commit() INetURLObject aObj( m_aURL ); aObj.SetName( m_aName ); m_aURL = aObj.GetMainURL( INetURLObject::NO_DECODE ); - m_bModified = FALSE; - m_bSourceRead = TRUE; + m_bModified = sal_False; + m_bSourceRead = sal_True; } catch ( CommandAbortedException& ) { @@ -1274,7 +1274,7 @@ sal_Int16 UCBStorageStream_Impl::Commit() return COMMIT_RESULT_FAILURE; } - m_bCommited = FALSE; + m_bCommited = sal_False; return COMMIT_RESULT_SUCCESS; } } @@ -1282,13 +1282,13 @@ sal_Int16 UCBStorageStream_Impl::Commit() return COMMIT_RESULT_NOTHING_TO_DO; } -BOOL UCBStorageStream_Impl::Revert() +sal_Bool UCBStorageStream_Impl::Revert() { // if an OLEStorage is created on this stream, no "revert" is neccessary because OLEStorages do nothing on "Revert" ! if ( m_bCommited ) { DBG_ERROR("Revert while commit is in progress!" ); - return FALSE; // ??? + return sal_False; // ??? } Free(); @@ -1298,7 +1298,7 @@ BOOL UCBStorageStream_Impl::Revert() m_aTempURL.Erase(); } - m_bSourceRead = FALSE; + m_bSourceRead = sal_False; try { m_rSource = m_pContent->openStream(); @@ -1306,11 +1306,11 @@ BOOL UCBStorageStream_Impl::Revert() { if ( m_pAntiImpl && ( m_nMode & STREAM_TRUNC ) ) // stream is in use and should be truncated - m_bSourceRead = FALSE; + m_bSourceRead = sal_False; else { m_nMode &= ~STREAM_TRUNC; - m_bSourceRead = TRUE; + m_bSourceRead = sal_True; } } else @@ -1328,15 +1328,15 @@ BOOL UCBStorageStream_Impl::Revert() { } - m_bModified = FALSE; + m_bModified = sal_False; m_aName = m_aOriginalName; m_aContentType = m_aOriginalContentType; return ( GetError() == ERRCODE_NONE ); } -BOOL UCBStorageStream_Impl::Clear() +sal_Bool UCBStorageStream_Impl::Clear() { - BOOL bRet = ( m_pAntiImpl == NULL ); + sal_Bool bRet = ( m_pAntiImpl == NULL ); DBG_ASSERT( bRet, "Removing used stream!" ); if( bRet ) { @@ -1387,7 +1387,7 @@ void UCBStorageStream_Impl::PrepareCachedForReopen( StreamMode nMode ) } } -UCBStorageStream::UCBStorageStream( const String& rName, StreamMode nMode, BOOL bDirect, const ByteString* pKey ) +UCBStorageStream::UCBStorageStream( const String& rName, StreamMode nMode, sal_Bool bDirect, const ByteString* pKey ) { // pImp must be initialized in the body, because otherwise the vtable of the stream is not initialized // to class UCBStorageStream ! @@ -1396,7 +1396,7 @@ UCBStorageStream::UCBStorageStream( const String& rName, StreamMode nMode, BOOL StorageBase::m_nMode = pImp->m_nMode; } -UCBStorageStream::UCBStorageStream( const String& rName, StreamMode nMode, BOOL bDirect, const ByteString* pKey, BOOL bRepair, Reference< XProgressHandler > xProgress ) +UCBStorageStream::UCBStorageStream( const String& rName, StreamMode nMode, sal_Bool bDirect, const ByteString* pKey, sal_Bool bRepair, Reference< XProgressHandler > xProgress ) { // pImp must be initialized in the body, because otherwise the vtable of the stream is not initialized // to class UCBStorageStream ! @@ -1423,13 +1423,13 @@ UCBStorageStream::~UCBStorageStream() pImp->ReleaseRef(); } -ULONG UCBStorageStream::Read( void * pData, ULONG nSize ) +sal_uIntPtr UCBStorageStream::Read( void * pData, sal_uIntPtr nSize ) { //return pImp->m_pStream->Read( pData, nSize ); return pImp->GetData( pData, nSize ); } -ULONG UCBStorageStream::Write( const void* pData, ULONG nSize ) +sal_uIntPtr UCBStorageStream::Write( const void* pData, sal_uIntPtr nSize ) { /* // mba: does occur in writer ! @@ -1439,18 +1439,18 @@ ULONG UCBStorageStream::Write( const void* pData, ULONG nSize ) return 0; } */ - // pImp->m_bModified = TRUE; + // pImp->m_bModified = sal_True; //return pImp->m_pStream->Write( pData, nSize ); return pImp->PutData( pData, nSize ); } -ULONG UCBStorageStream::Seek( ULONG nPos ) +sal_uIntPtr UCBStorageStream::Seek( sal_uIntPtr nPos ) { //return pImp->m_pStream->Seek( nPos ); return pImp->Seek( nPos ); } -ULONG UCBStorageStream::Tell() +sal_uIntPtr UCBStorageStream::Tell() { if( !pImp->Init() ) return 0; @@ -1463,32 +1463,32 @@ void UCBStorageStream::Flush() Commit(); } -BOOL UCBStorageStream::SetSize( ULONG nNewSize ) +sal_Bool UCBStorageStream::SetSize( sal_uIntPtr nNewSize ) { /* if ( pImp->m_bCommited ) { DBG_ERROR("Changing stream size while commit is in progress!" ); - return FALSE; + return sal_False; } */ - // pImp->m_bModified = TRUE; + // pImp->m_bModified = sal_True; //return pImp->m_pStream->SetStreamSize( nNewSize ); pImp->SetSize( nNewSize ); return !pImp->GetError(); } -BOOL UCBStorageStream::Validate( BOOL bWrite ) const +sal_Bool UCBStorageStream::Validate( sal_Bool bWrite ) const { return ( !bWrite || ( pImp->m_nMode & STREAM_WRITE ) ); } -BOOL UCBStorageStream::ValidateMode( StreamMode m ) const +sal_Bool UCBStorageStream::ValidateMode( StreamMode m ) const { // ??? if( m == ( STREAM_READ | STREAM_TRUNC ) ) // from stg.cxx - return TRUE; - USHORT nCurMode = 0xFFFF; + return sal_True; + sal_uInt16 nCurMode = 0xFFFF; if( ( m & 3 ) == STREAM_READ ) { // only SHARE_DENYWRITE or SHARE_DENYALL allowed @@ -1496,7 +1496,7 @@ BOOL UCBStorageStream::ValidateMode( StreamMode m ) const && ( nCurMode & STREAM_SHARE_DENYWRITE ) ) || ( ( m & STREAM_SHARE_DENYALL ) && ( nCurMode & STREAM_SHARE_DENYALL ) ) ) - return TRUE; + return sal_True; } else { @@ -1505,10 +1505,10 @@ BOOL UCBStorageStream::ValidateMode( StreamMode m ) const // the commit may fail if( ( m & STREAM_SHARE_DENYALL ) && ( nCurMode & STREAM_SHARE_DENYALL ) ) - return TRUE; + return sal_True; } - return TRUE; + return sal_True; } const SvStream* UCBStorageStream::GetSvStream() const @@ -1530,28 +1530,28 @@ Reference< XInputStream > UCBStorageStream::GetXInputStream() const return pImp->GetXInputStream(); } -BOOL UCBStorageStream::Equals( const BaseStorageStream& rStream ) const +sal_Bool UCBStorageStream::Equals( const BaseStorageStream& rStream ) const { // ??? return ((BaseStorageStream*) this ) == &rStream; } -BOOL UCBStorageStream::Commit() +sal_Bool UCBStorageStream::Commit() { // mark this stream for sending it on root commit pImp->FlushData(); - return TRUE; + return sal_True; } -BOOL UCBStorageStream::Revert() +sal_Bool UCBStorageStream::Revert() { return pImp->Revert(); } -BOOL UCBStorageStream::CopyTo( BaseStorageStream* pDestStm ) +sal_Bool UCBStorageStream::CopyTo( BaseStorageStream* pDestStm ) { if( !pImp->Init() ) - return FALSE; + return sal_False; UCBStorageStream* pStg = PTR_CAST( UCBStorageStream, pDestStm ); if ( pStg ) @@ -1559,18 +1559,18 @@ BOOL UCBStorageStream::CopyTo( BaseStorageStream* pDestStm ) pDestStm->SetSize( 0 ); Seek( STREAM_SEEK_TO_END ); - INT32 n = Tell(); + sal_Int32 n = Tell(); if( n < 0 ) - return FALSE; + return sal_False; if( pDestStm->SetSize( n ) && n ) { - BYTE* p = new BYTE[ 4096 ]; + sal_uInt8* p = new sal_uInt8[ 4096 ]; Seek( 0L ); pDestStm->Seek( 0L ); while( n ) { - UINT32 nn = n; + sal_uInt32 nn = n; if( nn > 4096 ) nn = 4096; if( Read( p, nn ) != nn ) @@ -1583,13 +1583,13 @@ BOOL UCBStorageStream::CopyTo( BaseStorageStream* pDestStm ) delete[] p; } - return TRUE; + return sal_True; } -BOOL UCBStorageStream::SetProperty( const String& rName, const ::com::sun::star::uno::Any& rValue ) +sal_Bool UCBStorageStream::SetProperty( const String& rName, const ::com::sun::star::uno::Any& rValue ) { if ( rName.CompareToAscii("Title") == COMPARE_EQUAL ) - return FALSE; + return sal_False; if ( rName.CompareToAscii("MediaType") == COMPARE_EQUAL ) { @@ -1603,34 +1603,34 @@ BOOL UCBStorageStream::SetProperty( const String& rName, const ::com::sun::star: if ( pImp->m_pContent ) { pImp->m_pContent->setPropertyValue( rName, rValue ); - return TRUE; + return sal_True; } } catch ( Exception& ) { } - return FALSE; + return sal_False; } -BOOL UCBStorageStream::GetProperty( const String& rName, ::com::sun::star::uno::Any& rValue ) +sal_Bool UCBStorageStream::GetProperty( const String& rName, ::com::sun::star::uno::Any& rValue ) { try { if ( pImp->m_pContent ) { rValue = pImp->m_pContent->getPropertyValue( rName ); - return TRUE; + return sal_True; } } catch ( Exception& ) { } - return FALSE; + return sal_False; } -UCBStorage::UCBStorage( SvStream& rStrm, BOOL bDirect ) +UCBStorage::UCBStorage( SvStream& rStrm, sal_Bool bDirect ) { String aURL = GetLinkedFile( rStrm ); if ( aURL.Len() ) @@ -1640,7 +1640,7 @@ UCBStorage::UCBStorage( SvStream& rStrm, BOOL bDirect ) nMode = STREAM_READ | STREAM_WRITE; ::ucbhelper::Content aContent( aURL, Reference < XCommandEnvironment >() ); - pImp = new UCBStorage_Impl( aContent, aURL, nMode, this, bDirect, TRUE ); + pImp = new UCBStorage_Impl( aContent, aURL, nMode, this, bDirect, sal_True ); } else { @@ -1654,7 +1654,7 @@ UCBStorage::UCBStorage( SvStream& rStrm, BOOL bDirect ) StorageBase::m_nMode = pImp->m_nMode; } -UCBStorage::UCBStorage( const ::ucbhelper::Content& rContent, const String& rName, StreamMode nMode, BOOL bDirect, BOOL bIsRoot ) +UCBStorage::UCBStorage( const ::ucbhelper::Content& rContent, const String& rName, StreamMode nMode, sal_Bool bDirect, sal_Bool bIsRoot ) { // pImp must be initialized in the body, because otherwise the vtable of the stream is not initialized // to class UCBStorage ! @@ -1664,7 +1664,7 @@ UCBStorage::UCBStorage( const ::ucbhelper::Content& rContent, const String& rNam StorageBase::m_nMode = pImp->m_nMode; } -UCBStorage::UCBStorage( const String& rName, StreamMode nMode, BOOL bDirect, BOOL bIsRoot, BOOL bIsRepair, Reference< XProgressHandler > xProgressHandler ) +UCBStorage::UCBStorage( const String& rName, StreamMode nMode, sal_Bool bDirect, sal_Bool bIsRoot, sal_Bool bIsRepair, Reference< XProgressHandler > xProgressHandler ) { // pImp must be initialized in the body, because otherwise the vtable of the stream is not initialized // to class UCBStorage ! @@ -1674,7 +1674,7 @@ UCBStorage::UCBStorage( const String& rName, StreamMode nMode, BOOL bDirect, BOO StorageBase::m_nMode = pImp->m_nMode; } -UCBStorage::UCBStorage( const String& rName, StreamMode nMode, BOOL bDirect, BOOL bIsRoot ) +UCBStorage::UCBStorage( const String& rName, StreamMode nMode, sal_Bool bDirect, sal_Bool bIsRoot ) { // pImp must be initialized in the body, because otherwise the vtable of the stream is not initialized // to class UCBStorage ! @@ -1703,7 +1703,7 @@ UCBStorage::~UCBStorage() pImp->ReleaseRef(); } -UCBStorage_Impl::UCBStorage_Impl( const ::ucbhelper::Content& rContent, const String& rName, StreamMode nMode, UCBStorage* pStorage, BOOL bDirect, BOOL bIsRoot, BOOL bIsRepair, Reference< XProgressHandler > xProgressHandler ) +UCBStorage_Impl::UCBStorage_Impl( const ::ucbhelper::Content& rContent, const String& rName, StreamMode nMode, UCBStorage* pStorage, sal_Bool bDirect, sal_Bool bIsRoot, sal_Bool bIsRepair, Reference< XProgressHandler > xProgressHandler ) : m_pAntiImpl( pStorage ) , m_pContent( new ::ucbhelper::Content( rContent ) ) , m_pTempFile( NULL ) @@ -1711,13 +1711,13 @@ UCBStorage_Impl::UCBStorage_Impl( const ::ucbhelper::Content& rContent, const St //, m_pStream( NULL ) , m_nError( 0 ) , m_nMode( nMode ) - , m_bModified( FALSE ) - , m_bCommited( FALSE ) + , m_bModified( sal_False ) + , m_bCommited( sal_False ) , m_bDirect( bDirect ) , m_bIsRoot( bIsRoot ) - , m_bDirty( FALSE ) - , m_bIsLinked( TRUE ) - , m_bListCreated( FALSE ) + , m_bDirty( sal_False ) + , m_bIsLinked( sal_True ) + , m_bListCreated( sal_False ) , m_nFormat( 0 ) , m_aClassId( SvGlobalName() ) , m_bRepairPackage( bIsRepair ) @@ -1731,14 +1731,14 @@ UCBStorage_Impl::UCBStorage_Impl( const ::ucbhelper::Content& rContent, const St // no name given = use temporary name! DBG_ASSERT( m_bIsRoot, "SubStorage must have a name!" ); m_pTempFile = new ::utl::TempFile; - m_pTempFile->EnableKillingFile( TRUE ); + m_pTempFile->EnableKillingFile( sal_True ); m_aName = m_aOriginalName = aName = m_pTempFile->GetURL(); } m_aURL = rName; } -UCBStorage_Impl::UCBStorage_Impl( const String& rName, StreamMode nMode, UCBStorage* pStorage, BOOL bDirect, BOOL bIsRoot, BOOL bIsRepair, Reference< XProgressHandler > xProgressHandler ) +UCBStorage_Impl::UCBStorage_Impl( const String& rName, StreamMode nMode, UCBStorage* pStorage, sal_Bool bDirect, sal_Bool bIsRoot, sal_Bool bIsRepair, Reference< XProgressHandler > xProgressHandler ) : m_pAntiImpl( pStorage ) , m_pContent( NULL ) , m_pTempFile( NULL ) @@ -1746,13 +1746,13 @@ UCBStorage_Impl::UCBStorage_Impl( const String& rName, StreamMode nMode, UCBStor //, m_pStream( NULL ) , m_nError( 0 ) , m_nMode( nMode ) - , m_bModified( FALSE ) - , m_bCommited( FALSE ) + , m_bModified( sal_False ) + , m_bCommited( sal_False ) , m_bDirect( bDirect ) , m_bIsRoot( bIsRoot ) - , m_bDirty( FALSE ) - , m_bIsLinked( FALSE ) - , m_bListCreated( FALSE ) + , m_bDirty( sal_False ) + , m_bIsLinked( sal_False ) + , m_bListCreated( sal_False ) , m_nFormat( 0 ) , m_aClassId( SvGlobalName() ) , m_bRepairPackage( bIsRepair ) @@ -1765,7 +1765,7 @@ UCBStorage_Impl::UCBStorage_Impl( const String& rName, StreamMode nMode, UCBStor // no name given = use temporary name! DBG_ASSERT( m_bIsRoot, "SubStorage must have a name!" ); m_pTempFile = new ::utl::TempFile; - m_pTempFile->EnableKillingFile( TRUE ); + m_pTempFile->EnableKillingFile( sal_True ); m_aName = m_aOriginalName = aName = m_pTempFile->GetURL(); } @@ -1788,31 +1788,31 @@ UCBStorage_Impl::UCBStorage_Impl( const String& rName, StreamMode nMode, UCBStor // substorages are opened like streams: the URL is a "child URL" of the root package URL m_aURL = rName; if ( m_aURL.CompareToAscii( "vnd.sun.star.pkg://", 19 ) != 0 ) - m_bIsLinked = TRUE; + m_bIsLinked = sal_True; } } -UCBStorage_Impl::UCBStorage_Impl( SvStream& rStream, UCBStorage* pStorage, BOOL bDirect ) +UCBStorage_Impl::UCBStorage_Impl( SvStream& rStream, UCBStorage* pStorage, sal_Bool bDirect ) : m_pAntiImpl( pStorage ) , m_pContent( NULL ) , m_pTempFile( new ::utl::TempFile ) , m_pSource( &rStream ) , m_nError( 0 ) - , m_bModified( FALSE ) - , m_bCommited( FALSE ) + , m_bModified( sal_False ) + , m_bCommited( sal_False ) , m_bDirect( bDirect ) - , m_bIsRoot( TRUE ) - , m_bDirty( FALSE ) - , m_bIsLinked( FALSE ) - , m_bListCreated( FALSE ) + , m_bIsRoot( sal_True ) + , m_bDirty( sal_False ) + , m_bIsLinked( sal_False ) + , m_bListCreated( sal_False ) , m_nFormat( 0 ) , m_aClassId( SvGlobalName() ) - , m_bRepairPackage( FALSE ) + , m_bRepairPackage( sal_False ) , m_pUNOStorageHolderList( NULL ) { // opening in direct mode is too fuzzy because the data is transferred to the stream in the Commit() call, // which will be called in the storages' dtor - m_pTempFile->EnableKillingFile( TRUE ); + m_pTempFile->EnableKillingFile( sal_True ); DBG_ASSERT( !bDirect, "Storage on a stream must not be opened in direct mode!" ); // UCBStorages work on a content, so a temporary file for a content must be created, even if the stream is only @@ -1973,7 +1973,7 @@ void UCBStorage_Impl::ReadContent() if ( m_bListCreated ) return; - m_bListCreated = TRUE; + m_bListCreated = sal_True; // create cursor for access to children Sequence< ::rtl::OUString > aProps(4); @@ -2011,9 +2011,9 @@ void UCBStorage_Impl::ReadContent() aContentType = xRow->getString(3); } - BOOL bIsFolder( xRow->getBoolean(2) ); + sal_Bool bIsFolder( xRow->getBoolean(2) ); sal_Int64 nSize = xRow->getLong(4); - UCBStorageElement_Impl* pElement = new UCBStorageElement_Impl( aTitle, bIsFolder, (ULONG) nSize ); + UCBStorageElement_Impl* pElement = new UCBStorageElement_Impl( aTitle, bIsFolder, (sal_uIntPtr) nSize ); m_aChildrenList.Insert( pElement, LIST_APPEND ); sal_Bool bIsOfficeDocument = m_bIsLinked || ( m_aClassId != SvGlobalName() ); @@ -2044,13 +2044,13 @@ void UCBStorage_Impl::ReadContent() ::rtl::OUString aMediaType; Any aAny = aContent.getPropertyValue( ::rtl::OUString::createFromAscii( "MediaType" ) ); if ( ( aAny >>= aMediaType ) && ( aMediaType.compareToAscii("application/vnd.sun.star.oleobject") == 0 ) ) - pElement->m_bIsStorage = TRUE; + pElement->m_bIsStorage = sal_True; else if ( !aMediaType.getLength() ) { // older files didn't have that special content type, so they must be detected OpenStream( pElement, STREAM_STD_READ, m_bDirect ); if ( Storage::IsStorageFile( pElement->m_xStream ) ) - pElement->m_bIsStorage = TRUE; + pElement->m_bIsStorage = sal_True; else pElement->m_xStream->Free(); } @@ -2118,7 +2118,7 @@ sal_Int32 UCBStorage_Impl::GetObjectCount() ::rtl::OUString Find_Impl( const Sequence < Sequence < PropertyValue > >& rSequence, const ::rtl::OUString& rPath ) { - BOOL bFound = FALSE; + sal_Bool bFound = sal_False; for ( sal_Int32 nSeqs=0; nSeqs<rSequence.getLength(); nSeqs++ ) { const Sequence < PropertyValue >& rMyProps = rSequence[nSeqs]; @@ -2131,7 +2131,7 @@ sal_Int32 UCBStorage_Impl::GetObjectCount() { rtl::OUString aTmp; if ( ( rAny.Value >>= aTmp ) && aTmp == rPath ) - bFound = TRUE; + bFound = sal_True; if ( aType.getLength() ) break; } @@ -2269,11 +2269,11 @@ UCBStorage_Impl::~UCBStorage_Impl() delete m_pTempFile; } -BOOL UCBStorage_Impl::Insert( ::ucbhelper::Content *pContent ) +sal_Bool UCBStorage_Impl::Insert( ::ucbhelper::Content *pContent ) { // a new substorage is inserted into a UCBStorage ( given by the parameter pContent ) // it must be inserted with a title and a type - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; try { @@ -2310,7 +2310,7 @@ BOOL UCBStorage_Impl::Insert( ::ucbhelper::Content *pContent ) // remove old content, create an "empty" new one and initialize it with the new inserted DELETEZ( m_pContent ); m_pContent = new ::ucbhelper::Content( aNewFolder ); - bRet = TRUE; + bRet = sal_True; } } } @@ -2349,11 +2349,11 @@ sal_Int16 UCBStorage_Impl::Commit() while ( pElement && nRet ) { ::ucbhelper::Content* pContent = pElement->GetContent(); - BOOL bDeleteContent = FALSE; + sal_Bool bDeleteContent = sal_False; if ( !pContent && pElement->IsModified() ) { // if the element has never been opened, no content has been created until now - bDeleteContent = TRUE; // remember to delete it later + bDeleteContent = sal_True; // remember to delete it later String aName( m_aURL ); aName += '/'; aName += pElement->m_aOriginalName; @@ -2401,7 +2401,7 @@ sal_Int16 UCBStorage_Impl::Commit() // OLE storage should be stored encrytped, if the storage uses encryption pElement->m_xStream->m_aContentType = String::CreateFromAscii("application/vnd.sun.star.oleobject"); Any aValue; - aValue <<= (BOOL) TRUE; + aValue <<= (sal_Bool) sal_True; pElement->m_xStream->m_pContent->setPropertyValue(String::CreateFromAscii("Encrypted"), aValue ); } @@ -2483,7 +2483,7 @@ sal_Int16 UCBStorage_Impl::Commit() // write a manifest file // first create a subfolder "META-inf" Content aNewSubFolder; - BOOL bRet = ::utl::UCBContentHelper::MakeFolder( *m_pContent, String::CreateFromAscii("META-INF"), aNewSubFolder ); + sal_Bool bRet = ::utl::UCBContentHelper::MakeFolder( *m_pContent, String::CreateFromAscii("META-INF"), aNewSubFolder ); if ( bRet ) { // create a stream to write the manifest file - use a temp file @@ -2584,7 +2584,7 @@ sal_Int16 UCBStorage_Impl::Commit() // after successfull root commit all elements names and types are adjusted and all removed elements // are also removed from the lists UCBStorageElement_Impl* pInnerElement = m_aChildrenList.First(); - BOOL bRet = TRUE; + sal_Bool bRet = sal_True; while ( pInnerElement && bRet ) { UCBStorageElement_Impl* pNext = m_aChildrenList.Next(); @@ -2596,26 +2596,26 @@ sal_Int16 UCBStorage_Impl::Commit() else { pInnerElement->m_aOriginalName = pInnerElement->m_aName; - pInnerElement->m_bIsInserted = FALSE; + pInnerElement->m_bIsInserted = sal_False; } pInnerElement = pNext; } } - m_bCommited = FALSE; + m_bCommited = sal_False; } return nRet; } -BOOL UCBStorage_Impl::Revert() +sal_Bool UCBStorage_Impl::Revert() { UCBStorageElement_Impl* pElement = m_aChildrenList.First(); - BOOL bRet = TRUE; + sal_Bool bRet = sal_True; while ( pElement && bRet ) { - pElement->m_bIsRemoved = FALSE; + pElement->m_bIsRemoved = sal_False; if ( pElement->m_bIsInserted ) { m_aChildrenList.Remove( pElement ); // correct usage of list ??? @@ -2634,7 +2634,7 @@ BOOL UCBStorage_Impl::Revert() } pElement->m_aName = pElement->m_aOriginalName; - pElement->m_bIsRemoved = FALSE; + pElement->m_bIsRemoved = sal_False; } pElement = m_aChildrenList.Next(); @@ -2648,17 +2648,17 @@ const String& UCBStorage::GetName() const return pImp->m_aName; // pImp->m_aURL ?! } -BOOL UCBStorage::IsRoot() const +sal_Bool UCBStorage::IsRoot() const { return pImp->m_bIsRoot; } void UCBStorage::SetDirty() { - pImp->m_bDirty = TRUE; + pImp->m_bDirty = sal_True; } -void UCBStorage::SetClass( const SvGlobalName & rClass, ULONG nOriginalClipFormat, const String & rUserTypeName ) +void UCBStorage::SetClass( const SvGlobalName & rClass, sal_uIntPtr nOriginalClipFormat, const String & rUserTypeName ) { pImp->m_aClassId = rClass; pImp->m_nFormat = nOriginalClipFormat; @@ -2697,15 +2697,15 @@ const ClsId& UCBStorage::GetClassId() const return ( const ClsId& ) pImp->m_aClassId.GetCLSID(); } -void UCBStorage::SetConvertClass( const SvGlobalName & /*rConvertClass*/, ULONG /*nOriginalClipFormat*/, const String & /*rUserTypeName*/ ) +void UCBStorage::SetConvertClass( const SvGlobalName & /*rConvertClass*/, sal_uIntPtr /*nOriginalClipFormat*/, const String & /*rUserTypeName*/ ) { // ??? } -BOOL UCBStorage::ShouldConvert() +sal_Bool UCBStorage::ShouldConvert() { // ??? - return FALSE; + return sal_False; } SvGlobalName UCBStorage::GetClassName() @@ -2713,7 +2713,7 @@ SvGlobalName UCBStorage::GetClassName() return pImp->m_aClassId; } -ULONG UCBStorage::GetFormat() +sal_uIntPtr UCBStorage::GetFormat() { return pImp->m_nFormat; } @@ -2733,7 +2733,7 @@ void UCBStorage::FillInfoList( SvStorageInfoList* pList ) const if ( !pElement->m_bIsRemoved ) { // problem: what about the size of a substorage ?! - ULONG nSize = pElement->m_nSize; + sal_uIntPtr nSize = pElement->m_nSize; if ( pElement->m_xStream.Is() ) nSize = pElement->m_xStream->GetSize(); SvStorageInfo aInfo( pElement->m_aName, nSize, pElement->m_bIsStorage ); @@ -2744,7 +2744,7 @@ void UCBStorage::FillInfoList( SvStorageInfoList* pList ) const } } -BOOL UCBStorage::CopyStorageElement_Impl( UCBStorageElement_Impl& rElement, BaseStorage* pDest, const String& rNew ) const +sal_Bool UCBStorage::CopyStorageElement_Impl( UCBStorageElement_Impl& rElement, BaseStorage* pDest, const String& rNew ) const { // insert stream or storage into the list or stream of the destination storage // not into the content, this will be done on commit ! @@ -2755,7 +2755,7 @@ BOOL UCBStorage::CopyStorageElement_Impl( UCBStorageElement_Impl& rElement, Base // the destination stream must not be open BaseStorageStream* pOtherStream = pDest->OpenStream( rNew, STREAM_WRITE | STREAM_SHARE_DENYALL, pImp->m_bDirect ); BaseStorageStream* pStream = NULL; - BOOL bDeleteStream = FALSE; + sal_Bool bDeleteStream = sal_False; // if stream is already open, it is allowed to copy it, so be aware of this if ( rElement.m_xStream.Is() ) @@ -2763,7 +2763,7 @@ BOOL UCBStorage::CopyStorageElement_Impl( UCBStorageElement_Impl& rElement, Base if ( !pStream ) { pStream = ( const_cast < UCBStorage* > (this) )->OpenStream( rElement.m_aName, STREAM_STD_READ, pImp->m_bDirect ); - bDeleteStream = TRUE; + bDeleteStream = sal_True; } pStream->CopyTo( pOtherStream ); @@ -2784,19 +2784,19 @@ BOOL UCBStorage::CopyStorageElement_Impl( UCBStorageElement_Impl& rElement, Base BaseStorage* pStorage = NULL; // if stream is already open, it is allowed to copy it, so be aware of this - BOOL bDeleteStorage = FALSE; + sal_Bool bDeleteStorage = sal_False; if ( rElement.m_xStorage.Is() ) pStorage = rElement.m_xStorage->m_pAntiImpl; if ( !pStorage ) { pStorage = ( const_cast < UCBStorage* > (this) )->OpenStorage( rElement.m_aName, pImp->m_nMode, pImp->m_bDirect ); - bDeleteStorage = TRUE; + bDeleteStorage = sal_True; } UCBStorage* pUCBDest = PTR_CAST( UCBStorage, pDest ); UCBStorage* pUCBCopy = PTR_CAST( UCBStorage, pStorage ); - BOOL bOpenUCBStorage = pUCBDest && pUCBCopy; + sal_Bool bOpenUCBStorage = pUCBDest && pUCBCopy; BaseStorage* pOtherStorage = bOpenUCBStorage ? pDest->OpenUCBStorage( rNew, STREAM_WRITE | STREAM_SHARE_DENYALL, pImp->m_bDirect ) : pDest->OpenOLEStorage( rNew, STREAM_WRITE | STREAM_SHARE_DENYALL, pImp->m_bDirect ); @@ -2821,7 +2821,7 @@ BOOL UCBStorage::CopyStorageElement_Impl( UCBStorageElement_Impl& rElement, Base delete pOtherStorage; } - return BOOL( Good() && pDest->Good() ); + return sal_Bool( Good() && pDest->Good() ); } UCBStorageElement_Impl* UCBStorage::FindElement_Impl( const String& rName ) const @@ -2838,11 +2838,11 @@ UCBStorageElement_Impl* UCBStorage::FindElement_Impl( const String& rName ) cons return pElement; } -BOOL UCBStorage::CopyTo( BaseStorage* pDestStg ) const +sal_Bool UCBStorage::CopyTo( BaseStorage* pDestStg ) const { DBG_ASSERT( pDestStg != ((BaseStorage*)this), "Self-Copying is not possible!" ); if ( pDestStg == ((BaseStorage*)this) ) - return FALSE; + return sal_False; // perhaps it's also a problem if one storage is a parent of the other ?! // or if not: could be optimized ?! @@ -2856,7 +2856,7 @@ BOOL UCBStorage::CopyTo( BaseStorage* pDestStg ) const pDestStg->SetClassId( GetClassId() ); pDestStg->SetDirty(); - BOOL bRet = TRUE; + sal_Bool bRet = sal_True; UCBStorageElement_Impl* pElement = pImp->GetChildrenList().First(); while ( pElement && bRet ) { @@ -2867,18 +2867,18 @@ BOOL UCBStorage::CopyTo( BaseStorage* pDestStg ) const if( !bRet ) SetError( pDestStg->GetError() ); - return BOOL( Good() && pDestStg->Good() ); + return sal_Bool( Good() && pDestStg->Good() ); } -BOOL UCBStorage::CopyTo( const String& rElemName, BaseStorage* pDest, const String& rNew ) +sal_Bool UCBStorage::CopyTo( const String& rElemName, BaseStorage* pDest, const String& rNew ) { if( !rElemName.Len() ) - return FALSE; + return sal_False; if ( pDest == ((BaseStorage*) this) ) { // can't double an element - return FALSE; + return sal_False; } else { @@ -2889,28 +2889,28 @@ BOOL UCBStorage::CopyTo( const String& rElemName, BaseStorage* pDest, const Stri else { SetError( SVSTREAM_FILE_NOT_FOUND ); - return FALSE; + return sal_False; } } } -BOOL UCBStorage::Commit() +sal_Bool UCBStorage::Commit() { // mark this storage for sending it on root commit - pImp->m_bCommited = TRUE; + pImp->m_bCommited = sal_True; if ( pImp->m_bIsRoot ) // the root storage coordinates commiting by sending a Commit command to its content return ( pImp->Commit() != COMMIT_RESULT_FAILURE ); else - return TRUE; + return sal_True; } -BOOL UCBStorage::Revert() +sal_Bool UCBStorage::Revert() { return pImp->Revert(); } -BaseStorageStream* UCBStorage::OpenStream( const String& rEleName, StreamMode nMode, BOOL bDirect, const ByteString* pKey ) +BaseStorageStream* UCBStorage::OpenStream( const String& rEleName, StreamMode nMode, sal_Bool bDirect, const ByteString* pKey ) { if( !rEleName.Len() ) return NULL; @@ -2935,7 +2935,7 @@ BaseStorageStream* UCBStorage::OpenStream( const String& rEleName, StreamMode nM { // create a new UCBStorageElement and insert it into the list pElement = new UCBStorageElement_Impl( rEleName ); - pElement->m_bIsInserted = TRUE; + pElement->m_bIsInserted = sal_True; pImp->m_aChildrenList.Insert( pElement, LIST_APPEND ); } } @@ -2980,7 +2980,7 @@ BaseStorageStream* UCBStorage::OpenStream( const String& rEleName, StreamMode nM return NULL; } -UCBStorageStream_Impl* UCBStorage_Impl::OpenStream( UCBStorageElement_Impl* pElement, StreamMode nMode, BOOL bDirect, const ByteString* pKey ) +UCBStorageStream_Impl* UCBStorage_Impl::OpenStream( UCBStorageElement_Impl* pElement, StreamMode nMode, sal_Bool bDirect, const ByteString* pKey ) { String aName( m_aURL ); aName += '/'; @@ -2989,31 +2989,31 @@ UCBStorageStream_Impl* UCBStorage_Impl::OpenStream( UCBStorageElement_Impl* pEle return pElement->m_xStream; } -BaseStorage* UCBStorage::OpenUCBStorage( const String& rEleName, StreamMode nMode, BOOL bDirect ) +BaseStorage* UCBStorage::OpenUCBStorage( const String& rEleName, StreamMode nMode, sal_Bool bDirect ) { if( !rEleName.Len() ) return NULL; - return OpenStorage_Impl( rEleName, nMode, bDirect, TRUE ); + return OpenStorage_Impl( rEleName, nMode, bDirect, sal_True ); } -BaseStorage* UCBStorage::OpenOLEStorage( const String& rEleName, StreamMode nMode, BOOL bDirect ) +BaseStorage* UCBStorage::OpenOLEStorage( const String& rEleName, StreamMode nMode, sal_Bool bDirect ) { if( !rEleName.Len() ) return NULL; - return OpenStorage_Impl( rEleName, nMode, bDirect, FALSE ); + return OpenStorage_Impl( rEleName, nMode, bDirect, sal_False ); } -BaseStorage* UCBStorage::OpenStorage( const String& rEleName, StreamMode nMode, BOOL bDirect ) +BaseStorage* UCBStorage::OpenStorage( const String& rEleName, StreamMode nMode, sal_Bool bDirect ) { if( !rEleName.Len() ) return NULL; - return OpenStorage_Impl( rEleName, nMode, bDirect, TRUE ); + return OpenStorage_Impl( rEleName, nMode, bDirect, sal_True ); } -BaseStorage* UCBStorage::OpenStorage_Impl( const String& rEleName, StreamMode nMode, BOOL bDirect, BOOL bForceUCBStorage ) +BaseStorage* UCBStorage::OpenStorage_Impl( const String& rEleName, StreamMode nMode, sal_Bool bDirect, sal_Bool bForceUCBStorage ) { // try to find the storage element UCBStorageElement_Impl *pElement = FindElement_Impl( rEleName ); @@ -3026,8 +3026,8 @@ BaseStorage* UCBStorage::OpenStorage_Impl( const String& rEleName, StreamMode nM String aName( pImp->m_aURL ); aName += '/'; aName += rEleName; // ??? - UCBStorage *pStorage = new UCBStorage( aName, nMode, bDirect, FALSE, pImp->m_bRepairPackage, pImp->m_xProgressHandler ); - pStorage->pImp->m_bIsRoot = FALSE; + UCBStorage *pStorage = new UCBStorage( aName, nMode, bDirect, sal_False, pImp->m_bRepairPackage, pImp->m_xProgressHandler ); + pStorage->pImp->m_bIsRoot = sal_False; pStorage->pImp->m_bListCreated = sal_True; // the storage is pretty new, nothing to read pStorage->SetError( GetError() ); return pStorage; @@ -3037,7 +3037,7 @@ BaseStorage* UCBStorage::OpenStorage_Impl( const String& rEleName, StreamMode nM // problem: perhaps an OLEStorage should be created ?! // Because nothing is known about the element that should be created, an external parameter is needed ! pElement = new UCBStorageElement_Impl( rEleName ); - pElement->m_bIsInserted = TRUE; + pElement->m_bIsInserted = sal_True; pImp->m_aChildrenList.Insert( pElement, LIST_APPEND ); } @@ -3064,7 +3064,7 @@ BaseStorage* UCBStorage::OpenStorage_Impl( const String& rEleName, StreamMode nM pElement->m_xStream->PrepareCachedForReopen( nMode ); pElement->m_xStream->Init(); - pElement->m_bIsStorage = TRUE; + pElement->m_bIsStorage = sal_True; return pElement->m_xStream->CreateStorage(); // can only be created in transacted mode } else if ( pElement->m_xStorage.Is() ) @@ -3077,13 +3077,13 @@ BaseStorage* UCBStorage::OpenStorage_Impl( const String& rEleName, StreamMode nM } else { - BOOL bIsWritable = (( pElement->m_xStorage->m_nMode & STREAM_WRITE ) != 0); + sal_Bool bIsWritable = (( pElement->m_xStorage->m_nMode & STREAM_WRITE ) != 0); if ( !bIsWritable && (( nMode & STREAM_WRITE ) != 0 )) { String aName( pImp->m_aURL ); aName += '/'; aName += pElement->m_aOriginalName; - UCBStorage* pStorage = new UCBStorage( aName, nMode, bDirect, FALSE, pImp->m_bRepairPackage, pImp->m_xProgressHandler ); + UCBStorage* pStorage = new UCBStorage( aName, nMode, bDirect, sal_False, pImp->m_bRepairPackage, pImp->m_xProgressHandler ); pElement->m_xStorage = pStorage->pImp; return pStorage; } @@ -3097,7 +3097,7 @@ BaseStorage* UCBStorage::OpenStorage_Impl( const String& rEleName, StreamMode nM else if ( !pElement->m_xStream.Is() ) { // storage is opened the first time - BOOL bIsWritable = (( pImp->m_nMode & STREAM_WRITE ) != 0 ); + sal_Bool bIsWritable = (( pImp->m_nMode & STREAM_WRITE ) != 0 ); if ( pImp->m_bIsLinked && pImp->m_bIsRoot && bIsWritable ) { // make sure that the root storage object has been created before substorages will be created @@ -3107,7 +3107,7 @@ BaseStorage* UCBStorage::OpenStorage_Impl( const String& rEleName, StreamMode nM Content aFolder( aFolderObj.GetMainURL( INetURLObject::NO_DECODE ), Reference < XCommandEnvironment >() ); pImp->m_pContent = new Content; - BOOL bRet = ::utl::UCBContentHelper::MakeFolder( aFolder, pImp->m_aName, *pImp->m_pContent ); + sal_Bool bRet = ::utl::UCBContentHelper::MakeFolder( aFolder, pImp->m_aName, *pImp->m_pContent ); if ( !bRet ) { SetError( SVSTREAM_CANNOT_MAKE ); @@ -3128,31 +3128,31 @@ BaseStorage* UCBStorage::OpenStorage_Impl( const String& rEleName, StreamMode nM return NULL; } -UCBStorage_Impl* UCBStorage_Impl::OpenStorage( UCBStorageElement_Impl* pElement, StreamMode nMode, BOOL bDirect ) +UCBStorage_Impl* UCBStorage_Impl::OpenStorage( UCBStorageElement_Impl* pElement, StreamMode nMode, sal_Bool bDirect ) { UCBStorage_Impl* pRet = NULL; String aName( m_aURL ); aName += '/'; aName += pElement->m_aOriginalName; // ??? - pElement->m_bIsStorage = pElement->m_bIsFolder = TRUE; + pElement->m_bIsStorage = pElement->m_bIsFolder = sal_True; if ( m_bIsLinked && !::utl::UCBContentHelper::Exists( aName ) ) { Content aNewFolder; - BOOL bRet = ::utl::UCBContentHelper::MakeFolder( *m_pContent, pElement->m_aOriginalName, aNewFolder ); + sal_Bool bRet = ::utl::UCBContentHelper::MakeFolder( *m_pContent, pElement->m_aOriginalName, aNewFolder ); if ( bRet ) - pRet = new UCBStorage_Impl( aNewFolder, aName, nMode, NULL, bDirect, FALSE, m_bRepairPackage, m_xProgressHandler ); + pRet = new UCBStorage_Impl( aNewFolder, aName, nMode, NULL, bDirect, sal_False, m_bRepairPackage, m_xProgressHandler ); } else { - pRet = new UCBStorage_Impl( aName, nMode, NULL, bDirect, FALSE, m_bRepairPackage, m_xProgressHandler ); + pRet = new UCBStorage_Impl( aName, nMode, NULL, bDirect, sal_False, m_bRepairPackage, m_xProgressHandler ); } if ( pRet ) { pRet->m_bIsLinked = m_bIsLinked; - pRet->m_bIsRoot = FALSE; + pRet->m_bIsRoot = sal_False; // if name has been changed before creating the stream: set name! pRet->m_aName = pElement->m_aOriginalName; @@ -3165,41 +3165,41 @@ UCBStorage_Impl* UCBStorage_Impl::OpenStorage( UCBStorageElement_Impl* pElement, return pRet; } -BOOL UCBStorage::IsStorage( const String& rEleName ) const +sal_Bool UCBStorage::IsStorage( const String& rEleName ) const { if( !rEleName.Len() ) - return FALSE; + return sal_False; const UCBStorageElement_Impl *pElement = FindElement_Impl( rEleName ); return ( pElement && pElement->m_bIsStorage ); } -BOOL UCBStorage::IsStream( const String& rEleName ) const +sal_Bool UCBStorage::IsStream( const String& rEleName ) const { if( !rEleName.Len() ) - return FALSE; + return sal_False; const UCBStorageElement_Impl *pElement = FindElement_Impl( rEleName ); return ( pElement && !pElement->m_bIsStorage ); } -BOOL UCBStorage::IsContained( const String & rEleName ) const +sal_Bool UCBStorage::IsContained( const String & rEleName ) const { if( !rEleName.Len() ) - return FALSE; + return sal_False; const UCBStorageElement_Impl *pElement = FindElement_Impl( rEleName ); return ( pElement != NULL ); } -BOOL UCBStorage::Remove( const String& rEleName ) +sal_Bool UCBStorage::Remove( const String& rEleName ) { if( !rEleName.Len() ) - return FALSE; + return sal_False; UCBStorageElement_Impl *pElement = FindElement_Impl( rEleName ); if ( pElement ) { - pElement->m_bIsRemoved = TRUE; + pElement->m_bIsRemoved = sal_True; } else SetError( SVSTREAM_FILE_NOT_FOUND ); @@ -3207,16 +3207,16 @@ BOOL UCBStorage::Remove( const String& rEleName ) return ( pElement != NULL ); } -BOOL UCBStorage::Rename( const String& rEleName, const String& rNewName ) +sal_Bool UCBStorage::Rename( const String& rEleName, const String& rNewName ) { if( !rEleName.Len()|| !rNewName.Len() ) - return FALSE; + return sal_False; UCBStorageElement_Impl *pAlreadyExisting = FindElement_Impl( rNewName ); if ( pAlreadyExisting ) { SetError( SVSTREAM_ACCESS_DENIED ); - return FALSE; // can't change to a name that is already used + return sal_False; // can't change to a name that is already used } UCBStorageElement_Impl *pElement = FindElement_Impl( rEleName ); @@ -3230,10 +3230,10 @@ BOOL UCBStorage::Rename( const String& rEleName, const String& rNewName ) return pElement != NULL; } -BOOL UCBStorage::MoveTo( const String& rEleName, BaseStorage* pNewSt, const String& rNewName ) +sal_Bool UCBStorage::MoveTo( const String& rEleName, BaseStorage* pNewSt, const String& rNewName ) { if( !rEleName.Len() || !rNewName.Len() ) - return FALSE; + return sal_False; if ( pNewSt == ((BaseStorage*) this) && !FindElement_Impl( rNewName ) ) { @@ -3257,31 +3257,31 @@ BOOL UCBStorage::MoveTo( const String& rEleName, BaseStorage* pNewSt, const Stri } */ // MoveTo is done by first copying to the new destination and then removing the old element - BOOL bRet = CopyTo( rEleName, pNewSt, rNewName ); + sal_Bool bRet = CopyTo( rEleName, pNewSt, rNewName ); if ( bRet ) bRet = Remove( rEleName ); return bRet; } } -BOOL UCBStorage::ValidateFAT() +sal_Bool UCBStorage::ValidateFAT() { // ??? - return TRUE; + return sal_True; } -BOOL UCBStorage::Validate( BOOL bWrite ) const +sal_Bool UCBStorage::Validate( sal_Bool bWrite ) const { // ??? return ( !bWrite || ( pImp->m_nMode & STREAM_WRITE ) ); } -BOOL UCBStorage::ValidateMode( StreamMode m ) const +sal_Bool UCBStorage::ValidateMode( StreamMode m ) const { // ??? if( m == ( STREAM_READ | STREAM_TRUNC ) ) // from stg.cxx - return TRUE; - USHORT nCurMode = 0xFFFF; + return sal_True; + sal_uInt16 nCurMode = 0xFFFF; if( ( m & 3 ) == STREAM_READ ) { // only SHARE_DENYWRITE or SHARE_DENYALL allowed @@ -3289,7 +3289,7 @@ BOOL UCBStorage::ValidateMode( StreamMode m ) const && ( nCurMode & STREAM_SHARE_DENYWRITE ) ) || ( ( m & STREAM_SHARE_DENYALL ) && ( nCurMode & STREAM_SHARE_DENYALL ) ) ) - return TRUE; + return sal_True; } else { @@ -3298,10 +3298,10 @@ BOOL UCBStorage::ValidateMode( StreamMode m ) const // the commit may fail if( ( m & STREAM_SHARE_DENYALL ) && ( nCurMode & STREAM_SHARE_DENYALL ) ) - return TRUE; + return sal_True; } - return TRUE; + return sal_True; } const SvStream* UCBStorage::GetSvStream() const @@ -3311,13 +3311,13 @@ const SvStream* UCBStorage::GetSvStream() const return pImp->m_pSource; } -BOOL UCBStorage::Equals( const BaseStorage& rStorage ) const +sal_Bool UCBStorage::Equals( const BaseStorage& rStorage ) const { // ??? return ((BaseStorage*)this) == &rStorage; } -BOOL UCBStorage::IsStorageFile( const String& rFileName ) +sal_Bool UCBStorage::IsStorageFile( const String& rFileName ) { String aFileURL = rFileName; INetURLObject aObj( aFileURL ); @@ -3329,27 +3329,27 @@ BOOL UCBStorage::IsStorageFile( const String& rFileName ) } SvStream * pStm = ::utl::UcbStreamHelper::CreateStream( aFileURL, STREAM_STD_READ ); - BOOL bRet = UCBStorage::IsStorageFile( pStm ); + sal_Bool bRet = UCBStorage::IsStorageFile( pStm ); delete pStm; return bRet; } -BOOL UCBStorage::IsStorageFile( SvStream* pFile ) +sal_Bool UCBStorage::IsStorageFile( SvStream* pFile ) { if ( !pFile ) - return FALSE; + return sal_False; - ULONG nPos = pFile->Tell(); + sal_uIntPtr nPos = pFile->Tell(); pFile->Seek( STREAM_SEEK_TO_END ); if ( pFile->Tell() < 4 ) - return FALSE; + return sal_False; pFile->Seek(0); - UINT32 nBytes; + sal_uInt32 nBytes; *pFile >> nBytes; // search for the magic bytes - BOOL bRet = ( nBytes == 0x04034b50 ); + sal_Bool bRet = ( nBytes == 0x04034b50 ); if ( !bRet ) { // disk spanned file have an additional header in front of the usual one @@ -3365,22 +3365,22 @@ BOOL UCBStorage::IsStorageFile( SvStream* pFile ) return bRet; } -BOOL UCBStorage::IsDiskSpannedFile( SvStream* pFile ) +sal_Bool UCBStorage::IsDiskSpannedFile( SvStream* pFile ) { if ( !pFile ) - return FALSE; + return sal_False; - ULONG nPos = pFile->Tell(); + sal_uIntPtr nPos = pFile->Tell(); pFile->Seek( STREAM_SEEK_TO_END ); if ( !pFile->Tell() ) - return FALSE; + return sal_False; pFile->Seek(0); - UINT32 nBytes; + sal_uInt32 nBytes; *pFile >> nBytes; // disk spanned file have an additional header in front of the usual one - BOOL bRet = ( nBytes == 0x08074b50 ); + sal_Bool bRet = ( nBytes == 0x08074b50 ); if ( bRet ) { *pFile >> nBytes; @@ -3394,13 +3394,13 @@ BOOL UCBStorage::IsDiskSpannedFile( SvStream* pFile ) String UCBStorage::GetLinkedFile( SvStream &rStream ) { String aString; - ULONG nPos = rStream.Tell(); + sal_uIntPtr nPos = rStream.Tell(); rStream.Seek( STREAM_SEEK_TO_END ); if ( !rStream.Tell() ) return aString; rStream.Seek(0); - UINT32 nBytes; + sal_uInt32 nBytes; rStream >> nBytes; if( nBytes == 0x04034b50 ) { @@ -3430,7 +3430,7 @@ String UCBStorage::CreateLinkFile( const String& rName ) SvStream* pStream = pTempFile->GetStream( STREAM_STD_READWRITE | STREAM_TRUNC ); // write header - *pStream << ( UINT32 ) 0x04034b50; + *pStream << ( sal_uInt32 ) 0x04034b50; // assemble a new folder name in the destination folder INetURLObject aObj( rName ); @@ -3441,7 +3441,7 @@ String UCBStorage::CreateLinkFile( const String& rName ) // create a folder and store its URL Content aFolder( aFolderURL, Reference < XCommandEnvironment >() ); Content aNewFolder; - BOOL bRet = ::utl::UCBContentHelper::MakeFolder( aFolder, aTitle, aNewFolder ); + sal_Bool bRet = ::utl::UCBContentHelper::MakeFolder( aFolder, aTitle, aNewFolder ); if ( !bRet ) { aFolderObj.insertName( aTitle ); @@ -3487,15 +3487,15 @@ String UCBStorage::CreateLinkFile( const String& rName ) return aURL; } - pTempFile->EnableKillingFile( TRUE ); + pTempFile->EnableKillingFile( sal_True ); delete pTempFile; return String(); } -BOOL UCBStorage::SetProperty( const String& rName, const ::com::sun::star::uno::Any& rValue ) +sal_Bool UCBStorage::SetProperty( const String& rName, const ::com::sun::star::uno::Any& rValue ) { if ( rName.CompareToAscii("Title") == COMPARE_EQUAL ) - return FALSE; + return sal_False; if ( rName.CompareToAscii("MediaType") == COMPARE_EQUAL ) { @@ -3509,38 +3509,38 @@ BOOL UCBStorage::SetProperty( const String& rName, const ::com::sun::star::uno:: if ( pImp->GetContent() ) { pImp->m_pContent->setPropertyValue( rName, rValue ); - return TRUE; + return sal_True; } } catch ( Exception& ) { } - return FALSE; + return sal_False; } -BOOL UCBStorage::GetProperty( const String& rName, ::com::sun::star::uno::Any& rValue ) +sal_Bool UCBStorage::GetProperty( const String& rName, ::com::sun::star::uno::Any& rValue ) { try { if ( pImp->GetContent() ) { rValue = pImp->m_pContent->getPropertyValue( rName ); - return TRUE; + return sal_True; } } catch ( Exception& ) { } - return FALSE; + return sal_False; } -BOOL UCBStorage::GetProperty( const String& rEleName, const String& rName, ::com::sun::star::uno::Any& rValue ) +sal_Bool UCBStorage::GetProperty( const String& rEleName, const String& rName, ::com::sun::star::uno::Any& rValue ) { UCBStorageElement_Impl *pEle = FindElement_Impl( rEleName ); if ( !pEle ) - return FALSE; + return sal_False; if ( !pEle->m_bIsFolder ) { @@ -3549,7 +3549,7 @@ BOOL UCBStorage::GetProperty( const String& rEleName, const String& rName, ::com if ( pEle->m_xStream->m_nError ) { pEle->m_xStream.Clear(); - return FALSE; + return sal_False; } try @@ -3557,7 +3557,7 @@ BOOL UCBStorage::GetProperty( const String& rEleName, const String& rName, ::com if ( pEle->m_xStream->m_pContent ) { rValue = pEle->m_xStream->m_pContent->getPropertyValue( rName ); - return TRUE; + return sal_True; } } catch ( Exception& ) @@ -3571,7 +3571,7 @@ BOOL UCBStorage::GetProperty( const String& rEleName, const String& rName, ::com if ( pEle->m_xStorage->m_nError ) { pEle->m_xStorage.Clear(); - return FALSE; + return sal_False; } try @@ -3579,7 +3579,7 @@ BOOL UCBStorage::GetProperty( const String& rEleName, const String& rName, ::com if ( pEle->m_xStorage->GetContent() ) { rValue = pEle->m_xStorage->m_pContent->getPropertyValue( rName ); - return TRUE; + return sal_True; } } catch ( Exception& ) @@ -3587,7 +3587,7 @@ BOOL UCBStorage::GetProperty( const String& rEleName, const String& rName, ::com } } - return FALSE; + return sal_False; } UNOStorageHolderList* UCBStorage::GetUNOStorageHolderList() diff --git a/sot/source/sdstor/unostorageholder.cxx b/sot/source/sdstor/unostorageholder.cxx index 55c205557648..aa84ed0cf87c 100644 --- a/sot/source/sdstor/unostorageholder.cxx +++ b/sot/source/sdstor/unostorageholder.cxx @@ -133,7 +133,7 @@ void SAL_CALL UNOStorageHolder::commited( const lang::EventObject& /*aEvent*/ ) xComp->dispose(); - SotStorageRef rTempStorage = new SotStorage( TRUE, aTmpStorFile.GetURL(), STREAM_WRITE, STORAGE_TRANSACTED ); + SotStorageRef rTempStorage = new SotStorage( sal_True, aTmpStorFile.GetURL(), STREAM_WRITE, STORAGE_TRANSACTED ); if ( !rTempStorage.Is() || rTempStorage->GetError() != ERRCODE_NONE ) throw uno::RuntimeException(); |