[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source

Kohei Yoshida kohei.yoshida at gmail.com
Thu May 2 17:37:12 PDT 2013


 sc/source/core/data/column.cxx  |    8 ++++----
 sc/source/core/data/column2.cxx |   14 +++++++-------
 sc/source/core/data/column3.cxx |    4 ++--
 3 files changed, 13 insertions(+), 13 deletions(-)

New commits:
commit 8877c7834df8dad05aa5698b2a493286a93a1b77
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Thu May 2 20:38:06 2013 -0400

    Switch script type storage from unsigned short to unsigned char.
    
    This will save quite a bit of storage. It requires the next version
    of mdds (probably will be 0.8.0).
    
    Change-Id: I11e972c043ad58e8b76e241d3312b5a1de952cf7

diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 2933e9f..be9e5d6 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -75,13 +75,13 @@ ScNeededSizeOptions::ScNeededSizeOptions() :
 
 void ScColumn::SwapScriptTypes( ScriptType& rSrc, SCROW nSrcRow, ScriptType& rDest, SCROW nDestRow )
 {
-    unsigned short nSrcVal = 0;
-    unsigned short nDestVal = 0;
+    unsigned char nSrcVal = 0;
+    unsigned char nDestVal = 0;
 
     if (!rSrc.is_empty(nSrcRow))
-        nSrcVal = rSrc.get<unsigned short>(nSrcRow);
+        nSrcVal = rSrc.get<unsigned char>(nSrcRow);
     if (!rDest.is_empty(nDestRow))
-        nDestVal = rDest.get<unsigned short>(nDestRow);
+        nDestVal = rDest.get<unsigned char>(nDestRow);
 
     if (nDestVal)
         rSrc.set(nSrcRow, nDestVal);
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index c93e043..bad84e9 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -1469,7 +1469,7 @@ void ScColumn::CopyScriptTypesToDocument(SCROW nRow1, SCROW nRow2, ScColumn& rDe
     nRowPos = static_cast<size_t>(nRow2); // End row position.
 
     // Keep copying until we hit the end row position.
-    mdds::mtv::ushort_element_block::const_iterator itData, itDataEnd;
+    mdds::mtv::uchar_element_block::const_iterator itData, itDataEnd;
     for (; itBlk != itBlkEnd; ++itBlk, nBlockStart = nBlockEnd, nOffsetInBlock = 0)
     {
         nBlockEnd = nBlockStart + itBlk->size;
@@ -1486,15 +1486,15 @@ void ScColumn::CopyScriptTypesToDocument(SCROW nRow1, SCROW nRow2, ScColumn& rDe
         }
 
         // Non-empty block.
-        itData = mdds::mtv::ushort_element_block::begin(*itBlk->data);
-        itDataEnd = mdds::mtv::ushort_element_block::end(*itBlk->data);
+        itData = mdds::mtv::uchar_element_block::begin(*itBlk->data);
+        itDataEnd = mdds::mtv::uchar_element_block::end(*itBlk->data);
         std::advance(itData, nOffsetInBlock);
 
         if (nBlockStart <= nRowPos && nRowPos <= nBlockEnd)
         {
             // This block contains the end row. Only copy partially.
             size_t nOffset = nRowPos - nBlockStart + 1;
-            itDataEnd = mdds::mtv::ushort_element_block::begin(*itBlk->data);
+            itDataEnd = mdds::mtv::uchar_element_block::begin(*itBlk->data);
             std::advance(itDataEnd, nOffset);
 
             rDestCol.maScriptTypes.set(nBlockStart + nOffsetInBlock, itData, itDataEnd);
@@ -1545,7 +1545,7 @@ void ScColumn::SetCell(SCROW nRow, ScBaseCell* pNewCell)
         }
 
         maTextWidths.set<unsigned short>(nRow, TEXTWIDTH_DIRTY);
-        maScriptTypes.set<unsigned short>(nRow, SC_SCRIPTTYPE_UNKNOWN);
+        maScriptTypes.set<unsigned char>(nRow, SC_SCRIPTTYPE_UNKNOWN);
         CellStorageModified();
     }
 }
@@ -1565,7 +1565,7 @@ sal_uInt8 ScColumn::GetScriptType( SCROW nRow ) const
     if (!ValidRow(nRow) || maScriptTypes.is_empty(nRow))
         return 0;
 
-    return maScriptTypes.get<unsigned short>(nRow);
+    return maScriptTypes.get<unsigned char>(nRow);
 }
 
 void ScColumn::SetScriptType( SCROW nRow, sal_uInt8 nType )
@@ -1576,7 +1576,7 @@ void ScColumn::SetScriptType( SCROW nRow, sal_uInt8 nType )
     if (!nType)
         maScriptTypes.set_empty(nRow, nRow);
     else
-        maScriptTypes.set<unsigned short>(nRow, nType);
+        maScriptTypes.set<unsigned char>(nRow, nType);
 }
 
 size_t ScColumn::GetFormulaHash( SCROW nRow ) const
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 63b3a5f..2334330 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -104,7 +104,7 @@ void ScColumn::Append( SCROW nRow, ScBaseCell* pCell )
     maItems.back().nRow  = nRow;
 
     maTextWidths.set<unsigned short>(nRow, TEXTWIDTH_DIRTY);
-    maScriptTypes.set<unsigned short>(nRow, SC_SCRIPTTYPE_UNKNOWN);
+    maScriptTypes.set<unsigned char>(nRow, SC_SCRIPTTYPE_UNKNOWN);
     CellStorageModified();
 }
 
@@ -1415,7 +1415,7 @@ bool ScColumn::SetString( SCROW nRow, SCTAB nTabP, const String& rString,
                 pOldCell->Delete();
                 maItems[i].pCell = pNewCell; // Replace
                 maTextWidths.set<unsigned short>(nRow, TEXTWIDTH_DIRTY);
-                maScriptTypes.set<unsigned short>(nRow, SC_SCRIPTTYPE_UNKNOWN);
+                maScriptTypes.set<unsigned char>(nRow, SC_SCRIPTTYPE_UNKNOWN);
                 CellStorageModified();
 
                 if ( pNewCell->GetCellType() == CELLTYPE_FORMULA )


More information about the Libreoffice-commits mailing list