Some cppcheck cleaning

This commit is contained in:
Julien Nabet
2011-02-10 14:48:51 +01:00
parent 31b0769d2c
commit 4d1e8ed389
11 changed files with 18 additions and 20 deletions

View File

@@ -543,10 +543,9 @@ String MsgEdit::GetSelected()
TextSelection MsgEdit::GetSelection() const TextSelection MsgEdit::GetSelection() const
{ {
ULONG nStart=0,nEnd=0;
if ( aEditTree.FirstSelected() ) if ( aEditTree.FirstSelected() )
{ {
ULONG nStart=0,nEnd=0;
nStart = aEditTree.GetModel()->GetAbsPos(aEditTree.FirstSelected() ); nStart = aEditTree.GetModel()->GetAbsPos(aEditTree.FirstSelected() );
if ( aEditTree.LastSelected() ) if ( aEditTree.LastSelected() )
nEnd = aEditTree.GetModel()->GetAbsPos(aEditTree.LastSelected() ); nEnd = aEditTree.GetModel()->GetAbsPos(aEditTree.LastSelected() );

View File

@@ -149,7 +149,6 @@ BOOL SbiImage::Load( SvStream& r, UINT32& nVersion )
ULONG nNext; ULONG nNext;
while( ( nNext = r.Tell() ) < nLast ) while( ( nNext = r.Tell() ) < nLast )
{ {
short i;
r >> nSign >> nLen >> nCount; r >> nSign >> nLen >> nCount;
nNext += nLen + 8; nNext += nLen + 8;
@@ -217,6 +216,7 @@ BOOL SbiImage::Load( SvStream& r, UINT32& nVersion )
case B_STRINGPOOL: case B_STRINGPOOL:
if( bBadVer ) break; if( bBadVer ) break;
MakeStrings( nCount ); MakeStrings( nCount );
short i;
for( i = 0; i < nStrings && SbiGood( r ); i++ ) for( i = 0; i < nStrings && SbiGood( r ); i++ )
{ {
r >> nOff; r >> nOff;

View File

@@ -375,12 +375,12 @@ SbxObject* cloneTypeObjectImpl( const SbxObject& rTypeObj )
SbxBase* pParObj = pVar->GetObject(); SbxBase* pParObj = pVar->GetObject();
SbxDimArray* pSource = PTR_CAST(SbxDimArray,pParObj); SbxDimArray* pSource = PTR_CAST(SbxDimArray,pParObj);
SbxDimArray* pDest = new SbxDimArray( pVar->GetType() ); SbxDimArray* pDest = new SbxDimArray( pVar->GetType() );
INT32 lb = 0;
INT32 ub = 0;
pDest->setHasFixedSize( pSource->hasFixedSize() ); pDest->setHasFixedSize( pSource->hasFixedSize() );
if ( pSource->GetDims() && pSource->hasFixedSize() ) if ( pSource->GetDims() && pSource->hasFixedSize() )
{ {
INT32 lb = 0;
INT32 ub = 0;
for ( INT32 j = 1 ; j <= pSource->GetDims(); ++j ) for ( INT32 j = 1 ; j <= pSource->GetDims(); ++j )
{ {
pSource->GetDim32( (INT32)j, lb, ub ); pSource->GetDim32( (INT32)j, lb, ub );

View File

@@ -289,7 +289,7 @@ static void myftoa( double nNum, char * pBuf, short nPrec, short nExpWidth,
short nExp = 0; // Exponent short nExp = 0; // Exponent
short nDig = nPrec + 1; // Anzahl Digits in Zahl short nDig = nPrec + 1; // Anzahl Digits in Zahl
short nDec; // Anzahl Vorkommastellen short nDec; // Anzahl Vorkommastellen
register int i, digit; register int i;
// Komma besorgen // Komma besorgen
sal_Unicode cDecimalSep, cThousandSep; sal_Unicode cDecimalSep, cThousandSep;
@@ -339,6 +339,7 @@ static void myftoa( double nNum, char * pBuf, short nPrec, short nExpWidth,
// Zahl ausgeben: // Zahl ausgeben:
if( nDig > 0 ) if( nDig > 0 )
{ {
register int digit;
for( i = 0 ; ; ++i ) for( i = 0 ; ; ++i )
{ {
if( i < 16 ) if( i < 16 )
@@ -747,8 +748,6 @@ void SbxValue::Format( XubString& rRes, const XubString* pFmt ) const
SvNumberFormatter aFormatter( xFactory, eLangType ); SvNumberFormatter aFormatter( xFactory, eLangType );
sal_uInt32 nIndex; sal_uInt32 nIndex;
xub_StrLen nCheckPos = 0;
short nType;
double nNumber; double nNumber;
Color* pCol; Color* pCol;
@@ -757,6 +756,8 @@ void SbxValue::Format( XubString& rRes, const XubString* pFmt ) const
// number format, use SvNumberFormatter to handle it. // number format, use SvNumberFormatter to handle it.
if( bSuccess ) if( bSuccess )
{ {
xub_StrLen nCheckPos = 0;
short nType;
String aFmtStr = *pFmt; String aFmtStr = *pFmt;
VbaFormatInfo* pInfo = getFormatInfo( aFmtStr ); VbaFormatInfo* pInfo = getFormatInfo( aFmtStr );
if( pInfo && pInfo->meType != VBA_FORMAT_TYPE_NULL ) if( pInfo && pInfo->meType != VBA_FORMAT_TYPE_NULL )

View File

@@ -1199,7 +1199,6 @@ BOOL SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp )
} }
else if( GetType() == SbxCURRENCY || rOp.GetType() == SbxCURRENCY ) else if( GetType() == SbxCURRENCY || rOp.GetType() == SbxCURRENCY )
{ {
double dTest;
aL.eType = SbxCURRENCY; aL.eType = SbxCURRENCY;
aR.eType = SbxCURRENCY; aR.eType = SbxCURRENCY;
@@ -1210,6 +1209,7 @@ BOOL SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp )
if( Get( aL ) ) switch( eOp ) if( Get( aL ) ) switch( eOp )
{ {
double dTest;
case SbxMUL: case SbxMUL:
// first overflow check: see if product will fit - test real value of product (hence 2 curr factors) // first overflow check: see if product will fit - test real value of product (hence 2 curr factors)
dTest = (double)aL.nInt64 * (double)aR.nInt64 / (double)CURRENCY_FACTOR_SQUARE; dTest = (double)aL.nInt64 * (double)aR.nInt64 / (double)CURRENCY_FACTOR_SQUARE;

View File

@@ -252,7 +252,6 @@ void DBTypeConversion::setValue(const Reference<XColumnUpdate>& xVariant,
sal_Int16 nFieldType, sal_Int16 nFieldType,
sal_Int16 nKeyType) throw(::com::sun::star::lang::IllegalArgumentException) sal_Int16 nKeyType) throw(::com::sun::star::lang::IllegalArgumentException)
{ {
double fValue = 0;
if (rString.getLength()) if (rString.getLength())
{ {
// Muss der String formatiert werden? // Muss der String formatiert werden?
@@ -264,7 +263,7 @@ void DBTypeConversion::setValue(const Reference<XColumnUpdate>& xVariant,
// wirft convertStringToNumber eine NotNumericException // wirft convertStringToNumber eine NotNumericException
try try
{ {
fValue = xFormatter->convertStringToNumber(nKeyToUse, rString); double fValue = xFormatter->convertStringToNumber(nKeyToUse, rString);
sal_Int32 nRealUsedKey = xFormatter->detectNumberFormat(0, rString); sal_Int32 nRealUsedKey = xFormatter->detectNumberFormat(0, rString);
if (nRealUsedKey != nKeyToUse) if (nRealUsedKey != nKeyToUse)
nRealUsedTypeClass = getNumberFormatType(xFormatter, nRealUsedKey) & ~NumberFormat::DEFINED; nRealUsedTypeClass = getNumberFormatType(xFormatter, nRealUsedKey) & ~NumberFormat::DEFINED;

View File

@@ -161,7 +161,7 @@ void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyV
::dbtools::throwFunctionSequenceException(*this); ::dbtools::throwFunctionSequenceException(*this);
} }
catch(const Exception ) catch(const Exception& )
{ {
osl_decrementInterlockedCount( &m_refCount ); osl_decrementInterlockedCount( &m_refCount );
throw; throw;

View File

@@ -48,7 +48,7 @@ IniParser::IniParser(OUString const & rIniName) throw(com::sun::star::io::IOExce
if (iniUrl.getLength()) if (iniUrl.getLength())
fileError = osl_openFile(iniUrl.pData, &handle, osl_File_OpenFlag_Read); fileError = osl_openFile(iniUrl.pData, &handle, osl_File_OpenFlag_Read);
} }
catch(::com::sun::star::io::IOException e) catch(::com::sun::star::io::IOException&)
{ {
#if OSL_DEBUG_LEVEL > 0 #if OSL_DEBUG_LEVEL > 0
OString file_tmp = OUStringToOString(iniUrl, RTL_TEXTENCODING_ASCII_US); OString file_tmp = OUStringToOString(iniUrl, RTL_TEXTENCODING_ASCII_US);

View File

@@ -75,9 +75,9 @@ namespace connectivity
MQueryExpressionBase( node_type _eNodeType ) : m_eNodeType( _eNodeType ) {} MQueryExpressionBase( node_type _eNodeType ) : m_eNodeType( _eNodeType ) {}
public: public:
sal_Bool isUnknown( ) { return m_eNodeType == Unknown; } sal_Bool isUnknown( ) const { return m_eNodeType == Unknown; }
sal_Bool isStringExpr( ) { return m_eNodeType == StringExpr; } sal_Bool isStringExpr( ) const { return m_eNodeType == StringExpr; }
sal_Bool isExpr( ) { return m_eNodeType == Expr; } sal_Bool isExpr( ) const { return m_eNodeType == Expr; }
}; };
class MQueryExpressionString : public MQueryExpressionBase { class MQueryExpressionString : public MQueryExpressionBase {
@@ -137,7 +137,7 @@ namespace connectivity
{ return m_aExprVector; } { return m_aExprVector; }
// All expressions on a peer level use same condition operator // All expressions on a peer level use same condition operator
bool_cond getExpressionCondition( ) bool_cond getExpressionCondition( ) const
{ return m_aExprCondType; } { return m_aExprCondType; }
MQueryExpression() : MQueryExpressionBase( MQueryExpressionBase::Expr ), MQueryExpression() : MQueryExpressionBase( MQueryExpressionBase::Expr ),

View File

@@ -65,7 +65,7 @@ namespace connectivity
void setCard(nsIAbCard *card); void setCard(nsIAbCard *card);
nsIAbCard *getCard(); nsIAbCard *getCard();
sal_Bool setRowStates(sal_Int32 state){m_RowStates = state; return sal_True;}; sal_Bool setRowStates(sal_Int32 state){m_RowStates = state; return sal_True;};
sal_Int32 getRowStates() { return m_RowStates;}; sal_Int32 getRowStates() const { return m_RowStates;};
}; };
class MQueryHelper : public nsIAbDirectoryQueryResultListener class MQueryHelper : public nsIAbDirectoryQueryResultListener

View File

@@ -885,7 +885,6 @@ void OSQLParseTreeIterator::traverseCreateColumns(const OSQLParseNode* pSelectNo
::rtl::OUString aTypeName; ::rtl::OUString aTypeName;
::rtl::OUString aTableRange; ::rtl::OUString aTableRange;
sal_Int32 nType = DataType::VARCHAR; sal_Int32 nType = DataType::VARCHAR;
sal_Int32 nLen = 0;
aColumnName = pColumnRef->getChild(0)->getTokenValue(); aColumnName = pColumnRef->getChild(0)->getTokenValue();
OSQLParseNode *pDatatype = pColumnRef->getChild(1); OSQLParseNode *pDatatype = pColumnRef->getChild(1);
@@ -899,7 +898,7 @@ void OSQLParseTreeIterator::traverseCreateColumns(const OSQLParseNode* pSelectNo
const OSQLParseNode *pParams = pDatatype->getChild(pDatatype->count()-1); const OSQLParseNode *pParams = pDatatype->getChild(pDatatype->count()-1);
if ( pParams->count() ) if ( pParams->count() )
{ {
nLen = pParams->getChild(1)->getTokenValue().toInt32(); sal_Int32 nLen = pParams->getChild(1)->getTokenValue().toInt32();
(void)nLen; (void)nLen;
} }
} }