summaryrefslogtreecommitdiff
path: root/registry
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2018-01-12 20:18:29 +0100
committerStephan Bergmann <sbergman@redhat.com>2018-01-12 20:18:29 +0100
commitfe3924a3677ff5e3aa58bc0c7ec0310ad49acafd (patch)
treec04a76a4354837217b0a184ed55333f2d9ebd49d /registry
parent05db2098032f17085b7c3b47d02f617371eeddc0 (diff)
More loplugin:cstylecast: registry
auto-rewrite with <https://gerrit.libreoffice.org/#/c/47798/> "Enable loplugin:cstylecast for some more cases" plus solenv/clang-format/reformat-formatted-files Change-Id: I496dc091b46b6a67afe52eb12c07824f65f71212
Diffstat (limited to 'registry')
-rw-r--r--registry/source/reflcnst.hxx40
-rw-r--r--registry/source/reflread.cxx34
-rw-r--r--registry/source/reflwrit.cxx15
-rw-r--r--registry/source/regimpl.cxx2
4 files changed, 45 insertions, 46 deletions
diff --git a/registry/source/reflcnst.hxx b/registry/source/reflcnst.hxx
index 9bb560a47325..a0ee421d5089 100644
--- a/registry/source/reflcnst.hxx
+++ b/registry/source/reflcnst.hxx
@@ -108,16 +108,16 @@ inline sal_uInt32 writeBYTE(sal_uInt8* buffer, sal_uInt8 v)
inline sal_uInt32 writeINT16(sal_uInt8* buffer, sal_Int16 v)
{
- buffer[0] = (sal_uInt8)((v >> 8) & 0xFF);
- buffer[1] = (sal_uInt8)((v >> 0) & 0xFF);
+ buffer[0] = static_cast<sal_uInt8>((v >> 8) & 0xFF);
+ buffer[1] = static_cast<sal_uInt8>((v >> 0) & 0xFF);
return sizeof(sal_Int16);
}
inline sal_uInt32 writeUINT16(sal_uInt8* buffer, sal_uInt16 v)
{
- buffer[0] = (sal_uInt8)((v >> 8) & 0xFF);
- buffer[1] = (sal_uInt8)((v >> 0) & 0xFF);
+ buffer[0] = static_cast<sal_uInt8>((v >> 8) & 0xFF);
+ buffer[1] = static_cast<sal_uInt8>((v >> 0) & 0xFF);
return sizeof(sal_uInt16);
}
@@ -135,10 +135,10 @@ inline sal_uInt32 readUINT16(const sal_uInt8* buffer, sal_uInt16& v)
inline sal_uInt32 writeINT32(sal_uInt8* buffer, sal_Int32 v)
{
- buffer[0] = (sal_uInt8)((v >> 24) & 0xFF);
- buffer[1] = (sal_uInt8)((v >> 16) & 0xFF);
- buffer[2] = (sal_uInt8)((v >> 8) & 0xFF);
- buffer[3] = (sal_uInt8)((v >> 0) & 0xFF);
+ buffer[0] = static_cast<sal_uInt8>((v >> 24) & 0xFF);
+ buffer[1] = static_cast<sal_uInt8>((v >> 16) & 0xFF);
+ buffer[2] = static_cast<sal_uInt8>((v >> 8) & 0xFF);
+ buffer[3] = static_cast<sal_uInt8>((v >> 0) & 0xFF);
return sizeof(sal_Int32);
}
@@ -157,10 +157,10 @@ inline sal_uInt32 readINT32(const sal_uInt8* buffer, sal_Int32& v)
inline sal_uInt32 writeUINT32(sal_uInt8* buffer, sal_uInt32 v)
{
- buffer[0] = (sal_uInt8)((v >> 24) & 0xFF);
- buffer[1] = (sal_uInt8)((v >> 16) & 0xFF);
- buffer[2] = (sal_uInt8)((v >> 8) & 0xFF);
- buffer[3] = (sal_uInt8)((v >> 0) & 0xFF);
+ buffer[0] = static_cast<sal_uInt8>((v >> 24) & 0xFF);
+ buffer[1] = static_cast<sal_uInt8>((v >> 16) & 0xFF);
+ buffer[2] = static_cast<sal_uInt8>((v >> 8) & 0xFF);
+ buffer[3] = static_cast<sal_uInt8>((v >> 0) & 0xFF);
return sizeof(sal_uInt32);
}
@@ -180,14 +180,14 @@ inline sal_uInt32 readUINT32(const sal_uInt8* buffer, sal_uInt32& v)
inline sal_uInt32 writeUINT64(sal_uInt8* buffer, sal_uInt64 v)
{
- buffer[0] = (sal_uInt8)((v >> 56) & 0xFF);
- buffer[1] = (sal_uInt8)((v >> 48) & 0xFF);
- buffer[2] = (sal_uInt8)((v >> 40) & 0xFF);
- buffer[3] = (sal_uInt8)((v >> 32) & 0xFF);
- buffer[4] = (sal_uInt8)((v >> 24) & 0xFF);
- buffer[5] = (sal_uInt8)((v >> 16) & 0xFF);
- buffer[6] = (sal_uInt8)((v >> 8) & 0xFF);
- buffer[7] = (sal_uInt8)((v >> 0) & 0xFF);
+ buffer[0] = static_cast<sal_uInt8>((v >> 56) & 0xFF);
+ buffer[1] = static_cast<sal_uInt8>((v >> 48) & 0xFF);
+ buffer[2] = static_cast<sal_uInt8>((v >> 40) & 0xFF);
+ buffer[3] = static_cast<sal_uInt8>((v >> 32) & 0xFF);
+ buffer[4] = static_cast<sal_uInt8>((v >> 24) & 0xFF);
+ buffer[5] = static_cast<sal_uInt8>((v >> 16) & 0xFF);
+ buffer[6] = static_cast<sal_uInt8>((v >> 8) & 0xFF);
+ buffer[7] = static_cast<sal_uInt8>((v >> 0) & 0xFF);
return sizeof(sal_uInt64);
}
diff --git a/registry/source/reflread.cxx b/registry/source/reflread.cxx
index 1a06dab771e3..57ce8b9e3172 100644
--- a/registry/source/reflread.cxx
+++ b/registry/source/reflread.cxx
@@ -122,14 +122,14 @@ public:
throw BoundsError();
}
return (
- ((sal_Int64)m_pBuffer[index] << 56) |
- ((sal_Int64)m_pBuffer[index+1] << 48) |
- ((sal_Int64)m_pBuffer[index+2] << 40) |
- ((sal_Int64)m_pBuffer[index+3] << 32) |
- ((sal_Int64)m_pBuffer[index+4] << 24) |
- ((sal_Int64)m_pBuffer[index+5] << 16) |
- ((sal_Int64)m_pBuffer[index+6] << 8) |
- ((sal_Int64)m_pBuffer[index+7] << 0)
+ (static_cast<sal_Int64>(m_pBuffer[index]) << 56) |
+ (static_cast<sal_Int64>(m_pBuffer[index+1]) << 48) |
+ (static_cast<sal_Int64>(m_pBuffer[index+2]) << 40) |
+ (static_cast<sal_Int64>(m_pBuffer[index+3]) << 32) |
+ (static_cast<sal_Int64>(m_pBuffer[index+4]) << 24) |
+ (static_cast<sal_Int64>(m_pBuffer[index+5]) << 16) |
+ (static_cast<sal_Int64>(m_pBuffer[index+6]) << 8) |
+ (static_cast<sal_Int64>(m_pBuffer[index+7]) << 0)
);
}
@@ -139,14 +139,14 @@ public:
throw BoundsError();
}
return (
- ((sal_uInt64)m_pBuffer[index] << 56) |
- ((sal_uInt64)m_pBuffer[index+1] << 48) |
- ((sal_uInt64)m_pBuffer[index+2] << 40) |
- ((sal_uInt64)m_pBuffer[index+3] << 32) |
- ((sal_uInt64)m_pBuffer[index+4] << 24) |
- ((sal_uInt64)m_pBuffer[index+5] << 16) |
- ((sal_uInt64)m_pBuffer[index+6] << 8) |
- ((sal_uInt64)m_pBuffer[index+7] << 0)
+ (static_cast<sal_uInt64>(m_pBuffer[index]) << 56) |
+ (static_cast<sal_uInt64>(m_pBuffer[index+1]) << 48) |
+ (static_cast<sal_uInt64>(m_pBuffer[index+2]) << 40) |
+ (static_cast<sal_uInt64>(m_pBuffer[index+3]) << 32) |
+ (static_cast<sal_uInt64>(m_pBuffer[index+4]) << 24) |
+ (static_cast<sal_uInt64>(m_pBuffer[index+5]) << 16) |
+ (static_cast<sal_uInt64>(m_pBuffer[index+6]) << 8) |
+ (static_cast<sal_uInt64>(m_pBuffer[index+7]) << 0)
);
}
};
@@ -556,7 +556,7 @@ const sal_Unicode* ConstantPool::readStringConstant(sal_uInt16 index) const
}
}
- aString = m_pStringCache->getString((sal_uInt16) (m_pIndex[index - 1] * -1));
+ aString = m_pStringCache->getString(static_cast<sal_uInt16>(m_pIndex[index - 1] * -1));
}
return aString;
diff --git a/registry/source/reflwrit.cxx b/registry/source/reflwrit.cxx
index 45c5ae474a2c..10742fcf789e 100644
--- a/registry/source/reflwrit.cxx
+++ b/registry/source/reflwrit.cxx
@@ -80,7 +80,7 @@ sal_uInt32 writeString(sal_uInt8* buffer, const sal_Unicode* v)
for (i = 0; i < len; i++)
{
- buff += writeUINT16(buff, (sal_uInt16) v[i]);
+ buff += writeUINT16(buff, static_cast<sal_uInt16>(v[i]));
}
return (buff - buffer);
@@ -103,7 +103,7 @@ sal_uInt32 readString(const sal_uInt8* buffer, sal_Unicode* v, sal_uInt32 maxSiz
buff += readUINT16(buff, aChar);
- v[i] = (sal_Unicode) aChar;
+ v[i] = static_cast<sal_Unicode>(aChar);
}
v[len - 1] = L'\0';
@@ -262,12 +262,12 @@ sal_uInt32 CPInfo::toBlop(sal_uInt8* buffer)
sal_uInt8* buff = buffer;
buff += writeUINT32(buff, getBlopSize());
- buff += writeUINT16(buff, (sal_uInt16) m_tag);
+ buff += writeUINT16(buff, static_cast<sal_uInt16>(m_tag));
switch (m_tag)
{
case CP_TAG_CONST_BOOL:
- buff += writeBYTE(buff, (sal_uInt8) m_value.aConst.aBool);
+ buff += writeBYTE(buff, static_cast<sal_uInt8>(m_value.aConst.aBool));
break;
case CP_TAG_CONST_BYTE:
buff += writeBYTE(
@@ -868,8 +868,7 @@ void TypeWriter::createBlop()
for (sal_uInt16 i = 0; i < m_methodCount; i++)
{
- pMethodEntrySize[i] = (sal_uInt16)
- ( blopMethodEntrySize + // header
+ pMethodEntrySize[i] = static_cast<sal_uInt16>( blopMethodEntrySize + // header
sizeof(sal_uInt16) + // parameterCount
(m_methods[i].m_paramCount * blopParamEntrySize) + // exceptions
sizeof(sal_uInt16) + // exceptionCount
@@ -1044,8 +1043,8 @@ void TypeWriter::createBlop()
pBuffer += writeUINT16(pBuffer, majorVersion);
pBuffer += writeUINT16(pBuffer, BLOP_HEADER_N_ENTRIES);
- pBuffer += writeUINT16(pBuffer, (sal_uInt16)RT_UNO_IDL);
- pBuffer += writeUINT16(pBuffer, (sal_uInt16)m_typeClass);
+ pBuffer += writeUINT16(pBuffer, sal_uInt16(RT_UNO_IDL));
+ pBuffer += writeUINT16(pBuffer, static_cast<sal_uInt16>(m_typeClass));
pBuffer += writeUINT16(pBuffer, cpIndexThisName);
pBuffer += writeUINT16(pBuffer, 0); // cpIndexUik
pBuffer += writeUINT16(pBuffer, cpIndexDoku);
diff --git a/registry/source/regimpl.cxx b/registry/source/regimpl.cxx
index 6dec181933ea..db665844e502 100644
--- a/registry/source/regimpl.cxx
+++ b/registry/source/regimpl.cxx
@@ -1158,7 +1158,7 @@ RegError ORegistry::mergeModuleValue(OStoreStream& rTargetValue,
RegistryTypeWriter writer(reader.getTypeClass(),
reader.getTypeName(),
reader.getSuperTypeName(),
- (sal_uInt16)count);
+ static_cast<sal_uInt16>(count));
for (sal_uInt32 i=0 ; i < reader.getFieldCount(); i++)
{