[Libreoffice-commits] core.git: 4 commits - sc/qa sc/source vcl/opengl vcl/workben

Caolán McNamara caolanm at redhat.com
Wed Sep 30 11:37:56 PDT 2015


 sc/qa/unit/data/xls/pass/crash-1.xls |binary
 sc/source/core/data/globalx.cxx      |    4 ++++
 sc/source/core/tool/optutil.cxx      |    4 ++++
 sc/source/filter/excel/excel.cxx     |   13 ++++++++++++-
 sc/source/filter/excel/xicontent.cxx |   11 ++++++++---
 vcl/opengl/win/blocklist_parser.cxx  |    7 ++++---
 vcl/workben/fftester.cxx             |   14 ++++++++++++++
 7 files changed, 46 insertions(+), 7 deletions(-)

New commits:
commit 358ca9eaa3d85236047a7a2781e38f57209c2858
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Sep 30 17:01:23 2015 +0100

    don't believe xls wrt size to reserve
    
    Change-Id: Id9864f199e270d13d801348b12f1e94dd80558c7

diff --git a/sc/qa/unit/data/xls/pass/crash-1.xls b/sc/qa/unit/data/xls/pass/crash-1.xls
new file mode 100644
index 0000000..724bfc1
Binary files /dev/null and b/sc/qa/unit/data/xls/pass/crash-1.xls differ
diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx
index d821a8a..6b0f688 100644
--- a/sc/source/filter/excel/xicontent.cxx
+++ b/sc/source/filter/excel/xicontent.cxx
@@ -75,10 +75,15 @@ XclImpSst::XclImpSst( const XclImpRoot& rRoot ) :
 void XclImpSst::ReadSst( XclImpStream& rStrm )
 {
     rStrm.Ignore( 4 );
-    sal_uInt32 nStrCount(0);
-    nStrCount = rStrm.ReaduInt32();
+    sal_uInt32 nStrCount = rStrm.ReaduInt32();
+    auto nBytesAvailable = rStrm.GetRecLeft();
+    if (nStrCount > nBytesAvailable)
+    {
+        SAL_WARN("sc.filter", "xls claimed to have " << nStrCount << " strings, but only " << nBytesAvailable << " bytes available, truncating");
+        nStrCount = nBytesAvailable;
+    }
     maStrings.clear();
-    maStrings.reserve( static_cast< size_t >( nStrCount ) );
+    maStrings.reserve(nStrCount);
     while( (nStrCount > 0) && rStrm.IsValid() )
     {
         XclImpString aString;
commit ac9e7af60bd4e898f921173260bd0e9ebfd0ea34
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Sep 30 16:46:10 2015 +0100

    add xls support to fftester
    
    Change-Id: I23e219cec1a8d98e02c3584041f67ff42dd29bd8

diff --git a/sc/source/core/data/globalx.cxx b/sc/source/core/data/globalx.cxx
index 5430bb8..2b3794a 100644
--- a/sc/source/core/data/globalx.cxx
+++ b/sc/source/core/data/globalx.cxx
@@ -35,6 +35,7 @@
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <comphelper/processfactory.hxx>
 #include <comphelper/string.hxx>
+#include <unotools/configmgr.hxx>
 #include <unotools/localedatawrapper.hxx>
 
 using namespace ::com::sun::star;
@@ -43,6 +44,9 @@ using namespace ::com::sun::star::ucb;
 
 void ScGlobal::InitAddIns()
 {
+    if (utl::ConfigManager::IsAvoidConfig())
+        return;
+
     // multi paths separated by semicolons
     SvtPathOptions aPathOpt;
     OUString aMultiPath = aPathOpt.GetAddinPath();
diff --git a/sc/source/core/tool/optutil.cxx b/sc/source/core/tool/optutil.cxx
index 6bbc0dc..e78fabd 100644
--- a/sc/source/core/tool/optutil.cxx
+++ b/sc/source/core/tool/optutil.cxx
@@ -21,10 +21,14 @@
 
 #include "optutil.hxx"
 #include "global.hxx"
+#include <unotools/configmgr.hxx>
 #include <unotools/syslocale.hxx>
 
 bool ScOptionsUtil::IsMetricSystem()
 {
+    if (utl::ConfigManager::IsAvoidConfig())
+        return true;
+
     //TODO: which language should be used here - system language or installed office language?
 
     MeasurementSystem eSys = ScGlobal::pLocaleData->getMeasurementSystemEnum();
diff --git a/sc/source/filter/excel/excel.cxx b/sc/source/filter/excel/excel.cxx
index 10c22a9..b21ca5f 100644
--- a/sc/source/filter/excel/excel.cxx
+++ b/sc/source/filter/excel/excel.cxx
@@ -40,6 +40,7 @@
 #include "imp_op.hxx"
 #include "excimp8.hxx"
 #include "exp_op.hxx"
+#include "scdll.hxx"
 
 #include <memory>
 
@@ -217,4 +218,14 @@ FltError ScFormatFilterPluginImpl::ScExportExcel5( SfxMedium& rMedium, ScDocumen
     return eRet;
 }
 
+extern "C" SAL_DLLPUBLIC_EXPORT bool SAL_CALL TestImportXLS(const OUString &rURL)
+{
+    ScDLL::Init();
+    SfxMedium aMedium(rURL, StreamMode::READ);
+    ScDocument aDocument;
+    aDocument.MakeTable(0);
+    FltError eError = ScFormatFilter::Get().ScImportExcel(aMedium, &aDocument, EIF_AUTO);
+    return eError == eERR_OK;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/workben/fftester.cxx b/vcl/workben/fftester.cxx
index 41f5f88..f0bbb74 100644
--- a/vcl/workben/fftester.cxx
+++ b/vcl/workben/fftester.cxx
@@ -335,6 +335,20 @@ try_again:
                 else
                     ret = (int) (*pfnImport)(out, OUString("CWW8"));
             }
+            else if (strcmp(argv[2], "xls") == 0)
+            {
+                static HFilterCall pfnImport(0);
+                if (!pfnImport)
+                {
+                    osl::Module aLibrary;
+                    aLibrary.loadRelative(&thisModule, "libscfiltlo.so", SAL_LOADMODULE_LAZY);
+                    pfnImport = reinterpret_cast<HFilterCall>(
+                        aLibrary.getFunctionSymbol("TestImportXLS"));
+                    aLibrary.release();
+                }
+                ret = (int) (*pfnImport)(out);
+            }
+
             else if (strcmp(argv[2], "hwp") == 0)
             {
                 static HFilterCall pfnImport(0);
commit 9e481f6036775044bb02a5e08f6d3af3a37acc56
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Sep 30 15:27:00 2015 +0100

    cppcheck: uninitMemberVar
    
    Change-Id: I8409a6f00803e357a20b53fd59d77f155e057753

diff --git a/vcl/opengl/win/blocklist_parser.cxx b/vcl/opengl/win/blocklist_parser.cxx
index ef4771a..b132265 100644
--- a/vcl/opengl/win/blocklist_parser.cxx
+++ b/vcl/opengl/win/blocklist_parser.cxx
@@ -10,9 +10,10 @@
 #include "blocklist_parser.hxx"
 
 WinBlocklistParser::WinBlocklistParser(const OUString& rURL,
-        std::vector<wgl::DriverInfo>& rDriverList):
-    maURL(rURL),
-    mrDriverList(rDriverList)
+        std::vector<wgl::DriverInfo>& rDriverList)
+    : maURL(rURL)
+    , mrDriverList(rDriverList)
+    , meBlockType(BlockType::UNKNOWN)
 {
 }
 
commit 80c4130367d0bbd527b8cec1bd10e4e72c453647
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Sep 30 15:05:03 2015 +0100

    titchy typo ScImportExcel->ScExportExcel
    
    Change-Id: I05624acbdf4695ef652e619662996ac41afed410

diff --git a/sc/source/filter/excel/excel.cxx b/sc/source/filter/excel/excel.cxx
index d193bb5..10c22a9 100644
--- a/sc/source/filter/excel/excel.cxx
+++ b/sc/source/filter/excel/excel.cxx
@@ -202,7 +202,7 @@ FltError ScFormatFilterPluginImpl::ScExportExcel5( SfxMedium& rMedium, ScDocumen
         return eERR_NI;
 
     // check the passed Calc document
-    OSL_ENSURE( pDocument, "::ScImportExcel - no document" );
+    OSL_ENSURE( pDocument, "::ScExportExcel5 - no document" );
     if( !pDocument ) return eERR_INTERN;        // should not happen
 
     // check the output stream from medium


More information about the Libreoffice-commits mailing list