diff options
author | Noel Grandin <noel@peralex.com> | 2016-03-16 13:17:24 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-03-17 06:09:42 +0000 |
commit | 8ca50d20c189dda2fcc4477303ef2947c72bb01e (patch) | |
tree | 4e68e83104b3822f3b9949f39b2de6a66b67ef97 /tools | |
parent | a976a19ca82661d8b459b85f5514b0e4c9222d47 (diff) |
loplugin:constantparam in tools
Change-Id: I3774661799c074561c694515baba42a375d0a077
Reviewed-on: https://gerrit.libreoffice.org/23301
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/source/fsys/urlobj.cxx | 55 | ||||
-rw-r--r-- | tools/source/generic/b3dtrans.cxx | 10 | ||||
-rw-r--r-- | tools/source/generic/poly.cxx | 18 | ||||
-rw-r--r-- | tools/source/memtools/multisel.cxx | 11 | ||||
-rw-r--r-- | tools/source/ref/pstm.cxx | 26 | ||||
-rw-r--r-- | tools/source/stream/stream.cxx | 4 | ||||
-rw-r--r-- | tools/source/zcodec/zcodec.cxx | 6 |
7 files changed, 60 insertions, 70 deletions
diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx index e8b026012705..825076282ff3 100644 --- a/tools/source/fsys/urlobj.cxx +++ b/tools/source/fsys/urlobj.cxx @@ -1869,7 +1869,7 @@ bool INetURLObject::convertRelToAbs(OUString const & rTheRelURIRef, } bool INetURLObject::convertAbsToRel(OUString const & rTheAbsURIRef, - bool bOctets, OUString & rTheRelURIRef, + OUString & rTheRelURIRef, EncodeMechanism eEncodeMechanism, DecodeMechanism eDecodeMechanism, rtl_TextEncoding eCharset, @@ -1886,7 +1886,7 @@ bool INetURLObject::convertAbsToRel(OUString const & rTheAbsURIRef, // ref: INetURLObject aSubject; bool bWasAbsolute; - if (!convertRelToAbs(rTheAbsURIRef, bOctets, aSubject, bWasAbsolute, + if (!convertRelToAbs(rTheAbsURIRef, false/*bOctets*/, aSubject, bWasAbsolute, eEncodeMechanism, eCharset, false, false, false, eStyle)) { @@ -2226,7 +2226,7 @@ INetURLObject::SubString INetURLObject::getAuthority() const } bool INetURLObject::setUser(OUString const & rTheUser, - bool bOctets, EncodeMechanism eMechanism, + EncodeMechanism eMechanism, rtl_TextEncoding eCharset) { if ( @@ -2236,7 +2236,7 @@ bool INetURLObject::setUser(OUString const & rTheUser, return false; } - OUString aNewUser(encodeText(rTheUser, bOctets, PART_USER_PASSWORD, + OUString aNewUser(encodeText(rTheUser, false/*bOctets*/, PART_USER_PASSWORD, eMechanism, eCharset, false)); sal_Int32 nDelta; if (m_aUser.isPresent()) @@ -2287,12 +2287,12 @@ bool INetURLObject::clearPassword() } bool INetURLObject::setPassword(OUString const & rThePassword, - bool bOctets, EncodeMechanism eMechanism, + EncodeMechanism eMechanism, rtl_TextEncoding eCharset) { if (!getSchemeInfo().m_bPassword) return false; - OUString aNewAuth(encodeText(rThePassword, bOctets, PART_USER_PASSWORD, + OUString aNewAuth(encodeText(rThePassword, false/*bOctets*/, PART_USER_PASSWORD, eMechanism, eCharset, false)); sal_Int32 nDelta; if (m_aAuth.isPresent()) @@ -2824,7 +2824,7 @@ bool INetURLObject::parseHostOrNetBiosName( return true; } -bool INetURLObject::setHost(OUString const & rTheHost, bool bOctets, +bool INetURLObject::setHost(OUString const & rTheHost, EncodeMechanism eMechanism, rtl_TextEncoding eCharset) { @@ -2856,7 +2856,7 @@ bool INetURLObject::setHost(OUString const & rTheHost, bool bOctets, } if (!parseHostOrNetBiosName( aSynHost.getStr(), aSynHost.getStr() + aSynHost.getLength(), - bOctets, eMechanism, eCharset, bNetBiosName, &aSynHost)) + false/*bOctets*/, eMechanism, eCharset, bNetBiosName, &aSynHost)) return false; sal_Int32 nDelta = m_aHost.set(m_aAbsURIRef, aSynHost.makeStringAndClear()); m_aPort += nDelta; @@ -3123,14 +3123,14 @@ bool INetURLObject::parsePath(INetProtocol eScheme, return true; } -bool INetURLObject::setPath(OUString const & rThePath, bool bOctets, +bool INetURLObject::setPath(OUString const & rThePath, EncodeMechanism eMechanism, rtl_TextEncoding eCharset) { OUStringBuffer aSynPath; sal_Unicode const * p = rThePath.getStr(); sal_Unicode const * pEnd = p + rThePath.getLength(); - if (!parsePath(m_eScheme, &p, pEnd, bOctets, eMechanism, eCharset, false, + if (!parsePath(m_eScheme, &p, pEnd, false/*bOctets*/, eMechanism, eCharset, false, '/', 0x80000000, 0x80000000, 0x80000000, aSynPath) || p != pEnd) return false; @@ -3151,10 +3151,10 @@ bool INetURLObject::checkHierarchical() const { } bool INetURLObject::appendSegment(OUString const & rTheSegment, - bool bOctets, EncodeMechanism eMechanism, + EncodeMechanism eMechanism, rtl_TextEncoding eCharset) { - return insertName(rTheSegment, bOctets, false, LAST_SEGMENT, true, + return insertName(rTheSegment, false/*bOctets*/, false, LAST_SEGMENT, true, eMechanism, eCharset); } @@ -3287,7 +3287,7 @@ bool INetURLObject::insertName(OUString const & rTheName, bool bOctets, } aNewPath.append(pSuffixBegin, pPathEnd - pSuffixBegin); - return setPath(aNewPath.makeStringAndClear(), false, NOT_CANONIC, + return setPath(aNewPath.makeStringAndClear(), NOT_CANONIC, RTL_TEXTENCODING_UTF8); } @@ -3304,13 +3304,13 @@ bool INetURLObject::clearQuery() return false; } -bool INetURLObject::setQuery(OUString const & rTheQuery, bool bOctets, +bool INetURLObject::setQuery(OUString const & rTheQuery, EncodeMechanism eMechanism, rtl_TextEncoding eCharset) { if (!getSchemeInfo().m_bQuery) return false; - OUString aNewQuery(encodeText(rTheQuery, bOctets, PART_URIC, + OUString aNewQuery(encodeText(rTheQuery, false/*bOctets*/, PART_URIC, eMechanism, eCharset, true)); sal_Int32 nDelta; if (m_aQuery.isPresent()) @@ -3338,12 +3338,12 @@ bool INetURLObject::clearFragment() } bool INetURLObject::setFragment(OUString const & rTheFragment, - bool bOctets, EncodeMechanism eMechanism, + EncodeMechanism eMechanism, rtl_TextEncoding eCharset) { if (HasError()) return false; - OUString aNewFragment(encodeText(rTheFragment, bOctets, PART_URIC, + OUString aNewFragment(encodeText(rTheFragment, false/*bOctets*/, PART_URIC, eMechanism, eCharset, true)); if (m_aFragment.isPresent()) m_aFragment.set(m_aAbsURIRef, aNewFragment); @@ -3985,7 +3985,7 @@ bool INetURLObject::removeSegment(sal_Int32 nIndex, bool bIgnoreFinalSlash) aNewPath.append('/'); } - return setPath(aNewPath.makeStringAndClear(), false, NOT_CANONIC, + return setPath(aNewPath.makeStringAndClear(), NOT_CANONIC, RTL_TEXTENCODING_UTF8); } @@ -4035,7 +4035,7 @@ bool INetURLObject::setName(OUString const & rTheName) WAS_ENCODED, RTL_TEXTENCODING_UTF8, true)); aNewPath.append(p, pPathEnd - p); - return setPath(aNewPath.makeStringAndClear(), false, NOT_CANONIC, + return setPath(aNewPath.makeStringAndClear(), NOT_CANONIC, RTL_TEXTENCODING_UTF8); } @@ -4084,11 +4084,10 @@ OUString INetURLObject::getBase(sal_Int32 nIndex, bool bIgnoreFinalSlash, } bool INetURLObject::setBase(OUString const & rTheBase, sal_Int32 nIndex, - bool bIgnoreFinalSlash, EncodeMechanism eMechanism, rtl_TextEncoding eCharset) { - SubString aSegment(getSegment(nIndex, bIgnoreFinalSlash)); + SubString aSegment(getSegment(nIndex, true/*bIgnoreFinalSlash*/)); if (!aSegment.isPresent()) return false; @@ -4115,7 +4114,7 @@ bool INetURLObject::setBase(OUString const & rTheBase, sal_Int32 nIndex, eMechanism, eCharset, true)); aNewPath.append(pExtension, pPathEnd - pExtension); - return setPath(aNewPath.makeStringAndClear(), false, NOT_CANONIC, + return setPath(aNewPath.makeStringAndClear(), NOT_CANONIC, RTL_TEXTENCODING_UTF8); } @@ -4179,7 +4178,7 @@ bool INetURLObject::setExtension(OUString const & rTheExtension, eMechanism, eCharset, true)); aNewPath.append(p, pPathEnd - p); - return setPath(aNewPath.makeStringAndClear(), false, NOT_CANONIC, + return setPath(aNewPath.makeStringAndClear(), NOT_CANONIC, RTL_TEXTENCODING_UTF8); } @@ -4210,7 +4209,7 @@ bool INetURLObject::removeExtension(sal_Int32 nIndex, bool bIgnoreFinalSlash) aNewPath.append(pPathBegin, pExtension - pPathBegin); aNewPath.append(p, pPathEnd - p); - return setPath(aNewPath.makeStringAndClear(), false, NOT_CANONIC, + return setPath(aNewPath.makeStringAndClear(), NOT_CANONIC, RTL_TEXTENCODING_UTF8); } @@ -4240,7 +4239,7 @@ bool INetURLObject::setFinalSlash() aNewPath.append(pPathBegin, pPathEnd - pPathBegin); aNewPath.append('/'); - return setPath(aNewPath.makeStringAndClear(), false, NOT_CANONIC, + return setPath(aNewPath.makeStringAndClear(), NOT_CANONIC, RTL_TEXTENCODING_UTF8); } @@ -4260,7 +4259,7 @@ bool INetURLObject::removeFinalSlash() return false; OUString aNewPath(pPathBegin, pPathEnd - pPathBegin); - return setPath(aNewPath, false, NOT_CANONIC, RTL_TEXTENCODING_UTF8); + return setPath(aNewPath, NOT_CANONIC, RTL_TEXTENCODING_UTF8); } bool INetURLObject::setFSysPath(OUString const & rFSysPath, @@ -4924,7 +4923,7 @@ OUString INetURLObject::GetPath() const void INetURLObject::SetBase(OUString const & rTheBase) { - setBase(rTheBase, LAST_SEGMENT, true, ENCODE_ALL); + setBase(rTheBase, LAST_SEGMENT, ENCODE_ALL); } OUString INetURLObject::GetBase() const @@ -4938,7 +4937,7 @@ void INetURLObject::SetName(OUString const & rTheName, { INetURLObject aTemp(*this); if (aTemp.removeSegment() - && aTemp.insertName(rTheName, false, LAST_SEGMENT, true, eMechanism, + && aTemp.insertName(rTheName, false, LAST_SEGMENT, eMechanism, eCharset)) *this = aTemp; } diff --git a/tools/source/generic/b3dtrans.cxx b/tools/source/generic/b3dtrans.cxx index c735bd0cd8cb..34b205a6312d 100644 --- a/tools/source/generic/b3dtrans.cxx +++ b/tools/source/generic/b3dtrans.cxx @@ -339,8 +339,7 @@ void B3dTransformationSet::SetRatio(double fNew) } } -void B3dTransformationSet::SetDeviceRectangle(double fL, double fR, double fB, double fT, - bool bBroadCastChange) +void B3dTransformationSet::SetDeviceRectangle(double fL, double fR, double fB, double fT) { if(fL != mfLeftBound || fR != mfRightBound || fB != mfBottomBound || fT != mfTopBound) { @@ -354,8 +353,7 @@ void B3dTransformationSet::SetDeviceRectangle(double fL, double fR, double fB, d mbWorldToViewValid = false; // Broadcast changes - if(bBroadCastChange) - DeviceRectangleChange(); + DeviceRectangleChange(); } } @@ -444,14 +442,14 @@ void B3dViewport::CalcOrientation() B3dCamera::B3dCamera( const basegfx::B3DPoint& rPos, const basegfx::B3DVector& rLkAt, - double fFocLen, double fBnkAng, bool bUseFocLen) + double fFocLen, double fBnkAng) : B3dViewport(), aPosition(rPos), aCorrectedPosition(rPos), aLookAt(rLkAt), fFocalLength(fFocLen), fBankAngle(fBnkAng), - bUseFocalLength(bUseFocLen) + bUseFocalLength(false) { CalcNewViewportValues(); } diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx index 319c11192c48..519c9b45c1da 100644 --- a/tools/source/generic/poly.cxx +++ b/tools/source/generic/poly.cxx @@ -621,21 +621,19 @@ Polygon::Polygon( const Rectangle& rRect, sal_uInt32 nHorzRound, sal_uInt32 nVer } } -Polygon::Polygon( const Point& rCenter, long nRadX, long nRadY, sal_uInt16 nPoints ) +Polygon::Polygon( const Point& rCenter, long nRadX, long nRadY ) { if( nRadX && nRadY ) { + sal_uInt16 nPoints = 0; // Compute default (depends on size) - if( !nPoints ) - { - nPoints = (sal_uInt16) MinMax( - ( F_PI * ( 1.5 * ( nRadX + nRadY ) - - sqrt( (double) labs( nRadX * nRadY ) ) ) ), - 32, 256 ); + nPoints = (sal_uInt16) MinMax( + ( F_PI * ( 1.5 * ( nRadX + nRadY ) - + sqrt( (double) labs( nRadX * nRadY ) ) ) ), + 32, 256 ); - if( ( nRadX > 32 ) && ( nRadY > 32 ) && ( nRadX + nRadY ) < 8192 ) - nPoints >>= 1; - } + if( ( nRadX > 32 ) && ( nRadY > 32 ) && ( nRadX + nRadY ) < 8192 ) + nPoints >>= 1; // Ceil number of points until divisible by four mpImplPolygon = new ImplPolygon( nPoints = (nPoints + 3) & ~3 ); diff --git a/tools/source/memtools/multisel.cxx b/tools/source/memtools/multisel.cxx index 25599212b9a4..d671130bc650 100644 --- a/tools/source/memtools/multisel.cxx +++ b/tools/source/memtools/multisel.cxx @@ -607,14 +607,14 @@ bool StringRangeEnumerator::insertRange( sal_Int32 i_nFirst, sal_Int32 i_nLast, } bool StringRangeEnumerator::insertJoinedRanges( - const std::vector< sal_Int32 >& rNumbers, bool i_bStrict ) + const std::vector< sal_Int32 >& rNumbers ) { size_t nCount = rNumbers.size(); if( nCount == 0 ) return true; if( nCount == 1 ) - return insertRange( rNumbers[0], -1, false, ! i_bStrict ); + return insertRange( rNumbers[0], -1, false, true ); for( size_t i = 0; i < nCount - 1; i++ ) { @@ -626,8 +626,7 @@ bool StringRangeEnumerator::insertJoinedRanges( else if( nFirst < nLast ) nFirst++; } - if ( ! insertRange( nFirst, nLast, nFirst != nLast, ! i_bStrict ) && i_bStrict) - return false; + insertRange( nFirst, nLast, nFirst != nLast, true ); } return true; @@ -663,7 +662,7 @@ bool StringRangeEnumerator::setRange( const OUString& i_rNewRange ) { if( bSequence && !aNumbers.empty() ) aNumbers.push_back( mnMax ); - insertJoinedRanges( aNumbers, false/*i_bStrict*/ ); + insertJoinedRanges( aNumbers ); aNumbers.clear(); bSequence = false; @@ -677,7 +676,7 @@ bool StringRangeEnumerator::setRange( const OUString& i_rNewRange ) // insert last entries if( bSequence && !aNumbers.empty() ) aNumbers.push_back( mnMax ); - insertJoinedRanges( aNumbers, false/*i_bStrict*/ ); + insertJoinedRanges( aNumbers ); return true; } diff --git a/tools/source/ref/pstm.cxx b/tools/source/ref/pstm.cxx index 6c10aaace559..3c15968c0699 100644 --- a/tools/source/ref/pstm.cxx +++ b/tools/source/ref/pstm.cxx @@ -51,11 +51,11 @@ SvCreateInstancePersist SvClassManager::Get( sal_Int32 nClassId ) (cf. <SvPersistStream::SetStream>). @see SvPersistStream::SetStream */ -SvPersistStream::SvPersistStream( SvClassManager & rMgr, SvStream * pStream, Index nStartIdxP ) +SvPersistStream::SvPersistStream( SvClassManager & rMgr, SvStream * pStream ) : rClassMgr( rMgr ) , pStm( pStream ) - , aPUIdx( nStartIdxP ) - , nStartIdx( nStartIdxP ) + , aPUIdx( 1 ) + , nStartIdx( 1 ) , pRefStm( nullptr ) { DBG_ASSERT( nStartIdx != 0, "zero index not allowed" ); @@ -446,8 +446,7 @@ SvPersistStream& SvPersistStream::WritePointer void SvPersistStream::ReadObj ( - SvPersistBase * & rpObj, - bool bRegister + SvPersistBase * & rpObj ) { sal_uInt8 nHdr; @@ -492,15 +491,12 @@ void SvPersistStream::ReadObj // Save reference rpObj->AddFirstRef(); - if( bRegister ) - { - // insert into table - const Index nNewId = aPUIdx.Insert( rpObj ); - // in order to restore state after saving - aPTable[ rpObj ] = nNewId; - DBG_ASSERT( !(nHdr & P_DBGUTIL) || nId == nNewId, - "read write id conflict: not the same" ); - } + // insert into table + const Index nNewId = aPUIdx.Insert( rpObj ); + // in order to restore state after saving + aPTable[ rpObj ] = nNewId; + DBG_ASSERT( !(nHdr & P_DBGUTIL) || nId == nNewId, + "read write id conflict: not the same" ); rpObj->Load( *this ); #ifdef DBG_UTIL if( nObjLen + nObjPos != Tell() ) @@ -529,7 +525,7 @@ SvPersistStream& SvPersistStream::ReadPointer SvPersistBase * & rpObj ) { - ReadObj( rpObj, true ); + ReadObj( rpObj ); return *this; } diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx index 26b2e2f05a95..deda3732c3ca 100644 --- a/tools/source/stream/stream.cxx +++ b/tools/source/stream/stream.cxx @@ -1740,7 +1740,7 @@ sal_uInt64 SvMemoryStream::GetSize() } void SvMemoryStream::SetBuffer( void* pNewBuf, sal_Size nCount, - bool bOwnsDat, sal_Size nEOF ) + sal_Size nEOF ) { SetBufferSize( 0 ); // Buffering in der Basisklasse initialisieren Seek( 0 ); @@ -1754,7 +1754,7 @@ void SvMemoryStream::SetBuffer( void* pNewBuf, sal_Size nCount, nPos = 0; nSize = nCount; nResize = 0; - bOwnsData = bOwnsDat; + bOwnsData = false; if( nEOF > nCount ) nEOF = nCount; diff --git a/tools/source/zcodec/zcodec.cxx b/tools/source/zcodec/zcodec.cxx index 5198a5b26ada..db86c4ec3190 100644 --- a/tools/source/zcodec/zcodec.cxx +++ b/tools/source/zcodec/zcodec.cxx @@ -393,11 +393,11 @@ void ZCodec::UpdateCRC ( sal_uInt8* pSource, long nDatSize) mnCRC = rtl_crc32( mnCRC, pSource, nDatSize ); } -bool ZCodec::AttemptDecompression(SvStream& rIStm, SvStream& rOStm, bool updateCrc, bool gzLib) +bool ZCodec::AttemptDecompression(SvStream& rIStm, SvStream& rOStm) { assert(meState == STATE_INIT); sal_uLong nStreamPos = rIStm.Tell(); - BeginCompression(ZCODEC_DEFAULT_COMPRESSION, updateCrc, gzLib); + BeginCompression(ZCODEC_DEFAULT_COMPRESSION, false/*updateCrc*/, true/*gzLib*/); InitDecompress(rIStm); EndCompression(); if ( !mbStatus || rIStm.GetError() ) @@ -406,7 +406,7 @@ bool ZCodec::AttemptDecompression(SvStream& rIStm, SvStream& rOStm, bool updateC return false; } rIStm.Seek(nStreamPos); - BeginCompression(ZCODEC_DEFAULT_COMPRESSION, updateCrc, gzLib); + BeginCompression(ZCODEC_DEFAULT_COMPRESSION, false/*updateCrc*/, true/*gzLib*/); Decompress(rIStm, rOStm); EndCompression(); if( !mbStatus || rIStm.GetError() || rOStm.GetError() ) |