summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-10-31 16:00:24 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-11-01 07:14:13 +0100
commit5d618d73ed8669a75b7b01774f6ea51e99e5b740 (patch)
tree45a609ee2442cc77c79a7fe23de4f19b82e82802 /basic
parent094542511fae905106a9daa19c049ff669e61bdc (diff)
loplugin:constantparam in basic,basctl
Change-Id: If918c42d4b82d78c07786cfa47c74d0dfb7493d6 Reviewed-on: https://gerrit.libreoffice.org/44131 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'basic')
-rw-r--r--basic/source/classes/sbunoobj.cxx10
-rw-r--r--basic/source/inc/date.hxx2
-rw-r--r--basic/source/runtime/methods.cxx6
-rw-r--r--basic/source/sbx/sbxbool.cxx2
-rw-r--r--basic/source/sbx/sbxbyte.cxx2
-rw-r--r--basic/source/sbx/sbxchar.cxx2
-rw-r--r--basic/source/sbx/sbxconv.hxx2
-rw-r--r--basic/source/sbx/sbxdbl.cxx2
-rw-r--r--basic/source/sbx/sbxint.cxx6
-rw-r--r--basic/source/sbx/sbxlng.cxx2
-rw-r--r--basic/source/sbx/sbxscan.cxx18
-rw-r--r--basic/source/sbx/sbxsng.cxx2
-rw-r--r--basic/source/sbx/sbxuint.cxx2
-rw-r--r--basic/source/sbx/sbxulng.cxx2
-rw-r--r--basic/source/sbx/sbxvalue.cxx6
-rw-r--r--basic/source/sbx/sbxvar.cxx4
16 files changed, 32 insertions, 38 deletions
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;