diff options
author | Noel Grandin <noel@peralex.com> | 2015-04-08 14:04:08 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-04-09 08:41:11 +0200 |
commit | 7b4ca582fcfd77b20eea5a11bd0e87b39d640e91 (patch) | |
tree | 3065c665ba7250d47bc41e4e46ec453192ab0fd0 /registry | |
parent | 95600edeaf48a80a1e84c44b37f4035bc4db3070 (diff) |
convert RegError to scoped enum
Change-Id: I55977c38578cb59deb195d91f8948da2e0905b6a
Diffstat (limited to 'registry')
-rw-r--r-- | registry/source/keyimpl.cxx | 128 | ||||
-rw-r--r-- | registry/source/regimpl.cxx | 176 | ||||
-rw-r--r-- | registry/source/registry.cxx | 110 | ||||
-rw-r--r-- | registry/source/regkey.cxx | 180 | ||||
-rw-r--r-- | registry/tools/regcompare.cxx | 36 | ||||
-rw-r--r-- | registry/tools/regmerge.cxx | 12 | ||||
-rw-r--r-- | registry/tools/regview.cxx | 16 |
7 files changed, 329 insertions, 329 deletions
diff --git a/registry/source/keyimpl.cxx b/registry/source/keyimpl.cxx index 1dcb797867b5..2df14b5454c5 100644 --- a/registry/source/keyimpl.cxx +++ b/registry/source/keyimpl.cxx @@ -82,7 +82,7 @@ RegError ORegKey::openKey(const OUString& keyName, RegKeyHandle* phOpenKey) RegError ORegKey::openSubKeys(const OUString& keyName, RegKeyHandle** phOpenSubKeys, sal_uInt32* pnSubKeys) { - RegError _ret = REG_NO_ERROR; + RegError _ret = RegError::NO_ERROR; *phOpenSubKeys = 0; *pnSubKeys = 0; @@ -91,7 +91,7 @@ RegError ORegKey::openSubKeys(const OUString& keyName, RegKeyHandle** phOpenSubK if ( !keyName.isEmpty() ) { _ret = openKey(keyName, reinterpret_cast<RegKeyHandle*>(&pKey)); - if (_ret != REG_NO_ERROR) + if (_ret != RegError::NO_ERROR) return _ret; } @@ -114,7 +114,7 @@ RegError ORegKey::openSubKeys(const OUString& keyName, RegKeyHandle** phOpenSubK ORegKey* pOpenSubKey = 0; _ret = pKey->openKey(sSubKeyName, reinterpret_cast<RegKeyHandle*>(&pOpenSubKey)); - if (_ret != REG_NO_ERROR) + if (_ret != RegError::NO_ERROR) { *phOpenSubKeys = NULL; *pnSubKeys = 0; @@ -135,7 +135,7 @@ RegError ORegKey::openSubKeys(const OUString& keyName, RegKeyHandle** phOpenSubK { (void) releaseKey(pKey); } - return REG_NO_ERROR; + return RegError::NO_ERROR; } @@ -146,7 +146,7 @@ RegError ORegKey::getKeyNames(const OUString& keyName, rtl_uString*** pSubKeyNames, sal_uInt32* pnSubKeys) { - RegError _ret = REG_NO_ERROR; + RegError _ret = RegError::NO_ERROR; *pSubKeyNames = 0; *pnSubKeys = 0; @@ -155,7 +155,7 @@ RegError ORegKey::getKeyNames(const OUString& keyName, if (!keyName.isEmpty()) { _ret = openKey(keyName, reinterpret_cast<RegKeyHandle*>(&pKey)); - if (_ret != REG_NO_ERROR) + if (_ret != RegError::NO_ERROR) return _ret; } @@ -195,7 +195,7 @@ RegError ORegKey::getKeyNames(const OUString& keyName, { releaseKey(pKey); } - return REG_NO_ERROR; + return RegError::NO_ERROR; } @@ -240,7 +240,7 @@ RegError ORegKey::getValueInfo(const OUString& valueName, RegValueType* pValueTy { *pValueType = RegValueType::NOT_DEFINED; *pValueSize = 0; - return REG_VALUE_NOT_EXISTS; + return RegError::VALUE_NOT_EXISTS; } pBuffer = static_cast<sal_uInt8*>(rtl_allocateMemory(VALUE_HEADERSIZE)); @@ -249,12 +249,12 @@ RegError ORegKey::getValueInfo(const OUString& valueName, RegValueType* pValueTy if ( rValue.readAt(0, pBuffer, VALUE_HEADERSIZE, readBytes) ) { rtl_freeMemory(pBuffer); - return REG_INVALID_VALUE; + return RegError::INVALID_VALUE; } if (readBytes != VALUE_HEADERSIZE) { rtl_freeMemory(pBuffer); - return REG_INVALID_VALUE; + return RegError::INVALID_VALUE; } sal_uInt32 size; @@ -280,7 +280,7 @@ RegError ORegKey::getValueInfo(const OUString& valueName, RegValueType* pValueTy // } rtl_freeMemory(pBuffer); - return REG_NO_ERROR; + return RegError::NO_ERROR; } @@ -294,12 +294,12 @@ RegError ORegKey::setValue(const OUString& valueName, RegValueType vType, RegVal if (m_pRegistry->isReadOnly()) { - return REG_REGISTRY_READONLY; + return RegError::REGISTRY_READONLY; } if (vType > RegValueType::BINARY) { - return REG_INVALID_VALUE; + return RegError::INVALID_VALUE; } OUString sImplValueName( VALUE_PREFIX ); @@ -309,7 +309,7 @@ RegError ORegKey::setValue(const OUString& valueName, RegValueType vType, RegVal if ( rValue.create(getStoreFile(), m_name + m_pRegistry->ROOT , sImplValueName, VALUE_MODE_CREATE) ) { - return REG_SET_VALUE_FAILED; + return RegError::SET_VALUE_FAILED; } sal_uInt32 size = vSize; @@ -346,17 +346,17 @@ RegError ORegKey::setValue(const OUString& valueName, RegValueType vType, RegVal if ( rValue.writeAt(0, pBuffer, VALUE_HEADERSIZE+size, writenBytes) ) { rtl_freeMemory(pBuffer); - return REG_SET_VALUE_FAILED; + return RegError::SET_VALUE_FAILED; } if (writenBytes != (VALUE_HEADERSIZE+size)) { rtl_freeMemory(pBuffer); - return REG_SET_VALUE_FAILED; + return RegError::SET_VALUE_FAILED; } setModified(); rtl_freeMemory(pBuffer); - return REG_NO_ERROR; + return RegError::NO_ERROR; } @@ -369,7 +369,7 @@ RegError ORegKey::setLongListValue(const OUString& valueName, sal_Int32* pValueL if (m_pRegistry->isReadOnly()) { - return REG_REGISTRY_READONLY; + return RegError::REGISTRY_READONLY; } OUString sImplValueName( VALUE_PREFIX ); @@ -379,7 +379,7 @@ RegError ORegKey::setLongListValue(const OUString& valueName, sal_Int32* pValueL if (rValue.create(getStoreFile(), m_name + m_pRegistry->ROOT, sImplValueName, VALUE_MODE_CREATE) ) { - return REG_SET_VALUE_FAILED; + return RegError::SET_VALUE_FAILED; } sal_uInt32 size = 4; // 4 bytes (sal_uInt32) for the length @@ -405,17 +405,17 @@ RegError ORegKey::setLongListValue(const OUString& valueName, sal_Int32* pValueL if ( rValue.writeAt(0, pBuffer, VALUE_HEADERSIZE+size, writenBytes) ) { rtl_freeMemory(pBuffer); - return REG_SET_VALUE_FAILED; + return RegError::SET_VALUE_FAILED; } if (writenBytes != (VALUE_HEADEROFFSET+size)) { rtl_freeMemory(pBuffer); - return REG_SET_VALUE_FAILED; + return RegError::SET_VALUE_FAILED; } setModified(); rtl_freeMemory(pBuffer); - return REG_NO_ERROR; + return RegError::NO_ERROR; } @@ -428,7 +428,7 @@ RegError ORegKey::setStringListValue(const OUString& valueName, sal_Char** pValu if (m_pRegistry->isReadOnly()) { - return REG_REGISTRY_READONLY; + return RegError::REGISTRY_READONLY; } OUString sImplValueName( VALUE_PREFIX ); @@ -438,7 +438,7 @@ RegError ORegKey::setStringListValue(const OUString& valueName, sal_Char** pValu if (rValue.create(getStoreFile(), m_name + m_pRegistry->ROOT, sImplValueName, VALUE_MODE_CREATE) ) { - return REG_SET_VALUE_FAILED; + return RegError::SET_VALUE_FAILED; } sal_uInt32 size = 4; // 4 bytes (sal_uInt32) for the length @@ -473,17 +473,17 @@ RegError ORegKey::setStringListValue(const OUString& valueName, sal_Char** pValu if ( rValue.writeAt(0, pBuffer, VALUE_HEADERSIZE+size, writenBytes) ) { rtl_freeMemory(pBuffer); - return REG_SET_VALUE_FAILED; + return RegError::SET_VALUE_FAILED; } if (writenBytes != (VALUE_HEADERSIZE+size)) { rtl_freeMemory(pBuffer); - return REG_SET_VALUE_FAILED; + return RegError::SET_VALUE_FAILED; } setModified(); rtl_freeMemory(pBuffer); - return REG_NO_ERROR; + return RegError::NO_ERROR; } @@ -496,7 +496,7 @@ RegError ORegKey::setUnicodeListValue(const OUString& valueName, sal_Unicode** p if (m_pRegistry->isReadOnly()) { - return REG_REGISTRY_READONLY; + return RegError::REGISTRY_READONLY; } OUString sImplValueName( VALUE_PREFIX ); @@ -506,7 +506,7 @@ RegError ORegKey::setUnicodeListValue(const OUString& valueName, sal_Unicode** p if (rValue.create(getStoreFile(), m_name + m_pRegistry->ROOT, sImplValueName, VALUE_MODE_CREATE) ) { - return REG_SET_VALUE_FAILED; + return RegError::SET_VALUE_FAILED; } sal_uInt32 size = 4; // 4 bytes (sal_uInt32) for the length @@ -541,17 +541,17 @@ RegError ORegKey::setUnicodeListValue(const OUString& valueName, sal_Unicode** p if ( rValue.writeAt(0, pBuffer, VALUE_HEADERSIZE+size, writenBytes) ) { rtl_freeMemory(pBuffer); - return REG_SET_VALUE_FAILED; + return RegError::SET_VALUE_FAILED; } if (writenBytes != (VALUE_HEADERSIZE+size)) { rtl_freeMemory(pBuffer); - return REG_SET_VALUE_FAILED; + return RegError::SET_VALUE_FAILED; } setModified(); rtl_freeMemory(pBuffer); - return REG_NO_ERROR; + return RegError::NO_ERROR; } @@ -577,7 +577,7 @@ RegError ORegKey::getValue(const OUString& valueName, RegValue value) const if (rValue.create(getStoreFile(), m_name + m_pRegistry->ROOT, sImplValueName, accessMode) ) { - return REG_VALUE_NOT_EXISTS; + return RegError::VALUE_NOT_EXISTS; } pBuffer = static_cast<sal_uInt8*>(rtl_allocateMemory(VALUE_HEADERSIZE)); @@ -586,12 +586,12 @@ RegError ORegKey::getValue(const OUString& valueName, RegValue value) const if ( rValue.readAt(0, pBuffer, VALUE_HEADERSIZE, readBytes) ) { rtl_freeMemory(pBuffer); - return REG_INVALID_VALUE; + return RegError::INVALID_VALUE; } if (readBytes != VALUE_HEADERSIZE) { rtl_freeMemory(pBuffer); - return REG_INVALID_VALUE; + return RegError::INVALID_VALUE; } sal_uInt8 type = *((sal_uInt8*)pBuffer); @@ -602,7 +602,7 @@ RegError ORegKey::getValue(const OUString& valueName, RegValue value) const if (valueType > RegValueType::BINARY) { - return REG_INVALID_VALUE; + return RegError::INVALID_VALUE; } pBuffer = static_cast<sal_uInt8*>(rtl_allocateMemory(valueSize)); @@ -610,12 +610,12 @@ RegError ORegKey::getValue(const OUString& valueName, RegValue value) const if ( rValue.readAt(VALUE_HEADEROFFSET, pBuffer, valueSize, readBytes) ) { rtl_freeMemory(pBuffer); - return REG_INVALID_VALUE; + return RegError::INVALID_VALUE; } if (readBytes != valueSize) { rtl_freeMemory(pBuffer); - return REG_INVALID_VALUE; + return RegError::INVALID_VALUE; } switch (valueType) @@ -645,7 +645,7 @@ RegError ORegKey::getValue(const OUString& valueName, RegValue value) const rtl_freeMemory(pBuffer); - return REG_NO_ERROR; + return RegError::NO_ERROR; } @@ -673,7 +673,7 @@ RegError ORegKey::getLongListValue(const OUString& valueName, sal_Int32** pValue { pValueList = NULL; *pLen = 0; - return REG_VALUE_NOT_EXISTS; + return RegError::VALUE_NOT_EXISTS; } pBuffer = static_cast<sal_uInt8*>(rtl_allocateMemory(VALUE_HEADERSIZE)); @@ -684,14 +684,14 @@ RegError ORegKey::getLongListValue(const OUString& valueName, sal_Int32** pValue pValueList = NULL; *pLen = 0; rtl_freeMemory(pBuffer); - return REG_INVALID_VALUE; + return RegError::INVALID_VALUE; } if (readBytes != VALUE_HEADERSIZE) { pValueList = NULL; *pLen = 0; rtl_freeMemory(pBuffer); - return REG_INVALID_VALUE; + return RegError::INVALID_VALUE; } sal_uInt8 type = *((sal_uInt8*)pBuffer); @@ -702,7 +702,7 @@ RegError ORegKey::getLongListValue(const OUString& valueName, sal_Int32** pValue pValueList = NULL; *pLen = 0; rtl_freeMemory(pBuffer); - return REG_INVALID_VALUE; + return RegError::INVALID_VALUE; } readUINT32(pBuffer+VALUE_TYPEOFFSET, valueSize); @@ -716,7 +716,7 @@ RegError ORegKey::getLongListValue(const OUString& valueName, sal_Int32** pValue pValueList = NULL; *pLen = 0; rtl_freeMemory(pBuffer); - return REG_INVALID_VALUE; + return RegError::INVALID_VALUE; } pBuffer = static_cast<sal_uInt8*>(rtl_allocateMemory(valueSize)); @@ -725,14 +725,14 @@ RegError ORegKey::getLongListValue(const OUString& valueName, sal_Int32** pValue pValueList = NULL; *pLen = 0; rtl_freeMemory(pBuffer); - return REG_INVALID_VALUE; + return RegError::INVALID_VALUE; } if (readBytes != valueSize) { pValueList = NULL; *pLen = 0; rtl_freeMemory(pBuffer); - return REG_INVALID_VALUE; + return RegError::INVALID_VALUE; } sal_uInt32 len = 0; @@ -744,7 +744,7 @@ RegError ORegKey::getLongListValue(const OUString& valueName, sal_Int32** pValue pValueList = NULL; *pLen = 0; rtl_freeMemory(pBuffer); - return REG_INVALID_VALUE; + return RegError::INVALID_VALUE; } *pLen = len; sal_Int32* pVList = static_cast<sal_Int32*>(rtl_allocateZeroMemory(len * sizeof(sal_Int32))); @@ -759,7 +759,7 @@ RegError ORegKey::getLongListValue(const OUString& valueName, sal_Int32** pValue *pValueList = pVList; rtl_freeMemory(pBuffer); - return REG_NO_ERROR; + return RegError::NO_ERROR; } @@ -787,7 +787,7 @@ RegError ORegKey::getStringListValue(const OUString& valueName, sal_Char*** pVal { pValueList = NULL; *pLen = 0; - return REG_VALUE_NOT_EXISTS; + return RegError::VALUE_NOT_EXISTS; } pBuffer = static_cast<sal_uInt8*>(rtl_allocateMemory(VALUE_HEADERSIZE)); @@ -798,14 +798,14 @@ RegError ORegKey::getStringListValue(const OUString& valueName, sal_Char*** pVal pValueList = NULL; *pLen = 0; rtl_freeMemory(pBuffer); - return REG_INVALID_VALUE; + return RegError::INVALID_VALUE; } if (readBytes != VALUE_HEADERSIZE) { pValueList = NULL; *pLen = 0; rtl_freeMemory(pBuffer); - return REG_INVALID_VALUE; + return RegError::INVALID_VALUE; } sal_uInt8 type = *((sal_uInt8*)pBuffer); @@ -816,7 +816,7 @@ RegError ORegKey::getStringListValue(const OUString& valueName, sal_Char*** pVal pValueList = NULL; *pLen = 0; rtl_freeMemory(pBuffer); - return REG_INVALID_VALUE; + return RegError::INVALID_VALUE; } readUINT32(pBuffer+VALUE_TYPEOFFSET, valueSize); @@ -830,14 +830,14 @@ RegError ORegKey::getStringListValue(const OUString& valueName, sal_Char*** pVal pValueList = NULL; *pLen = 0; rtl_freeMemory(pBuffer); - return REG_INVALID_VALUE; + return RegError::INVALID_VALUE; } if (readBytes != valueSize) { pValueList = NULL; *pLen = 0; rtl_freeMemory(pBuffer); - return REG_INVALID_VALUE; + return RegError::INVALID_VALUE; } sal_uInt32 len = 0; @@ -865,7 +865,7 @@ RegError ORegKey::getStringListValue(const OUString& valueName, sal_Char*** pVal *pValueList = pVList; rtl_freeMemory(pBuffer); - return REG_NO_ERROR; + return RegError::NO_ERROR; } @@ -893,7 +893,7 @@ RegError ORegKey::getUnicodeListValue(const OUString& valueName, sal_Unicode*** { pValueList = NULL; *pLen = 0; - return REG_VALUE_NOT_EXISTS; + return RegError::VALUE_NOT_EXISTS; } pBuffer = static_cast<sal_uInt8*>(rtl_allocateMemory(VALUE_HEADERSIZE)); @@ -904,14 +904,14 @@ RegError ORegKey::getUnicodeListValue(const OUString& valueName, sal_Unicode*** pValueList = NULL; *pLen = 0; rtl_freeMemory(pBuffer); - return REG_INVALID_VALUE; + return RegError::INVALID_VALUE; } if (readBytes != VALUE_HEADERSIZE) { pValueList = NULL; *pLen = 0; rtl_freeMemory(pBuffer); - return REG_INVALID_VALUE; + return RegError::INVALID_VALUE; } sal_uInt8 type = *((sal_uInt8*)pBuffer); @@ -922,7 +922,7 @@ RegError ORegKey::getUnicodeListValue(const OUString& valueName, sal_Unicode*** pValueList = NULL; *pLen = 0; rtl_freeMemory(pBuffer); - return REG_INVALID_VALUE; + return RegError::INVALID_VALUE; } readUINT32(pBuffer+VALUE_TYPEOFFSET, valueSize); @@ -936,14 +936,14 @@ RegError ORegKey::getUnicodeListValue(const OUString& valueName, sal_Unicode*** pValueList = NULL; *pLen = 0; rtl_freeMemory(pBuffer); - return REG_INVALID_VALUE; + return RegError::INVALID_VALUE; } if (readBytes != valueSize) { pValueList = NULL; *pLen = 0; rtl_freeMemory(pBuffer); - return REG_INVALID_VALUE; + return RegError::INVALID_VALUE; } sal_uInt32 len = 0; @@ -971,7 +971,7 @@ RegError ORegKey::getUnicodeListValue(const OUString& valueName, sal_Unicode*** *pValueList = pVList; rtl_freeMemory(pBuffer); - return REG_NO_ERROR; + return RegError::NO_ERROR; } @@ -979,10 +979,10 @@ RegError ORegKey::getResolvedKeyName(const OUString& keyName, OUString& resolvedName) { if (keyName.isEmpty()) - return REG_INVALID_KEYNAME; + return RegError::INVALID_KEYNAME; resolvedName = getFullPath(keyName); - return REG_NO_ERROR; + return RegError::NO_ERROR; } diff --git a/registry/source/regimpl.cxx b/registry/source/regimpl.cxx index 0a7ad76f52a5..a1ed1ffba133 100644 --- a/registry/source/regimpl.cxx +++ b/registry/source/regimpl.cxx @@ -454,7 +454,7 @@ ORegistry::~ORegistry() RegError ORegistry::initRegistry(const OUString& regName, RegAccessMode accessMode, bool bCreate) { - RegError eRet = REG_INVALID_REGISTRY; + RegError eRet = RegError::INVALID_REGISTRY; OStoreFile rRegFile; storeAccessMode sAccessMode = REG_MODE_OPEN; storeError errCode; @@ -484,13 +484,13 @@ RegError ORegistry::initRegistry(const OUString& regName, RegAccessMode accessMo switch (errCode) { case store_E_NotExists: - eRet = REG_REGISTRY_NOT_EXISTS; + eRet = RegError::REGISTRY_NOT_EXISTS; break; case store_E_LockingViolation: - eRet = REG_CANNOT_OPEN_FOR_READWRITE; + eRet = RegError::CANNOT_OPEN_FOR_READWRITE; break; default: - eRet = REG_INVALID_REGISTRY; + eRet = RegError::INVALID_REGISTRY; break; } } @@ -506,10 +506,10 @@ RegError ORegistry::initRegistry(const OUString& regName, RegAccessMode accessMo m_isOpen = true; m_openKeyTable[ROOT] = new ORegKey(ROOT, this); - eRet = REG_NO_ERROR; + eRet = RegError::NO_ERROR; } else - eRet = REG_INVALID_REGISTRY; + eRet = RegError::INVALID_REGISTRY; } return eRet; @@ -528,10 +528,10 @@ RegError ORegistry::closeRegistry() (void) releaseKey(m_openKeyTable[ROOT]); m_file.close(); m_isOpen = false; - return REG_NO_ERROR; + return RegError::NO_ERROR; } else { - return REG_REGISTRY_NOT_EXISTS; + return RegError::REGISTRY_NOT_EXISTS; } } @@ -547,7 +547,7 @@ RegError ORegistry::destroyRegistry(const OUString& regName) { std::unique_ptr<ORegistry> pReg(new ORegistry()); - if (!pReg->initRegistry(regName, RegAccessMode::READWRITE)) + if (pReg->initRegistry(regName, RegAccessMode::READWRITE) == RegError::NO_ERROR) { pReg.reset(); @@ -558,17 +558,17 @@ RegError ORegistry::destroyRegistry(const OUString& regName) OString name( OUStringToOString(systemName, osl_getThreadTextEncoding()) ); if (unlink(name.getStr()) != 0) { - return REG_DESTROY_REGISTRY_FAILED; + return RegError::DESTROY_REGISTRY_FAILED; } } else { - return REG_DESTROY_REGISTRY_FAILED; + return RegError::DESTROY_REGISTRY_FAILED; } } else { if (m_refCount != 1 || isReadOnly()) { - return REG_DESTROY_REGISTRY_FAILED; + return RegError::DESTROY_REGISTRY_FAILED; } if (m_file.isValid()) @@ -586,16 +586,16 @@ RegError ORegistry::destroyRegistry(const OUString& regName) OString name( OUStringToOString(systemName, osl_getThreadTextEncoding()) ); if (unlink(name.getStr()) != 0) { - return REG_DESTROY_REGISTRY_FAILED; + return RegError::DESTROY_REGISTRY_FAILED; } } } else { - return REG_REGISTRY_NOT_EXISTS; + return RegError::REGISTRY_NOT_EXISTS; } } - return REG_NO_ERROR; + return RegError::NO_ERROR; } @@ -605,12 +605,12 @@ RegError ORegistry::acquireKey (RegKeyHandle hKey) { ORegKey* pKey = static_cast< ORegKey* >(hKey); if (!pKey) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; REG_GUARD(m_mutex); pKey->acquire(); - return REG_NO_ERROR; + return RegError::NO_ERROR; } @@ -620,7 +620,7 @@ RegError ORegistry::releaseKey (RegKeyHandle hKey) { ORegKey* pKey = static_cast< ORegKey* >(hKey); if (!pKey) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; REG_GUARD(m_mutex); if (pKey->release() == 0) @@ -628,7 +628,7 @@ RegError ORegistry::releaseKey (RegKeyHandle hKey) m_openKeyTable.erase(pKey->getName()); delete pKey; } - return REG_NO_ERROR; + return RegError::NO_ERROR; } @@ -642,7 +642,7 @@ RegError ORegistry::createKey(RegKeyHandle hKey, const OUString& keyName, *phNewKey = NULL; if ( keyName.isEmpty() ) - return REG_INVALID_KEYNAME; + return RegError::INVALID_KEYNAME; REG_GUARD(m_mutex); @@ -658,7 +658,7 @@ RegError ORegistry::createKey(RegKeyHandle hKey, const OUString& keyName, *phNewKey = m_openKeyTable[sFullKeyName]; static_cast<ORegKey*>(*phNewKey)->acquire(); static_cast<ORegKey*>(*phNewKey)->setDeleted(false); - return REG_NO_ERROR; + return RegError::NO_ERROR; } OStoreDirectory rStoreDir; @@ -675,7 +675,7 @@ RegError ORegistry::createKey(RegKeyHandle hKey, const OUString& keyName, { if (rStoreDir.create(pKey->getStoreFile(), sFullPath.getStr(), token, KEY_MODE_CREATE)) { - return REG_CREATE_KEY_FAILED; + return RegError::CREATE_KEY_FAILED; } sFullPath.append(token); @@ -688,7 +688,7 @@ RegError ORegistry::createKey(RegKeyHandle hKey, const OUString& keyName, *phNewKey = pKey; m_openKeyTable[sFullKeyName] = pKey; - return REG_NO_ERROR; + return RegError::NO_ERROR; } @@ -704,7 +704,7 @@ RegError ORegistry::openKey(RegKeyHandle hKey, const OUString& keyName, if ( keyName.isEmpty() ) { - return REG_INVALID_KEYNAME; + return RegError::INVALID_KEYNAME; } REG_GUARD(m_mutex); @@ -723,9 +723,9 @@ RegError ORegistry::openKey(RegKeyHandle hKey, const OUString& keyName, isReadOnly() ? KEY_MODE_OPENREAD : KEY_MODE_OPEN)) { case store_E_NotExists: - return REG_KEY_NOT_EXISTS; + return RegError::KEY_NOT_EXISTS; case store_E_WrongFormat: - return REG_INVALID_KEY; + return RegError::INVALID_KEY; default: break; } @@ -737,7 +737,7 @@ RegError ORegistry::openKey(RegKeyHandle hKey, const OUString& keyName, i->second->acquire(); } *phOpenKey = i->second; - return REG_NO_ERROR; + return RegError::NO_ERROR; } @@ -752,7 +752,7 @@ RegError ORegistry::closeKey(RegKeyHandle hKey) OUString const aKeyName (pKey->getName()); if (!(m_openKeyTable.count(aKeyName) > 0)) - return REG_KEY_NOT_OPEN; + return RegError::KEY_NOT_OPEN; if (pKey->isModified()) { @@ -782,7 +782,7 @@ RegError ORegistry::deleteKey(RegKeyHandle hKey, const OUString& keyName) { ORegKey* pKey = static_cast< ORegKey* >(hKey); if ( keyName.isEmpty() ) - return REG_INVALID_KEYNAME; + return RegError::INVALID_KEYNAME; REG_GUARD(m_mutex); @@ -795,11 +795,11 @@ RegError ORegistry::deleteKey(RegKeyHandle hKey, const OUString& keyName) RegError ORegistry::eraseKey(ORegKey* pKey, const OUString& keyName) { - RegError _ret = REG_NO_ERROR; + RegError _ret = RegError::NO_ERROR; if ( keyName.isEmpty() ) { - return REG_INVALID_KEYNAME; + return RegError::INVALID_KEYNAME; } OUString sFullKeyName(pKey->getName()); @@ -831,11 +831,11 @@ RegError ORegistry::eraseKey(ORegKey* pKey, const OUString& keyName) ORegKey* pOldKey = 0; _ret = pKey->openKey(keyName, reinterpret_cast<RegKeyHandle*>(&pOldKey)); - if (_ret != REG_NO_ERROR) + if (_ret != RegError::NO_ERROR) return _ret; _ret = deleteSubkeysAndValues(pOldKey); - if (_ret != REG_NO_ERROR) + if (_ret != RegError::NO_ERROR) { pKey->closeKey(pOldKey); return _ret; @@ -847,7 +847,7 @@ RegError ORegistry::eraseKey(ORegKey* pKey, const OUString& keyName) OStoreFile sFile(pKey->getStoreFile()); if ( sFile.isValid() && sFile.remove(sFullPath, tmpName) ) { - return REG_DELETE_KEY_FAILED; + return RegError::DELETE_KEY_FAILED; } pOldKey->setModified(); @@ -863,7 +863,7 @@ RegError ORegistry::eraseKey(ORegKey* pKey, const OUString& keyName) RegError ORegistry::deleteSubkeysAndValues(ORegKey* pKey) { OStoreDirectory::iterator iter; - RegError _ret = REG_NO_ERROR; + RegError _ret = RegError::NO_ERROR; OStoreDirectory rStoreDir(pKey->getStoreDir()); storeError _err = rStoreDir.first(iter); @@ -874,7 +874,7 @@ RegError ORegistry::deleteSubkeysAndValues(ORegKey* pKey) if (iter.m_nAttrib & STORE_ATTRIB_ISDIR) { _ret = eraseKey(pKey, keyName); - if (_ret) + if (_ret != RegError::NO_ERROR) return _ret; } else @@ -886,7 +886,7 @@ RegError ORegistry::deleteSubkeysAndValues(ORegKey* pKey) if ( ((OStoreFile&)pKey->getStoreFile()).remove(sFullPath, keyName) ) { - return REG_DELETE_VALUE_FAILED; + return RegError::DELETE_VALUE_FAILED; } pKey->setModified(); } @@ -894,7 +894,7 @@ RegError ORegistry::deleteSubkeysAndValues(ORegKey* pKey) _err = rStoreDir.next(iter); } - return REG_NO_ERROR; + return RegError::NO_ERROR; } @@ -904,12 +904,12 @@ RegError ORegistry::deleteSubkeysAndValues(ORegKey* pKey) RegError ORegistry::loadKey(RegKeyHandle hKey, const OUString& regFileName, bool bWarnings, bool bReport) { - RegError _ret = REG_NO_ERROR; + RegError _ret = RegError::NO_ERROR; ORegKey* pKey = static_cast< ORegKey* >(hKey); std::unique_ptr< ORegistry > pReg (new ORegistry()); _ret = pReg->initRegistry(regFileName, RegAccessMode::READONLY); - if (_ret != REG_NO_ERROR) + if (_ret != RegError::NO_ERROR) return _ret; ORegKey* pRootKey = pReg->getRootKey(); @@ -932,9 +932,9 @@ RegError ORegistry::loadKey(RegKeyHandle hKey, const OUString& regFileName, _ret = loadAndSaveValue(pKey, pRootKey, keyName, 0, bWarnings, bReport); } - if (_ret == REG_MERGE_ERROR) + if (_ret == RegError::MERGE_ERROR) break; - if (_ret == REG_MERGE_CONFLICT && bWarnings) + if (_ret == RegError::MERGE_CONFLICT && bWarnings) break; _err = rStoreDir.next(iter); @@ -952,12 +952,12 @@ RegError ORegistry::loadKey(RegKeyHandle hKey, const OUString& regFileName, RegError ORegistry::saveKey(RegKeyHandle hKey, const OUString& regFileName, bool bWarnings, bool bReport) { - RegError _ret = REG_NO_ERROR; + RegError _ret = RegError::NO_ERROR; ORegKey* pKey = static_cast< ORegKey* >(hKey); std::unique_ptr< ORegistry > pReg (new ORegistry()); _ret = pReg->initRegistry(regFileName, RegAccessMode::READWRITE, true/*bCreate*/); - if (_ret != REG_NO_ERROR) + if (_ret != RegError::NO_ERROR) return _ret; ORegKey* pRootKey = pReg->getRootKey(); @@ -984,7 +984,7 @@ RegError ORegistry::saveKey(RegKeyHandle hKey, const OUString& regFileName, bWarnings, bReport); } - if (_ret != REG_NO_ERROR) + if (_ret != RegError::NO_ERROR) break; _err = rStoreDir.next(iter); @@ -1037,7 +1037,7 @@ RegError ORegistry::loadAndSaveValue(ORegKey* pTargetKey, if (rValue.create(pSourceKey->getStoreFile(), sSourcePath, valueName, sourceAccess)) { - return REG_VALUE_NOT_EXISTS; + return RegError::VALUE_NOT_EXISTS; } pBuffer = static_cast<sal_uInt8*>(rtl_allocateMemory(VALUE_HEADERSIZE)); @@ -1046,15 +1046,15 @@ RegError ORegistry::loadAndSaveValue(ORegKey* pTargetKey, if (rValue.readAt(0, pBuffer, VALUE_HEADERSIZE, rwBytes)) { rtl_freeMemory(pBuffer); - return REG_INVALID_VALUE; + return RegError::INVALID_VALUE; } if (rwBytes != VALUE_HEADERSIZE) { rtl_freeMemory(pBuffer); - return REG_INVALID_VALUE; + return RegError::INVALID_VALUE; } - RegError _ret = REG_NO_ERROR; + RegError _ret = RegError::NO_ERROR; sal_uInt8 type = *((sal_uInt8*)pBuffer); valueType = (RegValueType)type; readUINT32(pBuffer+VALUE_TYPEOFFSET, valueSize); @@ -1066,12 +1066,12 @@ RegError ORegistry::loadAndSaveValue(ORegKey* pTargetKey, if (rValue.readAt(0, pBuffer, nSize, rwBytes)) { rtl_freeMemory(pBuffer); - return REG_INVALID_VALUE; + return RegError::INVALID_VALUE; } if (rwBytes != nSize) { rtl_freeMemory(pBuffer); - return REG_INVALID_VALUE; + return RegError::INVALID_VALUE; } OStoreFile rTargetFile(pTargetKey->getStoreFile()); @@ -1083,10 +1083,10 @@ RegError ORegistry::loadAndSaveValue(ORegKey* pTargetKey, _ret = checkBlop( rValue, sTargetPath, valueSize, pBuffer+VALUE_HEADEROFFSET, bReport); - if (_ret) + if (_ret != RegError::NO_ERROR) { - if (_ret == REG_MERGE_ERROR || - (_ret == REG_MERGE_CONFLICT && bWarnings)) + if (_ret == RegError::MERGE_ERROR || + (_ret == RegError::MERGE_CONFLICT && bWarnings)) { rtl_freeMemory(pBuffer); return _ret; @@ -1103,18 +1103,18 @@ RegError ORegistry::loadAndSaveValue(ORegKey* pTargetKey, if (rValue.create(rTargetFile, sTargetPath, valueName, VALUE_MODE_CREATE)) { rtl_freeMemory(pBuffer); - return REG_INVALID_VALUE; + return RegError::INVALID_VALUE; } if (rValue.writeAt(0, pBuffer, nSize, rwBytes)) { rtl_freeMemory(pBuffer); - return REG_INVALID_VALUE; + return RegError::INVALID_VALUE; } if (rwBytes != nSize) { rtl_freeMemory(pBuffer); - return REG_INVALID_VALUE; + return RegError::INVALID_VALUE; } pTargetKey->setModified(); @@ -1136,7 +1136,7 @@ RegError ORegistry::checkBlop(OStoreStream& rValue, if (reader.getTypeClass() == RT_TYPE_INVALID) { - return REG_INVALID_VALUE; + return RegError::INVALID_VALUE; } sal_uInt8* pBuffer = static_cast<sal_uInt8*>(rtl_allocateMemory(VALUE_HEADERSIZE)); @@ -1171,7 +1171,7 @@ RegError ORegistry::checkBlop(OStoreStream& rValue, fprintf(stdout, "ERROR: values of blop from key \"%s\" has different types.\n", targetPath.getStr()); } - return REG_MERGE_ERROR; + return RegError::MERGE_ERROR; } if (reader.getTypeClass() == RT_TYPE_MODULE) @@ -1182,16 +1182,16 @@ RegError ORegistry::checkBlop(OStoreStream& rValue, mergeModuleValue(rValue, reader, reader2); rtl_freeMemory(pBuffer); - return REG_NO_ERROR; + return RegError::NO_ERROR; } else if (reader2.getFieldCount() > 0) { rtl_freeMemory(pBuffer); - return REG_NO_ERROR; + return RegError::NO_ERROR; } else { rtl_freeMemory(pBuffer); - return REG_MERGE_CONFLICT; + return RegError::MERGE_CONFLICT; } } else { @@ -1202,7 +1202,7 @@ RegError ORegistry::checkBlop(OStoreStream& rValue, fprintf(stderr, "WARNING: value of key \"%s\" already exists.\n", targetPath.getStr()); } - return REG_MERGE_CONFLICT; + return RegError::MERGE_CONFLICT; } } else { @@ -1212,7 +1212,7 @@ RegError ORegistry::checkBlop(OStoreStream& rValue, fprintf(stderr, "ERROR: values of key \"%s\" contains bad data.\n", targetPath.getStr()); } - return REG_MERGE_ERROR; + return RegError::MERGE_ERROR; } } else { @@ -1222,12 +1222,12 @@ RegError ORegistry::checkBlop(OStoreStream& rValue, fprintf(stderr, "ERROR: values of key \"%s\" has different types.\n", targetPath.getStr()); } - return REG_MERGE_ERROR; + return RegError::MERGE_ERROR; } } else { rtl_freeMemory(pBuffer); - return REG_INVALID_VALUE; + return RegError::INVALID_VALUE; } } @@ -1314,18 +1314,18 @@ RegError ORegistry::mergeModuleValue(OStoreStream& rTargetValue, if (rTargetValue.writeAt(0, pBuffer, VALUE_HEADERSIZE+aBlopSize, rwBytes)) { rtl_freeMemory(pBuffer); - return REG_INVALID_VALUE; + return RegError::INVALID_VALUE; } if (rwBytes != VALUE_HEADERSIZE+aBlopSize) { rtl_freeMemory(pBuffer); - return REG_INVALID_VALUE; + return RegError::INVALID_VALUE; } rtl_freeMemory(pBuffer); } - return REG_NO_ERROR; + return RegError::NO_ERROR; } @@ -1338,7 +1338,7 @@ RegError ORegistry::loadAndSaveKeys(ORegKey* pTargetKey, bool bWarnings, bool bReport) { - RegError _ret = REG_NO_ERROR; + RegError _ret = RegError::NO_ERROR; OUString sRelPath(pSourceKey->getName().copy(nCut)); OUString sFullPath; @@ -1354,7 +1354,7 @@ RegError ORegistry::loadAndSaveKeys(ORegKey* pTargetKey, OStoreDirectory rStoreDir; if (rStoreDir.create(pTargetKey->getStoreFile(), sFullPath, keyName, KEY_MODE_CREATE)) { - return REG_CREATE_KEY_FAILED; + return RegError::CREATE_KEY_FAILED; } if (m_openKeyTable.count(sFullKeyName) > 0) @@ -1364,7 +1364,7 @@ RegError ORegistry::loadAndSaveKeys(ORegKey* pTargetKey, ORegKey* pTmpKey = 0; _ret = pSourceKey->openKey(keyName, reinterpret_cast<RegKeyHandle*>(&pTmpKey)); - if (_ret != REG_NO_ERROR) + if (_ret != RegError::NO_ERROR) return _ret; OStoreDirectory::iterator iter; @@ -1385,9 +1385,9 @@ RegError ORegistry::loadAndSaveKeys(ORegKey* pTargetKey, sName, nCut, bWarnings, bReport); } - if (_ret == REG_MERGE_ERROR) + if (_ret == RegError::MERGE_ERROR) break; - if (_ret == REG_MERGE_CONFLICT && bWarnings) + if (_ret == RegError::MERGE_CONFLICT && bWarnings) break; _err = rTmpStoreDir.next(iter); @@ -1415,7 +1415,7 @@ RegError ORegistry::dumpRegistry(RegKeyHandle hKey) const { ORegKey *pKey = static_cast<ORegKey*>(hKey); OUString sName; - RegError _ret = REG_NO_ERROR; + RegError _ret = RegError::NO_ERROR; OStoreDirectory::iterator iter; OStoreDirectory rStoreDir(pKey->getStoreDir()); storeError _err = rStoreDir.first(iter); @@ -1436,7 +1436,7 @@ RegError ORegistry::dumpRegistry(RegKeyHandle hKey) const _ret = dumpValue(pKey->getName(), sName, 1); } - if (_ret) + if (_ret != RegError::NO_ERROR) { return _ret; } @@ -1444,7 +1444,7 @@ RegError ORegistry::dumpRegistry(RegKeyHandle hKey) const _err = rStoreDir.next(iter); } - return REG_NO_ERROR; + return RegError::NO_ERROR; } @@ -1473,7 +1473,7 @@ RegError ORegistry::dumpValue(const OUString& sPath, const OUString& sName, sal_ } if (rValue.create(m_file, sFullPath, sName, accessMode)) { - return REG_VALUE_NOT_EXISTS; + return RegError::VALUE_NOT_EXISTS; } pBuffer = static_cast<sal_uInt8*>(rtl_allocateMemory(VALUE_HEADERSIZE)); @@ -1482,12 +1482,12 @@ RegError ORegistry::dumpValue(const OUString& sPath, const OUString& sName, sal_ if (rValue.readAt(0, pBuffer, VALUE_HEADERSIZE, rwBytes)) { rtl_freeMemory(pBuffer); - return REG_INVALID_VALUE; + return RegError::INVALID_VALUE; } if (rwBytes != (VALUE_HEADERSIZE)) { rtl_freeMemory(pBuffer); - return REG_INVALID_VALUE; + return RegError::INVALID_VALUE; } sal_uInt8 type = *((sal_uInt8*)pBuffer); @@ -1498,12 +1498,12 @@ RegError ORegistry::dumpValue(const OUString& sPath, const OUString& sName, sal_ if (rValue.readAt(VALUE_HEADEROFFSET, pBuffer, valueSize, rwBytes)) { rtl_freeMemory(pBuffer); - return REG_INVALID_VALUE; + return RegError::INVALID_VALUE; } if (rwBytes != valueSize) { rtl_freeMemory(pBuffer); - return REG_INVALID_VALUE; + return RegError::INVALID_VALUE; } const sal_Char* indent = sIndent.getStr(); @@ -1683,7 +1683,7 @@ RegError ORegistry::dumpValue(const OUString& sPath, const OUString& sName, sal_ fprintf(stdout, "\n"); rtl_freeMemory(pBuffer); - return REG_NO_ERROR; + return RegError::NO_ERROR; } @@ -1695,7 +1695,7 @@ RegError ORegistry::dumpKey(const OUString& sPath, const OUString& sName, sal_In OUString sFullPath(sPath); OString sIndent; storeAccessMode accessMode = KEY_MODE_OPEN; - RegError _ret = REG_NO_ERROR; + RegError _ret = RegError::NO_ERROR; if (isReadOnly()) { @@ -1710,9 +1710,9 @@ RegError ORegistry::dumpKey(const OUString& sPath, const OUString& sName, sal_In storeError _err = rStoreDir.create(m_file, sFullPath, sName, accessMode); if (_err == store_E_NotExists) - return REG_KEY_NOT_EXISTS; + return RegError::KEY_NOT_EXISTS; else if (_err == store_E_WrongFormat) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; fprintf(stdout, "%s/ %s\n", sIndent.getStr(), OUStringToOString(sName, RTL_TEXTENCODING_UTF8).getStr()); @@ -1736,7 +1736,7 @@ RegError ORegistry::dumpKey(const OUString& sPath, const OUString& sName, sal_In _ret = dumpValue(sSubPath, sSubName, nSpace+2); } - if (_ret) + if (_ret != RegError::NO_ERROR) { return _ret; } @@ -1744,7 +1744,7 @@ RegError ORegistry::dumpKey(const OUString& sPath, const OUString& sName, sal_In _err = rStoreDir.next(iter); } - return REG_NO_ERROR; + return RegError::NO_ERROR; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/registry/source/registry.cxx b/registry/source/registry.cxx index 5daacedbcf6f..15fd9ae5fa3e 100644 --- a/registry/source/registry.cxx +++ b/registry/source/registry.cxx @@ -80,16 +80,16 @@ static RegError REGISTRY_CALLTYPE getName(RegHandle hReg, rtl_uString** pName) if ( pReg->isOpen() ) { rtl_uString_assign(pName, pReg->getName().pData); - return REG_NO_ERROR; + return RegError::NO_ERROR; } else { rtl_uString_new(pName); - return REG_REGISTRY_NOT_OPEN; + return RegError::REGISTRY_NOT_OPEN; } } rtl_uString_new(pName); - return REG_INVALID_REGISTRY; + return RegError::INVALID_REGISTRY; } @@ -114,7 +114,7 @@ static RegError REGISTRY_CALLTYPE createRegistry(rtl_uString* registryName, RegError ret; ORegistry* pReg = new ORegistry(); - if ((ret = pReg->initRegistry(registryName, RegAccessMode::READWRITE, true/*bCreate*/))) + if ((ret = pReg->initRegistry(registryName, RegAccessMode::READWRITE, true/*bCreate*/)) != RegError::NO_ERROR) { delete pReg; *phRegistry = NULL; @@ -123,7 +123,7 @@ static RegError REGISTRY_CALLTYPE createRegistry(rtl_uString* registryName, *phRegistry = pReg; - return REG_NO_ERROR; + return RegError::NO_ERROR; } @@ -138,16 +138,16 @@ static RegError REGISTRY_CALLTYPE openRootKey(RegHandle hReg, { pReg = static_cast<ORegistry*>(hReg); if (!pReg->isOpen()) - return REG_REGISTRY_NOT_OPEN; + return RegError::REGISTRY_NOT_OPEN; } else { phRootKey = NULL; - return REG_INVALID_REGISTRY; + return RegError::INVALID_REGISTRY; } *phRootKey = pReg->getRootKey(); - return REG_NO_ERROR; + return RegError::NO_ERROR; } @@ -161,7 +161,7 @@ static RegError REGISTRY_CALLTYPE openRegistry(rtl_uString* registryName, RegError _ret; ORegistry* pReg = new ORegistry(); - if ((_ret = pReg->initRegistry(registryName, accessMode))) + if ((_ret = pReg->initRegistry(registryName, accessMode)) != RegError::NO_ERROR) { *phRegistry = NULL; delete pReg; @@ -171,7 +171,7 @@ static RegError REGISTRY_CALLTYPE openRegistry(rtl_uString* registryName, *phRegistry = pReg; - return REG_NO_ERROR; + return RegError::NO_ERROR; } @@ -185,9 +185,9 @@ static RegError REGISTRY_CALLTYPE closeRegistry(RegHandle hReg) { pReg = static_cast<ORegistry*>(hReg); if (!pReg->isOpen()) - return REG_REGISTRY_NOT_OPEN; + return RegError::REGISTRY_NOT_OPEN; - RegError ret = REG_NO_ERROR; + RegError ret = RegError::NO_ERROR; if (pReg->release() == 0) { delete(pReg); @@ -199,7 +199,7 @@ static RegError REGISTRY_CALLTYPE closeRegistry(RegHandle hReg) return ret; } else { - return REG_INVALID_REGISTRY; + return RegError::INVALID_REGISTRY; } } @@ -216,10 +216,10 @@ static RegError REGISTRY_CALLTYPE destroyRegistry(RegHandle hReg, { pReg = static_cast<ORegistry*>(hReg); if (!pReg->isOpen()) - return REG_INVALID_REGISTRY; + return RegError::INVALID_REGISTRY; RegError ret = pReg->destroyRegistry(registryName); - if (!ret) + if (ret == RegError::NO_ERROR) { if (!registryName->length) { @@ -230,7 +230,7 @@ static RegError REGISTRY_CALLTYPE destroyRegistry(RegHandle hReg, return ret; } else { - return REG_INVALID_REGISTRY; + return RegError::INVALID_REGISTRY; } } @@ -246,37 +246,37 @@ static RegError REGISTRY_CALLTYPE loadKey(RegHandle hReg, ORegistry* pReg = static_cast< ORegistry* >(hReg); if (!pReg) - return REG_INVALID_REGISTRY; + return RegError::INVALID_REGISTRY; if (!pReg->isOpen()) - return REG_REGISTRY_NOT_OPEN; + return RegError::REGISTRY_NOT_OPEN; ORegKey* pKey = static_cast< ORegKey* >(hKey); if (!pKey) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; if (pKey->getRegistry() != pReg) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; if (pKey->isDeleted()) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; if (pKey->isReadOnly()) - return REG_REGISTRY_READONLY; + return RegError::REGISTRY_READONLY; ORegKey* pNewKey = 0; RegError _ret = pKey->openKey(keyName, reinterpret_cast<RegKeyHandle*>(&pNewKey)); - if (_ret == REG_NO_ERROR) + if (_ret == RegError::NO_ERROR) { pKey->releaseKey(pNewKey); pKey->deleteKey(keyName); } _ret = pKey->createKey(keyName, reinterpret_cast<RegKeyHandle*>(&pNewKey)); - if (_ret != REG_NO_ERROR) + if (_ret != RegError::NO_ERROR) return _ret; _ret = pReg->loadKey(pNewKey, regFileName); - if (_ret != REG_NO_ERROR) + if (_ret != RegError::NO_ERROR) { pKey->releaseKey(pNewKey); pKey->deleteKey(keyName); @@ -297,27 +297,27 @@ static RegError REGISTRY_CALLTYPE saveKey(RegHandle hReg, ORegistry* pReg = static_cast< ORegistry* >(hReg); if (!pReg) - return REG_INVALID_REGISTRY; + return RegError::INVALID_REGISTRY; if (!pReg->isOpen()) - return REG_REGISTRY_NOT_OPEN; + return RegError::REGISTRY_NOT_OPEN; ORegKey* pKey = static_cast< ORegKey* >(hKey); if (!pKey) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; if (pKey->getRegistry() != pReg) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; if (pKey->isDeleted()) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; ORegKey* pNewKey = 0; RegError _ret = pKey->openKey(keyName, reinterpret_cast<RegKeyHandle*>(&pNewKey)); - if (_ret != REG_NO_ERROR) + if (_ret != RegError::NO_ERROR) return _ret; _ret = pReg->saveKey(pNewKey, regFileName); - if (_ret != REG_NO_ERROR) + if (_ret != RegError::NO_ERROR) { (void) pKey->releaseKey(pNewKey); return _ret; @@ -338,29 +338,29 @@ static RegError REGISTRY_CALLTYPE mergeKey(RegHandle hReg, { ORegistry* pReg = static_cast< ORegistry* >(hReg); if (!pReg) - return REG_INVALID_REGISTRY; + return RegError::INVALID_REGISTRY; if (!pReg->isOpen()) - return REG_REGISTRY_NOT_OPEN; + return RegError::REGISTRY_NOT_OPEN; ORegKey* pKey = static_cast< ORegKey* >(hKey); if (!pKey) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; if (pKey->getRegistry() != pReg) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; if (pKey->isDeleted()) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; if (pKey->isReadOnly()) - return REG_REGISTRY_READONLY; + return RegError::REGISTRY_READONLY; if (keyName->length) { ORegKey* pNewKey = 0; RegError _ret = pKey->createKey(keyName, reinterpret_cast<RegKeyHandle*>(&pNewKey)); - if (_ret != REG_NO_ERROR) + if (_ret != RegError::NO_ERROR) return _ret; _ret = pReg->loadKey(pNewKey, regFileName, bWarnings, bReport); - if (_ret != REG_NO_ERROR && (_ret != REG_MERGE_CONFLICT || bWarnings)) + if (_ret != RegError::NO_ERROR && (_ret != RegError::MERGE_CONFLICT || bWarnings)) { if (pNewKey != pKey) (void) pKey->closeKey(pNewKey); @@ -383,17 +383,17 @@ static RegError REGISTRY_CALLTYPE dumpRegistry(RegHandle hReg, { ORegistry* pReg = static_cast< ORegistry* >(hReg); if (!pReg) - return REG_INVALID_REGISTRY; + return RegError::INVALID_REGISTRY; if (!pReg->isOpen()) - return REG_REGISTRY_NOT_OPEN; + return RegError::REGISTRY_NOT_OPEN; ORegKey* pKey = static_cast< ORegKey* >(hKey); if (!pKey) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; if (pKey->getRegistry() != pReg) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; if (pKey->isDeleted()) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; return pReg->dumpRegistry(hKey); } @@ -457,7 +457,7 @@ RegError REGISTRY_CALLTYPE reg_loadKey(RegKeyHandle hKey, if (hKey) pKey = static_cast<ORegKey*>(hKey); else - return REG_INVALID_KEY; + return RegError::INVALID_KEY; return loadKey(pKey->getRegistry(), hKey, keyName, regFileName); } @@ -474,7 +474,7 @@ RegError REGISTRY_CALLTYPE reg_saveKey(RegKeyHandle hKey, if (hKey) pKey = static_cast<ORegKey*>(hKey); else - return REG_INVALID_KEY; + return RegError::INVALID_KEY; return saveKey(pKey->getRegistry(), hKey, keyName, regFileName); } @@ -493,7 +493,7 @@ RegError REGISTRY_CALLTYPE reg_mergeKey(RegKeyHandle hKey, if (hKey) pKey = static_cast<ORegKey*>(hKey); else - return REG_INVALID_KEY; + return RegError::INVALID_KEY; return mergeKey(pKey->getRegistry(), hKey, keyName, regFileName, bWarnings, bReport); } @@ -507,7 +507,7 @@ RegError REGISTRY_CALLTYPE reg_createRegistry(rtl_uString* registryName, RegError ret; ORegistry* pReg = new ORegistry(); - if ((ret = pReg->initRegistry(registryName, RegAccessMode::READWRITE, true/*bCreate*/))) + if ((ret = pReg->initRegistry(registryName, RegAccessMode::READWRITE, true/*bCreate*/)) != RegError::NO_ERROR) { delete pReg; *phRegistry = NULL; @@ -516,7 +516,7 @@ RegError REGISTRY_CALLTYPE reg_createRegistry(rtl_uString* registryName, *phRegistry = pReg; - return REG_NO_ERROR; + return RegError::NO_ERROR; } @@ -557,7 +557,7 @@ RegError REGISTRY_CALLTYPE reg_openRegistry(rtl_uString* registryName, RegError _ret; ORegistry* pReg = new ORegistry(); - if ((_ret = pReg->initRegistry(registryName, accessMode))) + if ((_ret = pReg->initRegistry(registryName, accessMode)) != RegError::NO_ERROR) { delete pReg; *phRegistry = NULL; @@ -566,7 +566,7 @@ RegError REGISTRY_CALLTYPE reg_openRegistry(rtl_uString* registryName, *phRegistry = pReg; - return REG_NO_ERROR; + return RegError::NO_ERROR; } @@ -578,10 +578,10 @@ RegError REGISTRY_CALLTYPE reg_closeRegistry(RegHandle hRegistry) { ORegistry* pReg = static_cast<ORegistry*>(hRegistry); delete(pReg); - return REG_NO_ERROR; + return RegError::NO_ERROR; } else { - return REG_REGISTRY_NOT_OPEN; + return RegError::REGISTRY_NOT_OPEN; } } @@ -606,7 +606,7 @@ RegError REGISTRY_CALLTYPE reg_dumpRegistry(RegKeyHandle hKey) if (hKey) pKey = static_cast<ORegKey*>(hKey); else - return REG_INVALID_KEY; + return RegError::INVALID_KEY; return dumpRegistry(pKey->getRegistry(), hKey); } diff --git a/registry/source/regkey.cxx b/registry/source/regkey.cxx index 7c71336a4e4c..04751101bf80 100644 --- a/registry/source/regkey.cxx +++ b/registry/source/regkey.cxx @@ -74,11 +74,11 @@ RegError REGISTRY_CALLTYPE getKeyName(RegKeyHandle hKey, rtl_uString** pKeyName) if (pKey) { rtl_uString_assign( pKeyName, pKey->getName().pData ); - return REG_NO_ERROR; + return RegError::NO_ERROR; } else { rtl_uString_new(pKeyName); - return REG_INVALID_KEY; + return RegError::INVALID_KEY; } } @@ -94,13 +94,13 @@ RegError REGISTRY_CALLTYPE createKey(RegKeyHandle hKey, ORegKey* pKey = static_cast< ORegKey* >(hKey); if (!pKey) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; if (pKey->isDeleted()) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; if (pKey->isReadOnly()) - return REG_REGISTRY_READONLY; + return RegError::REGISTRY_READONLY; return pKey->createKey(keyName, phNewKey); } @@ -116,10 +116,10 @@ RegError REGISTRY_CALLTYPE openKey(RegKeyHandle hKey, ORegKey* pKey = static_cast< ORegKey* >(hKey); if (!pKey) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; if (pKey->isDeleted()) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; return pKey->openKey(keyName, phOpenKey); } @@ -137,10 +137,10 @@ RegError REGISTRY_CALLTYPE openSubKeys(RegKeyHandle hKey, ORegKey* pKey = static_cast< ORegKey* >(hKey); if (!pKey) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; if (pKey->isDeleted()) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; return pKey->openSubKeys(keyName, pphSubKeys, pnSubKeys); } @@ -152,7 +152,7 @@ RegError REGISTRY_CALLTYPE closeSubKeys(RegKeyHandle* phSubKeys, sal_uInt32 nSubKeys) { if (phSubKeys == 0 || nSubKeys == 0) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; ORegistry* pReg = static_cast<ORegKey*>(phSubKeys[0])->getRegistry(); for (sal_uInt32 i = 0; i < nSubKeys; i++) @@ -161,7 +161,7 @@ RegError REGISTRY_CALLTYPE closeSubKeys(RegKeyHandle* phSubKeys, } rtl_freeMemory(phSubKeys); - return REG_NO_ERROR; + return RegError::NO_ERROR; } @@ -172,13 +172,13 @@ RegError REGISTRY_CALLTYPE deleteKey(RegKeyHandle hKey, { ORegKey* pKey = static_cast< ORegKey* >(hKey); if (!pKey) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; if (pKey->isDeleted()) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; if (pKey->isReadOnly()) - return REG_REGISTRY_READONLY; + return RegError::REGISTRY_READONLY; return pKey->deleteKey(keyName); } @@ -190,7 +190,7 @@ RegError REGISTRY_CALLTYPE closeKey(RegKeyHandle hKey) { ORegKey* pKey = static_cast< ORegKey* >(hKey); if (!pKey) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; return pKey->closeKey(hKey); } @@ -206,27 +206,27 @@ RegError REGISTRY_CALLTYPE setValue(RegKeyHandle hKey, { ORegKey* pKey = static_cast< ORegKey* >(hKey); if (!pKey) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; if (pKey->isDeleted()) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; if (pKey->isReadOnly()) - return REG_REGISTRY_READONLY; + return RegError::REGISTRY_READONLY; OUString valueName("value"); if (keyName->length) { ORegKey* pSubKey = 0; RegError _ret1 = pKey->openKey(keyName, reinterpret_cast<RegKeyHandle*>(&pSubKey)); - if (_ret1 != REG_NO_ERROR) + if (_ret1 != RegError::NO_ERROR) return _ret1; _ret1 = pSubKey->setValue(valueName, valueType, pData, valueSize); - if (_ret1 != REG_NO_ERROR) + if (_ret1 != RegError::NO_ERROR) { RegError _ret2 = pKey->closeKey(pSubKey); - if (_ret2) + if (_ret2 != RegError::NO_ERROR) return _ret2; else return _ret1; @@ -248,27 +248,27 @@ RegError REGISTRY_CALLTYPE setLongListValue(RegKeyHandle hKey, { ORegKey* pKey = static_cast< ORegKey* >(hKey); if (!pKey) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; if (pKey->isDeleted()) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; if (pKey->isReadOnly()) - return REG_REGISTRY_READONLY; + return RegError::REGISTRY_READONLY; OUString valueName("value"); if (keyName->length) { ORegKey* pSubKey = 0; RegError _ret1 = pKey->openKey(keyName, reinterpret_cast<RegKeyHandle*>(&pSubKey)); - if (_ret1 != REG_NO_ERROR) + if (_ret1 != RegError::NO_ERROR) return _ret1; _ret1 = pSubKey->setLongListValue(valueName, pValueList, len); - if (_ret1 != REG_NO_ERROR) + if (_ret1 != RegError::NO_ERROR) { RegError _ret2 = pKey->closeKey(pSubKey); - if (_ret2 != REG_NO_ERROR) + if (_ret2 != RegError::NO_ERROR) return _ret2; else return _ret1; @@ -290,27 +290,27 @@ RegError REGISTRY_CALLTYPE setStringListValue(RegKeyHandle hKey, { ORegKey* pKey = static_cast< ORegKey* >(hKey); if (!pKey) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; if (pKey->isDeleted()) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; if (pKey->isReadOnly()) - return REG_REGISTRY_READONLY; + return RegError::REGISTRY_READONLY; OUString valueName("value"); if (keyName->length) { ORegKey* pSubKey = 0; RegError _ret1 = pKey->openKey(keyName, reinterpret_cast<RegKeyHandle*>(&pSubKey)); - if (_ret1 != REG_NO_ERROR) + if (_ret1 != RegError::NO_ERROR) return _ret1; _ret1 = pSubKey->setStringListValue(valueName, pValueList, len); - if (_ret1 != REG_NO_ERROR) + if (_ret1 != RegError::NO_ERROR) { RegError _ret2 = pKey->closeKey(pSubKey); - if (_ret2 != REG_NO_ERROR) + if (_ret2 != RegError::NO_ERROR) return _ret2; else return _ret1; @@ -332,27 +332,27 @@ RegError REGISTRY_CALLTYPE setUnicodeListValue(RegKeyHandle hKey, { ORegKey* pKey = static_cast< ORegKey* >(hKey); if (!pKey) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; if (pKey->isDeleted()) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; if (pKey->isReadOnly()) - return REG_REGISTRY_READONLY; + return RegError::REGISTRY_READONLY; OUString valueName("value"); if (keyName->length) { ORegKey* pSubKey = 0; RegError _ret1 = pKey->openKey(keyName, reinterpret_cast<RegKeyHandle*>(&pSubKey)); - if (_ret1 != REG_NO_ERROR) + if (_ret1 != RegError::NO_ERROR) return _ret1; _ret1 = pSubKey->setUnicodeListValue(valueName, pValueList, len); - if (_ret1 != REG_NO_ERROR) + if (_ret1 != RegError::NO_ERROR) { RegError _ret2 = pKey->closeKey(pSubKey); - if (_ret2 != REG_NO_ERROR) + if (_ret2 != RegError::NO_ERROR) return _ret2; else return _ret1; @@ -377,10 +377,10 @@ RegError REGISTRY_CALLTYPE getValueInfo(RegKeyHandle hKey, ORegKey* pKey = static_cast< ORegKey* >(hKey); if (!pKey) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; if (pKey->isDeleted()) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; RegValueType valueType; sal_uInt32 valueSize; @@ -390,13 +390,13 @@ RegError REGISTRY_CALLTYPE getValueInfo(RegKeyHandle hKey, { ORegKey* pSubKey = 0; RegError _ret = pKey->openKey(keyName, reinterpret_cast<RegKeyHandle*>(&pSubKey)); - if (_ret != REG_NO_ERROR) + if (_ret != RegError::NO_ERROR) return _ret; - if (pSubKey->getValueInfo(valueName, &valueType, &valueSize) != REG_NO_ERROR) + if (pSubKey->getValueInfo(valueName, &valueType, &valueSize) != RegError::NO_ERROR) { (void) pKey->releaseKey(pSubKey); - return REG_INVALID_VALUE; + return RegError::INVALID_VALUE; } *pValueType = valueType; @@ -406,15 +406,15 @@ RegError REGISTRY_CALLTYPE getValueInfo(RegKeyHandle hKey, } - if (pKey->getValueInfo(valueName, &valueType, &valueSize) != REG_NO_ERROR) + if (pKey->getValueInfo(valueName, &valueType, &valueSize) != RegError::NO_ERROR) { - return REG_INVALID_VALUE; + return RegError::INVALID_VALUE; } *pValueType = valueType; *pValueSize = valueSize; - return REG_NO_ERROR; + return RegError::NO_ERROR; } @@ -426,21 +426,21 @@ RegError REGISTRY_CALLTYPE getValue(RegKeyHandle hKey, { ORegKey* pKey = static_cast< ORegKey* >(hKey); if (!pKey) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; if (pKey->isDeleted()) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; OUString valueName("value"); if (keyName->length) { ORegKey* pSubKey = 0; RegError _ret1 = pKey->openKey(keyName, reinterpret_cast<RegKeyHandle*>(&pSubKey)); - if (_ret1 != REG_NO_ERROR) + if (_ret1 != RegError::NO_ERROR) return _ret1; _ret1 = pSubKey->getValue(valueName, pValue); - if (_ret1 != REG_NO_ERROR) + if (_ret1 != RegError::NO_ERROR) { (void) pKey->releaseKey(pSubKey); return _ret1; @@ -465,21 +465,21 @@ RegError REGISTRY_CALLTYPE getLongListValue(RegKeyHandle hKey, ORegKey* pKey = static_cast< ORegKey* >(hKey); if (!pKey) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; if (pKey->isDeleted()) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; OUString valueName("value"); if (keyName->length) { ORegKey* pSubKey = 0; RegError _ret1 = pKey->openKey(keyName, reinterpret_cast<RegKeyHandle*>(&pSubKey)); - if (_ret1 != REG_NO_ERROR) + if (_ret1 != RegError::NO_ERROR) return _ret1; _ret1 = pSubKey->getLongListValue(valueName, pValueList, pLen); - if (_ret1 != REG_NO_ERROR) + if (_ret1 != RegError::NO_ERROR) { (void) pKey->releaseKey(pSubKey); return _ret1; @@ -504,21 +504,21 @@ RegError REGISTRY_CALLTYPE getStringListValue(RegKeyHandle hKey, ORegKey* pKey = static_cast< ORegKey* >(hKey); if (!pKey) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; if (pKey->isDeleted()) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; OUString valueName("value"); if (keyName->length) { ORegKey* pSubKey = 0; RegError _ret1 = pKey->openKey(keyName, reinterpret_cast<RegKeyHandle*>(&pSubKey)); - if (_ret1 != REG_NO_ERROR) + if (_ret1 != RegError::NO_ERROR) return _ret1; _ret1 = pSubKey->getStringListValue(valueName, pValueList, pLen); - if (_ret1 != REG_NO_ERROR) + if (_ret1 != RegError::NO_ERROR) { (void) pKey->releaseKey(pSubKey); return _ret1; @@ -541,21 +541,21 @@ RegError REGISTRY_CALLTYPE getUnicodeListValue(RegKeyHandle hKey, ORegKey* pKey = static_cast< ORegKey* >(hKey); if (!pKey) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; if (pKey->isDeleted()) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; OUString valueName("value"); if (keyName->length) { ORegKey* pSubKey = 0; RegError _ret1 = pKey->openKey(keyName, reinterpret_cast<RegKeyHandle*>(&pSubKey)); - if (_ret1 != REG_NO_ERROR) + if (_ret1 != RegError::NO_ERROR) return _ret1; _ret1 = pSubKey->getUnicodeListValue(valueName, pValueList, pLen); - if (_ret1 != REG_NO_ERROR) + if (_ret1 != RegError::NO_ERROR) { (void) pKey->releaseKey(pSubKey); return _ret1; @@ -604,11 +604,11 @@ RegError REGISTRY_CALLTYPE freeValueList(RegValueType valueType, } break; default: - return REG_INVALID_VALUE; + return RegError::INVALID_VALUE; } pValueList = NULL; - return REG_NO_ERROR; + return RegError::NO_ERROR; } @@ -621,14 +621,14 @@ RegError REGISTRY_CALLTYPE getResolvedKeyName(RegKeyHandle hKey, { ORegKey* pKey = static_cast< ORegKey* >(hKey); if (!pKey) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; if (pKey->isDeleted()) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; OUString resolvedName; RegError _ret = pKey->getResolvedKeyName(keyName, resolvedName); - if (_ret == REG_NO_ERROR) + if (_ret == RegError::NO_ERROR) rtl_uString_assign(pResolvedName, resolvedName.pData); return _ret; } @@ -643,10 +643,10 @@ RegError REGISTRY_CALLTYPE getKeyNames(RegKeyHandle hKey, { ORegKey* pKey = static_cast< ORegKey* >(hKey); if (!pKey) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; if (pKey->isDeleted()) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; return pKey->getKeyNames(keyName, pSubKeyNames, pnSubKeys); } @@ -664,7 +664,7 @@ RegError REGISTRY_CALLTYPE freeKeyNames(rtl_uString** pKeyNames, rtl_freeMemory(pKeyNames); - return REG_NO_ERROR; + return RegError::NO_ERROR; } @@ -679,7 +679,7 @@ RegError REGISTRY_CALLTYPE reg_createKey(RegKeyHandle hKey, RegKeyHandle* phNewKey) { if (!hKey) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; return createKey(hKey, keyName, phNewKey); } @@ -692,7 +692,7 @@ RegError REGISTRY_CALLTYPE reg_openKey(RegKeyHandle hKey, RegKeyHandle* phOpenKey) { if (!hKey) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; return openKey(hKey, keyName, phOpenKey); } @@ -706,7 +706,7 @@ RegError REGISTRY_CALLTYPE reg_openSubKeys(RegKeyHandle hKey, sal_uInt32* pnSubKeys) { if (!hKey) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; return openSubKeys(hKey, keyName, pphSubKeys, pnSubKeys); } @@ -718,7 +718,7 @@ RegError REGISTRY_CALLTYPE reg_closeSubKeys(RegKeyHandle* pphSubKeys, sal_uInt32 nSubKeys) { if (!pphSubKeys) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; return closeSubKeys(pphSubKeys, nSubKeys); } @@ -730,7 +730,7 @@ RegError REGISTRY_CALLTYPE reg_deleteKey(RegKeyHandle hKey, rtl_uString* keyName) { if (!hKey) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; return deleteKey(hKey, keyName); } @@ -741,7 +741,7 @@ RegError REGISTRY_CALLTYPE reg_deleteKey(RegKeyHandle hKey, RegError REGISTRY_CALLTYPE reg_closeKey(RegKeyHandle hKey) { if (!hKey) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; return closeKey(hKey); } @@ -755,11 +755,11 @@ RegError REGISTRY_CALLTYPE reg_getKeyName(RegKeyHandle hKey, rtl_uString** pKeyN if (hKey) { rtl_uString_assign( pKeyName, static_cast<ORegKey*>(hKey)->getName().pData ); - return REG_NO_ERROR; + return RegError::NO_ERROR; } else { rtl_uString_new( pKeyName ); - return REG_INVALID_KEY; + return RegError::INVALID_KEY; } } @@ -773,7 +773,7 @@ RegError REGISTRY_CALLTYPE reg_setValue(RegKeyHandle hKey, sal_uInt32 valueSize) { if (!hKey) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; return setValue(hKey, keyName, valueType, pData, valueSize); } @@ -787,7 +787,7 @@ RegError REGISTRY_CALLTYPE reg_setLongListValue(RegKeyHandle hKey, sal_uInt32 len) { if (!hKey) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; return setLongListValue(hKey, keyName, pValueList, len); } @@ -801,7 +801,7 @@ RegError REGISTRY_CALLTYPE reg_setStringListValue(RegKeyHandle hKey, sal_uInt32 len) { if (!hKey) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; return setStringListValue(hKey, keyName, pValueList, len); } @@ -815,7 +815,7 @@ RegError REGISTRY_CALLTYPE reg_setUnicodeListValue(RegKeyHandle hKey, sal_uInt32 len) { if (!hKey) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; return setUnicodeListValue(hKey, keyName, pValueList, len); } @@ -829,7 +829,7 @@ RegError REGISTRY_CALLTYPE reg_getValueInfo(RegKeyHandle hKey, sal_uInt32* pValueSize) { if (!hKey) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; return getValueInfo(hKey, keyName, pValueType, pValueSize); } @@ -842,7 +842,7 @@ RegError REGISTRY_CALLTYPE reg_getValue(RegKeyHandle hKey, RegValue pData) { if (!hKey) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; return getValue(hKey, keyName, pData); } @@ -856,7 +856,7 @@ RegError REGISTRY_CALLTYPE reg_getLongListValue(RegKeyHandle hKey, sal_uInt32* pLen) { if (!hKey) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; return getLongListValue(hKey, keyName, pValueList, pLen); } @@ -870,7 +870,7 @@ RegError REGISTRY_CALLTYPE reg_getStringListValue(RegKeyHandle hKey, sal_uInt32* pLen) { if (!hKey) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; return getStringListValue(hKey, keyName, pValueList, pLen); } @@ -884,7 +884,7 @@ RegError REGISTRY_CALLTYPE reg_getUnicodeListValue(RegKeyHandle hKey, sal_uInt32* pLen) { if (!hKey) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; return getUnicodeListValue(hKey, keyName, pValueList, pLen); } @@ -899,7 +899,7 @@ RegError REGISTRY_CALLTYPE reg_freeValueList(RegValueType valueType, if (pValueList) return freeValueList(valueType, pValueList, len); else - return REG_INVALID_VALUE; + return RegError::INVALID_VALUE; } @@ -911,7 +911,7 @@ RegError REGISTRY_CALLTYPE reg_getResolvedKeyName(RegKeyHandle hKey, rtl_uString** pResolvedName) { if (!hKey) - return REG_INVALID_KEY; + return RegError::INVALID_KEY; return getResolvedKeyName(hKey, keyName, firstLinkOnly, pResolvedName); } diff --git a/registry/tools/regcompare.cxx b/registry/tools/regcompare.cxx index 771a2bbba0b1..def055ab7ced 100644 --- a/registry/tools/regcompare.cxx +++ b/registry/tools/regcompare.cxx @@ -1647,7 +1647,7 @@ static bool hasPublishedChildren(Options_Impl const & options, RegistryKey & key { keyName = keyName.copy(keyName.lastIndexOf('/') + 1); RegistryKey subKey; - if (!key.openKey(keyName, subKey)) + if (key.openKey(keyName, subKey) == RegError::NO_ERROR) { if (options.forceOutput()) { @@ -1663,7 +1663,7 @@ static bool hasPublishedChildren(Options_Impl const & options, RegistryKey & key { RegValueType type; sal_uInt32 size; - if (subKey.getValueInfo(OUString(), &type, &size) != REG_NO_ERROR) + if (subKey.getValueInfo(OUString(), &type, &size) != RegError::NO_ERROR) { if (options.forceOutput()) { @@ -1679,7 +1679,7 @@ static bool hasPublishedChildren(Options_Impl const & options, RegistryKey & key { bool published = false; std::vector< sal_uInt8 > value(size); - if (subKey.getValue(OUString(), &value[0]) != REG_NO_ERROR) + if (subKey.getValue(OUString(), &value[0]) != RegError::NO_ERROR) { if (options.forceOutput()) { @@ -1747,7 +1747,7 @@ static sal_uInt32 checkDifferences( { keyName = keyName.copy(keyName.lastIndexOf('/') + 1); RegistryKey subKey; - if (key.openKey(keyName, subKey)) + if (key.openKey(keyName, subKey) != RegError::NO_ERROR) { if (options.forceOutput()) { @@ -1764,7 +1764,7 @@ static sal_uInt32 checkDifferences( { RegValueType type; sal_uInt32 size; - if (subKey.getValueInfo(OUString(), &type, &size) != REG_NO_ERROR) + if (subKey.getValueInfo(OUString(), &type, &size) != RegError::NO_ERROR) { if (options.forceOutput()) { @@ -1780,7 +1780,7 @@ static sal_uInt32 checkDifferences( else if (type == RegValueType::BINARY) { std::vector< sal_uInt8 > value(size); - if (subKey.getValue(OUString(), &value[0]) != REG_NO_ERROR) + if (subKey.getValue(OUString(), &value[0]) != RegError::NO_ERROR) { if (options.forceOutput()) { @@ -1876,13 +1876,13 @@ static sal_uInt32 compareKeys( OUString tmpName; RegError e1 = key1.getValueInfo(tmpName, &valueType1, &size1); RegError e2 = key2.getValueInfo(tmpName, &valueType2, &size2); - if ( (e1 == e2) && (e1 != REG_VALUE_NOT_EXISTS) && (e1 != REG_INVALID_VALUE) ) + if ( (e1 == e2) && (e1 != RegError::VALUE_NOT_EXISTS) && (e1 != RegError::INVALID_VALUE) ) { nError += checkValueDifference(options, key1, valueType1, size1, key2, valueType2, size2); } else { - if ( (e1 != REG_INVALID_VALUE) || (e2 != REG_INVALID_VALUE) ) + if ( (e1 != RegError::INVALID_VALUE) || (e2 != RegError::INVALID_VALUE) ) { if ( options.forceOutput() ) { @@ -1917,7 +1917,7 @@ static sal_uInt32 compareKeys( keyName = keyName.copy( nPos != -1 ? nPos+1 : 0 ); RegistryKey subKey1; - if ( key1.openKey(keyName, subKey1) ) + if ( key1.openKey(keyName, subKey1) != RegError::NO_ERROR ) { if ( options.forceOutput() ) { @@ -1928,7 +1928,7 @@ static sal_uInt32 compareKeys( } RegistryKey subKey2; - if ( key2.openKey(keyName, subKey2) ) + if ( key2.openKey(keyName, subKey2) != RegError::NO_ERROR ) { if ( options.forceOutput() ) { @@ -1975,13 +1975,13 @@ int _cdecl main( int argc, char * argv[] ) OUString regName2( convertToFileUrl(options.getRegName2().c_str(), options.getRegName2().size()) ); Registry reg1, reg2; - if ( reg1.open(regName1, RegAccessMode::READONLY) ) + if ( reg1.open(regName1, RegAccessMode::READONLY) != RegError::NO_ERROR ) { fprintf(stdout, "%s: open registry \"%s\" failed\n", options.getProgramName().c_str(), options.getRegName1().c_str()); return 2; } - if ( reg2.open(regName2, RegAccessMode::READONLY) ) + if ( reg2.open(regName2, RegAccessMode::READONLY) != RegError::NO_ERROR ) { fprintf(stdout, "%s: open registry \"%s\" failed\n", options.getProgramName().c_str(), options.getRegName2().c_str()); @@ -1989,13 +1989,13 @@ int _cdecl main( int argc, char * argv[] ) } RegistryKey key1, key2; - if ( reg1.openRootKey(key1) ) + if ( reg1.openRootKey(key1) != RegError::NO_ERROR ) { fprintf(stdout, "%s: open root key of registry \"%s\" failed\n", options.getProgramName().c_str(), options.getRegName1().c_str()); return 4; } - if ( reg2.openRootKey(key2) ) + if ( reg2.openRootKey(key2) != RegError::NO_ERROR ) { fprintf(stdout, "%s: open root key of registry \"%s\" failed\n", options.getProgramName().c_str(), options.getRegName2().c_str()); @@ -2011,13 +2011,13 @@ int _cdecl main( int argc, char * argv[] ) return 6; } RegistryKey sk1, sk2; - if ( key1.openKey(options.getStartKey(), sk1) ) + if ( key1.openKey(options.getStartKey(), sk1) != RegError::NO_ERROR ) { fprintf(stdout, "%s: open start key of registry \"%s\" failed\n", options.getProgramName().c_str(), options.getRegName1().c_str()); return 7; } - if ( key2.openKey(options.getStartKey(), sk2) ) + if ( key2.openKey(options.getStartKey(), sk2) != RegError::NO_ERROR ) { fprintf(stdout, "%s: open start key of registry \"%s\" failed\n", options.getProgramName().c_str(), options.getRegName2().c_str()); @@ -2047,13 +2047,13 @@ int _cdecl main( int argc, char * argv[] ) key1.releaseKey(); key2.releaseKey(); - if ( reg1.close() ) + if ( reg1.close() != RegError::NO_ERROR ) { fprintf(stdout, "%s: closing registry \"%s\" failed\n", options.getProgramName().c_str(), options.getRegName1().c_str()); return 9; } - if ( reg2.close() ) + if ( reg2.close() != RegError::NO_ERROR ) { fprintf(stdout, "%s: closing registry \"%s\" failed\n", options.getProgramName().c_str(), options.getRegName2().c_str()); diff --git a/registry/tools/regmerge.cxx b/registry/tools/regmerge.cxx index 7a170d72f925..e7578d1c78f1 100644 --- a/registry/tools/regmerge.cxx +++ b/registry/tools/regmerge.cxx @@ -109,9 +109,9 @@ int __cdecl main( int argc, char * argv[] ) Registry reg; OUString regName( convertToFileUrl(args[0].c_str(), args[0].size()) ); - if (reg.open(regName, RegAccessMode::READWRITE) != REG_NO_ERROR) + if (reg.open(regName, RegAccessMode::READWRITE) != RegError::NO_ERROR) { - if (reg.create(regName) != REG_NO_ERROR) + if (reg.create(regName) != RegError::NO_ERROR) { if (options.isVerbose()) fprintf(stderr, "open registry \"%s\" failed\n", args[0].c_str()); @@ -120,7 +120,7 @@ int __cdecl main( int argc, char * argv[] ) } RegistryKey rootKey; - if (reg.openRootKey(rootKey) != REG_NO_ERROR) + if (reg.openRootKey(rootKey) != RegError::NO_ERROR) { if (options.isVerbose()) fprintf(stderr, "open root key of registry \"%s\" failed\n", args[0].c_str()); @@ -132,9 +132,9 @@ int __cdecl main( int argc, char * argv[] ) { OUString targetRegName( convertToFileUrl(args[i].c_str(), args[i].size()) ); RegError _ret = reg.mergeKey(rootKey, mergeKeyName, targetRegName, false, options.isVerbose()); - if (_ret != REG_NO_ERROR) + if (_ret != RegError::NO_ERROR) { - if (_ret == REG_MERGE_CONFLICT) + if (_ret == RegError::MERGE_CONFLICT) { if (options.isVerbose()) fprintf(stderr, "merging registry \"%s\" under key \"%s\" in registry \"%s\".\n", @@ -157,7 +157,7 @@ int __cdecl main( int argc, char * argv[] ) } rootKey.releaseKey(); - if (reg.close() != REG_NO_ERROR) + if (reg.close() != RegError::NO_ERROR) { if (options.isVerbose()) fprintf(stderr, "closing registry \"%s\" failed\n", args[0].c_str()); diff --git a/registry/tools/regview.cxx b/registry/tools/regview.cxx index 6930a8fcc073..e48e0d8156e1 100644 --- a/registry/tools/regview.cxx +++ b/registry/tools/regview.cxx @@ -44,25 +44,25 @@ int __cdecl main( int argc, char * argv[] ) } OUString regName( convertToFileUrl(argv[1], strlen(argv[1])) ); - if (reg_openRegistry(regName.pData, &hReg, RegAccessMode::READONLY)) + if (reg_openRegistry(regName.pData, &hReg, RegAccessMode::READONLY) != RegError::NO_ERROR) { fprintf(stderr, "open registry \"%s\" failed\n", argv[1]); exit(1); } - if (!reg_openRootKey(hReg, &hRootKey)) + if (reg_openRootKey(hReg, &hRootKey) == RegError::NO_ERROR) { if (argc == 3) { OUString keyName( OUString::createFromAscii(argv[2]) ); - if (!reg_openKey(hRootKey, keyName.pData, &hKey)) + if (reg_openKey(hRootKey, keyName.pData, &hKey) == RegError::NO_ERROR) { - if (reg_dumpRegistry(hKey)) + if (reg_dumpRegistry(hKey) != RegError::NO_ERROR) { fprintf(stderr, "dumping registry \"%s\" failed\n", argv[1]); } - if (reg_closeKey(hKey)) + if (reg_closeKey(hKey) != RegError::NO_ERROR) { fprintf(stderr, "closing key \"%s\" of registry \"%s\" failed\n", argv[2], argv[1]); @@ -76,13 +76,13 @@ int __cdecl main( int argc, char * argv[] ) } else { - if (reg_dumpRegistry(hRootKey)) + if (reg_dumpRegistry(hRootKey) != RegError::NO_ERROR) { fprintf(stderr, "dumping registry \"%s\" failed\n", argv[1]); } } - if (reg_closeKey(hRootKey)) + if (reg_closeKey(hRootKey) != RegError::NO_ERROR) { fprintf(stderr, "closing root key of registry \"%s\" failed\n", argv[1]); } @@ -92,7 +92,7 @@ int __cdecl main( int argc, char * argv[] ) fprintf(stderr, "open root key of registry \"%s\" failed\n", argv[1]); } - if (reg_closeRegistry(hReg)) + if (reg_closeRegistry(hReg) != RegError::NO_ERROR) { fprintf(stderr, "closing registry \"%s\" failed\n", argv[1]); exit(1); |