Kaydet (Commit) 7b4ca582 authored tarafından Noel Grandin's avatar Noel Grandin

convert RegError to scoped enum

Change-Id: I55977c38578cb59deb195d91f8948da2e0905b6a
üst 95600ede
......@@ -1452,10 +1452,10 @@ void cppuhelper::ServiceManager::readRdbFile(
bool cppuhelper::ServiceManager::readLegacyRdbFile(rtl::OUString const & uri) {
Registry reg;
switch (reg.open(uri, RegAccessMode::READONLY)) {
case REG_NO_ERROR:
case RegError::NO_ERROR:
break;
case REG_REGISTRY_NOT_EXISTS:
case REG_INVALID_REGISTRY:
case RegError::REGISTRY_NOT_EXISTS:
case RegError::INVALID_REGISTRY:
{
// Ignore empty rdb files (which are at least seen by subordinate
// uno processes during extension registration; Registry::open can
......@@ -1475,16 +1475,16 @@ bool cppuhelper::ServiceManager::readLegacyRdbFile(rtl::OUString const & uri) {
return false;
}
RegistryKey rootKey;
if (reg.openRootKey(rootKey) != REG_NO_ERROR) {
if (reg.openRootKey(rootKey) != RegError::NO_ERROR) {
throw css::uno::DeploymentException(
"Failure reading legacy rdb file " + uri,
static_cast< cppu::OWeakObject * >(this));
}
RegistryKeyArray impls;
switch (rootKey.openSubKeys("IMPLEMENTATIONS", impls)) {
case REG_NO_ERROR:
case RegError::NO_ERROR:
break;
case REG_KEY_NOT_EXISTS:
case RegError::KEY_NOT_EXISTS:
return true;
default:
throw css::uno::DeploymentException(
......@@ -1534,8 +1534,8 @@ rtl::OUString cppuhelper::ServiceManager::readLegacyRdbString(
RegistryKey subkey;
RegValueType t;
sal_uInt32 s(0);
if (key.openKey(path, subkey) != REG_NO_ERROR
|| subkey.getValueInfo(rtl::OUString(), &t, &s) != REG_NO_ERROR
if (key.openKey(path, subkey) != RegError::NO_ERROR
|| subkey.getValueInfo(rtl::OUString(), &t, &s) != RegError::NO_ERROR
|| t != RegValueType::STRING
|| s == 0 || s > static_cast< sal_uInt32 >(SAL_MAX_INT32))
{
......@@ -1545,7 +1545,7 @@ rtl::OUString cppuhelper::ServiceManager::readLegacyRdbString(
}
rtl::OUString val;
std::vector< char > v(s); // assuming sal_uInt32 fits into vector::size_type
if (subkey.getValue(rtl::OUString(), &v[0]) != REG_NO_ERROR
if (subkey.getValue(rtl::OUString(), &v[0]) != RegError::NO_ERROR
|| v.back() != '\0'
|| !rtl_convertStringToUString(
&val.pData, &v[0], static_cast< sal_Int32 >(s - 1),
......@@ -1568,9 +1568,9 @@ void cppuhelper::ServiceManager::readLegacyRdbStrings(
assert(strings != 0);
RegistryKey subkey;
switch (key.openKey(path, subkey)) {
case REG_NO_ERROR:
case RegError::NO_ERROR:
break;
case REG_KEY_NOT_EXISTS:
case RegError::KEY_NOT_EXISTS:
return;
default:
throw css::uno::DeploymentException(
......@@ -1579,7 +1579,7 @@ void cppuhelper::ServiceManager::readLegacyRdbStrings(
}
rtl::OUString prefix(subkey.getName() + "/");
RegistryKeyNames names;
if (subkey.getKeyNames(rtl::OUString(), names) != REG_NO_ERROR) {
if (subkey.getKeyNames(rtl::OUString(), names) != RegError::NO_ERROR) {
throw css::uno::DeploymentException(
"Failure reading legacy rdb file " + uri,
static_cast< cppu::OWeakObject * >(this));
......
......@@ -43,7 +43,7 @@ bool AstModule::dump(RegistryKey& rKey)
localKey = rKey;
}else
{
if (rKey.createKey( OStringToOUString(getFullName(), RTL_TEXTENCODING_UTF8 ), localKey))
if (rKey.createKey( OStringToOUString(getFullName(), RTL_TEXTENCODING_UTF8 ), localKey) != RegError::NO_ERROR)
{
fprintf(stderr, "%s: warning, could not create key '%s' in '%s'\n",
idlc()->getOptions()->getProgramName().getStr(),
......@@ -87,7 +87,7 @@ bool AstModule::dump(RegistryKey& rKey)
void const * pBlob = aBlob.getBlob(&aBlobSize);
if (localKey.setValue(emptyStr, RegValueType::BINARY,
const_cast<RegValue>(pBlob), aBlobSize))
const_cast<RegValue>(pBlob), aBlobSize) != RegError::NO_ERROR)
{
fprintf(stderr, "%s: warning, could not set value of key \"%s\" in %s\n",
idlc()->getOptions()->getProgramName().getStr(),
......@@ -112,7 +112,7 @@ bool AstModule::dump(RegistryKey& rKey)
if ( getNodeType() != NT_root )
{
if (localKey.setValue(emptyStr, RegValueType::BINARY,
const_cast<RegValue>(pBlob), aBlobSize))
const_cast<RegValue>(pBlob), aBlobSize) != RegError::NO_ERROR)
{
fprintf(stderr, "%s: warning, could not set value of key \"%s\" in %s\n",
idlc()->getOptions()->getProgramName().getStr(),
......@@ -132,7 +132,7 @@ bool AstTypeDef::dump(RegistryKey& rKey)
{
OUString emptyStr;
RegistryKey localKey;
if (rKey.createKey( OStringToOUString(getFullName(), RTL_TEXTENCODING_UTF8 ), localKey))
if (rKey.createKey( OStringToOUString(getFullName(), RTL_TEXTENCODING_UTF8 ), localKey) != RegError::NO_ERROR)
{
fprintf(stderr, "%s: warning, could not create key '%s' in '%s'\n",
idlc()->getOptions()->getProgramName().getStr(),
......@@ -152,7 +152,7 @@ bool AstTypeDef::dump(RegistryKey& rKey)
sal_uInt32 aBlobSize;
void const * pBlob = aBlob.getBlob(&aBlobSize);
if (localKey.setValue(emptyStr, RegValueType::BINARY, const_cast<RegValue>(pBlob), aBlobSize))
if (localKey.setValue(emptyStr, RegValueType::BINARY, const_cast<RegValue>(pBlob), aBlobSize) != RegError::NO_ERROR)
{
fprintf(stderr, "%s: warning, could not set value of key \"%s\" in %s\n",
idlc()->getOptions()->getProgramName().getStr(),
......@@ -219,7 +219,7 @@ bool AstService::dump(RegistryKey& rKey)
RegistryKey localKey;
if (rKey.createKey(
OStringToOUString(getFullName(), RTL_TEXTENCODING_UTF8),
localKey)) {
localKey) != RegError::NO_ERROR) {
fprintf(
stderr, "%s: warning, could not create key '%s' in '%s'\n",
idlc()->getOptions()->getProgramName().getStr(),
......@@ -310,7 +310,7 @@ bool AstService::dump(RegistryKey& rKey)
void const * blob = writer.getBlob(&size);
if (localKey.setValue(
emptyStr, RegValueType::BINARY, const_cast< void * >(blob),
size))
size) != RegError::NO_ERROR)
{
fprintf(
stderr, "%s: warning, could not set value of key \"%s\" in %s\n",
......
......@@ -58,7 +58,7 @@ AstConstant* AstEnum::checkValue(AstExpression* pExpr)
bool AstEnum::dump(RegistryKey& rKey)
{
RegistryKey localKey;
if (rKey.createKey( OStringToOUString(getFullName(), RTL_TEXTENCODING_UTF8 ), localKey))
if (rKey.createKey( OStringToOUString(getFullName(), RTL_TEXTENCODING_UTF8 ), localKey) != RegError::NO_ERROR)
{
fprintf(stderr, "%s: warning, could not create key '%s' in '%s'\n",
idlc()->getOptions()->getProgramName().getStr(),
......@@ -92,7 +92,7 @@ bool AstEnum::dump(RegistryKey& rKey)
void const * pBlob = aBlob.getBlob(&aBlobSize);
if (localKey.setValue(emptyStr, RegValueType::BINARY,
const_cast<RegValue>(pBlob), aBlobSize))
const_cast<RegValue>(pBlob), aBlobSize) != RegError::NO_ERROR)
{
fprintf(stderr, "%s: warning, could not set value of key \"%s\" in %s\n",
idlc()->getOptions()->getProgramName().getStr(),
......
......@@ -105,7 +105,7 @@ bool AstInterface::dump(RegistryKey& rKey)
return true;
RegistryKey localKey;
if (rKey.createKey( OStringToOUString(getFullName(), RTL_TEXTENCODING_UTF8 ), localKey))
if (rKey.createKey( OStringToOUString(getFullName(), RTL_TEXTENCODING_UTF8 ), localKey) != RegError::NO_ERROR)
{
fprintf(stderr, "%s: warning, could not create key '%s' in '%s'\n",
idlc()->getOptions()->getProgramName().getStr(),
......@@ -244,7 +244,7 @@ bool AstInterface::dump(RegistryKey& rKey)
sal_uInt32 aBlobSize;
void const * pBlob = aBlob.getBlob(&aBlobSize);
if (localKey.setValue(emptyStr, RegValueType::BINARY, const_cast<RegValue>(pBlob), aBlobSize))
if (localKey.setValue(emptyStr, RegValueType::BINARY, const_cast<RegValue>(pBlob), aBlobSize) != RegError::NO_ERROR)
{
fprintf(stderr, "%s: warning, could not set value of key \"%s\" in %s\n",
idlc()->getOptions()->getProgramName().getStr(),
......
......@@ -78,7 +78,7 @@ bool AstStruct::isType() const {
bool AstStruct::dump(RegistryKey& rKey)
{
RegistryKey localKey;
if (rKey.createKey( OStringToOUString(getFullName(), RTL_TEXTENCODING_UTF8 ), localKey))
if (rKey.createKey( OStringToOUString(getFullName(), RTL_TEXTENCODING_UTF8 ), localKey) != RegError::NO_ERROR)
{
fprintf(stderr, "%s: warning, could not create key '%s' in '%s'\n",
idlc()->getOptions()->getProgramName().getStr(),
......@@ -162,7 +162,7 @@ bool AstStruct::dump(RegistryKey& rKey)
void const * pBlob = aBlob.getBlob(&aBlobSize);
if (localKey.setValue(emptyStr, RegValueType::BINARY,
const_cast<RegValue>(pBlob), aBlobSize))
const_cast<RegValue>(pBlob), aBlobSize) != RegError::NO_ERROR)
{
fprintf(stderr, "%s: warning, could not set value of key \"%s\" in %s\n",
idlc()->getOptions()->getProgramName().getStr(),
......
......@@ -154,7 +154,7 @@ produceFile(const OString& regFileName, sPair_t const*const pDepFile)
OString urlRegTmpName = convertToFileUrl(regTmpName);
Registry regFile;
if ( regFile.create(OStringToOUString(urlRegTmpName, RTL_TEXTENCODING_UTF8)) != REG_NO_ERROR )
if ( regFile.create(OStringToOUString(urlRegTmpName, RTL_TEXTENCODING_UTF8)) != RegError::NO_ERROR )
{
fprintf(stderr, "%s: could not create registry file '%s'\n",
pOptions->getProgramName().getStr(), regTmpName.getStr());
......@@ -165,7 +165,7 @@ produceFile(const OString& regFileName, sPair_t const*const pDepFile)
}
RegistryKey rootKey;
if ( regFile.openRootKey(rootKey) != REG_NO_ERROR )
if ( regFile.openRootKey(rootKey) != RegError::NO_ERROR )
{
fprintf(stderr, "%s: could not open root of registry file '%s'\n",
pOptions->getProgramName().getStr(), regFileName.getStr());
......@@ -179,7 +179,7 @@ produceFile(const OString& regFileName, sPair_t const*const pDepFile)
if ( !idlc()->getRoot()->dump(rootKey) )
{
rootKey.releaseKey();
if (regFile.close() != REG_NO_ERROR)
if (regFile.close() != RegError::NO_ERROR)
{
fprintf(stderr, "%s: could not close registry file '%s'\n",
pOptions->getProgramName().getStr(), regFileName.getStr());
......@@ -191,7 +191,7 @@ produceFile(const OString& regFileName, sPair_t const*const pDepFile)
}
rootKey.releaseKey();
if ( regFile.close() != REG_NO_ERROR )
if ( regFile.close() != RegError::NO_ERROR )
{
fprintf(stderr, "%s: could not close registry file '%s'\n",
pOptions->getProgramName().getStr(), regFileName.getStr());
......
This diff is collapsed.
......@@ -77,77 +77,77 @@ enum class SAL_DLLPUBLIC_RTTI RegValueType
};
/// specifies the possible error codes which can occur using the registry API.
enum SAL_DLLPUBLIC_RTTI RegError
enum class SAL_DLLPUBLIC_RTTI RegError
{
/// no error.
REG_NO_ERROR,
NO_ERROR,
/// internal registry error.
REG_INTERNAL_ERROR,
INTERNAL_ERROR,
/// registry is not open.
REG_REGISTRY_NOT_OPEN,
REGISTRY_NOT_OPEN,
/// registry does not exists.
REG_REGISTRY_NOT_EXISTS,
REGISTRY_NOT_EXISTS,
/// registry is open with readonly access rights.
REG_REGISTRY_READONLY,
REGISTRY_READONLY,
/// destroy a registry failed. There are may be any open keys.
REG_DESTROY_REGISTRY_FAILED,
DESTROY_REGISTRY_FAILED,
/** registry cannot be opened with readwrite access because the registry is already
open with readwrite access anywhere.
*/
REG_CANNOT_OPEN_FOR_READWRITE,
CANNOT_OPEN_FOR_READWRITE,
/** registry is in an invalid state or the registry does not point to
a valid registry data file.
*/
REG_INVALID_REGISTRY,
INVALID_REGISTRY,
/// the key or key handle points to an invalid key or closed key.
REG_KEY_NOT_OPEN,
KEY_NOT_OPEN,
/// the specified keyname points to a nonexisting key.
REG_KEY_NOT_EXISTS,
KEY_NOT_EXISTS,
/// the key with the specified keyname cannot be created.
REG_CREATE_KEY_FAILED,
CREATE_KEY_FAILED,
/// the specified key cannot be deleted. Maybe an open key handle exists to this key.
REG_DELETE_KEY_FAILED,
DELETE_KEY_FAILED,
/** the keyname is invalid. This error will return if the keyname
is NULL but should not be NULL in the context of a called function.
*/
REG_INVALID_KEYNAME,
INVALID_KEYNAME,
/// the key is not in a valid state.
REG_INVALID_KEY,
INVALID_KEY,
/// the key has no value
REG_VALUE_NOT_EXISTS,
VALUE_NOT_EXISTS,
/// setting the specified value of a key failed.
REG_SET_VALUE_FAILED,
SET_VALUE_FAILED,
/// deleting of the key value failed.
REG_DELETE_VALUE_FAILED,
DELETE_VALUE_FAILED,
/// the key has a invalid value or the value type is unknown.
REG_INVALID_VALUE,
INVALID_VALUE,
/// merging a key, the value and all subkeys failed.
REG_MERGE_ERROR,
MERGE_ERROR,
/** conflicts exists during the merge process of a key. This could happen if
the value of a key already exists and the merge process will replace it.
*/
REG_MERGE_CONFLICT,
MERGE_CONFLICT,
/** a recursion was detected resolving different link targets (no longer
used).
*/
REG_DETECT_RECURSION,
DETECT_RECURSION,
/** the link is invalid and can not be resolved (now used by all
link-related operations, as links are no longer supported).
*/
REG_INVALID_LINK,
INVALID_LINK,
/// the specified linkname is not valid (no longer used).
REG_INVALID_LINKNAME,
INVALID_LINKNAME,
/// the linknane is not valid (no longer used).
REG_INVALID_LINKTARGET,
INVALID_LINKTARGET,
/// the link target points to a nonexisting key (no longer used).
REG_LINKTARGET_NOT_EXIST,
LINKTARGET_NOT_EXIST,
/// the reserved buffer for the resolved keyname is to small.
REG_BUFFERSIZE_TOSMALL
BUFFERSIZE_TOSMALL
};
/// specify the calling convention for the registry API
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -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());
......
......@@ -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());
......
......@@ -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);
......
......@@ -103,11 +103,11 @@ Cursor::Cursor(
prefix_ += "/";
}
RegError e = key_.getKeyNames("", names_);
if (e != REG_NO_ERROR) {
if (e != RegError::NO_ERROR) {
throw FileFormatException(
key_.getRegistryName(),
("legacy format: cannot get sub-key names of " + key_.getName()
+ ": " + OUString::number(e)));
+ ": " + OUString::number(static_cast<int>(e))));
}
}
}
......@@ -150,11 +150,11 @@ private:
std::vector< OUString > Module::getMemberNames() const {
RegistryKeyNames names;
RegError e = key_.getKeyNames("", names);
if (e != REG_NO_ERROR) {
if (e != RegError::NO_ERROR) {
throw FileFormatException(
key_.getRegistryName(),
("legacy format: cannot get sub-key names of " + key_.getName()
+ ": " + OUString::number(e)));
+ ": " + OUString::number(static_cast<int>(e))));
}
std::vector< OUString > ns;
for (sal_uInt32 i = 0; i != names.getLength(); ++i) {
......@@ -168,11 +168,11 @@ typereg::Reader getReader(RegistryKey & key, std::vector< char > * buffer) {
RegValueType type;
sal_uInt32 size;
RegError e = key.getValueInfo("", &type, &size);
if (e != REG_NO_ERROR) {
if (e != RegError::NO_ERROR) {
throw FileFormatException(
key.getRegistryName(),
("legacy format: cannot get value info about key " + key.getName()
+ ": " + OUString::number(e)));
+ ": " + OUString::number(static_cast<int>(e))));
}
if (type != RegValueType::BINARY) {
throw FileFormatException(
......@@ -190,11 +190,11 @@ typereg::Reader getReader(RegistryKey & key, std::vector< char > * buffer) {
}
buffer->resize(static_cast< std::vector< char >::size_type >(size));
e = key.getValue("", &(*buffer)[0]);
if (e != REG_NO_ERROR) {
if (e != RegError::NO_ERROR) {
throw FileFormatException(
key.getRegistryName(),
("legacy format: cannot get binary value of key " + key.getName()
+ ": " + OUString::number(e)));
+ ": " + OUString::number(static_cast<int>(e))));
}
typereg::Reader reader(&(*buffer)[0], size, false, TYPEREG_VERSION_1);
if (!reader.isValid()) {
......@@ -213,9 +213,9 @@ rtl::Reference< Entity > readEntity(
RegistryKey sub;
RegError e = key.openKey(path, sub);
switch (e) {
case REG_NO_ERROR:
case RegError::NO_ERROR:
break;
case REG_KEY_NOT_EXISTS:
case RegError::KEY_NOT_EXISTS:
if (probe) {
return rtl::Reference< Entity >();
}
......@@ -224,7 +224,7 @@ rtl::Reference< Entity > readEntity(
throw FileFormatException(
key.getRegistryName(),
("legacy format: cannot open sub-key " + path + " of "
+ key.getName() + ": " + OUString::number(e)));
+ key.getName() + ": " + OUString::number(static_cast<int>(e))));
}
std::vector< char > buf;
typereg::Reader reader(getReader(sub, &buf));
......@@ -725,9 +725,9 @@ rtl::Reference< Entity > readEntity(
RegistryKey key2;
e = ucr.openKey(basePath, key2);
switch (e) {
case REG_NO_ERROR:
case RegError::NO_ERROR:
break;
case REG_KEY_NOT_EXISTS:
case RegError::KEY_NOT_EXISTS:
throw FileFormatException(
key.getRegistryName(),
("legacy format: unknown super-type " + basePath
......@@ -736,7 +736,7 @@ rtl::Reference< Entity > readEntity(
throw FileFormatException(
key.getRegistryName(),
("legacy format: cannot open ucr sub-key " + basePath
+ ": " + OUString::number(e)));
+ ": " + OUString::number(static_cast<int>(e))));
}
std::vector< char > buf2;
typereg::Reader reader2(getReader(key2, &buf2));
......@@ -798,28 +798,28 @@ LegacyProvider::LegacyProvider(Manager & manager, OUString const & uri):
Registry reg;
RegError e = reg.open(uri, RegAccessMode::READONLY);
switch (e) {
case REG_NO_ERROR:
case RegError::NO_ERROR:
break;
case REG_REGISTRY_NOT_EXISTS:
case RegError::REGISTRY_NOT_EXISTS:
throw NoSuchFileException(uri);
default:
throw FileFormatException(
uri, "cannot open legacy file: " + OUString::number(e));
uri, "cannot open legacy file: " + OUString::number(static_cast<int>(e)));
}
RegistryKey root;
e = reg.openRootKey(root);
if (e != REG_NO_ERROR) {
if (e != RegError::NO_ERROR) {
throw FileFormatException(
uri, "legacy format: cannot open root key: " + OUString::number(e));
uri, "legacy format: cannot open root key: " + OUString::number(static_cast<int>(e)));
}
e = root.openKey("UCR", ucr_);
switch (e) {
case REG_NO_ERROR:
case REG_KEY_NOT_EXISTS: // such effectively empty files exist in the wild
case RegError::NO_ERROR:
case RegError::KEY_NOT_EXISTS: // such effectively empty files exist in the wild
break;
default:
throw FileFormatException(
uri, "legacy format: cannot open UCR key: " + OUString::number(e));
uri, "legacy format: cannot open UCR key: " + OUString::number(static_cast<int>(e)));
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment