loplugin:unuseddefaultparam in tools

Change-Id: I027f4d53e3aa793bd61bf110899e464a9b6430ec
Reviewed-on: https://gerrit.libreoffice.org/22891
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
This commit is contained in:
Noel Grandin 2016-03-04 12:20:58 +02:00 committed by Noel Grandin
parent ff45bc3346
commit 46c67c4323
7 changed files with 52 additions and 83 deletions

View File

@ -240,7 +240,7 @@ bool UnusedDefaultParams::VisitDeclRefExpr( const DeclRefExpr* declRefExpr )
return true;
}
loplugin::Plugin::Registration< UnusedDefaultParams > X("unuseddefaultparams", false);
loplugin::Plugin::Registration< UnusedDefaultParams > X("unuseddefaultparams", true);
}

View File

@ -68,7 +68,7 @@ public:
void Remove( long nIndex );
const Range& GetTotalRange() const { return aTotRange; }
long FirstSelected( bool bInverse = false );
long FirstSelected();
long LastSelected();
long NextSelected();

View File

@ -689,7 +689,7 @@ public:
sal_Size GetEndOfData() const { return nEndOfData; }
const void* GetData() { Flush(); return pBuf; }
void* SwitchBuffer( sal_Size nInitSize=512 );
void* SwitchBuffer();
void SetBuffer( void* pBuf, sal_Size nSize,
bool bOwnsData=true, sal_Size nEOF=0 );

View File

