Kaydet (Commit) 95600ede authored tarafından Noel Grandin's avatar Noel Grandin

convert RegValueType to scoped enum

Change-Id: Ic672e75db4d7323760577b19490ffa28d38965b6
üst 1f345247
......@@ -1536,7 +1536,7 @@ rtl::OUString cppuhelper::ServiceManager::readLegacyRdbString(
sal_uInt32 s(0);
if (key.openKey(path, subkey) != REG_NO_ERROR
|| subkey.getValueInfo(rtl::OUString(), &t, &s) != REG_NO_ERROR
|| t != RG_VALUETYPE_STRING
|| t != RegValueType::STRING
|| s == 0 || s > static_cast< sal_uInt32 >(SAL_MAX_INT32))
{
throw css::uno::DeploymentException(
......
......@@ -86,7 +86,7 @@ bool AstModule::dump(RegistryKey& rKey)
sal_uInt32 aBlobSize;
void const * pBlob = aBlob.getBlob(&aBlobSize);
if (localKey.setValue(emptyStr, RG_VALUETYPE_BINARY,
if (localKey.setValue(emptyStr, RegValueType::BINARY,
const_cast<RegValue>(pBlob), aBlobSize))
{
fprintf(stderr, "%s: warning, could not set value of key \"%s\" in %s\n",
......@@ -111,7 +111,7 @@ bool AstModule::dump(RegistryKey& rKey)
if ( getNodeType() != NT_root )
{
if (localKey.setValue(emptyStr, RG_VALUETYPE_BINARY,
if (localKey.setValue(emptyStr, RegValueType::BINARY,
const_cast<RegValue>(pBlob), aBlobSize))
{
fprintf(stderr, "%s: warning, could not set value of key \"%s\" in %s\n",
......@@ -152,7 +152,7 @@ bool AstTypeDef::dump(RegistryKey& rKey)
sal_uInt32 aBlobSize;
void const * pBlob = aBlob.getBlob(&aBlobSize);
if (localKey.setValue(emptyStr, RG_VALUETYPE_BINARY, const_cast<RegValue>(pBlob), aBlobSize))
if (localKey.setValue(emptyStr, RegValueType::BINARY, const_cast<RegValue>(pBlob), aBlobSize))
{
fprintf(stderr, "%s: warning, could not set value of key \"%s\" in %s\n",
idlc()->getOptions()->getProgramName().getStr(),
......@@ -309,7 +309,7 @@ bool AstService::dump(RegistryKey& rKey)
sal_uInt32 size;
void const * blob = writer.getBlob(&size);
if (localKey.setValue(
emptyStr, RG_VALUETYPE_BINARY, const_cast< void * >(blob),
emptyStr, RegValueType::BINARY, const_cast< void * >(blob),
size))
{
fprintf(
......
......@@ -91,7 +91,7 @@ bool AstEnum::dump(RegistryKey& rKey)
sal_uInt32 aBlobSize;
void const * pBlob = aBlob.getBlob(&aBlobSize);
if (localKey.setValue(emptyStr, RG_VALUETYPE_BINARY,
if (localKey.setValue(emptyStr, RegValueType::BINARY,
const_cast<RegValue>(pBlob), aBlobSize))
{
fprintf(stderr, "%s: warning, could not set value of key \"%s\" in %s\n",
......
......@@ -244,7 +244,7 @@ bool AstInterface::dump(RegistryKey& rKey)
sal_uInt32 aBlobSize;
void const * pBlob = aBlob.getBlob(&aBlobSize);
if (localKey.setValue(emptyStr, RG_VALUETYPE_BINARY, const_cast<RegValue>(pBlob), aBlobSize))
if (localKey.setValue(emptyStr, RegValueType::BINARY, const_cast<RegValue>(pBlob), aBlobSize))
{
fprintf(stderr, "%s: warning, could not set value of key \"%s\" in %s\n",
idlc()->getOptions()->getProgramName().getStr(),
......
......@@ -161,7 +161,7 @@ bool AstStruct::dump(RegistryKey& rKey)
sal_uInt32 aBlobSize;
void const * pBlob = aBlob.getBlob(&aBlobSize);
if (localKey.setValue(emptyStr, RG_VALUETYPE_BINARY,
if (localKey.setValue(emptyStr, RegValueType::BINARY,
const_cast<RegValue>(pBlob), aBlobSize))
{
fprintf(stderr, "%s: warning, could not set value of key \"%s\" in %s\n",
......
......@@ -322,7 +322,7 @@ public:
RegistryValueList()
: m_length(0)
, m_pValueList(NULL)
, m_valueType(RG_VALUETYPE_NOT_DEFINED)
, m_valueType(RegValueType::NOT_DEFINED)
{}
/// Destructor, the internal value list will be freed.
......@@ -1018,7 +1018,7 @@ inline RegError RegistryKey::getLongListValue(const rtl::OUString& keyName,
return ret;
} else
{
rValueList.setValueList(m_registry, RG_VALUETYPE_LONGLIST,
rValueList.setValueList(m_registry, RegValueType::LONGLIST,
pValueList, length);
return ret;
}
......@@ -1041,7 +1041,7 @@ inline RegError RegistryKey::getStringListValue(const rtl::OUString& keyName,
return ret;
} else
{
rValueList.setValueList(m_registry, RG_VALUETYPE_STRINGLIST,
rValueList.setValueList(m_registry, RegValueType::STRINGLIST,
pValueList, length);
return ret;
}
......@@ -1064,7 +1064,7 @@ inline RegError RegistryKey::getUnicodeListValue(const rtl::OUString& keyName,
return ret;
} else
{
rValueList.setValueList(m_registry, RG_VALUETYPE_UNICODELIST,
rValueList.setValueList(m_registry, RegValueType::UNICODELIST,
pValueList, length);
return ret;
}
......
......@@ -56,24 +56,24 @@ namespace o3tl
to define own data structures and store these types in the registry. The UNO
core reflection data is stored as a binary blob in the type registry.
*/
enum SAL_DLLPUBLIC_RTTI RegValueType
enum class SAL_DLLPUBLIC_RTTI RegValueType
{
/// The key has no value or the value type is unknown.
RG_VALUETYPE_NOT_DEFINED,
NOT_DEFINED,
/// The key has a value of type long
RG_VALUETYPE_LONG,
LONG,
/// The key has a value of type ascii string
RG_VALUETYPE_STRING,
STRING,
/// The key has a value of type unicode string
RG_VALUETYPE_UNICODE,
UNICODE,
/// The key has a value of type binary
RG_VALUETYPE_BINARY,
BINARY,
/// The key has a value of type long list
RG_VALUETYPE_LONGLIST,
LONGLIST,
/// The key has a value of type ascii string list
RG_VALUETYPE_STRINGLIST,
STRINGLIST,
/// The key has a value of type unicode string list
RG_VALUETYPE_UNICODELIST
UNICODELIST
};
/// specifies the possible error codes which can occur using the registry API.
......
......@@ -238,7 +238,7 @@ RegError ORegKey::getValueInfo(const OUString& valueName, RegValueType* pValueTy
if ( rValue.create(m_pRegistry->getStoreFile(), m_name + m_pRegistry->ROOT, sImplValueName, accessMode) )
{
*pValueType = RG_VALUETYPE_NOT_DEFINED;
*pValueType = RegValueType::NOT_DEFINED;
*pValueSize = 0;
return REG_VALUE_NOT_EXISTS;
}
......@@ -262,12 +262,12 @@ RegError ORegKey::getValueInfo(const OUString& valueName, RegValueType* pValueTy
readUINT32(pBuffer+VALUE_TYPEOFFSET, size);
*pValueType = (RegValueType)type;
// if (*pValueType == RG_VALUETYPE_UNICODE)
// if (*pValueType == RegValueType::UNICODE)
// {
// *pValueSize = (size / 2) * sizeof(sal_Unicode);
// } else
// {
if (*pValueType > 4)
if (*pValueType > RegValueType::BINARY)
{
rtl_freeMemory(pBuffer);
pBuffer = static_cast<sal_uInt8*>(rtl_allocateMemory(4));
......@@ -297,7 +297,7 @@ RegError ORegKey::setValue(const OUString& valueName, RegValueType vType, RegVal
return REG_REGISTRY_READONLY;
}
if (vType > 4)
if (vType > RegValueType::BINARY)
{
return REG_INVALID_VALUE;
}
......@@ -322,19 +322,19 @@ RegError ORegKey::setValue(const OUString& valueName, RegValueType vType, RegVal
switch (vType)
{
case RG_VALUETYPE_NOT_DEFINED:
case RegValueType::NOT_DEFINED:
memcpy(pBuffer+VALUE_HEADEROFFSET, value, size);
break;
case RG_VALUETYPE_LONG:
case RegValueType::LONG:
writeINT32(pBuffer+VALUE_HEADEROFFSET, *static_cast<sal_Int32*>(value));
break;
case RG_VALUETYPE_STRING:
case RegValueType::STRING:
writeUtf8(pBuffer+VALUE_HEADEROFFSET, static_cast<const sal_Char*>(value));
break;
case RG_VALUETYPE_UNICODE:
case RegValueType::UNICODE:
writeString(pBuffer+VALUE_HEADEROFFSET, static_cast<const sal_Unicode*>(value));
break;
case RG_VALUETYPE_BINARY:
case RegValueType::BINARY:
memcpy(pBuffer+VALUE_HEADEROFFSET, value, size);
break;
default:
......@@ -386,7 +386,7 @@ RegError ORegKey::setLongListValue(const OUString& valueName, sal_Int32* pValueL
size += len * 4;
sal_uInt8 type = (sal_uInt8)RG_VALUETYPE_LONGLIST;
sal_uInt8 type = (sal_uInt8)RegValueType::LONGLIST;
pBuffer = static_cast<sal_uInt8*>(rtl_allocateMemory(VALUE_HEADERSIZE + size));
memcpy(pBuffer, &type, 1);
......@@ -449,7 +449,7 @@ RegError ORegKey::setStringListValue(const OUString& valueName, sal_Char** pValu
size += 4 + strlen(pValueList[i]) + 1;
}
sal_uInt8 type = (sal_uInt8)RG_VALUETYPE_STRINGLIST;
sal_uInt8 type = (sal_uInt8)RegValueType::STRINGLIST;
pBuffer = static_cast<sal_uInt8*>(rtl_allocateMemory(VALUE_HEADERSIZE + size));
memcpy(pBuffer, &type, 1);
......@@ -517,7 +517,7 @@ RegError ORegKey::setUnicodeListValue(const OUString& valueName, sal_Unicode** p
size += 4 + ((rtl_ustr_getLength(pValueList[i]) +1) * 2);
}
sal_uInt8 type = (sal_uInt8)RG_VALUETYPE_UNICODELIST;
sal_uInt8 type = (sal_uInt8)RegValueType::UNICODELIST;
pBuffer = static_cast<sal_uInt8*>(rtl_allocateMemory(VALUE_HEADERSIZE + size));
memcpy(pBuffer, &type, 1);
......@@ -600,7 +600,7 @@ RegError ORegKey::getValue(const OUString& valueName, RegValue value) const
rtl_freeMemory(pBuffer);
if (valueType > 4)
if (valueType > RegValueType::BINARY)
{
return REG_INVALID_VALUE;
}
......@@ -620,25 +620,25 @@ RegError ORegKey::getValue(const OUString& valueName, RegValue value) const
switch (valueType)
{
case RG_VALUETYPE_NOT_DEFINED:
case RegValueType::NOT_DEFINED:
memcpy(value, pBuffer, valueSize);
break;
case RG_VALUETYPE_LONG:
case RegValueType::LONG:
readINT32(pBuffer, *static_cast<sal_Int32*>(value));
break;
case RG_VALUETYPE_STRING:
case RegValueType::STRING:
readUtf8(pBuffer, static_cast<sal_Char*>(value), valueSize);
break;
case RG_VALUETYPE_UNICODE:
case RegValueType::UNICODE:
readString(pBuffer, static_cast<sal_Unicode*>(value), valueSize);
break;
case RG_VALUETYPE_BINARY:
case RegValueType::BINARY:
memcpy(value, pBuffer, valueSize);
break;
// coverity[dead_error_begin] - following conditions exist to avoid compiler warning
case RG_VALUETYPE_LONGLIST:
case RG_VALUETYPE_STRINGLIST:
case RG_VALUETYPE_UNICODELIST:
case RegValueType::LONGLIST:
case RegValueType::STRINGLIST:
case RegValueType::UNICODELIST:
memcpy(value, pBuffer, valueSize);
break;
}
......@@ -697,7 +697,7 @@ RegError ORegKey::getLongListValue(const OUString& valueName, sal_Int32** pValue
sal_uInt8 type = *((sal_uInt8*)pBuffer);
valueType = (RegValueType)type;
if (valueType != RG_VALUETYPE_LONGLIST)
if (valueType != RegValueType::LONGLIST)
{
pValueList = NULL;
*pLen = 0;
......@@ -811,7 +811,7 @@ RegError ORegKey::getStringListValue(const OUString& valueName, sal_Char*** pVal
sal_uInt8 type = *((sal_uInt8*)pBuffer);
valueType = (RegValueType)type;
if (valueType != RG_VALUETYPE_STRINGLIST)
if (valueType != RegValueType::STRINGLIST)
{
pValueList = NULL;
*pLen = 0;
......@@ -917,7 +917,7 @@ RegError ORegKey::getUnicodeListValue(const OUString& valueName, sal_Unicode***
sal_uInt8 type = *((sal_uInt8*)pBuffer);
valueType = (RegValueType)type;
if (valueType != RG_VALUETYPE_UNICODELIST)
if (valueType != RegValueType::UNICODELIST)
{
pValueList = NULL;
*pLen = 0;
......
......@@ -1078,7 +1078,7 @@ RegError ORegistry::loadAndSaveValue(ORegKey* pTargetKey,
if (!rValue.create(rTargetFile, sTargetPath, valueName, VALUE_MODE_OPEN))
{
if (valueType == RG_VALUETYPE_BINARY)
if (valueType == RegValueType::BINARY)
{
_ret = checkBlop(
rValue, sTargetPath, valueSize, pBuffer+VALUE_HEADEROFFSET,
......@@ -1153,7 +1153,7 @@ RegError ORegistry::checkBlop(OStoreStream& rValue,
readUINT32(pBuffer+VALUE_TYPEOFFSET, valueSize);
rtl_freeMemory(pBuffer);
if (valueType == RG_VALUETYPE_BINARY)
if (valueType == RegValueType::BINARY)
{
pBuffer = static_cast<sal_uInt8*>(rtl_allocateMemory(valueSize));
if (!rValue.readAt(VALUE_HEADEROFFSET, pBuffer, valueSize, rwBytes) &&
......@@ -1303,7 +1303,7 @@ RegError ORegistry::mergeModuleValue(OStoreStream& rTargetValue,
const sal_uInt8* pBlop = writer.getBlop();
sal_uInt32 aBlopSize = writer.getBlopSize();
sal_uInt8 type = (sal_uInt8)RG_VALUETYPE_BINARY;
sal_uInt8 type = (sal_uInt8)RegValueType::BINARY;
sal_uInt8* pBuffer = static_cast<sal_uInt8*>(rtl_allocateMemory(VALUE_HEADERSIZE + aBlopSize));
memcpy(pBuffer, &type, 1);
......@@ -1509,12 +1509,12 @@ RegError ORegistry::dumpValue(const OUString& sPath, const OUString& sName, sal_
const sal_Char* indent = sIndent.getStr();
switch (valueType)
{
case 0:
case RegValueType::NOT_DEFINED:
fprintf(stdout, "%sValue: Type = VALUETYPE_NOT_DEFINED\n", indent);
break;
case 1:
case RegValueType::LONG:
{
fprintf(stdout, "%sValue: Type = RG_VALUETYPE_LONG\n", indent);
fprintf(stdout, "%sValue: Type = RegValueType::LONG\n", indent);
fprintf(
stdout, "%s Size = %lu\n", indent,
sal::static_int_cast< unsigned long >(valueSize));
......@@ -1525,11 +1525,11 @@ RegError ORegistry::dumpValue(const OUString& sPath, const OUString& sName, sal_
fprintf(stdout, "%ld\n", sal::static_int_cast< long >(value));
}
break;
case 2:
case RegValueType::STRING:
{
sal_Char* value = static_cast<sal_Char*>(rtl_allocateMemory(valueSize));
readUtf8(pBuffer, value, valueSize);
fprintf(stdout, "%sValue: Type = RG_VALUETYPE_STRING\n", indent);
fprintf(stdout, "%sValue: Type = RegValueType::STRING\n", indent);
fprintf(
stdout, "%s Size = %lu\n", indent,
sal::static_int_cast< unsigned long >(valueSize));
......@@ -1537,10 +1537,10 @@ RegError ORegistry::dumpValue(const OUString& sPath, const OUString& sName, sal_
rtl_freeMemory(value);
}
break;
case 3:
case RegValueType::UNICODE:
{
sal_uInt32 size = (valueSize / 2) * sizeof(sal_Unicode);
fprintf(stdout, "%sValue: Type = RG_VALUETYPE_UNICODE\n", indent);
fprintf(stdout, "%sValue: Type = RegValueType::UNICODE\n", indent);
fprintf(
stdout, "%s Size = %lu\n", indent,
sal::static_int_cast< unsigned long >(valueSize));
......@@ -1554,9 +1554,9 @@ RegError ORegistry::dumpValue(const OUString& sPath, const OUString& sName, sal_
delete[] value;
}
break;
case 4:
case RegValueType::BINARY:
{
fprintf(stdout, "%sValue: Type = RG_VALUETYPE_BINARY\n", indent);
fprintf(stdout, "%sValue: Type = RegValueType::BINARY\n", indent);
fprintf(
stdout, "%s Size = %lu\n", indent,
sal::static_int_cast< unsigned long >(valueSize));
......@@ -1567,14 +1567,14 @@ RegError ORegistry::dumpValue(const OUString& sPath, const OUString& sName, sal_
sIndent + " ");
}
break;
case 5:
case RegValueType::LONGLIST:
{
sal_uInt32 offset = 4; // initial 4 bytes for the size of the array
sal_uInt32 len = 0;
readUINT32(pBuffer, len);
fprintf(stdout, "%sValue: Type = RG_VALUETYPE_LONGLIST\n", indent);
fprintf(stdout, "%sValue: Type = RegValueType::LONGLIST\n", indent);
fprintf(
stdout, "%s Size = %lu\n", indent,
sal::static_int_cast< unsigned long >(valueSize));
......@@ -1599,7 +1599,7 @@ RegError ORegistry::dumpValue(const OUString& sPath, const OUString& sName, sal_
}
}
break;
case 6:
case RegValueType::STRINGLIST:
{
sal_uInt32 offset = 4; // initial 4 bytes for the size of the array
sal_uInt32 sLen = 0;
......@@ -1607,7 +1607,7 @@ RegError ORegistry::dumpValue(const OUString& sPath, const OUString& sName, sal_
readUINT32(pBuffer, len);
fprintf(stdout, "%sValue: Type = RG_VALUETYPE_STRINGLIST\n", indent);
fprintf(stdout, "%sValue: Type = RegValueType::STRINGLIST\n", indent);
fprintf(
stdout, "%s Size = %lu\n", indent,
sal::static_int_cast< unsigned long >(valueSize));
......@@ -1636,7 +1636,7 @@ RegError ORegistry::dumpValue(const OUString& sPath, const OUString& sName, sal_
}
}
break;
case 7:
case RegValueType::UNICODELIST:
{
sal_uInt32 offset = 4; // initial 4 bytes for the size of the array
sal_uInt32 sLen = 0;
......@@ -1644,7 +1644,7 @@ RegError ORegistry::dumpValue(const OUString& sPath, const OUString& sName, sal_
readUINT32(pBuffer, len);
fprintf(stdout, "%sValue: Type = RG_VALUETYPE_UNICODELIST\n", indent);
fprintf(stdout, "%sValue: Type = RegValueType::UNICODELIST\n", indent);
fprintf(
stdout, "%s Size = %lu\n", indent,
sal::static_int_cast< unsigned long >(valueSize));
......
......@@ -372,7 +372,7 @@ RegError REGISTRY_CALLTYPE getValueInfo(RegKeyHandle hKey,
RegValueType* pValueType,
sal_uInt32* pValueSize)
{
*pValueType = RG_VALUETYPE_NOT_DEFINED;
*pValueType = RegValueType::NOT_DEFINED;
*pValueSize = 0;
ORegKey* pKey = static_cast< ORegKey* >(hKey);
......@@ -576,12 +576,12 @@ RegError REGISTRY_CALLTYPE freeValueList(RegValueType valueType,
{
switch (valueType)
{
case 5:
case RegValueType::LONGLIST:
{
rtl_freeMemory(pValueList);
}
break;
case 6:
case RegValueType::STRINGLIST:
{
sal_Char** pVList = static_cast<sal_Char**>(pValueList);
for (sal_uInt32 i=0; i < len; i++)
......@@ -592,7 +592,7 @@ RegError REGISTRY_CALLTYPE freeValueList(RegValueType valueType,
rtl_freeMemory(pVList);
}
break;
case 7:
case RegValueType::UNICODELIST:
{
sal_Unicode** pVList = static_cast<sal_Unicode**>(pValueList);
for (sal_uInt32 i=0; i < len; i++)
......
This diff is collapsed.
......@@ -131,7 +131,7 @@ void test_coreReflection()
const sal_uInt8* pBlop = writer.getBlop();
sal_uInt32 aBlopSize = writer.getBlopSize();
REG_ENSURE(!key2.setValue(OUString(), RG_VALUETYPE_BINARY, (void*)pBlop, aBlopSize), "testCoreReflection error 9");
REG_ENSURE(!key2.setValue(OUString(), RegValueType::BINARY, (void*)pBlop, aBlopSize), "testCoreReflection error 9");
sal_uInt8* readBlop = (sal_uInt8*)rtl_allocateMemory(aBlopSize);
REG_ENSURE(!key2.getValue(OUString(), (void*)readBlop) , "testCoreReflection error 9a");
......@@ -178,7 +178,7 @@ void test_coreReflection()
const sal_uInt8* pBlop = writer.getBlop();
sal_uInt32 aBlopSize = writer.getBlopSize();
REG_ENSURE(!key3.setValue(OUString(), RG_VALUETYPE_BINARY, (void*)pBlop, aBlopSize), "testCoreReflection error 9a");
REG_ENSURE(!key3.setValue(OUString(), RegValueType::BINARY, (void*)pBlop, aBlopSize), "testCoreReflection error 9a");
}
{
......@@ -205,7 +205,7 @@ void test_coreReflection()
const sal_uInt8* pBlop = writer.getBlop();
sal_uInt32 aBlopSize = writer.getBlopSize();
REG_ENSURE(!key4.setValue(OUString(), RG_VALUETYPE_BINARY, (void*)pBlop, aBlopSize), "testCoreReflection error 9b");
REG_ENSURE(!key4.setValue(OUString(), RegValueType::BINARY, (void*)pBlop, aBlopSize), "testCoreReflection error 9b");
}
{
......@@ -246,7 +246,7 @@ void test_coreReflection()
const sal_uInt8* pBlop = writer.getBlop();
sal_uInt32 aBlopSize = writer.getBlopSize();
REG_ENSURE(!key5.setValue(OUString(), RG_VALUETYPE_BINARY, (void*)pBlop, aBlopSize), "testCoreReflection error 9c");
REG_ENSURE(!key5.setValue(OUString(), RegValueType::BINARY, (void*)pBlop, aBlopSize), "testCoreReflection error 9c");
sal_uInt8* readBlop = (sal_uInt8*)rtl_allocateMemory(aBlopSize);
REG_ENSURE(!key5.getValue(OUString(), (void*)readBlop) , "testCoreReflection error 9c1");
......@@ -283,7 +283,7 @@ void test_coreReflection()
const sal_uInt8* pBlop = writer.getBlop();
sal_uInt32 aBlopSize = writer.getBlopSize();
REG_ENSURE(!key6.setValue(OUString(), RG_VALUETYPE_BINARY, (void*)pBlop, aBlopSize), "testCoreReflection error 9d");
REG_ENSURE(!key6.setValue(OUString(), RegValueType::BINARY, (void*)pBlop, aBlopSize), "testCoreReflection error 9d");
}
{
......@@ -312,7 +312,7 @@ void test_coreReflection()
const sal_uInt8* pBlop = writer.getBlop();
sal_uInt32 aBlopSize = writer.getBlopSize();
REG_ENSURE(!key7.setValue(OUString(), RG_VALUETYPE_BINARY, (void*)pBlop, aBlopSize), "testCoreReflection error 9e");
REG_ENSURE(!key7.setValue(OUString(), RegValueType::BINARY, (void*)pBlop, aBlopSize), "testCoreReflection error 9e");
sal_uInt8* readBlop = (sal_uInt8*)rtl_allocateMemory(aBlopSize);
REG_ENSURE(!key7.getValue(OUString(), (void*)readBlop) , "testCoreReflection error 9e2");
......@@ -362,7 +362,7 @@ void test_coreReflection()
const sal_uInt8* pBlop = writer.getBlop();
sal_uInt32 aBlopSize = writer.getBlopSize();
REG_ENSURE(!key8.setValue(OUString(), RG_VALUETYPE_BINARY, (void*)pBlop, aBlopSize), "testCoreReflection error 9f");
REG_ENSURE(!key8.setValue(OUString(), RegValueType::BINARY, (void*)pBlop, aBlopSize), "testCoreReflection error 9f");
}
// REG_ENSURE(!myRegistry->destroy(NULL), "testCoreReflection error 10");
......@@ -492,7 +492,7 @@ void test_registry_CppApi()
sal_Char* Value=(sal_Char*)"Mein erster Value";
REG_ENSURE(!rootKey.setValue(OUString("mySecondKey"), RG_VALUETYPE_STRING, Value, 18), "test_registry_CppApi error 9");
REG_ENSURE(!rootKey.setValue(OUString("mySecondKey"), RegValueType::STRING, Value, 18), "test_registry_CppApi error 9");
RegValueType valueType;
sal_uInt32 valueSize;
......@@ -502,7 +502,7 @@ void test_registry_CppApi()
readValue = (sal_Char*)rtl_allocateMemory(valueSize);
REG_ENSURE(!key2.getValue(OUString(), readValue), "test_registry_CppApi error 10");
REG_ENSURE(valueType == RG_VALUETYPE_STRING, "test_registry_CppApi error 11");
REG_ENSURE(valueType == RegValueType::STRING, "test_registry_CppApi error 11");
REG_ENSURE(valueSize == 18, "test_registry_CppApi error 12");
REG_ENSURE(strcmp(readValue, Value) == 0, "test_registry_CppApi error 13");
rtl_freeMemory(readValue);
......@@ -526,7 +526,7 @@ void test_registry_CppApi()
REG_ENSURE(strcmp(n3, valueList.getElement(2)) == 0, "test_registry_CppApi error 13e");
REG_ENSURE(!rootKey.getValueInfo(OUString("myFourthKey"), &valueType, &valueSize), "test_registry_CppApi error 13e1");
REG_ENSURE(valueType == RG_VALUETYPE_STRINGLIST, "test_registry_CppApi error 13e2");
REG_ENSURE(valueType == RegValueType::STRINGLIST, "test_registry_CppApi error 13e2");
REG_ENSURE(valueSize == 3, "test_registry_CppApi error 13e3");
sal_Int32 pLong[3];
......@@ -546,7 +546,7 @@ void test_registry_CppApi()
OUString sWTestValue("Mein erster Unicode Value");
const sal_Unicode* wTestValue= sWTestValue.getStr();
REG_ENSURE(!rootKey.setValue(OUString("mySixthKey"), RG_VALUETYPE_UNICODE, (void*)wTestValue,
REG_ENSURE(!rootKey.setValue(OUString("mySixthKey"), RegValueType::UNICODE, (void*)wTestValue,
(rtl_ustr_getLength(wTestValue)+1)*sizeof(sal_Unicode)), "test_registry_CppApi error 13j1");
REG_ENSURE(!rootKey.getValueInfo(OUString("mySixthKey"), &valueType, &valueSize), "test_registry_CppApi error 13j2");
......@@ -608,7 +608,7 @@ void test_registry_CppApi()
REG_ENSURE(!rootKey2.createKey(OUString("reg2ThirdKey"), key25), "test_registry_CppApi error 29");
sal_uInt32 nValue= 123456789;
REG_ENSURE(!key23.setValue(OUString(), RG_VALUETYPE_LONG, &nValue, sizeof(sal_uInt32)), "test_registry_CppApi error 30");
REG_ENSURE(!key23.setValue(OUString(), RegValueType::LONG, &nValue, sizeof(sal_uInt32)), "test_registry_CppApi error 30");
REG_ENSURE(!key21.closeKey() &&
!key22.closeKey() &&
......@@ -643,7 +643,7 @@ void test_registry_CppApi()
!key2.closeKey(), "test_registry_CppApi error 41");
const sal_Unicode* wValue= OUString("Mein erster Unicode Value").getStr();
REG_ENSURE(!key3.setValue(OUString(), RG_VALUETYPE_UNICODE, (void*)wValue,
REG_ENSURE(!key3.setValue(OUString(), RegValueType::UNICODE, (void*)wValue,
(rtl_ustr_getLength(wValue)+1)*sizeof(sal_Unicode)), "test_registry_CppApi error 42");
REG_ENSURE(!key3.closeKey(), "test_registry_CppApi error 43");
......
This diff is collapsed.
......@@ -91,7 +91,7 @@ int _cdecl main()
char* Value=(char*)"Mein erster Value";
if (reg_setValue(hRootKey, OUString("mySecondKey").pData, RG_VALUETYPE_STRING, Value, 18))
if (reg_setValue(hRootKey, OUString("mySecondKey").pData, RegValueType::STRING, Value, 18))
cout << "\t9. setValue of key \"mySecondKey\" failed\n";
else
cout << "9. setValue (string Value) of key \"mySecondKey\"\n";
......@@ -208,7 +208,7 @@ int _cdecl main()
cout << "27. key \"reg2ThirdKey\" is created\n";
sal_uInt32 nValue= 123456789;
if (reg_setValue(h2Key3, OUString().pData, RG_VALUETYPE_LONG, &nValue, sizeof(sal_uInt32)))
if (reg_setValue(h2Key3, OUString().pData, RegValueType::LONG, &nValue, sizeof(sal_uInt32)))
cout << "\t27.b) setValue of key \"reg2FirstSubKey\" failed\n";
else
cout << "27.b). setValue (long Value) of key \"reg2FirstSubKey\"\n";
......
......@@ -281,7 +281,7 @@ css::registry::RegistryValueType Key::getValueType()
case REG_NO_ERROR:
break;
case REG_INVALID_VALUE:
type = RG_VALUETYPE_NOT_DEFINED;
type = RegValueType::NOT_DEFINED;
break;
default:
throw css::registry::InvalidRegistryException(
......@@ -294,21 +294,21 @@ css::registry::RegistryValueType Key::getValueType()
default:
std::abort(); // this cannot happen
// pseudo-fall-through to avoid warnings on MSC
case RG_VALUETYPE_NOT_DEFINED:
case RegValueType::NOT_DEFINED:
return css::registry::RegistryValueType_NOT_DEFINED;
case RG_VALUETYPE_LONG:
case RegValueType::LONG:
return css::registry::RegistryValueType_LONG;
case RG_VALUETYPE_STRING:
case RegValueType::STRING:
return css::registry::RegistryValueType_ASCII;
case RG_VALUETYPE_UNICODE:
case RegValueType::UNICODE:
return css::registry::RegistryValueType_STRING;
case RG_VALUETYPE_BINARY:
case RegValueType::BINARY:
return css::registry::RegistryValueType_BINARY;
case RG_VALUETYPE_LONGLIST:
case RegValueType::LONGLIST:
return css::registry::RegistryValueType_LONGLIST;
case RG_VALUETYPE_STRINGLIST:
case RegValueType::STRINGLIST:
return css::registry::RegistryValueType_ASCIILIST;
case RG_VALUETYPE_UNICODELIST:
case RegValueType::UNICODELIST:
return css::registry::RegistryValueType_STRINGLIST;
}
}
......@@ -343,7 +343,7 @@ void Key::setLongValue(sal_Int32 value)
{
osl::MutexGuard guard(registry_->mutex_);
RegError err = key_.setValue(
OUString(), RG_VALUETYPE_LONG, &value, sizeof (sal_Int32));
OUString(), RegValueType::LONG, &value, sizeof (sal_Int32));
if (err != REG_NO_ERROR) {
throw css::registry::InvalidRegistryException(
(("com.sun.star.registry.SimpleRegistry key setLongValue:"
......@@ -426,11 +426,11 @@ OUString Key::getAsciiValue() throw (
OUString::number(err)),
static_cast< OWeakObject * >(this));
}
if (type != RG_VALUETYPE_STRING) {
if (type != RegValueType::STRING) {
throw css::registry::InvalidValueException(
(("com.sun.star.registry.SimpleRegistry key getAsciiValue:"
" underlying RegistryKey type = ") +
OUString::number(type)),
OUString::number(static_cast<int>(type))),
static_cast< OWeakObject * >(this));
}
// size contains terminating null (error in underlying registry.cxx):
......@@ -495,7 +495,7 @@ void Key::setAsciiValue(OUString const & value)
static_cast< OWeakObject * >(this));
}
RegError err = key_.setValue(
OUString(), RG_VALUETYPE_STRING,
OUString(), RegValueType::STRING,
const_cast< char * >(utf8.getStr()), utf8.getLength() + 1);
// +1 for terminating null (error in underlying registry.cxx)
if (err != REG_NO_ERROR) {
......@@ -615,11 +615,11 @@ OUString Key::getStringValue() throw (
OUString::number(err)),
static_cast< OWeakObject * >(this));
}
if (type != RG_VALUETYPE_UNICODE) {
if (type != RegValueType::UNICODE) {
throw css::registry::InvalidValueException(
(("com.sun.star.registry.SimpleRegistry key getStringValue:"
" underlying RegistryKey type = ") +
OUString::number(type)),
OUString::number(static_cast<int>(type))),
static_cast< OWeakObject * >(this));
}
// size contains terminating null and is *2 (error in underlying
......@@ -661,7 +661,7 @@ void Key::setStringValue(OUString const & value)
{
osl::MutexGuard guard(registry_->mutex_);
RegError err = key_.setValue(
OUString(), RG_VALUETYPE_UNICODE,
OUString(), RegValueType::UNICODE,
const_cast< sal_Unicode * >(value.getStr()),
(value.getLength() + 1) * sizeof (sal_Unicode));
// +1 for terminating null (error in underlying registry.cxx)
......@@ -752,11 +752,11 @@ css::uno::Sequence< sal_Int8 > Key::getBinaryValue()
OUString::number(err)),
static_cast< OWeakObject * >(this));
}
if (type != RG_VALUETYPE_BINARY) {
if (type != RegValueType::BINARY) {
throw css::registry::InvalidValueException(
(("com.sun.star.registry.SimpleRegistry key getBinaryValue:"
" underlying RegistryKey type = ") +
OUString::number(type)),
OUString::number(static_cast<int>(type))),
static_cast< OWeakObject * >(this));
}
if (size > SAL_MAX_INT32) {
......@@ -782,7 +782,7 @@ void Key::setBinaryValue(css::uno::Sequence< sal_Int8 > const & value)
{
osl::MutexGuard guard(registry_->mutex_);
RegError err = key_.setValue(
OUString(), RG_VALUETYPE_BINARY,
OUString(), RegValueType::BINARY,
const_cast< sal_Int8 * >(value.getConstArray()),
static_cast< sal_uInt32 >(value.getLength()));
if (err != REG_NO_ERROR) {
......
......@@ -174,10 +174,10 @@ typereg::Reader getReader(RegistryKey & key, std::vector< char > * buffer) {
("legacy format: cannot get value info about key " + key.getName()
+ ": " + OUString::number(e)));
}
if (type != RG_VALUETYPE_BINARY) {
if (type != RegValueType::BINARY) {
throw FileFormatException(
key.getRegistryName(),
("legacy format: unexpected value type " + OUString::number(type)
("legacy format: unexpected value type " + OUString::number(static_cast<int>(type))
+ " of key " + key.getName()));
}
if (size == 0
......
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