Kaydet (Commit) 2e1559cd authored tarafından Stephan Bergmann's avatar Stephan Bergmann

More loplugin:cstylecast: embeddedobj

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: I16cbffa66d6b9bcc4ca68f0dd8f6bf3f4966a77f
üst 126f1084
......@@ -309,7 +309,7 @@ uno::Reference< io::XStream > OleEmbeddedObject::TryToGetAcceptableFormat_Impl(
nRead = xInStream->readBytes( aHeadData, 4 );
sal_uInt32 nLen = 0;
if ( nRead == 4 && aHeadData.getLength() == 4 )
nLen = ( ( ( (sal_uInt32)aHeadData[3] * 0x100 + (sal_uInt32)aHeadData[2] ) * 0x100 ) + (sal_uInt32)aHeadData[1] ) * 0x100 + (sal_uInt32)aHeadData[0];
nLen = ( ( ( static_cast<sal_uInt32>(aHeadData[3]) * 0x100 + static_cast<sal_uInt32>(aHeadData[2]) ) * 0x100 ) + static_cast<sal_uInt32>(aHeadData[1]) ) * 0x100 + static_cast<sal_uInt32>(aHeadData[0]);
if ( nLen > 4 )
{
xInStream->skipBytes( nLen - 4 );
......@@ -322,7 +322,7 @@ uno::Reference< io::XStream > OleEmbeddedObject::TryToGetAcceptableFormat_Impl(
// check whether the first bytes represent the size
sal_uInt32 nSize = 0;
for ( sal_Int32 nInd = 3; nInd >= 0; nInd-- )
nSize = ( nSize << 8 ) + (sal_uInt8)aData[nInd];
nSize = ( nSize << 8 ) + static_cast<sal_uInt8>(aData[nInd]);
if ( nSize == xSeek->getLength() - 4 )
nHeaderOffset = 4;
......@@ -441,7 +441,7 @@ void OleEmbeddedObject::InsertVisualCache_Impl( const uno::Reference< io::XStrea
// write width
for ( nIndex = 0; nIndex < 4; nIndex++ )
{
aData[nIndex] = (sal_Int8)( aSize.Width % 0x100 );
aData[nIndex] = static_cast<sal_Int8>( aSize.Width % 0x100 );
aSize.Width /= 0x100;
}
xTempOutStream->writeBytes( aData );
......@@ -449,7 +449,7 @@ void OleEmbeddedObject::InsertVisualCache_Impl( const uno::Reference< io::XStrea
// write height
for ( nIndex = 0; nIndex < 4; nIndex++ )
{
aData[nIndex] = (sal_Int8)( aSize.Height % 0x100 );
aData[nIndex] = static_cast<sal_Int8>( aSize.Height % 0x100 );
aSize.Height /= 0x100;
}
xTempOutStream->writeBytes( aData );
......@@ -472,7 +472,7 @@ void OleEmbeddedObject::InsertVisualCache_Impl( const uno::Reference< io::XStrea
}
for ( sal_Int32 nInd = 0; nInd < 4; nInd++ )
{
aData[nInd] = (sal_Int8)( ( (sal_uInt64) nLength ) % 0x100 );
aData[nInd] = static_cast<sal_Int8>( static_cast<sal_uInt64>(nLength) % 0x100 );
nLength /= 0x100;
}
xTempSeek->seek( 36 );
......
......@@ -69,7 +69,7 @@ embed::VisualRepresentation OleEmbeddedObject::GetVisualRepresentationInNativeFo
cppu::UnoType<uno::Sequence< sal_Int8 >>::get() );
}
sal_Int32 nStreamLength = (sal_Int32)xSeekable->getLength();
sal_Int32 nStreamLength = static_cast<sal_Int32>(xSeekable->getLength());
uno::Sequence< sal_Int8 > aRepresent( nStreamLength );
xInStream->readBytes( aRepresent, nStreamLength );
aVisualRepr.Data <<= aRepresent;
......
......@@ -309,10 +309,10 @@ bool OwnView_Impl::ReadContentsAndGenerateTempFile( const uno::Reference< io::XI
if ( xInStream->readBytes( aReadSeq, 4 ) != 4 )
return false;
sal_uInt32 nUrlSize = (sal_uInt8)aReadSeq[0]
+ (sal_uInt8)aReadSeq[1] * 0x100
+ (sal_uInt8)aReadSeq[2] * 0x10000
+ (sal_uInt8)aReadSeq[3] * 0x1000000;
sal_uInt32 nUrlSize = static_cast<sal_uInt8>(aReadSeq[0])
+ static_cast<sal_uInt8>(aReadSeq[1]) * 0x100
+ static_cast<sal_uInt8>(aReadSeq[2]) * 0x10000
+ static_cast<sal_uInt8>(aReadSeq[3]) * 0x1000000;
sal_Int64 nTargetPos = xSeekable->getPosition() + nUrlSize;
xSeekable->seek( nTargetPos );
......@@ -321,10 +321,10 @@ bool OwnView_Impl::ReadContentsAndGenerateTempFile( const uno::Reference< io::XI
if ( xInStream->readBytes( aReadSeq, 4 ) != 4 )
return false;
sal_uInt32 nDataSize = (sal_uInt8)aReadSeq[0]
+ (sal_uInt8)aReadSeq[1] * 0x100
+ (sal_uInt8)aReadSeq[2] * 0x10000
+ (sal_uInt8)aReadSeq[3] * 0x1000000;
sal_uInt32 nDataSize = static_cast<sal_uInt8>(aReadSeq[0])
+ static_cast<sal_uInt8>(aReadSeq[1]) * 0x100
+ static_cast<sal_uInt8>(aReadSeq[2]) * 0x10000
+ static_cast<sal_uInt8>(aReadSeq[3]) * 0x1000000;
aReadSeq.realloc( 32000 );
sal_uInt32 nRead = 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