[Libreoffice-commits] core.git: 10 commits - extensions/source filter/source formula/source idlc/source io/source linguistic/source
Stephan Bergmann
sbergman at redhat.com
Wed Oct 7 03:50:09 PDT 2015
extensions/source/scanner/sane.cxx | 43 ++++++++------------------
extensions/source/scanner/sane.hxx | 8 ++--
extensions/source/scanner/sanedlg.cxx | 8 +---
filter/source/graphicfilter/epict/epict.cxx | 7 +---
filter/source/graphicfilter/ipict/ipict.cxx | 12 ++++---
filter/source/graphicfilter/iras/iras.cxx | 8 +++-
formula/source/core/api/FormulaCompiler.cxx | 18 +++++-----
formula/source/ui/dlg/formula.cxx | 3 -
idlc/source/idlccompile.cxx | 4 +-
io/source/TextInputStream/TextInputStream.cxx | 1
linguistic/source/dicimp.cxx | 9 ++---
11 files changed, 51 insertions(+), 70 deletions(-)
New commits:
commit 3be460bbd609041aa03005e8d7bf8f424622a8a9
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Wed Oct 7 12:34:15 2015 +0200
clang-analyzer-deadcode.DeadStores
Change-Id: Ie8e69d2a39abf6538cf3f8b75b76042ca7b71521
diff --git a/linguistic/source/dicimp.cxx b/linguistic/source/dicimp.cxx
index e9820d5..016ecb9 100644
--- a/linguistic/source/dicimp.cxx
+++ b/linguistic/source/dicimp.cxx
@@ -260,13 +260,12 @@ sal_uLong DictionaryNeo::loadEntries(const OUString &rMainURL)
SvStreamPtr pStream = SvStreamPtr( utl::UcbStreamHelper::CreateStream( xStream ) );
- sal_uLong nErr = sal::static_int_cast< sal_uLong >(-1);
-
// read header
bool bNegativ;
sal_uInt16 nLang;
nDicVersion = ReadDicVersion(pStream, nLang, bNegativ);
- if (0 != (nErr = pStream->GetError()))
+ sal_uLong nErr = pStream->GetError();
+ if (0 != nErr)
return nErr;
nLanguage = nLang;
@@ -440,7 +439,6 @@ sal_uLong DictionaryNeo::saveEntries(const OUString &rURL)
if (!xStream.is())
return static_cast< sal_uLong >(-1);
- sal_uLong nErr = sal::static_int_cast< sal_uLong >(-1);
SvStreamPtr pStream = SvStreamPtr( utl::UcbStreamHelper::CreateStream( xStream ) );
@@ -448,7 +446,8 @@ sal_uLong DictionaryNeo::saveEntries(const OUString &rURL)
rtl_TextEncoding eEnc = RTL_TEXTENCODING_UTF8;
pStream->WriteLine(OString(pVerOOo7));
- if (0 != (nErr = pStream->GetError()))
+ sal_uLong nErr = pStream->GetError();
+ if (0 != nErr)
return nErr;
/* XXX: the <none> case could be differentiated, is it absence or
* undetermined or multiple? Earlier versions did not know about 'und' and
commit 1d00baff394da0953a1ef1eb6ccd9c4c4995443b
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Wed Oct 7 12:32:59 2015 +0200
clang-analyzer-deadcode.DeadStores
Change-Id: I22b423b99c87070ab1b8ce7f3eff928384951947
diff --git a/io/source/TextInputStream/TextInputStream.cxx b/io/source/TextInputStream/TextInputStream.cxx
index 75e6871..edfe2f3 100644
--- a/io/source/TextInputStream/TextInputStream.cxx
+++ b/io/source/TextInputStream/TextInputStream.cxx
@@ -344,7 +344,6 @@ sal_Int32 OTextInputStream::implReadNext()
mSeqSource.realloc( nTotalRead );
}
mSeqSource.getArray()[ nOldLen ] = aOneByteSeq.getConstArray()[ 0 ];
- pbSource = mSeqSource.getConstArray();
bCont = true;
}
commit f72ebcbe43102c3a6eda1ec826ab9c5f53111189
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Wed Oct 7 12:31:23 2015 +0200
clang-analyzer-deadcode.DeadStores
Change-Id: I9c409cb2d7898ac6f395618cd950385cf036b002
diff --git a/idlc/source/idlccompile.cxx b/idlc/source/idlccompile.cxx
index fd4b58b..beb9fb8 100644
--- a/idlc/source/idlccompile.cxx
+++ b/idlc/source/idlccompile.cxx
@@ -388,8 +388,8 @@ sal_Int32 compileFile(const OString * pathname)
//yydebug = 1 parser produce trace information
yydebug = 0;
- sal_Int32 nErrors = yyparse();
- nErrors = idlc()->getErrorCount();
+ yyparse();
+ sal_Int32 nErrors = idlc()->getErrorCount();
fclose(yyin);
if (unlink(preprocFile.getStr()) != 0)
commit dc2b5cbbf6ab30def8b7f253ee001d4d8ed2281a
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Wed Oct 7 12:30:13 2015 +0200
clang-analyzer-deadcode.DeadStores
Change-Id: I273aee2d65f952afd78f6e2e504b5fa70dd65ef0
diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx
index 9d613e9..443efc8 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -1157,7 +1157,7 @@ void FormulaCompiler::Factor()
if( eOp != ocClose )
SetError( errPairExpected);
else
- eOp = NextToken();
+ NextToken();
}
}
}
@@ -1181,7 +1181,7 @@ void FormulaCompiler::Factor()
if (eOp != ocClose)
SetError( errPairExpected);
else
- eOp = NextToken();
+ NextToken();
}
else
{
@@ -1240,7 +1240,7 @@ void FormulaCompiler::Factor()
if (eOp != ocClose)
SetError( errPairExpected);
PutCode( pFacToken);
- eOp = NextToken();
+ NextToken();
}
}
// special cases NOT() and NEG()
@@ -1278,7 +1278,7 @@ void FormulaCompiler::Factor()
if (eOp != ocClose)
SetError( errPairExpected);
else
- eOp = NextToken();
+ NextToken();
pFacToken->SetByte( nSepCount );
if (nSepCount == 2)
{
@@ -1305,7 +1305,7 @@ void FormulaCompiler::Factor()
else if ( !pArr->GetCodeError() )
pFacToken->SetByte( 1 );
PutCode( pFacToken );
- eOp = NextToken();
+ NextToken();
}
}
else if ((SC_OPCODE_START_2_PAR <= eOp && eOp < SC_OPCODE_STOP_2_PAR)
@@ -1355,7 +1355,7 @@ void FormulaCompiler::Factor()
else if (eOp != ocClose)
SetError( errPairExpected);
else
- eOp = NextToken();
+ NextToken();
// Jumps are just normal functions for the FunctionAutoPilot tree view
if (!mbJumpCommandReorder && pFacToken->GetType() == svJump)
pFacToken = new FormulaFAPToken( pFacToken->GetOpCode(), nSepCount, pFacToken );
@@ -1428,7 +1428,7 @@ void FormulaCompiler::Factor()
SetError( errPairExpected);
else
{
- eOp = NextToken();
+ NextToken();
// always limit to nJumpMax, no arbitrary overwrites
if ( ++nJumpCount <= nJumpMax )
pFacToken->GetJump()[ nJumpCount ] = pc-1;
@@ -1459,7 +1459,7 @@ void FormulaCompiler::Factor()
else if ( eOp == ocMissing )
{
PutCode( mpToken );
- eOp = NextToken();
+ NextToken();
}
else if ( eOp == ocClose )
{
@@ -1477,7 +1477,7 @@ void FormulaCompiler::Factor()
else if ( mpToken->IsExternalRef() )
{
PutCode( mpToken);
- eOp = NextToken();
+ NextToken();
}
else
{
commit 1e42e804da9ae28e24b2e59ebc5430cb08818239
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Wed Oct 7 12:21:49 2015 +0200
clang-analyzer-deadcode.DeadStores
Change-Id: I6a903931fdb3ac1b13d2d9c39071cc27c08fe194
diff --git a/formula/source/ui/dlg/formula.cxx b/formula/source/ui/dlg/formula.cxx
index 86f30c7..2744e87 100644
--- a/formula/source/ui/dlg/formula.cxx
+++ b/formula/source/ui/dlg/formula.cxx
@@ -1354,7 +1354,6 @@ IMPL_LINK_NOARG_TYPED(FormulaDlg_Impl, FormulaCursorHdl, EditBox&, void)
{
FormEditData* pData = m_pHelper->getFormEditData();
if (!pData) return;
- sal_Int32 nFStart = pData->GetFStart();
bEditFlag=true;
@@ -1373,7 +1372,7 @@ IMPL_LINK_NOARG_TYPED(FormulaDlg_Impl, FormulaCursorHdl, EditBox&, void)
{
sal_Int32 nPos = aSel.Min();
- nFStart=GetFunctionPos(nPos - 1);
+ sal_Int32 nFStart=GetFunctionPos(nPos - 1);
if(nFStart<nPos)
{
commit 6eaf556542a8635c1d0ecbdfe00a5da394db6a81
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Wed Oct 7 12:16:06 2015 +0200
clang-analyzer-deadcode.DeadStores
Change-Id: Ic9d76c173d3948c973a96a97debccc771c2c9ede
diff --git a/filter/source/graphicfilter/ipict/ipict.cxx b/filter/source/graphicfilter/ipict/ipict.cxx
index 53b1a09..de3516b 100644
--- a/filter/source/graphicfilter/ipict/ipict.cxx
+++ b/filter/source/graphicfilter/ipict/ipict.cxx
@@ -706,9 +706,9 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo
BitmapWriteAccess* pAcc = NULL;
BitmapReadAccess* pReadAcc = NULL;
sal_uInt16 nColTabSize;
- sal_uInt16 nRowBytes, nBndX, nBndY, nWidth, nHeight, nVersion, nPackType, nPixelType,
+ sal_uInt16 nRowBytes, nBndX, nBndY, nWidth, nHeight, nPackType,
nPixelSize, nCmpCount, nCmpSize;
- sal_uInt32 nPackSize, nPlaneBytes, nHRes, nVRes;
+ sal_uInt32 nHRes, nVRes;
sal_uInt8 nDat, nRed, nGreen, nBlue, nDummy;
size_t i, nDataSize = 0;
@@ -730,6 +730,10 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo
if ( ( nRowBytes & 0x8000 ) != 0 )
{ // it is a PixMap
nRowBytes &= 0x3fff;
+ sal_uInt16 nVersion;
+ sal_uInt32 nPackSize;
+ sal_uInt16 nPixelType;
+ sal_uInt32 nPlaneBytes;
pPict->ReadUInt16( nVersion ).ReadUInt16( nPackType ).ReadUInt32( nPackSize ).ReadUInt32( nHRes ).ReadUInt32( nVRes ).ReadUInt16( nPixelType ). ReadUInt16( nPixelSize ).ReadUInt16( nCmpCount ).ReadUInt16( nCmpSize ).ReadUInt32( nPlaneBytes );
pPict->SeekRel( 8 );
@@ -769,10 +773,8 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo
else
{
nRowBytes &= 0x3fff;
- nVersion = 0;
nPackType = 0;
- nPackSize = nHRes = nVRes = nPlaneBytes = 0;
- nPixelType = 0;
+ // nHRes = nVRes = 0;
nPixelSize = nCmpCount = nCmpSize = 1;
nDataSize += 10;
aBitmap = Bitmap( Size( nWidth, nHeight ), 1 );
commit 54bb1410eebce79e29ef33068efab59f0fb58881
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Wed Oct 7 12:13:07 2015 +0200
clang-analyzer-deadcode.DeadStores
Change-Id: I028994045b13625e09589190e3cc259c49714e20
diff --git a/filter/source/graphicfilter/iras/iras.cxx b/filter/source/graphicfilter/iras/iras.cxx
index b569d5b..ea92080 100644
--- a/filter/source/graphicfilter/iras/iras.cxx
+++ b/filter/source/graphicfilter/iras/iras.cxx
@@ -215,11 +215,12 @@ bool RASReader::ImplReadHeader()
bool RASReader::ImplReadBody(BitmapWriteAccess * pAcc)
{
sal_Int32 x, y;
- sal_uInt8 nDat = 0;
sal_uInt8 nRed, nGreen, nBlue;
switch ( mnDstBitsPerPix )
{
case 1 :
+ {
+ sal_uInt8 nDat = 0;
for (y = 0; y < mnHeight && mbStatus; ++y)
{
for (x = 0; x < mnWidth && mbStatus; ++x)
@@ -242,13 +243,14 @@ bool RASReader::ImplReadBody(BitmapWriteAccess * pAcc)
}
}
break;
+ }
case 8 :
for (y = 0; y < mnHeight && mbStatus; ++y)
{
for (x = 0; x < mnWidth && mbStatus; ++x)
{
- nDat = ImplGetByte();
+ sal_uInt8 nDat = ImplGetByte();
pAcc->SetPixelIndex( y, x, nDat );
if (!m_rRAS.good())
mbStatus = false;
@@ -301,7 +303,7 @@ bool RASReader::ImplReadBody(BitmapWriteAccess * pAcc)
{
for (x = 0; x < mnWidth && mbStatus; ++x)
{
- nDat = ImplGetByte(); // pad byte > nil
+ ImplGetByte(); // pad byte > nil
if ( mnType == RAS_TYPE_RGB_FORMAT )
{
nRed = ImplGetByte();
commit 5ab441664a6207fcff48c14b950db157c4c6d39d
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Wed Oct 7 12:10:20 2015 +0200
clang-analyzer-deadcode.DeadStores
Change-Id: I4c9013fca76b213a725e39a47e61775caf5e8519
diff --git a/filter/source/graphicfilter/epict/epict.cxx b/filter/source/graphicfilter/epict/epict.cxx
index b421497..267488b 100644
--- a/filter/source/graphicfilter/epict/epict.cxx
+++ b/filter/source/graphicfilter/epict/epict.cxx
@@ -870,7 +870,7 @@ void PictWriter::WriteOpcode_BitsRect(const Point & rPoint, const Size & rSize,
Bitmap aBitmap( rBitmap );
sal_uLong nWidth, nHeight, nDstRowBytes, nx, nc, ny, nCount, nColTabSize, i;
- sal_uLong nDstRowPos, nSrcRowBytes, nEqu3, nPos, nDstMapPos;
+ sal_uLong nDstRowPos, nEqu3, nPos, nDstMapPos;
sal_uInt16 nBitsPerPixel, nPackType;
sal_uInt8 *pComp[4], *pTemp;
sal_uInt8 nEquData = 0;
@@ -899,8 +899,7 @@ void PictWriter::WriteOpcode_BitsRect(const Point & rPoint, const Size & rSize,
// If 24-Bit, then create the Opcode 'DirectBitsRect':
if ( nBitsPerPixel == 24 )
{
- // Calculate the number of bytes of an (uncompressed) line of source and destination.
- nSrcRowBytes =( ( 3 * nWidth ) + 0x0003 ) & 0xfffc;
+ // Calculate the number of bytes of an (uncompressed) line of destination.
nDstRowBytes = nWidth * 4;
// writing Opcode and BaseAddr (?):
@@ -1086,7 +1085,7 @@ void PictWriter::WriteOpcode_BitsRect(const Point & rPoint, const Size & rSize,
// Calculate the number of bytes of an (unpacked) line of source an destination.
nDstRowBytes = ( nWidth * nBitsPerPixel + 7 ) >> 3;
- nSrcRowBytes = ( nDstRowBytes + 3 ) & 0xfffffffc;
+ sal_uLong nSrcRowBytes = ( nDstRowBytes + 3 ) & 0xfffffffc;
// writing Opcode:
pPict->WriteUInt16( 0x0098 );
commit 61806cb98388c42f950ec8db2f51f4fd402db67d
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Wed Oct 7 12:07:11 2015 +0200
clang-analyzer-deadcode.DeadStores
Change-Id: Id193a3fa8c3832da783f8647d6fc6db8375149f4
diff --git a/extensions/source/scanner/sanedlg.cxx b/extensions/source/scanner/sanedlg.cxx
index 0d32908..94c4c0f 100644
--- a/extensions/source/scanner/sanedlg.cxx
+++ b/extensions/source/scanner/sanedlg.cxx
@@ -368,7 +368,6 @@ void SaneDlg::InitFields()
int nOption, i, nValue;
double fValue;
- bool bSuccess = false;
const char *ppSpecialOptions[] = {
"resolution",
"tl-x",
@@ -395,8 +394,7 @@ void SaneDlg::InitFields()
{
double fRes;
- bSuccess = mrSane.GetOptionValue( nOption, fRes );
- if( bSuccess )
+ if( mrSane.GetOptionValue( nOption, fRes ) )
{
mpReslBox->Enable( true );
@@ -468,11 +466,9 @@ void SaneDlg::InitFields()
pField = mpBottomField;
}
nOption = pOptionName ? mrSane.GetOptionByName( pOptionName ) : -1;
- bSuccess = false;
if( nOption != -1 )
{
- bSuccess = mrSane.GetOptionValue( nOption, fValue );
- if( bSuccess )
+ if( mrSane.GetOptionValue( nOption, fValue ) )
{
if( mrSane.GetOptionUnit( nOption ) == SANE_UNIT_MM )
{
commit 27ec6a8ef39e95a7094503aa3036f268f62408ad
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Wed Oct 7 12:05:17 2015 +0200
Sane::SetOptionValue return values are unused
Change-Id: Ie9310be6508fe828ca1ef36372d56596a02085aa
diff --git a/extensions/source/scanner/sane.cxx b/extensions/source/scanner/sane.cxx
index e95446a..d2d3e4b 100644
--- a/extensions/source/scanner/sane.cxx
+++ b/extensions/source/scanner/sane.cxx
@@ -410,46 +410,37 @@ bool Sane::GetOptionValue( int n, double* pSet )
return true;
}
-bool Sane::SetOptionValue( int n, bool bSet )
+void Sane::SetOptionValue( int n, bool bSet )
{
if( ! maHandle || mppOptions[n]->type != SANE_TYPE_BOOL )
- return false;
+ return;
SANE_Word nRet = bSet ? SANE_TRUE : SANE_FALSE;
- SANE_Status nStatus = ControlOption( n, SANE_ACTION_SET_VALUE, &nRet );
- if( nStatus != SANE_STATUS_GOOD )
- return false;
- return true;
+ ControlOption( n, SANE_ACTION_SET_VALUE, &nRet );
}
-bool Sane::SetOptionValue( int n, const OUString& rSet )
+void Sane::SetOptionValue( int n, const OUString& rSet )
{
if( ! maHandle || mppOptions[n]->type != SANE_TYPE_STRING )
- return false;
+ return;
OString aSet(OUStringToOString(rSet, osl_getThreadTextEncoding()));
- SANE_Status nStatus = ControlOption( n, SANE_ACTION_SET_VALUE, const_cast<char *>(aSet.getStr()) );
- if( nStatus != SANE_STATUS_GOOD )
- return false;
- return true;
+ ControlOption( n, SANE_ACTION_SET_VALUE, const_cast<char *>(aSet.getStr()) );
}
-bool Sane::SetOptionValue( int n, double fSet, int nElement )
+void Sane::SetOptionValue( int n, double fSet, int nElement )
{
- bool bSuccess = false;
-
if( ! maHandle || ( mppOptions[n]->type != SANE_TYPE_INT &&
mppOptions[n]->type != SANE_TYPE_FIXED ) )
- return false;
+ return;
- SANE_Status nStatus;
if( mppOptions[n]->size/sizeof(SANE_Word) > 1 )
{
std::unique_ptr<SANE_Word[]> pSet(new SANE_Word[mppOptions[n]->size/sizeof(SANE_Word)]);
- nStatus = ControlOption( n, SANE_ACTION_GET_VALUE, pSet.get() );
+ SANE_Status nStatus = ControlOption( n, SANE_ACTION_GET_VALUE, pSet.get() );
if( nStatus == SANE_STATUS_GOOD )
{
pSet[nElement] = mppOptions[n]->type == SANE_TYPE_INT ?
(SANE_Word)fSet : SANE_FIX( fSet );
- nStatus = ControlOption( n, SANE_ACTION_SET_VALUE, pSet.get() );
+ ControlOption( n, SANE_ACTION_SET_VALUE, pSet.get() );
}
}
else
@@ -458,18 +449,15 @@ bool Sane::SetOptionValue( int n, double fSet, int nElement )
mppOptions[n]->type == SANE_TYPE_INT ?
(SANE_Word)fSet : SANE_FIX( fSet );
- nStatus = ControlOption( n, SANE_ACTION_SET_VALUE, &nSetTo );
- if( nStatus == SANE_STATUS_GOOD )
- bSuccess = true;
+ ControlOption( n, SANE_ACTION_SET_VALUE, &nSetTo );
}
- return bSuccess;
}
-bool Sane::SetOptionValue( int n, double* pSet )
+void Sane::SetOptionValue( int n, double* pSet )
{
if( ! maHandle || ( mppOptions[n]->type != SANE_TYPE_INT &&
mppOptions[n]->type != SANE_TYPE_FIXED ) )
- return false;
+ return;
std::unique_ptr<SANE_Word[]> pFixedSet(new SANE_Word[mppOptions[n]->size/sizeof(SANE_Word)]);
for( size_t i = 0; i < mppOptions[n]->size/sizeof(SANE_Word); i++ )
{
@@ -478,10 +466,7 @@ bool Sane::SetOptionValue( int n, double* pSet )
else
pFixedSet[i] = (SANE_Word)pSet[i];
}
- SANE_Status nStatus = ControlOption( n, SANE_ACTION_SET_VALUE, pFixedSet.get() );
- if( nStatus != SANE_STATUS_GOOD )
- return false;
- return true;
+ ControlOption( n, SANE_ACTION_SET_VALUE, pFixedSet.get() );
}
enum FrameStyleType {
diff --git a/extensions/source/scanner/sane.hxx b/extensions/source/scanner/sane.hxx
index 7f204f6..4f755e6 100644
--- a/extensions/source/scanner/sane.hxx
+++ b/extensions/source/scanner/sane.hxx
@@ -150,10 +150,10 @@ public:
bool GetOptionValue( int, double&, int nElement = 0 );
bool GetOptionValue( int, double* );
- bool SetOptionValue( int, bool );
- bool SetOptionValue( int, const OUString& );
- bool SetOptionValue( int, double, int nElement = 0 );
- bool SetOptionValue( int, double* );
+ void SetOptionValue( int, bool );
+ void SetOptionValue( int, const OUString& );
+ void SetOptionValue( int, double, int nElement = 0 );
+ void SetOptionValue( int, double* );
bool ActivateButtonOption( int );
More information about the Libreoffice-commits
mailing list