[Libreoffice-commits] core.git: Branch 'aoo/trunk' - sc/inc sc/source

Armin Le Grand alg at apache.org
Fri Jan 17 16:08:00 PST 2014


 sc/inc/document.hxx                    |    2 +-
 sc/inc/refdata.hxx                     |   12 ++++++++++++
 sc/source/core/tool/reftokenhelper.cxx |   12 ++++++++++++
 sc/source/filter/excel/excform8.cxx    |    8 ++++++++
 4 files changed, 33 insertions(+), 1 deletion(-)

New commits:
commit 5cc9cb9c52617bab6eb6d84331dde8f3d580ee31
Author: Armin Le Grand <alg at apache.org>
Date:   Fri Jan 17 22:32:30 2014 +0000

    i123870 corrected import values on xml import with chart, avoid uninitialized values

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 88980a2..3338e25 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -465,7 +465,7 @@ public:
 public:
     SC_DLLPUBLIC                ScDocument( ScDocumentMode eMode = SCDOCMODE_DOCUMENT,
                                 SfxObjectShell* pDocShell = NULL );
-    SC_DLLPUBLIC                ~ScDocument();
+    SC_DLLPUBLIC                virtual ~ScDocument();
 
     inline ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
                     GetServiceManager() const { return xServiceManager; }
diff --git a/sc/inc/refdata.hxx b/sc/inc/refdata.hxx
index d729d22..9550b82 100644
--- a/sc/inc/refdata.hxx
+++ b/sc/inc/refdata.hxx
@@ -76,6 +76,10 @@ struct SC_DLLPUBLIC ScSingleRefData        // Single reference (one address) int
 
     // No default ctor, because used in ScRawToken union, set InitFlags!
     inline  void InitFlags() { bFlags = 0; }    // all FALSE
+
+    // #123870# Make it possible to init members to some defined values
+    inline void InitMembers() { nCol = nRow = nTab = nRelCol = nRelRow = nRelTab = 0; }
+
     // InitAddress: InitFlags and set address
     inline  void InitAddress( const ScAddress& rAdr );
     inline  void InitAddress( SCCOL nCol, SCROW nRow, SCTAB nTab );
@@ -157,6 +161,14 @@ struct ScComplexRefData         // Complex reference (a range) into the sheet
 
     inline  void InitFlags()
         { Ref1.InitFlags(); Ref2.InitFlags(); }
+
+    // #123870# Make it possible to init members to some defined values
+    inline void InitMembers()
+    {
+        Ref1.InitMembers();
+        Ref2.InitMembers();
+    }
+
     inline  void InitRange( const ScRange& rRange )
         {
             Ref1.InitAddress( rRange.aStart );
diff --git a/sc/source/core/tool/reftokenhelper.cxx b/sc/source/core/tool/reftokenhelper.cxx
index f15f5a0..7f6fde5 100644
--- a/sc/source/core/tool/reftokenhelper.cxx
+++ b/sc/source/core/tool/reftokenhelper.cxx
@@ -146,6 +146,12 @@ bool ScRefTokenHelper::getRangeFromToken(ScRange& rRange, const ScSharedTokenRef
                 return false;
 
             const ScSingleRefData& rRefData = pToken->GetSingleRef();
+
+            if(!rRefData.Valid())
+            {
+                OSL_ENSURE(false, "RefData out of range, correct before usage (!)");
+            }
+
             rRange.aStart.SetCol(rRefData.nCol);
             rRange.aStart.SetRow(rRefData.nRow);
             rRange.aStart.SetTab(rRefData.nTab);
@@ -160,6 +166,12 @@ bool ScRefTokenHelper::getRangeFromToken(ScRange& rRange, const ScSharedTokenRef
                 return false;
 
             const ScComplexRefData& rRefData = pToken->GetDoubleRef();
+
+            if(!rRefData.Valid())
+            {
+                OSL_ENSURE(false, "RefData out of range, correct before usage (!)");
+            }
+
             rRange.aStart.SetCol(rRefData.Ref1.nCol);
             rRange.aStart.SetRow(rRefData.Ref1.nRow);
             rRange.aStart.SetTab(rRefData.Ref1.nTab);
diff --git a/sc/source/filter/excel/excform8.cxx b/sc/source/filter/excel/excform8.cxx
index 84955b4..a940d01 100644
--- a/sc/source/filter/excel/excform8.cxx
+++ b/sc/source/filter/excel/excform8.cxx
@@ -124,6 +124,10 @@ ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, XclImpStream& aIn,
 
     sal_Size nEndPos = aIn.GetRecPos() + nFormulaLen;
 
+    // #123870# Init members, they are on random values and not all will beinitialized in all cases below
+    aSRD.InitMembers();
+    aCRD.InitMembers();
+
     while( (aIn.GetRecPos() < nEndPos) && !bError )
     {
         aIn >> nOp;
@@ -1244,6 +1248,10 @@ ConvErr ExcelToSc8::ConvertExternName( const ScTokenArray*& rpArray, XclImpStrea
 
     sal_Size nEndPos = rStrm.GetRecPos() + nFormulaLen;
 
+    // #123870# Init members, they are on random values and not all will beinitialized in all cases below
+    aSRD.InitMembers();
+    aCRD.InitMembers();
+
     while( (rStrm.GetRecPos() < nEndPos) && !bError )
     {
         rStrm >> nOp;


More information about the Libreoffice-commits mailing list