diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-02-09 15:35:29 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-02-10 17:39:19 +0100 |
commit | baf2bc036dfee6821478f67f551ec296b0fb4381 (patch) | |
tree | 7c7eaeeaec5b16ee00932fbc17022d43baad0233 /sc | |
parent | dcfa2cb4e8f2ce94c5c723efe49961c3b8004c93 (diff) |
use read_uInt8s_ToOUString
Change-Id: I3575019373632f476737b00d8616d01867970ae6
Reviewed-on: https://gerrit.libreoffice.org/49506
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/filter/inc/qpro.hxx | 2 | ||||
-rw-r--r-- | sc/source/filter/qpro/qpro.cxx | 12 |
2 files changed, 5 insertions, 9 deletions
diff --git a/sc/source/filter/inc/qpro.hxx b/sc/source/filter/inc/qpro.hxx index bc74b9ad81d0..5410b8145d64 100644 --- a/sc/source/filter/inc/qpro.hxx +++ b/sc/source/filter/inc/qpro.hxx @@ -48,7 +48,7 @@ public: bool nextRecord(); sal_uInt16 getId() { return mnId; } sal_uInt16 getLength() { return mnLength; } - void readString( OUString &rString, sal_uInt16 nLength ); + OUString readString(sal_uInt16 nLength); ErrCode import( ScDocument *pDoc ); ErrCode readSheet( SCTAB nTab, ScDocument* pDoc, ScQProStyle *pStyle ); diff --git a/sc/source/filter/qpro/qpro.cxx b/sc/source/filter/qpro/qpro.cxx index 3d663a515000..676c297900d6 100644 --- a/sc/source/filter/qpro/qpro.cxx +++ b/sc/source/filter/qpro/qpro.cxx @@ -49,12 +49,11 @@ ErrCode ScQProReader::readSheet( SCTAB nTab, ScDocument* pDoc, ScQProStyle *pSty switch( getId() ) { case 0x000f:{ // Label cell - OUString aLabel; mpStream->ReadUChar( nCol ).ReadUChar( nDummy ).ReadUInt16( nRow ).ReadUInt16( nStyle ).ReadUChar( nDummy ); sal_uInt16 nLen = getLength(); if (nLen >= 7) { - readString( aLabel, nLen - 7 ); + OUString aLabel(readString(nLen - 7)); nStyle = nStyle >> 3; pStyle->SetFormat( pDoc, nCol, nRow, nTab, nStyle ); pDoc->EnsureTable(nTab); @@ -215,7 +214,7 @@ ErrCode ScQProReader::import( ScDocument *pDoc ) pStyleElement->setFontRecord( j, nFontAttr, nPtSize ); sal_uInt16 nLen = getLength(); if (nLen >= 4) - readString( aLabel, nLen - 4 ); + aLabel = readString(nLen - 4); else eRet = SCERR_IMPORT_FORMAT; pStyleElement->setFontType( j, aLabel ); @@ -275,12 +274,9 @@ bool ScQProReader::nextRecord() return true; } -void ScQProReader::readString( OUString &rString, sal_uInt16 nLength ) +OUString ScQProReader::readString(sal_uInt16 nLength) { - std::unique_ptr<sal_Char[]> pText(new sal_Char[ nLength + 1 ]); - nLength = mpStream->ReadBytes(pText.get(), nLength); - pText[ nLength ] = 0; - rString = OUString( pText.get(), strlen(pText.get()), mpStream->GetStreamCharSet() ); + return read_uInt8s_ToOUString(*mpStream, nLength, mpStream->GetStreamCharSet()); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |