diff options
author | Noel Grandin <noel@peralex.com> | 2016-04-01 14:23:45 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-04-04 09:09:39 +0000 |
commit | 953f8f2cfecbe3005eb7de84daf1c9d86379244c (patch) | |
tree | 6cfd12b025f709c6d27c319e1597c9e5122198ed | |
parent | e099c5bdaa458105148059228ec11c98b9d13029 (diff) |
loplugin:constantparam in tools
Change-Id: I8b2a722b525722bd09ed1f27c648062d6f29cce7
Reviewed-on: https://gerrit.libreoffice.org/23723
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
-rw-r--r-- | include/tools/multisel.hxx | 2 | ||||
-rw-r--r-- | include/tools/urlobj.hxx | 42 | ||||
-rw-r--r-- | tools/source/fsys/urlobj.cxx | 55 | ||||
-rw-r--r-- | tools/source/memtools/multisel.cxx | 25 |
4 files changed, 48 insertions, 76 deletions
diff --git a/include/tools/multisel.hxx b/include/tools/multisel.hxx index e8ad7ce38eb9..103d7fa0ee02 100644 --- a/include/tools/multisel.hxx +++ b/include/tools/multisel.hxx @@ -94,7 +94,7 @@ class TOOLS_DLLPUBLIC StringRangeEnumerator bool mbValidInput; bool setRange( const OUString& i_rNewRange ); - bool insertRange( sal_Int32 nFirst, sal_Int32 nLast, bool bSequence, bool bMayAdjust ); + bool insertRange( sal_Int32 nFirst, sal_Int32 nLast, bool bSequence ); bool insertJoinedRanges( const std::vector< sal_Int32 >& rNumbers ); bool checkValue( sal_Int32, const std::set< sal_Int32 >* i_pPossibleValues = nullptr ) const; public: diff --git a/include/tools/urlobj.hxx b/include/tools/urlobj.hxx index 383a3aa00700..7b48084e7be5 100644 --- a/include/tools/urlobj.hxx +++ b/include/tools/urlobj.hxx @@ -422,7 +422,7 @@ public: { return decode(m_aAuth, eMechanism, eCharset); } inline bool SetUser(OUString const & rTheUser) - { return setUser(rTheUser, WAS_ENCODED, RTL_TEXTENCODING_UTF8); } + { return setUser(rTheUser, RTL_TEXTENCODING_UTF8); } inline bool SetPass(OUString const & rThePassword); @@ -444,7 +444,7 @@ public: sal_uInt32 GetPort() const; inline bool SetHost(OUString const & rTheHost) - { return setHost(rTheHost, WAS_ENCODED, RTL_TEXTENCODING_UTF8); } + { return setHost(rTheHost, RTL_TEXTENCODING_UTF8); } bool SetPort(sal_uInt32 nThePort); @@ -539,7 +539,7 @@ public: the specified place to insert the new segment does not exist, false is returned. If false is returned, the object is not modified. */ - inline bool insertName(OUString const & rTheName, + bool insertName(OUString const & rTheName, bool bAppendFinalSlash = false, sal_Int32 nIndex = LAST_SEGMENT, EncodeMechanism eMechanism = WAS_ENCODED, @@ -665,8 +665,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. - @param eCharset See the general discussion for set-methods. @return True if the extension has successfully been modified (and the @@ -677,7 +675,6 @@ public: bool setExtension(OUString const & rTheExtension, sal_Int32 nIndex = LAST_SEGMENT, bool bIgnoreFinalSlash = true, - EncodeMechanism eMechanism = WAS_ENCODED, rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8); /** Remove the extension of the name of a segment. @@ -1015,7 +1012,7 @@ private: // Relative URLs: bool convertRelToAbs( - OUString const & rTheRelURIRef, bool bOctets, + OUString const & rTheRelURIRef, INetURLObject & rTheAbsURIRef, bool & rWasAbsolute, EncodeMechanism eMechanism, rtl_TextEncoding eCharset, bool bIgnoreFragment, bool bSmart, bool bRelativeNonURIs, @@ -1061,13 +1058,13 @@ private: bool setUser( OUString const & rTheUser, - EncodeMechanism eMechanism, rtl_TextEncoding eCharset); + rtl_TextEncoding eCharset); bool clearPassword(); bool setPassword( OUString const & rThePassword, - EncodeMechanism eMechanism, rtl_TextEncoding eCharset); + rtl_TextEncoding eCharset); // Host and Port: @@ -1082,7 +1079,7 @@ private: bool setHost( OUString const & rTheHost, - EncodeMechanism eMechanism, rtl_TextEncoding eCharset); + rtl_TextEncoding eCharset); // Path: @@ -1109,11 +1106,6 @@ private: TOOLS_DLLPRIVATE SubString getSegment( sal_Int32 nIndex, bool bIgnoreFinalSlash) const; - bool insertName( - OUString const & rTheName, bool bOctets, bool bAppendFinalSlash, - sal_Int32 nIndex, bool bIgnoreFinalSlash, EncodeMechanism eMechanism, - rtl_TextEncoding eCharset); - // Query: bool clearQuery(); @@ -1235,7 +1227,7 @@ INetURLObject::smartRel2Abs(OUString const & rTheRelURIRef, FSysStyle eStyle) const { INetURLObject aTheAbsURIRef; - convertRelToAbs(rTheRelURIRef, false, aTheAbsURIRef, rWasAbsolute, + convertRelToAbs(rTheRelURIRef, aTheAbsURIRef, rWasAbsolute, eMechanism, eCharset, bIgnoreFragment, true, bRelativeNonURIs, eStyle); return aTheAbsURIRef; @@ -1247,7 +1239,7 @@ inline bool INetURLObject::GetNewAbsURL(OUString const & rTheRelURIRef, { INetURLObject aTheAbsURIRef; bool bWasAbsolute; - if (!convertRelToAbs(rTheRelURIRef, false, aTheAbsURIRef, bWasAbsolute, + if (!convertRelToAbs(rTheRelURIRef, aTheAbsURIRef, bWasAbsolute, WAS_ENCODED, RTL_TEXTENCODING_UTF8, false/*bIgnoreFragment*/, false, false, FSYS_DETECT)) return false; @@ -1299,26 +1291,16 @@ inline bool INetURLObject::SetPass(OUString const & rThePassword) { return rThePassword.isEmpty() ? clearPassword() : - setPassword(rThePassword, WAS_ENCODED, RTL_TEXTENCODING_UTF8); + setPassword(rThePassword, RTL_TEXTENCODING_UTF8); } inline bool INetURLObject::SetUserAndPass(OUString const & rTheUser, OUString const & rThePassword) { - return setUser(rTheUser, WAS_ENCODED, RTL_TEXTENCODING_UTF8) + return setUser(rTheUser, RTL_TEXTENCODING_UTF8) && (rThePassword.isEmpty() ? clearPassword() : - setPassword(rThePassword, WAS_ENCODED, RTL_TEXTENCODING_UTF8)); -} - -inline bool INetURLObject::insertName(OUString const & rTheName, - bool bAppendFinalSlash, - sal_Int32 nIndex, - EncodeMechanism eMechanism, - rtl_TextEncoding eCharset) -{ - return insertName(rTheName, false, bAppendFinalSlash, nIndex, - true/*bIgnoreFinalSlash*/, eMechanism, eCharset); + setPassword(rThePassword, RTL_TEXTENCODING_UTF8)); } inline bool INetURLObject::SetParam(OUString const & rTheQuery, diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx index 825076282ff3..eb0b025ec848 100644 --- a/tools/source/fsys/urlobj.cxx +++ b/tools/source/fsys/urlobj.cxx @@ -1470,7 +1470,6 @@ void INetURLObject::changeScheme(INetProtocol eTargetScheme) { } bool INetURLObject::convertRelToAbs(OUString const & rTheRelURIRef, - bool bOctets, INetURLObject & rTheAbsURIRef, bool & rWasAbsolute, EncodeMechanism eMechanism, @@ -1533,7 +1532,7 @@ bool INetURLObject::convertRelToAbs(OUString const & rTheRelURIRef, q, pEnd - q, '\\'); sal_Unicode const * qe = n == -1 ? pEnd : q + n; if (parseHostOrNetBiosName( - q, qe, bOctets, ENCODE_ALL, RTL_TEXTENCODING_DONTKNOW, + q, qe, false/*bOctets*/, ENCODE_ALL, RTL_TEXTENCODING_DONTKNOW, true, nullptr)) { bFSys = true; // 1st @@ -1542,7 +1541,7 @@ bool INetURLObject::convertRelToAbs(OUString const & rTheRelURIRef, if (bFSys) { INetURLObject aNewURI; - aNewURI.setAbsURIRef(rTheRelURIRef, bOctets, eMechanism, + aNewURI.setAbsURIRef(rTheRelURIRef, false/*bOctets*/, eMechanism, eCharset, true, eStyle); if (!aNewURI.HasError()) { @@ -1649,7 +1648,7 @@ bool INetURLObject::convertRelToAbs(OUString const & rTheRelURIRef, { EscapeType eEscapeType; sal_uInt32 nUTF32 - = getUTF32(p, pEnd, bOctets, eMechanism, + = getUTF32(p, pEnd, false/*bOctets*/, eMechanism, eCharset, eEscapeType); if (eEscapeType == ESCAPE_NO) { @@ -1661,7 +1660,7 @@ bool INetURLObject::convertRelToAbs(OUString const & rTheRelURIRef, break; } } - appendUCS4(aSynAbsURIRef, nUTF32, eEscapeType, bOctets, + appendUCS4(aSynAbsURIRef, nUTF32, eEscapeType, false/*bOctets*/, PART_VISIBLE, eCharset, true); } } @@ -1704,7 +1703,7 @@ bool INetURLObject::convertRelToAbs(OUString const & rTheRelURIRef, { EscapeType eEscapeType; sal_uInt32 nUTF32 - = getUTF32(p, pEnd, bOctets, eMechanism, eCharset, eEscapeType); + = getUTF32(p, pEnd, false/*bOctets*/, eMechanism, eCharset, eEscapeType); if (eEscapeType == ESCAPE_NO) { if (nUTF32 == nFragmentDelimiter) @@ -1715,7 +1714,7 @@ bool INetURLObject::convertRelToAbs(OUString const & rTheRelURIRef, else if (nUTF32 == nSegmentDelimiter) nUTF32 = '/'; } - appendUCS4(aSynAbsURIRef, nUTF32, eEscapeType, bOctets, ePart, + appendUCS4(aSynAbsURIRef, nUTF32, eEscapeType, false/*bOctets*/, ePart, eCharset, true); } } @@ -1797,9 +1796,9 @@ bool INetURLObject::convertRelToAbs(OUString const & rTheRelURIRef, { EscapeType eEscapeType; sal_uInt32 nUTF32 - = getUTF32(p, pEnd, bOctets, eMechanism, + = getUTF32(p, pEnd, false/*bOctets*/, eMechanism, eCharset, eEscapeType); - appendUCS4(aSynAbsURIRef, nUTF32, eEscapeType, bOctets, ePart, + appendUCS4(aSynAbsURIRef, nUTF32, eEscapeType, false/*bOctets*/, ePart, eCharset, true); } if (p != pEnd && *p == nSegmentDelimiter) @@ -1813,8 +1812,8 @@ bool INetURLObject::convertRelToAbs(OUString const & rTheRelURIRef, { EscapeType eEscapeType; sal_uInt32 nUTF32 - = getUTF32(p, pEnd, bOctets, eMechanism, eCharset, eEscapeType); - appendUCS4(aSynAbsURIRef, nUTF32, eEscapeType, bOctets, ePart, + = getUTF32(p, pEnd, false/*bOctets*/, eMechanism, eCharset, eEscapeType); + appendUCS4(aSynAbsURIRef, nUTF32, eEscapeType, false/*bOctets*/, ePart, eCharset, true); } @@ -1843,8 +1842,8 @@ bool INetURLObject::convertRelToAbs(OUString const & rTheRelURIRef, { EscapeType eEscapeType; sal_uInt32 nUTF32 - = getUTF32(p, pEnd, bOctets, eMechanism, eCharset, eEscapeType); - appendUCS4(aSynAbsURIRef, nUTF32, eEscapeType, bOctets, + = getUTF32(p, pEnd, false/*bOctets*/, eMechanism, eCharset, eEscapeType); + appendUCS4(aSynAbsURIRef, nUTF32, eEscapeType, false/*bOctets*/, PART_VISIBLE, eCharset, true); } } @@ -1886,7 +1885,7 @@ bool INetURLObject::convertAbsToRel(OUString const & rTheAbsURIRef, // ref: INetURLObject aSubject; bool bWasAbsolute; - if (!convertRelToAbs(rTheAbsURIRef, false/*bOctets*/, aSubject, bWasAbsolute, + if (!convertRelToAbs(rTheAbsURIRef, aSubject, bWasAbsolute, eEncodeMechanism, eCharset, false, false, false, eStyle)) { @@ -2226,7 +2225,6 @@ INetURLObject::SubString INetURLObject::getAuthority() const } bool INetURLObject::setUser(OUString const & rTheUser, - EncodeMechanism eMechanism, rtl_TextEncoding eCharset) { if ( @@ -2237,7 +2235,7 @@ bool INetURLObject::setUser(OUString const & rTheUser, } OUString aNewUser(encodeText(rTheUser, false/*bOctets*/, PART_USER_PASSWORD, - eMechanism, eCharset, false)); + WAS_ENCODED, eCharset, false)); sal_Int32 nDelta; if (m_aUser.isPresent()) nDelta = m_aUser.set(m_aAbsURIRef, aNewUser); @@ -2287,13 +2285,12 @@ bool INetURLObject::clearPassword() } bool INetURLObject::setPassword(OUString const & rThePassword, - EncodeMechanism eMechanism, rtl_TextEncoding eCharset) { if (!getSchemeInfo().m_bPassword) return false; OUString aNewAuth(encodeText(rThePassword, false/*bOctets*/, PART_USER_PASSWORD, - eMechanism, eCharset, false)); + WAS_ENCODED, eCharset, false)); sal_Int32 nDelta; if (m_aAuth.isPresent()) nDelta = m_aAuth.set(m_aAbsURIRef, aNewAuth); @@ -2825,7 +2822,6 @@ bool INetURLObject::parseHostOrNetBiosName( } bool INetURLObject::setHost(OUString const & rTheHost, - EncodeMechanism eMechanism, rtl_TextEncoding eCharset) { if (!getSchemeInfo().m_bHost) @@ -2856,7 +2852,7 @@ bool INetURLObject::setHost(OUString const & rTheHost, } if (!parseHostOrNetBiosName( aSynHost.getStr(), aSynHost.getStr() + aSynHost.getLength(), - false/*bOctets*/, eMechanism, eCharset, bNetBiosName, &aSynHost)) + false/*bOctets*/, WAS_ENCODED, eCharset, bNetBiosName, &aSynHost)) return false; sal_Int32 nDelta = m_aHost.set(m_aAbsURIRef, aSynHost.makeStringAndClear()); m_aPort += nDelta; @@ -3154,8 +3150,7 @@ bool INetURLObject::appendSegment(OUString const & rTheSegment, EncodeMechanism eMechanism, rtl_TextEncoding eCharset) { - return insertName(rTheSegment, false/*bOctets*/, false, LAST_SEGMENT, true, - eMechanism, eCharset); + return insertName(rTheSegment, false, LAST_SEGMENT, eMechanism, eCharset); } INetURLObject::SubString INetURLObject::getSegment(sal_Int32 nIndex, @@ -3204,9 +3199,8 @@ INetURLObject::SubString INetURLObject::getSegment(sal_Int32 nIndex, pSegEnd - pSegBegin); } -bool INetURLObject::insertName(OUString const & rTheName, bool bOctets, +bool INetURLObject::insertName(OUString const & rTheName, bool bAppendFinalSlash, sal_Int32 nIndex, - bool bIgnoreFinalSlash, EncodeMechanism eMechanism, rtl_TextEncoding eCharset) { @@ -3225,7 +3219,7 @@ bool INetURLObject::insertName(OUString const & rTheName, bool bOctets, if (nIndex == LAST_SEGMENT) { pPrefixEnd = pPathEnd; - if (bIgnoreFinalSlash && pPrefixEnd > pPathBegin && + if (pPrefixEnd > pPathBegin && pPrefixEnd[-1] == '/') { --pPrefixEnd; @@ -3241,14 +3235,14 @@ bool INetURLObject::insertName(OUString const & rTheName, bool bOctets, (pPathBegin == pPathEnd && bAppendFinalSlash); pSuffixBegin = (pPathEnd - pPathBegin == 1 && *pPathBegin == '/' && - !bAppendFinalSlash && bIgnoreFinalSlash) + !bAppendFinalSlash) ? pPathEnd : pPathBegin; } else { pPrefixEnd = pPathBegin; sal_Unicode const * pEnd = pPathEnd; - if (bIgnoreFinalSlash && pEnd > pPathBegin && pEnd[-1] == '/') + if (pEnd > pPathBegin && pEnd[-1] == '/') --pEnd; bool bSkip = pPrefixEnd < pEnd && *pPrefixEnd == '/'; bInsertSlash = false; @@ -3280,7 +3274,7 @@ bool INetURLObject::insertName(OUString const & rTheName, bool bOctets, OUStringBuffer aNewPath; aNewPath.append(pPathBegin, pPrefixEnd - pPathBegin); aNewPath.append('/'); - aNewPath.append(encodeText(rTheName, bOctets, PART_PCHAR, + aNewPath.append(encodeText(rTheName, false/*bOctets*/, PART_PCHAR, eMechanism, eCharset, true)); if (bInsertSlash) { aNewPath.append('/'); @@ -3842,7 +3836,7 @@ OUString INetURLObject::GetAbsURL(OUString const & rTheBaseURIRef, INetURLObject aTheAbsURIRef; bool bWasAbsolute; return INetURLObject(rTheBaseURIRef, eEncodeMechanism, eCharset). - convertRelToAbs(rTheRelURIRef, false, aTheAbsURIRef, + convertRelToAbs(rTheRelURIRef, aTheAbsURIRef, bWasAbsolute, eEncodeMechanism, eCharset, bIgnoreFragment, false, false, FSYS_DETECT) @@ -4147,7 +4141,6 @@ OUString INetURLObject::getExtension(sal_Int32 nIndex, bool INetURLObject::setExtension(OUString const & rTheExtension, sal_Int32 nIndex, bool bIgnoreFinalSlash, - EncodeMechanism eMechanism, rtl_TextEncoding eCharset) { SubString aSegment(getSegment(nIndex, bIgnoreFinalSlash)); @@ -4175,7 +4168,7 @@ bool INetURLObject::setExtension(OUString const & rTheExtension, aNewPath.append(pPathBegin, pExtension - pPathBegin); aNewPath.append('.'); aNewPath.append(encodeText(rTheExtension, false, PART_PCHAR, - eMechanism, eCharset, true)); + WAS_ENCODED, eCharset, true)); aNewPath.append(p, pPathEnd - p); return setPath(aNewPath.makeStringAndClear(), NOT_CANONIC, diff --git a/tools/source/memtools/multisel.cxx b/tools/source/memtools/multisel.cxx index d671130bc650..9e17b76ff907 100644 --- a/tools/source/memtools/multisel.cxx +++ b/tools/source/memtools/multisel.cxx @@ -561,22 +561,19 @@ bool StringRangeEnumerator::checkValue( sal_Int32 i_nValue, const std::set< sal_ return true; } -bool StringRangeEnumerator::insertRange( sal_Int32 i_nFirst, sal_Int32 i_nLast, bool bSequence, bool bMayAdjust ) +bool StringRangeEnumerator::insertRange( sal_Int32 i_nFirst, sal_Int32 i_nLast, bool bSequence ) { bool bSuccess = true; if( bSequence ) { - if( bMayAdjust ) - { - if( i_nFirst < mnMin ) - i_nFirst = mnMin; - if( i_nFirst > mnMax ) - i_nFirst = mnMax; - if( i_nLast < mnMin ) - i_nLast = mnMin; - if( i_nLast > mnMax ) - i_nLast = mnMax; - } + if( i_nFirst < mnMin ) + i_nFirst = mnMin; + if( i_nFirst > mnMax ) + i_nFirst = mnMax; + if( i_nLast < mnMin ) + i_nLast = mnMin; + if( i_nLast > mnMax ) + i_nLast = mnMax; if( checkValue( i_nFirst ) && checkValue( i_nLast ) ) { maSequence.push_back( Range( i_nFirst, i_nLast ) ); @@ -614,7 +611,7 @@ bool StringRangeEnumerator::insertJoinedRanges( return true; if( nCount == 1 ) - return insertRange( rNumbers[0], -1, false, true ); + return insertRange( rNumbers[0], -1, false ); for( size_t i = 0; i < nCount - 1; i++ ) { @@ -626,7 +623,7 @@ bool StringRangeEnumerator::insertJoinedRanges( else if( nFirst < nLast ) nFirst++; } - insertRange( nFirst, nLast, nFirst != nLast, true ); + insertRange( nFirst, nLast, nFirst != nLast ); } return true; |