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; 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 ); void Remove( long nIndex );
const Range& GetTotalRange() const { return aTotRange; } const Range& GetTotalRange() const { return aTotRange; }
long FirstSelected( bool bInverse = false ); long FirstSelected();
long LastSelected(); long LastSelected();
long NextSelected(); long NextSelected();

View File

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

View File

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

View File

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

View File

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

View File

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