Kaydet (Commit) 79fe112c authored tarafından Noel Grandin's avatar Noel Grandin Kaydeden (comit) Noel Grandin

Simplify ScCompressedArray constructor

nobody is setting a custom delta

Change-Id: I5dd9ac691fb226697eb8cb2b6b0b673552a4f049
Reviewed-on: https://gerrit.libreoffice.org/43437Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst b8c6a348
...@@ -25,8 +25,6 @@ ...@@ -25,8 +25,6 @@
#include "scdllapi.h" #include "scdllapi.h"
const size_t nScCompressedArrayDelta = 4;
/** Compressed array of row (or column) entries, e.g. heights, flags, ... /** Compressed array of row (or column) entries, e.g. heights, flags, ...
The array stores ranges of values such that equal consecutive values occupy only The array stores ranges of values such that equal consecutive values occupy only
...@@ -70,8 +68,7 @@ public: ...@@ -70,8 +68,7 @@ public:
/** Construct with nMaxAccess=MAXROW, for example. */ /** Construct with nMaxAccess=MAXROW, for example. */
ScCompressedArray( A nMaxAccess, ScCompressedArray( A nMaxAccess,
const D& rValue, const D& rValue );
size_t nDelta = nScCompressedArrayDelta );
/** Construct from a plain array of D */ /** Construct from a plain array of D */
ScCompressedArray( A nMaxAccess, ScCompressedArray( A nMaxAccess,
const D* pDataArray, size_t nDataCount ); const D* pDataArray, size_t nDataCount );
...@@ -119,7 +116,6 @@ public: ...@@ -119,7 +116,6 @@ public:
protected: protected:
size_t nCount; size_t nCount;
size_t nLimit; size_t nLimit;
size_t nDelta;
DataEntry* pData; DataEntry* pData;
A nMaxAccess; A nMaxAccess;
}; };
...@@ -176,9 +172,8 @@ template< typename A, typename D > class ScBitMaskCompressedArray : public ScCom ...@@ -176,9 +172,8 @@ template< typename A, typename D > class ScBitMaskCompressedArray : public ScCom
{ {
public: public:
ScBitMaskCompressedArray( A nMaxAccessP, ScBitMaskCompressedArray( A nMaxAccessP,
const D& rValue, const D& rValue )
size_t nDeltaP = nScCompressedArrayDelta ) : ScCompressedArray<A,D>( nMaxAccessP, rValue )
: ScCompressedArray<A,D>( nMaxAccessP, rValue, nDeltaP)
{} {}
ScBitMaskCompressedArray( A nMaxAccessP, ScBitMaskCompressedArray( A nMaxAccessP,
const D* pDataArray, size_t nDataCount ) const D* pDataArray, size_t nDataCount )
......
...@@ -23,12 +23,12 @@ ...@@ -23,12 +23,12 @@
#include <algorithm> #include <algorithm>
static const size_t nScCompressedArrayDelta = 4;
template< typename A, typename D > template< typename A, typename D >
ScCompressedArray<A,D>::ScCompressedArray( A nMaxAccessP, const D& rValue, ScCompressedArray<A,D>::ScCompressedArray( A nMaxAccessP, const D& rValue )
size_t nDeltaP )
: nCount(1) : nCount(1)
, nLimit(1) , nLimit(1)
, nDelta( nDeltaP > 0 ? nDeltaP : 1)
, pData( new DataEntry[1]) , pData( new DataEntry[1])
, nMaxAccess( nMaxAccessP) , nMaxAccess( nMaxAccessP)
{ {
...@@ -41,7 +41,6 @@ ScCompressedArray<A,D>::ScCompressedArray( A nMaxAccessP, const D* pDataArray, ...@@ -41,7 +41,6 @@ ScCompressedArray<A,D>::ScCompressedArray( A nMaxAccessP, const D* pDataArray,
size_t nDataCount ) size_t nDataCount )
: nCount(0) : nCount(0)
, nLimit( nDataCount) , nLimit( nDataCount)
, nDelta( nScCompressedArrayDelta)
, pData( new DataEntry[nDataCount]) , pData( new DataEntry[nDataCount])
, nMaxAccess( nMaxAccessP) , nMaxAccess( nMaxAccessP)
{ {
...@@ -127,7 +126,7 @@ void ScCompressedArray<A,D>::SetValue( A nStart, A nEnd, const D& rValue ) ...@@ -127,7 +126,7 @@ void ScCompressedArray<A,D>::SetValue( A nStart, A nEnd, const D& rValue )
size_t nNeeded = nCount + 2; size_t nNeeded = nCount + 2;
if (nLimit < nNeeded) if (nLimit < nNeeded)
{ {
nLimit += nDelta; nLimit += nScCompressedArrayDelta;
if (nLimit < nNeeded) if (nLimit < nNeeded)
nLimit = nNeeded; nLimit = nNeeded;
DataEntry* pNewData = new DataEntry[nLimit]; DataEntry* pNewData = new DataEntry[nLimit];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment