From 50321b1ccd964c4f9a2584729d6be3e34f6ddb1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Sat, 8 Feb 2014 19:28:26 +0100 Subject: [PATCH] segmentation: Fix integer underflow check error: comparison of unsigned expression < 0 is always false [-Werror,-Wtautological-compare] --- ext/opencv/gstsegmentation.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ext/opencv/gstsegmentation.cpp b/ext/opencv/gstsegmentation.cpp index 1a48afd8c7..1f81fcaa8a 100644 --- a/ext/opencv/gstsegmentation.cpp +++ b/ext/opencv/gstsegmentation.cpp @@ -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; }