diff options
author | Noel Grandin <noel@peralex.com> | 2016-05-09 13:22:38 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-05-10 06:29:32 +0000 |
commit | f469309e265b8cf692b2048eb29ce972f939c3f2 (patch) | |
tree | bf288ce36281a0222a9dc1271f65640a4f264c84 /sdext | |
parent | Simplify code with ForEachNonNull (diff) | |
download | core-f469309e265b8cf692b2048eb29ce972f939c3f2.tar.gz core-f469309e265b8cf692b2048eb29ce972f939c3f2.zip |
clang-tidy modernize-loop-convert scaddins to sdext
Change-Id: I63ccc56df1a1de8bc443abb95e520246c457912f
Reviewed-on: https://gerrit.libreoffice.org/24798
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'sdext')
-rw-r--r-- | sdext/source/pdfimport/filterdet.cxx | 12 | ||||
-rw-r--r-- | sdext/source/pdfimport/tree/pdfiprocessor.cxx | 10 | ||||
-rw-r--r-- | sdext/source/pdfimport/tree/style.cxx | 8 |
3 files changed, 15 insertions, 15 deletions
diff --git a/sdext/source/pdfimport/filterdet.cxx b/sdext/source/pdfimport/filterdet.cxx index 5e5485f2485a..6a845573e3bf 100644 --- a/sdext/source/pdfimport/filterdet.cxx +++ b/sdext/source/pdfimport/filterdet.cxx @@ -420,7 +420,7 @@ bool checkDocChecksum( const OUString& rInPDFFileURL, // prepare checksum to test sal_uInt8 nTestChecksum[ RTL_DIGEST_LENGTH_MD5 ]; const sal_Unicode* pChar = rChkSum.getStr(); - for( unsigned int i = 0; i < RTL_DIGEST_LENGTH_MD5; i++ ) + for(sal_uInt8 & rn : nTestChecksum) { sal_uInt8 nByte = sal_uInt8( ( (*pChar >= '0' && *pChar <= '9') ? *pChar - '0' : ( (*pChar >= 'A' && *pChar <= 'F') ? *pChar - 'A' + 10 : @@ -433,7 +433,7 @@ bool checkDocChecksum( const OUString& rInPDFFileURL, ( (*pChar >= 'a' && *pChar <= 'f') ? *pChar - 'a' + 10 : 0 ) ) ); pChar++; - nTestChecksum[i] = nByte; + rn = nByte; } // open file and calculate actual checksum up to index nBytes @@ -470,12 +470,12 @@ bool checkDocChecksum( const OUString& rInPDFFileURL, bRet = (0 == memcmp( nActualChecksum, nTestChecksum, sizeof( nActualChecksum ) )); #if OSL_DEBUG_LEVEL > 0 OSL_TRACE( "test checksum: " ); - for( unsigned int i = 0; i < sizeof(nTestChecksum); i++ ) - OSL_TRACE( "%.2X", int(nTestChecksum[i]) ); + for(sal_uInt8 i : nTestChecksum) + OSL_TRACE( "%.2X", int(i) ); OSL_TRACE( "\n" ); OSL_TRACE( "file checksum: " ); - for( unsigned int i = 0; i < sizeof(nActualChecksum); i++ ) - OSL_TRACE( "%.2X", int(nActualChecksum[i]) ); + for(sal_uInt8 i : nActualChecksum) + OSL_TRACE( "%.2X", int(i) ); OSL_TRACE( "\n" ); #endif return bRet; diff --git a/sdext/source/pdfimport/tree/pdfiprocessor.cxx b/sdext/source/pdfimport/tree/pdfiprocessor.cxx index c48a2e3ccf19..2551bf41237d 100644 --- a/sdext/source/pdfimport/tree/pdfiprocessor.cxx +++ b/sdext/source/pdfimport/tree/pdfiprocessor.cxx @@ -206,9 +206,9 @@ void PDFIProcessor::processGlyphLine() double spaceDetectBoundary = 0.0; // Try to find space glyph and its width - for (size_t i = 0; i < m_GlyphsList.size(); i++) + for (CharGlyph & i : m_GlyphsList) { - OUString& glyph = m_GlyphsList[i].getGlyph(); + OUString& glyph = i.getGlyph(); sal_Unicode ch = '\0'; if (!glyph.isEmpty()) @@ -216,7 +216,7 @@ void PDFIProcessor::processGlyphLine() if ((ch == 0x20) || (ch == 0xa0)) { - double spaceWidth = m_GlyphsList[i].getWidth(); + double spaceWidth = i.getWidth(); spaceDetectBoundary = spaceWidth * 0.5; break; } @@ -226,8 +226,8 @@ void PDFIProcessor::processGlyphLine() if (spaceDetectBoundary == 0.0) { double avgGlyphWidth = 0.0; - for (size_t i = 0; i < m_GlyphsList.size(); i++) - avgGlyphWidth += m_GlyphsList[i].getWidth(); + for (CharGlyph & i : m_GlyphsList) + avgGlyphWidth += i.getWidth(); avgGlyphWidth /= m_GlyphsList.size(); spaceDetectBoundary = avgGlyphWidth * 0.2; } diff --git a/sdext/source/pdfimport/tree/style.cxx b/sdext/source/pdfimport/tree/style.cxx index 35ac61b395c9..f6074b1f46de 100644 --- a/sdext/source/pdfimport/tree/style.cxx +++ b/sdext/source/pdfimport/tree/style.cxx @@ -44,8 +44,8 @@ sal_Int32 StyleContainer::impl_getStyleId( const Style& rStyle, bool bSubStyle ) aSearchStyle.Properties = rStyle.Properties; aSearchStyle.Contents = rStyle.Contents; aSearchStyle.ContainedElement = rStyle.ContainedElement; - for( size_t n = 0; n < rStyle.SubStyles.size(); ++n ) - aSearchStyle.SubStyles.push_back( impl_getStyleId( *rStyle.SubStyles[n], true ) ); + for(Style* pSubStyle : rStyle.SubStyles) + aSearchStyle.SubStyles.push_back( impl_getStyleId( *pSubStyle, true ) ); std::unordered_map< HashedStyle, sal_Int32, StyleHash >::iterator it = m_aStyleToId.find( aSearchStyle ); @@ -195,8 +195,8 @@ void StyleContainer::impl_emitStyle( sal_Int32 nStyleId, aProps[ "draw:name" ] = aProps[ "style:name" ]; rContext.rEmitter.beginTag( rStyle.Name.getStr(), aProps ); - for( size_t n = 0; n < rStyle.SubStyles.size(); ++n ) - impl_emitStyle( rStyle.SubStyles[n], rContext, rContainedElemVisitor ); + for(sal_Int32 nSubStyle : rStyle.SubStyles) + impl_emitStyle( nSubStyle, rContext, rContainedElemVisitor ); if( !rStyle.Contents.isEmpty() ) rContext.rEmitter.write( rStyle.Contents ); if( rStyle.ContainedElement ) |