summaryrefslogtreecommitdiff
path: root/store
diff options
context:
space:
mode:
authorMatthias Huetsch <mhu@openoffice.org>2001-08-09 15:14:51 +0000
committerMatthias Huetsch <mhu@openoffice.org>2001-08-09 15:14:51 +0000
commit60580f457ae2718547da22a79d7a58560332bf92 (patch)
tree9a96fd6589a7f018deada4cca860ff616521ae29 /store
parentaf5f691aa125c3a0b7fb590d988988b15e9c31d5 (diff)
#90643# Fixed 'OFileLockBytes_Impl::create()' to turn off memory mapped
write access for remote volumes.
Diffstat (limited to 'store')
-rw-r--r--store/source/filelckb.cxx68
1 files changed, 30 insertions, 38 deletions
diff --git a/store/source/filelckb.cxx b/store/source/filelckb.cxx
index 104c9c6bb8f5..093bcee88d69 100644
--- a/store/source/filelckb.cxx
+++ b/store/source/filelckb.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: filelckb.cxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: hro $ $Date: 2001-05-10 14:53:27 $
+ * last change: $Author: mhu $ $Date: 2001-08-09 16:14:51 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -59,7 +59,7 @@
*
************************************************************************/
-#define _STORE_FILELCKB_CXX_ "$Revision: 1.7 $"
+#define _STORE_FILELCKB_CXX_ "$Revision: 1.8 $"
#ifndef _SAL_TYPES_H_
#include <sal/types.h>
@@ -72,8 +72,8 @@
#include <rtl/ustring.hxx>
#endif
-#ifndef _OSL_FILE_H_
-#include <osl/file.h>
+#ifndef _OSL_FILE_HXX_
+#include <osl/file.hxx>
#endif
#ifndef _OSL_MUTEX_HXX_
#include <osl/mutex.hxx>
@@ -509,56 +509,48 @@ inline storeError OFileLockBytes_Impl::create (
// Path conversion result.
oslFileError result;
-#if 0
- // Convert into normalized path.
- rtl::OUString aNormPath;
- result = osl_getNormalizedPathFromFileURL (
- pFilename, &(aNormPath.pData));
+ // Convert into system path.
+ rtl::OUString aSystemPath;
+ result = osl_getSystemPathFromFileURL (pFilename, &(aSystemPath.pData));
if (!(result == osl_File_E_None))
{
- // Not FileUrl. Maybe System or already Normalized.
- result = osl_normalizePath (pFilename, &(aNormPath.pData));
+ // Not FileUrl. Maybe a system path, already.
+ result = osl_getFileURLFromSystemPath (
+ pFilename, &(aSystemPath.pData));
if (!(result == osl_File_E_None))
{
// Invalid path.
return store_E_InvalidParameter;
}
- }
- // Convert into system path.
- rtl::OUString aSystemPath;
- result = osl_getSystemPathFromNormalizedPath (
- aNormPath.pData, &(aSystemPath.pData));
- if (!(result == osl_File_E_None))
- {
- // Invalid path.
- return store_E_InvalidParameter;
+ rtl_uString_assign (&(aSystemPath.pData), pFilename);
}
-#else
- rtl::OUString aSystemPath;
-
- result = osl_getSystemPathFromFileURL( pFilename, &(aSystemPath.pData) );
- // Maybe it's alreadey a system path
-
- if ( osl_File_E_None != result )
+ // Check access mode for memory mapped I/O.
+ if (m_bMemmap && (!(eAccessMode == store_AccessReadOnly)))
{
- rtl::OUString aTempURL;
+ // Memory mapped write access. Obtain FileUrl.
+ rtl::OUString aFileUrl;
+ osl_getFileURLFromSystemPath (aSystemPath.pData, &(aFileUrl.pData));
- result = osl_getFileURLFromSystemPath( pFilename, &(aTempURL.pData) );
+ // Obtain directory.
+ sal_Int32 k = aFileUrl.lastIndexOf (sal_Unicode('/'));
+ if (k > 0)
+ {
+ // Cut off last segment.
+ aFileUrl = aFileUrl.copy (0, k);
+ }
- if (!(result == osl_File_E_None))
+ // Obtain volume attributes.
+ osl::VolumeInfo aInfo (VolumeInfoMask_Attributes);
+ osl::Directory::getVolumeInfo (aFileUrl, aInfo);
+ if (aInfo.isValid (VolumeInfoMask_Attributes) && aInfo.getRemoteFlag())
{
- // Invalid path.
- return store_E_InvalidParameter;
+ // Remote volume. Turn off memory mapped write access.
+ m_bMemmap = sal_False;
}
- else
- aSystemPath = pFilename;
}
-#endif
-
-
// Convert into system text encoding.
rtl::OString aFilename (
aSystemPath.pData->buffer,