projects
/
platform
/
upstream
/
gstreamer.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
78d9134
)
segmentation: Fix integer underflow check
author
Sebastian Dröge
<sebastian@centricular.com>
Sat, 8 Feb 2014 18:28:26 +0000
(19:28 +0100)
committer
Sebastian Dröge
<sebastian@centricular.com>
Sat, 8 Feb 2014 18:28:26 +0000
(19:28 +0100)
error: comparison of unsigned expression < 0 is
always false [-Werror,-Wtautological-compare]
ext/opencv/gstsegmentation.cpp
patch
|
blob
|
history
diff --git
a/ext/opencv/gstsegmentation.cpp
b/ext/opencv/gstsegmentation.cpp
index
1a48afd
..
1f81fca
100644
(file)
--- 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;
}