[Libreoffice-commits] core.git: toolkit/source tools/source ucb/source unotools/source uui/source

Noel Grandin noel at peralex.com
Fri May 13 08:11:10 UTC 2016


 toolkit/source/awt/vclxtoolkit.cxx                |   12 +++++------
 toolkit/source/controls/unocontrol.cxx            |    4 +--
 toolkit/source/helper/unowrapper.cxx              |    3 --
 toolkit/source/helper/vclunohelper.cxx            |   12 +++++------
 tools/source/inet/inetmime.cxx                    |    6 ++---
 tools/source/memtools/multisel.cxx                |   20 +++++++++---------
 tools/source/ref/errinf.cxx                       |    4 +--
 tools/source/stream/stream.cxx                    |    6 ++---
 tools/source/zcodec/zcodec.cxx                    |    4 +--
 ucb/source/sorter/sortdynres.cxx                  |    5 +---
 ucb/source/sorter/sortresult.cxx                  |    5 +---
 ucb/source/ucp/file/shell.cxx                     |    4 ---
 ucb/source/ucp/ftp/ftpcontentprovider.cxx         |   24 +++++++++++-----------
 ucb/source/ucp/ftp/ftpresultsetI.cxx              |    4 +--
 ucb/source/ucp/ftp/ftpurl.cxx                     |   12 ++++++-----
 ucb/source/ucp/webdav-neon/ContentProperties.cxx  |    9 ++------
 ucb/source/ucp/webdav-neon/webdavdatasupplier.cxx |    4 ---
 unotools/source/config/options.cxx                |    4 +--
 unotools/source/i18n/localedatawrapper.cxx        |    8 +++----
 unotools/source/misc/fontdefs.cxx                 |    6 ++---
 uui/source/iahndl-authentication.cxx              |    6 ++---
 21 files changed, 77 insertions(+), 85 deletions(-)

