basctl/source/basicide/baside2.cxx | 2 +- basctl/source/basicide/basides1.cxx | 2 +- basctl/source/basicide/bastypes.cxx | 4 ++-- basctl/source/basicide/macrodlg.cxx | 2 +- basctl/source/inc/basobj.hxx | 5 ++--- basctl/source/inc/bastypes.hxx | 2 +- basic/source/classes/sbunoobj.cxx | 10 ++++------ basic/source/inc/date.hxx | 2 +- basic/source/runtime/methods.cxx | 6 +++--- basic/source/sbx/sbxbool.cxx | 2 +- basic/source/sbx/sbxbyte.cxx | 2 +- basic/source/sbx/sbxchar.cxx | 2 +- basic/source/sbx/sbxconv.hxx | 2 +- basic/source/sbx/sbxdbl.cxx | 2 +- basic/source/sbx/sbxint.cxx | 6 +++--- basic/source/sbx/sbxlng.cxx | 2 +- basic/source/sbx/sbxscan.cxx | 18 +++++++----------- basic/source/sbx/sbxsng.cxx | 2 +- basic/source/sbx/sbxuint.cxx | 2 +- basic/source/sbx/sbxulng.cxx | 2 +- basic/source/sbx/sbxvalue.cxx | 6 +++--- basic/source/sbx/sbxvar.cxx | 4 ++-- 22 files changed, 40 insertions(+), 47 deletions(-)
New commits: commit 5d618d73ed8669a75b7b01774f6ea51e99e5b740 Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Tue Oct 31 16:00:24 2017 +0200 loplugin:constantparam in basic,basctl Change-Id: If918c42d4b82d78c07786cfa47c74d0dfb7493d6 Reviewed-on: https://gerrit.libreoffice.org/44131 Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> Tested-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx index e77e86dd1759..08c27f819639 100644 --- a/basctl/source/basicide/baside2.cxx +++ b/basctl/source/basicide/baside2.cxx @@ -338,7 +338,7 @@ void ModulWindow::BasicExecute() if ( !pMethod ) { // If not in a method then prompt the user - ChooseMacro( uno::Reference< frame::XModel >(), false ); + ChooseMacro( uno::Reference< frame::XModel >() ); return; } if ( pMethod ) diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx index 74161eec8161..db3945369fc8 100644 --- a/basctl/source/basicide/basides1.cxx +++ b/basctl/source/basicide/basides1.cxx @@ -269,7 +269,7 @@ void Shell::ExecuteGlobal( SfxRequest& rReq ) break; case SID_BASICIDE_CHOOSEMACRO: { - ChooseMacro( nullptr, false ); + ChooseMacro( nullptr ); } break; case SID_BASICIDE_CREATEMACRO: diff --git a/basctl/source/basicide/bastypes.cxx b/basctl/source/basicide/bastypes.cxx index fa0300dcb641..951c25287a86 100644 --- a/basctl/source/basicide/bastypes.cxx +++ b/basctl/source/basicide/bastypes.cxx @@ -564,7 +564,7 @@ void TabBar::Sort() } } -void CutLines( OUString& rStr, sal_Int32 nStartLine, sal_Int32 nLines, bool bEraseTrailingEmptyLines ) +void CutLines( OUString& rStr, sal_Int32 nStartLine, sal_Int32 nLines ) { sal_Int32 nStartPos = 0; sal_Int32 nLine = 0; @@ -596,7 +596,7 @@ void CutLines( OUString& rStr, sal_Int32 nStartLine, sal_Int32 nLines, bool bEra rStr = rStr.copy( 0, nStartPos ); rStr += aEndStr; - if ( bEraseTrailingEmptyLines ) + // erase trailing empty lines { sal_Int32 n = nStartPos; sal_Int32 nLen = rStr.getLength(); diff --git a/basctl/source/basicide/macrodlg.cxx b/basctl/source/basicide/macrodlg.cxx index d391ad20c708..9bb61bc870f0 100644 --- a/basctl/source/basicide/macrodlg.cxx +++ b/basctl/source/basicide/macrodlg.cxx @@ -304,7 +304,7 @@ void MacroChooser::DeleteMacro() sal_uInt16 nStart, nEnd; pMethod->GetLineRange( nStart, nEnd ); pModule->GetMethods()->Remove( pMethod ); - CutLines( aSource, nStart-1, nEnd-nStart+1, true ); + CutLines( aSource, nStart-1, nEnd-nStart+1 ); pModule->SetSource32( aSource ); // update module in library diff --git a/basctl/source/inc/basobj.hxx b/basctl/source/inc/basobj.hxx index 8e5e9badc8af..91862bff751f 100644 --- a/basctl/source/inc/basobj.hxx +++ b/basctl/source/inc/basobj.hxx @@ -77,9 +77,8 @@ namespace basctl const css::uno::Reference< css::frame::XModel >& rxLimitToDocument, const css::uno::Reference< css::frame::XFrame >& xDocFrame, bool bChooseOnly ); inline OUString ChooseMacro( - const css::uno::Reference< css::frame::XModel >& rxLimitToDocument, - bool bChooseOnly ) - { return ChooseMacro(rxLimitToDocument, css::uno::Reference< css::frame::XFrame >(), bChooseOnly); } + const css::uno::Reference< css::frame::XModel >& rxLimitToDocument ) + { return ChooseMacro(rxLimitToDocument, css::uno::Reference< css::frame::XFrame >(), false/*bChooseOnly*/); } /// @throws css::container::NoSuchElementException /// @throws css::uno::RuntimeException diff --git a/basctl/source/inc/bastypes.hxx b/basctl/source/inc/bastypes.hxx index 73b78afb7ced..429f4137a971 100644 --- a/basctl/source/inc/bastypes.hxx +++ b/basctl/source/inc/bastypes.hxx @@ -286,7 +286,7 @@ private: Map m_aMap; }; -void CutLines( OUString& rStr, sal_Int32 nStartLine, sal_Int32 nLines, bool bEraseTrailingEmptyLines ); +void CutLines( OUString& rStr, sal_Int32 nStartLine, sal_Int32 nLines ); OUString CreateMgrAndLibStr( const OUString& rMgrName, const OUString& rLibName ); sal_uLong CalcLineCount( SvStream& rStream ); diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx index 1be0133628df..d6e8210340a1 100644 --- a/basic/source/classes/sbunoobj.cxx +++ b/basic/source/classes/sbunoobj.cxx @@ -1451,11 +1451,9 @@ Any sbxToUnoValue( const SbxValue* pVar, const Type& rType, Property const * pUn return aRetVal; } -void processAutomationParams( SbxArray* pParams, Sequence< Any >& args, bool bOLEAutomation, sal_uInt32 nParamCount ) +void processAutomationParams( SbxArray* pParams, Sequence< Any >& args, sal_uInt32 nParamCount ) { - AutomationNamedArgsSbxArray* pArgNamesArray = nullptr; - if( bOLEAutomation ) - pArgNamesArray = dynamic_cast<AutomationNamedArgsSbxArray*>( pParams ); + AutomationNamedArgsSbxArray* pArgNamesArray = dynamic_cast<AutomationNamedArgsSbxArray*>( pParams ); args.realloc( nParamCount ); Any* pAnyArgs = args.getArray(); @@ -2074,7 +2072,7 @@ void SbUnoObject::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) // Automation properties have methods, so.. we need to invoke this through // XInvocation Sequence<Any> args; - processAutomationParams( pParams, args, true, nParamCount ); + processAutomationParams( pParams, args, nParamCount ); aRetAny = invokeAutomationMethod( pProp->GetName(), args, pParams, nParamCount, mxInvocation, INVOKETYPE::GetProp ); } else @@ -2219,7 +2217,7 @@ void SbUnoObject::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) } else if( bInvocation && pParams && mxInvocation.is() ) { - processAutomationParams( pParams, args, true/*bOLEAutomation*/, nParamCount ); + processAutomationParams( pParams, args, nParamCount ); } // call the method diff --git a/basic/source/inc/date.hxx b/basic/source/inc/date.hxx index 6173a0b44dd0..4b28f1d66b02 100644 --- a/basic/source/inc/date.hxx +++ b/basic/source/inc/date.hxx @@ -28,7 +28,7 @@ bool implDateSerial( sal_Int16 nYear, sal_Int16 nMonth, sal_Int16 nDay, bool bUs double implTimeSerial( sal_Int16 nHour, sal_Int16 nMinute, sal_Int16 nSecond); bool implDateTimeSerial( sal_Int16 nYear, sal_Int16 nMonth, sal_Int16 nDay, sal_Int16 nHour, sal_Int16 nMinute, sal_Int16 nSecond, - bool bUseTwoDigitYear, bool bRollOver, double& rdRet ); + double& rdRet ); sal_Int16 implGetWeekDay( double aDate, bool bFirstDayParam = false, sal_Int16 nFirstDay = 0 ); diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx index a4783ea78918..1d966832a77c 100644 --- a/basic/source/runtime/methods.cxx +++ b/basic/source/runtime/methods.cxx @@ -1836,7 +1836,7 @@ void SbxDateFromUNODateTime( SbxValue *pVal, const css::util::DateTime& aUnoDT) double dDate(0.0); if( implDateTimeSerial( aUnoDT.Year, aUnoDT.Month, aUnoDT.Day, aUnoDT.Hours, aUnoDT.Minutes, aUnoDT.Seconds, - false, false, dDate ) ) + dDate ) ) { pVal->PutDate( dDate ); } @@ -4687,10 +4687,10 @@ double implTimeSerial( sal_Int16 nHours, sal_Int16 nMinutes, sal_Int16 nSeconds bool implDateTimeSerial( sal_Int16 nYear, sal_Int16 nMonth, sal_Int16 nDay, sal_Int16 nHour, sal_Int16 nMinute, sal_Int16 nSecond, - bool bUseTwoDigitYear, bool bRollOver, double& rdRet ) + double& rdRet ) { double dDate; - if(!implDateSerial(nYear, nMonth, nDay, bUseTwoDigitYear, bRollOver, dDate)) + if(!implDateSerial(nYear, nMonth, nDay, false/*bUseTwoDigitYear*/, false/*bRollOver*/, dDate)) return false; rdRet += dDate + implTimeSerial(nHour, nMinute, nSecond); return true; diff --git a/basic/source/sbx/sbxbool.cxx b/basic/source/sbx/sbxbool.cxx index f199373165b1..5ce72334280d 100644 --- a/basic/source/sbx/sbxbool.cxx +++ b/basic/source/sbx/sbxbool.cxx @@ -81,7 +81,7 @@ enum SbxBOOL ImpGetBool( const SbxValues* p ) double n; SbxDataType t; sal_uInt16 nLen = 0; - if( ImpScan( *p->pOUString, n, t, &nLen ) == ERRCODE_NONE ) + if( ImpScan( *p->pOUString, n, t, &nLen, false ) == ERRCODE_NONE ) { if( nLen == p->pOUString->getLength() ) { diff --git a/basic/source/sbx/sbxbyte.cxx b/basic/source/sbx/sbxbyte.cxx index 4e1e47c54218..2eefb718f026 100644 --- a/basic/source/sbx/sbxbyte.cxx +++ b/basic/source/sbx/sbxbyte.cxx @@ -162,7 +162,7 @@ start: { double d; SbxDataType t; - if( ImpScan( *p->pOUString, d, t, nullptr ) != ERRCODE_NONE ) + if( ImpScan( *p->pOUString, d, t, nullptr, false ) != ERRCODE_NONE ) nRes = 0; else if( d > SbxMAXBYTE ) { diff --git a/basic/source/sbx/sbxchar.cxx b/basic/source/sbx/sbxchar.cxx index 37ce49dc3e06..6249588b39dc 100644 --- a/basic/source/sbx/sbxchar.cxx +++ b/basic/source/sbx/sbxchar.cxx @@ -148,7 +148,7 @@ start: { double d; SbxDataType t; - if( ImpScan( *p->pOUString, d, t, nullptr ) != ERRCODE_NONE ) + if( ImpScan( *p->pOUString, d, t, nullptr, false ) != ERRCODE_NONE ) nRes = 0; else if( d > SbxMAXCHAR ) { diff --git a/basic/source/sbx/sbxconv.hxx b/basic/source/sbx/sbxconv.hxx index 441729a8d0cc..88d066513be4 100644 --- a/basic/source/sbx/sbxconv.hxx +++ b/basic/source/sbx/sbxconv.hxx @@ -28,7 +28,7 @@ class SbxArray; extern void ImpCvtNum( double nNum, short nPrec, OUString& rRes, bool bCoreString=false ); extern ErrCode ImpScan ( const OUString& rSrc, double& nVal, SbxDataType& rType, sal_uInt16* pLen, - bool bAllowIntntl=false, bool bOnlyIntntl=false ); + bool bOnlyIntntl ); // with advanced evaluation (International, "TRUE"/"FALSE") extern bool ImpConvStringExt( OUString& rSrc, SbxDataType eTargetType ); diff --git a/basic/source/sbx/sbxdbl.cxx b/basic/source/sbx/sbxdbl.cxx index 7fa8f5d2a18e..d7a5abfdb6b6 100644 --- a/basic/source/sbx/sbxdbl.cxx +++ b/basic/source/sbx/sbxdbl.cxx @@ -81,7 +81,7 @@ double ImpGetDouble( const SbxValues* p ) { double d; SbxDataType t; - if( ImpScan( *p->pOUString, d, t, nullptr ) != ERRCODE_NONE ) + if( ImpScan( *p->pOUString, d, t, nullptr, false ) != ERRCODE_NONE ) { nRes = 0; #if HAVE_FEATURE_SCRIPTING diff --git a/basic/source/sbx/sbxint.cxx b/basic/source/sbx/sbxint.cxx index e43d6e5d8442..e3230259f205 100644 --- a/basic/source/sbx/sbxint.cxx +++ b/basic/source/sbx/sbxint.cxx @@ -155,7 +155,7 @@ start: { double d; SbxDataType t; - if( ImpScan( *p->pOUString, d, t, nullptr ) != ERRCODE_NONE ) + if( ImpScan( *p->pOUString, d, t, nullptr, false ) != ERRCODE_NONE ) nRes = 0; else if( d > SbxMAXINT ) { @@ -441,7 +441,7 @@ start: // Check if really 0 or invalid conversion double d; SbxDataType t; - if( ImpScan( *p->pOUString, d, t, nullptr ) != ERRCODE_NONE ) + if( ImpScan( *p->pOUString, d, t, nullptr, false ) != ERRCODE_NONE ) nRes = 0; else nRes = (sal_Int64) d; @@ -703,7 +703,7 @@ start: // Check if really 0 or invalid conversion double d; SbxDataType t; - if( ImpScan( *p->pOUString, d, t, nullptr ) != ERRCODE_NONE ) + if( ImpScan( *p->pOUString, d, t, nullptr, false ) != ERRCODE_NONE ) nRes = 0; else if( d > SbxMAXSALUINT64 ) { diff --git a/basic/source/sbx/sbxlng.cxx b/basic/source/sbx/sbxlng.cxx index c1436d5aa09e..1da39a406e88 100644 --- a/basic/source/sbx/sbxlng.cxx +++ b/basic/source/sbx/sbxlng.cxx @@ -119,7 +119,7 @@ start: { double d; SbxDataType t; - if( ImpScan( *p->pOUString, d, t, nullptr ) != ERRCODE_NONE ) + if( ImpScan( *p->pOUString, d, t, nullptr, false ) != ERRCODE_NONE ) nRes = 0; else if( d > SbxMAXLNG ) { diff --git a/basic/source/sbx/sbxscan.cxx b/basic/source/sbx/sbxscan.cxx index 093595800450..2693ef22199b 100644 --- a/basic/source/sbx/sbxscan.cxx +++ b/basic/source/sbx/sbxscan.cxx @@ -83,11 +83,11 @@ bool ImpStrChr( const sal_Unicode* p, sal_Unicode c ) // conversion error if data type is fixed and it doesn't fit ErrCode ImpScan( const OUString& rWSrc, double& nVal, SbxDataType& rType, - sal_uInt16* pLen, bool bAllowIntntl, bool bOnlyIntntl ) + sal_uInt16* pLen, bool bOnlyIntntl ) { sal_Unicode cIntntlDecSep, cIntntlGrpSep, cIntntlDecSepAlt; sal_Unicode cNonIntntlDecSep = '.'; - if( bAllowIntntl || bOnlyIntntl ) + if( bOnlyIntntl ) { ImpGetIntntlSep( cIntntlDecSep, cIntntlGrpSep, cIntntlDecSepAlt ); if( bOnlyIntntl ) @@ -284,7 +284,7 @@ ErrCode SbxValue::ScanNumIntnl( const OUString& rSrc, double& nVal, bool bSingle SbxDataType t; sal_uInt16 nLen = 0; ErrCode nRetError = ImpScan( rSrc, nVal, t, &nLen, - /*bAllowIntntl*/false, /*bOnlyIntntl*/true ); + /*bOnlyIntntl*/true ); // read completely? if( nRetError == ERRCODE_NONE && nLen != rSrc.getLength() ) { @@ -318,7 +318,7 @@ static const double roundArray[] = { */ static void myftoa( double nNum, char * pBuf, short nPrec, short nExpWidth, - bool bPt, bool bFix, sal_Unicode cForceThousandSep ) + sal_Unicode cForceThousandSep ) { short nExp = 0; @@ -346,9 +346,7 @@ static void myftoa( double nNum, char * pBuf, short nPrec, short nExpWidth, nExp++; } } - if( !bFix && !nExpWidth ) - nDig = nDig + nExp; - else if( bFix && !nPrec ) + if( !nPrec ) nDig = nExp + 1; // round number @@ -397,8 +395,6 @@ static void myftoa( double nNum, char * pBuf, short nPrec, short nExpWidth, nDec--; if( !nDec ) *pBuf++ = (char)cDecimalSep; - else if( !(nDec % 3 ) && bPt ) - *pBuf++ = (char)cThousandSep; } } } @@ -448,7 +444,7 @@ void ImpCvtNum( double nNum, short nPrec, OUString& rRes, bool bCoreString ) } double dMaxNumWithoutExp = (nPrec == 6) ? 1E6 : 1E14; myftoa( nNum, p, nPrec,( nNum &&( nNum < 1E-1 || nNum >= dMaxNumWithoutExp ) ) ? 4:0, - false, true, cDecimalSep ); + cDecimalSep ); // remove trailing zeros for( p = cBuf; *p &&( *p != 'E' ); p++ ) {} q = p; p--; @@ -568,7 +564,7 @@ bool SbxValue::Scan( const OUString& rSrc, sal_uInt16* pLen ) { double n; SbxDataType t; - eRes = ImpScan( rSrc, n, t, pLen ); + eRes = ImpScan( rSrc, n, t, pLen, false ); if( eRes == ERRCODE_NONE ) { if( !IsFixed() ) diff --git a/basic/source/sbx/sbxsng.cxx b/basic/source/sbx/sbxsng.cxx index 7406077852c1..11c332c0f39b 100644 --- a/basic/source/sbx/sbxsng.cxx +++ b/basic/source/sbx/sbxsng.cxx @@ -107,7 +107,7 @@ start: { double d; SbxDataType t; - if( ImpScan( *p->pOUString, d, t, nullptr ) != ERRCODE_NONE ) + if( ImpScan( *p->pOUString, d, t, nullptr, false ) != ERRCODE_NONE ) nRes = 0; else if( d > SbxMAXSNG ) { diff --git a/basic/source/sbx/sbxuint.cxx b/basic/source/sbx/sbxuint.cxx index fb366d91afa3..f28eb2599681 100644 --- a/basic/source/sbx/sbxuint.cxx +++ b/basic/source/sbx/sbxuint.cxx @@ -152,7 +152,7 @@ start: { double d; SbxDataType t; - if( ImpScan( *p->pOUString, d, t, nullptr ) != ERRCODE_NONE ) + if( ImpScan( *p->pOUString, d, t, nullptr, false ) != ERRCODE_NONE ) nRes = 0; else if( d > SbxMAXUINT ) { diff --git a/basic/source/sbx/sbxulng.cxx b/basic/source/sbx/sbxulng.cxx index 5204eb45cc60..ded4fe6d1f64 100644 --- a/basic/source/sbx/sbxulng.cxx +++ b/basic/source/sbx/sbxulng.cxx @@ -119,7 +119,7 @@ start: { double d; SbxDataType t; - if( ImpScan( *p->pOUString, d, t, nullptr ) != ERRCODE_NONE ) + if( ImpScan( *p->pOUString, d, t, nullptr, false ) != ERRCODE_NONE ) nRes = 0; else if( d > SbxMAXULNG ) { diff --git a/basic/source/sbx/sbxvalue.cxx b/basic/source/sbx/sbxvalue.cxx index 2d66ebe886ee..39df414fbdcd 100644 --- a/basic/source/sbx/sbxvalue.cxx +++ b/basic/source/sbx/sbxvalue.cxx @@ -699,7 +699,7 @@ bool SbxValue::ImpIsNumeric( bool bOnlyIntntl ) const double n; SbxDataType t2; sal_uInt16 nLen = 0; - if( ImpScan( s, n, t2, &nLen, /*bAllowIntntl*/false, bOnlyIntntl ) == ERRCODE_NONE ) + if( ImpScan( s, n, t2, &nLen, bOnlyIntntl ) == ERRCODE_NONE ) return nLen == s.getLength(); } return false; @@ -1395,7 +1395,7 @@ bool SbxValue::LoadData( SvStream& r, sal_uInt16 ) RTL_TEXTENCODING_ASCII_US); double d; SbxDataType t; - if( ImpScan( aVal, d, t, nullptr ) != ERRCODE_NONE || t == SbxDOUBLE ) + if( ImpScan( aVal, d, t, nullptr, false ) != ERRCODE_NONE || t == SbxDOUBLE ) { aData.nSingle = 0.0F; return false; @@ -1410,7 +1410,7 @@ bool SbxValue::LoadData( SvStream& r, sal_uInt16 ) OUString aVal = read_uInt16_lenPrefixed_uInt8s_ToOUString(r, RTL_TEXTENCODING_ASCII_US); SbxDataType t; - if( ImpScan( aVal, aData.nDouble, t, nullptr ) != ERRCODE_NONE ) + if( ImpScan( aVal, aData.nDouble, t, nullptr, false ) != ERRCODE_NONE ) { aData.nDouble = 0.0; return false; diff --git a/basic/source/sbx/sbxvar.cxx b/basic/source/sbx/sbxvar.cxx index 6c506e88cff6..d80514fe483a 100644 --- a/basic/source/sbx/sbxvar.cxx +++ b/basic/source/sbx/sbxvar.cxx @@ -506,7 +506,7 @@ bool SbxVariable::LoadData( SvStream& rStrm, sal_uInt16 nVer ) rStrm, RTL_TEXTENCODING_ASCII_US); double d; SbxDataType t; - if( ImpScan( aTmpString, d, t, nullptr ) != ERRCODE_NONE || t == SbxDOUBLE ) + if( ImpScan( aTmpString, d, t, nullptr, false ) != ERRCODE_NONE || t == SbxDOUBLE ) { aTmp.nSingle = 0; return false; @@ -521,7 +521,7 @@ bool SbxVariable::LoadData( SvStream& rStrm, sal_uInt16 nVer ) aTmpString = read_uInt16_lenPrefixed_uInt8s_ToOUString(rStrm, RTL_TEXTENCODING_ASCII_US); SbxDataType t; - if( ImpScan( aTmpString, aTmp.nDouble, t, nullptr ) != ERRCODE_NONE ) + if( ImpScan( aTmpString, aTmp.nDouble, t, nullptr, false ) != ERRCODE_NONE ) { aTmp.nDouble = 0; return false; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits