segmentation: Fix integer underflow check

error: comparison of unsigned expression < 0 is
always false [-Werror,-Wtautological-compare]
This commit is contained in:
Sebastian Dröge 2014-02-08 19:28:26 +01:00
parent 78d9134d63
commit 50321b1ccd

View file

@ -509,11 +509,13 @@ update_codebook (unsigned char *p, codeBook * c, unsigned *cbBounds,
int matchChannel;
for (n = 0; n < numChannels; n++) {
high[n] = *(p + n) + *(cbBounds + n);
high[n] = p[n] + cbBounds[n];
if (high[n] > 255)
high[n] = 255;
low[n] = *(p + n) - *(cbBounds + n);
if (low[n] < 0)
if (p[n] > cbBounds[n])
low[n] = p[n] - cbBounds[n];
else
low[n] = 0;
}