New commits:
commit 0f6725454823a5789f3e1c70dad024c46d3f6fc9
Author: Noel Grandin <noel at peralex.com>
Date:   Thu May 12 10:05:54 2016 +0200

    clang-tidy modernize-loop-convert in toolkit to uui
    
    Change-Id: I805aa1389ef8dde158f0b776d6b59579fa3082e4
    Reviewed-on: https://gerrit.libreoffice.org/24921
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx
index 4230cdb..c99030c 100644
--- a/toolkit/source/awt/vclxtoolkit.cxx
+++ b/toolkit/source/awt/vclxtoolkit.cxx
@@ -1787,10 +1787,10 @@ void VCLXToolkit::callTopWindowListeners(
         {
             css::lang::EventObject aAwtEvent(
                 static_cast< css::awt::XWindow * >(pWindow->GetWindowPeer()));
-            for (::sal_Int32 i = 0; i < (sal_Int32)aListeners.size(); ++i)
+            for (css::uno::Reference<XInterface> & i : aListeners)
             {
                 css::uno::Reference< css::awt::XTopWindowListener >
-                      xListener(aListeners[i], css::uno::UNO_QUERY);
+                      xListener(i, css::uno::UNO_QUERY);
                 try
                 {
                     (xListener.get()->*pFn)(aAwtEvent);
@@ -1833,10 +1833,10 @@ bool VCLXToolkit::callKeyHandlers(::VclSimpleEvent const * pEvent,
             pKeyEvent->GetKeyCode().GetCode(), pKeyEvent->GetCharCode(),
             sal::static_int_cast< sal_Int16 >(
                 pKeyEvent->GetKeyCode().GetFunction()));
-        for (::sal_Int32 i = 0; i < (sal_Int32)aHandlers.size(); ++i)
+        for (css::uno::Reference<XInterface> & i : aHandlers)
         {
             css::uno::Reference< css::awt::XKeyHandler > xHandler(
-                aHandlers[i], css::uno::UNO_QUERY);
+                i, css::uno::UNO_QUERY);
             try
             {
                 if ((bPressed ? xHandler->keyPressed(aAwtEvent)
@@ -1883,10 +1883,10 @@ void VCLXToolkit::callFocusListeners(::VclSimpleEvent const * pEvent,
                 static_cast< css::awt::XWindow * >(pWindow->GetWindowPeer()),
                 static_cast<sal_Int16>(pWindow->GetGetFocusFlags()),
                 xNext, false);
-            for (::sal_Int32 i = 0; i < (sal_Int32)aListeners.size(); ++i)
+            for (css::uno::Reference<XInterface> & i : aListeners)
             {
                 css::uno::Reference< css::awt::XFocusListener > xListener(
-                    aListeners[i], css::uno::UNO_QUERY);
+                    i, css::uno::UNO_QUERY);
                 try
                 {
                     bGained ? xListener->focusGained(aAwtEvent)
diff --git a/toolkit/source/controls/unocontrol.cxx b/toolkit/source/controls/unocontrol.cxx
index 75959ed..adb3989 100644
--- a/toolkit/source/controls/unocontrol.cxx
+++ b/toolkit/source/controls/unocontrol.cxx
@@ -586,9 +586,9 @@ void UnoControl::ImplModelPropertiesChanged( const Sequence< PropertyChangeEvent
             while ( pLangDepProp->pPropName != nullptr )
             {
                 bool bMustBeInserted( true );
-                for ( size_t i = 0; i < aPeerPropertiesToSet.size(); i++ )
+                for (PropertyValue & i : aPeerPropertiesToSet)
                 {
-                    if ( aPeerPropertiesToSet[i].Name.equalsAsciiL(
+                    if ( i.Name.equalsAsciiL(
                             pLangDepProp->pPropName, pLangDepProp->nPropNameLength ))
                     {
                         bMustBeInserted = false;
diff --git a/toolkit/source/helper/unowrapper.cxx b/toolkit/source/helper/unowrapper.cxx
index cc217b7..d5a00ad 100644
--- a/toolkit/source/helper/unowrapper.cxx
+++ b/toolkit/source/helper/unowrapper.cxx
@@ -197,9 +197,8 @@ void UnoWrapper::ReleaseAllGraphics( OutputDevice* pOutDev )
     std::vector< VCLXGraphics* > *pLst = pOutDev->GetUnoGraphicsList();
     if ( pLst )
     {
-        for ( size_t n = 0; n < pLst->size(); n++ )
+        for (VCLXGraphics* pGrf : *pLst)
         {
-            VCLXGraphics* pGrf = (*pLst)[ n ];
             pGrf->SetOutputDevice( nullptr );
         }
     }
diff --git a/toolkit/source/helper/vclunohelper.cxx b/toolkit/source/helper/vclunohelper.cxx
index bfe0e51..dda0172 100644
--- a/toolkit/source/helper/vclunohelper.cxx
+++ b/toolkit/source/helper/vclunohelper.cxx
@@ -544,19 +544,19 @@ namespace
             { FUNIT_FOOT,       MeasureUnit::FOOT,          1 },
             { FUNIT_MILE,       MeasureUnit::MILE,          1 },
         };
-        for ( size_t i = 0; i < SAL_N_ELEMENTS( aUnits ); ++i )
+        for (auto & aUnit : aUnits)
         {
             if ( eDirection == FieldUnitToMeasurementUnit )
             {
-                if ( ( aUnits[ i ].eFieldUnit == (FieldUnit)_nUnit ) && ( aUnits[ i ].nFieldToMeasureFactor == _rFieldToUNOValueFactor ) )
-                    return aUnits[ i ].nMeasurementUnit;
+                if ( ( aUnit.eFieldUnit == (FieldUnit)_nUnit ) && ( aUnit.nFieldToMeasureFactor == _rFieldToUNOValueFactor ) )
+                    return aUnit.nMeasurementUnit;
             }
             else
             {
-                if ( aUnits[ i ].nMeasurementUnit == _nUnit )
+                if ( aUnit.nMeasurementUnit == _nUnit )
                 {
-                    _rFieldToUNOValueFactor = aUnits[ i ].nFieldToMeasureFactor;
-                    return (sal_Int16)aUnits[ i ].eFieldUnit;
+                    _rFieldToUNOValueFactor = aUnit.nFieldToMeasureFactor;
+                    return (sal_Int16)aUnit.eFieldUnit;
                 }
             }
         }
diff --git a/tools/source/inet/inetmime.cxx b/tools/source/inet/inetmime.cxx
index ce123e8..5fdbf43 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 9e17b76..ac32e37 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 32bfb80..40e7b69 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 deda373..0074ed6 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 db86c4e..fcf8c21 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 );
diff --git a/ucb/source/sorter/sortdynres.cxx b/ucb/source/sorter/sortdynres.cxx
index e4552ec..65f4132 100644
--- a/ucb/source/sorter/sortdynres.cxx
+++ b/ucb/source/sorter/sortdynres.cxx
@@ -535,10 +535,9 @@ SortedDynamicResultSetFactory::createSortedDynamicResultSet(
 
 void EventList::Clear()
 {
-    for ( std::deque< ListAction* >::size_type i = 0;
-          i < maData.size(); ++i )
+    for (ListAction* p : maData)
     {
-        delete maData[i];
+        delete p;
     }
 
     maData.clear();
diff --git a/ucb/source/sorter/sortresult.cxx b/ucb/source/sorter/sortresult.cxx
index f65b89a..95d9c97 100644
--- a/ucb/source/sorter/sortresult.cxx
+++ b/ucb/source/sorter/sortresult.cxx
@@ -1801,10 +1801,9 @@ SortListData::SortListData( sal_IntPtr nPos )
 
 void SortedEntryList::Clear()
 {
-    for ( std::deque< ListAction* >::size_type i = 0;
-          i < maData.size(); ++i )
+    for (SortListData* p : maData)
     {
-        delete maData[i];
+        delete p;
     }
 
     maData.clear();
diff --git a/ucb/source/ucp/file/shell.cxx b/ucb/source/ucp/file/shell.cxx
index 6db4742..029459e 100644
--- a/ucb/source/ucp/file/shell.cxx
+++ b/ucb/source/ucp/file/shell.cxx
@@ -2751,10 +2751,8 @@ shell::getContentExchangedEventListeners( const OUString& aOldPrefix,
 void SAL_CALL
 shell::notifyContentExchanged( std::vector< std::list< ContentEventNotifier* >* >* listeners_vec )
 {
-    std::list< ContentEventNotifier* >* listeners;
-    for( size_t i = 0; i < listeners_vec->size(); ++i )
+    for( std::list< ContentEventNotifier* >* listeners : *listeners_vec)
     {
-        listeners = (*listeners_vec)[i];
         std::list< ContentEventNotifier* >::iterator it = listeners->begin();
         while( it != listeners->end() )
         {
diff --git a/ucb/source/ucp/ftp/ftpcontentprovider.cxx b/ucb/source/ucp/ftp/ftpcontentprovider.cxx
index caa2a34..cb67852 100644
--- a/ucb/source/ucp/ftp/ftpcontentprovider.cxx
+++ b/ucb/source/ucp/ftp/ftpcontentprovider.cxx
@@ -244,13 +244,13 @@ bool FTPContentProvider::forHost( const OUString& host,
                                   OUString& account)
 {
     osl::MutexGuard aGuard(m_aMutex);
-    for(size_t i = 0; i < m_ServerInfo.size(); ++i)
-        if(host == m_ServerInfo[i].host &&
-           port == m_ServerInfo[i].port &&
-           username == m_ServerInfo[i].username )
+    for(ServerInfo & i : m_ServerInfo)
+        if(host == i.host &&
+           port == i.port &&
+           username == i.username )
         {
-            password = m_ServerInfo[i].password;
-            account = m_ServerInfo[i].account;
+            password = i.password;
+            account = i.account;
             return true;
         }
 
@@ -272,14 +272,14 @@ bool  FTPContentProvider::setHost( const OUString& host,
 
     bool present(false);
     osl::MutexGuard aGuard(m_aMutex);
-    for(size_t i = 0; i < m_ServerInfo.size(); ++i)
-        if(host == m_ServerInfo[i].host &&
-           port == m_ServerInfo[i].port &&
-           username == m_ServerInfo[i].username)
+    for(ServerInfo & i : m_ServerInfo)
+        if(host == i.host &&
+           port == i.port &&
+           username == i.username)
         {
             present = true;
-            m_ServerInfo[i].password = password;
-            m_ServerInfo[i].account = account;
+            i.password = password;
+            i.account = account;
         }
 
     if(!present)
diff --git a/ucb/source/ucp/ftp/ftpresultsetI.cxx b/ucb/source/ucp/ftp/ftpresultsetI.cxx
index 7c2b5c0..862fb91 100644
--- a/ucb/source/ucp/ftp/ftpresultsetI.cxx
+++ b/ucb/source/ucp/ftp/ftpresultsetI.cxx
@@ -44,8 +44,8 @@ ResultSetI::ResultSetI(const Reference<XComponentContext>&  rxContext,
                        const std::vector<FTPDirentry>&  dirvec)
     : ResultSetBase(rxContext,xProvider,seqProp)
 {
-    for( size_t i = 0; i < dirvec.size(); ++i)
-        m_aPath.push_back(dirvec[i].m_aURL);
+    for(const auto & i : dirvec)
+        m_aPath.push_back(i.m_aURL);
 
     // m_aIdents holds the content identifiers
 
diff --git a/ucb/source/ucp/ftp/ftpurl.cxx b/ucb/source/ucp/ftp/ftpurl.cxx
index cab116c..9f2ffce 100644
--- a/ucb/source/ucp/ftp/ftpurl.cxx
+++ b/ucb/source/ucp/ftp/ftpurl.cxx
@@ -612,9 +612,9 @@ FTPDirentry FTPURL::direntry() const
 
         std::vector<FTPDirentry> aList = aURL.list(OpenMode::ALL);
 
-        for(size_t i = 0; i < aList.size(); ++i) {
-            if(aList[i].m_aName == nettitle) { // the relevant file is found
-                aDirentry = aList[i];
+        for(FTPDirentry & d : aList) {
+            if(d.m_aName == nettitle) { // the relevant file is found
+                aDirentry = d;
                 break;
             }
         }
@@ -774,12 +774,14 @@ void FTPURL::del() const
 
     if(aDirentry.m_nMode & INETCOREFTP_FILEMODE_ISDIR) {
         std::vector<FTPDirentry> vec = list(sal_Int16(OpenMode::ALL));
-        for( size_t i = 0; i < vec.size(); ++i )
+        for(const FTPDirentry & i : vec)
+        {
             try {
-                FTPURL url(vec[i].m_aURL,m_pFCP);
+                FTPURL url(i.m_aURL,m_pFCP);
                 url.del();
             } catch(const curl_exception&) {
             }
+        }
         dele = OString("RMD ") + dele;
     }
     else if(aDirentry.m_nMode != INETCOREFTP_FILEMODE_UNKNOWN)
diff --git a/ucb/source/ucp/webdav-neon/ContentProperties.cxx b/ucb/source/ucp/webdav-neon/ContentProperties.cxx
index 34a9a06..a3bf1ec 100644
--- a/ucb/source/ucp/webdav-neon/ContentProperties.cxx
+++ b/ucb/source/ucp/webdav-neon/ContentProperties.cxx
@@ -538,18 +538,15 @@ namespace
             OUString(  "Date"  )
         };
 
-        for ( sal_uInt32 n = 0;
-              n <  ( sizeof( aNonCachableProps )
-                     / sizeof( aNonCachableProps[ 0 ] ) );
-              ++n )
+        for (const auto & rNonCachableProp : aNonCachableProps)
         {
             if ( isCaseSensitive )
             {
-                if ( rName.equals( aNonCachableProps[ n ] ) )
+                if ( rName.equals( rNonCachableProp ) )
                     return false;
             }
             else
-                if ( rName.equalsIgnoreAsciiCase( aNonCachableProps[ n ] ) )
+                if ( rName.equalsIgnoreAsciiCase( rNonCachableProp ) )
                     return false;
         }
         return true;
diff --git a/ucb/source/ucp/webdav-neon/webdavdatasupplier.cxx b/ucb/source/ucp/webdav-neon/webdavdatasupplier.cxx
index ab883d5..7eef0b1 100644
--- a/ucb/source/ucp/webdav-neon/webdavdatasupplier.cxx
+++ b/ucb/source/ucp/webdav-neon/webdavdatasupplier.cxx
@@ -411,10 +411,8 @@ bool DataSupplier::getData()
                 aPath = NeonUri::unescape( aPath );
                 bool bFoundParent = false;
 
-                for ( size_t n = 0; n < resources.size(); ++n )
+                for (DAVResource & rRes : resources)
                 {
-                    const DAVResource & rRes = resources[ n ];
-
                     // Filter parent, which is contained somewhere(!) in
                     // the vector.
                     if ( !bFoundParent )
diff --git a/unotools/source/config/options.cxx b/unotools/source/config/options.cxx
index 28b64bb..e336775 100644
--- a/unotools/source/config/options.cxx
+++ b/unotools/source/config/options.cxx
@@ -68,8 +68,8 @@ void ConfigurationBroadcaster::NotifyListeners( sal_uInt32 nHint )
         nHint |= m_nBlockedHint;
         m_nBlockedHint = 0;
         if ( mpList ) {
-            for ( size_t n = 0; n < mpList->size(); n++ ) {
-                (*mpList)[ n ]->ConfigurationChanged( this, nHint );
+            for (ConfigurationListener* n : *mpList) {
+                n->ConfigurationChanged( this, nHint );
             }
         }
     }
diff --git a/unotools/source/i18n/localedatawrapper.cxx b/unotools/source/i18n/localedatawrapper.cxx
index 87a5140..7204f66 100644
--- a/unotools/source/i18n/localedatawrapper.cxx
+++ b/unotools/source/i18n/localedatawrapper.cxx
@@ -138,14 +138,14 @@ void LocaleDataWrapper::invalidateData()
     nCurrPositiveFormat = nCurrNegativeFormat = nCurrDigits = nCurrFormatInvalid;
     if ( bLocaleDataItemValid )
     {
-        for (sal_Int32 j=0; j<LocaleItem::COUNT; ++j)
-            aLocaleItem[j].clear();
+        for (OUString & j : aLocaleItem)
+            j.clear();
         bLocaleDataItemValid = false;
     }
     if ( bReservedWordValid )
     {
-        for ( sal_Int16 j=0; j<reservedWords::COUNT; ++j )
-            aReservedWord[j].clear();
+        for (OUString & j : aReservedWord)
+            j.clear();
         bReservedWordValid = false;
     }
     xDefaultCalendar.reset();
diff --git a/unotools/source/misc/fontdefs.cxx b/unotools/source/misc/fontdefs.cxx
index a08941a..bce62f5 100644
--- a/unotools/source/misc/fontdefs.cxx
+++ b/unotools/source/misc/fontdefs.cxx
@@ -341,10 +341,10 @@ OUString StripScriptFromName(const OUString& _aName)
     while (!bFinished)
     {
         bFinished = true;
-        for (size_t i = 0; i < SAL_N_ELEMENTS(suffixes); ++i)
+        for (const char* suffix : suffixes)
         {
-            size_t nLen = strlen(suffixes[i]);
-            if (aName.endsWithIgnoreAsciiCaseAsciiL(suffixes[i], nLen))
+            size_t nLen = strlen(suffix);
+            if (aName.endsWithIgnoreAsciiCaseAsciiL(suffix, nLen))
             {
                 bFinished = false;
                 aName = aName.copy(0, aName.getLength() - nLen);
diff --git a/uui/source/iahndl-authentication.cxx b/uui/source/iahndl-authentication.cxx
index e4d1d60..9855df9 100644
--- a/uui/source/iahndl-authentication.cxx
+++ b/uui/source/iahndl-authentication.cxx
@@ -449,10 +449,10 @@ executeMasterPasswordDialog(
                       1000);
 
     OUStringBuffer aBuffer;
-    for (int i = 0; i < RTL_DIGEST_LENGTH_MD5; ++i)
+    for (sal_uInt8 i : aKey)
     {
-        aBuffer.append(static_cast< sal_Unicode >('a' + (aKey[i] >> 4)));
-        aBuffer.append(static_cast< sal_Unicode >('a' + (aKey[i] & 15)));
+        aBuffer.append(static_cast< sal_Unicode >('a' + (i >> 4)));
+        aBuffer.append(static_cast< sal_Unicode >('a' + (i & 15)));
     }
     rInfo.SetPassword(aBuffer.makeStringAndClear());
 }


More information about the Libreoffice-commits mailing list