diff options
author | Matthias Huetsch <mhu@openoffice.org> | 2001-03-13 20:07:32 +0000 |
---|---|---|
committer | Matthias Huetsch <mhu@openoffice.org> | 2001-03-13 20:07:32 +0000 |
commit | 36fcfd6774bd9695ebe0a1264cbb790be2eba24a (patch) | |
tree | 76df23f46fd1eba80658f1f499f9c0660047a057 /store | |
parent | d0378cade4e3a2065598f47e288ff4b4a90295a7 (diff) |
Major revision. Removed usage of module 'vos'.
Diffstat (limited to 'store')
-rw-r--r-- | store/source/filelckb.cxx | 69 | ||||
-rw-r--r-- | store/source/memlckb.cxx | 70 | ||||
-rw-r--r-- | store/source/object.cxx | 84 | ||||
-rw-r--r-- | store/source/storbase.cxx | 195 | ||||
-rw-r--r-- | store/source/storbase.hxx | 89 | ||||
-rw-r--r-- | store/source/storcach.cxx | 53 | ||||
-rw-r--r-- | store/source/storcach.hxx | 38 | ||||
-rw-r--r-- | store/source/stordata.cxx | 79 | ||||
-rw-r--r-- | store/source/stordata.hxx | 83 | ||||
-rw-r--r-- | store/source/store.cxx | 339 | ||||
-rw-r--r-- | store/source/storlckb.cxx | 132 | ||||
-rw-r--r-- | store/source/storlckb.hxx | 93 | ||||
-rw-r--r-- | store/source/stortree.cxx | 43 | ||||
-rw-r--r-- | store/source/stortree.hxx | 51 | ||||
-rw-r--r-- | store/util/makefile.mk | 8 |
15 files changed, 695 insertions, 731 deletions
diff --git a/store/source/filelckb.cxx b/store/source/filelckb.cxx index 8b1a742d9..a16042aca 100644 --- a/store/source/filelckb.cxx +++ b/store/source/filelckb.cxx @@ -2,9 +2,9 @@ * * $RCSfile: filelckb.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: mhu $ $Date: 2001-02-26 14:24:25 $ + * last change: $Author: mhu $ $Date: 2001-03-13 20:49:56 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -59,11 +59,14 @@ * ************************************************************************/ -#define _STORE_FILELCKB_CXX_ "$Revision: 1.2 $" +#define _STORE_FILELCKB_CXX_ "$Revision: 1.3 $" #ifndef _SAL_TYPES_H_ #include <sal/types.h> #endif +#ifndef _SAL_MACROS_H_ +#include <sal/macros.h> +#endif #ifndef _RTL_STRING_HXX_ #include <rtl/string.hxx> @@ -76,9 +79,6 @@ #include <osl/thread.h> #endif -#ifndef _STORE_MACROS_HXX_ -#include <store/macros.hxx> -#endif #ifndef _STORE_OBJECT_HXX_ #include <store/object.hxx> #endif @@ -93,10 +93,7 @@ #include <store/types.h> #endif -#ifdef _USE_NAMESPACE -using namespace rtl; using namespace store; -#endif /*======================================================================== * @@ -325,9 +322,8 @@ inline void OMappingDescriptor_Impl::cleanup (void) * OFileLockBytes_Impl interface. * *======================================================================*/ -#ifdef _USE_NAMESPACE -namespace store { -#endif +namespace store +{ class OFileLockBytes_Impl { @@ -379,9 +375,7 @@ public: storeError stat (sal_uInt32 &rnSize); }; -#ifdef _USE_NAMESPACE -} -#endif +} // namespace store /*======================================================================== * @@ -506,7 +500,7 @@ inline storeError OFileLockBytes_Impl::create ( inline storeError OFileLockBytes_Impl::create ( rtl_uString *pFilename, storeAccessMode eAccessMode) { - OString aFilename ( + rtl::OString aFilename ( pFilename->buffer, pFilename->length, osl_getThreadTextEncoding()); @@ -624,7 +618,7 @@ inline storeError OFileLockBytes_Impl::readAt ( if (!(nOffset < m_nSize)) return store_E_None; - nBytes = VOS_MIN(nOffset + nBytes, m_nSize) - nOffset; + nBytes = SAL_MIN(nOffset + nBytes, m_nSize) - nOffset; if (!(nBytes > 0)) return store_E_None; @@ -741,19 +735,13 @@ inline storeError OFileLockBytes_Impl::stat (sal_uInt32 &rnSize) * OFileLockBytes implementation. * *======================================================================*/ -VOS_IMPLEMENT_CLASSINFO( - VOS_CLASSNAME (OFileLockBytes, store), - VOS_NAMESPACE (OFileLockBytes, store), - VOS_NAMESPACE (OStoreObject, store), - 0); - /* * OFileLockBytes. */ OFileLockBytes::OFileLockBytes (void) { // Acquire exclusive access. - osl::Guard<osl::Mutex> aGuard (m_aMutex); + osl::MutexGuard aGuard (m_aMutex); m_pImpl = new OFileLockBytes_Impl(); } @@ -763,15 +751,14 @@ OFileLockBytes::OFileLockBytes (void) OFileLockBytes::~OFileLockBytes (void) { // Acquire exclusive access. - osl::Guard<osl::Mutex> aGuard (m_aMutex); + osl::MutexGuard aGuard (m_aMutex); delete m_pImpl; } /* * acquire. */ -NAMESPACE_VOS(IReference)::RefCount -SAL_CALL OFileLockBytes::acquire (void) +oslInterlockedCount SAL_CALL OFileLockBytes::acquire (void) { return OStoreObject::acquire(); } @@ -779,22 +766,12 @@ SAL_CALL OFileLockBytes::acquire (void) /* * release. */ -NAMESPACE_VOS(IReference)::RefCount -SAL_CALL OFileLockBytes::release (void) +oslInterlockedCount SAL_CALL OFileLockBytes::release (void) { return OStoreObject::release(); } /* - * referenced. - */ -NAMESPACE_VOS(IReference)::RefCount -SAL_CALL OFileLockBytes::referenced (void) const -{ - return OStoreObject::referenced(); -} - -/* * create. */ storeError OFileLockBytes::create ( @@ -802,7 +779,7 @@ storeError OFileLockBytes::create ( storeAccessMode eAccessMode) { // Acquire exclusive access. - osl::Guard<osl::Mutex> aGuard (m_aMutex); + osl::MutexGuard aGuard (m_aMutex); if (pFilename) return m_pImpl->create (pFilename, eAccessMode); @@ -823,7 +800,7 @@ storeError OFileLockBytes::readAt ( rnDone = 0; // Acquire exclusive access. - osl::Guard<osl::Mutex> aGuard (m_aMutex); + osl::MutexGuard aGuard (m_aMutex); if (m_pImpl->isValid()) return m_pImpl->readAt (nOffset, pBuffer, nBytes, rnDone); else @@ -843,7 +820,7 @@ storeError OFileLockBytes::writeAt ( rnDone = 0; // Acquire exclusive access. - osl::Guard<osl::Mutex> aGuard (m_aMutex); + osl::MutexGuard aGuard (m_aMutex); if (m_pImpl->isValid()) return m_pImpl->writeAt (nOffset, pBuffer, nBytes, rnDone); else @@ -856,7 +833,7 @@ storeError OFileLockBytes::writeAt ( storeError OFileLockBytes::flush (void) { // Acquire exclusive access. - osl::Guard<osl::Mutex> aGuard (m_aMutex); + osl::MutexGuard aGuard (m_aMutex); if (m_pImpl->isValid()) return m_pImpl->sync(); else @@ -869,7 +846,7 @@ storeError OFileLockBytes::flush (void) storeError OFileLockBytes::setSize (sal_uInt32 nSize) { // Acquire exclusive access. - osl::Guard<osl::Mutex> aGuard (m_aMutex); + osl::MutexGuard aGuard (m_aMutex); if (m_pImpl->isValid()) return m_pImpl->resize (nSize); else @@ -885,7 +862,7 @@ storeError OFileLockBytes::stat (sal_uInt32 &rnSize) rnSize = 0; // Acquire exclusive access. - osl::Guard<osl::Mutex> aGuard (m_aMutex); + osl::MutexGuard aGuard (m_aMutex); if (m_pImpl->isValid()) return m_pImpl->stat (rnSize); else @@ -899,7 +876,7 @@ storeError OFileLockBytes::lockRange ( sal_uInt32 nOffset, sal_uInt32 nBytes) { // Acquire exclusive access. - osl::Guard<osl::Mutex> aGuard (m_aMutex); + osl::MutexGuard aGuard (m_aMutex); if (m_pImpl->isValid()) return store_E_None; // E_Unsupported else @@ -913,7 +890,7 @@ storeError OFileLockBytes::unlockRange ( sal_uInt32 nOffset, sal_uInt32 nBytes) { // Acquire exclusive access. - osl::Guard<osl::Mutex> aGuard (m_aMutex); + osl::MutexGuard aGuard (m_aMutex); if (m_pImpl->isValid()) return store_E_None; // E_Unsupported else diff --git a/store/source/memlckb.cxx b/store/source/memlckb.cxx index c854179b7..dd7cdc5e8 100644 --- a/store/source/memlckb.cxx +++ b/store/source/memlckb.cxx @@ -2,9 +2,9 @@ * * $RCSfile: memlckb.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 15:18:32 $ + * last change: $Author: mhu $ $Date: 2001-03-13 20:49:56 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -54,16 +54,19 @@ * * All Rights Reserved. * - * Contributor(s): _______________________________________ + * Contributor(s): Matthias Huetsch <matthias.huetsch@sun.com> * * ************************************************************************/ -#define _STORE_MEMLCKB_CXX_ "$Revision: 1.1.1.1 $" +#define _STORE_MEMLCKB_CXX_ "$Revision: 1.2 $" #ifndef _SAL_TYPES_H_ #include <sal/types.h> #endif +#ifndef _SAL_MACROS_H_ +#include <sal/macros.h> +#endif #ifndef _RTL_ALLOC_H_ #include <rtl/alloc.h> @@ -72,13 +75,10 @@ #include <rtl/memory.h> #endif -#ifndef _VOS_MUTEX_HXX_ -#include <vos/mutex.hxx> +#ifndef _OSL_MUTEX_HXX_ +#include <osl/mutex.hxx> #endif -#ifndef _STORE_MACROS_HXX_ -#include <store/macros.hxx> -#endif #ifndef _STORE_OBJECT_HXX_ #include <store/object.hxx> #endif @@ -93,9 +93,7 @@ #include <store/types.h> #endif -#ifdef _USE_NAMESPACE using namespace store; -#endif /*======================================================================== * @@ -114,9 +112,8 @@ using namespace store; * OMemoryLockBytes_Impl interface. * *======================================================================*/ -#ifdef _USE_NAMESPACE -namespace store { -#endif +namespace store +{ class OMemoryLockBytes_Impl { @@ -143,9 +140,7 @@ public: storeError stat (sal_uInt32 &rnSize); }; -#ifdef _USE_NAMESPACE -} -#endif +} // namespace store /*======================================================================== * @@ -206,7 +201,7 @@ inline storeError OMemoryLockBytes_Impl::readAt ( if (!(nOffset < m_nSize)) return store_E_None; - nBytes = VOS_MIN(nOffset + nBytes, m_nSize) - nOffset; + nBytes = SAL_MIN(nOffset + nBytes, m_nSize) - nOffset; if (!(nBytes > 0)) return store_E_None; @@ -252,19 +247,13 @@ inline storeError OMemoryLockBytes_Impl::stat (sal_uInt32 &rnSize) * OMemoryLockBytes implementation. * *======================================================================*/ -VOS_IMPLEMENT_CLASSINFO( - VOS_CLASSNAME (OMemoryLockBytes, store), - VOS_NAMESPACE (OMemoryLockBytes, store), - VOS_NAMESPACE (OStoreObject, store), - 0); - /* * OMemoryLockBytes. */ OMemoryLockBytes::OMemoryLockBytes (void) { // Acquire exclusive access. - NAMESPACE_VOS(OGuard) aGuard (m_aMutex); + osl::MutexGuard aGuard (m_aMutex); m_pImpl = new OMemoryLockBytes_Impl(); } @@ -274,15 +263,14 @@ OMemoryLockBytes::OMemoryLockBytes (void) OMemoryLockBytes::~OMemoryLockBytes (void) { // Acquire exclusive access. - NAMESPACE_VOS(OGuard) aGuard (m_aMutex); + osl::MutexGuard aGuard (m_aMutex); delete m_pImpl; } /* * acquire. */ -NAMESPACE_VOS(IReference)::RefCount -SAL_CALL OMemoryLockBytes::acquire (void) +oslInterlockedCount SAL_CALL OMemoryLockBytes::acquire (void) { return OStoreObject::acquire(); } @@ -290,22 +278,12 @@ SAL_CALL OMemoryLockBytes::acquire (void) /* * release. */ -NAMESPACE_VOS(IReference)::RefCount -SAL_CALL OMemoryLockBytes::release (void) +oslInterlockedCount SAL_CALL OMemoryLockBytes::release (void) { return OStoreObject::release(); } /* - * referenced. - */ -NAMESPACE_VOS(IReference)::RefCount -SAL_CALL OMemoryLockBytes::referenced (void) const -{ - return OStoreObject::referenced(); -} - -/* * readAt. */ storeError OMemoryLockBytes::readAt ( @@ -318,7 +296,7 @@ storeError OMemoryLockBytes::readAt ( rnDone = 0; // Acquire exclusive access. - NAMESPACE_VOS(OGuard) aGuard (m_aMutex); + osl::MutexGuard aGuard (m_aMutex); return m_pImpl->readAt (nOffset, pBuffer, nBytes, rnDone); } @@ -335,7 +313,7 @@ storeError OMemoryLockBytes::writeAt ( rnDone = 0; // Acquire exclusive access. - NAMESPACE_VOS(OGuard) aGuard (m_aMutex); + osl::MutexGuard aGuard (m_aMutex); return m_pImpl->writeAt (nOffset, pBuffer, nBytes, rnDone); } @@ -345,7 +323,7 @@ storeError OMemoryLockBytes::writeAt ( storeError OMemoryLockBytes::flush (void) { // Acquire exclusive access. - NAMESPACE_VOS(OGuard) aGuard (m_aMutex); + osl::MutexGuard aGuard (m_aMutex); return store_E_None; } @@ -355,7 +333,7 @@ storeError OMemoryLockBytes::flush (void) storeError OMemoryLockBytes::setSize (sal_uInt32 nSize) { // Acquire exclusive access. - NAMESPACE_VOS(OGuard) aGuard (m_aMutex); + osl::MutexGuard aGuard (m_aMutex); return m_pImpl->resize (nSize); } @@ -368,7 +346,7 @@ storeError OMemoryLockBytes::stat (sal_uInt32 &rnSize) rnSize = 0; // Acquire exclusive access. - NAMESPACE_VOS(OGuard) aGuard (m_aMutex); + osl::MutexGuard aGuard (m_aMutex); return m_pImpl->stat (rnSize); } @@ -379,7 +357,7 @@ storeError OMemoryLockBytes::lockRange ( sal_uInt32 nOffset, sal_uInt32 nBytes) { // Acquire exclusive access. - NAMESPACE_VOS(OGuard) aGuard (m_aMutex); + osl::MutexGuard aGuard (m_aMutex); return store_E_None; // E_Unsupported } @@ -390,7 +368,7 @@ storeError OMemoryLockBytes::unlockRange ( sal_uInt32 nOffset, sal_uInt32 nBytes) { // Acquire exclusive access. - NAMESPACE_VOS(OGuard) aGuard (m_aMutex); + osl::MutexGuard aGuard (m_aMutex); return store_E_None; // E_Unsupported } diff --git a/store/source/object.cxx b/store/source/object.cxx index ac392409e..b32c92083 100644 --- a/store/source/object.cxx +++ b/store/source/object.cxx @@ -2,9 +2,9 @@ * * $RCSfile: object.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 15:18:32 $ + * last change: $Author: mhu $ $Date: 2001-03-13 20:49:56 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -54,43 +54,50 @@ * * All Rights Reserved. * - * Contributor(s): _______________________________________ + * Contributor(s): Matthias Huetsch <matthias.huetsch@sun.com> * * ************************************************************************/ -#define _STORE_OBJECT_CXX_ "$Revision: 1.1.1.1 $" +#define _STORE_OBJECT_CXX_ "$Revision: 1.2 $" #ifndef _SAL_TYPES_H_ #include <sal/types.h> #endif -#ifndef _STORE_MACROS_HXX_ -#include <store/macros.hxx> +#ifndef _RTL_ALLOC_H_ +#include <rtl/alloc.h> #endif +#ifndef _RTL_REF_HXX_ +#include <rtl/ref.hxx> +#endif + +#ifndef _OSL_DIAGNOSE_H_ +#include <osl/diagnose.h> +#endif +#ifndef _OSL_INTERLCK_H_ +#include <osl/interlck.h> +#endif + #ifndef _STORE_OBJECT_HXX_ #include <store/object.hxx> #endif -#ifdef _USE_NAMESPACE -using namespace store; -#endif +namespace store +{ /*======================================================================== * * OStoreObject implementation. * *======================================================================*/ -VOS_IMPLEMENT_CLASSINFO( - VOS_CLASSNAME (OStoreObject, store), - VOS_NAMESPACE (OStoreObject, store), - VOS_NAMESPACE (OObject, vos), - 0); +const sal_uInt32 OStoreObject::m_nTypeId = sal_uInt32(0x58190322); /* * OStoreObject. */ OStoreObject::OStoreObject (void) + : m_nRefCount (0) { } @@ -99,5 +106,54 @@ OStoreObject::OStoreObject (void) */ OStoreObject::~OStoreObject (void) { + OSL_ASSERT(m_nRefCount == 0); +} + +/* + * operator new. + */ +void* OStoreObject::operator new (size_t n) +{ + return rtl_allocateMemory (n); +} + +/* + * operator delete. + */ +void OStoreObject::operator delete (void *p) +{ + rtl_freeMemory (p); +} + +/* + * isKindOf. + */ +sal_Bool SAL_CALL OStoreObject::isKindOf (sal_uInt32 nTypeId) +{ + return (nTypeId == m_nTypeId); +} + +/* + * acquire. + */ +oslInterlockedCount SAL_CALL OStoreObject::acquire (void) +{ + oslInterlockedCount result = osl_incrementInterlockedCount (&m_nRefCount); + return (result); +} + +/* + * release. + */ +oslInterlockedCount SAL_CALL OStoreObject::release (void) +{ + oslInterlockedCount result = osl_decrementInterlockedCount (&m_nRefCount); + if (result == 0) + { + // Last reference released. + delete this; + } + return (result); } +} // namespace store diff --git a/store/source/storbase.cxx b/store/source/storbase.cxx index 11668669b..91e17d918 100644 --- a/store/source/storbase.cxx +++ b/store/source/storbase.cxx @@ -2,9 +2,9 @@ * * $RCSfile: storbase.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 15:18:32 $ + * last change: $Author: mhu $ $Date: 2001-03-13 20:54:25 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -54,15 +54,15 @@ * * All Rights Reserved. * - * Contributor(s): _______________________________________ + * Contributor(s): Matthias Huetsch <matthias.huetsch@sun.com> * * ************************************************************************/ -#define _STORE_STORBASE_CXX_ "$Revision: 1.1.1.1 $" +#define _STORE_STORBASE_CXX_ "$Revision: 1.2 $" -#ifndef __STL_USE_NEWALLOC -#define __STL_USE_NEWALLOC 1 +#ifndef __ALGORITHM__ +#include <algorithm> #endif #ifndef __UTILITY__ #include <utility> @@ -81,23 +81,23 @@ #ifndef _RTL_MEMORY_H_ #include <rtl/memory.h> #endif +#ifndef _RTL_REF_HXX_ +#include <rtl/ref.hxx> +#endif -#ifndef _VOS_DIAGNOSE_HXX_ -#include <vos/diagnose.hxx> +#ifndef _OSL_DIAGNOSE_H_ +#include <osl/diagnose.h> #endif -#ifndef _VOS_MUTEX_HXX_ -#include <vos/mutex.hxx> +#ifndef _OSL_ENDIAN_H_ +#include <osl/endian.h> #endif -#ifndef _VOS_REF_HXX_ -#include <vos/ref.hxx> +#ifndef _OSL_MUTEX_HXX_ +#include <osl/mutex.hxx> #endif #ifndef _STORE_TYPES_H_ #include <store/types.h> #endif -#ifndef _STORE_MACROS_HXX_ -#include <store/macros.hxx> -#endif #ifndef _STORE_OBJECT_HXX_ #include <store/object.hxx> #endif @@ -109,9 +109,7 @@ #include <storbase.hxx> #endif -#ifdef _USE_NAMESPACE using namespace store; -#endif /*======================================================================== * @@ -121,7 +119,7 @@ using namespace store; /* * CRC polynomial 0xEDB88320. */ -const sal_uInt32 NAMESPACE_STORE(OStorePageGuard)::m_pTable[] = +const sal_uInt32 store::OStorePageGuard::m_pTable[] = { /* 0 */ 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, @@ -396,10 +394,10 @@ struct OStoreSuperBlock m_aGuard.swap(); m_aDescr.swap(); - m_nMarked = VOS_SWAPDWORD(m_nMarked); + m_nMarked = OSL_SWAPDWORD(m_nMarked); m_aMarked.swap(); - m_nUnused = VOS_SWAPDWORD(m_nUnused); + m_nUnused = OSL_SWAPDWORD(m_nUnused); m_aUnused.swap(); #endif /* OSL_BIGENDIAN */ } @@ -412,7 +410,7 @@ struct OStoreSuperBlock nCRC32 = G::crc32 (nCRC32, &m_aGuard.m_nMagic, sizeof(sal_uInt32)); nCRC32 = G::crc32 (nCRC32, &m_aDescr, size() - sizeof(G)); #ifdef OSL_BIGENDIAN - nCRC32 = VOS_SWAPDWORD(nCRC32); + nCRC32 = OSL_SWAPDWORD(nCRC32); #endif /* OSL_BIGENDIAN */ m_aGuard.m_nCRC32 = nCRC32; } @@ -423,7 +421,7 @@ struct OStoreSuperBlock { sal_uInt32 nMagic = m_aGuard.m_nMagic; #ifdef OSL_BIGENDIAN - nMagic = VOS_SWAPDWORD(nMagic); + nMagic = OSL_SWAPDWORD(nMagic); #endif /* OSL_BIGENDIAN */ if (nMagic != STORE_MAGIC_SUPERBLOCK) store_E_WrongFormat; @@ -432,7 +430,7 @@ struct OStoreSuperBlock nCRC32 = G::crc32 (nCRC32, &m_aGuard.m_nMagic, sizeof(sal_uInt32)); nCRC32 = G::crc32 (nCRC32, &m_aDescr, size() - sizeof(G)); #ifdef OSL_BIGENDIAN - nCRC32 = VOS_SWAPDWORD(nCRC32); + nCRC32 = OSL_SWAPDWORD(nCRC32); #endif /* OSL_BIGENDIAN */ if (m_aGuard.m_nCRC32 != nCRC32) return store_E_InvalidChecksum; @@ -477,7 +475,7 @@ struct OStoreStateBlock void swap (void) { #ifdef OSL_BIGENDIAN - m_nState = VOS_SWAPDWORD(m_nState); + m_nState = OSL_SWAPDWORD(m_nState); #endif /* OSL_BIGENDIAN */ } @@ -516,9 +514,8 @@ struct OStoreStateBlock * OStoreSuperBlockPage interface. * *======================================================================*/ -#ifdef _USE_NAMESPACE -namespace store { -#endif +namespace store +{ struct OStoreSuperBlockPage { @@ -622,9 +619,7 @@ struct OStoreSuperBlockPage OStorePageBIOS &rBIOS); }; -#ifdef _USE_NAMESPACE -} -#endif +} // namespace store /*======================================================================== * @@ -825,7 +820,7 @@ storeError OStoreSuperBlockPage::verify (OStorePageBIOS &rBIOS) else { // Double Failure. - VOS_TRACE("OStoreSuperBlockPage::verify(): double failure.\n"); + OSL_TRACE("OStoreSuperBlockPage::verify(): double failure.\n"); } } @@ -843,18 +838,16 @@ storeError OStoreSuperBlockPage::verify (OStorePageBIOS &rBIOS) * OStorePageACL. * *======================================================================*/ -typedef sal_uInt32 key_type; -typedef sal_uInt32 val_type; +typedef sal_uInt32 key_type; +typedef sal_uInt32 val_type; -typedef NAMESPACE_STD(hash)<key_type> key_hash; -typedef NAMESPACE_STD(equal_to)<key_type> key_cmp; +typedef std::hash<key_type> key_hash; +typedef std::equal_to<key_type> key_cmp; -typedef NAMESPACE_STD(hash_map) - <key_type, val_type, key_hash, key_cmp> map_type; +typedef std::hash_map<key_type, val_type, key_hash, key_cmp> map_type; -#ifdef _USE_NAMESPACE -namespace store { -#endif +namespace store +{ struct OStorePageACL : public map_type { @@ -869,21 +862,13 @@ struct OStorePageACL : public map_type {} }; -#ifdef _USE_NAMESPACE -} -#endif +} // namespace store /*======================================================================== * * OStorePageBIOS implementation. * *======================================================================*/ -VOS_IMPLEMENT_CLASSINFO( - VOS_CLASSNAME (OStorePageBIOS, store), - VOS_NAMESPACE (OStorePageBIOS, store), - VOS_NAMESPACE (OStoreObject, store), - 0); - /* * OStorePageBIOS. */ @@ -927,10 +912,10 @@ storeError OStorePageBIOS::verify (SuperPage *&rpSuper) // Check SuperBlock state. if (rpSuper->m_aState.closePending()) - VOS_TRACE("OStorePageBIOS::verify(): close pending.\n"); + OSL_TRACE("OStorePageBIOS::verify(): close pending.\n"); if (rpSuper->m_aState.flushPending()) - VOS_TRACE("OStorePageBIOS::verify(): flush pending.\n"); + OSL_TRACE("OStorePageBIOS::verify(): flush pending.\n"); } // Verify SuperBlock page (with repair). @@ -970,7 +955,7 @@ storeError OStorePageBIOS::initialize ( storeAccessMode eAccessMode) { // Acquire exclusive access. - NAMESPACE_VOS(OGuard) aGuard (m_aMutex); + osl::MutexGuard aGuard (m_aMutex); // Check arguments. storeError eErrCode = store_E_InvalidParameter; @@ -1025,20 +1010,20 @@ storeError OStorePageBIOS::initialize ( storeError OStorePageBIOS::create (sal_uInt16 nPageSize) { // Acquire exclusive access. - NAMESPACE_VOS(OGuard) aGuard (m_aMutex); + osl::MutexGuard aGuard (m_aMutex); // Check precond. - if (!m_xLockBytes.isValid()) + if (!m_xLockBytes.is()) return store_E_InvalidAccess; if (!m_bWriteable) return store_E_AccessViolation; // Check PageSize. sal_uInt16 nMinSize = SuperPage::size(); - nMinSize = VOS_MAX(nMinSize, STORE_MINIMUM_PAGESIZE); + nMinSize = std::max (nMinSize, STORE_MINIMUM_PAGESIZE); - nPageSize = VOS_MAX(nPageSize, nMinSize); - nPageSize = VOS_MIN(nPageSize, STORE_MAXIMUM_PAGESIZE); + nPageSize = std::max (nPageSize, nMinSize); + nPageSize = std::min (nPageSize, STORE_MAXIMUM_PAGESIZE); sal_uInt16 nRemSize = nPageSize % nMinSize; if (nRemSize) @@ -1076,7 +1061,7 @@ storeError OStorePageBIOS::create (sal_uInt16 nPageSize) // Commit. eErrCode = m_xLockBytes->flush(); - VOS_POSTCOND( + OSL_POSTCOND( eErrCode == store_E_None, "OStorePageBIOS::create(): flush failed"); if (eErrCode == store_E_None) @@ -1096,13 +1081,13 @@ storeError OStorePageBIOS::create (sal_uInt16 nPageSize) storeError OStorePageBIOS::getPageSize (sal_uInt16 &rnPageSize) { // Acquire exclusive access. - NAMESPACE_VOS(OGuard) aGuard (m_aMutex); + osl::MutexGuard aGuard (m_aMutex); // Initialize [out] param. rnPageSize = 0; // Check precond. - if (!m_xLockBytes.isValid()) + if (!m_xLockBytes.is()) return store_E_InvalidAccess; // Load SuperBlock and require good health. @@ -1123,11 +1108,11 @@ storeError OStorePageBIOS::acquireLock ( sal_uInt32 nAddr, sal_uInt32 nSize) { // Check precond. - if (!m_xLockBytes.isValid()) + if (!m_xLockBytes.is()) return store_E_InvalidAccess; // Check Address. - VOS_PRECOND( + OSL_PRECOND( nAddr != STORE_PAGE_NULL, "OStorePageBIOS::acquireLock(): invalid Address"); if (nAddr == STORE_PAGE_NULL) @@ -1149,11 +1134,11 @@ storeError OStorePageBIOS::releaseLock ( sal_uInt32 nAddr, sal_uInt32 nSize) { // Check precond. - if (!m_xLockBytes.isValid()) + if (!m_xLockBytes.is()) return store_E_InvalidAccess; // Check Address. - VOS_PRECOND( + OSL_PRECOND( nAddr != STORE_PAGE_NULL, "OStorePageBIOS::releaseLock(): invalid Address"); if (nAddr == STORE_PAGE_NULL) @@ -1175,18 +1160,18 @@ storeError OStorePageBIOS::read ( sal_uInt32 nAddr, void *pData, sal_uInt32 nSize) { // Check precond. - if (!m_xLockBytes.isValid()) + if (!m_xLockBytes.is()) return store_E_InvalidAccess; // Check Address. - VOS_PRECOND( + OSL_PRECOND( nAddr != STORE_PAGE_NULL, "OStorePageBIOS::read(): invalid Address"); if (nAddr == STORE_PAGE_NULL) return store_E_CantSeek; // Check Data. - VOS_PRECOND(pData, "OStorePageBIOS::read(): no Data"); + OSL_PRECOND(pData, "OStorePageBIOS::read(): no Data"); if (pData == NULL) return store_E_InvalidParameter; @@ -1212,20 +1197,20 @@ storeError OStorePageBIOS::write ( sal_uInt32 nAddr, const void *pData, sal_uInt32 nSize) { // Check precond. - if (!m_xLockBytes.isValid()) + if (!m_xLockBytes.is()) return store_E_InvalidAccess; if (!m_bWriteable) return store_E_AccessViolation; // Check Address. - VOS_PRECOND( + OSL_PRECOND( nAddr != STORE_PAGE_NULL, "OStorePageBIOS::write(): invalid Address"); if (nAddr == STORE_PAGE_NULL) return store_E_CantSeek; // Check Data. - VOS_PRECOND(pData, "OStorePageBIOS::write(): no Data"); + OSL_PRECOND(pData, "OStorePageBIOS::write(): no Data"); if (pData == NULL) return store_E_InvalidParameter; @@ -1261,10 +1246,10 @@ storeError OStorePageBIOS::acquirePage ( const OStorePageDescriptor& rDescr, storeAccessMode eMode) { // Acquire exclusive access. - NAMESPACE_VOS(OGuard) aGuard (m_aMutex); + osl::MutexGuard aGuard (m_aMutex); // Check precond. - if (!m_xLockBytes.isValid()) + if (!m_xLockBytes.is()) return store_E_InvalidAccess; // Check access mode. @@ -1288,7 +1273,7 @@ storeError OStorePageBIOS::acquirePage ( else { // Insert new entry. - typedef NAMESPACE_STD(pair)<const sal_uInt32, sal_uInt32> map_entry; + typedef std::pair<const sal_uInt32, sal_uInt32> map_entry; m_pAcl->insert (map_entry (rDescr.m_nAddr, 1)); } @@ -1305,10 +1290,10 @@ storeError OStorePageBIOS::releasePage ( const OStorePageDescriptor& rDescr, storeAccessMode eMode) { // Acquire exclusive access. - NAMESPACE_VOS(OGuard) aGuard (m_aMutex); + osl::MutexGuard aGuard (m_aMutex); // Check precond. - if (!m_xLockBytes.isValid()) + if (!m_xLockBytes.is()) return store_E_InvalidAccess; // Check access control list. @@ -1338,7 +1323,7 @@ storeError OStorePageBIOS::releasePage ( sal_uInt32 OStorePageBIOS::getRefererCount (void) { // Acquire exclusive access. - NAMESPACE_VOS(OGuard) aGuard (m_aMutex); + osl::MutexGuard aGuard (m_aMutex); // Obtain total referer count. if (m_pAcl) @@ -1355,10 +1340,10 @@ storeError OStorePageBIOS::allocate ( OStorePageObject& rPage, Allocation eAlloc) { // Acquire exclusive access. - NAMESPACE_VOS(OGuard) aGuard (m_aMutex); + osl::MutexGuard aGuard (m_aMutex); // Check precond. - if (!m_xLockBytes.isValid()) + if (!m_xLockBytes.is()) return store_E_InvalidAccess; if (!m_bWriteable) return store_E_AccessViolation; @@ -1396,7 +1381,7 @@ storeError OStorePageBIOS::allocate ( } // Verify FreeList head. - VOS_PRECOND( + OSL_PRECOND( aPageHead.m_aUnused.m_nAddr != STORE_PAGE_NULL, "OStorePageBIOS::allocate(): page not free"); if (aPageHead.m_aUnused.m_nAddr == STORE_PAGE_NULL) @@ -1439,7 +1424,7 @@ storeError OStorePageBIOS::allocate ( m_pSuper->m_aSuperOne = m_pSuper->m_aSuperTwo; eErrCode = m_pSuper->save (*this); - VOS_POSTCOND( + OSL_POSTCOND( eErrCode == store_E_None, "OStorePageBIOS::allocate(): SuperBlock save failed"); @@ -1480,7 +1465,9 @@ storeError OStorePageBIOS::allocate ( } // Resize. - sal_uInt32 nAlign = VOS_MIN(nAddr, STORE_MAXIMUM_PAGESIZE); + sal_uInt32 nAlign = STORE_MAXIMUM_PAGESIZE; + + nAlign = std::min (nAddr, nAlign); nAddr = ((nAddr + nAlign) / nAlign) * nAlign; eErrCode = m_xLockBytes->setSize (nAddr); @@ -1507,7 +1494,7 @@ storeError OStorePageBIOS::allocate ( m_pSuper->m_aSuperOne = m_pSuper->m_aSuperTwo; eErrCode = m_pSuper->save (*this); - VOS_POSTCOND( + OSL_POSTCOND( eErrCode == store_E_None, "OStorePageBIOS::allocate(): SuperBlock save failed"); @@ -1522,10 +1509,10 @@ storeError OStorePageBIOS::allocate ( storeError OStorePageBIOS::free (OStorePageObject& rPage) { // Acquire exclusive access. - NAMESPACE_VOS(OGuard) aGuard (m_aMutex); + osl::MutexGuard aGuard (m_aMutex); // Check precond. - if (!m_xLockBytes.isValid()) + if (!m_xLockBytes.is()) return store_E_InvalidAccess; if (!m_bWriteable) return store_E_AccessViolation; @@ -1572,7 +1559,7 @@ storeError OStorePageBIOS::free (OStorePageObject& rPage) m_pSuper->m_aSuperOne = m_pSuper->m_aSuperTwo; eErrCode = m_pSuper->save (*this); - VOS_POSTCOND( + OSL_POSTCOND( eErrCode == store_E_None, "OStorePageBIOS::free(): SuperBlock save failed"); @@ -1587,10 +1574,10 @@ storeError OStorePageBIOS::free (OStorePageObject& rPage) storeError OStorePageBIOS::load (OStorePageObject& rPage) { // Acquire exclusive access. - NAMESPACE_VOS(OGuard) aGuard (m_aMutex); + osl::MutexGuard aGuard (m_aMutex); // Check precond. - if (!m_xLockBytes.isValid()) + if (!m_xLockBytes.is()) return store_E_InvalidAccess; // Save PageDescriptor. @@ -1639,10 +1626,10 @@ storeError OStorePageBIOS::load (OStorePageObject& rPage) storeError OStorePageBIOS::save (OStorePageObject& rPage) { // Acquire exclusive access. - NAMESPACE_VOS(OGuard) aGuard (m_aMutex); + osl::MutexGuard aGuard (m_aMutex); // Check precond. - if (!m_xLockBytes.isValid()) + if (!m_xLockBytes.is()) return store_E_InvalidAccess; if (!m_bWriteable) return store_E_AccessViolation; @@ -1658,7 +1645,7 @@ storeError OStorePageBIOS::save (OStorePageObject& rPage) storeError OStorePageBIOS::close (void) { // Acquire exclusive access. - NAMESPACE_VOS(OGuard) aGuard (m_aMutex); + osl::MutexGuard aGuard (m_aMutex); // Check access control list. if (m_pAcl) @@ -1668,7 +1655,7 @@ storeError OStorePageBIOS::close (void) { // Report remaining referer count. sal_uInt32 k = m_pAcl->m_nRefCount; - VOS_TRACE("OStorePageBIOS::close(): referer count: %d\n", k); + OSL_TRACE("OStorePageBIOS::close(): referer count: %d\n", k); } __STORE_DELETEZ (m_pAcl); } @@ -1682,11 +1669,11 @@ storeError OStorePageBIOS::close (void) } // Check LockBytes. - if (m_xLockBytes.isValid()) + if (m_xLockBytes.is()) { // Release LockBytes. m_xLockBytes->flush(); - m_xLockBytes.unbind(); + m_xLockBytes.clear(); } return store_E_None; } @@ -1698,10 +1685,10 @@ storeError OStorePageBIOS::close (void) storeError OStorePageBIOS::flush (void) { // Acquire exclusive access. - NAMESPACE_VOS(OGuard) aGuard (m_aMutex); + osl::MutexGuard aGuard (m_aMutex); // Check precond. - if (!m_xLockBytes.isValid()) + if (!m_xLockBytes.is()) return store_E_InvalidAccess; // Check mode and state. @@ -1710,13 +1697,13 @@ storeError OStorePageBIOS::flush (void) // Flush SuperBlock page. storeError eErrCode = m_pSuper->flush (*this); - VOS_POSTCOND( + OSL_POSTCOND( eErrCode == store_E_None, "OStorePageBIOS::flush(): SuperBlock flush failed"); // Flush LockBytes. eErrCode = m_xLockBytes->flush(); - VOS_POSTCOND( + OSL_POSTCOND( eErrCode == store_E_None, "OStorePageBIOS::flush(): LockBytes flush failed"); if (eErrCode == store_E_None) @@ -1734,13 +1721,13 @@ storeError OStorePageBIOS::flush (void) storeError OStorePageBIOS::size (sal_uInt32 &rnSize) { // Acquire exclusive access. - NAMESPACE_VOS(OGuard) aGuard (m_aMutex); + osl::MutexGuard aGuard (m_aMutex); // Initialize [out] param. rnSize = 0; // Check precond. - if (!m_xLockBytes.isValid()) + if (!m_xLockBytes.is()) return store_E_InvalidAccess; // Obtain LockBytes size. @@ -1755,7 +1742,7 @@ storeError OStorePageBIOS::scanBegin ( ScanContext &rCtx, sal_uInt32 nMagic) { // Acquire exclusive access. - NAMESPACE_VOS(OGuard) aGuard (m_aMutex); + osl::MutexGuard aGuard (m_aMutex); // Initialize [out] param. rCtx.m_aDescr = OStorePageDescriptor(0, 0, 0); @@ -1763,7 +1750,7 @@ storeError OStorePageBIOS::scanBegin ( rCtx.m_nMagic = nMagic; // Check precond. - if (!m_xLockBytes.isValid()) + if (!m_xLockBytes.is()) return store_E_InvalidAccess; // Check SuperBlock page. @@ -1771,7 +1758,7 @@ storeError OStorePageBIOS::scanBegin ( if (eErrCode != store_E_None) { // Damaged. Determine page size (NYI). - VOS_TRACE ("OStorePageBIOS::scanBegin(): damaged.\n"); + OSL_TRACE ("OStorePageBIOS::scanBegin(): damaged.\n"); return eErrCode; } @@ -1796,10 +1783,10 @@ storeError OStorePageBIOS::scanNext ( ScanContext &rCtx, OStorePageObject &rPage) { // Acquire exclusive access. - NAMESPACE_VOS(OGuard) aGuard (m_aMutex); + osl::MutexGuard aGuard (m_aMutex); // Check precond. - if (!m_xLockBytes.isValid()) + if (!m_xLockBytes.is()) return store_E_InvalidAccess; // Setup PageHead. diff --git a/store/source/storbase.hxx b/store/source/storbase.hxx index 843e409fb..0f88dc1a3 100644 --- a/store/source/storbase.hxx +++ b/store/source/storbase.hxx @@ -2,9 +2,9 @@ * * $RCSfile: storbase.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 15:18:32 $ + * last change: $Author: mhu $ $Date: 2001-03-13 20:54:25 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -54,13 +54,13 @@ * * All Rights Reserved. * - * Contributor(s): _______________________________________ + * Contributor(s): Matthias Huetsch <matthias.huetsch@sun.com> * * ************************************************************************/ #ifndef _STORE_STORBASE_HXX_ -#define _STORE_STORBASE_HXX_ "$Revision: 1.1.1.1 $" +#define _STORE_STORBASE_HXX_ "$Revision: 1.2 $" #ifndef _SAL_TYPES_H_ #include <sal/types.h> @@ -75,23 +75,20 @@ #ifndef _RTL_STRING_H_ #include <rtl/string.h> #endif - -#ifndef _VOS_MACROS_HXX_ -#include <vos/macros.hxx> +#ifndef _RTL_REF_HXX_ +#include <rtl/ref.hxx> #endif -#ifndef _VOS_MUTEX_HXX_ -#include <vos/mutex.hxx> + +#ifndef _OSL_ENDIAN_H_ +#include <osl/endian.h> #endif -#ifndef _VOS_REF_HXX_ -#include <vos/ref.hxx> +#ifndef _OSL_MUTEX_HXX_ +#include <osl/mutex.hxx> #endif #ifndef _STORE_TYPES_H_ #include <store/types.h> #endif -#ifndef _STORE_MACROS_HXX_ -#include <store/macros.hxx> -#endif #ifndef _STORE_OBJECT_HXX_ #include <store/object.hxx> #endif @@ -103,9 +100,8 @@ #define __STORE_DELETEZ(p) (delete p, p = 0) #endif -#ifdef _USE_NAMESPACE -namespace store { -#endif +namespace store +{ /*======================================================================== * @@ -151,8 +147,8 @@ struct OStorePageGuard void swap (void) { #ifdef OSL_BIGENDIAN - m_nMagic = VOS_SWAPDWORD(m_nMagic); - m_nCRC32 = VOS_SWAPDWORD(m_nCRC32); + m_nMagic = OSL_SWAPDWORD(m_nMagic); + m_nCRC32 = OSL_SWAPDWORD(m_nCRC32); #endif /* OSL_BIGENDIAN */ } @@ -236,9 +232,9 @@ struct OStorePageDescriptor void swap (void) { #ifdef OSL_BIGENDIAN - m_nAddr = VOS_SWAPDWORD(m_nAddr); - m_nSize = VOS_SWAPWORD(m_nSize); - m_nUsed = VOS_SWAPWORD(m_nUsed); + m_nAddr = OSL_SWAPDWORD(m_nAddr); + m_nSize = OSL_SWAPWORD(m_nSize); + m_nUsed = OSL_SWAPWORD(m_nUsed); #endif /* OSL_BIGENDIAN */ } }; @@ -293,8 +289,8 @@ struct OStorePageKey void swap (void) { #ifdef OSL_BIGENDIAN - m_nLow = VOS_SWAPDWORD(m_nLow); - m_nHigh = VOS_SWAPDWORD(m_nHigh); + m_nLow = OSL_SWAPDWORD(m_nLow); + m_nHigh = OSL_SWAPDWORD(m_nHigh); #endif /* OSL_BIGENDIAN */ } }; @@ -358,7 +354,7 @@ struct OStorePageLink void swap (void) { #ifdef OSL_BIGENDIAN - m_nAddr = VOS_SWAPDWORD(m_nAddr); + m_nAddr = OSL_SWAPDWORD(m_nAddr); #endif /* OSL_BIGENDIAN */ } }; @@ -420,7 +416,7 @@ struct OStorePageNameBlock #ifdef OSL_BIGENDIAN m_aGuard.swap(); m_aKey.swap(); - m_nAttrib = VOS_SWAPDWORD(m_nAttrib); + m_nAttrib = OSL_SWAPDWORD(m_nAttrib); #endif /* OSL_BIGENDIAN */ } @@ -432,7 +428,7 @@ struct OStorePageNameBlock nCRC32 = G::crc32 (nCRC32, &m_aGuard.m_nMagic, sizeof(sal_uInt32)); nCRC32 = G::crc32 (nCRC32, &m_aKey, size() - sizeof(G)); #ifdef OSL_BIGENDIAN - nCRC32 = VOS_SWAPDWORD(nCRC32); + nCRC32 = OSL_SWAPDWORD(nCRC32); #endif /* OSL_BIGENDIAN */ m_aGuard.m_nCRC32 = nCRC32; } @@ -445,7 +441,7 @@ struct OStorePageNameBlock nCRC32 = G::crc32 (nCRC32, &m_aGuard.m_nMagic, sizeof(sal_uInt32)); nCRC32 = G::crc32 (nCRC32, &m_aKey, size() - sizeof(G)); #ifdef OSL_BIGENDIAN - nCRC32 = VOS_SWAPDWORD(nCRC32); + nCRC32 = OSL_SWAPDWORD(nCRC32); #endif /* OSL_BIGENDIAN */ if (m_aGuard.m_nCRC32 != nCRC32) return store_E_InvalidChecksum; @@ -576,7 +572,7 @@ struct OStorePageData nCRC32 = G::crc32 (nCRC32, &m_aGuard.m_nMagic, sizeof(sal_uInt32)); nCRC32 = G::crc32 (nCRC32, &m_aDescr, size() - sizeof(G)); #ifdef OSL_BIGENDIAN - nCRC32 = VOS_SWAPDWORD(nCRC32); + nCRC32 = OSL_SWAPDWORD(nCRC32); #endif /* OSL_BIGENDIAN */ m_aGuard.m_nCRC32 = nCRC32; } @@ -589,7 +585,7 @@ struct OStorePageData nCRC32 = G::crc32 (nCRC32, &m_aGuard.m_nMagic, sizeof(sal_uInt32)); nCRC32 = G::crc32 (nCRC32, &m_aDescr, size() - sizeof(G)); #ifdef OSL_BIGENDIAN - nCRC32 = VOS_SWAPDWORD(nCRC32); + nCRC32 = OSL_SWAPDWORD(nCRC32); #endif /* OSL_BIGENDIAN */ if (m_aGuard.m_nCRC32 != nCRC32) return store_E_InvalidChecksum; @@ -698,18 +694,16 @@ inline void OStorePageObject::location (sal_uInt32 nAddr) struct OStoreSuperBlockPage; struct OStorePageACL; -class OStorePageBIOS : public NAMESPACE_STORE(OStoreObject) +class OStorePageBIOS : public store::OStoreObject { - VOS_DECLARE_CLASSINFO (VOS_NAMESPACE (OStorePageBIOS, store)); - public: /** Construction. */ OStorePageBIOS (void); - /** Conversion into IMutex& + /** Conversion into Mutex& */ - inline operator NAMESPACE_VOS(IMutex)& (void) const; + inline operator osl::Mutex& (void) const; /** Initialization. * @param pLockBytes [in] @@ -856,15 +850,15 @@ protected: private: /** Representation. */ - NAMESPACE_VOS(ORef)<ILockBytes> m_xLockBytes; - NAMESPACE_VOS(OMutex) m_aMutex; - OStorePageACL *m_pAcl; + rtl::Reference<ILockBytes> m_xLockBytes; + osl::Mutex m_aMutex; + OStorePageACL *m_pAcl; - typedef OStoreSuperBlockPage SuperPage; - SuperPage *m_pSuper; + typedef OStoreSuperBlockPage SuperPage; + SuperPage *m_pSuper; - sal_Bool m_bModified : 1; - sal_Bool m_bWriteable : 1; + sal_Bool m_bModified : 1; + sal_Bool m_bWriteable : 1; /** SuperBlock verification and repair. */ @@ -877,9 +871,9 @@ private: OStorePageBIOS& operator= (const OStorePageBIOS&); }; -inline OStorePageBIOS::operator NAMESPACE_VOS(IMutex)& (void) const +inline OStorePageBIOS::operator osl::Mutex& (void) const { - return (NAMESPACE_VOS(IMutex)&)m_aMutex; + return (osl::Mutex&)m_aMutex; } inline sal_Bool OStorePageBIOS::isModified (void) const { @@ -891,7 +885,7 @@ inline sal_Bool OStorePageBIOS::isWriteable (void) const } inline sal_Bool OStorePageBIOS::isValid (void) const { - return m_xLockBytes.isValid(); + return m_xLockBytes.is(); } inline OStorePageBIOS::ScanContext::ScanContext (void) @@ -908,9 +902,8 @@ inline sal_Bool OStorePageBIOS::ScanContext::isValid (void) const * The End. * *======================================================================*/ -#ifdef _USE_NAMESPACE -} -#endif + +} // namespace store #endif /* !_STORE_STORBASE_HXX_ */ diff --git a/store/source/storcach.cxx b/store/source/storcach.cxx index c0d1bad7a..7099640cf 100644 --- a/store/source/storcach.cxx +++ b/store/source/storcach.cxx @@ -2,9 +2,9 @@ * * $RCSfile: storcach.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 15:18:32 $ + * last change: $Author: mhu $ $Date: 2001-03-13 20:54:25 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -54,12 +54,12 @@ * * All Rights Reserved. * - * Contributor(s): _______________________________________ + * Contributor(s): Matthias Huetsch <matthias.huetsch@sun.com> * * ************************************************************************/ -#define _STORE_STORCACH_CXX "$Revision: 1.1.1.1 $" +#define _STORE_STORCACH_CXX "$Revision: 1.2 $" #ifndef _SAL_TYPES_H_ #include <sal/types.h> @@ -69,19 +69,16 @@ #include <rtl/memory.h> #endif -#ifndef _VOS_DIAGNOSE_HXX_ -#include <vos/diagnose.hxx> +#ifndef _OSL_DIAGNOSE_H_ +#include <osl/diagnose.h> #endif -#ifndef _VOS_MUTEX_HXX_ -#include <vos/mutex.hxx> +#ifndef _OSL_MUTEX_HXX_ +#include <osl/mutex.hxx> #endif #ifndef _STORE_TYPES_H_ #include <store/types.h> #endif -#ifndef _STORE_MACROS_HXX_ -#include <store/macros.hxx> -#endif #ifndef _STORE_STORBASE_HXX_ #include <storbase.hxx> @@ -90,11 +87,7 @@ #include <storcach.hxx> #endif -#include <string.h> - -#ifdef _USE_NAMESPACE using namespace store; -#endif /*======================================================================== * @@ -104,9 +97,9 @@ using namespace store; /* * __store_memcpy. */ +#include <string.h> inline void __store_memcpy (void *dst, const void *src, sal_uInt32 n) { - // rtl_copyMemory (dst, src, n); ::memcpy (dst, src, n); } @@ -115,9 +108,8 @@ inline void __store_memcpy (void *dst, const void *src, sal_uInt32 n) * OStorePageCacheEntry. * *======================================================================*/ -#ifdef _USE_NAMESPACE -namespace store { -#endif +namespace store +{ struct OStorePageCacheEntry { @@ -135,11 +127,12 @@ struct OStorePageCacheEntry /** Construction. */ OStorePageCacheEntry (const D& rDescr, const data& rData) - : m_aDescr (rDescr), m_pData (NULL), m_pNext (this), m_pPrev (this) + : m_aDescr (rDescr) { sal_uInt16 nSize = m_aDescr.m_nSize; m_pData = new(nSize) data(nSize); __store_memcpy (m_pData, &rData, nSize); + m_pNext = m_pPrev = this; } /** Data assignment. @@ -247,9 +240,7 @@ struct OStorePageCacheEntry } }; -#ifdef _USE_NAMESPACE -} -#endif +} // namespace store /*======================================================================== * @@ -396,7 +387,7 @@ void OStorePageCache::move (sal_uInt16 nSI, sal_uInt16 nDI) m_pData[nDI]->index(nDI); #if 0 /* DEBUG */ - VOS_POSTCOND( + OSL_POSTCOND( __store_check_entry(&m_pData[0], m_nUsed), "OStorePageCache::move(): check_entry() failed"); #endif /* DEBUG */ @@ -413,7 +404,7 @@ storeError OStorePageCache::insert ( InsertMode eMode) { #if 0 /* DEBUG */ - VOS_PRECOND( + OSL_PRECOND( __store_check_entry(&m_pData[0], m_nUsed), "OStorePageCache::insert(): check_entry() failed"); #endif /* DEBUG */ @@ -514,7 +505,7 @@ storeError OStorePageCache::load ( const OStorePageDescriptor &rDescr, OStorePageData &rData, OStorePageBIOS &rBIOS, - NAMESPACE_VOS(IMutex) *pMutex) + osl::Mutex *pMutex) { // Enter. STORE_METHOD_ENTER(pMutex); @@ -567,7 +558,7 @@ storeError OStorePageCache::update ( const OStorePageDescriptor &rDescr, const OStorePageData &rData, OStorePageBIOS &rBIOS, - NAMESPACE_VOS(IMutex) *pMutex, + osl::Mutex *pMutex, UpdateMode eMode) { // Enter. @@ -624,7 +615,7 @@ storeError OStorePageCache::update ( */ storeError OStorePageCache::invalidate ( const OStorePageDescriptor &rDescr, - NAMESPACE_VOS(IMutex) *pMutex) + osl::Mutex *pMutex) { // Enter. STORE_METHOD_ENTER(pMutex); @@ -661,8 +652,8 @@ storeError OStorePageCache::invalidate ( * flush. */ storeError OStorePageCache::flush ( - OStorePageBIOS &rBIOS, - NAMESPACE_VOS(IMutex) *pMutex) + OStorePageBIOS &rBIOS, + osl::Mutex *pMutex) { // Enter. STORE_METHOD_ENTER(pMutex); @@ -679,7 +670,7 @@ storeError OStorePageCache::flush ( // Write page. storeError eErrCode = rBIOS.write ( aDescr.m_nAddr, m_pData[i]->m_pData, aDescr.m_nSize); - VOS_POSTCOND( + OSL_POSTCOND( eErrCode == store_E_None, "OStorePageCache::flush(): write() failed"); diff --git a/store/source/storcach.hxx b/store/source/storcach.hxx index b5d13003b..3ec0baede 100644 --- a/store/source/storcach.hxx +++ b/store/source/storcach.hxx @@ -2,9 +2,9 @@ * * $RCSfile: storcach.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 15:18:32 $ + * last change: $Author: mhu $ $Date: 2001-03-13 20:54:25 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -54,35 +54,28 @@ * * All Rights Reserved. * - * Contributor(s): _______________________________________ + * Contributor(s): Matthias Huetsch <matthias.huetsch@sun.com> * * ************************************************************************/ #ifndef _STORE_STORCACH_HXX -#define _STORE_STORCACH_HXX "$Revision: 1.1.1.1 $" +#define _STORE_STORCACH_HXX "$Revision: 1.2 $" #ifndef _SAL_TYPES_H_ #include <sal/types.h> #endif -#ifndef _VOS_MACROS_HXX_ -#include <vos/macros.hxx> -#endif -#ifndef _VOS_MUTEX_HXX -#include <vos/mutex.hxx> +#ifndef _OSL_MUTEX_HXX_ +#include <osl/mutex.hxx> #endif #ifndef _STORE_TYPES_H_ #include <store/types.h> #endif -#ifndef _STORE_MACROS_HXX_ -#include <store/macros.hxx> -#endif -#ifdef _USE_NAMESPACE -namespace store { -#endif +namespace store +{ struct OStorePageDescriptor; struct OStorePageData; @@ -119,7 +112,7 @@ public: const OStorePageDescriptor &rDescr, OStorePageData &rData, OStorePageBIOS &rBIOS, - NAMESPACE_VOS(IMutex) *pMutex = NULL); + osl::Mutex *pMutex = NULL); /** update. */ @@ -133,20 +126,20 @@ public: const OStorePageDescriptor &rDescr, const OStorePageData &rData, OStorePageBIOS &rBIOS, - NAMESPACE_VOS(IMutex) *pMutex = NULL, + osl::Mutex *pMutex = NULL, UpdateMode eMode = UPDATE_WRITE_THROUGH); /** invalidate. */ storeError invalidate ( const OStorePageDescriptor &rDescr, - NAMESPACE_VOS(IMutex) *pMutex = NULL); + osl::Mutex *pMutex = NULL); /** flush. */ storeError flush ( - OStorePageBIOS &rBIOS, - NAMESPACE_VOS(IMutex) *pMutex = NULL); + OStorePageBIOS &rBIOS, + osl::Mutex *pMutex = NULL); /** hitRatio [nHit / (nHit + nMissed)]. */ @@ -223,9 +216,8 @@ inline double OStorePageCache::usageRatio (void) const * The End. * *======================================================================*/ -#ifdef _USE_NAMESPACE -} -#endif + +} // namespace store #endif /* !_STORE_STORCACH_HXX */ diff --git a/store/source/stordata.cxx b/store/source/stordata.cxx index 06078297b..02f0debb3 100644 --- a/store/source/stordata.cxx +++ b/store/source/stordata.cxx @@ -2,9 +2,9 @@ * * $RCSfile: stordata.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 15:18:32 $ + * last change: $Author: mhu $ $Date: 2001-03-13 20:59:02 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -54,33 +54,30 @@ * * All Rights Reserved. * - * Contributor(s): _______________________________________ + * Contributor(s): Matthias Huetsch <matthias.huetsch@sun.com> * * ************************************************************************/ -#define _STORE_STORDATA_CXX_ "$Revision: 1.1.1.1 $" +#define _STORE_STORDATA_CXX_ "$Revision: 1.2 $" #ifndef _SAL_TYPES_H_ #include <sal/types.h> #endif -#ifndef _VOS_DIAGNOSE_HXX_ -#include <vos/diagnose.hxx> +#ifndef _OSL_DIAGNOSE_H_ +#include <osl/diagnose.h> #endif -#ifndef _VOS_MACROS_HXX_ -#include <vos/macros.hxx> +#ifndef _OSL_ENDIAN_H_ +#include <osl/endian.h> #endif -#ifndef _VOS_MUTEX_HXX_ -#include <vos/mutex.hxx> +#ifndef _OSL_MUTEX_HXX_ +#include <osl/mutex.hxx> #endif #ifndef _STORE_TYPES_H_ #include <store/types.h> #endif -#ifndef _STORE_MACROS_HXX_ -#include <store/macros.hxx> -#endif #ifndef _STORE_STORBASE_HXX_ #include <storbase.hxx> @@ -89,9 +86,7 @@ #include <stordata.hxx> #endif -#ifdef _USE_NAMESPACE using namespace store; -#endif /*======================================================================== * @@ -131,7 +126,7 @@ void OStoreIndirectionPageData::swap (const D& rDescr) sal_uInt16 i, n = capacityCount (rDescr); for (i = 0; i < n; i++) - m_pData[i] = VOS_SWAPDWORD(m_pData[i]); + m_pData[i] = OSL_SWAPDWORD(m_pData[i]); #endif /* OSL_BIGENDIAN */ } @@ -179,7 +174,7 @@ storeError OStoreIndirectionPageObject::get ( sal_uInt16 nSingle, OStoreDataPageObject &rData, OStorePageBIOS &rBIOS, - NAMESPACE_VOS(IMutex) *pMutex) + osl::Mutex *pMutex) { // Enter. STORE_METHOD_ENTER(pMutex); @@ -210,7 +205,7 @@ storeError OStoreIndirectionPageObject::get ( page *&rpSingle, OStoreDataPageObject &rData, OStorePageBIOS &rBIOS, - NAMESPACE_VOS(IMutex) *pMutex) + osl::Mutex *pMutex) { // Enter. STORE_METHOD_ENTER(pMutex); @@ -257,7 +252,7 @@ storeError OStoreIndirectionPageObject::get ( page *&rpSingle, OStoreDataPageObject &rData, OStorePageBIOS &rBIOS, - NAMESPACE_VOS(IMutex) *pMutex) + osl::Mutex *pMutex) { // Enter. STORE_METHOD_ENTER(pMutex); @@ -301,7 +296,7 @@ storeError OStoreIndirectionPageObject::put ( sal_uInt16 nSingle, OStoreDataPageObject &rData, OStorePageBIOS &rBIOS, - NAMESPACE_VOS(IMutex) *pMutex) + osl::Mutex *pMutex) { // Enter. STORE_METHOD_ENTER(pMutex); @@ -348,7 +343,7 @@ storeError OStoreIndirectionPageObject::put ( page *&rpSingle, OStoreDataPageObject &rData, OStorePageBIOS &rBIOS, - NAMESPACE_VOS(IMutex) *pMutex) + osl::Mutex *pMutex) { // Enter. STORE_METHOD_ENTER(pMutex); @@ -414,7 +409,7 @@ storeError OStoreIndirectionPageObject::put ( page *&rpSingle, OStoreDataPageObject &rData, OStorePageBIOS &rBIOS, - NAMESPACE_VOS(IMutex) *pMutex) + osl::Mutex *pMutex) { // Enter. STORE_METHOD_ENTER(pMutex); @@ -477,7 +472,7 @@ storeError OStoreIndirectionPageObject::truncate ( sal_uInt16 nSingle, OStoreDataPageObject &rData, OStorePageBIOS &rBIOS, - NAMESPACE_VOS(IMutex) *pMutex) + osl::Mutex *pMutex) { // Enter. STORE_METHOD_ENTER(pMutex); @@ -524,7 +519,7 @@ storeError OStoreIndirectionPageObject::truncate ( if (eErrCode != store_E_None) { // Must not happen. - VOS_TRACE("OStoreIndirectionPageObject::truncate(): save failed"); + OSL_TRACE("OStoreIndirectionPageObject::truncate(): save failed"); // Release Lock and Leave. rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); @@ -546,7 +541,7 @@ storeError OStoreIndirectionPageObject::truncate ( page *&rpSingle, OStoreDataPageObject &rData, OStorePageBIOS &rBIOS, - NAMESPACE_VOS(IMutex) *pMutex) + osl::Mutex *pMutex) { // Acquire Mutex. STORE_METHOD_ENTER(pMutex); @@ -676,7 +671,7 @@ storeError OStoreIndirectionPageObject::truncate ( if (eErrCode != store_E_None) { // Must not happen. - VOS_TRACE("OStoreIndirectionPageObject::truncate(): save failed"); + OSL_TRACE("OStoreIndirectionPageObject::truncate(): save failed"); // Release Lock and Leave. rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); @@ -700,7 +695,7 @@ storeError OStoreIndirectionPageObject::truncate ( page *&rpSingle, OStoreDataPageObject &rData, OStorePageBIOS &rBIOS, - NAMESPACE_VOS(IMutex) *pMutex) + osl::Mutex *pMutex) { // Enter. STORE_METHOD_ENTER(pMutex); @@ -833,7 +828,7 @@ storeError OStoreIndirectionPageObject::truncate ( if (eErrCode != store_E_None) { // Must not happen. - VOS_TRACE("OStoreIndirectionPageObject::truncate(): save failed"); + OSL_TRACE("OStoreIndirectionPageObject::truncate(): save failed"); // Release Lock and Leave. rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); @@ -883,13 +878,13 @@ void OStoreDirectoryDataBlock::LinkTable::swap (void) #ifdef OSL_BIGENDIAN sal_Int32 i; for (i = 0; i < STORE_LIMIT_DATAPAGE_DIRECT; i++) - m_pDirect[i] = VOS_SWAPDWORD(m_pDirect[i]); + m_pDirect[i] = OSL_SWAPDWORD(m_pDirect[i]); for (i = 0; i < STORE_LIMIT_DATAPAGE_SINGLE; i++) - m_pSingle[i] = VOS_SWAPDWORD(m_pSingle[i]); + m_pSingle[i] = OSL_SWAPDWORD(m_pSingle[i]); for (i = 0; i < STORE_LIMIT_DATAPAGE_DOUBLE; i++) - m_pDouble[i] = VOS_SWAPDWORD(m_pDouble[i]); + m_pDouble[i] = OSL_SWAPDWORD(m_pDouble[i]); for (i = 0; i < STORE_LIMIT_DATAPAGE_TRIPLE; i++) - m_pTriple[i] = VOS_SWAPDWORD(m_pTriple[i]); + m_pTriple[i] = OSL_SWAPDWORD(m_pTriple[i]); #endif /* OSL_BIGENDIAN */ } @@ -972,7 +967,7 @@ OStoreDirectoryPageObject::scope ( // Verify reduction. n = index1 * nCapacity + index0; - VOS_POSTCOND(n == nPage, "wrong math on indirect indices"); + OSL_POSTCOND(n == nPage, "wrong math on indirect indices"); if (n != nPage) return page::SCOPE_UNKNOWN; @@ -1004,7 +999,7 @@ OStoreDirectoryPageObject::scope ( // Verify reduction. n = index2 * nCapacity * nCapacity + index1 * nCapacity + index0; - VOS_POSTCOND(n == nPage, "wrong math on double indirect indices"); + OSL_POSTCOND(n == nPage, "wrong math on double indirect indices"); if (n != nPage) return page::SCOPE_UNKNOWN; @@ -1042,7 +1037,7 @@ OStoreDirectoryPageObject::scope ( n = index3 * nCapacity * nCapacity * nCapacity + index2 * nCapacity * nCapacity + index1 * nCapacity + index0; - VOS_POSTCOND(n == nPage, "wrong math on triple indirect indices"); + OSL_POSTCOND(n == nPage, "wrong math on triple indirect indices"); if (n != nPage) return page::SCOPE_UNKNOWN; @@ -1070,7 +1065,7 @@ storeError OStoreDirectoryPageObject::get ( indirect *&rpTriple, OStoreDataPageObject &rData, OStorePageBIOS &rBIOS, - NAMESPACE_VOS(IMutex) *pMutex) + osl::Mutex *pMutex) { // Enter. STORE_METHOD_ENTER(pMutex); @@ -1172,7 +1167,7 @@ storeError OStoreDirectoryPageObject::get ( else { // Unknown scope. - VOS_TRACE("OStoreDirectoryPageObject::get(): scope failed"); + OSL_TRACE("OStoreDirectoryPageObject::get(): scope failed"); eErrCode = store_E_Unknown; } @@ -1190,7 +1185,7 @@ storeError OStoreDirectoryPageObject::put ( indirect *&rpTriple, OStoreDataPageObject &rData, OStorePageBIOS &rBIOS, - NAMESPACE_VOS(IMutex) *pMutex) + osl::Mutex *pMutex) { // Enter. STORE_METHOD_ENTER(pMutex); @@ -1323,7 +1318,7 @@ storeError OStoreDirectoryPageObject::put ( else { // Unknown scope. - VOS_TRACE("OStoreDirectoryPageObject::put(): scope failed"); + OSL_TRACE("OStoreDirectoryPageObject::put(): scope failed"); eErrCode = store_E_Unknown; } @@ -1341,7 +1336,7 @@ storeError OStoreDirectoryPageObject::truncate ( indirect *&rpTriple, OStoreDataPageObject &rData, OStorePageBIOS &rBIOS, - NAMESPACE_VOS(IMutex) *pMutex) + osl::Mutex *pMutex) { // Enter. STORE_METHOD_ENTER(pMutex); @@ -1567,7 +1562,7 @@ storeError OStoreDirectoryPageObject::truncate ( else { // Unknown scope. - VOS_TRACE("OStoreDirectoryPageObject::put(): scope failed"); + OSL_TRACE("OStoreDirectoryPageObject::put(): scope failed"); eErrCode = store_E_Unknown; } @@ -1586,7 +1581,7 @@ storeError OStoreDirectoryPageObject::truncate ( indirect *&rpTriple, OStoreDataPageObject &rData, OStorePageBIOS &rBIOS, - NAMESPACE_VOS(IMutex) *pMutex) + osl::Mutex *pMutex) { // Enter. STORE_METHOD_ENTER(pMutex); diff --git a/store/source/stordata.hxx b/store/source/stordata.hxx index 174f9a73b..757777771 100644 --- a/store/source/stordata.hxx +++ b/store/source/stordata.hxx @@ -2,9 +2,9 @@ * * $RCSfile: stordata.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 15:18:32 $ + * last change: $Author: mhu $ $Date: 2001-03-13 20:59:02 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -54,13 +54,13 @@ * * All Rights Reserved. * - * Contributor(s): _______________________________________ + * Contributor(s): Matthias Huetsch <matthias.huetsch@sun.com> * * ************************************************************************/ #ifndef _STORE_STORDATA_HXX_ -#define _STORE_STORDATA_HXX_ "$Revision: 1.1.1.1 $" +#define _STORE_STORDATA_HXX_ "$Revision: 1.2 $" #ifndef _SAL_TYPES_H_ #include <sal/types.h> @@ -70,27 +70,23 @@ #include <rtl/memory.h> #endif -#ifndef _VOS_MACROS_HXX_ -#include <vos/macros.hxx> +#ifndef _OSL_ENDIAN_H_ +#include <osl/endian.h> #endif -#ifndef _VOS_MUTEX_HXX_ -#include <vos/mutex.hxx> +#ifndef _OSL_MUTEX_HXX_ +#include <osl/mutex.hxx> #endif #ifndef _STORE_TYPES_H_ #include <store/types.h> #endif -#ifndef _STORE_MACROS_HXX_ -#include <store/macros.hxx> -#endif #ifndef _STORE_STORBASE_HXX_ #include <storbase.hxx> #endif -#ifdef _USE_NAMESPACE -namespace store { -#endif +namespace store +{ /*======================================================================== * @@ -99,8 +95,7 @@ namespace store { *======================================================================*/ #define STORE_MAGIC_DATAPAGE 0x94190310UL -struct OStoreDataPageData : - public NAMESPACE_STORE(OStorePageData) +struct OStoreDataPageData : public store::OStorePageData { typedef OStorePageData base; typedef OStoreDataPageData self; @@ -165,8 +160,7 @@ struct OStoreDataPageData : * OStoreDataPageObject. * *======================================================================*/ -class OStoreDataPageObject : - public NAMESPACE_STORE(OStorePageObject) +class OStoreDataPageObject : public store::OStorePageObject { typedef OStorePageObject base; typedef OStoreDataPageData page; @@ -194,8 +188,7 @@ inline OStoreDataPageObject::OStoreDataPageObject (page& rPage) *======================================================================*/ #define STORE_MAGIC_INDIRECTPAGE 0x89191107UL -struct OStoreIndirectionPageData : - public NAMESPACE_STORE(OStorePageData) +struct OStoreIndirectionPageData : public store::OStorePageData { typedef OStorePageData base; typedef OStoreIndirectionPageData self; @@ -261,7 +254,7 @@ struct OStoreIndirectionPageData : nCRC32 = G::crc32 (nCRC32, &m_aGuard.m_nMagic, sizeof(sal_uInt32)); nCRC32 = G::crc32 (nCRC32, m_pData, capacity(rDescr)); #ifdef OSL_BIGENDIAN - nCRC32 = VOS_SWAPDWORD(nCRC32); + nCRC32 = OSL_SWAPDWORD(nCRC32); #endif /* OSL_BIGENDIAN */ m_aGuard.m_nCRC32 = nCRC32; } @@ -274,7 +267,7 @@ struct OStoreIndirectionPageData : nCRC32 = G::crc32 (nCRC32, &m_aGuard.m_nMagic, sizeof(sal_uInt32)); nCRC32 = G::crc32 (nCRC32, m_pData, capacity(rDescr)); #ifdef OSL_BIGENDIAN - nCRC32 = VOS_SWAPDWORD(nCRC32); + nCRC32 = OSL_SWAPDWORD(nCRC32); #endif /* OSL_BIGENDIAN */ if (m_aGuard.m_nCRC32 != nCRC32) return store_E_InvalidChecksum; @@ -288,8 +281,7 @@ struct OStoreIndirectionPageData : * OStoreIndirectionPageObject. * *======================================================================*/ -class OStoreIndirectionPageObject : - public NAMESPACE_STORE(OStorePageObject) +class OStoreIndirectionPageObject : public store::OStorePageObject { typedef OStorePageObject base; typedef OStoreIndirectionPageData page; @@ -313,7 +305,7 @@ public: sal_uInt16 nSingle, OStoreDataPageObject &rData, OStorePageBIOS &rBIOS, - NAMESPACE_VOS(IMutex) *pMutex = NULL); + osl::Mutex *pMutex = NULL); storeError get ( sal_uInt16 nDouble, @@ -321,7 +313,7 @@ public: page *&rpSingle, OStoreDataPageObject &rData, OStorePageBIOS &rBIOS, - NAMESPACE_VOS(IMutex) *pMutex = NULL); + osl::Mutex *pMutex = NULL); storeError get ( sal_uInt16 nTriple, @@ -331,7 +323,7 @@ public: page *&rpSingle, OStoreDataPageObject &rData, OStorePageBIOS &rBIOS, - NAMESPACE_VOS(IMutex) *pMutex = NULL); + osl::Mutex *pMutex = NULL); /** put (indirect data page). */ @@ -339,7 +331,7 @@ public: sal_uInt16 nSingle, OStoreDataPageObject &rData, OStorePageBIOS &rBIOS, - NAMESPACE_VOS(IMutex) *pMutex = NULL); + osl::Mutex *pMutex = NULL); storeError put ( sal_uInt16 nDouble, @@ -347,7 +339,7 @@ public: page *&rpSingle, OStoreDataPageObject &rData, OStorePageBIOS &rBIOS, - NAMESPACE_VOS(IMutex) *pMutex = NULL); + osl::Mutex *pMutex = NULL); storeError put ( sal_uInt16 nTriple, @@ -357,7 +349,7 @@ public: page *&rpSingle, OStoreDataPageObject &rData, OStorePageBIOS &rBIOS, - NAMESPACE_VOS(IMutex) *pMutex = NULL); + osl::Mutex *pMutex = NULL); /** truncate (indirect data page). */ @@ -365,7 +357,7 @@ public: sal_uInt16 nSingle, OStoreDataPageObject &rData, OStorePageBIOS &rBIOS, - NAMESPACE_VOS(IMutex) *pMutex = NULL); + osl::Mutex *pMutex = NULL); storeError truncate ( sal_uInt16 nDouble, @@ -373,7 +365,7 @@ public: page *&rpSingle, OStoreDataPageObject &rData, OStorePageBIOS &rBIOS, - NAMESPACE_VOS(IMutex) *pMutex = NULL); + osl::Mutex *pMutex = NULL); storeError truncate ( sal_uInt16 nTriple, @@ -383,7 +375,7 @@ public: page *&rpSingle, OStoreDataPageObject &rData, OStorePageBIOS &rBIOS, - NAMESPACE_VOS(IMutex) *pMutex = NULL); + osl::Mutex *pMutex = NULL); private: /** Representation. @@ -494,7 +486,7 @@ struct OStoreDirectoryDataBlock #ifdef OSL_BIGENDIAN m_aGuard.swap(); m_aTable.swap(); - m_nDataLen = VOS_SWAPDWORD(m_nDataLen); + m_nDataLen = OSL_SWAPDWORD(m_nDataLen); #endif /* OSL_BIGENDIAN */ } @@ -506,7 +498,7 @@ struct OStoreDirectoryDataBlock nCRC32 = G::crc32 (nCRC32, &m_aGuard.m_nMagic, sizeof(sal_uInt32)); nCRC32 = G::crc32 (nCRC32, &m_aTable, size() - sizeof(G)); #ifdef OSL_BIGENDIAN - nCRC32 = VOS_SWAPDWORD(nCRC32); + nCRC32 = OSL_SWAPDWORD(nCRC32); #endif /* OSL_BIGENDIAN */ m_aGuard.m_nCRC32 = nCRC32; } @@ -519,7 +511,7 @@ struct OStoreDirectoryDataBlock nCRC32 = G::crc32 (nCRC32, &m_aGuard.m_nMagic, sizeof(sal_uInt32)); nCRC32 = G::crc32 (nCRC32, &m_aTable, size() - sizeof(G)); #ifdef OSL_BIGENDIAN - nCRC32 = VOS_SWAPDWORD(nCRC32); + nCRC32 = OSL_SWAPDWORD(nCRC32); #endif /* OSL_BIGENDIAN */ if (m_aGuard.m_nCRC32 != nCRC32) return store_E_InvalidChecksum; @@ -611,8 +603,7 @@ struct OStoreDirectoryDataBlock *======================================================================*/ #define STORE_MAGIC_DIRECTORYPAGE 0x62190120UL -struct OStoreDirectoryPageData : - public NAMESPACE_STORE(OStorePageData) +struct OStoreDirectoryPageData : public store::OStorePageData { typedef OStorePageData base; typedef OStoreDirectoryPageData self; @@ -767,8 +758,7 @@ struct OStoreDirectoryPageData : * OStoreDirectoryPageObject. * *======================================================================*/ -class OStoreDirectoryPageObject : - public NAMESPACE_STORE(OStorePageObject) +class OStoreDirectoryPageObject : public store::OStorePageObject { typedef OStorePageObject base; typedef OStoreDirectoryPageData page; @@ -874,7 +864,7 @@ public: indirect *&rpTriple, OStoreDataPageObject &rData, OStorePageBIOS &rBIOS, - NAMESPACE_VOS(IMutex) *pMutex = NULL); + osl::Mutex *pMutex = NULL); /** put (external data page). */ @@ -885,7 +875,7 @@ public: indirect *&rpTriple, OStoreDataPageObject &rData, OStorePageBIOS &rBIOS, - NAMESPACE_VOS(IMutex) *pMutex = NULL); + osl::Mutex *pMutex = NULL); /** truncate (external data page). */ @@ -896,7 +886,7 @@ public: indirect *&rpTriple, OStoreDataPageObject &rData, OStorePageBIOS &rBIOS, - NAMESPACE_VOS(IMutex) *pMutex = NULL); + osl::Mutex *pMutex = NULL); private: /** Representation. @@ -913,7 +903,7 @@ private: indirect *&rpTriple, OStoreDataPageObject &rData, OStorePageBIOS &rBIOS, - NAMESPACE_VOS(IMutex) *pMutex = NULL); + osl::Mutex *pMutex = NULL); }; inline OStoreDirectoryPageObject::OStoreDirectoryPageObject (page& rPage) @@ -926,9 +916,8 @@ inline OStoreDirectoryPageObject::OStoreDirectoryPageObject (page& rPage) * The End. * *======================================================================*/ -#ifdef _USE_NAMESPACE -} -#endif + +} // namespace store #endif /* !_STORE_STORDATA_HXX_ */ diff --git a/store/source/store.cxx b/store/source/store.cxx index 1cc981f79..a7c113af3 100644 --- a/store/source/store.cxx +++ b/store/source/store.cxx @@ -2,9 +2,9 @@ * * $RCSfile: store.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 15:18:32 $ + * last change: $Author: mhu $ $Date: 2001-03-13 20:49:56 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -54,12 +54,12 @@ * * All Rights Reserved. * - * Contributor(s): _______________________________________ + * Contributor(s): Matthias Huetsch <matthias.huetsch@sun.com> * * ************************************************************************/ -#define _STORE_STORE_CXX_ "$Revision: 1.1.1.1 $" +#define _STORE_STORE_CXX_ "$Revision: 1.2 $" #ifndef _SAL_TYPES_H_ #include <sal/types.h> @@ -71,20 +71,13 @@ #ifndef _RTL_STRING_HXX_ #include <rtl/string.hxx> #endif - -#ifndef _VOS_OBJECT_HXX_ -#include <vos/object.hxx> -#endif -#ifndef _VOS_REF_HXX_ -#include <vos/ref.hxx> +#ifndef _RTL_REF_HXX_ +#include <rtl/ref.hxx> #endif #ifndef _STORE_STORE_H_ #include <store/store.h> #endif -#ifndef _STORE_MACROS_HXX_ -#include <store/macros.hxx> -#endif #ifndef _STORE_OBJECT_HXX_ #include <store/object.hxx> #endif @@ -105,12 +98,10 @@ #include <storlckb.hxx> #endif -#ifdef _USE_NAMESPACE -using namespace rtl; -using namespace store; -#endif +using rtl::Reference; +using rtl::OString; -typedef NAMESPACE_VOS(ORef)<OStorePageManager> OStorePageManagerRef; +using namespace store; /*======================================================================== * @@ -120,32 +111,30 @@ typedef NAMESPACE_VOS(ORef)<OStorePageManager> OStorePageManagerRef; /* * store_acquireHandle. */ -storeError SAL_CALL store_acquireHandle (storeHandle Handle) +storeError SAL_CALL store_acquireHandle ( + storeHandle Handle +) SAL_THROW_EXTERN_C() { - OStoreObject *pObj = (OStoreObject*)Handle; - if (!pObj) - return store_E_InvalidHandle; - - if (!pObj->isKindOf (VOS_CLASSINFO (OStoreObject))) + IStoreHandle *pHandle = static_cast<IStoreHandle*>(Handle); + if (!pHandle) return store_E_InvalidHandle; - pObj->acquire(); + pHandle->acquire(); return store_E_None; } /* * store_releaseHandle. */ -storeError SAL_CALL store_releaseHandle (storeHandle Handle) +storeError SAL_CALL store_releaseHandle ( + storeHandle Handle +) SAL_THROW_EXTERN_C() { - OStoreObject *pObj = (OStoreObject*)Handle; - if (!pObj) - return store_E_InvalidHandle; - - if (!pObj->isKindOf (VOS_CLASSINFO (OStoreObject))) + IStoreHandle *pHandle = static_cast<IStoreHandle*>(Handle); + if (!pHandle) return store_E_InvalidHandle; - pObj->release(); + pHandle->release(); return store_E_None; } @@ -159,18 +148,19 @@ storeError SAL_CALL store_releaseHandle (storeHandle Handle) */ storeError SAL_CALL store_createMemoryFile ( sal_uInt16 nPageSize, - storeFileHandle *phFile) + storeFileHandle *phFile +) SAL_THROW_EXTERN_C() { if (!phFile) return store_E_InvalidParameter; *phFile = NULL; - NAMESPACE_VOS(ORef)<OMemoryLockBytes> xLockBytes (new OMemoryLockBytes()); - if (!xLockBytes.isValid()) + Reference<OMemoryLockBytes> xLockBytes (new OMemoryLockBytes()); + if (!xLockBytes.is()) return store_E_OutOfMemory; - NAMESPACE_VOS(ORef)<OStorePageManager> xManager (new OStorePageManager()); - if (!xManager.isValid()) + Reference<OStorePageManager> xManager (new OStorePageManager()); + if (!xManager.is()) return store_E_OutOfMemory; storeError eErrCode = xManager->initialize ( @@ -191,7 +181,8 @@ storeError SAL_CALL store_openFile ( rtl_uString *pFilename, storeAccessMode eAccessMode, sal_uInt16 nPageSize, - storeFileHandle *phFile) + storeFileHandle *phFile +) SAL_THROW_EXTERN_C() { if (phFile) *phFile = NULL; @@ -199,16 +190,16 @@ storeError SAL_CALL store_openFile ( if (!(pFilename && phFile)) return store_E_InvalidParameter; - NAMESPACE_VOS(ORef)<OFileLockBytes> xLockBytes (new OFileLockBytes()); - if (!xLockBytes.isValid()) + Reference<OFileLockBytes> xLockBytes (new OFileLockBytes()); + if (!xLockBytes.is()) return store_E_OutOfMemory; storeError eErrCode = xLockBytes->create (pFilename, eAccessMode); if (eErrCode != store_E_None) return eErrCode; - NAMESPACE_VOS(ORef)<OStorePageManager> xManager (new OStorePageManager()); - if (!xManager.isValid()) + Reference<OStorePageManager> xManager (new OStorePageManager()); + if (!xManager.is()) return store_E_OutOfMemory; eErrCode = xManager->initialize (&*xLockBytes, eAccessMode, nPageSize); @@ -224,30 +215,30 @@ storeError SAL_CALL store_openFile ( /* * store_closeFile. */ -storeError SAL_CALL store_closeFile (storeFileHandle Handle) +storeError SAL_CALL store_closeFile ( + storeFileHandle Handle +) SAL_THROW_EXTERN_C() { - OStorePageManager *pObj = (OStorePageManager*)Handle; - if (!pObj) + OStorePageManager *pManager = + OStoreHandle<OStorePageManager>::query (Handle); + if (!pManager) return store_E_InvalidHandle; - if (!pObj->isKindOf (VOS_CLASSINFO (OStorePageManager))) - return store_E_InvalidHandle; - - pObj->close(); - pObj->release(); + pManager->close(); + pManager->release(); return store_E_None; } /* * store_flushFile. */ -storeError SAL_CALL store_flushFile (storeFileHandle Handle) +storeError SAL_CALL store_flushFile ( + storeFileHandle Handle +) SAL_THROW_EXTERN_C() { - OStorePageManagerRef xManager ((OStorePageManager*)Handle); - if (!xManager.isValid()) - return store_E_InvalidHandle; - - if (!xManager->isKindOf (VOS_CLASSINFO (OStorePageManager))) + OStoreHandle<OStorePageManager> xManager ( + OStoreHandle<OStorePageManager>::query (Handle)); + if (!xManager.is()) return store_E_InvalidHandle; return xManager->flush(); @@ -257,13 +248,13 @@ storeError SAL_CALL store_flushFile (storeFileHandle Handle) * store_getFileRefererCount. */ storeError SAL_CALL store_getFileRefererCount ( - storeFileHandle Handle, sal_uInt32 *pnRefCount) + storeFileHandle Handle, + sal_uInt32 *pnRefCount +) SAL_THROW_EXTERN_C() { - OStorePageManagerRef xManager ((OStorePageManager*)Handle); - if (!xManager.isValid()) - return store_E_InvalidHandle; - - if (!xManager->isKindOf (VOS_CLASSINFO (OStorePageManager))) + OStoreHandle<OStorePageManager> xManager ( + OStoreHandle<OStorePageManager>::query (Handle)); + if (!xManager.is()) return store_E_InvalidHandle; if (!pnRefCount) @@ -277,13 +268,13 @@ storeError SAL_CALL store_getFileRefererCount ( * store_getFileSize. */ storeError SAL_CALL store_getFileSize ( - storeFileHandle Handle, sal_uInt32 *pnSize) + storeFileHandle Handle, + sal_uInt32 *pnSize +) SAL_THROW_EXTERN_C() { - OStorePageManagerRef xManager ((OStorePageManager*)Handle); - if (!xManager.isValid()) - return store_E_InvalidHandle; - - if (!xManager->isKindOf (VOS_CLASSINFO (OStorePageManager))) + OStoreHandle<OStorePageManager> xManager ( + OStoreHandle<OStorePageManager>::query (Handle)); + if (!xManager.is()) return store_E_InvalidHandle; if (!pnSize) @@ -297,27 +288,28 @@ storeError SAL_CALL store_getFileSize ( */ storeError SAL_CALL store_rebuildFile ( rtl_uString *pSrcFilename, - rtl_uString *pDstFilename) + rtl_uString *pDstFilename +) SAL_THROW_EXTERN_C() { storeError eErrCode = store_E_None; if (!(pSrcFilename && pDstFilename)) return store_E_InvalidParameter; - OStorePageManagerRef xManager (new OStorePageManager()); - if (!xManager.isValid()) + Reference<OStorePageManager> xManager (new OStorePageManager()); + if (!xManager.is()) return store_E_OutOfMemory; - NAMESPACE_VOS(ORef)<OFileLockBytes> xSrcLB (new OFileLockBytes()); - if (!xSrcLB.isValid()) + Reference<OFileLockBytes> xSrcLB (new OFileLockBytes()); + if (!xSrcLB.is()) return store_E_OutOfMemory; eErrCode = xSrcLB->create (pSrcFilename, store_AccessReadOnly); if (eErrCode != store_E_None) return eErrCode; - NAMESPACE_VOS(ORef)<OFileLockBytes> xDstLB (new OFileLockBytes()); - if (!xDstLB.isValid()) + Reference<OFileLockBytes> xDstLB (new OFileLockBytes()); + if (!xDstLB.is()) return store_E_OutOfMemory; eErrCode = xDstLB->create (pDstFilename, store_AccessCreate); @@ -332,8 +324,6 @@ storeError SAL_CALL store_rebuildFile ( * storeDirectoryHandle implementation. * *======================================================================*/ -typedef NAMESPACE_VOS(ORef)<OStoreDirectory> OStoreDirectoryRef; - /* * store_openDirectory. */ @@ -342,24 +332,23 @@ storeError SAL_CALL store_openDirectory ( rtl_uString *pPath, rtl_uString *pName, storeAccessMode eAccessMode, - storeDirectoryHandle *phDirectory) + storeDirectoryHandle *phDirectory +) SAL_THROW_EXTERN_C() { storeError eErrCode = store_E_None; if (phDirectory) *phDirectory = NULL; - OStorePageManagerRef xManager ((OStorePageManager*)hFile); - if (!xManager.isValid()) - return store_E_InvalidHandle; - - if (!xManager->isKindOf (VOS_CLASSINFO (OStorePageManager))) + OStoreHandle<OStorePageManager> xManager ( + OStoreHandle<OStorePageManager>::query (hFile)); + if (!xManager.is()) return store_E_InvalidHandle; if (!(pPath && pName && phDirectory)) return store_E_InvalidParameter; - OStoreDirectoryRef xDirectory (new OStoreDirectory()); - if (!xDirectory.isValid()) + Reference<OStoreDirectory> xDirectory (new OStoreDirectory()); + if (!xDirectory.is()) return store_E_OutOfMemory; eErrCode = xDirectory->create (&*xManager, pPath, pName, eAccessMode); @@ -375,16 +364,16 @@ storeError SAL_CALL store_openDirectory ( /* * store_closeDirectory. */ -storeError SAL_CALL store_closeDirectory (storeDirectoryHandle Handle) +storeError SAL_CALL store_closeDirectory ( + storeDirectoryHandle Handle +) SAL_THROW_EXTERN_C() { - OStoreDirectory *pObj = (OStoreDirectory*)Handle; - if (!pObj) + OStoreDirectory *pDirectory = + OStoreHandle<OStoreDirectory>::query (Handle); + if (!pDirectory) return store_E_InvalidHandle; - if (!pObj->isKindOf (VOS_CLASSINFO (OStoreDirectory))) - return store_E_InvalidHandle; - - pObj->release(); + pDirectory->release(); return store_E_None; } @@ -393,13 +382,12 @@ storeError SAL_CALL store_closeDirectory (storeDirectoryHandle Handle) */ storeError SAL_CALL store_findFirst ( storeDirectoryHandle Handle, - storeFindData *pFindData) + storeFindData *pFindData +) SAL_THROW_EXTERN_C() { - OStoreDirectoryRef xDirectory ((OStoreDirectory*)Handle); - if (!xDirectory.isValid()) - return store_E_InvalidHandle; - - if (!xDirectory->isKindOf (VOS_CLASSINFO (OStoreDirectory))) + OStoreHandle<OStoreDirectory> xDirectory ( + OStoreHandle<OStoreDirectory>::query (Handle)); + if (!xDirectory.is()) return store_E_InvalidHandle; if (!pFindData) @@ -418,13 +406,12 @@ storeError SAL_CALL store_findFirst ( */ storeError SAL_CALL store_findNext ( storeDirectoryHandle Handle, - storeFindData *pFindData) + storeFindData *pFindData +) SAL_THROW_EXTERN_C() { - OStoreDirectoryRef xDirectory ((OStoreDirectory*)Handle); - if (!xDirectory.isValid()) - return store_E_InvalidHandle; - - if (!xDirectory->isKindOf (VOS_CLASSINFO (OStoreDirectory))) + OStoreHandle<OStoreDirectory> xDirectory ( + OStoreHandle<OStoreDirectory>::query (Handle)); + if (!xDirectory.is()) return store_E_InvalidHandle; if (!pFindData) @@ -444,8 +431,6 @@ storeError SAL_CALL store_findNext ( * storeStreamHandle implementation. * *======================================================================*/ -typedef NAMESPACE_VOS(ORef)<OStoreLockBytes> OStoreLockBytesRef; - /* * store_openStream */ @@ -454,24 +439,23 @@ storeError SAL_CALL store_openStream ( rtl_uString *pPath, rtl_uString *pName, storeAccessMode eAccessMode, - storeStreamHandle *phStream) + storeStreamHandle *phStream +) SAL_THROW_EXTERN_C() { storeError eErrCode = store_E_None; if (phStream) *phStream = NULL; - OStorePageManagerRef xManager ((OStorePageManager*)hFile); - if (!xManager.isValid()) - return store_E_InvalidHandle; - - if (!xManager->isKindOf (VOS_CLASSINFO (OStorePageManager))) + OStoreHandle<OStorePageManager> xManager ( + OStoreHandle<OStorePageManager>::query (hFile)); + if (!xManager.is()) return store_E_InvalidHandle; if (!(pPath && pName && phStream)) return store_E_InvalidParameter; - OStoreLockBytesRef xLockBytes (new OStoreLockBytes()); - if (!xLockBytes.isValid()) + Reference<OStoreLockBytes> xLockBytes (new OStoreLockBytes()); + if (!xLockBytes.is()) return store_E_OutOfMemory; eErrCode = xLockBytes->create (&*xManager, pPath, pName, eAccessMode); @@ -487,16 +471,16 @@ storeError SAL_CALL store_openStream ( /* * store_closeStream. */ -storeError SAL_CALL store_closeStream (storeStreamHandle Handle) +storeError SAL_CALL store_closeStream ( + storeStreamHandle Handle +) SAL_THROW_EXTERN_C() { - OStoreLockBytes *pObj = (OStoreLockBytes*)Handle; - if (!pObj) + OStoreLockBytes *pLockBytes = + OStoreHandle<OStoreLockBytes>::query (Handle); + if (!pLockBytes) return store_E_InvalidHandle; - if (!pObj->isKindOf (VOS_CLASSINFO (OStoreLockBytes))) - return store_E_InvalidHandle; - - pObj->release(); + pLockBytes->release(); return store_E_None; } @@ -508,13 +492,12 @@ storeError SAL_CALL store_readStream ( sal_uInt32 nOffset, void *pBuffer, sal_uInt32 nBytes, - sal_uInt32 *pnDone) + sal_uInt32 *pnDone +) SAL_THROW_EXTERN_C() { - OStoreLockBytesRef xLockBytes ((OStoreLockBytes*)Handle); - if (!xLockBytes.isValid()) - return store_E_InvalidHandle; - - if (!xLockBytes->isKindOf (VOS_CLASSINFO (OStoreLockBytes))) + OStoreHandle<OStoreLockBytes> xLockBytes ( + OStoreHandle<OStoreLockBytes>::query (Handle)); + if (!xLockBytes.is()) return store_E_InvalidHandle; if (!(pBuffer && pnDone)) @@ -531,13 +514,12 @@ storeError SAL_CALL store_writeStream ( sal_uInt32 nOffset, const void *pBuffer, sal_uInt32 nBytes, - sal_uInt32 *pnDone) + sal_uInt32 *pnDone +) SAL_THROW_EXTERN_C() { - OStoreLockBytesRef xLockBytes ((OStoreLockBytes*)Handle); - if (!xLockBytes.isValid()) - return store_E_InvalidHandle; - - if (!xLockBytes->isKindOf (VOS_CLASSINFO (OStoreLockBytes))) + OStoreHandle<OStoreLockBytes> xLockBytes ( + OStoreHandle<OStoreLockBytes>::query (Handle)); + if (!xLockBytes.is()) return store_E_InvalidHandle; if (!(pBuffer && pnDone)) @@ -549,13 +531,13 @@ storeError SAL_CALL store_writeStream ( /* * store_flushStream. */ -storeError SAL_CALL store_flushStream (storeStreamHandle Handle) +storeError SAL_CALL store_flushStream ( + storeStreamHandle Handle +) SAL_THROW_EXTERN_C() { - OStoreLockBytesRef xLockBytes ((OStoreLockBytes*)Handle); - if (!xLockBytes.isValid()) - return store_E_InvalidHandle; - - if (!xLockBytes->isKindOf (VOS_CLASSINFO (OStoreLockBytes))) + OStoreHandle<OStoreLockBytes> xLockBytes ( + OStoreHandle<OStoreLockBytes>::query (Handle)); + if (!xLockBytes.is()) return store_E_InvalidHandle; return xLockBytes->flush(); @@ -565,13 +547,13 @@ storeError SAL_CALL store_flushStream (storeStreamHandle Handle) * store_getStreamSize. */ storeError SAL_CALL store_getStreamSize ( - storeStreamHandle Handle, sal_uInt32 *pnSize) + storeStreamHandle Handle, + sal_uInt32 *pnSize +) SAL_THROW_EXTERN_C() { - OStoreLockBytesRef xLockBytes ((OStoreLockBytes*)Handle); - if (!xLockBytes.isValid()) - return store_E_InvalidHandle; - - if (!xLockBytes->isKindOf (VOS_CLASSINFO (OStoreLockBytes))) + OStoreHandle<OStoreLockBytes> xLockBytes ( + OStoreHandle<OStoreLockBytes>::query (Handle)); + if (!xLockBytes.is()) return store_E_InvalidHandle; if (!pnSize) @@ -584,13 +566,13 @@ storeError SAL_CALL store_getStreamSize ( * store_setStreamSize. */ storeError SAL_CALL store_setStreamSize ( - storeStreamHandle Handle, sal_uInt32 nSize) + storeStreamHandle Handle, + sal_uInt32 nSize +) SAL_THROW_EXTERN_C() { - OStoreLockBytesRef xLockBytes ((OStoreLockBytes*)Handle); - if (!xLockBytes.isValid()) - return store_E_InvalidHandle; - - if (!xLockBytes->isKindOf (VOS_CLASSINFO (OStoreLockBytes))) + OStoreHandle<OStoreLockBytes> xLockBytes ( + OStoreHandle<OStoreLockBytes>::query (Handle)); + if (!xLockBytes.is()) return store_E_InvalidHandle; return xLockBytes->setSize (nSize); @@ -610,17 +592,16 @@ storeError SAL_CALL store_attrib ( rtl_uString *pName, sal_uInt32 nMask1, sal_uInt32 nMask2, - sal_uInt32 *pnAttrib) + sal_uInt32 *pnAttrib +) SAL_THROW_EXTERN_C() { storeError eErrCode = store_E_None; if (pnAttrib) *pnAttrib = 0; - OStorePageManagerRef xManager ((OStorePageManager*)Handle); - if (!xManager.isValid()) - return store_E_InvalidHandle; - - if (!xManager->isKindOf (VOS_CLASSINFO (OStorePageManager))) + OStoreHandle<OStorePageManager> xManager ( + OStoreHandle<OStorePageManager>::query (Handle)); + if (!xManager.is()) return store_E_InvalidHandle; if (!(pPath && pName)) @@ -649,15 +630,14 @@ storeError SAL_CALL store_attrib ( storeError SAL_CALL store_link ( storeFileHandle Handle, rtl_uString *pSrcPath, rtl_uString *pSrcName, - rtl_uString *pDstPath, rtl_uString *pDstName) + rtl_uString *pDstPath, rtl_uString *pDstName +) SAL_THROW_EXTERN_C() { storeError eErrCode = store_E_None; - OStorePageManagerRef xManager ((OStorePageManager*)Handle); - if (!xManager.isValid()) - return store_E_InvalidHandle; - - if (!xManager->isKindOf (VOS_CLASSINFO (OStorePageManager))) + OStoreHandle<OStorePageManager> xManager ( + OStoreHandle<OStorePageManager>::query (Handle)); + if (!xManager.is()) return store_E_InvalidHandle; if (!(pSrcPath && pSrcName)) @@ -700,15 +680,14 @@ storeError SAL_CALL store_link ( storeError SAL_CALL store_symlink ( storeFileHandle Handle, rtl_uString *pSrcPath, rtl_uString *pSrcName, - rtl_uString *pDstPath, rtl_uString *pDstName) + rtl_uString *pDstPath, rtl_uString *pDstName +) SAL_THROW_EXTERN_C() { storeError eErrCode = store_E_None; - OStorePageManagerRef xManager ((OStorePageManager*)Handle); - if (!xManager.isValid()) - return store_E_InvalidHandle; - - if (!xManager->isKindOf (VOS_CLASSINFO (OStorePageManager))) + OStoreHandle<OStorePageManager> xManager ( + OStoreHandle<OStorePageManager>::query (Handle)); + if (!xManager.is()) return store_E_InvalidHandle; if (!(pSrcPath && pSrcName)) @@ -744,15 +723,14 @@ storeError SAL_CALL store_symlink ( storeError SAL_CALL store_rename ( storeFileHandle Handle, rtl_uString *pSrcPath, rtl_uString *pSrcName, - rtl_uString *pDstPath, rtl_uString *pDstName) + rtl_uString *pDstPath, rtl_uString *pDstName +) SAL_THROW_EXTERN_C() { storeError eErrCode = store_E_None; - OStorePageManagerRef xManager ((OStorePageManager*)Handle); - if (!xManager.isValid()) - return store_E_InvalidHandle; - - if (!xManager->isKindOf (VOS_CLASSINFO (OStorePageManager))) + OStoreHandle<OStorePageManager> xManager ( + OStoreHandle<OStorePageManager>::query (Handle)); + if (!xManager.is()) return store_E_InvalidHandle; if (!(pSrcPath && pSrcName)) @@ -788,15 +766,14 @@ storeError SAL_CALL store_rename ( storeError SAL_CALL store_remove ( storeFileHandle Handle, rtl_uString *pPath, - rtl_uString *pName) + rtl_uString *pName +) SAL_THROW_EXTERN_C() { storeError eErrCode = store_E_None; - OStorePageManagerRef xManager ((OStorePageManager*)Handle); - if (!xManager.isValid()) - return store_E_InvalidHandle; - - if (!xManager->isKindOf (VOS_CLASSINFO (OStorePageManager))) + OStoreHandle<OStorePageManager> xManager ( + OStoreHandle<OStorePageManager>::query (Handle)); + if (!xManager.is()) return store_E_InvalidHandle; if (!(pPath && pName)) diff --git a/store/source/storlckb.cxx b/store/source/storlckb.cxx index 2a9ad329f..20d42dcd1 100644 --- a/store/source/storlckb.cxx +++ b/store/source/storlckb.cxx @@ -2,9 +2,9 @@ * * $RCSfile: storlckb.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 15:18:32 $ + * last change: $Author: mhu $ $Date: 2001-03-13 21:03:26 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -54,16 +54,19 @@ * * All Rights Reserved. * - * Contributor(s): _______________________________________ + * Contributor(s): Matthias Huetsch <matthias.huetsch@sun.com> * * ************************************************************************/ -#define _STORE_STORLCKB_CXX_ "$Revision: 1.1.1.1 $" +#define _STORE_STORLCKB_CXX_ "$Revision: 1.2 $" #ifndef _SAL_TYPES_H_ #include <sal/types.h> #endif +#ifndef _SAL_MACROS_H_ +#include <sal/macros.h> +#endif #ifndef _RTL_MEMORY_H_ #include <rtl/memory.h> @@ -74,20 +77,17 @@ #ifndef _RTL_STRING_HXX_ #include <rtl/string.hxx> #endif - -#ifndef _VOS_MUTEX_HXX_ -#include <vos/mutex.hxx> +#ifndef _RTL_REF_HXX_ +#include <rtl/ref.hxx> #endif -#ifndef _VOS_REF_HXX_ -#include <vos/ref.hxx> + +#ifndef _OSL_MUTEX_HXX_ +#include <osl/mutex.hxx> #endif #ifndef _STORE_TYPES_H_ #include <store/types.h> #endif -#ifndef _STORE_MACROS_HXX_ -#include <store/macros.hxx> -#endif #ifndef _STORE_OBJECT_HXX_ #include <store/object.hxx> #endif @@ -109,10 +109,7 @@ #include <storlckb.hxx> #endif -#ifdef _USE_NAMESPACE -using namespace rtl; using namespace store; -#endif /*======================================================================== * @@ -219,11 +216,7 @@ static storeError __store_iget ( * OStoreDirectory implementation. * *======================================================================*/ -VOS_IMPLEMENT_CLASSINFO( - VOS_CLASSNAME (OStoreDirectory, store), - VOS_NAMESPACE (OStoreDirectory, store), - VOS_NAMESPACE (OStoreObject, store), - 0); +const sal_uInt32 OStoreDirectory::m_nTypeId = sal_uInt32(0x89191107); /* * OStoreDirectory. @@ -242,9 +235,9 @@ OStoreDirectory::OStoreDirectory (void) */ OStoreDirectory::~OStoreDirectory (void) { - if (m_xManager.isValid()) + if (m_xManager.is()) { - NAMESPACE_VOS(OGuard) aGuard (*m_xManager); + osl::MutexGuard aGuard (*m_xManager); if (m_pNode) { m_xManager->releasePage (m_aDescr, store_AccessReadOnly); @@ -255,6 +248,14 @@ OStoreDirectory::~OStoreDirectory (void) } /* + * isKindOf. + */ +sal_Bool SAL_CALL OStoreDirectory::isKindOf (sal_uInt32 nTypeId) +{ + return (nTypeId == m_nTypeId); +} + +/* * create. */ storeError OStoreDirectory::create ( @@ -263,14 +264,14 @@ storeError OStoreDirectory::create ( rtl_uString *pName, storeAccessMode eMode) { - NAMESPACE_VOS(ORef)<OStorePageManager> xManager (pManager); - if (!xManager.isValid()) + rtl::Reference<OStorePageManager> xManager (pManager); + if (!xManager.is()) return store_E_InvalidAccess; if (!(pPath && pName)) return store_E_InvalidParameter; - NAMESPACE_VOS(OGuard) aGuard (*xManager); + osl::MutexGuard aGuard (*xManager); storeError eErrCode = xManager->getPageSize (m_aDescr.m_nSize); if (eErrCode != store_E_None) return eErrCode; @@ -280,8 +281,8 @@ storeError OStoreDirectory::create ( if (!m_pNode) return store_E_OutOfMemory; - OString aPath (pPath->buffer, pPath->length, RTL_TEXTENCODING_UTF8); - OString aName (pName->buffer, pName->length, RTL_TEXTENCODING_UTF8); + rtl::OString aPath (pPath->buffer, pPath->length, RTL_TEXTENCODING_UTF8); + rtl::OString aName (pName->buffer, pName->length, RTL_TEXTENCODING_UTF8); eErrCode = __store_iget ( *xManager, *m_pNode, STORE_ATTRIB_ISDIR, @@ -316,7 +317,7 @@ storeError OStoreDirectory::create ( */ storeError OStoreDirectory::iterate (storeFindData &rFindData) { - if (!m_xManager.isValid()) + if (!m_xManager.is()) return store_E_InvalidAccess; storeError eErrCode = store_E_NoMoreFiles; @@ -324,7 +325,7 @@ storeError OStoreDirectory::iterate (storeFindData &rFindData) return eErrCode; // Acquire exclusive access. - NAMESPACE_VOS(OGuard) aGuard (*m_xManager); + osl::MutexGuard aGuard (*m_xManager); // Check TextConverter. if (m_hTextCvt == NULL) @@ -387,11 +388,7 @@ storeError OStoreDirectory::iterate (storeFindData &rFindData) * OStoreLockBytes implementation. * *======================================================================*/ -VOS_IMPLEMENT_CLASSINFO( - VOS_CLASSNAME (OStoreLockBytes, store), - VOS_NAMESPACE (OStoreLockBytes, store), - VOS_NAMESPACE (OStoreObject, store), - 0); +const sal_uInt32 OStoreLockBytes::m_nTypeId = sal_uInt32(0x94190310); /* * OStoreLockBytes. @@ -413,9 +410,9 @@ OStoreLockBytes::OStoreLockBytes (void) */ OStoreLockBytes::~OStoreLockBytes (void) { - if (m_xManager.isValid()) + if (m_xManager.is()) { - NAMESPACE_VOS(OGuard) aGuard (*m_xManager); + osl::MutexGuard aGuard (*m_xManager); if (m_pNode) { OStorePageDescriptor aDescr (m_pNode->m_aDescr); @@ -435,30 +432,27 @@ OStoreLockBytes::~OStoreLockBytes (void) } /* - * acquire. + * isKindOf. */ -NAMESPACE_VOS(IReference)::RefCount -SAL_CALL OStoreLockBytes::acquire (void) +sal_Bool SAL_CALL OStoreLockBytes::isKindOf (sal_uInt32 nTypeId) { - return OStoreObject::acquire(); + return (nTypeId == m_nTypeId); } /* - * release. + * acquire. */ -NAMESPACE_VOS(IReference)::RefCount -SAL_CALL OStoreLockBytes::release (void) +oslInterlockedCount SAL_CALL OStoreLockBytes::acquire (void) { - return OStoreObject::release(); + return OStoreObject::acquire(); } /* - * referenced. + * release. */ -NAMESPACE_VOS(IReference)::RefCount -SAL_CALL OStoreLockBytes::referenced (void) const +oslInterlockedCount SAL_CALL OStoreLockBytes::release (void) { - return OStoreObject::referenced(); + return OStoreObject::release(); } /* @@ -470,14 +464,14 @@ storeError OStoreLockBytes::create ( rtl_uString *pName, storeAccessMode eMode) { - NAMESPACE_VOS(ORef)<OStorePageManager> xManager (pManager); - if (!xManager.isValid()) + rtl::Reference<OStorePageManager> xManager (pManager); + if (!xManager.is()) return store_E_InvalidAccess; if (!(pPath && pName)) return store_E_InvalidParameter; - NAMESPACE_VOS(OGuard) aGuard (*xManager); + osl::MutexGuard aGuard (*xManager); storeError eErrCode = xManager->getPageSize (m_nPageSize); if (eErrCode != store_E_None) return eErrCode; @@ -487,8 +481,8 @@ storeError OStoreLockBytes::create ( if (!m_pNode) return store_E_OutOfMemory; - OString aPath (pPath->buffer, pPath->length, RTL_TEXTENCODING_UTF8); - OString aName (pName->buffer, pName->length, RTL_TEXTENCODING_UTF8); + rtl::OString aPath (pPath->buffer, pPath->length, RTL_TEXTENCODING_UTF8); + rtl::OString aName (pName->buffer, pName->length, RTL_TEXTENCODING_UTF8); eErrCode = __store_iget ( *xManager, *m_pNode, STORE_ATTRIB_ISFILE, @@ -537,7 +531,7 @@ storeError OStoreLockBytes::readAt ( { rnDone = 0; - if (!m_xManager.isValid()) + if (!m_xManager.is()) return store_E_InvalidAccess; if (!pBuffer) @@ -546,7 +540,7 @@ storeError OStoreLockBytes::readAt ( return store_E_None; // Acquire exclusive access. - NAMESPACE_VOS(OGuard) aGuard (*m_xManager); + osl::MutexGuard aGuard (*m_xManager); // Determine data length. OStoreDirectoryPageObject aPage (*m_pNode); @@ -566,7 +560,9 @@ storeError OStoreLockBytes::readAt ( // Read from inode page (internal scope). inode::ChunkDescriptor aDescr ( nOffset, m_pNode->capacity()); - sal_uInt32 nLength = VOS_MIN (aDescr.m_nLength, nBytes); + + sal_uInt32 nLength = sal_uInt32(aDescr.m_nLength); + nLength = SAL_MIN(nLength, nBytes); rtl_copyMemory ( &pData[rnDone], @@ -589,7 +585,9 @@ storeError OStoreLockBytes::readAt ( inode::ChunkDescriptor aDescr ( nOffset - m_pNode->capacity(), m_pData->capacity()); - sal_uInt32 nLength = VOS_MIN (aDescr.m_nLength, nBytes); + + sal_uInt32 nLength = sal_uInt32(aDescr.m_nLength); + nLength = SAL_MIN(nLength, nBytes); storeError eErrCode = aPage.get ( aDescr.m_nPage, m_pSingle, m_pDouble, m_pTriple, @@ -633,7 +631,7 @@ storeError OStoreLockBytes::writeAt ( { rnDone = 0; - if (!m_xManager.isValid()) + if (!m_xManager.is()) return store_E_InvalidAccess; if (!m_bWriteable) return store_E_AccessViolation; @@ -644,7 +642,7 @@ storeError OStoreLockBytes::writeAt ( return store_E_None; // Acquire exclusive access. - NAMESPACE_VOS(OGuard) aGuard (*m_xManager); + osl::MutexGuard aGuard (*m_xManager); // Write data. OStoreDirectoryPageObject aPage (*m_pNode); @@ -660,7 +658,9 @@ storeError OStoreLockBytes::writeAt ( // Write to inode page (internal scope). inode::ChunkDescriptor aDescr ( nOffset, m_pNode->capacity()); - sal_uInt32 nLength = VOS_MIN (aDescr.m_nLength, nBytes); + + sal_uInt32 nLength = sal_uInt32(aDescr.m_nLength); + nLength = SAL_MIN(nLength, nBytes); rtl_copyMemory ( &m_pNode->m_pData[aDescr.m_nOffset], @@ -689,8 +689,8 @@ storeError OStoreLockBytes::writeAt ( inode::ChunkDescriptor aDescr ( nOffset - m_pNode->capacity(), m_pData->capacity()); - sal_uInt32 nLength = aDescr.m_nLength; + sal_uInt32 nLength = sal_uInt32(aDescr.m_nLength); if ((aDescr.m_nOffset > 0) || (nBytes < nLength)) { // Unaligned. Need to load/create data page. @@ -709,7 +709,7 @@ storeError OStoreLockBytes::writeAt ( } // Modify data page. - nLength = VOS_MIN (nLength, nBytes); + nLength = SAL_MIN(nLength, nBytes); rtl_copyMemory ( &m_pData->m_pData[aDescr.m_nOffset], @@ -745,7 +745,7 @@ storeError OStoreLockBytes::writeAt ( */ storeError OStoreLockBytes::flush (void) { - if (!m_xManager.isValid()) + if (!m_xManager.is()) return store_E_InvalidAccess; return m_xManager->flush(); @@ -756,13 +756,13 @@ storeError OStoreLockBytes::flush (void) */ storeError OStoreLockBytes::setSize (sal_uInt32 nSize) { - if (!m_xManager.isValid()) + if (!m_xManager.is()) return store_E_InvalidAccess; if (!m_bWriteable) return store_E_AccessViolation; // Acquire exclusive access. - NAMESPACE_VOS(OGuard) aGuard (*m_xManager); + osl::MutexGuard aGuard (*m_xManager); // Determine current length. OStoreDirectoryPageObject aPage (*m_pNode); @@ -843,7 +843,7 @@ storeError OStoreLockBytes::stat (sal_uInt32 &rnSize) { rnSize = 0; - if (!m_xManager.isValid()) + if (!m_xManager.is()) return store_E_InvalidAccess; rnSize = m_pNode->m_aDataBlock.m_nDataLen; diff --git a/store/source/storlckb.hxx b/store/source/storlckb.hxx index a152dc5cf..8a67a6b57 100644 --- a/store/source/storlckb.hxx +++ b/store/source/storlckb.hxx @@ -2,9 +2,9 @@ * * $RCSfile: storlckb.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 15:18:32 $ + * last change: $Author: mhu $ $Date: 2001-03-13 21:03:26 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -54,13 +54,13 @@ * * All Rights Reserved. * - * Contributor(s): _______________________________________ + * Contributor(s): Matthias Huetsch <matthias.huetsch@sun.com> * * ************************************************************************/ #ifndef _STORE_STORLCKB_HXX_ -#define _STORE_STORLCKB_HXX_ "$Revision: 1.1.1.1 $" +#define _STORE_STORLCKB_HXX_ "$Revision: 1.2 $" #ifndef _SAL_TYPES_H_ #include <sal/types.h> @@ -72,10 +72,10 @@ #ifndef _RTL_USTRING_H_ #include <rtl/ustring.h> #endif - -#ifndef _STORE_MACROS_HXX_ -#include <store/macros.hxx> +#ifndef _RTL_REF_HXX_ +#include <rtl/ref.hxx> #endif + #ifndef _STORE_OBJECT_HXX_ #include <store/object.hxx> #endif @@ -90,9 +90,8 @@ #include <storpage.hxx> #endif -#ifdef _USE_NAMESPACE -namespace store { -#endif +namespace store +{ struct OStoreDataPageData; struct OStoreDirectoryPageData; @@ -103,10 +102,8 @@ struct OStoreIndirectionPageData; * OStoreDirectory interface. * *======================================================================*/ -class OStoreDirectory : public NAMESPACE_STORE(OStoreObject) +class OStoreDirectory : public store::OStoreObject { - VOS_DECLARE_CLASSINFO (VOS_NAMESPACE (OStoreDirectory, store)); - public: /** Construction. */ @@ -133,15 +130,28 @@ public: storeError iterate ( storeFindData &rFindData); + /** IStoreHandle. + */ + virtual sal_Bool SAL_CALL isKindOf (sal_uInt32 nTypeId); + protected: - /** Destruction (OReference). + /** Destruction. */ virtual ~OStoreDirectory (void); private: + /** IStoreHandle TypeId. + */ + static const sal_uInt32 m_nTypeId; + + /** IStoreHandle query() template function specialization. + */ + friend inline OStoreDirectory* + SAL_CALL query (IStoreHandle *pHandle, OStoreDirectory*); + /** Representation. */ - NAMESPACE_VOS(ORef)<OStorePageManager> m_xManager; + rtl::Reference<OStorePageManager> m_xManager; typedef OStoreDirectoryPageData inode; inode *m_pNode; @@ -156,17 +166,26 @@ private: OStoreDirectory& operator= (const OStoreDirectory&); }; +inline OStoreDirectory* +SAL_CALL query (IStoreHandle *pHandle, OStoreDirectory*) +{ + if (pHandle && pHandle->isKindOf (OStoreDirectory::m_nTypeId)) + { + // Handle is kind of OStoreDirectory. + return static_cast<OStoreDirectory*>(pHandle); + } + return 0; +} + /*======================================================================== * * OStoreLockBytes interface. * *======================================================================*/ class OStoreLockBytes : - public NAMESPACE_STORE(OStoreObject), - public NAMESPACE_STORE(ILockBytes) + public store::OStoreObject, + public store::ILockBytes { - VOS_DECLARE_CLASSINFO (VOS_NAMESPACE (OStoreLockBytes, store)); - public: /** Construction. */ @@ -247,11 +266,14 @@ public: sal_uInt32 nOffset, sal_uInt32 nBytes); + /** IStoreHandle. + */ + virtual sal_Bool SAL_CALL isKindOf (sal_uInt32 nMagic); + /** Delegate multiple inherited IReference. */ - virtual RefCount SAL_CALL acquire (void); - virtual RefCount SAL_CALL release (void); - virtual RefCount SAL_CALL referenced (void) const; + virtual oslInterlockedCount SAL_CALL acquire (void); + virtual oslInterlockedCount SAL_CALL release (void); protected: /** Destruction (OReference). @@ -259,9 +281,18 @@ protected: virtual ~OStoreLockBytes (void); private: + /** IStoreHandle TypeId. + */ + static const sal_uInt32 m_nTypeId; + + /** IStoreHandle query() template specialization. + */ + friend inline OStoreLockBytes* + SAL_CALL query (IStoreHandle *pHandle, OStoreLockBytes*); + /** Representation. */ - NAMESPACE_VOS(ORef)<OStorePageManager> m_xManager; + rtl::Reference<OStorePageManager> m_xManager; typedef OStoreDataPageData data; typedef OStoreDirectoryPageData inode; @@ -283,14 +314,24 @@ private: OStoreLockBytes& operator= (const OStoreLockBytes&); }; +inline OStoreLockBytes* +SAL_CALL query (IStoreHandle *pHandle, OStoreLockBytes*) +{ + if (pHandle && pHandle->isKindOf (OStoreLockBytes::m_nTypeId)) + { + // Handle is kind of OStoreLockBytes. + return static_cast<OStoreLockBytes*>(pHandle); + } + return 0; +} + /*======================================================================== * * The End. * *======================================================================*/ -#ifdef _USE_NAMESPACE -} -#endif + +} // namespace store #endif /* !_STORE_STORLCKB_HXX_ */ diff --git a/store/source/stortree.cxx b/store/source/stortree.cxx index 69d343f80..d5bbe6b99 100644 --- a/store/source/stortree.cxx +++ b/store/source/stortree.cxx @@ -2,9 +2,9 @@ * * $RCSfile: stortree.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 15:18:32 $ + * last change: $Author: mhu $ $Date: 2001-03-13 21:03:26 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -54,12 +54,12 @@ * * All Rights Reserved. * - * Contributor(s): _______________________________________ + * Contributor(s): Matthias Huetsch <matthias.huetsch@sun.com> * * ************************************************************************/ -#define _STORE_STORTREE_CXX "$Revision: 1.1.1.1 $" +#define _STORE_STORTREE_CXX "$Revision: 1.2 $" #ifndef _SAL_TYPES_H_ #include <sal/types.h> @@ -69,22 +69,19 @@ #include <rtl/memory.h> #endif -#ifndef _VOS_DIAGNOSE_HXX_ -#include <vos/diagnose.hxx> +#ifndef _OSL_DIAGNOSE_H_ +#include <osl/diagnose.h> #endif -#ifndef _VOS_MACROS_HXX_ -#include <vos/macros.hxx> +#ifndef _OSL_ENDIAN_H_ +#include <osl/endian.h> #endif -#ifndef _VOS_MUTEX_HXX_ -#include <vos/mutex.hxx> +#ifndef _OSL_MUTEX_HXX_ +#include <osl/mutex.hxx> #endif #ifndef _STORE_TYPES_H_ #include <store/types.h> #endif -#ifndef _STORE_MACROS_HXX_ -#include <store/macros.hxx> -#endif #ifndef _STORE_STORBASE_HXX #include <storbase.hxx> @@ -93,9 +90,7 @@ #include <stortree.hxx> #endif -#ifdef _USE_NAMESPACE using namespace store; -#endif /*======================================================================== * @@ -287,7 +282,7 @@ storeError OStoreBTreeNodeObject::split ( OStoreBTreeNodeData &rPageL, OStoreBTreeNodeData &rPageR, OStorePageBIOS &rBIOS, - NAMESPACE_VOS(IMutex) *pMutex) + osl::Mutex *pMutex) { // Check usage. if (!rPageL.querySplit()) @@ -328,7 +323,7 @@ storeError OStoreBTreeNodeObject::split ( if (eErrCode != store_E_None) { // Must not happen. - VOS_TRACE("OStoreBTreeNodeObject::split(): save() failed"); + OSL_TRACE("OStoreBTreeNodeObject::split(): save() failed"); // Release Lock and Leave. rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); @@ -349,7 +344,7 @@ storeError OStoreBTreeNodeObject::split ( if (eErrCode != store_E_None) { // Must not happen. - VOS_TRACE("OStoreBTreeNodeObject::split(): save() failed"); + OSL_TRACE("OStoreBTreeNodeObject::split(): save() failed"); // Release Lock and Leave. rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); @@ -376,7 +371,7 @@ storeError OStoreBTreeNodeObject::remove ( OStoreBTreeNodeData &rPageR, #endif /* NYI */ OStorePageBIOS &rBIOS, - NAMESPACE_VOS(IMutex) *pMutex) + osl::Mutex *pMutex) { // Enter. STORE_METHOD_ENTER(pMutex); @@ -424,7 +419,7 @@ storeError OStoreBTreeNodeObject::remove ( if (eErrCode != store_E_None) { // Must not happen. - VOS_TRACE("OStoreBTreeNodeObject::remove(): load() failed"); + OSL_TRACE("OStoreBTreeNodeObject::remove(): load() failed"); // Release Lock and Leave. rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); @@ -500,7 +495,7 @@ storeError OStoreBTreeNodeObject::remove ( if (eErrCode != store_E_None) { // Must not happen. - VOS_TRACE("OStoreBTreeNodeObject::remove(): save() failed"); + OSL_TRACE("OStoreBTreeNodeObject::remove(): save() failed"); // Release Lock and Leave. rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); @@ -524,7 +519,7 @@ storeError OStoreBTreeNodeObject::remove ( storeError OStoreBTreeRootObject::change ( OStoreBTreeNodeData &rPageL, OStorePageBIOS &rBIOS, - NAMESPACE_VOS(IMutex) *pMutex) + osl::Mutex *pMutex) { // Enter. STORE_METHOD_ENTER(pMutex); @@ -561,7 +556,7 @@ storeError OStoreBTreeRootObject::change ( if (eErrCode != store_E_None) { // Must not happen. - VOS_TRACE("OStoreBTreeRootObject::change(): save() failed"); + OSL_TRACE("OStoreBTreeRootObject::change(): save() failed"); // Release Lock and Leave. rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); @@ -585,7 +580,7 @@ storeError OStoreBTreeRootObject::split ( OStoreBTreeNodeData &rPageL, OStoreBTreeNodeData &rPageR, OStorePageBIOS &rBIOS, - NAMESPACE_VOS(IMutex) *pMutex) + osl::Mutex *pMutex) { // Check usage. if (!querySplit()) diff --git a/store/source/stortree.hxx b/store/source/stortree.hxx index d07f3837c..6829ffd7b 100644 --- a/store/source/stortree.hxx +++ b/store/source/stortree.hxx @@ -2,9 +2,9 @@ * * $RCSfile: stortree.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 15:18:32 $ + * last change: $Author: mhu $ $Date: 2001-03-13 21:03:26 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -54,13 +54,13 @@ * * All Rights Reserved. * - * Contributor(s): _______________________________________ + * Contributor(s): Matthias Huetsch <matthias.huetsch@sun.com> * * ************************************************************************/ #ifndef _STORE_STORTREE_HXX -#define _STORE_STORTREE_HXX "$Revision: 1.1.1.1 $" +#define _STORE_STORTREE_HXX "$Revision: 1.2 $" #ifndef _SAL_TYPES_H_ #include <sal/types.h> @@ -70,27 +70,23 @@ #include <rtl/memory.h> #endif -#ifndef _VOS_MACROS_HXX_ -#include <vos/macros.hxx> +#ifndef _OSL_ENDIAN_H_ +#include <osl/endian.h> #endif -#ifndef _VOS_MUTEX_HXX_ -#include <vos/mutex.hxx> +#ifndef _OSL_MUTEX_HXX_ +#include <osl/mutex.hxx> #endif #ifndef _STORE_TYPES_H_ #include <store/types.h> #endif -#ifndef _STORE_MACROS_HXX_ -#include <store/macros.hxx> -#endif #ifndef _STORE_STORBASE_HXX #include <storbase.hxx> #endif -#ifdef _USE_NAMESPACE -namespace store { -#endif +namespace store +{ /*======================================================================== * @@ -154,7 +150,7 @@ struct OStoreBTreeEntry #ifdef OSL_BIGENDIAN m_aKey.swap(); m_aLink.swap(); - m_nAttrib = VOS_SWAPDWORD(m_nAttrib); + m_nAttrib = OSL_SWAPDWORD(m_nAttrib); #endif /* OSL_BIGENDIAN */ } }; @@ -166,7 +162,7 @@ struct OStoreBTreeEntry *======================================================================*/ #define STORE_MAGIC_BTREENODE 0x58190322UL -struct OStoreBTreeNodeData : public NAMESPACE_STORE(OStorePageData) +struct OStoreBTreeNodeData : public store::OStorePageData { typedef OStorePageData base; typedef OStoreBTreeNodeData self; @@ -263,7 +259,7 @@ struct OStoreBTreeNodeData : public NAMESPACE_STORE(OStorePageData) nCRC32 = G::crc32 (nCRC32, &m_aGuard.m_nMagic, sizeof(sal_uInt32)); nCRC32 = G::crc32 (nCRC32, m_pData, capacity(rDescr)); #ifdef OSL_BIGENDIAN - nCRC32 = VOS_SWAPDWORD(nCRC32); + nCRC32 = OSL_SWAPDWORD(nCRC32); #endif /* OSL_BIGENDIAN */ m_aGuard.m_nCRC32 = nCRC32; } @@ -276,7 +272,7 @@ struct OStoreBTreeNodeData : public NAMESPACE_STORE(OStorePageData) nCRC32 = G::crc32 (nCRC32, &m_aGuard.m_nMagic, sizeof(sal_uInt32)); nCRC32 = G::crc32 (nCRC32, m_pData, capacity(rDescr)); #ifdef OSL_BIGENDIAN - nCRC32 = VOS_SWAPDWORD(nCRC32); + nCRC32 = OSL_SWAPDWORD(nCRC32); #endif /* OSL_BIGENDIAN */ if (m_aGuard.m_nCRC32 != nCRC32) return store_E_InvalidChecksum; @@ -333,8 +329,7 @@ struct OStoreBTreeNodeData : public NAMESPACE_STORE(OStorePageData) * OStoreBTreeNodeObject. * *======================================================================*/ -class OStoreBTreeNodeObject : - public NAMESPACE_STORE(OStorePageObject) +class OStoreBTreeNodeObject : public store::OStorePageObject { typedef OStorePageObject base; typedef OStoreBTreeNodeObject self; @@ -365,7 +360,7 @@ public: OStoreBTreeNodeData &rPageL, OStoreBTreeNodeData &rPageR, OStorePageBIOS &rBIOS, - NAMESPACE_VOS(IMutex) *pMutex = NULL); + osl::Mutex *pMutex = NULL); /** remove (down to leaf node, recursive). */ @@ -377,7 +372,7 @@ public: OStoreBTreeNodeData &rPageR, #endif /* NYI */ OStorePageBIOS &rBIOS, - NAMESPACE_VOS(IMutex) *pMutex = NULL); + osl::Mutex *pMutex = NULL); private: /** Representation. @@ -400,8 +395,7 @@ inline sal_Bool OStoreBTreeNodeObject::querySplit (void) const * OStoreBTreeRootObject. * *======================================================================*/ -class OStoreBTreeRootObject : - public NAMESPACE_STORE(OStoreBTreeNodeObject) +class OStoreBTreeRootObject : public store::OStoreBTreeNodeObject { typedef OStoreBTreeNodeObject base; typedef OStoreBTreeNodeData page; @@ -418,7 +412,7 @@ public: OStoreBTreeNodeData &rPageL, OStoreBTreeNodeData &rPageR, OStorePageBIOS &rBIOS, - NAMESPACE_VOS(IMutex) *pMutex = NULL); + osl::Mutex *pMutex = NULL); private: /** Representation. @@ -430,7 +424,7 @@ private: storeError change ( OStoreBTreeNodeData &rPageL, OStorePageBIOS &rBIOS, - NAMESPACE_VOS(IMutex) *pMutex = NULL); + osl::Mutex *pMutex = NULL); }; inline OStoreBTreeRootObject::OStoreBTreeRootObject (page& rPage) @@ -443,9 +437,8 @@ inline OStoreBTreeRootObject::OStoreBTreeRootObject (page& rPage) * The End. * *======================================================================*/ -#ifdef _USE_NAMESPACE -} -#endif + +} // namespace store #endif /* !_STORE_STORTREE_HXX */ diff --git a/store/util/makefile.mk b/store/util/makefile.mk index 7b063ce87..edd7d8ac7 100644 --- a/store/util/makefile.mk +++ b/store/util/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.3 $ +# $Revision: 1.4 $ # -# last change: $Author: pluby $ $Date: 2001-02-22 22:54:39 $ +# last change: $Author: mhu $ $Date: 2001-03-13 21:07:32 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -97,10 +97,10 @@ SHL1IMPLIB= istore SHL1VERSIONMAP= $(TARGET).map .ENDIF -SHL1STDLIBS= $(VOSLIB) $(SALLIB) +SHL1STDLIBS= $(SALLIB) SHL1DEF= $(MISC)$/$(SHL1TARGET).def -SHL1DEPN= $(L)$/ivos.lib $(L)$/isal.lib +SHL1DEPN= $(L)$/isal.lib SHL1LIBS= $(SLB)$/store.lib # --- Def-File --- |