@ -203,8 +203,7 @@ public:
bool ConcatData(INetProtocol eTheScheme, OUString const & rTheUser,
OUString const & rThePassword,
OUString const & rTheHost, sal_uInt32 nThePort,
OUString const & rThePath,
EncodeMechanism eMechanism = WAS_ENCODED);
OUString const & rThePath);
// Smart Parsing:
@ -330,8 +329,7 @@ public:
GetNewAbsURL(OUString const & rTheRelURIRef,
INetURLObject * pTheAbsURIRef,
EncodeMechanism eMechanism = WAS_ENCODED,
rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8,
FSysStyle eStyle = FSYS_DETECT)
rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8)
const;
/** @descr If rTheRelURIRef cannot be converted to an absolute URL
@ -359,7 +357,7 @@ public:
// External URLs:
OUString getExternalURL(DecodeMechanism eMechanism = DECODE_TO_IURI) const;
OUString getExternalURL() const;
static inline bool translateToExternal(OUString const & rTheIntURIRef,
OUString & rTheExtURIRef,
@ -425,16 +423,13 @@ public:
= RTL_TEXTENCODING_UTF8) const
{ return decode(m_aAuth, eMechanism, eCharset); }
inline bool SetUser(OUString const & rTheUser,
EncodeMechanism eMechanism = WAS_ENCODED)
{ return setUser(rTheUser, false, eMechanism, RTL_TEXTENCODING_UTF8); }
inline bool SetUser(OUString const & rTheUser)
{ return setUser(rTheUser, false, WAS_ENCODED, RTL_TEXTENCODING_UTF8); }
inline bool SetPass(OUString const & rThePassword,
EncodeMechanism eMechanism = WAS_ENCODED);
inline bool SetPass(OUString const & rThePassword);
inline bool SetUserAndPass(OUString const & rTheUser,
OUString const & rThePassword,
EncodeMechanism eMechanism = WAS_ENCODED);
OUString const & rThePassword);
// Host and Port:
@ -450,9 +445,8 @@ public:
sal_uInt32 GetPort() const;
inline bool SetHost(OUString const & rTheHost,
EncodeMechanism eMechanism = WAS_ENCODED)
{ return setHost(rTheHost, false, eMechanism, RTL_TEXTENCODING_UTF8); }
inline bool SetHost(OUString const & rTheHost)
{ return setHost(rTheHost, false, WAS_ENCODED, RTL_TEXTENCODING_UTF8); }
bool SetPort(sal_uInt32 nThePort);
@ -588,8 +582,6 @@ public:
@param bIgnoreFinalSlash If true, a final slash at the end of the
hierarchical path does not denote an empty segment, but is ignored.
@param eMechanism See the general discussion for set-methods.
@return True if the name has successfully been modified (and the
resulting URI is still valid). If the path is not hierarchical, or
the specified segment does not exist, false is returned. If false is
@ -597,8 +589,7 @@ public:
*/
bool setName(OUString const & rTheName,
sal_Int32 nIndex = LAST_SEGMENT,
bool bIgnoreFinalSlash = true,
EncodeMechanism eMechanism = WAS_ENCODED);
bool bIgnoreFinalSlash = true);
/** Get the base of the name of a segment.
@ -647,16 +638,13 @@ public:
EncodeMechanism eMechanism = WAS_ENCODED,
rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
/** Determine whether the name of a segment has an extension.
@param nIndex The non-negative index of the segment, or LAST_SEGMENT
if addressing the last segment.
/** Determine whether the name of the last segment has an extension.
@return True if the name of the specified segment has an extension.
If the path is not hierarchical, or the specified segment does not
exist, false is returned.
*/
bool hasExtension(sal_Int32 nIndex = LAST_SEGMENT) const;
bool hasExtension() const;
/** Get the extension of the name of a segment.
@ -916,8 +904,7 @@ public:
// OBSOLETE Hierarchical Path:
OUString GetPartBeforeLastName(DecodeMechanism eMechanism
= DECODE_TO_IURI) const;
OUString GetPartBeforeLastName() const;
/** Get the last segment in the path.
@ -976,13 +963,12 @@ public:
= RTL_TEXTENCODING_UTF8) const
{ return GetLastName(eMechanism, eCharset); }
void SetExtension(OUString const & rTheExtension,
EncodeMechanism eMechanism = WAS_ENCODED);
void SetExtension(OUString const & rTheExtension);
inline OUString GetExtension( DecodeMechanism eMechanism = DECODE_TO_IURI ) const
{ return GetFileExtension(eMechanism); }
inline OUString GetExtension() const
{ return GetFileExtension(); }
OUString CutExtension(DecodeMechanism eMechanism = DECODE_TO_IURI);
OUString CutExtension();
static bool IsCaseSensitive() { return true; }
@ -1280,15 +1266,14 @@ INetURLObject::smartRel2Abs(OUString const & rTheRelURIRef,
inline bool INetURLObject::GetNewAbsURL(OUString const & rTheRelURIRef,
INetURLObject * pTheAbsURIRef,
EncodeMechanism eMechanism,
rtl_TextEncoding eCharset,
FSysStyle eStyle)
rtl_TextEncoding eCharset)
const
{
INetURLObject aTheAbsURIRef;
bool bWasAbsolute;
if (!convertRelToAbs(rTheRelURIRef, false, aTheAbsURIRef, bWasAbsolute,
eMechanism, eCharset, false/*bIgnoreFragment*/, false, false,
eStyle))
FSYS_DETECT))
return false;
if (pTheAbsURIRef)
*pTheAbsURIRef = aTheAbsURIRef;
@ -1334,22 +1319,20 @@ inline bool INetURLObject::translateToInternal(OUString const &
eDecodeMechanism, eCharset);
}
inline bool INetURLObject::SetPass(OUString const & rThePassword,
EncodeMechanism eMechanism)
inline bool INetURLObject::SetPass(OUString const & rThePassword)
{
return rThePassword.isEmpty() ?
clearPassword() :
setPassword(rThePassword, false, eMechanism, RTL_TEXTENCODING_UTF8);
setPassword(rThePassword, false, WAS_ENCODED, RTL_TEXTENCODING_UTF8);
}
inline bool INetURLObject::SetUserAndPass(OUString const & rTheUser,
OUString const & rThePassword,
EncodeMechanism eMechanism)
OUString const & rThePassword)
{
return setUser(rTheUser, false, eMechanism, RTL_TEXTENCODING_UTF8)
return setUser(rTheUser, false, WAS_ENCODED, RTL_TEXTENCODING_UTF8)
&& (rThePassword.isEmpty() ?
clearPassword() :
setPassword(rThePassword, false, eMechanism, RTL_TEXTENCODING_UTF8));
setPassword(rThePassword, false, WAS_ENCODED, RTL_TEXTENCODING_UTF8));
}
inline bool INetURLObject::insertName(OUString const & rTheName,

View File

@ -3700,8 +3700,7 @@ bool INetURLObject::ConcatData(INetProtocol eTheScheme,
OUString const & rThePassword,
OUString const & rTheHost,
sal_uInt32 nThePort,
OUString const & rThePath,
EncodeMechanism eMechanism)
OUString const & rThePath)
{
setInvalid();
m_eScheme = eTheScheme;
@ -3720,7 +3719,7 @@ bool INetURLObject::ConcatData(INetProtocol eTheScheme,
{
m_aUser.set(m_aAbsURIRef,
encodeText(rTheUser, false, PART_USER_PASSWORD,
eMechanism, RTL_TEXTENCODING_UTF8, false),
WAS_ENCODED, RTL_TEXTENCODING_UTF8, false),
m_aAbsURIRef.getLength());
bUserInfo = true;
}
@ -3737,7 +3736,7 @@ bool INetURLObject::ConcatData(INetProtocol eTheScheme,
m_aAbsURIRef.append(':');
m_aAuth.set(m_aAbsURIRef,
encodeText(rThePassword, false, PART_USER_PASSWORD,
eMechanism, RTL_TEXTENCODING_UTF8, false),
WAS_ENCODED, RTL_TEXTENCODING_UTF8, false),
m_aAbsURIRef.getLength());
bUserInfo = true;
}
@ -3784,7 +3783,7 @@ bool INetURLObject::ConcatData(INetProtocol eTheScheme,
}
if (!parseHostOrNetBiosName(
aSynHost.getStr(), aSynHost.getStr() + aSynHost.getLength(),
false, eMechanism, RTL_TEXTENCODING_UTF8, bNetBiosName, &aSynHost))
false, WAS_ENCODED, RTL_TEXTENCODING_UTF8, bNetBiosName, &aSynHost))
{
setInvalid();
return false;
@ -3816,7 +3815,7 @@ bool INetURLObject::ConcatData(INetProtocol eTheScheme,
OUStringBuffer aSynPath;
sal_Unicode const * p = rThePath.getStr();
sal_Unicode const * pEnd = p + rThePath.getLength();
if (!parsePath(m_eScheme, &p, pEnd, false, eMechanism, RTL_TEXTENCODING_UTF8, false, '/',
if (!parsePath(m_eScheme, &p, pEnd, false, WAS_ENCODED, RTL_TEXTENCODING_UTF8, false, '/',
0x80000000, 0x80000000, 0x80000000, aSynPath)
|| p != pEnd)
{
@ -3854,11 +3853,11 @@ OUString INetURLObject::GetAbsURL(OUString const & rTheBaseURIRef,
rTheRelURIRef;
}
OUString INetURLObject::getExternalURL(DecodeMechanism eMechanism) const
OUString INetURLObject::getExternalURL() const
{
OUString aTheExtURIRef;
translateToExternal(
m_aAbsURIRef.toString(), aTheExtURIRef, eMechanism);
m_aAbsURIRef.toString(), aTheExtURIRef);
return aTheExtURIRef;
}
@ -4012,8 +4011,7 @@ OUString INetURLObject::getName(sal_Int32 nIndex, bool bIgnoreFinalSlash,
}
bool INetURLObject::setName(OUString const & rTheName, sal_Int32 nIndex,
bool bIgnoreFinalSlash,
EncodeMechanism eMechanism)
bool bIgnoreFinalSlash)
{
SubString aSegment(getSegment(nIndex, bIgnoreFinalSlash));
if (!aSegment.isPresent())
@ -4035,17 +4033,17 @@ bool INetURLObject::setName(OUString const & rTheName, sal_Int32 nIndex,
OUStringBuffer aNewPath;
aNewPath.append(pPathBegin, pSegBegin - pPathBegin);
aNewPath.append(encodeText(rTheName, false, PART_PCHAR,
eMechanism, RTL_TEXTENCODING_UTF8, true));
WAS_ENCODED, RTL_TEXTENCODING_UTF8, true));
aNewPath.append(p, pPathEnd - p);
return setPath(aNewPath.makeStringAndClear(), false, NOT_CANONIC,
RTL_TEXTENCODING_UTF8);
}
bool INetURLObject::hasExtension(sal_Int32 nIndex)
bool INetURLObject::hasExtension()
const
{
SubString aSegment(getSegment(nIndex, true/*bIgnoreFinalSlash*/));
SubString aSegment(getSegment(LAST_SEGMENT, true/*bIgnoreFinalSlash*/));
if (!aSegment.isPresent())
return false;
@ -4862,7 +4860,7 @@ bool INetURLObject::scanIPv6reference(sal_Unicode const *& rBegin,
return false;
}
OUString INetURLObject::GetPartBeforeLastName(DecodeMechanism eMechanism)
OUString INetURLObject::GetPartBeforeLastName()
const
{
if (!checkHierarchical())
@ -4872,7 +4870,7 @@ OUString INetURLObject::GetPartBeforeLastName(DecodeMechanism eMechanism)
aTemp.clearQuery();
aTemp.removeSegment(LAST_SEGMENT, false);
aTemp.setFinalSlash();
return aTemp.GetMainURL(eMechanism);
return aTemp.GetMainURL(DECODE_TO_IURI);
}
OUString INetURLObject::GetLastName(DecodeMechanism eMechanism,
@ -4948,15 +4946,14 @@ void INetURLObject::SetName(OUString const & rTheName,
*this = aTemp;
}
void INetURLObject::SetExtension(OUString const & rTheExtension,
EncodeMechanism eMechanism)
void INetURLObject::SetExtension(OUString const & rTheExtension)
{
setExtension(rTheExtension, LAST_SEGMENT, false, eMechanism);
setExtension(rTheExtension, LAST_SEGMENT, false);
}
OUString INetURLObject::CutExtension(DecodeMechanism eMechanism)
OUString INetURLObject::CutExtension()
{
OUString aTheExtension(getExtension(LAST_SEGMENT, false, eMechanism));
OUString aTheExtension(getExtension(LAST_SEGMENT, false));
return removeExtension(LAST_SEGMENT, false)
? aTheExtension : OUString();
}

View File

@ -432,26 +432,14 @@ long MultiSelection::ImplFwdUnselected()
return SFX_ENDOFSELECTION;
}
long MultiSelection::FirstSelected( bool bInverse )
long MultiSelection::FirstSelected()
{
bInverseCur = bInverse;
bInverseCur = false;
nCurSubSel = 0;
if ( bInverseCur )
{
bCurValid = nSelCount < sal_uIntPtr(aTotRange.Len());
if ( bCurValid )
{
nCurIndex = 0;
return ImplFwdUnselected();
}
}
else
{
bCurValid = !aSels.empty();
if ( bCurValid )
return nCurIndex = aSels[ 0 ]->Min();
}
bCurValid = !aSels.empty();
if ( bCurValid )
return nCurIndex = aSels[ 0 ]->Min();
return SFX_ENDOFSELECTION;
}

View File

@ -1937,7 +1937,7 @@ void SvMemoryStream::FreeMemory()
delete[] pBuf;
}
void* SvMemoryStream::SwitchBuffer( sal_Size nInitSize)
void* SvMemoryStream::SwitchBuffer()
{
Flush();
if( !bOwnsData )
@ -1955,7 +1955,8 @@ void* SvMemoryStream::SwitchBuffer( sal_Size nInitSize)
ResetError();
if( nInitSize && !AllocateMemory(nInitSize) )
sal_Size nInitSize = 512;
if( !AllocateMemory(nInitSize) )
{
SetError( SVSTREAM_OUTOFMEMORY );
nSize = 0;