Kaydet (Commit) 0c1a37e6 authored tarafından Julien Nabet's avatar Julien Nabet

Some cppcheck cleaning

Change-Id: I74ff9d8d116ebfe9ebc302c79a3763eda9c1250f
üst df98a644
...@@ -569,6 +569,7 @@ CCIDecompressor::CCIDecompressor( sal_uLong nOpts, sal_uInt32 nImageWidth ) : ...@@ -569,6 +569,7 @@ CCIDecompressor::CCIDecompressor( sal_uLong nOpts, sal_uInt32 nImageWidth ) :
bTableBad ( sal_False ), bTableBad ( sal_False ),
bStatus ( sal_False ), bStatus ( sal_False ),
pByteSwap ( NULL ), pByteSwap ( NULL ),
pIStream ( NULL ),
nWidth ( nImageWidth ), nWidth ( nImageWidth ),
nOptions ( nOpts ), nOptions ( nOpts ),
pLastLine ( NULL ) pLastLine ( NULL )
...@@ -623,7 +624,7 @@ void CCIDecompressor::StartDecompression( SvStream & rIStream ) ...@@ -623,7 +624,7 @@ void CCIDecompressor::StartDecompression( SvStream & rIStream )
sal_Bool CCIDecompressor::DecompressScanline( sal_uInt8 * pTarget, sal_uLong nTargetBits ) sal_Bool CCIDecompressor::DecompressScanline( sal_uInt8 * pTarget, sal_uLong nTargetBits )
{ {
sal_uInt16 i; sal_uInt16 i;
sal_uInt8 * pSrc,* pDst; sal_uInt8 * pDst;
sal_Bool b2D; sal_Bool b2D;
if ( nEOLCount >= 5 ) // RTC (Return To Controller) if ( nEOLCount >= 5 ) // RTC (Return To Controller)
...@@ -700,7 +701,7 @@ sal_Bool CCIDecompressor::DecompressScanline( sal_uInt8 * pTarget, sal_uLong nTa ...@@ -700,7 +701,7 @@ sal_Bool CCIDecompressor::DecompressScanline( sal_uInt8 * pTarget, sal_uLong nTa
// if we're in 2D mode we have to remember the line: // if we're in 2D mode we have to remember the line:
if ( nOptions & CCI_OPTION_2D && bStatus == sal_True ) if ( nOptions & CCI_OPTION_2D && bStatus == sal_True )
{ {
pSrc = pTarget; sal_uInt8 *pSrc = pTarget;
pDst = pLastLine; pDst = pLastLine;
for ( i = 0; i < nLastLineSize; i++ ) *(pDst++)=*(pSrc++); for ( i = 0; i < nLastLineSize; i++ ) *(pDst++)=*(pSrc++);
} }
......
...@@ -116,13 +116,13 @@ RscTop * RscArray::GetTypeClass() const ...@@ -116,13 +116,13 @@ RscTop * RscArray::GetTypeClass() const
static RscInstNode * Create( RscInstNode * pNode ) static RscInstNode * Create( RscInstNode * pNode )
{ {
RscInstNode * pRetNode = NULL; RscInstNode * pRetNode = NULL;
RscInstNode * pTmpNode;
if( pNode ) if( pNode )
{ {
pRetNode = new RscInstNode( pNode->GetId() ); pRetNode = new RscInstNode( pNode->GetId() );
pRetNode->aInst = pNode->aInst.pClass->Create( NULL, pNode->aInst ); pRetNode->aInst = pNode->aInst.pClass->Create( NULL, pNode->aInst );
if( (pTmpNode = Create( pNode->Left() )) != NULL ) RscInstNode * pTmpNode = Create(pNode->Left());
if (pTmpNode)
pRetNode->Insert( pTmpNode ); pRetNode->Insert( pTmpNode );
if( (pTmpNode = Create( pNode->Right() )) != NULL ) if( (pTmpNode = Create( pNode->Right() )) != NULL )
pRetNode->Insert( pTmpNode ); pRetNode->Insert( pTmpNode );
...@@ -381,14 +381,11 @@ static sal_Bool IsValueDefault( RscInstNode * pNode, CLASS_DATA pDef ) ...@@ -381,14 +381,11 @@ static sal_Bool IsValueDefault( RscInstNode * pNode, CLASS_DATA pDef )
sal_Bool RscArray::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ) sal_Bool RscArray::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef )
{ {
RscArrayInst * pClassData; sal_Bool bRet = RscTop::IsValueDefault( rInst, pDef );
sal_Bool bRet;
bRet = RscTop::IsValueDefault( rInst, pDef );
if( bRet ) if( bRet )
{ {
pClassData = (RscArrayInst *)(rInst.pData + nOffInstData); RscArrayInst * pClassData = (RscArrayInst *)(rInst.pData + nOffInstData);
bRet = ::IsValueDefault( pClassData->pNode, pDef ); bRet = ::IsValueDefault( pClassData->pNode, pDef );
} }
......
...@@ -234,7 +234,7 @@ struct SwHTMLFmtInfo ...@@ -234,7 +234,7 @@ struct SwHTMLFmtInfo
// Konstruktor fuer einen Dummy zum Suchen // Konstruktor fuer einen Dummy zum Suchen
SwHTMLFmtInfo( const SwFmt *pF ) : SwHTMLFmtInfo( const SwFmt *pF ) :
pFmt( pF ), pRefFmt(0), pItemSet( 0 ), nFirstLineIndent(0) pFmt( pF ), pRefFmt(0), pItemSet( 0 ), nFirstLineIndent(0), bScriptDependent(false)
{} {}
......
...@@ -40,15 +40,10 @@ ...@@ -40,15 +40,10 @@
void normalize_pe_image(sal_uInt8* buffer, size_t nBufferSize) void normalize_pe_image(sal_uInt8* buffer, size_t nBufferSize)
{ {
const int OFFSET_PE_OFFSET = 0x3c;
const int OFFSET_COFF_TIMEDATESTAMP = 4;
const int PE_SIGNATURE_SIZE = 4;
const int COFFHEADER_SIZE = 20;
const int OFFSET_PE_OPTIONALHEADER_CHECKSUM = 64;
// Check the header part of the file buffer // Check the header part of the file buffer
if (buffer[0] == sal_uInt8('M') && buffer[1] == sal_uInt8('Z')) if (buffer[0] == sal_uInt8('M') && buffer[1] == sal_uInt8('Z'))
{ {
const int OFFSET_PE_OFFSET = 0x3c;
unsigned long PEHeaderOffset = (long)buffer[OFFSET_PE_OFFSET]; unsigned long PEHeaderOffset = (long)buffer[OFFSET_PE_OFFSET];
if (PEHeaderOffset < nBufferSize-4) if (PEHeaderOffset < nBufferSize-4)
{ {
...@@ -57,6 +52,8 @@ void normalize_pe_image(sal_uInt8* buffer, size_t nBufferSize) ...@@ -57,6 +52,8 @@ void normalize_pe_image(sal_uInt8* buffer, size_t nBufferSize)
buffer[PEHeaderOffset+2] == 0 && buffer[PEHeaderOffset+2] == 0 &&
buffer[PEHeaderOffset+3] == 0 ) buffer[PEHeaderOffset+3] == 0 )
{ {
const int PE_SIGNATURE_SIZE = 4;
const int OFFSET_COFF_TIMEDATESTAMP = 4;
PEHeaderOffset += PE_SIGNATURE_SIZE; PEHeaderOffset += PE_SIGNATURE_SIZE;
if (PEHeaderOffset+OFFSET_COFF_TIMEDATESTAMP < nBufferSize-4) if (PEHeaderOffset+OFFSET_COFF_TIMEDATESTAMP < nBufferSize-4)
{ {
...@@ -68,7 +65,8 @@ void normalize_pe_image(sal_uInt8* buffer, size_t nBufferSize) ...@@ -68,7 +65,8 @@ void normalize_pe_image(sal_uInt8* buffer, size_t nBufferSize)
buffer[PEHeaderOffset+OFFSET_COFF_TIMEDATESTAMP+2] = 0; buffer[PEHeaderOffset+OFFSET_COFF_TIMEDATESTAMP+2] = 0;
buffer[PEHeaderOffset+OFFSET_COFF_TIMEDATESTAMP+3] = 0; buffer[PEHeaderOffset+OFFSET_COFF_TIMEDATESTAMP+3] = 0;
} }
const int COFFHEADER_SIZE = 20;
const int OFFSET_PE_OPTIONALHEADER_CHECKSUM = 64;
if (PEHeaderOffset+COFFHEADER_SIZE+OFFSET_PE_OPTIONALHEADER_CHECKSUM < nBufferSize-4) if (PEHeaderOffset+COFFHEADER_SIZE+OFFSET_PE_OPTIONALHEADER_CHECKSUM < nBufferSize-4)
{ {
// Set checksum to a normalized value // Set checksum to a normalized value
...@@ -84,9 +82,6 @@ void normalize_pe_image(sal_uInt8* buffer, size_t nBufferSize) ...@@ -84,9 +82,6 @@ void normalize_pe_image(sal_uInt8* buffer, size_t nBufferSize)
rtlDigestError calc_md5_checksum(const char *filename, rtl::OString &rChecksum) rtlDigestError calc_md5_checksum(const char *filename, rtl::OString &rChecksum)
{ {
const size_t BUFFER_SIZE = 0x1000;
const size_t MINIMAL_SIZE = 512;
sal_uInt8 checksum[RTL_DIGEST_LENGTH_MD5]; sal_uInt8 checksum[RTL_DIGEST_LENGTH_MD5];
rtlDigestError error = rtl_Digest_E_None; rtlDigestError error = rtl_Digest_E_None;
rtl::OStringBuffer aChecksumBuf; rtl::OStringBuffer aChecksumBuf;
...@@ -99,6 +94,7 @@ rtlDigestError calc_md5_checksum(const char *filename, rtl::OString &rChecksum) ...@@ -99,6 +94,7 @@ rtlDigestError calc_md5_checksum(const char *filename, rtl::OString &rChecksum)
if ( digest ) if ( digest )
{ {
const size_t BUFFER_SIZE = 0x1000;
size_t nBytesRead; size_t nBytesRead;
sal_uInt8 buffer[BUFFER_SIZE]; sal_uInt8 buffer[BUFFER_SIZE];
bool bHeader(true); bool bHeader(true);
...@@ -109,6 +105,7 @@ rtlDigestError calc_md5_checksum(const char *filename, rtl::OString &rChecksum) ...@@ -109,6 +105,7 @@ rtlDigestError calc_md5_checksum(const char *filename, rtl::OString &rChecksum)
if (bHeader) if (bHeader)
{ {
bHeader = false; bHeader = false;
const size_t MINIMAL_SIZE = 512;
if (nBytesRead >= MINIMAL_SIZE && buffer[0] == sal_uInt8('M') && buffer[1] == sal_uInt8('Z') ) if (nBytesRead >= MINIMAL_SIZE && buffer[0] == sal_uInt8('M') && buffer[1] == sal_uInt8('Z') )
normalize_pe_image(buffer, nBytesRead); normalize_pe_image(buffer, nBytesRead);
} }
......
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