Fix clang-analyzer-core.uninitialized.Assign

/media/ddnet/src/engine/shared/dilate.cpp:32:22: warning: The left expression of the compound assignment is an uninitialized value. The computed value will also be garbage [clang-analyzer-core.uninitialized.Assign]
This commit is contained in:
def 2020-10-12 19:05:39 +02:00
parent 87b06d307f
commit 7f38bc0941

View file

@ -29,7 +29,10 @@ static void Dilate(int w, int h, int BPP, unsigned char *pSrc, unsigned char *pD
if(pSrc[k + AlphaCompIndex] > AlphaThreshold)
{
for(int p = 0; p < BPP - 1; ++p)
SumOfOpaque[p] += pSrc[k + p];
// Seems safe for BPP = 3, 4 which we use. clang-analyzer seems to
// asssume being called with larger value. TODO: Can make this
// safer anyway.
SumOfOpaque[p] += pSrc[k + p]; // NOLINT(clang-analyzer-core.uninitialized.Assign)
++Counter;
break;
}