[Libreoffice-commits] core.git: vcl/source vcl/unx
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Mon Mar 22 14:06:38 UTC 2021
vcl/source/filter/itiff/lzwdecom.cxx | 23 ++++++++++++-----------
vcl/source/filter/itiff/lzwdecom.hxx | 2 +-
vcl/unx/generic/print/bitmap_gfx.cxx | 19 ++++++++++---------
3 files changed, 23 insertions(+), 21 deletions(-)
New commits:
commit 4566bcbf03c1b7b0c1ce3a83fee1d195f0ff7059
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Mar 22 10:53:37 2021 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Mar 22 15:05:49 2021 +0100
cid#707834 silence Uninitialized scalar field
and
cid#1474340 silence Uninitialized scalar field
Change-Id: Ib5d12595bfcd2eaf5b26ce333d5ea8328fdeb2aa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112880
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/vcl/source/filter/itiff/lzwdecom.cxx b/vcl/source/filter/itiff/lzwdecom.cxx
index 15784321b92e..14a7e276f4ee 100644
--- a/vcl/source/filter/itiff/lzwdecom.cxx
+++ b/vcl/source/filter/itiff/lzwdecom.cxx
@@ -24,6 +24,7 @@
LZWDecompressor::LZWDecompressor()
: pIStream(nullptr)
+ , aTable{{}}
, nTableSize(0)
, bEOIFound(false)
, bInvert(false)
@@ -36,9 +37,9 @@ LZWDecompressor::LZWDecompressor()
{
for (sal_uInt16 i=0; i<MAX_TABLE_SIZE; i++)
{
- pTable[i].nPrevCode=0;
- pTable[i].nDataCount=1;
- pTable[i].nData=static_cast<sal_uInt8>(i);
+ aTable[i].nPrevCode=0;
+ aTable[i].nDataCount=1;
+ aTable[i].nData=static_cast<sal_uInt8>(i);
}
}
@@ -156,7 +157,7 @@ void LZWDecompressor::AddToTable(sal_uInt16 nPrevCode, sal_uInt16 nCodeFirstData
}
unsigned char aSeenIndexes[MAX_TABLE_SIZE] = {0};
- while (pTable[nCodeFirstData].nDataCount>1)
+ while (aTable[nCodeFirstData].nDataCount>1)
{
if (aSeenIndexes[nCodeFirstData])
{
@@ -165,12 +166,12 @@ void LZWDecompressor::AddToTable(sal_uInt16 nPrevCode, sal_uInt16 nCodeFirstData
return;
}
aSeenIndexes[nCodeFirstData] = 1;
- nCodeFirstData=pTable[nCodeFirstData].nPrevCode;
+ nCodeFirstData=aTable[nCodeFirstData].nPrevCode;
}
- pTable[nTableSize].nPrevCode=nPrevCode;
- pTable[nTableSize].nDataCount=pTable[nPrevCode].nDataCount+1;
- pTable[nTableSize].nData=pTable[nCodeFirstData].nData;
+ aTable[nTableSize].nPrevCode=nPrevCode;
+ aTable[nTableSize].nDataCount=aTable[nPrevCode].nDataCount+1;
+ aTable[nTableSize].nData=aTable[nCodeFirstData].nData;
nTableSize++;
}
@@ -204,12 +205,12 @@ void LZWDecompressor::DecompressSome()
nOldCode=nCode;
- nOutBufDataLen=pTable[nCode].nDataCount;
+ nOutBufDataLen=aTable[nCode].nDataCount;
pOutBufData=pOutBuf.data()+nOutBufDataLen;
for (i=0; i<nOutBufDataLen; i++)
{
- *(--pOutBufData)=pTable[nCode].nData;
- nCode=pTable[nCode].nPrevCode;
+ *(--pOutBufData)=aTable[nCode].nData;
+ nCode=aTable[nCode].nPrevCode;
}
}
diff --git a/vcl/source/filter/itiff/lzwdecom.hxx b/vcl/source/filter/itiff/lzwdecom.hxx
index 71ec833b21db..cd6590a6dc87 100644
--- a/vcl/source/filter/itiff/lzwdecom.hxx
+++ b/vcl/source/filter/itiff/lzwdecom.hxx
@@ -53,7 +53,7 @@ private:
SvStream* pIStream;
- std::array<LZWTableEntry, MAX_TABLE_SIZE> pTable;
+ std::array<LZWTableEntry, MAX_TABLE_SIZE> aTable;
sal_uInt16 nTableSize;
bool bEOIFound, bInvert, bFirst;
diff --git a/vcl/unx/generic/print/bitmap_gfx.cxx b/vcl/unx/generic/print/bitmap_gfx.cxx
index 4ddce0214190..830561b9677f 100644
--- a/vcl/unx/generic/print/bitmap_gfx.cxx
+++ b/vcl/unx/generic/print/bitmap_gfx.cxx
@@ -299,7 +299,7 @@ private:
};
std::array<LZWCTreeNode, 4096>
- mpTable; // LZW compression data
+ maTable; // LZW compression data
LZWCTreeNode* mpPrefix; // the compression is as same as the TIFF compression
static constexpr sal_uInt16 gnDataSize = 8;
static constexpr sal_uInt16 gnClearCode = 1 << gnDataSize;
@@ -323,6 +323,7 @@ public:
LZWEncoder::LZWEncoder(osl::File* pOutputFile) :
Ascii85Encoder (pOutputFile),
+ maTable{{}},
mpPrefix(nullptr),
mnTableSize(gnEOICode + 1),
mnCodeSize(gnDataSize + 1),
@@ -331,10 +332,10 @@ LZWEncoder::LZWEncoder(osl::File* pOutputFile) :
{
for (sal_uInt32 i = 0; i < 4096; i++)
{
- mpTable[i].mpBrother = nullptr;
- mpTable[i].mpFirstChild = nullptr;
- mpTable[i].mnCode = i;
- mpTable[i].mnValue = static_cast<sal_uInt8>(mpTable[i].mnCode);
+ maTable[i].mpBrother = nullptr;
+ maTable[i].mpFirstChild = nullptr;
+ maTable[i].mnCode = i;
+ maTable[i].mnValue = static_cast<sal_uInt8>(maTable[i].mnCode);
}
WriteBits( gnClearCode, mnCodeSize );
@@ -372,7 +373,7 @@ LZWEncoder::EncodeByte (sal_uInt8 nByte )
if (!mpPrefix)
{
- mpPrefix = mpTable.data() + nByte;
+ mpPrefix = maTable.data() + nByte;
}
else
{
@@ -396,7 +397,7 @@ LZWEncoder::EncodeByte (sal_uInt8 nByte )
WriteBits (gnClearCode, mnCodeSize);
for (i = 0; i < gnClearCode; i++)
- mpTable[i].mpFirstChild = nullptr;
+ maTable[i].mpFirstChild = nullptr;
mnCodeSize = gnDataSize + 1;
mnTableSize = gnEOICode + 1;
@@ -406,14 +407,14 @@ LZWEncoder::EncodeByte (sal_uInt8 nByte )
if(mnTableSize == static_cast<sal_uInt16>((1 << mnCodeSize) - 1))
mnCodeSize++;
- p = mpTable.data() + (mnTableSize++);
+ p = maTable.data() + (mnTableSize++);
p->mpBrother = mpPrefix->mpFirstChild;
mpPrefix->mpFirstChild = p;
p->mnValue = nV;
p->mpFirstChild = nullptr;
}
- mpPrefix = mpTable.data() + nV;
+ mpPrefix = maTable.data() + nV;
}
}
}
More information about the Libreoffice-commits
mailing list