diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-08-10 20:47:32 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-08-11 11:20:43 +0200 |
commit | 2d582244680e7f6dec6e4a466e276f93ccb01dc9 (patch) | |
tree | b0e880ddfb3ce1ea2f47151b648e7fbb55132f08 /xmlhelp | |
parent | 74012c48d99634a7556a86f77e9522024f2afdb2 (diff) |
loplugin:flatten
Change-Id: I6560756eb63856a22b43e3e65a7b7843cd2d5376
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100447
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmlhelp')
-rw-r--r-- | xmlhelp/source/cxxhelp/provider/db.cxx | 68 | ||||
-rw-r--r-- | xmlhelp/source/cxxhelp/provider/urlparameter.cxx | 24 |
2 files changed, 46 insertions, 46 deletions
diff --git a/xmlhelp/source/cxxhelp/provider/db.cxx b/xmlhelp/source/cxxhelp/provider/db.cxx index f8a38ecd8199..1e376e83e32d 100644 --- a/xmlhelp/source/cxxhelp/provider/db.cxx +++ b/xmlhelp/source/cxxhelp/provider/db.cxx @@ -77,47 +77,47 @@ void Hdf::createHashMap( bool bOptimizeForPerformance ) } Reference< XInputStream > xIn = m_xSFA->openFileRead( m_aFileURL ); - if( xIn.is() ) - { - Sequence< sal_Int8 > aData; - sal_Int32 nSize = m_xSFA->getSize( m_aFileURL ); - sal_Int32 nRead = xIn->readBytes( aData, nSize ); + if( !xIn.is() ) + return; - const char* pData = reinterpret_cast<const char*>(aData.getConstArray()); - int iPos = 0; - while( iPos < nRead ) - { - HDFData aDBKey; - if( !implReadLenAndData( pData, iPos, aDBKey ) ) - break; + Sequence< sal_Int8 > aData; + sal_Int32 nSize = m_xSFA->getSize( m_aFileURL ); + sal_Int32 nRead = xIn->readBytes( aData, nSize ); - OString aOKeyStr = aDBKey.getData(); + const char* pData = reinterpret_cast<const char*>(aData.getConstArray()); + int iPos = 0; + while( iPos < nRead ) + { + HDFData aDBKey; + if( !implReadLenAndData( pData, iPos, aDBKey ) ) + break; - // Read val len - const char* pStartPtr = pData + iPos; - char* pEndPtr; - sal_Int32 nValLen = strtol( pStartPtr, &pEndPtr, 16 ); - if( pEndPtr == pStartPtr ) - break; + OString aOKeyStr = aDBKey.getData(); - iPos += (pEndPtr - pStartPtr) + 1; + // Read val len + const char* pStartPtr = pData + iPos; + char* pEndPtr; + sal_Int32 nValLen = strtol( pStartPtr, &pEndPtr, 16 ); + if( pEndPtr == pStartPtr ) + break; - if( bOptimizeForPerformance ) - { - const char* pValSrc = pData + iPos; - OString aValStr( pValSrc, nValLen ); - (*m_pStringToDataMap)[aOKeyStr] = aValStr; - } - else - { - // store value start position - (*m_pStringToValPosMap)[aOKeyStr] = std::pair<int,int>( iPos, nValLen ); - } - iPos += nValLen + 1; - } + iPos += (pEndPtr - pStartPtr) + 1; - xIn->closeInput(); + if( bOptimizeForPerformance ) + { + const char* pValSrc = pData + iPos; + OString aValStr( pValSrc, nValLen ); + (*m_pStringToDataMap)[aOKeyStr] = aValStr; + } + else + { + // store value start position + (*m_pStringToValPosMap)[aOKeyStr] = std::pair<int,int>( iPos, nValLen ); + } + iPos += nValLen + 1; } + + xIn->closeInput(); } void Hdf::releaseHashMap() diff --git a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx index 2ec811373c76..b43411df75ac 100644 --- a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx +++ b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx @@ -260,20 +260,20 @@ void URLParameter::readHelpDataFile() } } - if( bSuccess ) + if( !bSuccess ) + return; + + DbtToStringConverter converter( pData ); + m_aTitle = converter.getTitle(); + m_pDatabases->replaceName( m_aTitle ); + m_aPath = converter.getFile(); + m_aJar = converter.getDatabase(); + if( !aExtensionPath.isEmpty() ) { - DbtToStringConverter converter( pData ); - m_aTitle = converter.getTitle(); - m_pDatabases->replaceName( m_aTitle ); - m_aPath = converter.getFile(); - m_aJar = converter.getDatabase(); - if( !aExtensionPath.isEmpty() ) - { - m_aJar = "?" + aExtensionPath + "?" + m_aJar; - m_aExtensionRegistryPath = aExtensionRegistryPath; - } - m_aTag = converter.getHash(); + m_aJar = "?" + aExtensionPath + "?" + m_aJar; + m_aExtensionRegistryPath = aExtensionRegistryPath; } + m_aTag = converter.getHash(); } |