From a72cabcec67a5aa8b1ca175fe8a7494ab4327c68 Mon Sep 17 00:00:00 2001 From: "Matthias Huetsch [mhu]" <matthias.huetsch@sun.com> Date: Tue, 27 Oct 2009 16:57:01 +0100 Subject: #i71568# #i108349# simplified C++ wrapper inline implementation. --- store/inc/store/store.hxx | 422 ++++++++++++++++++++++++++++++++---------- store/inc/store/store.inl | 454 ---------------------------------------------- 2 files changed, 322 insertions(+), 554 deletions(-) delete mode 100644 store/inc/store/store.inl (limited to 'store') diff --git a/store/inc/store/store.hxx b/store/inc/store/store.hxx index 54f0d44024b8..b6301f41f8b3 100644 --- a/store/inc/store/store.hxx +++ b/store/inc/store/store.hxx @@ -31,9 +31,9 @@ #ifndef _STORE_STORE_HXX_ #define _STORE_STORE_HXX_ "$Revision: 1.5 $" -#include <sal/types.h> -#include <rtl/ustring.hxx> -#include <store/store.h> +#include "sal/types.h" +#include "rtl/ustring.hxx" +#include "store/store.h" namespace store { @@ -48,86 +48,154 @@ class OStoreStream public: /** Construction. */ - inline OStoreStream (void) SAL_THROW(()); + inline OStoreStream (void) SAL_THROW(()) + : m_hImpl (0) + {} /** Destruction. */ - inline ~OStoreStream (void) SAL_THROW(()); + inline ~OStoreStream (void) SAL_THROW(()) + { + if (m_hImpl) + (void) store_releaseHandle (m_hImpl); + } /** Copy construction. */ - inline OStoreStream ( - const OStoreStream& rOther) SAL_THROW(()); + inline OStoreStream (OStoreStream const & rhs) SAL_THROW(()) + : m_hImpl (rhs.m_hImpl) + { + if (m_hImpl) + (void) store_acquireHandle (m_hImpl); + } /** Assignment. */ - inline OStoreStream& operator= ( - const OStoreStream& rOther) SAL_THROW(()); - + inline OStoreStream & operator= (OStoreStream const & rhs) SAL_THROW(()) + { + if (rhs.m_hImpl) + (void) store_acquireHandle (rhs.m_hImpl); + if (m_hImpl) + (void) store_releaseHandle (m_hImpl); + m_hImpl = rhs.m_hImpl; + return *this; + } /** Construction from Stream Handle. */ - inline OStoreStream (storeStreamHandle Handle) SAL_THROW(()); + inline explicit OStoreStream (storeStreamHandle Handle) SAL_THROW(()) + : m_hImpl (Handle) + { + if (m_hImpl) + (void) store_acquireHandle (m_hImpl); + } /** Conversion into Stream Handle. */ - inline operator storeStreamHandle (void) const SAL_THROW(()); + inline operator storeStreamHandle (void) const SAL_THROW(()) + { + return m_hImpl; + } /** Check for a valid Stream Handle. @return sal_True if valid, sal_False otherwise. */ - inline sal_Bool isValid (void) const SAL_THROW(()); - + inline bool isValid (void) const SAL_THROW(()) + { + return (m_hImpl != 0); + } /** Open the stream. @see store_openStream() */ inline storeError create ( - storeFileHandle hFile, - const rtl::OUString &rPath, - const rtl::OUString &rName, - storeAccessMode eMode - ) SAL_THROW(()); + storeFileHandle hFile, + rtl::OUString const & rPath, + rtl::OUString const & rName, + storeAccessMode eMode) SAL_THROW(()) + { + if (m_hImpl) + { + (void) store_releaseHandle (m_hImpl); + m_hImpl = 0; + } + return store_openStream (hFile, rPath.pData, rName.pData, eMode, &m_hImpl); + } /** Close the stream. @see store_closeStream() */ - inline void close (void) SAL_THROW(()); + inline void close (void) SAL_THROW(()) + { + if (m_hImpl) + { + (void) store_closeStream (m_hImpl); + m_hImpl = 0; + } + } /** Read from the stream. @see store_readStream() */ inline storeError readAt ( - sal_uInt32 nOffset, - void *pBuffer, - sal_uInt32 nBytes, - sal_uInt32 &rnDone - ) SAL_THROW(()); + sal_uInt32 nOffset, + void * pBuffer, + sal_uInt32 nBytes, + sal_uInt32 & rnDone) SAL_THROW(()) + { + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_readStream (m_hImpl, nOffset, pBuffer, nBytes, &rnDone); + } /** Write to the stream. @see store_writeStream() */ inline storeError writeAt ( - sal_uInt32 nOffset, - const void *pBuffer, - sal_uInt32 nBytes, - sal_uInt32 &rnDone - ) SAL_THROW(()); + sal_uInt32 nOffset, + void const * pBuffer, + sal_uInt32 nBytes, + sal_uInt32 & rnDone) SAL_THROW(()) + { + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_writeStream (m_hImpl, nOffset, pBuffer, nBytes, &rnDone); + } /** Flush the stream. @see store_flushStream() */ - inline storeError flush (void) const SAL_THROW(()); + inline storeError flush (void) const SAL_THROW(()) + { + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_flushStream (m_hImpl); + } /** Get the stream size. @see store_getStreamSize() */ - inline storeError getSize (sal_uInt32 &rnSize) const SAL_THROW(()); + inline storeError getSize (sal_uInt32 & rnSize) const SAL_THROW(()) + { + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_getStreamSize (m_hImpl, &rnSize); + } /** Set the stream size. @see store_setStreamSize() */ - inline storeError setSize (sal_uInt32 nSize) SAL_THROW(()); + inline storeError setSize (sal_uInt32 nSize) SAL_THROW(()) + { + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_setStreamSize (m_hImpl, nSize); + } private: /** Representation. @@ -145,52 +213,91 @@ class OStoreDirectory public: /** Construction. */ - inline OStoreDirectory (void) SAL_THROW(()); + inline OStoreDirectory (void) SAL_THROW(()) + : m_hImpl (0) + {} /** Destruction. */ - inline ~OStoreDirectory (void) SAL_THROW(()); + inline ~OStoreDirectory (void) SAL_THROW(()) + { + if (m_hImpl) + (void) store_releaseHandle (m_hImpl); + } /** Copy construction. */ - inline OStoreDirectory ( - const OStoreDirectory& rOther) SAL_THROW(()); + inline OStoreDirectory (OStoreDirectory const & rhs) SAL_THROW(()) + : m_hImpl (rhs.m_hImpl) + { + if (m_hImpl) + (void) store_acquireHandle (m_hImpl); + } /** Assignment. */ - inline OStoreDirectory& operator= ( - const OStoreDirectory& rOther) SAL_THROW(()); - + inline OStoreDirectory & operator= (OStoreDirectory const & rhs) SAL_THROW(()) + { + if (rhs.m_hImpl) + (void) store_acquireHandle (rhs.m_hImpl); + if (m_hImpl) + (void) store_releaseHandle (m_hImpl); + m_hImpl = rOther.m_hImpl; + return *this; + } /** Construction from Directory Handle. */ - inline OStoreDirectory (storeDirectoryHandle Handle) SAL_THROW(()); + inline explicit OStoreDirectory (storeDirectoryHandle Handle) SAL_THROW(()) + : m_hImpl (Handle) + { + if (m_hImpl) + (void) store_acquireHandle (m_hImpl); + } /** Conversion into Directory Handle. */ - inline operator storeDirectoryHandle (void) const SAL_THROW(()); + inline operator storeDirectoryHandle(void) const SAL_THROW(()) + { + return m_hImpl; + } /** Check for a valid Directory Handle. @return sal_True if valid, sal_False otherwise. */ - inline sal_Bool isValid (void) const SAL_THROW(()); - + inline bool isValid (void) const SAL_THROW(()) + { + return (m_hImpl != 0); + } /** Open the directory. @see store_openDirectory() */ inline storeError create ( - storeFileHandle hFile, - const rtl::OUString &rPath, - const rtl::OUString &rName, - storeAccessMode eMode - ) SAL_THROW(()); + storeFileHandle hFile, + rtl::OUString const & rPath, + rtl::OUString const & rName, + storeAccessMode eMode) SAL_THROW(()) + { + if (m_hImpl) + { + (void) store_releaseHandle (m_hImpl); + m_hImpl = 0; + } + return store_openDirectory (hFile, rPath.pData, rName.pData, eMode, &m_hImpl); + } /** Close the directory. @see store_closeDirectory() */ - inline void close (void) SAL_THROW(()); - + inline void close (void) SAL_THROW(()) + { + if (m_hImpl) + { + (void) store_closeDirectory (m_hImpl); + m_hImpl = 0; + } + } /** Directory iterator type. @see first() @@ -201,12 +308,24 @@ public: /** Find first directory entry. @see store_findFirst() */ - inline storeError first (iterator& it) SAL_THROW(()); + inline storeError first (iterator& it) SAL_THROW(()) + { + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_findFirst (m_hImpl, &it); + } /** Find next directory entry. @see store_findNext() */ - inline storeError next (iterator& it) SAL_THROW(()); + inline storeError next (iterator& it) SAL_THROW(()) + { + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_findNext (m_hImpl, &it); + } /** Directory traversal helper. @see travel() @@ -228,7 +347,18 @@ public: @param rTraveller [in] the traversal callback. @return store_E_NoMoreFiles upon end of iteration. */ - inline storeError travel (traveller& rTraveller) const; + inline storeError travel (traveller & rTraveller) const + { + storeError eErrCode = store_E_InvalidHandle; + if (m_hImpl) + { + iterator it; + eErrCode = store_findFirst (m_hImpl, &it); + while ((eErrCode == store_E_None) && rTraveller.visit(it)) + eErrCode = store_findNext (m_hImpl, &it); + } + return eErrCode; + } private: /** Representation. @@ -246,126 +376,220 @@ class OStoreFile public: /** Construction. */ - inline OStoreFile (void) SAL_THROW(()); + inline OStoreFile (void) SAL_THROW(()) + : m_hImpl (0) + {} /** Destruction. */ - inline ~OStoreFile (void) SAL_THROW(()); + inline ~OStoreFile (void) SAL_THROW(()) + { + if (m_hImpl) + (void) store_releaseHandle (m_hImpl); + } /** Copy construction. */ - inline OStoreFile (const OStoreFile& rOther) SAL_THROW(()); + inline OStoreFile (OStoreFile const & rhs) SAL_THROW(()) + : m_hImpl (rhs.m_hImpl) + { + if (m_hImpl) + (void) store_acquireHandle (m_hImpl); + } /** Assignment. */ - inline OStoreFile& operator= (const OStoreFile& rOther) SAL_THROW(()); - + inline OStoreFile & operator= (OStoreFile const & rhs) SAL_THROW(()) + { + if (rhs.m_hImpl) + (void) store_acquireHandle (rhs.m_hImpl); + if (m_hImpl) + (void) store_releaseHandle (m_hImpl); + m_hImpl = rhs.m_hImpl; + return *this; + } /** Construction from File Handle. */ - inline OStoreFile (storeFileHandle Handle) SAL_THROW(()); + inline explicit OStoreFile (storeFileHandle Handle) SAL_THROW(()) + : m_hImpl (Handle) + { + if (m_hImpl) + (void) store_acquireHandle (m_hImpl); + } /** Conversion into File Handle. */ - inline operator storeFileHandle (void) const SAL_THROW(()); + inline operator storeFileHandle (void) const SAL_THROW(()) + { + return m_hImpl; + } /** Check for a valid File Handle. @return sal_True if valid, sal_False otherwise. */ - inline sal_Bool isValid (void) const SAL_THROW(()); - + inline bool isValid (void) const SAL_THROW(()) + { + return (m_hImpl != 0); + } /** Open the file. @see store_openFile() */ inline storeError create ( - const rtl::OUString &rFilename, - storeAccessMode eAccessMode, - sal_uInt16 nPageSize = STORE_DEFAULT_PAGESIZE - ) SAL_THROW(()); + rtl::OUString const & rFilename, + storeAccessMode eAccessMode, + sal_uInt16 nPageSize = STORE_DEFAULT_PAGESIZE) SAL_THROW(()) + { + if (m_hImpl) + { + (void) store_releaseHandle (m_hImpl); + m_hImpl = 0; + } + return store_openFile (rFilename.pData, eAccessMode, nPageSize, &m_hImpl); + } /** Open the temporary file in memory. @see store_createMemoryFile() */ inline storeError createInMemory ( - sal_uInt16 nPageSize = STORE_DEFAULT_PAGESIZE - ) SAL_THROW(()); + sal_uInt16 nPageSize = STORE_DEFAULT_PAGESIZE) SAL_THROW(()) + { + if (m_hImpl) + { + (void) store_releaseHandle (m_hImpl); + m_hImpl = 0; + } + return store_createMemoryFile (nPageSize, &m_hImpl); + } /** Close the file. @see store_closeFile() */ - inline void close (void) SAL_THROW(()); + inline void close (void) SAL_THROW(()) + { + if (m_hImpl) + { + (void) store_closeFile (m_hImpl); + m_hImpl = 0; + } + } /** Flush the file. @see store_flushFile() */ - inline storeError flush (void) const SAL_THROW(()); + inline storeError flush (void) const SAL_THROW(()) + { + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_flushFile (m_hImpl); + } /** Get the number of referers to the file. @see store_getFileRefererCount() */ - inline storeError getRefererCount ( - sal_uInt32 &rnRefCount) const SAL_THROW(()); + inline storeError getRefererCount (sal_uInt32 & rnRefCount) const SAL_THROW(()) + { + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_getFileRefererCount (m_hImpl, &rnRefCount); + } /** Get the file size. @see store_getFileSize() */ - inline storeError getSize ( - sal_uInt32 &rnSize) const SAL_THROW(()); + inline storeError getSize (sal_uInt32 & rnSize) const SAL_THROW(()) + { + if (!m_hImpl) + return store_E_InvalidHandle; + return store_getFileSize (m_hImpl, &rnSize); + } /** Set attributes of a file entry. @see store_attrib() */ inline storeError attrib ( - const rtl::OUString &rPath, - const rtl::OUString &rName, - sal_uInt32 nMask1, - sal_uInt32 nMask2, - sal_uInt32 &rnAttrib - ) SAL_THROW(()); + rtl::OUString const & rPath, + rtl::OUString const & rName, + sal_uInt32 nMask1, + sal_uInt32 nMask2, + sal_uInt32 & rnAttrib) SAL_THROW(()) + { + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_attrib (m_hImpl, rPath.pData, rName.pData, nMask1, nMask2, &rnAttrib); + } /** Set attributes of a file entry. @see store_attrib() */ inline storeError attrib ( - const rtl::OUString &rPath, - const rtl::OUString &rName, - sal_uInt32 nMask1, - sal_uInt32 nMask2 - ) SAL_THROW(()); + rtl::OUString const & rPath, + rtl::OUString const & rName, + sal_uInt32 nMask1, + sal_uInt32 nMask2) SAL_THROW(()) + { + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_attrib (m_hImpl, rPath.pData, rName.pData, nMask1, nMask2, NULL); + } /** Insert a file entry as 'hard link' to another file entry. @see store_link() */ inline storeError link ( - const rtl::OUString &rSrcPath, const rtl::OUString &rSrcName, - const rtl::OUString &rDstPath, const rtl::OUString &rDstName - ) SAL_THROW(()); + rtl::OUString const & rSrcPath, rtl::OUString const & rSrcName, + rtl::OUString const & rDstPath, rtl::OUString const & rDstName) SAL_THROW(()) + { + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_link ( + m_hImpl, rSrcPath.pData, rSrcName.pData, rDstPath.pData, rDstName.pData); + } /** Insert a file entry as 'symbolic link' to another file entry. @see store_symlink() */ inline storeError symlink ( - const rtl::OUString &rSrcPath, const rtl::OUString &rSrcName, - const rtl::OUString &rDstPath, const rtl::OUString &rDstName - ) SAL_THROW(()); + rtl::OUString const & rSrcPath, rtl::OUString const & rSrcName, + rtl::OUString const & rDstPath, rtl::OUString const & rDstName) SAL_THROW(()) + { + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_symlink (m_hImpl, rSrcPath.pData, rSrcName.pData, rDstPath.pData, rDstName.pData); + } /** Rename a file entry. @see store_rename() */ inline storeError rename ( - const rtl::OUString &rSrcPath, const rtl::OUString &rSrcName, - const rtl::OUString &rDstPath, const rtl::OUString &rDstName - ) SAL_THROW(()); + rtl::OUString const & rSrcPath, rtl::OUString const & rSrcName, + rtl::OUString const & rDstPath, rtl::OUString const & rDstName) SAL_THROW(()) + { + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_rename (m_hImpl, rSrcPath.pData, rSrcName.pData, rDstPath.pData, rDstName.pData); + } /** Remove a file entry. @see store_remove() */ inline storeError remove ( - const rtl::OUString &rPath, - const rtl::OUString &rName - ) SAL_THROW(()); + rtl::OUString const & rPath, rtl::OUString const & rName) SAL_THROW(()) + { + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_remove (m_hImpl, rPath.pData, rName.pData); + } private: /** Representation. @@ -379,8 +603,6 @@ private: * *======================================================================*/ -#include <store/store.inl> - } // namespace store #endif /* !_STORE_STORE_HXX_ */ diff --git a/store/inc/store/store.inl b/store/inc/store/store.inl deleted file mode 100644 index 35aff6dde1e2..000000000000 --- a/store/inc/store/store.inl +++ /dev/null @@ -1,454 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: store.inl,v $ - * $Revision: 1.4 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#define _STORE_STORE_INL_ "$Revision: 1.4 $" - -/*======================================================================== - * - * OStoreStream implementation. - * - *======================================================================*/ -inline OStoreStream::OStoreStream (void) SAL_THROW(()) - : m_hImpl (0) -{ -} - -inline OStoreStream::~OStoreStream (void) SAL_THROW(()) -{ - if (m_hImpl) - store_releaseHandle (m_hImpl); -} - -inline OStoreStream::OStoreStream ( - const OStoreStream& rOther) SAL_THROW(()) - : m_hImpl (rOther.m_hImpl) -{ - if (m_hImpl) - store_acquireHandle (m_hImpl); -} - -inline OStoreStream& OStoreStream::operator= ( - const OStoreStream& rOther) SAL_THROW(()) -{ - if (m_hImpl) - store_releaseHandle (m_hImpl); - m_hImpl = rOther.m_hImpl; - if (m_hImpl) - store_acquireHandle (m_hImpl); - return *this; -} - -inline OStoreStream::OStoreStream ( - storeStreamHandle Handle) SAL_THROW(()) - : m_hImpl (Handle) -{ - if (m_hImpl) - store_acquireHandle (m_hImpl); -} - -inline OStoreStream::operator storeStreamHandle (void) const SAL_THROW(()) -{ - return m_hImpl; -} - -inline sal_Bool OStoreStream::isValid (void) const SAL_THROW(()) -{ - return (!!m_hImpl); -} - -inline storeError OStoreStream::create ( - storeFileHandle hFile, - const rtl::OUString &rPath, - const rtl::OUString &rName, - storeAccessMode eMode) SAL_THROW(()) -{ - if (m_hImpl) - { - store_releaseHandle (m_hImpl); - m_hImpl = 0; - } - return store_openStream ( - hFile, rPath.pData, rName.pData, eMode, &m_hImpl); -} - -inline void OStoreStream::close (void) SAL_THROW(()) -{ - if (m_hImpl) - { - store_closeStream (m_hImpl); - m_hImpl = 0; - } -} - -inline storeError OStoreStream::readAt ( - sal_uInt32 nOffset, - void *pBuffer, - sal_uInt32 nBytes, - sal_uInt32 &rnDone) SAL_THROW(()) -{ - if (!m_hImpl) - return store_E_InvalidHandle; - - return store_readStream ( - m_hImpl, nOffset, pBuffer, nBytes, &rnDone); -} - -inline storeError OStoreStream::writeAt ( - sal_uInt32 nOffset, - const void *pBuffer, - sal_uInt32 nBytes, - sal_uInt32 &rnDone) SAL_THROW(()) -{ - if (!m_hImpl) - return store_E_InvalidHandle; - - return store_writeStream ( - m_hImpl, nOffset, pBuffer, nBytes, &rnDone); -} - -inline storeError OStoreStream::flush (void) const SAL_THROW(()) -{ - if (!m_hImpl) - return store_E_InvalidHandle; - - return store_flushStream (m_hImpl); -} - -inline storeError OStoreStream::getSize ( - sal_uInt32 &rnSize) const SAL_THROW(()) -{ - if (!m_hImpl) - return store_E_InvalidHandle; - - return store_getStreamSize (m_hImpl, &rnSize); -} - -inline storeError OStoreStream::setSize ( - sal_uInt32 nSize) SAL_THROW(()) -{ - if (!m_hImpl) - return store_E_InvalidHandle; - - return store_setStreamSize (m_hImpl, nSize); -} - -/*======================================================================== - * - * OStoreDirectory implementation. - * - *======================================================================*/ -inline OStoreDirectory::OStoreDirectory (void) SAL_THROW(()) - : m_hImpl (0) -{ -} - -inline OStoreDirectory::~OStoreDirectory (void) SAL_THROW(()) -{ - if (m_hImpl) - store_releaseHandle (m_hImpl); -} - -inline OStoreDirectory::OStoreDirectory ( - const OStoreDirectory& rOther) SAL_THROW(()) - : m_hImpl (rOther.m_hImpl) -{ - if (m_hImpl) - store_acquireHandle (m_hImpl); -} - -inline OStoreDirectory& OStoreDirectory::operator= ( - const OStoreDirectory& rOther) SAL_THROW(()) -{ - if (m_hImpl) - store_releaseHandle (m_hImpl); - m_hImpl = rOther.m_hImpl; - if (m_hImpl) - store_acquireHandle (m_hImpl); - return *this; -} - -inline OStoreDirectory::OStoreDirectory ( - storeDirectoryHandle Handle) SAL_THROW(()) - : m_hImpl (Handle) -{ - if (m_hImpl) - store_acquireHandle (m_hImpl); -} - -inline OStoreDirectory::operator storeDirectoryHandle(void) const SAL_THROW(()) -{ - return m_hImpl; -} - -inline sal_Bool OStoreDirectory::isValid (void) const SAL_THROW(()) -{ - return (!!m_hImpl); -} - -inline storeError OStoreDirectory::create ( - storeFileHandle hFile, - const rtl::OUString &rPath, - const rtl::OUString &rName, - storeAccessMode eMode) SAL_THROW(()) -{ - if (m_hImpl) - { - store_releaseHandle (m_hImpl); - m_hImpl = 0; - } - return store_openDirectory ( - hFile, rPath.pData, rName.pData, eMode, &m_hImpl); -} - -inline void OStoreDirectory::close (void) SAL_THROW(()) -{ - if (m_hImpl) - { - store_closeDirectory (m_hImpl); - m_hImpl = 0; - } -} - -inline storeError OStoreDirectory::first (iterator& it) SAL_THROW(()) -{ - if (!m_hImpl) - return store_E_InvalidHandle; - - return store_findFirst (m_hImpl, &it); -} - -inline storeError OStoreDirectory::next (iterator& it) SAL_THROW(()) -{ - if (!m_hImpl) - return store_E_InvalidHandle; - - return store_findNext (m_hImpl, &it); -} - -inline storeError OStoreDirectory::travel (traveller& rTraveller) const -{ - storeError eErrCode = store_E_InvalidHandle; - if (m_hImpl) - { - iterator it; - eErrCode = store_findFirst (m_hImpl, &it); - while ((eErrCode == store_E_None) && rTraveller.visit(it)) - eErrCode = store_findNext (m_hImpl, &it); - } - return eErrCode; -} - -/*======================================================================== - * - * OStoreFile implementation. - * - *======================================================================*/ -inline OStoreFile::OStoreFile (void) SAL_THROW(()) - : m_hImpl (0) -{ -} - -inline OStoreFile::~OStoreFile (void) SAL_THROW(()) -{ - if (m_hImpl) - store_releaseHandle (m_hImpl); -} - -inline OStoreFile::OStoreFile ( - const OStoreFile& rOther) SAL_THROW(()) - : m_hImpl (rOther.m_hImpl) -{ - if (m_hImpl) - store_acquireHandle (m_hImpl); -} - -inline OStoreFile& OStoreFile::operator= ( - const OStoreFile& rOther) SAL_THROW(()) -{ - if (m_hImpl) - store_releaseHandle (m_hImpl); - m_hImpl = rOther.m_hImpl; - if (m_hImpl) - store_acquireHandle (m_hImpl); - return *this; -} - -inline OStoreFile::OStoreFile ( - storeFileHandle Handle) SAL_THROW(()) - : m_hImpl (Handle) -{ - if (m_hImpl) - store_acquireHandle (m_hImpl); -} - -inline OStoreFile::operator storeFileHandle (void) const SAL_THROW(()) -{ - return m_hImpl; -} - -inline sal_Bool OStoreFile::isValid (void) const SAL_THROW(()) -{ - return (!!m_hImpl); -} - -inline storeError OStoreFile::create ( - const rtl::OUString &rFilename, - storeAccessMode eAccessMode, - sal_uInt16 nPageSize) SAL_THROW(()) -{ - if (m_hImpl) - { - store_releaseHandle (m_hImpl); - m_hImpl = 0; - } - return store_openFile (rFilename.pData, eAccessMode, nPageSize, &m_hImpl); -} - -inline storeError OStoreFile::createInMemory ( - sal_uInt16 nPageSize) SAL_THROW(()) -{ - if (m_hImpl) - { - store_releaseHandle (m_hImpl); - m_hImpl = 0; - } - return store_createMemoryFile (nPageSize, &m_hImpl); -} - -inline void OStoreFile::close (void) SAL_THROW(()) -{ - if (m_hImpl) - { - store_closeFile (m_hImpl); - m_hImpl = 0; - } -} - -inline storeError OStoreFile::flush (void) const SAL_THROW(()) -{ - if (!m_hImpl) - return store_E_InvalidHandle; - - return store_flushFile (m_hImpl); -} - -inline storeError OStoreFile::getRefererCount ( - sal_uInt32 &rnRefCount) const SAL_THROW(()) -{ - if (!m_hImpl) - return store_E_InvalidHandle; - - return store_getFileRefererCount (m_hImpl, &rnRefCount); -} - -inline storeError OStoreFile::getSize ( - sal_uInt32 &rnSize) const SAL_THROW(()) -{ - if (!m_hImpl) - return store_E_InvalidHandle; - - return store_getFileSize (m_hImpl, &rnSize); -} - -inline storeError OStoreFile::attrib ( - const rtl::OUString &rPath, - const rtl::OUString &rName, - sal_uInt32 nMask1, - sal_uInt32 nMask2, - sal_uInt32 &rnAttrib) SAL_THROW(()) -{ - if (!m_hImpl) - return store_E_InvalidHandle; - - return store_attrib ( - m_hImpl, rPath.pData, rName.pData, nMask1, nMask2, &rnAttrib); -} - -inline storeError OStoreFile::attrib ( - const rtl::OUString &rPath, - const rtl::OUString &rName, - sal_uInt32 nMask1, - sal_uInt32 nMask2) SAL_THROW(()) -{ - if (!m_hImpl) - return store_E_InvalidHandle; - - return store_attrib ( - m_hImpl, rPath.pData, rName.pData, nMask1, nMask2, NULL); -} - -inline storeError OStoreFile::link ( - const rtl::OUString &rSrcPath, const rtl::OUString &rSrcName, - const rtl::OUString &rDstPath, const rtl::OUString &rDstName) SAL_THROW(()) -{ - if (!m_hImpl) - return store_E_InvalidHandle; - - return store_link ( - m_hImpl, - rSrcPath.pData, rSrcName.pData, - rDstPath.pData, rDstName.pData); -} - -inline storeError OStoreFile::symlink ( - const rtl::OUString &rSrcPath, const rtl::OUString &rSrcName, - const rtl::OUString &rDstPath, const rtl::OUString &rDstName) SAL_THROW(()) -{ - if (!m_hImpl) - return store_E_InvalidHandle; - - return store_symlink ( - m_hImpl, - rSrcPath.pData, rSrcName.pData, - rDstPath.pData, rDstName.pData); -} - -inline storeError OStoreFile::rename ( - const rtl::OUString &rSrcPath, const rtl::OUString &rSrcName, - const rtl::OUString &rDstPath, const rtl::OUString &rDstName) SAL_THROW(()) -{ - if (!m_hImpl) - return store_E_InvalidHandle; - - return store_rename ( - m_hImpl, - rSrcPath.pData, rSrcName.pData, - rDstPath.pData, rDstName.pData); -} - -inline storeError OStoreFile::remove ( - const rtl::OUString &rPath, const rtl::OUString &rName) SAL_THROW(()) -{ - if (!m_hImpl) - return store_E_InvalidHandle; - - return store_remove (m_hImpl, rPath.pData, rName.pData); -} - -- cgit From aa4b05bffbcea6156c51f0c5ff936f87fc2f26a3 Mon Sep 17 00:00:00 2001 From: "Matthias Huetsch [mhu]" <matthias.huetsch@sun.com> Date: Thu, 29 Oct 2009 16:00:34 +0100 Subject: #i71568# #i108349# Remove unused range locking code. --- store/inc/store/store.hxx | 7 +-- store/source/lockbyte.cxx | 34 ------------ store/source/lockbyte.hxx | 30 ----------- store/source/storbios.cxx | 130 ++++------------------------------------------ store/source/storbios.hxx | 10 ---- store/source/stordata.cxx | 91 ++++---------------------------- store/source/stortree.cxx | 115 ++++------------------------------------ store/workben/t_base.cxx | 11 ---- 8 files changed, 33 insertions(+), 395 deletions(-) (limited to 'store') diff --git a/store/inc/store/store.hxx b/store/inc/store/store.hxx index b6301f41f8b3..44540a44cb32 100644 --- a/store/inc/store/store.hxx +++ b/store/inc/store/store.hxx @@ -6,9 +6,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: store.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -29,7 +26,7 @@ ************************************************************************/ #ifndef _STORE_STORE_HXX_ -#define _STORE_STORE_HXX_ "$Revision: 1.5 $" +#define _STORE_STORE_HXX_ #include "sal/types.h" #include "rtl/ustring.hxx" @@ -242,7 +239,7 @@ public: (void) store_acquireHandle (rhs.m_hImpl); if (m_hImpl) (void) store_releaseHandle (m_hImpl); - m_hImpl = rOther.m_hImpl; + m_hImpl = rhs.m_hImpl; return *this; } diff --git a/store/source/lockbyte.cxx b/store/source/lockbyte.cxx index a03628bfb740..551c7c737127 100644 --- a/store/source/lockbyte.cxx +++ b/store/source/lockbyte.cxx @@ -156,40 +156,6 @@ storeError ILockBytes::flush() return flush_Impl(); } -storeError ILockBytes::lockRange (sal_uInt32 nOffset, sal_uInt32 nBytes) -{ - OSL_PRECOND(!(nOffset == STORE_PAGE_NULL), "store::ILockBytes::lockRange(): invalid Offset"); - if (nOffset == STORE_PAGE_NULL) - return store_E_CantSeek; - - sal_uInt64 size = nOffset + nBytes; - if (size > SAL_MAX_UINT32) - return store_E_CantSeek; - -#ifdef STORE_FEATURE_LOCKING - return lockRange_Impl (nOffset, nBytes); -#else - return store_E_None; // E_Unsupported -#endif /* STORE_FEATURE_LOCKING */ -} - -storeError ILockBytes::unlockRange (sal_uInt32 nOffset, sal_uInt32 nBytes) -{ - OSL_PRECOND(!(nOffset == STORE_PAGE_NULL), "store::ILockBytes::unlockRange(): invalid Offset"); - if (nOffset == STORE_PAGE_NULL) - return store_E_CantSeek; - - sal_uInt64 size = nOffset + nBytes; - if (size > SAL_MAX_UINT32) - return store_E_CantSeek; - -#ifdef STORE_FEATURE_LOCKING - return unlockRange_Impl (nOffset, nBytes); -#else - return store_E_None; // E_Unsupported -#endif /* STORE_FEATURE_LOCKING */ -} - /*======================================================================== * * FileLockBytes implementation. diff --git a/store/source/lockbyte.hxx b/store/source/lockbyte.hxx index 20a8b0b77073..95f73f289b67 100644 --- a/store/source/lockbyte.hxx +++ b/store/source/lockbyte.hxx @@ -128,26 +128,6 @@ public: */ storeError flush(); - /** - @param nOffset [in] - @param nBytes [in] - @return store_E_None upon success - store_E_LockingViolation - */ - storeError lockRange ( - sal_uInt32 nOffset, - sal_uInt32 nBytes); - - /** - @param nOffset [in] - @param nBytes [in] - @return store_E_None upon success - store_E_LockingViolation - */ - storeError unlockRange ( - sal_uInt32 nOffset, - sal_uInt32 nBytes); - private: /** Implementation (abstract). */ @@ -180,16 +160,6 @@ private: sal_uInt32 nSize) = 0; virtual storeError flush_Impl() = 0; - -#ifdef STORE_FEATURE_LOCKING - virtual storeError lockRange_Impl ( - sal_uInt32 nOffset, - sal_uInt32 nBytes) = 0; - - virtual storeError unlockRange_Impl ( - sal_uInt32 nOffset, - sal_uInt32 nBytes) = 0; -#endif /* STORE_FEATURE_LOCKING */ }; /*======================================================================== diff --git a/store/source/storbios.cxx b/store/source/storbios.cxx index d1f15dcda247..62852fa3e0cd 100644 --- a/store/source/storbios.cxx +++ b/store/source/storbios.cxx @@ -697,22 +697,8 @@ storeError OStorePageBIOS::verify (SuperPage *&rpSuper) */ storeError OStorePageBIOS::repair (SuperPage *&rpSuper) { - // Acquire Lock. - storeError eErrCode = acquireLock (0, SuperPage::theSize); - if (eErrCode != store_E_None) - return eErrCode; - // Verify SuperBlock page (with repair). - eErrCode = verify (rpSuper); - if (eErrCode != store_E_None) - { - // Failure. - releaseLock (0, SuperPage::theSize); - return eErrCode; - } - - // ReleaseLock. - return releaseLock (0, SuperPage::theSize); + return verify (rpSuper); } /* @@ -729,29 +715,16 @@ storeError OStorePageBIOS::create (sal_uInt16 nPageSize) return store_E_InvalidParameter; nPageSize = ((nPageSize + STORE_MINIMUM_PAGESIZE - 1) & ~(STORE_MINIMUM_PAGESIZE - 1)); - // Acquire Lock. - storeError eErrCode = acquireLock (0, nPageSize); - if (eErrCode != store_E_None) - return eErrCode; - // Allocate SuperBlock page. delete m_pSuper, m_pSuper = 0; if ((m_pSuper = new(nPageSize) SuperPage(nPageSize)) == 0) - { - // Cleanup and fail. - releaseLock (0, nPageSize); return store_E_OutOfMemory; - } m_pSuper->guard(); // Create initial page (w/ SuperBlock). - eErrCode = m_xLockBytes->writeAt (0, m_pSuper, nPageSize); + storeError eErrCode = m_xLockBytes->writeAt (0, m_pSuper, nPageSize); if (eErrCode != store_E_None) - { - // Cleanup and fail. - releaseLock (0, nPageSize); return eErrCode; - } #ifdef STORE_FEATURE_COMMIT // Commit. @@ -763,9 +736,7 @@ storeError OStorePageBIOS::create (sal_uInt16 nPageSize) // Adjust modified state. m_bModified = (eErrCode != store_E_None); - - // Release Lock and finish. - return releaseLock (0, nPageSize); + return eErrCode; } /* @@ -859,36 +830,6 @@ storeError OStorePageBIOS::initialize ( return eErrCode; } -/* - * acquireLock. - * Low Level: Precond: initialized, exclusive access. - */ -storeError OStorePageBIOS::acquireLock ( - sal_uInt32 nAddr, sal_uInt32 nSize) -{ - // Check precond. - if (!m_xLockBytes.is()) - return store_E_InvalidAccess; - - // Acquire Lock. - return m_xLockBytes->lockRange (nAddr, nSize); -} - -/* - * releaseLock. - * Low Level: Precond: initialized, exclusive access. - */ -storeError OStorePageBIOS::releaseLock ( - sal_uInt32 nAddr, sal_uInt32 nSize) -{ - // Check precond. - if (!m_xLockBytes.is()) - return store_E_InvalidAccess; - - // Release Lock. - return m_xLockBytes->unlockRange (nAddr, nSize); -} - /* * read. * Low Level: Precond: initialized, exclusive access. @@ -1034,18 +975,10 @@ storeError OStorePageBIOS::allocate ( if (!m_bWriteable) return store_E_AccessViolation; - // Acquire SuperBlock Lock. - storeError eErrCode = acquireLock (0, SuperPage::theSize); - if (eErrCode != store_E_None) - return eErrCode; - // Load SuperBlock and require good health. - eErrCode = verify (m_pSuper); + storeError eErrCode = verify (m_pSuper); if (eErrCode != store_E_None) - { - releaseLock (0, SuperPage::theSize); return eErrCode; - } // Check allocation. if (eAlloc != ALLOCATE_EOF) @@ -1061,10 +994,7 @@ storeError OStorePageBIOS::allocate ( // Load PageHead. eErrCode = peek (aPageHead); if (eErrCode != store_E_None) - { - releaseLock (0, SuperPage::theSize); return eErrCode; - } // Verify FreeList head. OSL_PRECOND( @@ -1079,9 +1009,6 @@ storeError OStorePageBIOS::allocate ( // Save SuperBlock page. eErrCode = m_pSuper->save (*this); - // Release SuperBlock Lock. - releaseLock (0, SuperPage::theSize); - // Recovery: Allocate from EOF. if (eErrCode == store_E_None) return allocate (rPage, ALLOCATE_EOF); @@ -1096,12 +1023,9 @@ storeError OStorePageBIOS::allocate ( // Save page at PageHead location. eErrCode = saveObjectAt_Impl (rPage, aPageHead.location()); if (eErrCode != store_E_None) - { - releaseLock (0, SuperPage::theSize); return eErrCode; - } - // Save SuperBlock page. + // Save SuperBlock page and finish. m_pSuper->m_aSuperTwo.unusedRemove (aListHead); m_pSuper->m_aSuperOne = m_pSuper->m_aSuperTwo; @@ -1109,9 +1033,7 @@ storeError OStorePageBIOS::allocate ( OSL_POSTCOND( eErrCode == store_E_None, "OStorePageBIOS::allocate(): SuperBlock save failed"); - - // Release SuperBlock Lock and finish. - return releaseLock (0, SuperPage::theSize); + return eErrCode; } } @@ -1119,10 +1041,7 @@ storeError OStorePageBIOS::allocate ( sal_uInt32 nPhysLen = STORE_PAGE_NULL; eErrCode = m_xLockBytes->getSize (nPhysLen); if (eErrCode != store_E_None) - { - releaseLock (0, SuperPage::theSize); return eErrCode; - } // Obtain logical EOF. OStorePageDescriptor aDescr (m_pSuper->m_aSuperTwo.m_aDescr); @@ -1141,10 +1060,7 @@ storeError OStorePageBIOS::allocate ( // Mark SuperBlock modified. eErrCode = m_pSuper->modified (*this); if (eErrCode != store_E_None) - { - releaseLock (0, SuperPage::theSize); return eErrCode; - } } // Resize. @@ -1153,21 +1069,15 @@ storeError OStorePageBIOS::allocate ( eErrCode = m_xLockBytes->setSize (nPhysLen); if (eErrCode != store_E_None) - { - releaseLock (0, SuperPage::theSize); return eErrCode; - } } // Save page at logical EOF. eErrCode = saveObjectAt_Impl (rPage, nLogLen); if (eErrCode != store_E_None) - { - releaseLock (0, SuperPage::theSize); return eErrCode; - } - // Save SuperBlock page. + // Save SuperBlock page and finish. nLogLen += store::ntohs(aDescr.m_nSize); aDescr.m_nAddr = store::htonl(nLogLen); @@ -1178,9 +1088,7 @@ storeError OStorePageBIOS::allocate ( OSL_POSTCOND( eErrCode == store_E_None, "OStorePageBIOS::allocate(): SuperBlock save failed"); - - // Release SuperBlock Lock and finish. - return releaseLock (0, SuperPage::theSize); + return eErrCode; } /* @@ -1198,18 +1106,10 @@ storeError OStorePageBIOS::free (OStorePageData & /* rData */, sal_uInt32 nAddr) if (!m_bWriteable) return store_E_AccessViolation; - // Acquire SuperBlock Lock. - storeError eErrCode = acquireLock (0, SuperPage::theSize); - if (eErrCode != store_E_None) - return eErrCode; - // Load SuperBlock and require good health. - eErrCode = verify (m_pSuper); + storeError eErrCode = verify (m_pSuper); if (eErrCode != store_E_None) - { - releaseLock (0, SuperPage::theSize); return eErrCode; - } // Load PageHead. OStorePageData aPageHead(OStorePageData::theSize); @@ -1217,10 +1117,7 @@ storeError OStorePageBIOS::free (OStorePageData & /* rData */, sal_uInt32 nAddr) eErrCode = peek (aPageHead); if (eErrCode != store_E_None) - { - releaseLock (0, SuperPage::theSize); return eErrCode; - } // Invalidate cache. (void) m_xCache->removePageAt (nAddr); @@ -1234,12 +1131,9 @@ storeError OStorePageBIOS::free (OStorePageData & /* rData */, sal_uInt32 nAddr) // Save PageHead. eErrCode = poke (aPageHead); if (eErrCode != store_E_None) - { - releaseLock (0, SuperPage::theSize); return eErrCode; - } - // Save SuperBlock page. + // Save SuperBlock page and finish. m_pSuper->m_aSuperTwo.unusedInsert (aListHead); m_pSuper->m_aSuperOne = m_pSuper->m_aSuperTwo; @@ -1247,9 +1141,7 @@ storeError OStorePageBIOS::free (OStorePageData & /* rData */, sal_uInt32 nAddr) OSL_POSTCOND( eErrCode == store_E_None, "OStorePageBIOS::free(): SuperBlock save failed"); - - // Release SuperBlock Lock and finish. - return releaseLock (0, SuperPage::theSize); + return eErrCode; } /* diff --git a/store/source/storbios.hxx b/store/source/storbios.hxx index d9a0f982bd3c..d9d91255742b 100644 --- a/store/source/storbios.hxx +++ b/store/source/storbios.hxx @@ -83,16 +83,6 @@ public: return m_xAllocator; } - /** acquireLock. - */ - storeError acquireLock ( - sal_uInt32 nAddr, sal_uInt32 nSize); - - /** releaseLock. - */ - storeError releaseLock ( - sal_uInt32 nAddr, sal_uInt32 nSize); - /** read. */ storeError read ( diff --git a/store/source/stordata.cxx b/store/source/stordata.cxx index 29350f8ebfdd..dd0a8f18211f 100644 --- a/store/source/stordata.cxx +++ b/store/source/stordata.cxx @@ -436,17 +436,8 @@ storeError OStoreIndirectionPageObject::truncate ( if (!(nSingle < nLimit)) return store_E_InvalidAccess; - // Save PageDescriptor. - OStorePageDescriptor aDescr (rPage.m_aDescr); - aDescr.m_nAddr = store::ntohl(aDescr.m_nAddr); - aDescr.m_nSize = store::ntohs(aDescr.m_nSize); - - // Acquire Lock. - storeError eErrCode = rBIOS.acquireLock (aDescr.m_nAddr, aDescr.m_nSize); - if (eErrCode != store_E_None) - return eErrCode; - // Truncate. + storeError eErrCode = store_E_None; for (sal_uInt16 i = nLimit; i > nSingle; i--) { // Obtain data page location. @@ -457,10 +448,7 @@ storeError OStoreIndirectionPageObject::truncate ( OStorePageData aPageHead; eErrCode = rBIOS.free (aPageHead, nAddr); if (eErrCode != store_E_None) - { - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); return eErrCode; - } // Clear pointer to data page. rPage.m_pData[i - 1] = STORE_PAGE_NULL; @@ -473,19 +461,10 @@ storeError OStoreIndirectionPageObject::truncate ( { // Save this page. eErrCode = rBIOS.saveObjectAt (*this, location()); - if (eErrCode != store_E_None) - { - // Must not happen. - OSL_TRACE("OStoreIndirectionPageObject::truncate(): save failed"); - - // Release Lock and Leave. - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); - return eErrCode; - } } - // Release Lock and Leave. - return rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); + // Done. + return eErrCode; } /* @@ -504,26 +483,14 @@ storeError OStoreIndirectionPageObject::truncate ( if (!((nDouble < nLimit) && (nSingle < nLimit))) return store_E_InvalidAccess; - // Save PageDescriptor. - OStorePageDescriptor aDescr (rPage.m_aDescr); - aDescr.m_nAddr = store::ntohl(aDescr.m_nAddr); - aDescr.m_nSize = store::ntohs(aDescr.m_nSize); - - // Acquire Lock. - storeError eErrCode = rBIOS.acquireLock (aDescr.m_nAddr, aDescr.m_nSize); - if (eErrCode != store_E_None) - return eErrCode; - // Truncate. + storeError eErrCode = store_E_None; for (sal_uInt16 i = nLimit; i > nDouble + 1; i--) { // Truncate single indirect page to zero direct pages. eErrCode = store_truncate_Impl (store::ntohl(rPage.m_pData[i - 1]), 0, rBIOS); if (eErrCode != store_E_None) - { - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); return eErrCode; - } // Clear pointer to single indirect page. rPage.m_pData[i - 1] = STORE_PAGE_NULL; @@ -533,10 +500,7 @@ storeError OStoreIndirectionPageObject::truncate ( // Truncate last single indirect page to 'nSingle' direct pages. eErrCode = store_truncate_Impl (store::ntohl(rPage.m_pData[nDouble]), nSingle, rBIOS); if (eErrCode != store_E_None) - { - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); return eErrCode; - } // Check for complete truncation. if (nSingle == 0) @@ -551,19 +515,10 @@ storeError OStoreIndirectionPageObject::truncate ( { // Save this page. eErrCode = rBIOS.saveObjectAt (*this, location()); - if (eErrCode != store_E_None) - { - // Must not happen. - OSL_TRACE("OStoreIndirectionPageObject::truncate(): save failed"); - - // Release Lock and Leave. - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); - return eErrCode; - } } - // Release Lock and Leave. - return rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); + // Done. + return eErrCode; } /* @@ -583,26 +538,14 @@ storeError OStoreIndirectionPageObject::truncate ( if (!((nTriple < nLimit) && (nDouble < nLimit) && (nSingle < nLimit))) return store_E_InvalidAccess; - // Save PageDescriptor. - OStorePageDescriptor aDescr (rPage.m_aDescr); - aDescr.m_nAddr = store::ntohl(aDescr.m_nAddr); - aDescr.m_nSize = store::ntohs(aDescr.m_nSize); - - // Acquire Lock. - storeError eErrCode = rBIOS.acquireLock (aDescr.m_nAddr, aDescr.m_nSize); - if (eErrCode != store_E_None) - return eErrCode; - // Truncate. + storeError eErrCode = store_E_None; for (sal_uInt16 i = nLimit; i > nTriple + 1; i--) { // Truncate double indirect page to zero single indirect pages. eErrCode = store_truncate_Impl (store::ntohl(rPage.m_pData[i - 1]), 0, 0, rBIOS); if (eErrCode != store_E_None) - { - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); return eErrCode; - } // Clear pointer to double indirect page. rPage.m_pData[i - 1] = STORE_PAGE_NULL; @@ -612,10 +555,7 @@ storeError OStoreIndirectionPageObject::truncate ( // Truncate last double indirect page to 'nDouble', 'nSingle' pages. eErrCode = store_truncate_Impl (store::ntohl(rPage.m_pData[nTriple]), nDouble, nSingle, rBIOS); if (eErrCode != store_E_None) - { - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); return eErrCode; - } // Check for complete truncation. if ((nDouble + nSingle) == 0) @@ -630,19 +570,10 @@ storeError OStoreIndirectionPageObject::truncate ( { // Save this page. eErrCode = rBIOS.saveObjectAt (*this, location()); - if (eErrCode != store_E_None) - { - // Must not happen. - OSL_TRACE("OStoreIndirectionPageObject::truncate(): save failed"); - - // Release Lock and Leave. - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); - return eErrCode; - } } - // Release Lock and Leave. - return rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); + // Done. + return eErrCode; } /*======================================================================== @@ -1132,8 +1063,8 @@ storeError OStoreDirectoryPageObject::truncate ( if (nAddr == STORE_PAGE_NULL) continue; // Free data page. - OStoreDataPageData aData; - eErrCode = rBIOS.free (aData, nAddr); + OStorePageData aPageHead; + eErrCode = rBIOS.free (aPageHead, nAddr); if (eErrCode != store_E_None) break; diff --git a/store/source/stortree.cxx b/store/source/stortree.cxx index 614b995aba72..3f4f4b21c68b 100644 --- a/store/source/stortree.cxx +++ b/store/source/stortree.cxx @@ -205,25 +205,10 @@ storeError OStoreBTreeNodeObject::split ( if (!rxPageL->querySplit()) return store_E_None; - // Save PageDescriptor. - OStorePageDescriptor aDescr (xPage->m_aDescr); - aDescr.m_nAddr = store::ntohl(aDescr.m_nAddr); - aDescr.m_nSize = store::ntohs(aDescr.m_nSize); - - // Acquire Lock. - storeError eErrCode = rBIOS.acquireLock (aDescr.m_nAddr, aDescr.m_nSize); - if (eErrCode != store_E_None) - return eErrCode; - - // [Begin PageL Lock (NYI)] - // Construct right page. PageHolderObject< page > xPageR; if (!xPageR.construct (rBIOS.allocator())) - { - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); return store_E_OutOfMemory; - } // Split right page off left page. xPageR->split (*rxPageL); @@ -231,12 +216,9 @@ storeError OStoreBTreeNodeObject::split ( // Allocate right page. self aNodeR (xPageR.get()); - eErrCode = rBIOS.allocate (aNodeR); + storeError eErrCode = rBIOS.allocate (aNodeR); if (eErrCode != store_E_None) - { - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); return eErrCode; - } // Truncate left page. rxPageL->truncate (rxPageL->capacityCount() / 2); @@ -245,35 +227,14 @@ storeError OStoreBTreeNodeObject::split ( self aNodeL (rxPageL.get()); eErrCode = rBIOS.saveObjectAt (aNodeL, aNodeL.location()); if (eErrCode != store_E_None) - { - // Must not happen. - OSL_TRACE("OStoreBTreeNodeObject::split(): save() failed"); - - // Release Lock and Leave. - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); return eErrCode; - } - - // [End PageL Lock (NYI)] // Insert right page. OStorePageLink aLink (xPageR->location()); xPage->insert (nIndexL + 1, T(xPageR->m_pData[0].m_aKey, aLink)); - // Save this page. - eErrCode = rBIOS.saveObjectAt (*this, location()); - if (eErrCode != store_E_None) - { - // Must not happen. - OSL_TRACE("OStoreBTreeNodeObject::split(): save() failed"); - - // Release Lock and Leave. - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); - return eErrCode; - } - - // Release Lock and Leave. - return rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); + // Save this page and leave. + return rBIOS.saveObjectAt (*this, location()); } /* @@ -287,43 +248,25 @@ storeError OStoreBTreeNodeObject::remove ( PageHolderObject< page > xImpl (m_xPage); page & rPage = (*xImpl); - // Save PageDescriptor. - OStorePageDescriptor aDescr (rPage.m_aDescr); - aDescr.m_nAddr = store::ntohl(aDescr.m_nAddr); - aDescr.m_nSize = store::ntohs(aDescr.m_nSize); - - // Acquire Lock. - storeError eErrCode = rBIOS.acquireLock (aDescr.m_nAddr, aDescr.m_nSize); - if (eErrCode != store_E_None) - return eErrCode; - // Check depth. + storeError eErrCode = store_E_None; if (rPage.depth()) { // Check link entry. T const aEntryL (rPage.m_pData[nIndexL]); if (!(rEntryL.compare (aEntryL) == T::COMPARE_EQUAL)) - { - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); return store_E_InvalidAccess; - } // Load link node. self aNodeL; eErrCode = rBIOS.loadObjectAt (aNodeL, aEntryL.m_aLink.location()); if (eErrCode != store_E_None) - { - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); return eErrCode; - } // Recurse: remove from link node. eErrCode = aNodeL.remove (0, rEntryL, rBIOS); if (eErrCode != store_E_None) - { - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); return eErrCode; - } // Check resulting link node usage. PageHolderObject< page > xPageL (aNodeL.get()); @@ -333,10 +276,7 @@ storeError OStoreBTreeNodeObject::remove ( OStorePageData aPageHead; eErrCode = rBIOS.free (aPageHead, xPageL->location()); if (eErrCode != store_E_None) - { - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); return eErrCode; - } // Remove index. rPage.remove (nIndexL); @@ -373,10 +313,7 @@ storeError OStoreBTreeNodeObject::remove ( { // Check leaf entry. if (!(rEntryL.compare (rPage.m_pData[nIndexL]) == T::COMPARE_EQUAL)) - { - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); return store_E_NotExists; - } // Save leaf entry. rEntryL = rPage.m_pData[nIndexL]; @@ -391,19 +328,10 @@ storeError OStoreBTreeNodeObject::remove ( { // Save this page. eErrCode = rBIOS.saveObjectAt (*this, location()); - if (eErrCode != store_E_None) - { - // Must not happen. - OSL_TRACE("OStoreBTreeNodeObject::remove(): save() failed"); - - // Release Lock and Leave. - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); - return eErrCode; - } } - // Release Lock and Leave. - return rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); + // Done. + return eErrCode; } /*======================================================================== @@ -457,33 +385,17 @@ storeError OStoreBTreeRootObject::change ( PageHolderObject< page > xPage (m_xPage); (void) testInvariant("OStoreBTreeRootObject::change(): enter"); - // Save PageDescriptor. - OStorePageDescriptor aDescr (xPage->m_aDescr); - aDescr.m_nAddr = store::ntohl(aDescr.m_nAddr); - aDescr.m_nSize = store::ntohs(aDescr.m_nSize); - // Save root location. sal_uInt32 const nRootAddr = xPage->location(); - // Acquire Lock. - storeError eErrCode = rBIOS.acquireLock (aDescr.m_nAddr, aDescr.m_nSize); - if (eErrCode != store_E_None) - return eErrCode; - // Construct new root. if (!rxPageL.construct (rBIOS.allocator())) - { - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); return store_E_OutOfMemory; - } // Save this as prev root. - eErrCode = rBIOS.allocate (*this); + storeError eErrCode = rBIOS.allocate (*this); if (eErrCode != store_E_None) - { - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); return store_E_OutOfMemory; - } // Setup new root. rxPageL->depth (xPage->depth() + 1); @@ -500,22 +412,13 @@ storeError OStoreBTreeRootObject::change ( // Save this as new root. eErrCode = rBIOS.saveObjectAt (*this, nRootAddr); - if (eErrCode != store_E_None) - { - // Must not happen. - OSL_TRACE("OStoreBTreeRootObject::change(): save() failed"); - - // Release Lock and Leave. - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); - return eErrCode; - } // Flush for robustness. (void) rBIOS.flush(); - // Done. Release Lock and Leave. + // Done. (void) testInvariant("OStoreBTreeRootObject::change(): leave"); - return rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); + return eErrCode; } /* diff --git a/store/workben/t_base.cxx b/store/workben/t_base.cxx index 593736e4d57b..02d283c7e31e 100644 --- a/store/workben/t_base.cxx +++ b/store/workben/t_base.cxx @@ -365,18 +365,7 @@ int SAL_CALL main (int argc, char **argv) rtl_zeroMemory (pBuffer, sizeof (pBuffer)); rtl_copyMemory (pBuffer, argv[0], rtl_str_getLength(argv[0]) + 1); - eErrCode = xBIOS->acquireLock (TEST_PAGESIZE, sizeof(pBuffer)); - if (eErrCode != store_E_None) - return eErrCode; - eErrCode = xBIOS->write (TEST_PAGESIZE, pBuffer, sizeof (pBuffer)); - if (eErrCode != store_E_None) - { - xBIOS->releaseLock (TEST_PAGESIZE, sizeof(pBuffer)); - return eErrCode; - } - - eErrCode = xBIOS->releaseLock (TEST_PAGESIZE, sizeof(pBuffer)); if (eErrCode != store_E_None) return eErrCode; -- cgit From d886d389f1531aadb4e81186ca5ceb3e8cb7c4ad Mon Sep 17 00:00:00 2001 From: "Matthias Huetsch [mhu]" <matthias.huetsch@sun.com> Date: Mon, 2 Nov 2009 19:09:43 +0100 Subject: #i71568# #i108349# Remove unused StateBlock code. --- store/source/storbios.cxx | 480 ++++++++++------------------------------------ store/source/storbios.hxx | 56 ++---- store/workben/makefile.mk | 6 +- 3 files changed, 119 insertions(+), 423 deletions(-) (limited to 'store') diff --git a/store/source/storbios.cxx b/store/source/storbios.cxx index 62852fa3e0cd..499584b02cd3 100644 --- a/store/source/storbios.cxx +++ b/store/source/storbios.cxx @@ -1,35 +1,27 @@ /************************************************************************* * - * OpenOffice.org - a multi-platform office productivity suite + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * $RCSfile: storbios.cxx,v $ + * Copyright 2008 by Sun Microsystems, Inc. * - * $Revision: 1.1.2.3 $ + * OpenOffice.org - a multi-platform office productivity suite * - * last change: $Author: mhu $ $Date: 2008/10/31 18:28:18 $ + * This file is part of OpenOffice.org. * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. * ************************************************************************/ @@ -91,36 +83,36 @@ struct OStoreSuperBlock m_aUnused (0) {} - OStoreSuperBlock (const OStoreSuperBlock& rOther) - : m_aGuard (rOther.m_aGuard), - m_aDescr (rOther.m_aDescr), - m_nMarked (rOther.m_nMarked), - m_aMarked (rOther.m_aMarked), - m_nUnused (rOther.m_nUnused), - m_aUnused (rOther.m_aUnused) + OStoreSuperBlock (const OStoreSuperBlock & rhs) + : m_aGuard (rhs.m_aGuard), + m_aDescr (rhs.m_aDescr), + m_nMarked (rhs.m_nMarked), + m_aMarked (rhs.m_aMarked), + m_nUnused (rhs.m_nUnused), + m_aUnused (rhs.m_aUnused) {} - OStoreSuperBlock& operator= (const OStoreSuperBlock& rOther) + OStoreSuperBlock& operator= (const OStoreSuperBlock & rhs) { - m_aGuard = rOther.m_aGuard; - m_aDescr = rOther.m_aDescr; - m_nMarked = rOther.m_nMarked; - m_aMarked = rOther.m_aMarked; - m_nUnused = rOther.m_nUnused; - m_aUnused = rOther.m_aUnused; + m_aGuard = rhs.m_aGuard; + m_aDescr = rhs.m_aDescr; + m_nMarked = rhs.m_nMarked; + m_aMarked = rhs.m_aMarked; + m_nUnused = rhs.m_nUnused; + m_aUnused = rhs.m_aUnused; return *this; } /** Comparison. */ - sal_Bool operator== (const OStoreSuperBlock& rOther) const + sal_Bool operator== (const OStoreSuperBlock & rhs) const { - return ((m_aGuard == rOther.m_aGuard ) && - (m_aDescr == rOther.m_aDescr ) && - (m_nMarked == rOther.m_nMarked) && - (m_aMarked == rOther.m_aMarked) && - (m_nUnused == rOther.m_nUnused) && - (m_aUnused == rOther.m_aUnused) ); + return ((m_aGuard == rhs.m_aGuard ) && + (m_aDescr == rhs.m_aDescr ) && + (m_nMarked == rhs.m_nMarked) && + (m_aMarked == rhs.m_aMarked) && + (m_nUnused == rhs.m_nUnused) && + (m_aUnused == rhs.m_aUnused) ); } /** unused(Count|Head|Insert|Remove|Reset). @@ -179,74 +171,6 @@ struct OStoreSuperBlock } }; -/*======================================================================== - * - * OStoreStateBlock. - * - *======================================================================*/ -struct OStoreStateBlock -{ - enum StateBits - { - STATE_CLEAN = 0, - STATE_CLOSE_WAIT = 1, - STATE_FLUSH_WAIT = 2 - }; - - /** Representation. - */ - sal_uInt32 m_nState; - - /** theSize. - */ - static const size_t theSize = sizeof(sal_uInt32); - - /** Construction. - */ - OStoreStateBlock() - : m_nState (store::htonl(STATE_CLEAN)) - {} - - /** Operation. - */ - bool closePending (void) const - { - sal_uInt32 nState = store::ntohl(m_nState); - return ((nState & STATE_CLOSE_WAIT) == STATE_CLOSE_WAIT); - } - void closed (void) - { - sal_uInt32 nState = store::ntohl(m_nState); - nState &= ~STATE_CLOSE_WAIT; - m_nState = store::htonl(nState); - } - - bool flushPending (void) const - { - sal_uInt32 nState = store::ntohl(m_nState); - return ((nState & STATE_FLUSH_WAIT) == STATE_FLUSH_WAIT); - } - void flushed (void) - { - sal_uInt32 nState = store::ntohl(m_nState); - nState &= ~STATE_FLUSH_WAIT; - m_nState = store::htonl(nState); - } - - void modified (void) - { - sal_uInt32 nState = store::ntohl(m_nState); - nState |= (STATE_CLOSE_WAIT | STATE_FLUSH_WAIT); - m_nState = store::htonl(nState); - } - void clean (void) - { - sal_uInt32 nState = store::ntohl(m_nState); - nState &= ~(STATE_CLOSE_WAIT | STATE_FLUSH_WAIT); - m_nState = store::htonl(nState); - } -}; - /*======================================================================== * * OStoreSuperBlockPage interface. @@ -258,17 +182,15 @@ namespace store struct OStoreSuperBlockPage { typedef OStoreSuperBlock SuperBlock; - typedef OStoreStateBlock StateBlock; /** Representation. */ SuperBlock m_aSuperOne; SuperBlock m_aSuperTwo; - StateBlock m_aState; /** theSize. */ - static const size_t theSize = 2 * SuperBlock::theSize + StateBlock::theSize; + static const size_t theSize = 2 * SuperBlock::theSize; static const sal_uInt16 thePageSize = theSize; STORE_STATIC_ASSERT(STORE_MINIMUM_PAGESIZE >= thePageSize); @@ -296,8 +218,7 @@ struct OStoreSuperBlockPage */ explicit OStoreSuperBlockPage (sal_uInt16 nPageSize = thePageSize) : m_aSuperOne(nPageSize), - m_aSuperTwo(nPageSize), - m_aState() + m_aSuperTwo(nPageSize) {} /** guard (external representation). @@ -319,21 +240,6 @@ struct OStoreSuperBlockPage return rBIOS.write (0, this, theSize); } - /** close. - */ - storeError close ( - OStorePageBIOS &rBIOS); - - /** flush. - */ - storeError flush ( - OStorePageBIOS &rBIOS); - - /** modified. - */ - storeError modified ( - OStorePageBIOS &rBIOS); - /** verify (with repair). */ storeError verify ( @@ -347,89 +253,44 @@ struct OStoreSuperBlockPage * OStoreSuperBlockPage implementation. * *======================================================================*/ -/* - * close. - */ -storeError OStoreSuperBlockPage::close (OStorePageBIOS &rBIOS) +#if 0 /* NEW */ +SuperBlockPage::unusedHead(PageData & rPageHead) // alloc page, step 1 { - storeError eErrCode = store_E_None; - if (m_aState.closePending()) - { - // Mark as modified. - m_aState.modified(); - - // Check access mode. - if (rBIOS.isWriteable()) - { - // Save StateBlock. - StateBlock aState (m_aState); - - // Mark as clean. - aState.clean(); + L aListHead (m_aSuperTwo.unusedHead()); + if (aListHead.location() == STORE_PAGE_NULL) + return store_E_NotExists; - // Write behind SuperBlock. - sal_uInt32 nAddr = 2 * SuperBlock::theSize; - eErrCode = rBIOS.write (nAddr, &aState, StateBlock::theSize); - } - - // Mark as clean. - m_aState.clean(); - } - return eErrCode; + rBIOS.read (aListHead.location(), &rPageHead, PageData::theSize); } - -/* - * flush. - */ -storeError OStoreSuperBlockPage::flush (OStorePageBIOS &rBIOS) +SuperBlockPage::unusedPop(sal_uInt32 nAddr) // alloc page, step 2 { - storeError eErrCode = store_E_None; - if (m_aState.flushPending()) - { - // Check access mode. - if (rBIOS.isWriteable()) - { - // Save StateBlock. - StateBlock aState (m_aState); - - // Mark as flushed. - aState.flushed(); +} +storeError OStoreSuperBlockPage::unusedPush (OStorePageBIOS & rBIOS, sal_uInt32 nAddr) +{ + PageData aPageHead (PageData::theSize); + eErrCode = rBIOS.read (nAddr, &aPageHead, PageData::theSize); + if (eErrCode != store_E_None) + return eErrCode; - // Write behind SuperBlock. - sal_uInt32 nAddr = 2 * SuperBlock::theSize; - eErrCode = rBIOS.write (nAddr, &aState, StateBlock::theSize); - } + eErrCode = aPageHead.verify (nAddr); + if (eErrCode != store_E_None) + return eErrCode; - // Mark as flushed. - m_aState.flushed(); - } - return eErrCode; -} + aPageHead.m_aUnused = m_aSuperTwo.unusedHead(); + aPageHead.guard (nAddr); -/* - * modified. - */ -storeError OStoreSuperBlockPage::modified (OStorePageBIOS &rBIOS) -{ - storeError eErrCode = store_E_None; - if (!m_aState.flushPending()) - { - // Mark as modified. - m_aState.modified(); + eErrCode = rBIOS.write (nAddr, &aPageHead, PageData::theSize); + if (eErrCode != store_E_None) + return eErrCode; - // Check access mode. - if (rBIOS.isWriteable()) - { - // Save StateBlock. - StateBlock aState (m_aState); + OStorePageLink aListHead (nAddr); + m_aSuperTwo.unusedInsert(aListHead); + m_aSuperOne = m_aSuperTwo; + guard(); - // Write behind SuperBlock. - sal_uInt32 nAddr = 2 * SuperBlock::theSize; - eErrCode = rBIOS.write (nAddr, &aState, StateBlock::theSize); - } - } - return eErrCode; + return rBIOS.write (0, this, theSize); } +#endif /* NEW */ /* * verify (with repair). @@ -644,8 +505,7 @@ OStorePageBIOS::AceCache::destroy (OStorePageBIOS::Ace * ace) OStorePageBIOS::OStorePageBIOS (void) : m_xLockBytes (NULL), m_pSuper (NULL), - m_bModified (sal_False), - m_bWriteable (sal_False) + m_bWriteable (false) { } @@ -678,29 +538,12 @@ storeError OStorePageBIOS::verify (SuperPage *&rpSuper) delete rpSuper, rpSuper = 0; return eErrCode; } - - // Check SuperBlock state. - if (rpSuper->m_aState.closePending()) - OSL_TRACE("OStorePageBIOS::verify(): close pending.\n"); - - if (rpSuper->m_aState.flushPending()) - OSL_TRACE("OStorePageBIOS::verify(): flush pending.\n"); } // Verify SuperBlock page (with repair). return rpSuper->verify (*this); } -/* - * repair (SuperBlock). - * Internal: Precond: initialized, exclusive access. - */ -storeError OStorePageBIOS::repair (SuperPage *&rpSuper) -{ - // Verify SuperBlock page (with repair). - return verify (rpSuper); -} - /* * create (SuperBlock). * Internal: Precond: initialized, exclusive access. @@ -722,21 +565,7 @@ storeError OStorePageBIOS::create (sal_uInt16 nPageSize) m_pSuper->guard(); // Create initial page (w/ SuperBlock). - storeError eErrCode = m_xLockBytes->writeAt (0, m_pSuper, nPageSize); - if (eErrCode != store_E_None) - return eErrCode; - -#ifdef STORE_FEATURE_COMMIT - // Commit. - eErrCode = m_xLockBytes->flush(); - OSL_POSTCOND( - eErrCode == store_E_None, - "OStorePageBIOS::create(): flush failed"); -#endif /* STORE_FEATURE_COMMIT */ - - // Adjust modified state. - m_bModified = (eErrCode != store_E_None); - return eErrCode; + return write (0, m_pSuper, nPageSize); } /* @@ -764,19 +593,13 @@ storeError OStorePageBIOS::initialize ( // Initialize. m_xLockBytes = pLockBytes; - m_bModified = sal_False; m_bWriteable = (!(eAccessMode == store_AccessReadOnly)); // Check access mode. - if (eAccessMode == store_AccessReadOnly) - { - // Verify SuperBlock page. - eErrCode = verify (m_pSuper); - } - else if (eAccessMode != store_AccessCreate) + if (eAccessMode != store_AccessCreate) { // Verify (w/ repair) SuperBlock page. - eErrCode = repair (m_pSuper); + eErrCode = verify (m_pSuper); } else { @@ -785,13 +608,6 @@ storeError OStorePageBIOS::initialize ( if (eErrCode != store_E_None) return eErrCode; -#ifdef STORE_FEATURE_COMMIT - // Commit. - eErrCode = m_xLockBytes->flush(); - if (eErrCode != store_E_None) - return eErrCode; -#endif /* STORE_FEATURE_COMMIT */ - // Mark as not existing. eErrCode = store_E_NotExists; } @@ -813,9 +629,6 @@ storeError OStorePageBIOS::initialize ( } if (eErrCode == store_E_None) { - // Obtain modified state. - m_bModified = m_pSuper->m_aState.flushPending(); - // Obtain page size. rnPageSize = store::ntohs(m_pSuper->m_aSuperOne.m_aDescr.m_nSize); @@ -841,7 +654,7 @@ storeError OStorePageBIOS::read ( if (!m_xLockBytes.is()) return store_E_InvalidAccess; - // Read Page. + // Read Data. return m_xLockBytes->readAt (nAddr, pData, nSize); } @@ -858,18 +671,6 @@ storeError OStorePageBIOS::write ( if (!m_bWriteable) return store_E_AccessViolation; - // Check modified state. - if (!m_bModified) - { - // Mark as modified. - m_bModified = sal_True; - - // Mark SuperBlock modified. - storeError eErrCode = m_pSuper->modified (*this); - if (eErrCode != store_E_None) - return eErrCode; - } - // Write Data. return m_xLockBytes->writeAt (nAddr, pData, nSize); } @@ -989,10 +790,9 @@ storeError OStorePageBIOS::allocate ( { // Allocate from FreeList. OStorePageData aPageHead (OStorePageData::theSize); - aPageHead.location (aListHead.location()); // Load PageHead. - eErrCode = peek (aPageHead); + eErrCode = peek (aPageHead, aListHead.location()); if (eErrCode != store_E_None) return eErrCode; @@ -1037,58 +837,14 @@ storeError OStorePageBIOS::allocate ( } } - // Allocate from logical EOF. Determine physical EOF. - sal_uInt32 nPhysLen = STORE_PAGE_NULL; - eErrCode = m_xLockBytes->getSize (nPhysLen); + // Allocate from EOF. Determine current size. + sal_uInt32 nSize = STORE_PAGE_NULL; + eErrCode = m_xLockBytes->getSize (nSize); if (eErrCode != store_E_None) return eErrCode; - // Obtain logical EOF. - OStorePageDescriptor aDescr (m_pSuper->m_aSuperTwo.m_aDescr); - sal_uInt32 nLogLen = store::ntohl(aDescr.m_nAddr); - if (nLogLen == 0) - nLogLen = nPhysLen; /* backward compatibility */ - - if (!(nLogLen < nPhysLen)) - { - // Check modified state. - if (!m_bModified) - { - // Mark modified. - m_bModified = sal_True; - - // Mark SuperBlock modified. - eErrCode = m_pSuper->modified (*this); - if (eErrCode != store_E_None) - return eErrCode; - } - - // Resize. - sal_uInt32 nAlign = SAL_MIN (nPhysLen, STORE_MAXIMUM_PAGESIZE); - nPhysLen = ((nPhysLen + nAlign) / nAlign) * nAlign; - - eErrCode = m_xLockBytes->setSize (nPhysLen); - if (eErrCode != store_E_None) - return eErrCode; - } - - // Save page at logical EOF. - eErrCode = saveObjectAt_Impl (rPage, nLogLen); - if (eErrCode != store_E_None) - return eErrCode; - - // Save SuperBlock page and finish. - nLogLen += store::ntohs(aDescr.m_nSize); - aDescr.m_nAddr = store::htonl(nLogLen); - - m_pSuper->m_aSuperTwo.m_aDescr = aDescr; - m_pSuper->m_aSuperOne = m_pSuper->m_aSuperTwo; - - eErrCode = m_pSuper->save (*this); - OSL_POSTCOND( - eErrCode == store_E_None, - "OStorePageBIOS::allocate(): SuperBlock save failed"); - return eErrCode; + // Save page at current EOF. + return saveObjectAt_Impl (rPage, nSize); } /* @@ -1113,9 +869,7 @@ storeError OStorePageBIOS::free (OStorePageData & /* rData */, sal_uInt32 nAddr) // Load PageHead. OStorePageData aPageHead(OStorePageData::theSize); - aPageHead.location (nAddr); - - eErrCode = peek (aPageHead); + eErrCode = peek (aPageHead, nAddr); if (eErrCode != store_E_None) return eErrCode; @@ -1129,7 +883,7 @@ storeError OStorePageBIOS::free (OStorePageData & /* rData */, sal_uInt32 nAddr) aListHead.m_nAddr = aPageHead.m_aDescr.m_nAddr; // Save PageHead. - eErrCode = poke (aPageHead); + eErrCode = poke (aPageHead, nAddr); if (eErrCode != store_E_None) return eErrCode; @@ -1253,37 +1007,17 @@ storeError OStorePageBIOS::close (void) #endif /* NEW */ } - // Check SuperBlock page. - storeError eErrCode = store_E_None; - if (m_pSuper) - { - // Release SuperBlock page. - eErrCode = m_pSuper->close (*this); - delete m_pSuper, m_pSuper = 0; - } + // Release SuperBlock page. + delete m_pSuper, m_pSuper = 0; // Release PageCache. m_xCache.clear(); - // Check LockBytes. - if (m_xLockBytes.is()) - { -#ifdef STORE_FEATURE_COMMIT - // Commit. - storeError result = m_xLockBytes->flush(); - if (eErrCode == store_E_None) - { - // Previous result(s) okay. Propagate next result. - eErrCode = result; - } -#endif /* STORE_FEATURE_COMMIT */ - - // Release LockBytes. - m_xLockBytes.clear(); - } + // Release LockBytes. + m_xLockBytes.clear(); // Done. - return eErrCode; + return store_E_None; } /* @@ -1299,27 +1033,8 @@ storeError OStorePageBIOS::flush (void) if (!m_xLockBytes.is()) return store_E_InvalidAccess; - // Check mode and state. - storeError eErrCode = store_E_None; - if (!(m_bWriteable && m_bModified)) - return eErrCode; - - // Flush SuperBlock page. - eErrCode = m_pSuper->flush (*this); - - // Flush LockBytes. - storeError result = m_xLockBytes->flush(); - if (eErrCode == store_E_None) - { - // Previous result(s) okay. Propagate next result. - eErrCode = result; - } - - // Adjust modified state. - m_bModified = (eErrCode != store_E_None); - - // Done. - return eErrCode; + // Flush LockBytes and finish. + return m_xLockBytes->flush(); } /* @@ -1372,7 +1087,8 @@ storeError OStorePageBIOS::scanBegin ( // Setup Context descriptor. rCtx.m_aDescr = m_pSuper->m_aSuperOne.m_aDescr; - rCtx.m_aDescr.m_nAddr = rCtx.m_aDescr.m_nSize; // @@@ ntoh @@@ + rCtx.m_aDescr.m_nSize = store::ntohs(rCtx.m_aDescr.m_nSize); + rCtx.m_aDescr.m_nAddr = rCtx.m_aDescr.m_nSize; // Setup Context size. eErrCode = size (rCtx.m_nSize); @@ -1404,11 +1120,11 @@ storeError OStorePageBIOS::scanNext ( while (rCtx.isValid()) { // Assign next location. - aPageHead.location (rCtx.m_aDescr.m_nAddr); + sal_uInt32 nAddr = rCtx.m_aDescr.m_nAddr; rCtx.m_aDescr.m_nAddr += rCtx.m_aDescr.m_nSize; // Load PageHead. - storeError eErrCode = peek (aPageHead); + storeError eErrCode = peek (aPageHead, nAddr); if (eErrCode != store_E_None) continue; @@ -1421,7 +1137,7 @@ storeError OStorePageBIOS::scanNext ( continue; // Load page. - eErrCode = loadObjectAt_Impl (rPage, aPageHead.location()); + eErrCode = loadObjectAt_Impl (rPage, nAddr); if (eErrCode != store_E_None) continue; @@ -1437,26 +1153,26 @@ storeError OStorePageBIOS::scanNext ( * peek (PageHead). * Internal: Precond: initialized, readable, exclusive access. */ -storeError OStorePageBIOS::peek (OStorePageData &rData) +storeError OStorePageBIOS::peek (OStorePageData &rData, sal_uInt32 nAddr) { // Read PageHead. - storeError eErrCode = read (rData.location(), &rData, OStorePageData::theSize); + storeError eErrCode = read (nAddr, &rData, OStorePageData::theSize); if (eErrCode != store_E_None) return eErrCode; // Verify PageHead. - return rData.verify(); + return rData.verify (nAddr); } /* * poke (PageHead). * Internal: Precond: initialized, writeable, exclusive access. */ -storeError OStorePageBIOS::poke (OStorePageData &rData) +storeError OStorePageBIOS::poke (OStorePageData &rData, sal_uInt32 nAddr) { // Guard PageHead. - rData.guard(); + rData.guard (nAddr); // Write PageHead. - return write (rData.location(), &rData, OStorePageData::theSize); + return write (nAddr, &rData, OStorePageData::theSize); } diff --git a/store/source/storbios.hxx b/store/source/storbios.hxx index d9d91255742b..f6e74ee3e19d 100644 --- a/store/source/storbios.hxx +++ b/store/source/storbios.hxx @@ -1,40 +1,32 @@ /************************************************************************* * - * OpenOffice.org - a multi-platform office productivity suite + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * $RCSfile: storbios.hxx,v $ + * Copyright 2008 by Sun Microsystems, Inc. * - * $Revision: 1.1.2.3 $ + * OpenOffice.org - a multi-platform office productivity suite * - * last change: $Author: mhu $ $Date: 2008/10/31 18:28:18 $ + * This file is part of OpenOffice.org. * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. * ************************************************************************/ #ifndef _STORE_STORBIOS_HXX_ -#define _STORE_STORBIOS_HXX_ "$Revision: 1.1.2.3 $" +#define _STORE_STORBIOS_HXX_ #include "sal/types.h" #include "rtl/ref.hxx" @@ -93,10 +85,6 @@ public: storeError write ( sal_uInt32 nAddr, const void *pData, sal_uInt32 nSize); - /** isModified. - */ - inline bool isModified (void) const; - /** isWriteable. */ inline bool isWriteable (void) const; @@ -197,7 +185,6 @@ private: typedef OStoreSuperBlockPage SuperPage; SuperPage *m_pSuper; - bool m_bModified; bool m_bWriteable; rtl::Reference< PageData::Allocator > m_xAllocator; @@ -235,14 +222,13 @@ private: /** SuperBlock verification and repair. */ storeError verify (SuperPage *&rpSuper); - storeError repair (SuperPage *&rpSuper); /** Page Maintenance. */ storeError peek ( - OStorePageData &rData); + OStorePageData &rData, sal_uInt32 nAddr); storeError poke ( - OStorePageData &rData); + OStorePageData &rData, sal_uInt32 nAddr); storeError loadObjectAt_Impl ( OStorePageObject & rPage, sal_uInt32 nAddr); @@ -259,10 +245,6 @@ inline OStorePageBIOS::operator osl::Mutex& (void) const { return (osl::Mutex&)m_aMutex; } -inline bool OStorePageBIOS::isModified (void) const -{ - return m_bModified; -} inline bool OStorePageBIOS::isWriteable (void) const { return m_bWriteable; diff --git a/store/workben/makefile.mk b/store/workben/makefile.mk index 4b58d26409a0..60f1bb9b2ffe 100644 --- a/store/workben/makefile.mk +++ b/store/workben/makefile.mk @@ -6,10 +6,6 @@ # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.6 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify @@ -80,6 +76,7 @@ APP1OBJS= $(OBJ)$/t_file.obj APP1STDLIBS= $(STOREDBGLIB) APP1STDLIBS+= $(SALLIB) APP1DEPN= $(STOREDBGLIB) +APP1RPATH= UREBIN APP2TARGET= t_page APP2OBJS= $(OBJ)$/t_page.obj @@ -92,6 +89,7 @@ APP3OBJS= $(OBJ)$/t_base.obj APP3STDLIBS= $(STOREDBGLIB) APP3STDLIBS+= $(SALLIB) APP3DEPN= $(STOREDBGLIB) +APP3RPATH= UREBIN APP4TARGET= t_store APP4OBJS= $(OBJ)$/t_store.obj -- cgit From 5243a9ef4e1178f0e03c9fcafb2a4405db4b4da3 Mon Sep 17 00:00:00 2001 From: "Matthias Huetsch [mhu]" <matthias.huetsch@sun.com> Date: Tue, 10 Nov 2009 15:55:03 +0100 Subject: #i71568# #i108349# Remove unnecessary flush(), more cleanup. --- store/source/storbios.cxx | 87 ++++++++++++++++++++++++++++++++--------------- store/source/storpage.cxx | 5 --- store/source/stortree.cxx | 7 +--- 3 files changed, 60 insertions(+), 39 deletions(-) (limited to 'store') diff --git a/store/source/storbios.cxx b/store/source/storbios.cxx index 499584b02cd3..1882c5ab072c 100644 --- a/store/source/storbios.cxx +++ b/store/source/storbios.cxx @@ -231,19 +231,16 @@ struct OStoreSuperBlockPage /** save. */ - storeError save (OStorePageBIOS &rBIOS) + storeError save (OStorePageBIOS & rBIOS) { - // Guard. - guard(); - - // Write. + m_aSuperOne.guard(); + m_aSuperTwo = m_aSuperOne; return rBIOS.write (0, this, theSize); } /** verify (with repair). */ - storeError verify ( - OStorePageBIOS &rBIOS); + storeError verify (OStorePageBIOS & rBIOS); }; } // namespace store @@ -254,17 +251,55 @@ struct OStoreSuperBlockPage * *======================================================================*/ #if 0 /* NEW */ -SuperBlockPage::unusedHead(PageData & rPageHead) // alloc page, step 1 +/** + * alloc page, step 1: get freelist head. + */ +storeError SuperBlockPage::unusedHead(OStorePageBIOS & rBIOS, PageData & rPageHead) { - L aListHead (m_aSuperTwo.unusedHead()); - if (aListHead.location() == STORE_PAGE_NULL) - return store_E_NotExists; + // Check FreeList. + OStorePageLink const aListHead (m_aSuperOne.unusedHead()); + if (aListHead.location() == 0) // @see SuperBlock::ctor() + { + rPageHead.location (STORE_PAGE_NULL); + return store_E_None; + } + + // Load PageHead. + eErrCode = rBIOS.read (aListHead.location(), &rPageHead, PageData::theSize); + + eErrCode = rPageHead.verify (aListHead.location()); - rBIOS.read (aListHead.location(), &rPageHead, PageData::theSize); + // Verify page is unused. + sal_uInt32 const nAddr = rPageHead.m_aUnused.location(); + OSL_POSTCOND(nAddr != STORE_PAGE_NULL, "store::SuperBlock::unusedHead(): page not free"); + if (nAddr == STORE_PAGE_NULL) + { + // Page in use. + rPageHead.location (STORE_PAGE_NULL); + + // Recovery: Reset FreeList. + m_aSuperOne.unusedReset(); + return save (rBIOS); + } + return store_E_None; } -SuperBlockPage::unusedPop(sal_uInt32 nAddr) // alloc page, step 2 + +/** + * alloc page, step 2: pop freelist head. + */ +SuperBlockPage::unusedPop (OStorePageBIOS & rBIOS, PageData const & rPageHead) { + sal_uInt32 const nAddr = rPageHead.m_aUnused.location(); + OSL_PRECOND(nAddr != STORE_PAGE_NULL, "store::SuperBlock::unusedPop(): page not free"); + if (nAddr == STORE_PAGE_NULL) + return store_E_CantSeek; + + // Pop from FreeList. + OStorePageLink const aListHead (nAddr); + m_aSuperOne.unusedRemove (aListHead); + return save (rBIOS); } + storeError OStoreSuperBlockPage::unusedPush (OStorePageBIOS & rBIOS, sal_uInt32 nAddr) { PageData aPageHead (PageData::theSize); @@ -276,19 +311,16 @@ storeError OStoreSuperBlockPage::unusedPush (OStorePageBIOS & rBIOS, sal_uInt32 if (eErrCode != store_E_None) return eErrCode; - aPageHead.m_aUnused = m_aSuperTwo.unusedHead(); + aPageHead.m_aUnused = m_aSuperOne.unusedHead(); aPageHead.guard (nAddr); eErrCode = rBIOS.write (nAddr, &aPageHead, PageData::theSize); if (eErrCode != store_E_None) return eErrCode; - OStorePageLink aListHead (nAddr); - m_aSuperTwo.unusedInsert(aListHead); - m_aSuperOne = m_aSuperTwo; - guard(); - - return rBIOS.write (0, this, theSize); + OStorePageLink const aListHead (nAddr); + m_aSuperOne.unusedInsert(aListHead); + return save (rBIOS); } #endif /* NEW */ @@ -785,7 +817,7 @@ storeError OStorePageBIOS::allocate ( if (eAlloc != ALLOCATE_EOF) { // Check FreeList. - OStorePageLink aListHead (m_pSuper->m_aSuperTwo.unusedHead()); + OStorePageLink aListHead (m_pSuper->m_aSuperOne.unusedHead()); if (aListHead.location()) { // Allocate from FreeList. @@ -803,8 +835,7 @@ storeError OStorePageBIOS::allocate ( if (aPageHead.m_aUnused.location() == STORE_PAGE_NULL) { // Recovery: Reset FreeList. - m_pSuper->m_aSuperTwo.unusedReset(); - m_pSuper->m_aSuperOne = m_pSuper->m_aSuperTwo; + m_pSuper->m_aSuperOne.unusedReset(); // Save SuperBlock page. eErrCode = m_pSuper->save (*this); @@ -826,8 +857,7 @@ storeError OStorePageBIOS::allocate ( return eErrCode; // Save SuperBlock page and finish. - m_pSuper->m_aSuperTwo.unusedRemove (aListHead); - m_pSuper->m_aSuperOne = m_pSuper->m_aSuperTwo; + m_pSuper->m_aSuperOne.unusedRemove (aListHead); eErrCode = m_pSuper->save (*this); OSL_POSTCOND( @@ -877,7 +907,9 @@ storeError OStorePageBIOS::free (OStorePageData & /* rData */, sal_uInt32 nAddr) (void) m_xCache->removePageAt (nAddr); // Push onto FreeList. - OStorePageLink aListHead (m_pSuper->m_aSuperTwo.unusedHead()); + // return m_pSuper->unusedPush (*this, nAddr); // @@@ NEW @@@ + + OStorePageLink aListHead (m_pSuper->m_aSuperOne.unusedHead()); aPageHead.m_aUnused.m_nAddr = aListHead.m_nAddr; aListHead.m_nAddr = aPageHead.m_aDescr.m_nAddr; @@ -888,8 +920,7 @@ storeError OStorePageBIOS::free (OStorePageData & /* rData */, sal_uInt32 nAddr) return eErrCode; // Save SuperBlock page and finish. - m_pSuper->m_aSuperTwo.unusedInsert (aListHead); - m_pSuper->m_aSuperOne = m_pSuper->m_aSuperTwo; + m_pSuper->m_aSuperOne.unusedInsert (aListHead); eErrCode = m_pSuper->save (*this); OSL_POSTCOND( diff --git a/store/source/storpage.cxx b/store/source/storpage.cxx index b112d5bb8fdd..126057457c15 100644 --- a/store/source/storpage.cxx +++ b/store/source/storpage.cxx @@ -120,11 +120,6 @@ storeError OStorePageManager::initialize ( // Save RootNode. eErrCode = base::saveObjectAt (m_aRoot, rnPageSize); - if (eErrCode != store_E_None) - return eErrCode; - - // Flush for robustness. - (void) base::flush(); } // Done. diff --git a/store/source/stortree.cxx b/store/source/stortree.cxx index 3f4f4b21c68b..26f06b887b75 100644 --- a/store/source/stortree.cxx +++ b/store/source/stortree.cxx @@ -410,13 +410,8 @@ storeError OStoreBTreeRootObject::change ( tmp.swap (m_xPage); } - // Save this as new root. + // Save this as new root and finish. eErrCode = rBIOS.saveObjectAt (*this, nRootAddr); - - // Flush for robustness. - (void) rBIOS.flush(); - - // Done. (void) testInvariant("OStoreBTreeRootObject::change(): leave"); return eErrCode; } -- cgit From 00075d74eef445722ff1b269ef5205e29f559af3 Mon Sep 17 00:00:00 2001 From: "Matthias Huetsch [mhu]" <matthias.huetsch@sun.com> Date: Fri, 13 Nov 2009 16:03:20 +0100 Subject: #i71568# #i108349# Simplified block (page) allocation. --- store/source/storbase.hxx | 17 -- store/source/storbios.cxx | 387 ++++++++++++++++++---------------------------- store/source/storbios.hxx | 25 ++- store/source/stordata.cxx | 15 +- store/source/storpage.cxx | 3 +- store/source/stortree.cxx | 5 +- 6 files changed, 170 insertions(+), 282 deletions(-) (limited to 'store') diff --git a/store/source/storbase.hxx b/store/source/storbase.hxx index 04be2860f691..3331763acf61 100644 --- a/store/source/storbase.hxx +++ b/store/source/storbase.hxx @@ -556,13 +556,6 @@ struct PageData /** guard (external representation). */ - void guard() - { - sal_uInt32 nCRC32 = 0; - nCRC32 = rtl_crc32 (nCRC32, &m_aGuard.m_nMagic, sizeof(sal_uInt32)); - nCRC32 = rtl_crc32 (nCRC32, &m_aDescr, theSize - sizeof(G)); - m_aGuard.m_nCRC32 = store::htonl(nCRC32); - } void guard (sal_uInt32 nAddr) { sal_uInt32 nCRC32 = 0; @@ -574,16 +567,6 @@ struct PageData /** verify (external representation). */ - storeError verify() const - { - sal_uInt32 nCRC32 = 0; - nCRC32 = rtl_crc32 (nCRC32, &m_aGuard.m_nMagic, sizeof(sal_uInt32)); - nCRC32 = rtl_crc32 (nCRC32, &m_aDescr, theSize - sizeof(G)); - if (m_aGuard.m_nCRC32 != store::htonl(nCRC32)) - return store_E_InvalidChecksum; - else - return store_E_None; - } storeError verify (sal_uInt32 nAddr) const { sal_uInt32 nCRC32 = 0; diff --git a/store/source/storbios.cxx b/store/source/storbios.cxx index 1882c5ab072c..9e01c0489d94 100644 --- a/store/source/storbios.cxx +++ b/store/source/storbios.cxx @@ -173,13 +173,13 @@ struct OStoreSuperBlock /*======================================================================== * - * OStoreSuperBlockPage interface. + * SuperBlockPage interface. * *======================================================================*/ namespace store { -struct OStoreSuperBlockPage +struct SuperBlockPage { typedef OStoreSuperBlock SuperBlock; @@ -216,28 +216,34 @@ struct OStoreSuperBlockPage /** Construction. */ - explicit OStoreSuperBlockPage (sal_uInt16 nPageSize = thePageSize) + explicit SuperBlockPage (sal_uInt16 nPageSize = thePageSize) : m_aSuperOne(nPageSize), m_aSuperTwo(nPageSize) {} - /** guard (external representation). - */ - void guard() - { - m_aSuperOne.guard(); - m_aSuperTwo.guard(); - } - /** save. */ - storeError save (OStorePageBIOS & rBIOS) + storeError save (OStorePageBIOS & rBIOS, sal_uInt32 nSize = theSize) { m_aSuperOne.guard(); m_aSuperTwo = m_aSuperOne; - return rBIOS.write (0, this, theSize); + return rBIOS.write (0, this, nSize); } + /** Page allocation. + */ + storeError unusedHead ( + OStorePageBIOS & rBIOS, + PageData & rPageHead); + + storeError unusedPop ( + OStorePageBIOS & rBIOS, + PageData const & rPageHead); + + storeError unusedPush ( + OStorePageBIOS & rBIOS, + sal_uInt32 nAddr); + /** verify (with repair). */ storeError verify (OStorePageBIOS & rBIOS); @@ -247,27 +253,35 @@ struct OStoreSuperBlockPage /*======================================================================== * - * OStoreSuperBlockPage implementation. + * SuperBlockPage implementation. * *======================================================================*/ -#if 0 /* NEW */ -/** - * alloc page, step 1: get freelist head. +/* + * unusedHead(): get freelist head (alloc page, step 1). */ -storeError SuperBlockPage::unusedHead(OStorePageBIOS & rBIOS, PageData & rPageHead) +storeError SuperBlockPage::unusedHead (OStorePageBIOS & rBIOS, PageData & rPageHead) { - // Check FreeList. + storeError eErrCode = verify (rBIOS); + if (eErrCode != store_E_None) + return eErrCode; + + // Check freelist head. OStorePageLink const aListHead (m_aSuperOne.unusedHead()); - if (aListHead.location() == 0) // @see SuperBlock::ctor() + if (aListHead.location() == 0) { + // Freelist empty, see SuperBlock::ctor(). rPageHead.location (STORE_PAGE_NULL); return store_E_None; } // Load PageHead. eErrCode = rBIOS.read (aListHead.location(), &rPageHead, PageData::theSize); + if (eErrCode != store_E_None) + return eErrCode; eErrCode = rPageHead.verify (aListHead.location()); + if (eErrCode != store_E_None) + return eErrCode; // Verify page is unused. sal_uInt32 const nAddr = rPageHead.m_aUnused.location(); @@ -277,17 +291,17 @@ storeError SuperBlockPage::unusedHead(OStorePageBIOS & rBIOS, PageData & rPageHe // Page in use. rPageHead.location (STORE_PAGE_NULL); - // Recovery: Reset FreeList. + // Recovery: Reset freelist to empty. m_aSuperOne.unusedReset(); - return save (rBIOS); + eErrCode = save (rBIOS); } - return store_E_None; + return eErrCode; } -/** - * alloc page, step 2: pop freelist head. +/* + * unusedPop(): pop freelist head (alloc page, step 2). */ -SuperBlockPage::unusedPop (OStorePageBIOS & rBIOS, PageData const & rPageHead) +storeError SuperBlockPage::unusedPop (OStorePageBIOS & rBIOS, PageData const & rPageHead) { sal_uInt32 const nAddr = rPageHead.m_aUnused.location(); OSL_PRECOND(nAddr != STORE_PAGE_NULL, "store::SuperBlock::unusedPop(): page not free"); @@ -300,9 +314,16 @@ SuperBlockPage::unusedPop (OStorePageBIOS & rBIOS, PageData const & rPageHead) return save (rBIOS); } -storeError OStoreSuperBlockPage::unusedPush (OStorePageBIOS & rBIOS, sal_uInt32 nAddr) +/* + * unusedPush(): push new freelist head. + */ +storeError SuperBlockPage::unusedPush (OStorePageBIOS & rBIOS, sal_uInt32 nAddr) { - PageData aPageHead (PageData::theSize); + storeError eErrCode = verify (rBIOS); + if (eErrCode != store_E_None) + return eErrCode; + + PageData aPageHead; eErrCode = rBIOS.read (nAddr, &aPageHead, PageData::theSize); if (eErrCode != store_E_None) return eErrCode; @@ -322,12 +343,11 @@ storeError OStoreSuperBlockPage::unusedPush (OStorePageBIOS & rBIOS, sal_uInt32 m_aSuperOne.unusedInsert(aListHead); return save (rBIOS); } -#endif /* NEW */ /* * verify (with repair). */ -storeError OStoreSuperBlockPage::verify (OStorePageBIOS &rBIOS) +storeError SuperBlockPage::verify (OStorePageBIOS & rBIOS) { // Verify 1st copy. storeError eErrCode = m_aSuperOne.verify(); @@ -546,58 +566,7 @@ OStorePageBIOS::OStorePageBIOS (void) */ OStorePageBIOS::~OStorePageBIOS (void) { - OStorePageBIOS::close(); -} - -/* - * verify (SuperBlock with repair). - * Internal: Precond: initialized, exclusive access. - */ -storeError OStorePageBIOS::verify (SuperPage *&rpSuper) -{ - // Check SuperBlock page allocation. - if (rpSuper == 0) - { - // Allocate. - if ((rpSuper = new SuperPage()) == 0) - return store_E_OutOfMemory; - - // Load (w/o verification). - storeError eErrCode = read (0, rpSuper, SuperPage::theSize); - if (eErrCode != store_E_None) - { - // Cleanup and fail. - delete rpSuper, rpSuper = 0; - return eErrCode; - } - } - - // Verify SuperBlock page (with repair). - return rpSuper->verify (*this); -} - -/* - * create (SuperBlock). - * Internal: Precond: initialized, exclusive access. - */ -storeError OStorePageBIOS::create (sal_uInt16 nPageSize) -{ - // Check (internal) precond. - OSL_PRECOND(m_xLockBytes.is(), "store::PageBIOS::create(): contract violation"); - - // Check PageSize. - if ((STORE_MINIMUM_PAGESIZE > nPageSize) || (nPageSize > STORE_MAXIMUM_PAGESIZE)) - return store_E_InvalidParameter; - nPageSize = ((nPageSize + STORE_MINIMUM_PAGESIZE - 1) & ~(STORE_MINIMUM_PAGESIZE - 1)); - - // Allocate SuperBlock page. - delete m_pSuper, m_pSuper = 0; - if ((m_pSuper = new(nPageSize) SuperPage(nPageSize)) == 0) - return store_E_OutOfMemory; - m_pSuper->guard(); - - // Create initial page (w/ SuperBlock). - return write (0, m_pSuper, nPageSize); + cleanup_Impl(); } /* @@ -612,26 +581,48 @@ storeError OStorePageBIOS::initialize ( // Acquire exclusive access. osl::MutexGuard aGuard (m_aMutex); - // Check arguments. - storeError eErrCode = store_E_InvalidParameter; - if (!pLockBytes) - return eErrCode; + // Initialize. + storeError eErrCode = initialize_Impl (pLockBytes, eAccessMode, rnPageSize); + if (eErrCode != store_E_None) + { + // Cleanup. + cleanup_Impl(); + } + return eErrCode; +} +/* + * initialize_Impl. + * Internal: Precond: exclusive access. + */ +storeError OStorePageBIOS::initialize_Impl ( + ILockBytes * pLockBytes, + storeAccessMode eAccessMode, + sal_uInt16 & rnPageSize) +{ // Cleanup. -#if 0 /* OLD */ - __STORE_DELETEZ (m_pAcl); /* @@@ */ -#endif /* OLD */ - delete m_pSuper, m_pSuper = 0; + cleanup_Impl(); // Initialize. m_xLockBytes = pLockBytes; - m_bWriteable = (!(eAccessMode == store_AccessReadOnly)); + if (!m_xLockBytes.is()) + return store_E_InvalidParameter; + m_bWriteable = (eAccessMode != store_AccessReadOnly); // Check access mode. + storeError eErrCode = store_E_None; if (eAccessMode != store_AccessCreate) { - // Verify (w/ repair) SuperBlock page. - eErrCode = verify (m_pSuper); + // Load SuperBlock page. + if ((m_pSuper = new SuperBlockPage()) == 0) + return store_E_OutOfMemory; + + eErrCode = read (0, m_pSuper, SuperBlockPage::theSize); + if (eErrCode == store_E_None) + { + // Verify SuperBlock page (with repair). + eErrCode = m_pSuper->verify (*this); + } } else { @@ -656,8 +647,15 @@ storeError OStorePageBIOS::initialize ( if (eAccessMode == store_AccessReadWrite) return store_E_NotExists; - // Create SuperBlock page. - eErrCode = create (rnPageSize); + // Check PageSize. + if ((STORE_MINIMUM_PAGESIZE > rnPageSize) || (rnPageSize > STORE_MAXIMUM_PAGESIZE)) + return store_E_InvalidParameter; + rnPageSize = ((rnPageSize + STORE_MINIMUM_PAGESIZE - 1) & ~(STORE_MINIMUM_PAGESIZE - 1)); + + // Create initial page (w/ SuperBlock). + if ((m_pSuper = new(rnPageSize) SuperBlockPage(rnPageSize)) == 0) + return store_E_OutOfMemory; + eErrCode = m_pSuper->save (*this, rnPageSize); } if (eErrCode == store_E_None) { @@ -675,6 +673,38 @@ storeError OStorePageBIOS::initialize ( return eErrCode; } +/* + * cleanup_Impl. + * Internal: Precond: exclusive access. + */ +void OStorePageBIOS::cleanup_Impl() +{ + // Check referer count. + if (m_ace_head.m_used > 0) + { + // Report remaining referer count. + OSL_TRACE("store::PageBIOS::cleanup_Impl(): referer count: %d\n", m_ace_head.m_used); + for (Ace * ace = m_ace_head.m_next; ace != &m_ace_head; ace = m_ace_head.m_next) + { + m_ace_head.m_used -= ace->m_used; + AceCache::get().destroy (ace); + } + OSL_ENSURE(m_ace_head.m_used == 0, "store::PageBIOS::cleanup_Impl(): logic error"); + } + + // Release SuperBlock page. + delete m_pSuper, m_pSuper = 0; + + // Release PageCache. + m_xCache.clear(); + + // Release PageAllocator. + m_xAllocator.clear(); + + // Release LockBytes. + m_xLockBytes.clear(); +} + /* * read. * Low Level: Precond: initialized, exclusive access. @@ -808,62 +838,26 @@ storeError OStorePageBIOS::allocate ( if (!m_bWriteable) return store_E_AccessViolation; - // Load SuperBlock and require good health. - storeError eErrCode = verify (m_pSuper); - if (eErrCode != store_E_None) - return eErrCode; - - // Check allocation. + // Check allocation type. + storeError eErrCode = store_E_None; if (eAlloc != ALLOCATE_EOF) { - // Check FreeList. - OStorePageLink aListHead (m_pSuper->m_aSuperOne.unusedHead()); - if (aListHead.location()) - { - // Allocate from FreeList. - OStorePageData aPageHead (OStorePageData::theSize); - - // Load PageHead. - eErrCode = peek (aPageHead, aListHead.location()); - if (eErrCode != store_E_None) - return eErrCode; - - // Verify FreeList head. - OSL_PRECOND( - aPageHead.m_aUnused.m_nAddr != STORE_PAGE_NULL, - "OStorePageBIOS::allocate(): page not free"); - if (aPageHead.m_aUnused.location() == STORE_PAGE_NULL) - { - // Recovery: Reset FreeList. - m_pSuper->m_aSuperOne.unusedReset(); - - // Save SuperBlock page. - eErrCode = m_pSuper->save (*this); - - // Recovery: Allocate from EOF. - if (eErrCode == store_E_None) - return allocate (rPage, ALLOCATE_EOF); - else - return store_E_Unknown; - } - - // Pop from FreeList. - aListHead = aPageHead.m_aUnused.location(); - rPage.get()->m_aUnused = STORE_PAGE_NULL; + // Try freelist head. + PageData aPageHead; + eErrCode = m_pSuper->unusedHead (*this, aPageHead); + if (eErrCode != store_E_None) + return eErrCode; - // Save page at PageHead location. - eErrCode = saveObjectAt_Impl (rPage, aPageHead.location()); + sal_uInt32 const nAddr = aPageHead.location(); + if (nAddr != STORE_PAGE_NULL) + { + // Save page. + eErrCode = saveObjectAt_Impl (rPage, nAddr); if (eErrCode != store_E_None) return eErrCode; - // Save SuperBlock page and finish. - m_pSuper->m_aSuperOne.unusedRemove (aListHead); - - eErrCode = m_pSuper->save (*this); - OSL_POSTCOND( - eErrCode == store_E_None, - "OStorePageBIOS::allocate(): SuperBlock save failed"); - return eErrCode; + // Pop freelist head and finish. + return m_pSuper->unusedPop (*this, aPageHead); } } @@ -881,7 +875,7 @@ storeError OStorePageBIOS::allocate ( * free. * Precond: initialized, writeable. */ -storeError OStorePageBIOS::free (OStorePageData & /* rData */, sal_uInt32 nAddr) +storeError OStorePageBIOS::free (sal_uInt32 nAddr) { // Acquire exclusive access. osl::MutexGuard aGuard (m_aMutex); @@ -892,41 +886,11 @@ storeError OStorePageBIOS::free (OStorePageData & /* rData */, sal_uInt32 nAddr) if (!m_bWriteable) return store_E_AccessViolation; - // Load SuperBlock and require good health. - storeError eErrCode = verify (m_pSuper); - if (eErrCode != store_E_None) - return eErrCode; - - // Load PageHead. - OStorePageData aPageHead(OStorePageData::theSize); - eErrCode = peek (aPageHead, nAddr); - if (eErrCode != store_E_None) - return eErrCode; - // Invalidate cache. (void) m_xCache->removePageAt (nAddr); - // Push onto FreeList. - // return m_pSuper->unusedPush (*this, nAddr); // @@@ NEW @@@ - - OStorePageLink aListHead (m_pSuper->m_aSuperOne.unusedHead()); - - aPageHead.m_aUnused.m_nAddr = aListHead.m_nAddr; - aListHead.m_nAddr = aPageHead.m_aDescr.m_nAddr; - - // Save PageHead. - eErrCode = poke (aPageHead, nAddr); - if (eErrCode != store_E_None) - return eErrCode; - - // Save SuperBlock page and finish. - m_pSuper->m_aSuperOne.unusedInsert (aListHead); - - eErrCode = m_pSuper->save (*this); - OSL_POSTCOND( - eErrCode == store_E_None, - "OStorePageBIOS::free(): SuperBlock save failed"); - return eErrCode; + // Push onto freelist. + return m_pSuper->unusedPush (*this, nAddr); } /* @@ -1018,34 +982,13 @@ storeError OStorePageBIOS::saveObjectAt_Impl (OStorePageObject & rPage, sal_uInt * close. * Precond: none. */ -storeError OStorePageBIOS::close (void) +storeError OStorePageBIOS::close() { // Acquire exclusive access. osl::MutexGuard aGuard (m_aMutex); - // Check referer count. - if (m_ace_head.m_used > 0) - { - // Report remaining referer count. - OSL_TRACE("store::PageBIOS::close(): referer count: %d\n", m_ace_head.m_used); -#if 1 /* NEW */ - for (Ace * ace = m_ace_head.m_next; ace != &m_ace_head; ace = m_ace_head.m_next) - { - m_ace_head.m_used -= ace->m_used; - AceCache::get().destroy (ace); - } - OSL_ENSURE(m_ace_head.m_used == 0, "store::PageBIOS::close(): logic error"); -#endif /* NEW */ - } - - // Release SuperBlock page. - delete m_pSuper, m_pSuper = 0; - - // Release PageCache. - m_xCache.clear(); - - // Release LockBytes. - m_xLockBytes.clear(); + // Cleanup. + cleanup_Impl(); // Done. return store_E_None; @@ -1108,7 +1051,7 @@ storeError OStorePageBIOS::scanBegin ( return store_E_InvalidAccess; // Check SuperBlock page. - storeError eErrCode = verify (m_pSuper); + storeError eErrCode = m_pSuper->verify (*this); if (eErrCode != store_E_None) { // Damaged. Determine page size (NYI). @@ -1145,7 +1088,7 @@ storeError OStorePageBIOS::scanNext ( return store_E_InvalidAccess; // Setup PageHead. - OStorePageData aPageHead (OStorePageData::theSize); + PageData aPageHead; // Check context. while (rCtx.isValid()) @@ -1154,11 +1097,15 @@ storeError OStorePageBIOS::scanNext ( sal_uInt32 nAddr = rCtx.m_aDescr.m_nAddr; rCtx.m_aDescr.m_nAddr += rCtx.m_aDescr.m_nSize; - // Load PageHead. - storeError eErrCode = peek (aPageHead, nAddr); + // Read PageHead. + storeError eErrCode = read (nAddr, &aPageHead, PageData::theSize); if (eErrCode != store_E_None) continue; + // Verify PageHead. + eErrCode = aPageHead.verify (nAddr); + continue; + // Check PageHead Magic number. if (aPageHead.m_aGuard.m_nMagic != rCtx.m_nMagic) continue; @@ -1179,31 +1126,3 @@ storeError OStorePageBIOS::scanNext ( // Done. return store_E_CantSeek; } - -/* - * peek (PageHead). - * Internal: Precond: initialized, readable, exclusive access. - */ -storeError OStorePageBIOS::peek (OStorePageData &rData, sal_uInt32 nAddr) -{ - // Read PageHead. - storeError eErrCode = read (nAddr, &rData, OStorePageData::theSize); - if (eErrCode != store_E_None) - return eErrCode; - - // Verify PageHead. - return rData.verify (nAddr); -} - -/* - * poke (PageHead). - * Internal: Precond: initialized, writeable, exclusive access. - */ -storeError OStorePageBIOS::poke (OStorePageData &rData, sal_uInt32 nAddr) -{ - // Guard PageHead. - rData.guard (nAddr); - - // Write PageHead. - return write (nAddr, &rData, OStorePageData::theSize); -} diff --git a/store/source/storbios.hxx b/store/source/storbios.hxx index f6e74ee3e19d..ef95d2f8376e 100644 --- a/store/source/storbios.hxx +++ b/store/source/storbios.hxx @@ -46,7 +46,7 @@ namespace store { -struct OStoreSuperBlockPage; +struct SuperBlockPage; class OStorePageBIOS : public store::OStoreObject { @@ -115,8 +115,7 @@ public: storeError allocate ( OStorePageObject& rPage, Allocation eAllocation = ALLOCATE_FIRST); - storeError free ( - OStorePageData & /* rData */, sal_uInt32 nAddr); + storeError free (sal_uInt32 nAddr); /** Page I/O. */ @@ -182,8 +181,7 @@ private: rtl::Reference<ILockBytes> m_xLockBytes; osl::Mutex m_aMutex; - typedef OStoreSuperBlockPage SuperPage; - SuperPage *m_pSuper; + SuperBlockPage * m_pSuper; bool m_bWriteable; @@ -215,21 +213,16 @@ private: class AceCache; - /** create (SuperBlock). - */ - storeError create (sal_uInt16 nPageSize); - - /** SuperBlock verification and repair. + /** Initialization. */ - storeError verify (SuperPage *&rpSuper); + storeError initialize_Impl ( + ILockBytes * pLockBytes, + storeAccessMode eAccessMode, + sal_uInt16 & rnPageSize); + void cleanup_Impl(); /** Page Maintenance. */ - storeError peek ( - OStorePageData &rData, sal_uInt32 nAddr); - storeError poke ( - OStorePageData &rData, sal_uInt32 nAddr); - storeError loadObjectAt_Impl ( OStorePageObject & rPage, sal_uInt32 nAddr); storeError saveObjectAt_Impl ( diff --git a/store/source/stordata.cxx b/store/source/stordata.cxx index dd0a8f18211f..91d789a2cb0d 100644 --- a/store/source/stordata.cxx +++ b/store/source/stordata.cxx @@ -98,8 +98,7 @@ static storeError store_truncate_Impl ( if (nSingle == 0) { // Free single indirect page. - OStorePageData aPageHead; - eErrCode = rBIOS.free (aPageHead, nAddr); + eErrCode = rBIOS.free (nAddr); if (eErrCode != store_E_None) return eErrCode; } @@ -138,8 +137,7 @@ static storeError store_truncate_Impl ( if ((nDouble + nSingle) == 0) { // Free double indirect page. - OStorePageData aPageHead; - eErrCode = rBIOS.free (aPageHead, nAddr); + eErrCode = rBIOS.free (nAddr); if (eErrCode != store_E_None) return eErrCode; } @@ -174,8 +172,7 @@ static storeError store_truncate_Impl ( if ((nTriple + nDouble + nSingle) == 0) { // Free triple indirect page. - OStorePageData aPageHead; - eErrCode = rBIOS.free (aPageHead, nAddr); + eErrCode = rBIOS.free (nAddr); if (eErrCode != store_E_None) return eErrCode; } @@ -445,8 +442,7 @@ storeError OStoreIndirectionPageObject::truncate ( if (nAddr != STORE_PAGE_NULL) { // Free data page. - OStorePageData aPageHead; - eErrCode = rBIOS.free (aPageHead, nAddr); + eErrCode = rBIOS.free (nAddr); if (eErrCode != store_E_None) return eErrCode; @@ -1063,8 +1059,7 @@ storeError OStoreDirectoryPageObject::truncate ( if (nAddr == STORE_PAGE_NULL) continue; // Free data page. - OStorePageData aPageHead; - eErrCode = rBIOS.free (aPageHead, nAddr); + eErrCode = rBIOS.free (nAddr); if (eErrCode != store_E_None) break; diff --git a/store/source/storpage.cxx b/store/source/storpage.cxx index 126057457c15..992931828080 100644 --- a/store/source/storpage.cxx +++ b/store/source/storpage.cxx @@ -855,8 +855,7 @@ storeError OStorePageManager::remove (const OStorePageKey &rKey) eErrCode = base::releasePage (aDescr, store_AccessReadWrite); // Release and free directory page. - OStorePageData aPageHead; - eErrCode = base::free (aPageHead, aPage.location()); + eErrCode = base::free (aPage.location()); } // Remove entry. diff --git a/store/source/stortree.cxx b/store/source/stortree.cxx index 26f06b887b75..d96216654732 100644 --- a/store/source/stortree.cxx +++ b/store/source/stortree.cxx @@ -273,8 +273,7 @@ storeError OStoreBTreeNodeObject::remove ( if (xPageL->usageCount() == 0) { // Free empty link node. - OStorePageData aPageHead; - eErrCode = rBIOS.free (aPageHead, xPageL->location()); + eErrCode = rBIOS.free (xPageL->location()); if (eErrCode != store_E_None) return eErrCode; @@ -298,7 +297,7 @@ storeError OStoreBTreeNodeObject::remove ( { rPageL.merge (rPageR); - eErrCode = rBIOS.free (aPageHead, rPageR.location()); + eErrCode = rBIOS.free (rPageR.location()); } } } -- cgit From 98e1ea0d79ca2db635662a3aacc6788f8a5c0df1 Mon Sep 17 00:00:00 2001 From: "Matthias Huetsch [mhu]" <matthias.huetsch@sun.com> Date: Wed, 9 Dec 2009 19:34:40 +0100 Subject: #i71568# #i108349# Fixed copyright header. --- store/source/stordata.hxx | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'store') diff --git a/store/source/stordata.hxx b/store/source/stordata.hxx index 4610bac425fd..882ffa1d0109 100644 --- a/store/source/stordata.hxx +++ b/store/source/stordata.hxx @@ -6,9 +6,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: stordata.hxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -29,7 +26,7 @@ ************************************************************************/ #ifndef _STORE_STORDATA_HXX_ -#define _STORE_STORDATA_HXX_ "$Revision: 1.6.8.2 $" +#define _STORE_STORDATA_HXX_ #include "sal/types.h" #include "sal/macros.h" -- cgit From eb4c085971f315ab5168522e80f8095af2778349 Mon Sep 17 00:00:00 2001 From: "Matthias Huetsch [mhu]" <matthias.huetsch@sun.com> Date: Mon, 18 Jan 2010 16:09:06 +0100 Subject: #i108349# Added missing statement (compiler warning). --- store/source/storbios.cxx | 1 + 1 file changed, 1 insertion(+) (limited to 'store') diff --git a/store/source/storbios.cxx b/store/source/storbios.cxx index 9e01c0489d94..955c59f0acc8 100644 --- a/store/source/storbios.cxx +++ b/store/source/storbios.cxx @@ -1104,6 +1104,7 @@ storeError OStorePageBIOS::scanNext ( // Verify PageHead. eErrCode = aPageHead.verify (nAddr); + if (eErrCode != store_E_None) continue; // Check PageHead Magic number. -- cgit From 709ee7e9b098fa7074d84d3faab7aa5cd5ebf73b Mon Sep 17 00:00:00 2001 From: "Matthias Huetsch [mhu]" <matthias.huetsch@sun.com> Date: Thu, 4 Mar 2010 15:19:41 +0100 Subject: mhu22: #i105430# #i108349# Fixed registry:ORegKey reference counting to avoid redundant closeKey()/flush() calls. --- store/source/lockbyte.cxx | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 store/source/lockbyte.cxx (limited to 'store') diff --git a/store/source/lockbyte.cxx b/store/source/lockbyte.cxx old mode 100644 new mode 100755 -- cgit