summaryrefslogtreecommitdiff
path: root/store
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2016-09-19 10:50:47 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2016-09-19 12:47:14 +0200
commite58324aaca6875dbfe7c6c8333d747d2bfd9d089 (patch)
treecd52172673e74c3ff38a0be60107eaaa6ad66d32 /store
parent99e95346ac33f2d04536ab6c268936ab8b822b42 (diff)
convert storeAccessMode to scoped enum
Change-Id: I67705cdff0440487019a2992571147d648be1bfc
Diffstat (limited to 'store')
-rw-r--r--store/source/lockbyte.cxx12
-rw-r--r--store/source/storbios.cxx12
-rw-r--r--store/source/stordir.cxx2
-rw-r--r--store/source/store.cxx2
-rw-r--r--store/source/storlckb.cxx10
-rw-r--r--store/source/storpage.cxx6
6 files changed, 22 insertions, 22 deletions
diff --git a/store/source/lockbyte.cxx b/store/source/lockbyte.cxx
index 1251de2b0b6d..73ad47fc9fbd 100644
--- a/store/source/lockbyte.cxx
+++ b/store/source/lockbyte.cxx
@@ -197,14 +197,14 @@ struct FileHandle
sal_uInt32 nFlags = 0;
switch (eAccessMode)
{
- case store_AccessCreate:
- case store_AccessReadCreate:
+ case storeAccessMode::Create:
+ case storeAccessMode::ReadCreate:
nFlags |= osl_File_OpenFlag_Create;
SAL_FALLTHROUGH;
- case store_AccessReadWrite:
+ case storeAccessMode::ReadWrite:
nFlags |= osl_File_OpenFlag_Write;
SAL_FALLTHROUGH;
- case store_AccessReadOnly:
+ case storeAccessMode::ReadOnly:
nFlags |= osl_File_OpenFlag_Read;
break;
default:
@@ -243,7 +243,7 @@ struct FileHandle
{
// Already existing (O_CREAT | O_EXCL).
result = osl_openFile (aFileUrl.pData, &m_handle, osl_File_OpenFlag_Read | osl_File_OpenFlag_Write);
- if ((result == osl_File_E_None) && (eAccessMode == store_AccessCreate))
+ if ((result == osl_File_E_None) && (eAccessMode == storeAccessMode::Create))
{
// Truncate existing file.
result = osl_setFileSize (m_handle, 0);
@@ -853,7 +853,7 @@ FileLockBytes_createInstance (
if (result != store_E_None)
return result;
- if (eAccessMode == store_AccessReadOnly)
+ if (eAccessMode == storeAccessMode::ReadOnly)
{
ResourceHolder<FileMapping> xMapping;
if (xMapping.get().initialize (xFile.get().m_handle) == osl_File_E_None)
diff --git a/store/source/storbios.cxx b/store/source/storbios.cxx
index ae6c0ae96d8a..00648ce170e3 100644
--- a/store/source/storbios.cxx
+++ b/store/source/storbios.cxx
@@ -584,11 +584,11 @@ storeError OStorePageBIOS::initialize_Impl (
m_xLockBytes = pLockBytes;
if (!m_xLockBytes.is())
return store_E_InvalidParameter;
- m_bWriteable = (eAccessMode != store_AccessReadOnly);
+ m_bWriteable = (eAccessMode != storeAccessMode::ReadOnly);
// Check access mode.
storeError eErrCode = store_E_None;
- if (eAccessMode != store_AccessCreate)
+ if (eAccessMode != storeAccessMode::Create)
{
// Load SuperBlock page.
if ((m_pSuper = new SuperBlockPage()) == nullptr)
@@ -619,9 +619,9 @@ storeError OStorePageBIOS::initialize_Impl (
return eErrCode;
// Check mode.
- if (eAccessMode == store_AccessReadOnly)
+ if (eAccessMode == storeAccessMode::ReadOnly)
return store_E_NotExists;
- if (eAccessMode == store_AccessReadWrite)
+ if (eAccessMode == storeAccessMode::ReadWrite)
return store_E_NotExists;
// Check PageSize.
@@ -730,7 +730,7 @@ storeError OStorePageBIOS::acquirePage (
return store_E_InvalidAccess;
// Check access mode.
- if (!(m_bWriteable || (eMode == store_AccessReadOnly)))
+ if (!(m_bWriteable || (eMode == storeAccessMode::ReadOnly)))
return store_E_AccessViolation;
// Find access control list entry.
@@ -738,7 +738,7 @@ storeError OStorePageBIOS::acquirePage (
if (ace->m_addr == rDescr.m_nAddr)
{
// Acquire existing entry (with ShareDenyWrite).
- if (eMode == store_AccessReadOnly)
+ if (eMode == storeAccessMode::ReadOnly)
ace->m_used += 1;
else
return store_E_AccessViolation;
diff --git a/store/source/stordir.cxx b/store/source/stordir.cxx
index aa34f91d1a00..399af1d90d42 100644
--- a/store/source/stordir.cxx
+++ b/store/source/stordir.cxx
@@ -123,7 +123,7 @@ storeError OStoreDirectory_Impl::create (
return store_E_NotDirectory;
inode_holder_type xNode (aPage.get());
- eErrCode = xManager->acquirePage (xNode->m_aDescr, store_AccessReadOnly);
+ eErrCode = xManager->acquirePage (xNode->m_aDescr, storeAccessMode::ReadOnly);
if (eErrCode != store_E_None)
return eErrCode;
diff --git a/store/source/store.cxx b/store/source/store.cxx
index bdb2468540d4..7c06aee6f91e 100644
--- a/store/source/store.cxx
+++ b/store/source/store.cxx
@@ -120,7 +120,7 @@ storeError SAL_CALL store_createMemoryFile (
return store_E_OutOfMemory;
eErrCode = xManager->initialize (
- &*xLockBytes, store_AccessCreate, nPageSize);
+ &*xLockBytes, storeAccessMode::Create, nPageSize);
if (eErrCode != store_E_None)
return eErrCode;
diff --git a/store/source/storlckb.cxx b/store/source/storlckb.cxx
index 0e74ab931974..eacfc8b140b7 100644
--- a/store/source/storlckb.cxx
+++ b/store/source/storlckb.cxx
@@ -101,19 +101,19 @@ storeError OStoreLockBytes::create (
}
inode_holder_type xNode (aPage.get());
- if (eMode != store_AccessReadOnly)
- eErrCode = xManager->acquirePage (xNode->m_aDescr, store_AccessReadWrite);
+ if (eMode != storeAccessMode::ReadOnly)
+ eErrCode = xManager->acquirePage (xNode->m_aDescr, storeAccessMode::ReadWrite);
else
- eErrCode = xManager->acquirePage (xNode->m_aDescr, store_AccessReadOnly);
+ eErrCode = xManager->acquirePage (xNode->m_aDescr, storeAccessMode::ReadOnly);
if (eErrCode != store_E_None)
return eErrCode;
m_xManager = xManager;
m_xNode = xNode;
- m_bWriteable = (eMode != store_AccessReadOnly);
+ m_bWriteable = (eMode != storeAccessMode::ReadOnly);
// Check for truncation.
- if (eMode == store_AccessCreate)
+ if (eMode == storeAccessMode::Create)
{
// Truncate to zero length.
eErrCode = setSize(0);
diff --git a/store/source/storpage.cxx b/store/source/storpage.cxx
index 0f559b4be3fd..3d10ec04e4fc 100644
--- a/store/source/storpage.cxx
+++ b/store/source/storpage.cxx
@@ -280,9 +280,9 @@ storeError OStorePageManager::iget (
if (eErrCode != store_E_NotExists)
return eErrCode;
- if (eMode == store_AccessReadWrite)
+ if (eMode == storeAccessMode::ReadWrite)
return store_E_NotExists;
- if (eMode == store_AccessReadOnly)
+ if (eMode == storeAccessMode::ReadOnly)
return store_E_NotExists;
if (!base::isWriteable())
@@ -477,7 +477,7 @@ storeError OStorePageManager::remove (const OStorePageKey &rKey)
// Acquire page write access.
OStorePageDescriptor aDescr (xNode->m_aDescr);
- eErrCode = base::acquirePage (aDescr, store_AccessReadWrite);
+ eErrCode = base::acquirePage (aDescr, storeAccessMode::ReadWrite);
if (eErrCode != store_E_None)
return eErrCode;