summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-10-12 17:12:22 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-10-15 19:22:21 +0200
commiteaf0c263eb1a72a58d2a67cc0506ab022d7c4be4 (patch)
tree4c732e95b560235e83c6de4b5b96260b638fa88d /vcl
parent921ae49cd7e332d7e1ad702efe2198b2780cc829 (diff)
loplugin:staticconstfield improvements
And fix ScXMLCachedRowAttrAccess::Cache which was never setting its mnTab field, and hence would never be hit. And fix oox::xls::CellBlockBuffer, which was never setting mnCurrRow. Change-Id: I2c46aa050b9ebe3c2dc2e52579555f97945dd61c Reviewed-on: https://gerrit.libreoffice.org/61772 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/octree.hxx8
-rw-r--r--vcl/source/filter/ipdf/pdfdocument.cxx7
-rw-r--r--vcl/source/gdi/octree.cxx13
-rw-r--r--vcl/unx/generic/print/bitmap_gfx.cxx18
4 files changed, 21 insertions, 25 deletions
diff --git a/vcl/inc/octree.hxx b/vcl/inc/octree.hxx
index ae819d858872..cec8e4171494 100644
--- a/vcl/inc/octree.hxx
+++ b/vcl/inc/octree.hxx
@@ -95,7 +95,7 @@ private:
std::unique_ptr<sal_uInt8[]> pBuffer;
std::unique_ptr<sal_uInt8[]> pMap;
- const sal_uLong nBits;
+ static constexpr sal_uLong gnBits = 8 -OCTREE_BITS;
SAL_DLLPRIVATE void ImplCreateBuffers( const sal_uLong nMax );
@@ -109,9 +109,9 @@ public:
inline sal_uInt16 InverseColorMap::GetBestPaletteIndex( const BitmapColor& rColor )
{
- return pMap[ ( ( static_cast<sal_uLong>(rColor.GetRed()) >> nBits ) << OCTREE_BITS_1 ) |
- ( ( static_cast<sal_uLong>(rColor.GetGreen()) >> nBits ) << OCTREE_BITS ) |
- ( static_cast<sal_uLong>(rColor.GetBlue()) >> nBits ) ];
+ return pMap[ ( ( static_cast<sal_uLong>(rColor.GetRed()) >> gnBits ) << OCTREE_BITS_1 ) |
+ ( ( static_cast<sal_uLong>(rColor.GetGreen()) >> gnBits ) << OCTREE_BITS ) |
+ ( static_cast<sal_uLong>(rColor.GetBlue()) >> gnBits ) ];
}
#endif // INCLUDED_VCL_INC_OCTREE_HXX
diff --git a/vcl/source/filter/ipdf/pdfdocument.cxx b/vcl/source/filter/ipdf/pdfdocument.cxx
index 09cafdea9f45..092df7cfbee7 100644
--- a/vcl/source/filter/ipdf/pdfdocument.cxx
+++ b/vcl/source/filter/ipdf/pdfdocument.cxx
@@ -2274,8 +2274,9 @@ size_t PDFDictionaryElement::Parse(const std::vector<std::unique_ptr<PDFElement>
if (pThisDictionary)
{
pThisDictionary->SetKeyOffset(aName, nNameOffset);
- pThisDictionary->SetKeyValueLength(
- aName, pName->GetLocation() + pName->GetLength() - nNameOffset);
+ pThisDictionary->SetKeyValueLength(aName, pName->GetLocation()
+ + PDFNameElement::GetLength()
+ - nNameOffset);
}
aName.clear();
}
@@ -2927,8 +2928,6 @@ const OString& PDFNameElement::GetValue() const { return m_aValue; }
sal_uInt64 PDFNameElement::GetLocation() const { return m_nLocation; }
-sal_uInt64 PDFNameElement::GetLength() const { return m_nLength; }
-
PDFStreamElement::PDFStreamElement(size_t nLength)
: m_nLength(nLength)
, m_nOffset(0)
diff --git a/vcl/source/gdi/octree.cxx b/vcl/source/gdi/octree.cxx
index 21af8416fee9..4635067901f8 100644
--- a/vcl/source/gdi/octree.cxx
+++ b/vcl/source/gdi/octree.cxx
@@ -232,14 +232,13 @@ void Octree::GetPalIndex( OctreeNode* pNode )
}
}
-InverseColorMap::InverseColorMap( const BitmapPalette& rPal ) :
- nBits( 8 - OCTREE_BITS )
+InverseColorMap::InverseColorMap( const BitmapPalette& rPal )
{
const int nColorMax = 1 << OCTREE_BITS;
- const unsigned long xsqr = 1 << ( nBits << 1 );
+ const unsigned long xsqr = 1 << ( gnBits << 1 );
const unsigned long xsqr2 = xsqr << 1;
const int nColors = rPal.GetEntryCount();
- const long x = 1 << nBits;
+ const long x = 1 << gnBits;
const long x2 = x >> 1;
sal_uLong r, g, b;
long rxx, gxx, bxx;
@@ -258,9 +257,9 @@ InverseColorMap::InverseColorMap( const BitmapPalette& rPal ) :
long bdist = cBlue - x2;
rdist = rdist*rdist + gdist*gdist + bdist*bdist;
- const long crinc = ( xsqr - ( cRed << nBits ) ) << 1;
- const long cginc = ( xsqr - ( cGreen << nBits ) ) << 1;
- const long cbinc = ( xsqr - ( cBlue << nBits ) ) << 1;
+ const long crinc = ( xsqr - ( cRed << gnBits ) ) << 1;
+ const long cginc = ( xsqr - ( cGreen << gnBits ) ) << 1;
+ const long cbinc = ( xsqr - ( cBlue << gnBits ) ) << 1;
sal_uLong* cdp = reinterpret_cast<sal_uLong*>(pBuffer.get());
sal_uInt8* crgbp = pMap.get();
diff --git a/vcl/unx/generic/print/bitmap_gfx.cxx b/vcl/unx/generic/print/bitmap_gfx.cxx
index 04ce1fd3ba96..613920aaed27 100644
--- a/vcl/unx/generic/print/bitmap_gfx.cxx
+++ b/vcl/unx/generic/print/bitmap_gfx.cxx
@@ -278,8 +278,8 @@ private:
mpTable; // LZW compression data
LZWCTreeNode* mpPrefix; // the compression is as same as the TIFF compression
static constexpr sal_uInt16 gnDataSize = 8;
- sal_uInt16 const mnClearCode;
- sal_uInt16 const mnEOICode;
+ static constexpr sal_uInt16 gnClearCode = 1 << gnDataSize;
+ static constexpr sal_uInt16 gnEOICode = gnClearCode + 1;
sal_uInt16 mnTableSize;
sal_uInt16 mnCodeSize;
sal_uInt32 mnOffset;
@@ -298,9 +298,7 @@ public:
LZWEncoder::LZWEncoder(osl::File* pOutputFile) :
Ascii85Encoder (pOutputFile),
mpPrefix(nullptr),
- mnClearCode(1 << gnDataSize),
- mnEOICode(mnClearCode + 1),
- mnTableSize(mnEOICode + 1),
+ mnTableSize(gnEOICode + 1),
mnCodeSize(gnDataSize + 1),
mnOffset(32), // free bits in dwShift
mdwShift(0)
@@ -313,7 +311,7 @@ LZWEncoder::LZWEncoder(osl::File* pOutputFile) :
mpTable[i].mnValue = static_cast<sal_uInt8>(mpTable[i].mnCode);
}
- WriteBits( mnClearCode, mnCodeSize );
+ WriteBits( gnClearCode, mnCodeSize );
}
LZWEncoder::~LZWEncoder()
@@ -321,7 +319,7 @@ LZWEncoder::~LZWEncoder()
if (mpPrefix)
WriteBits (mpPrefix->mnCode, mnCodeSize);
- WriteBits (mnEOICode, mnCodeSize);
+ WriteBits (gnEOICode, mnCodeSize);
}
void
@@ -369,13 +367,13 @@ LZWEncoder::EncodeByte (sal_uInt8 nByte )
if (mnTableSize == 409)
{
- WriteBits (mnClearCode, mnCodeSize);
+ WriteBits (gnClearCode, mnCodeSize);
- for (i = 0; i < mnClearCode; i++)
+ for (i = 0; i < gnClearCode; i++)
mpTable[i].mpFirstChild = nullptr;
mnCodeSize = gnDataSize + 1;
- mnTableSize = mnEOICode + 1;
+ mnTableSize = gnEOICode + 1;
}
else
{