diff options
author | Noel Grandin <noel@peralex.com> | 2015-04-08 13:09:05 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-04-09 08:41:11 +0200 |
commit | 95600edeaf48a80a1e84c44b37f4035bc4db3070 (patch) | |
tree | ed62af7a330438526d33ece26606811de365d7ee /registry/source | |
parent | 1f34524746a0849ee2c76241d7ac6934110009fe (diff) |
convert RegValueType to scoped enum
Change-Id: Ic672e75db4d7323760577b19490ffa28d38965b6
Diffstat (limited to 'registry/source')
-rw-r--r-- | registry/source/keyimpl.cxx | 48 | ||||
-rw-r--r-- | registry/source/regimpl.cxx | 36 | ||||
-rw-r--r-- | registry/source/regkey.cxx | 8 |
3 files changed, 46 insertions, 46 deletions
diff --git a/registry/source/keyimpl.cxx b/registry/source/keyimpl.cxx index 4f1a4f4aa585..1dcb797867b5 100644 --- a/registry/source/keyimpl.cxx +++ b/registry/source/keyimpl.cxx @@ -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; diff --git a/registry/source/regimpl.cxx b/registry/source/regimpl.cxx index 876245a0d366..0a7ad76f52a5 100644 --- a/registry/source/regimpl.cxx +++ b/registry/source/regimpl.cxx @@ -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)); diff --git a/registry/source/regkey.cxx b/registry/source/regkey.cxx index 3170a0c5f9db..7c71336a4e4c 100644 --- a/registry/source/regkey.cxx +++ b/registry/source/regkey.cxx @@ -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++) |