diff options
author | Release Engineers <releng@openoffice.org> | 2009-03-20 15:07:51 +0000 |
---|---|---|
committer | Release Engineers <releng@openoffice.org> | 2009-03-20 15:07:51 +0000 |
commit | a24a0885d9e2f4c2fd5fec1f92c5b21fcfbfecfd (patch) | |
tree | eed1800fe5d1acc7c85a5a4f718fc16d631e0011 /store | |
parent | 31ad95e48a9b0c088c7b9b0941724ac340be57c7 (diff) |
#i10000# additional files for mhu17
Diffstat (limited to 'store')
-rw-r--r-- | store/source/lockbyte.cxx | 12 | ||||
-rw-r--r-- | store/source/storbase.hxx | 2 | ||||
-rw-r--r-- | store/source/stordata.hxx | 4 | ||||
-rw-r--r-- | store/source/storlckb.cxx | 6 | ||||
-rw-r--r-- | store/source/stortree.cxx | 4 | ||||
-rw-r--r-- | store/workben/t_file.cxx | 25 | ||||
-rw-r--r-- | store/workben/t_page.cxx | 4 |
7 files changed, 46 insertions, 11 deletions
diff --git a/store/source/lockbyte.cxx b/store/source/lockbyte.cxx index ef97f1295..a38aa7689 100644 --- a/store/source/lockbyte.cxx +++ b/store/source/lockbyte.cxx @@ -41,6 +41,7 @@ #include "sal/types.h" #include "osl/diagnose.h" #include "osl/file.h" +#include "osl/process.h" #include "rtl/alloc.h" #include "rtl/ustring.hxx" @@ -278,9 +279,18 @@ struct FileHandle rtl::OUString aFileUrl; if (osl_getFileURLFromSystemPath (pFilename, &(aFileUrl.pData)) != osl_File_E_None) { - // Not system path. Maybe a file url, already. + // Not system path. Assume file url. rtl_uString_assign (&(aFileUrl.pData), pFilename); } + if (aFileUrl.compareToAscii("file://", 7) != 0) + { + // Not file url. Assume relative path. + rtl::OUString aCwdUrl; + (void) osl_getProcessWorkingDir (&(aCwdUrl.pData)); + + // Absolute file url. + (void) osl_getAbsoluteFileURL (aCwdUrl.pData, aFileUrl.pData, &(aFileUrl.pData)); + } // Acquire handle. oslFileError result = osl_openFile (aFileUrl.pData, &m_handle, nFlags); diff --git a/store/source/storbase.hxx b/store/source/storbase.hxx index cdb0a92c8..4a7851ff2 100644 --- a/store/source/storbase.hxx +++ b/store/source/storbase.hxx @@ -910,7 +910,7 @@ protected: public: template< class U > - PageHolderObject<U> get() const + PageHolderObject<U> makeHolder() const { return PageHolderObject<U>(m_xPage); } diff --git a/store/source/stordata.hxx b/store/source/stordata.hxx index 1da120734..b86287b06 100644 --- a/store/source/stordata.hxx +++ b/store/source/stordata.hxx @@ -836,13 +836,13 @@ private: */ page & PAGE() { - page * pImpl = reinterpret_cast<page*>(m_xPage.get()); + page * pImpl = static_cast<page*>(m_xPage.get()); OSL_PRECOND(pImpl != 0, "OStoreDirectoryPageObject::PAGE(): Null pointer"); return (*pImpl); } page const & PAGE() const { - page const * pImpl = reinterpret_cast<page const *>(m_xPage.get()); + page const * pImpl = static_cast<page const *>(m_xPage.get()); OSL_PRECOND(pImpl != 0, "OStoreDirectoryPageObject::PAGE(): Null pointer"); return (*pImpl); } diff --git a/store/source/storlckb.cxx b/store/source/storlckb.cxx index 794e9da12..61750643c 100644 --- a/store/source/storlckb.cxx +++ b/store/source/storlckb.cxx @@ -221,7 +221,7 @@ storeError OStoreLockBytes::readAt ( } else { - PageHolderObject< data > xData (aData.get<data>()); + PageHolderObject< data > xData (aData.makeHolder<data>()); memcpy ( &pData[rnDone], &xData->m_pData[aDescr.m_nOffset], @@ -322,13 +322,13 @@ storeError OStoreLockBytes::writeAt ( } } - PageHolderObject< data > xData (aData.get<data>()); + PageHolderObject< data > xData (aData.makeHolder<data>()); if (!xData.is()) { eErrCode = aData.construct<data>(m_xManager->allocator()); if (eErrCode != store_E_None) return eErrCode; - xData = aData.get<data>(); + xData = aData.makeHolder<data>(); } // Modify data page. diff --git a/store/source/stortree.cxx b/store/source/stortree.cxx index c639bf294..648aaf7a1 100644 --- a/store/source/stortree.cxx +++ b/store/source/stortree.cxx @@ -538,7 +538,7 @@ storeError OStoreBTreeRootObject::find_lookup ( // Check current page. PageHolderObject< page > xPage (rNode.get()); - for (; xPage->depth() > 0; xPage = rNode.get< page >()) + for (; xPage->depth() > 0; xPage = rNode.makeHolder< page >()) { // Find next page. page const & rPage = (*xPage); @@ -621,7 +621,7 @@ storeError OStoreBTreeRootObject::find_insert ( // Check current Page. PageHolderObject< page > xPage (rNode.get()); - for (; xPage->depth() > 0; xPage = rNode.get< page >()) + for (; xPage->depth() > 0; xPage = rNode.makeHolder< page >()) { // Find next page. page const & rPage = (*xPage); diff --git a/store/workben/t_file.cxx b/store/workben/t_file.cxx index 2090181a4..b70654040 100644 --- a/store/workben/t_file.cxx +++ b/store/workben/t_file.cxx @@ -42,6 +42,9 @@ #define INCLUDED_STDIO_H #endif +#include "osl/file.h" +#include "osl/process.h" + using namespace store; #define TEST_PAGESIZE 16384 @@ -62,6 +65,28 @@ int SAL_CALL main (int argc, char **argv) argv[1], rtl_str_getLength(argv[1]), osl_getThreadTextEncoding()); +#if 0 /* EXP */ + oslFileError result; + rtl::OUString aPath; + + result = osl_getFileURLFromSystemPath(aFilename.pData, &(aPath.pData)); + if (result != osl_File_E_None) + { + // not SystemPath, assume FileUrl. + aPath = aFilename; + } + if (rtl_ustr_ascii_shortenedCompare_WithLength(aPath.pData->buffer, aPath.pData->length, "file://", 7) != 0) + { + // not FileUrl, assume relative path. + rtl::OUString aBase; + (void) osl_getProcessWorkingDir (&(aBase.pData)); + + // absolute FileUrl. + (void) osl_getAbsoluteFileURL(aBase.pData, aPath.pData, &(aPath.pData)); + } + aFilename = aPath; +#endif /* EXP */ + eErrCode = FileLockBytes_createInstance ( xLockBytes, aFilename.pData, store_AccessReadWrite); if (eErrCode != store_E_None) diff --git a/store/workben/t_page.cxx b/store/workben/t_page.cxx index b488e1ac9..a0645f00b 100644 --- a/store/workben/t_page.cxx +++ b/store/workben/t_page.cxx @@ -17,7 +17,7 @@ * *======================================================================*/ -template< class T > inline void swap (T & lhs, T & rhs) +template< class T > void swap (T & lhs, T & rhs) { T tmp = rhs; rhs = lhs; lhs = tmp; } @@ -694,7 +694,7 @@ public: { TestObject aObj; - rBIOS.loadPageAt(aObj.get(), &aObj.verify); + rBIOS.loadPageAt(aObj.get(), aObj.verify); rBIOS.loadPageAt(aObj.get(), TestObject::verify); rBIOS.loadPageAt(aObj.get(), PageHolderObject<TestData>::verify); |