summaryrefslogtreecommitdiff
path: root/registry
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-07-22 13:31:57 +0200
committerNoel Grandin <noel@peralex.com>2015-07-23 08:41:46 +0200
commit95aad95fbec35c3aab777b176218a29821f79574 (patch)
tree860e5fc0890830b27c391b4492d6b91631ef9850 /registry
parente412e16d56caf426bac04c7e5966e2a9efa7c408 (diff)
inline a handful of use-once #defines
Change-Id: Id2654555c4042f8c0bdbd6bab6507e705f08326b
Diffstat (limited to 'registry')
-rw-r--r--registry/source/keyimpl.cxx32
-rw-r--r--registry/source/regimpl.cxx28
-rw-r--r--registry/source/regimpl.hxx13
3 files changed, 30 insertions, 43 deletions
diff --git a/registry/source/keyimpl.cxx b/registry/source/keyimpl.cxx
index 8336ff90b6b4..75256d4b54af 100644
--- a/registry/source/keyimpl.cxx
+++ b/registry/source/keyimpl.cxx
@@ -225,11 +225,11 @@ RegError ORegKey::getValueInfo(const OUString& valueName, RegValueType* pValueTy
{
OStoreStream rValue;
sal_uInt8* pBuffer;
- storeAccessMode accessMode = VALUE_MODE_OPEN;
+ storeAccessMode accessMode = store_AccessReadWrite;
if (m_pRegistry->isReadOnly())
{
- accessMode = VALUE_MODE_OPENREAD;
+ accessMode = store_AccessReadOnly;
}
OUString sImplValueName( VALUE_PREFIX );
@@ -308,7 +308,7 @@ RegError ORegKey::setValue(const OUString& valueName, RegValueType vType, RegVal
REG_GUARD(m_pRegistry->m_mutex);
- if ( rValue.create(getStoreFile(), m_name + m_pRegistry->ROOT , sImplValueName, VALUE_MODE_CREATE) )
+ if ( rValue.create(getStoreFile(), m_name + m_pRegistry->ROOT , sImplValueName, store_AccessCreate) )
{
return RegError::SET_VALUE_FAILED;
}
@@ -378,7 +378,7 @@ RegError ORegKey::setLongListValue(const OUString& valueName, sal_Int32* pValueL
REG_GUARD(m_pRegistry->m_mutex);
- if (rValue.create(getStoreFile(), m_name + m_pRegistry->ROOT, sImplValueName, VALUE_MODE_CREATE) )
+ if (rValue.create(getStoreFile(), m_name + m_pRegistry->ROOT, sImplValueName, store_AccessCreate) )
{
return RegError::SET_VALUE_FAILED;
}
@@ -437,7 +437,7 @@ RegError ORegKey::setStringListValue(const OUString& valueName, sal_Char** pValu
REG_GUARD(m_pRegistry->m_mutex);
- if (rValue.create(getStoreFile(), m_name + m_pRegistry->ROOT, sImplValueName, VALUE_MODE_CREATE) )
+ if (rValue.create(getStoreFile(), m_name + m_pRegistry->ROOT, sImplValueName, store_AccessCreate) )
{
return RegError::SET_VALUE_FAILED;
}
@@ -505,7 +505,7 @@ RegError ORegKey::setUnicodeListValue(const OUString& valueName, sal_Unicode** p
REG_GUARD(m_pRegistry->m_mutex);
- if (rValue.create(getStoreFile(), m_name + m_pRegistry->ROOT, sImplValueName, VALUE_MODE_CREATE) )
+ if (rValue.create(getStoreFile(), m_name + m_pRegistry->ROOT, sImplValueName, store_AccessCreate) )
{
return RegError::SET_VALUE_FAILED;
}
@@ -564,11 +564,11 @@ RegError ORegKey::getValue(const OUString& valueName, RegValue value) const
sal_uInt8* pBuffer;
RegValueType valueType;
sal_uInt32 valueSize;
- storeAccessMode accessMode = VALUE_MODE_OPEN;
+ storeAccessMode accessMode = store_AccessReadWrite;
if (m_pRegistry->isReadOnly())
{
- accessMode = VALUE_MODE_OPENREAD;
+ accessMode = store_AccessReadOnly;
}
OUString sImplValueName( VALUE_PREFIX );
@@ -658,11 +658,11 @@ RegError ORegKey::getLongListValue(const OUString& valueName, sal_Int32** pValue
sal_uInt8* pBuffer;
RegValueType valueType;
sal_uInt32 valueSize;
- storeAccessMode accessMode = VALUE_MODE_OPEN;
+ storeAccessMode accessMode = store_AccessReadWrite;
if (m_pRegistry->isReadOnly())
{
- accessMode = VALUE_MODE_OPENREAD;
+ accessMode = store_AccessReadOnly;
}
OUString sImplValueName( VALUE_PREFIX );
@@ -772,11 +772,11 @@ RegError ORegKey::getStringListValue(const OUString& valueName, sal_Char*** pVal
sal_uInt8* pBuffer;
RegValueType valueType;
sal_uInt32 valueSize;
- storeAccessMode accessMode = VALUE_MODE_OPEN;
+ storeAccessMode accessMode = store_AccessReadWrite;
if (m_pRegistry->isReadOnly())
{
- accessMode = VALUE_MODE_OPENREAD;
+ accessMode = store_AccessReadOnly;
}
OUString sImplValueName( VALUE_PREFIX );
@@ -878,11 +878,11 @@ RegError ORegKey::getUnicodeListValue(const OUString& valueName, sal_Unicode***
sal_uInt8* pBuffer;
RegValueType valueType;
sal_uInt32 valueSize;
- storeAccessMode accessMode = VALUE_MODE_OPEN;
+ storeAccessMode accessMode = store_AccessReadWrite;
if (m_pRegistry->isReadOnly())
{
- accessMode = VALUE_MODE_OPENREAD;
+ accessMode = store_AccessReadOnly;
}
OUString sImplValueName( VALUE_PREFIX );
@@ -1016,7 +1016,7 @@ OStoreDirectory ORegKey::getStoreDir()
OStoreDirectory rStoreDir;
OUString fullPath;
OUString relativName;
- storeAccessMode accessMode = KEY_MODE_OPEN;
+ storeAccessMode accessMode = store_AccessReadWrite;
if ( m_name.equals(m_pRegistry->ROOT) )
{
@@ -1030,7 +1030,7 @@ OStoreDirectory ORegKey::getStoreDir()
if (m_pRegistry->isReadOnly())
{
- accessMode = KEY_MODE_OPENREAD;
+ accessMode = store_AccessReadOnly;
}
rStoreDir.create(getStoreFile(), fullPath, relativName, accessMode);
diff --git a/registry/source/regimpl.cxx b/registry/source/regimpl.cxx
index d31458af72bb..3499a5a83167 100644
--- a/registry/source/regimpl.cxx
+++ b/registry/source/regimpl.cxx
@@ -456,16 +456,16 @@ RegError ORegistry::initRegistry(const OUString& regName, RegAccessMode accessMo
{
RegError eRet = RegError::INVALID_REGISTRY;
OStoreFile rRegFile;
- storeAccessMode sAccessMode = REG_MODE_OPEN;
+ storeAccessMode sAccessMode = store_AccessReadWrite;
storeError errCode;
if (bCreate)
{
- sAccessMode = REG_MODE_CREATE;
+ sAccessMode = store_AccessCreate;
}
else if (accessMode & RegAccessMode::READONLY)
{
- sAccessMode = REG_MODE_OPENREAD;
+ sAccessMode = store_AccessReadOnly;
m_readOnly = true;
}
@@ -673,7 +673,7 @@ RegError ORegistry::createKey(RegKeyHandle hKey, const OUString& keyName,
token = sFullKeyName.getToken( 0, '/', nIndex );
if (!token.isEmpty())
{
- if (rStoreDir.create(pKey->getStoreFile(), sFullPath.getStr(), token, KEY_MODE_CREATE))
+ if (rStoreDir.create(pKey->getStoreFile(), sFullPath.getStr(), token, store_AccessCreate))
{
return RegError::CREATE_KEY_FAILED;
}
@@ -720,7 +720,7 @@ RegError ORegistry::openKey(RegKeyHandle hKey, const OUString& keyName,
sal_Int32 n = path.lastIndexOf('/') + 1;
switch (OStoreDirectory().create(
pKey->getStoreFile(), path.copy(0, n), path.copy(n),
- isReadOnly() ? KEY_MODE_OPENREAD : KEY_MODE_OPEN))
+ isReadOnly() ? store_AccessReadOnly : store_AccessReadWrite))
{
case store_E_NotExists:
return RegError::KEY_NOT_EXISTS;
@@ -1010,13 +1010,13 @@ RegError ORegistry::loadAndSaveValue(ORegKey* pTargetKey,
RegValueType valueType;
sal_uInt32 valueSize;
sal_uInt32 nSize;
- storeAccessMode sourceAccess = VALUE_MODE_OPEN;
+ storeAccessMode sourceAccess = store_AccessReadWrite;
OUString sTargetPath(pTargetKey->getName());
OUString sSourcePath(pSourceKey->getName());
if (pSourceKey->isReadOnly())
{
- sourceAccess = VALUE_MODE_OPENREAD;
+ sourceAccess = store_AccessReadOnly;
}
if (nCut)
@@ -1076,7 +1076,7 @@ RegError ORegistry::loadAndSaveValue(ORegKey* pTargetKey,
OStoreFile rTargetFile(pTargetKey->getStoreFile());
- if (!rValue.create(rTargetFile, sTargetPath, valueName, VALUE_MODE_OPEN))
+ if (!rValue.create(rTargetFile, sTargetPath, valueName, store_AccessReadWrite))
{
if (valueType == RegValueType::BINARY)
{
@@ -1100,7 +1100,7 @@ RegError ORegistry::loadAndSaveValue(ORegKey* pTargetKey,
}
// write
- if (rValue.create(rTargetFile, sTargetPath, valueName, VALUE_MODE_CREATE))
+ if (rValue.create(rTargetFile, sTargetPath, valueName, store_AccessCreate))
{
rtl_freeMemory(pBuffer);
return RegError::INVALID_VALUE;
@@ -1352,7 +1352,7 @@ RegError ORegistry::loadAndSaveKeys(ORegKey* pTargetKey,
sFullKeyName += keyName;
OStoreDirectory rStoreDir;
- if (rStoreDir.create(pTargetKey->getStoreFile(), sFullPath, keyName, KEY_MODE_CREATE))
+ if (rStoreDir.create(pTargetKey->getStoreFile(), sFullPath, keyName, store_AccessCreate))
{
return RegError::CREATE_KEY_FAILED;
}
@@ -1458,11 +1458,11 @@ RegError ORegistry::dumpValue(const OUString& sPath, const OUString& sName, sal_
RegValueType valueType;
OUString sFullPath(sPath);
OString sIndent;
- storeAccessMode accessMode = VALUE_MODE_OPEN;
+ storeAccessMode accessMode = store_AccessReadWrite;
if (isReadOnly())
{
- accessMode = VALUE_MODE_OPENREAD;
+ accessMode = store_AccessReadOnly;
}
for (int i= 0; i < nSpc; i++) sIndent += " ";
@@ -1694,12 +1694,12 @@ RegError ORegistry::dumpKey(const OUString& sPath, const OUString& sName, sal_In
OStoreDirectory rStoreDir;
OUString sFullPath(sPath);
OString sIndent;
- storeAccessMode accessMode = KEY_MODE_OPEN;
+ storeAccessMode accessMode = store_AccessReadWrite;
RegError _ret = RegError::NO_ERROR;
if (isReadOnly())
{
- accessMode = KEY_MODE_OPENREAD;
+ accessMode = store_AccessReadOnly;
}
for (int i= 0; i < nSpace; i++) sIndent += " ";
diff --git a/registry/source/regimpl.hxx b/registry/source/regimpl.hxx
index 70d4a78cad74..eb1d8e099aff 100644
--- a/registry/source/regimpl.hxx
+++ b/registry/source/regimpl.hxx
@@ -30,19 +30,6 @@
#define REG_PAGESIZE 512
-#define REG_MODE_CREATE store_AccessCreate
-#define REG_MODE_OPEN store_AccessReadWrite
-#define REG_MODE_OPENREAD store_AccessReadOnly
-
-#define KEY_MODE_CREATE store_AccessCreate
-#define KEY_MODE_OPEN store_AccessReadWrite
-#define KEY_MODE_OPENREAD store_AccessReadOnly
-
-
-#define VALUE_MODE_CREATE store_AccessCreate
-#define VALUE_MODE_OPEN store_AccessReadWrite
-#define VALUE_MODE_OPENREAD store_AccessReadOnly
-
// 5 bytes = 1 (byte for the type) + 4 (bytes for the size of the data)
#define VALUE_HEADERSIZE 5
#define VALUE_TYPEOFFSET 1