[Libreoffice-commits] core.git: 2 commits - lotuswordpro/source sc/source

Caolán McNamara caolanm at redhat.com
Sat Feb 10 16:39:40 UTC 2018


 lotuswordpro/source/filter/lwpdoc.cxx |    4 ++++
 sc/source/filter/inc/qpro.hxx         |    2 +-
 sc/source/filter/qpro/qpro.cxx        |   12 ++++--------
 3 files changed, 9 insertions(+), 9 deletions(-)

New commits:
commit f7676f9755ab187be4d695d2630c8a6795a4904a
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Feb 9 14:59:23 2018 +0000

    ofz: time-out
    
    Change-Id: I89a1166f78938d7e36435bfeecb4a4f3f2ba9ad2
    Reviewed-on: https://gerrit.libreoffice.org/49503
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/lotuswordpro/source/filter/lwpdoc.cxx b/lotuswordpro/source/filter/lwpdoc.cxx
index 7a0165191daf..9c91ea3bca50 100644
--- a/lotuswordpro/source/filter/lwpdoc.cxx
+++ b/lotuswordpro/source/filter/lwpdoc.cxx
@@ -290,12 +290,16 @@ void LwpDocument::RegisterStylesInPara()
     if (xContent.is())
     {
         rtl::Reference<LwpStory> xStory(dynamic_cast<LwpStory*>(xContent->GetChildHead().obj(VO_STORY).get()));
+        std::set<LwpStory*> aSeen;
         while (xStory.is())
         {
+            aSeen.insert(xStory.get());
             //Register the child para
             xStory->SetFoundry(m_pFoundry);
             xStory->DoRegisterStyle();
             xStory.set(dynamic_cast<LwpStory*>(xStory->GetNext().obj(VO_STORY).get()));
+            if (aSeen.find(xStory.get()) != aSeen.end())
+                throw std::runtime_error("loop in conversion");
         }
     }
 }
commit baf2bc036dfee6821478f67f551ec296b0fb4381
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Feb 9 15:35:29 2018 +0000

    use read_uInt8s_ToOUString
    
    Change-Id: I3575019373632f476737b00d8616d01867970ae6
    Reviewed-on: https://gerrit.libreoffice.org/49506
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

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: */


More information about the Libreoffice-commits mailing list