diff options
author | Noel Grandin <noel@peralex.com> | 2016-05-12 10:05:54 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-05-13 08:10:29 +0000 |
commit | 0f6725454823a5789f3e1c70dad024c46d3f6fc9 (patch) | |
tree | 370646f32cddb69aadf0d9659e90ed8600d43901 /tools/source | |
parent | f12b17867ef8fa2cfc2ddb7ecda9d7acc57cfa59 (diff) |
clang-tidy modernize-loop-convert in toolkit to uui
Change-Id: I805aa1389ef8dde158f0b776d6b59579fa3082e4
Reviewed-on: https://gerrit.libreoffice.org/24921
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'tools/source')
-rw-r--r-- | tools/source/inet/inetmime.cxx | 6 | ||||
-rw-r--r-- | tools/source/memtools/multisel.cxx | 20 | ||||
-rw-r--r-- | tools/source/ref/errinf.cxx | 4 | ||||
-rw-r--r-- | tools/source/stream/stream.cxx | 6 | ||||
-rw-r--r-- | tools/source/zcodec/zcodec.cxx | 4 |
5 files changed, 20 insertions, 20 deletions
diff --git a/tools/source/inet/inetmime.cxx b/tools/source/inet/inetmime.cxx index ce123e8bd49e..5fdbf43342f6 100644 --- a/tools/source/inet/inetmime.cxx +++ b/tools/source/inet/inetmime.cxx @@ -2224,9 +2224,9 @@ static EncodingEntry const aEncodingMap[] rtl_TextEncoding getCharsetEncoding(sal_Char const * pBegin, sal_Char const * pEnd) { - for (sal_Size i = 0; i < SAL_N_ELEMENTS(aEncodingMap); ++i) - if (equalIgnoreCase(pBegin, pEnd, aEncodingMap[i].m_aName)) - return aEncodingMap[i].m_eEncoding; + for (const EncodingEntry& i : aEncodingMap) + if (equalIgnoreCase(pBegin, pEnd, i.m_aName)) + return i.m_eEncoding; return RTL_TEXTENCODING_DONTKNOW; } diff --git a/tools/source/memtools/multisel.cxx b/tools/source/memtools/multisel.cxx index 9e17b76ff907..ac32e372f8ef 100644 --- a/tools/source/memtools/multisel.cxx +++ b/tools/source/memtools/multisel.cxx @@ -27,8 +27,8 @@ void MultiSelection::ImplClear() // no selected indexes nSelCount = 0; - for ( size_t i = 0, n = aSels.size(); i < n; ++i ) { - delete aSels[ i ]; + for (Range* pSel : aSels) { + delete pSel; } aSels.clear(); } @@ -92,8 +92,8 @@ MultiSelection::MultiSelection( const MultiSelection& rOrig ) : } // copy the sub selections - for ( size_t n = 0; n < rOrig.aSels.size(); ++n ) - aSels.push_back( new Range( *rOrig.aSels[ n ] ) ); + for (const Range* pSel : rOrig.aSels) + aSels.push_back( new Range( *pSel ) ); } MultiSelection::MultiSelection( const Range& rRange ): @@ -109,8 +109,8 @@ MultiSelection::MultiSelection( const Range& rRange ): MultiSelection::~MultiSelection() { - for ( size_t i = 0, n = aSels.size(); i < n; ++i ) - delete aSels[ i ]; + for (Range* pSel : aSels) + delete pSel; aSels.clear(); } @@ -126,8 +126,8 @@ MultiSelection& MultiSelection::operator= ( const MultiSelection& rOrig ) // clear the old and copy the sub selections ImplClear(); - for ( size_t n = 0; n < rOrig.aSels.size(); ++n ) - aSels.push_back( new Range( *rOrig.aSels[ n ] ) ); + for (const Range* pSel : rOrig.aSels) + aSels.push_back( new Range( *pSel ) ); nSelCount = rOrig.nSelCount; return *this; @@ -527,8 +527,8 @@ void MultiSelection::SetTotalRange( const Range& rTotRange ) // re-calculate selection count nSelCount = 0; - for ( size_t i = 0, n = aSels.size(); i < n; ++ i ) - nSelCount += aSels[i]->Len(); + for (Range* pSel : aSels) + nSelCount += pSel->Len(); bCurValid = false; nCurIndex = 0; diff --git a/tools/source/ref/errinf.cxx b/tools/source/ref/errinf.cxx index 32bfb80b4659..40e7b697c8e2 100644 --- a/tools/source/ref/errinf.cxx +++ b/tools/source/ref/errinf.cxx @@ -63,8 +63,8 @@ EDcrData::EDcrData() , bIsWindowDsp(false) , nNextDcr(0) { - for(sal_uInt16 n=0;n<ERRCODE_DYNAMIC_COUNT;n++) - ppDcr[n]=nullptr; + for(DynamicErrorInfo*& rp : ppDcr) + rp = nullptr; } void DynamicErrorInfo_Impl::RegisterEDcr(DynamicErrorInfo *pDcr) diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx index deda3732c3ca..0074ed6fd670 100644 --- a/tools/source/stream/stream.cxx +++ b/tools/source/stream/stream.cxx @@ -1543,12 +1543,12 @@ sal_Size SvStream::CryptAndWriteBuffer( const void* pStart, sal_Size nLen) nLen -= nBufCount; memcpy( pTemp, pDataPtr, (sal_uInt16)nBufCount ); // **** Verschluesseln ***** - for ( sal_uInt16 n=0; n < CRYPT_BUFSIZE; n++ ) + for (unsigned char & rn : pTemp) { - unsigned char aCh = pTemp[n]; + unsigned char aCh = rn; aCh ^= nMask; SWAPNIBBLES(aCh) - pTemp[n] = aCh; + rn = aCh; } // ************************* nCount += PutData( pTemp, nBufCount ); diff --git a/tools/source/zcodec/zcodec.cxx b/tools/source/zcodec/zcodec.cxx index db86c4ec3190..fcf8c2126a6b 100644 --- a/tools/source/zcodec/zcodec.cxx +++ b/tools/source/zcodec/zcodec.cxx @@ -337,10 +337,10 @@ void ZCodec::InitDecompress(SvStream & inStream) if ( mbStatus && mbGzLib ) { sal_uInt8 n1, n2, j, nMethod, nFlags; - for ( int i = 0; i < 2; i++ ) // gz - magic number + for (int i : gz_magic) // gz - magic number { inStream.ReadUChar( j ); - if ( j != gz_magic[ i ] ) + if ( j != i ) mbStatus = false; } inStream.ReadUChar( nMethod ); |