From 26ccd00bc96c585b7065af0dcce246b5bfaae5e1 Mon Sep 17 00:00:00 2001 From: Tamás Zolnai Date: Wed, 31 Oct 2018 17:20:46 +0100 Subject: clang-tidy: (WIP) bugprone-too-small-loop-variable findings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Iaa255b39928ac45dec1ed37e368c149d6027f561 Reviewed-on: https://gerrit.libreoffice.org/62701 Reviewed-by: Tamás Zolnai Tested-by: Tamás Zolnai --- sdext/source/pdfimport/filterdet.cxx | 2 +- sdext/source/pdfimport/pdfparse/pdfentries.cxx | 4 ++-- sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'sdext') diff --git a/sdext/source/pdfimport/filterdet.cxx b/sdext/source/pdfimport/filterdet.cxx index 43cfd1ff0120..b48fc648ea04 100644 --- a/sdext/source/pdfimport/filterdet.cxx +++ b/sdext/source/pdfimport/filterdet.cxx @@ -237,7 +237,7 @@ OUString SAL_CALL PDFDetector::detect( uno::Sequence< beans::PropertyValue >& rF if( nBytes > 5 ) { const sal_Int8* pBytes = aBuf.getConstArray(); - for( unsigned int i = 0; i < nBytes-5; i++ ) + for( sal_uInt64 i = 0; i < nBytes-5; i++ ) { if( pBytes[i] == '%' && pBytes[i+1] == 'P' && diff --git a/sdext/source/pdfimport/pdfparse/pdfentries.cxx b/sdext/source/pdfimport/pdfparse/pdfentries.cxx index 7d176ebdfc16..7bc541c3b1bd 100644 --- a/sdext/source/pdfimport/pdfparse/pdfentries.cxx +++ b/sdext/source/pdfimport/pdfparse/pdfentries.cxx @@ -1189,7 +1189,7 @@ static bool check_user_password( const OString& rPwd, PDFFileImplData* pData ) for( int i = 1; i <= 19; i++ ) // do it 19 times, start with 1 { sal_uInt8 aTempKey[ENCRYPTION_KEY_LEN]; - for( sal_uInt32 j = 0; j < sizeof(aTempKey); j++ ) + for( size_t j = 0; j < sizeof(aTempKey); j++ ) aTempKey[j] = static_cast( aKey[j] ^ i ); if (rtl_cipher_initARCFOUR( pData->m_aCipher, rtl_Cipher_DirectionEncode, @@ -1257,7 +1257,7 @@ bool PDFFile::setupDecryptionData( const OString& rPwd ) const for( int i = 19; i >= 0; i-- ) { sal_uInt8 nTempKey[ENCRYPTION_KEY_LEN]; - for( unsigned int j = 0; j < sizeof(nTempKey); j++ ) + for( size_t j = 0; j < sizeof(nTempKey); j++ ) nTempKey[j] = sal_uInt8(aKey[j] ^ i); if (rtl_cipher_initARCFOUR( m_pData->m_aCipher, rtl_Cipher_DirectionDecode, nTempKey, nKeyLen, nullptr, 0 ) diff --git a/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx b/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx index 16db05afe870..28334dac56d8 100644 --- a/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx +++ b/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx @@ -81,7 +81,7 @@ int main(int argc, char **argv) aPwBuf[0] = 0; // mark as empty else { - for( unsigned int i = 0; i < sizeof(aPwBuf); i++ ) + for( size_t i = 0; i < sizeof(aPwBuf); i++ ) { if( aPwBuf[i] == '\n' ) { -- cgit