diff options
Diffstat (limited to 'xmlhelp/source/cxxhelp/provider/db.cxx')
-rw-r--r-- | xmlhelp/source/cxxhelp/provider/db.cxx | 68 |
1 files changed, 34 insertions, 34 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() |