Kaydet (Commit) 6f58d7a1 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

More loplugin:cstylecast: registry

Change-Id: I2c9436f5f9ea5ef3051d22310dee48ec39fad850
üst 3ffa7225
......@@ -256,7 +256,7 @@ RegError ORegKey::getValueInfo(const OUString& valueName, RegValueType* pValueTy
sal_uInt8 type = *pBuffer;
readUINT32(pBuffer+VALUE_TYPEOFFSET, size);
*pValueType = (RegValueType)type;
*pValueType = static_cast<RegValueType>(type);
// if (*pValueType == RegValueType::UNICODE)
// {
// *pValueSize = (size / 2) * sizeof(sal_Unicode);
......@@ -308,7 +308,7 @@ RegError ORegKey::setValue(const OUString& valueName, RegValueType vType, RegVal
sal_uInt32 size = vSize;
sal_uInt8 type = (sal_uInt8)vType;
sal_uInt8 type = static_cast<sal_uInt8>(vType);
pBuffer = static_cast<sal_uInt8*>(rtl_allocateMemory(VALUE_HEADERSIZE + size));
memcpy(pBuffer, &type, 1);
......@@ -380,7 +380,7 @@ RegError ORegKey::setLongListValue(const OUString& valueName, sal_Int32 const *
size += len * 4;
sal_uInt8 type = (sal_uInt8)RegValueType::LONGLIST;
sal_uInt8 type = sal_uInt8(RegValueType::LONGLIST);
pBuffer = static_cast<sal_uInt8*>(rtl_allocateMemory(VALUE_HEADERSIZE + size));
memcpy(pBuffer, &type, 1);
......@@ -443,7 +443,7 @@ RegError ORegKey::setStringListValue(const OUString& valueName, sal_Char** pValu
size += 4 + strlen(pValueList[i]) + 1;
}
sal_uInt8 type = (sal_uInt8)RegValueType::STRINGLIST;
sal_uInt8 type = sal_uInt8(RegValueType::STRINGLIST);
pBuffer = static_cast<sal_uInt8*>(rtl_allocateMemory(VALUE_HEADERSIZE + size));
memcpy(pBuffer, &type, 1);
......@@ -511,7 +511,7 @@ RegError ORegKey::setUnicodeListValue(const OUString& valueName, sal_Unicode** p
size += 4 + ((rtl_ustr_getLength(pValueList[i]) +1) * 2);
}
sal_uInt8 type = (sal_uInt8)RegValueType::UNICODELIST;
sal_uInt8 type = sal_uInt8(RegValueType::UNICODELIST);
pBuffer = static_cast<sal_uInt8*>(rtl_allocateMemory(VALUE_HEADERSIZE + size));
memcpy(pBuffer, &type, 1);
......@@ -589,7 +589,7 @@ RegError ORegKey::getValue(const OUString& valueName, RegValue value) const
}
sal_uInt8 type = *pBuffer;
valueType = (RegValueType)type;
valueType = static_cast<RegValueType>(type);
readUINT32(pBuffer+VALUE_TYPEOFFSET, valueSize);
rtl_freeMemory(pBuffer);
......@@ -689,7 +689,7 @@ RegError ORegKey::getLongListValue(const OUString& valueName, sal_Int32** pValue
}
sal_uInt8 type = *pBuffer;
valueType = (RegValueType)type;
valueType = static_cast<RegValueType>(type);
if (valueType != RegValueType::LONGLIST)
{
......@@ -803,7 +803,7 @@ RegError ORegKey::getStringListValue(const OUString& valueName, sal_Char*** pVal
}
sal_uInt8 type = *pBuffer;
valueType = (RegValueType)type;
valueType = static_cast<RegValueType>(type);
if (valueType != RegValueType::STRINGLIST)
{
......@@ -909,7 +909,7 @@ RegError ORegKey::getUnicodeListValue(const OUString& valueName, sal_Unicode***
}
sal_uInt8 type = *pBuffer;
valueType = (RegValueType)type;
valueType = static_cast<RegValueType>(type);
if (valueType != RegValueType::UNICODELIST)
{
......
......@@ -283,7 +283,7 @@ sal_uInt32 ConstantPool::parseIndex()
offset += readUINT32(offset);
if ( ((CPInfoTag) readUINT16(m_pIndex[i] + CP_OFFSET_ENTRY_TAG)) ==
if ( static_cast<CPInfoTag>(readUINT16(m_pIndex[i] + CP_OFFSET_ENTRY_TAG)) ==
CP_TAG_CONST_STRING )
{
numOfStrings++;
......@@ -308,7 +308,7 @@ CPInfoTag ConstantPool::readTag(sal_uInt16 index) const
if (m_pIndex && (index > 0) && (index <= m_numOfEntries))
{
tag = (CPInfoTag) readUINT16(m_pIndex[index - 1] + CP_OFFSET_ENTRY_TAG);
tag = static_cast<CPInfoTag>(readUINT16(m_pIndex[index - 1] + CP_OFFSET_ENTRY_TAG));
}
return tag;
......@@ -623,7 +623,7 @@ RTFieldAccess FieldList::getFieldAccess(sal_uInt16 index) const
if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
{
try {
aAccess = (RTFieldAccess) readUINT16(sizeof(sal_uInt16) + (index * m_FIELD_ENTRY_SIZE) + FIELD_OFFSET_ACCESS);
aAccess = static_cast<RTFieldAccess>(readUINT16(sizeof(sal_uInt16) + (index * m_FIELD_ENTRY_SIZE) + FIELD_OFFSET_ACCESS));
} catch (BlopObject::BoundsError &) {
SAL_WARN("registry", "bad data");
}
......@@ -788,7 +788,7 @@ RTReferenceType ReferenceList::getReferenceType(sal_uInt16 index) const
if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
{
try {
refType = (RTReferenceType) readUINT16(sizeof(sal_uInt16) + (index * m_REFERENCE_ENTRY_SIZE) + REFERENCE_OFFSET_TYPE);
refType = static_cast<RTReferenceType>(readUINT16(sizeof(sal_uInt16) + (index * m_REFERENCE_ENTRY_SIZE) + REFERENCE_OFFSET_TYPE));
} catch (BlopObject::BoundsError &) {
SAL_WARN("registry", "bad data");
}
......@@ -820,7 +820,7 @@ RTFieldAccess ReferenceList::getReferenceAccess(sal_uInt16 index) const
if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
{
try {
aAccess = (RTFieldAccess) readUINT16(sizeof(sal_uInt16) + (index * m_REFERENCE_ENTRY_SIZE) + REFERENCE_OFFSET_ACCESS);
aAccess = static_cast<RTFieldAccess>(readUINT16(sizeof(sal_uInt16) + (index * m_REFERENCE_ENTRY_SIZE) + REFERENCE_OFFSET_ACCESS));
} catch (BlopObject::BoundsError &) {
SAL_WARN("registry", "bad data");
}
......@@ -986,10 +986,10 @@ RTParamMode MethodList::getMethodParamMode(sal_uInt16 index, sal_uInt16 paramInd
(index <= m_numOfEntries) &&
(paramIndex <= readUINT16(m_pIndex[index] + METHOD_OFFSET_PARAM_COUNT)))
{
aMode = (RTParamMode) readUINT16(
aMode = static_cast<RTParamMode>(readUINT16(
m_pIndex[index] +
calcMethodParamIndex(paramIndex) +
PARAM_OFFSET_MODE);
PARAM_OFFSET_MODE));
}
} catch (BlopObject::BoundsError &) {
SAL_WARN("registry", "bad data");
......@@ -1067,7 +1067,7 @@ RTMethodMode MethodList::getMethodMode(sal_uInt16 index) const
if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
{
try {
aMode = (RTMethodMode) readUINT16(m_pIndex[index] + METHOD_OFFSET_MODE);
aMode = static_cast<RTMethodMode>(readUINT16(m_pIndex[index] + METHOD_OFFSET_MODE));
} catch (BlopObject::BoundsError &) {
SAL_WARN("registry", "bad data");
}
......@@ -1258,8 +1258,7 @@ RTTypeClass TYPEREG_CALLTYPE typereg_reader_getTypeClass(void * hEntry)
TypeRegistryEntry* pEntry = static_cast<TypeRegistryEntry*>(hEntry);
if (pEntry != nullptr) {
try {
return (RTTypeClass)
(pEntry->readUINT16(OFFSET_TYPE_CLASS) & ~RT_TYPE_PUBLISHED);
return static_cast<RTTypeClass>(pEntry->readUINT16(OFFSET_TYPE_CLASS) & ~RT_TYPE_PUBLISHED);
} catch (BlopObject::BoundsError &) {
SAL_WARN("registry", "bad data");
}
......
......@@ -830,7 +830,7 @@ void TypeWriter::createBlop()
if (m_fields[i].m_constValueType != RT_TYPE_NONE)
{
pInfo = new CPInfo((CPInfoTag)m_fields[i].m_constValueType, pInfo);
pInfo = new CPInfo(static_cast<CPInfoTag>(m_fields[i].m_constValueType), pInfo);
pInfo->m_value.aConst = m_fields[i].m_constValue;
cpIndexValue = pInfo->m_index;
}
......
......@@ -953,7 +953,7 @@ RegError ORegistry::loadAndSaveValue(ORegKey* pTargetKey,
RegError _ret = RegError::NO_ERROR;
sal_uInt8 type = *pBuffer;
valueType = (RegValueType)type;
valueType = static_cast<RegValueType>(type);
readUINT32(pBuffer+VALUE_TYPEOFFSET, valueSize);
rtl_freeMemory(pBuffer);
......@@ -1041,7 +1041,7 @@ RegError ORegistry::checkBlop(OStoreStream& rValue,
(rwBytes == VALUE_HEADERSIZE))
{
sal_uInt8 type = *pBuffer;
valueType = (RegValueType)type;
valueType = static_cast<RegValueType>(type);
readUINT32(pBuffer+VALUE_TYPEOFFSET, valueSize);
rtl_freeMemory(pBuffer);
......@@ -1189,7 +1189,7 @@ RegError ORegistry::mergeModuleValue(OStoreStream& rTargetValue,
const sal_uInt8* pBlop = writer.getBlop();
sal_uInt32 aBlopSize = writer.getBlopSize();
sal_uInt8 type = (sal_uInt8)RegValueType::BINARY;
sal_uInt8 type = sal_uInt8(RegValueType::BINARY);
sal_uInt8* pBuffer = static_cast<sal_uInt8*>(rtl_allocateMemory(VALUE_HEADERSIZE + aBlopSize));
memcpy(pBuffer, &type, 1);
......@@ -1363,7 +1363,7 @@ RegError ORegistry::dumpValue(const OUString& sPath, const OUString& sName, sal_
}
sal_uInt8 type = *pBuffer;
valueType = (RegValueType)type;
valueType = static_cast<RegValueType>(type);
readUINT32(pBuffer+VALUE_TYPEOFFSET, valueSize);
pBuffer = static_cast<sal_uInt8*>(rtl_allocateMemory(valueSize));
......
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