summaryrefslogtreecommitdiff
path: root/xmlhelp/source/cxxhelp/provider/databases.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-06-01 11:32:56 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-06-01 12:56:05 +0200
commit88ff39aee58cf0c098a2cce311cf62efbd76bb6d (patch)
tree21208ba2d8c4749d5ded424ac1946e43667c4d46 /xmlhelp/source/cxxhelp/provider/databases.cxx
parent73661c6f0f78964633a74f487d6bb7c0922d00dc (diff)
use OStringBuffer instead of manual buffer management
Change-Id: Iba155637cbbdfc5d6b3a427372695d4d03319621 Reviewed-on: https://gerrit.libreoffice.org/38297 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmlhelp/source/cxxhelp/provider/databases.cxx')
-rw-r--r--xmlhelp/source/cxxhelp/provider/databases.cxx19
1 files changed, 4 insertions, 15 deletions
diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx b/xmlhelp/source/cxxhelp/provider/databases.cxx
index 6f8ed43c5205..cbabe0890bed 100644
--- a/xmlhelp/source/cxxhelp/provider/databases.cxx
+++ b/xmlhelp/source/cxxhelp/provider/databases.cxx
@@ -952,8 +952,7 @@ void Databases::changeCSS(const OUString& newStyleSheet)
}
void Databases::cascadingStylesheet( const OUString& Language,
- std::unique_ptr<char[]>& buffer,
- int* byteCount )
+ OStringBuffer& buffer )
{
if( ! m_pCustomCSSDoc )
{
@@ -1056,18 +1055,13 @@ void Databases::cascadingStylesheet( const OUString& Language,
}
}
- *byteCount = m_nCustomCSSDocLength;
- buffer.reset( new char[ 1 + *byteCount ] );
- buffer[*byteCount] = 0;
- memcpy( buffer.get(), m_pCustomCSSDoc, m_nCustomCSSDocLength );
-
+ buffer.append( m_pCustomCSSDoc, m_nCustomCSSDocLength );
}
void Databases::setActiveText( const OUString& Module,
const OUString& Language,
const OUString& Id,
- std::unique_ptr<char[]>& buffer,
- int* byteCount )
+ OStringBuffer& buffer )
{
DataBaseIterator aDbIt( m_xContext, *this, Module, Language, true );
@@ -1110,15 +1104,10 @@ void Databases::setActiveText( const OUString& Module,
break;
}
- *byteCount = nSize;
- buffer.reset( new char[ 1 + nSize ] );
- buffer[nSize] = 0;
- memcpy( buffer.get(), pData, nSize );
+ buffer.append( pData, nSize );
}
else
{
- *byteCount = 0;
- buffer.reset( new char[1] ); // Initialize with 1 to avoid compiler warnings
if( !bFoundAsEmpty )
m_aEmptyActiveTextSet.insert( id );
}