Kaydet (Commit) cbf8f811 authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:useuniqueptr in xmlhelp

Change-Id: I8a407e0492adf61e1d815cadd5da0a1623c2b23b
Reviewed-on: https://gerrit.libreoffice.org/60191
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 4aecbe99
......@@ -119,7 +119,7 @@ ResultSetForQuery::ResultSetForQuery( const uno::Reference< uno::XComponentConte
OUString idxDir;
bool bExtension = false;
int iDir = 0;
vector< vector<HitItem>* > aIndexFolderResultVectorVector;
vector< vector<HitItem> > aIndexFolderResultVectorVector;
bool bTemporary;
while( !(idxDir = aIndexFolderIt.nextIndexFolder( bExtension, bTemporary )).isEmpty() )
......@@ -236,8 +236,7 @@ ResultSetForQuery::ResultSetForQuery( const uno::Reference< uno::XComponentConte
sort( aIndexFolderResultVector.begin(), aIndexFolderResultVector.end() );
}
vector<HitItem>* pIndexFolderHitItemVector = new vector<HitItem>( aIndexFolderResultVector );
aIndexFolderResultVectorVector.push_back( pIndexFolderHitItemVector );
aIndexFolderResultVectorVector.push_back( std::move(aIndexFolderResultVector) );
aIndexFolderResultVector.clear();
}
catch (const Exception &e)
......@@ -254,7 +253,7 @@ ResultSetForQuery::ResultSetForQuery( const uno::Reference< uno::XComponentConte
int nVectorCount = aIndexFolderResultVectorVector.size();
vector<HitItem>::size_type* pCurrentVectorIndex = new vector<HitItem>::size_type[nVectorCount];
std::unique_ptr<std::vector<HitItem>::size_type[]> pCurrentVectorIndex(new vector<HitItem>::size_type[nVectorCount]);
for( int j = 0 ; j < nVectorCount ; ++j )
pCurrentVectorIndex[j] = 0;
......@@ -266,7 +265,7 @@ ResultSetForQuery::ResultSetForQuery( const uno::Reference< uno::XComponentConte
float fBestScore = 0.0;
for( int k = 0 ; k < nVectorCount ; ++k )
{
vector<HitItem>& rIndexFolderVector = *aIndexFolderResultVectorVector[k];
vector<HitItem>& rIndexFolderVector = aIndexFolderResultVectorVector[k];
if( pCurrentVectorIndex[k] < rIndexFolderVector.size() )
{
const HitItem& rItem = rIndexFolderVector[ pCurrentVectorIndex[k] ];
......@@ -282,7 +281,7 @@ ResultSetForQuery::ResultSetForQuery( const uno::Reference< uno::XComponentConte
if( iVectorWithBestScore == -1 ) // No item left at all
break;
vector<HitItem>& rIndexFolderVector = *aIndexFolderResultVectorVector[iVectorWithBestScore];
vector<HitItem>& rIndexFolderVector = aIndexFolderResultVectorVector[iVectorWithBestScore];
const HitItem& rItem = rIndexFolderVector[ pCurrentVectorIndex[iVectorWithBestScore] ];
pCurrentVectorIndex[iVectorWithBestScore]++;
......@@ -291,12 +290,8 @@ ResultSetForQuery::ResultSetForQuery( const uno::Reference< uno::XComponentConte
++nHitCount;
}
delete[] pCurrentVectorIndex;
for( int n = 0 ; n < nVectorCount ; ++n )
{
vector<HitItem>* pIndexFolderVector = aIndexFolderResultVectorVector[n];
delete pIndexFolderVector;
}
pCurrentVectorIndex.reset();
aIndexFolderResultVectorVector.clear();
sal_Int32 replIdx = OUString( "#HLP#" ).getLength();
OUString replWith = "vnd.sun.star.help://";
......
......@@ -338,7 +338,7 @@ void URLParameter::open( const Reference< XOutputStream >& xDataSink )
return;
// a standard document or else an active help text, plug in the new input stream
InputStreamTransformer* p = new InputStreamTransformer( this,m_pDatabases,isRoot() );
std::unique_ptr<InputStreamTransformer> p(new InputStreamTransformer( this,m_pDatabases,isRoot() ));
try
{
xDataSink->writeBytes( Sequence< sal_Int8 >( reinterpret_cast<const sal_Int8*>(p->getData().getStr()), p->getData().getLength() ) );
......@@ -346,7 +346,7 @@ void URLParameter::open( const Reference< XOutputStream >& xDataSink )
catch( const Exception& )
{
}
delete p;
p.reset();
xDataSink->closeOutput();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment