diff --git a/xmlhelp/source/cxxhelp/db/BtreeDict.cxx b/xmlhelp/source/cxxhelp/db/BtreeDict.cxx index 06a970f77f18..e99a0cb72a2c 100644 --- a/xmlhelp/source/cxxhelp/db/BtreeDict.cxx +++ b/xmlhelp/source/cxxhelp/db/BtreeDict.cxx @@ -2,9 +2,9 @@ * * $RCSfile: BtreeDict.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: abi $ $Date: 2001-07-05 18:50:40 $ + * last change: $Author: abi $ $Date: 2001-07-06 11:04:05 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -357,7 +357,8 @@ void BlockProcessorImpl::process( Block* block ) const BtreeDict::BtreeDict( const util::IndexAccessor& indexAccessor ) throw( IOException ) - : blocks_( 0 ), + : blocksL_( 0 ), + blocks_( 0 ), blockManager_( new DBEnvImpl( indexAccessor ) ) // may throw IOExcption { @@ -379,7 +380,7 @@ BtreeDict::BtreeDict( const util::IndexAccessor& indexAccessor ) throw( IOExcept idx = 4 + aStr.lastIndexOf( "id1=" ); sal_Int32 count = atoi( bff + idx ); - blocks_ = new sal_Int32[ count ]; + blocks_ = new sal_Int32[ blocksL_ = count ]; delete[] bff; BlockProcessorImpl blProc( this ); @@ -456,6 +457,9 @@ sal_Int32 BtreeDict::fetch( const rtl::OUString& key ) const throw( excep::XmlSe rtl::OUString BtreeDict::fetch( sal_Int32 conceptID ) const throw( excep::XmlSearchException ) { + if( blocksL_ <= conceptID ) + throw excep::XmlSearchException( rtl::OUString() ); + return findID( blocks_[conceptID], conceptID ); } diff --git a/xmlhelp/source/cxxhelp/qe/Query.cxx b/xmlhelp/source/cxxhelp/qe/Query.cxx index fc043ea18b35..7ffb564b00aa 100644 --- a/xmlhelp/source/cxxhelp/qe/Query.cxx +++ b/xmlhelp/source/cxxhelp/qe/Query.cxx @@ -2,9 +2,9 @@ * * $RCSfile: Query.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: abi $ $Date: 2001-07-05 18:50:40 $ + * last change: $Author: abi $ $Date: 2001-07-06 11:04:07 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -78,6 +78,13 @@ using namespace xmlsearch::qe; +sal_Int32* QueryHit::getMatches( sal_Int32& matchesL ) +{ + matchesL = matchesL_; + return matches_; +} + + /******************************************************************************/ /* */ /* HitStore */ diff --git a/xmlhelp/source/cxxhelp/qe/XmlIndex.cxx b/xmlhelp/source/cxxhelp/qe/XmlIndex.cxx index 74b4a70a81f5..2a0d2dd8a2cf 100644 --- a/xmlhelp/source/cxxhelp/qe/XmlIndex.cxx +++ b/xmlhelp/source/cxxhelp/qe/XmlIndex.cxx @@ -2,9 +2,9 @@ * * $RCSfile: XmlIndex.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: abi $ $Date: 2001-07-06 10:03:26 $ + * last change: $Author: abi $ $Date: 2001-07-06 11:04:07 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -427,9 +427,20 @@ QueryHitData* XmlIndex::hitToData( QueryHit* hit ) for( sal_Int32 i = 0; i < termsL; ++i ) { sal_Int32 aInt = ( i << 1 ); - if( matches[ aInt ] > 0 ) - terms[i] = fetch( matches[ aInt ] ); + if( 0 <= aInt && aInt < matchesL ) + { + sal_Int32 match = matches[ aInt ]; + if( match > 0 ) + try + { + terms[i] = fetch( match ); + } + catch( const excep::XmlSearchException& e ) + { + } + } } + sal_Int32 document = hit->getDocument(); QueryHitData *res = new QueryHitData( hit->getPenalty(), documentName( document ),