[Libreoffice-commits] core.git: tools/source
Stephan Bergmann (via logerrit)
logerrit at kemper.freedesktop.org
Fri Jan 17 22:59:05 UTC 2020
tools/source/stream/stream.cxx | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
New commits:
commit bb32e871e9e5926004381029866df694a0c89dbb
Author: Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Fri Jan 17 18:30:20 2020 +0100
Commit: Stephan Bergmann <sbergman at redhat.com>
CommitDate: Fri Jan 17 23:58:28 2020 +0100
loplugin:redundantcast (size_t vs. std::size_t)
...which happen to be found by 6efffbbfce9c27439f54970f7a569b069ce46eba "Improve
loplugin:redundantcast for sal_Int... vs. ::sal_Int..." only on macOS, not on
Linux: At least for my Linux builds, size_t is a typedef in my local LLVM
installation's lib/clang/11.0.0/include/stddef.h while std::size_t is an
unrelated typedef (but to the same type) in
/usr/include/c++/9/x86_64-redhat-linux/bits/c++config.h.
Change-Id: I98dd605cb7b4ba5fb9bd3902bd9b1ae960a804e7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86994
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx
index c39d6787e134..8c38d862b3df 100644
--- a/tools/source/stream/stream.cxx
+++ b/tools/source/stream/stream.cxx
@@ -1248,7 +1248,7 @@ std::size_t SvStream::ReadBytes( void* pData, std::size_t nCount )
{
// => yes
if (nCount != 0)
- memcpy(pData, m_pBufPos, static_cast<size_t>(nCount));
+ memcpy(pData, m_pBufPos, nCount);
m_nBufActualPos = m_nBufActualPos + static_cast<sal_uInt16>(nCount);
m_pBufPos += nCount;
m_nBufFree = m_nBufFree - static_cast<sal_uInt16>(nCount);
@@ -1291,7 +1291,7 @@ std::size_t SvStream::ReadBytes( void* pData, std::size_t nCount )
{
nCount = nCountTmp; // trim count back, EOF see below
}
- memcpy( pData, m_pRWBuf.get(), static_cast<size_t>(nCount) );
+ memcpy( pData, m_pRWBuf.get(), nCount );
m_nBufActualPos = static_cast<sal_uInt16>(nCount);
m_pBufPos = m_pRWBuf.get() + nCount;
}
@@ -1331,7 +1331,7 @@ std::size_t SvStream::WriteBytes( const void* pData, std::size_t nCount )
m_isIoWrite = true;
if (nCount <= static_cast<std::size_t>(m_nBufSize - m_nBufActualPos))
{
- memcpy( m_pBufPos, pData, static_cast<size_t>(nCount) );
+ memcpy( m_pBufPos, pData, nCount );
m_nBufActualPos = m_nBufActualPos + static_cast<sal_uInt16>(nCount);
// Update length if buffer was updated
if (m_nBufActualPos > m_nBufActualLen)
@@ -1362,7 +1362,7 @@ std::size_t SvStream::WriteBytes( const void* pData, std::size_t nCount )
else
{
// Copy block to buffer
- memcpy( m_pRWBuf.get(), pData, static_cast<size_t>(nCount) );
+ memcpy( m_pRWBuf.get(), pData, nCount );
// Mind the order!
m_nBufFilePos += m_nBufActualPos;
@@ -1693,7 +1693,7 @@ std::size_t SvMemoryStream::GetData( void* pData, std::size_t nCount )
nCount = nMaxCount;
if (nCount != 0)
{
- memcpy( pData, pBuf+nPos, static_cast<size_t>(nCount) );
+ memcpy( pData, pBuf+nPos, nCount );
}
nPos += nCount;
return nCount;
@@ -1746,7 +1746,7 @@ std::size_t SvMemoryStream::PutData( const void* pData, std::size_t nCount )
}
}
assert(pBuf && "Possibly Reallocate failed");
- memcpy( pBuf+nPos, pData, static_cast<size_t>(nCount));
+ memcpy( pBuf+nPos, pData, nCount);
nPos += nCount;
if( nPos > nEndOfData )
@@ -1824,7 +1824,7 @@ bool SvMemoryStream::ReAllocateMemory( long nDiff )
bRetVal = true; // Success!
if( nNewSize < nSize ) // Are we shrinking?
{
- memcpy( pNewBuf, pBuf, static_cast<size_t>(nNewSize) );
+ memcpy( pNewBuf, pBuf, nNewSize );
if( nPos > nNewSize )
nPos = 0;
if( nEndOfData >= nNewSize )
@@ -1834,7 +1834,7 @@ bool SvMemoryStream::ReAllocateMemory( long nDiff )
{
if (nSize != 0)
{
- memcpy( pNewBuf, pBuf, static_cast<size_t>(nSize) );
+ memcpy( pNewBuf, pBuf, nSize );
}
memset(pNewBuf + nSize, 0x00, nNewSize - nSize);
}
More information about the Libreoffice-commits
mailing list