commit 1922debde59de72ef483b7d0ddbc17cc9274b745 Author: Oswald Buddenhagen <o...@users.sf.net> Date: Fri Nov 22 21:02:50 2019 +0100
make find_uint_array() never create negative indices src/util.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/util.c b/src/util.c index 665bb41..de94cb9 100644 --- a/src/util.c +++ b/src/util.c @@ -549,8 +549,8 @@ sort_uint_array( uint_array_t array ) int find_uint_array( uint_array_t array, uint value ) { - int bot = 0, top = array.size - 1; - while (bot <= top) { + int bot = 0, top = array.size; + while (bot < top) { int i = (bot + top) / 2; uint elt = array.data[i]; if (elt == value) @@ -558,7 +558,7 @@ find_uint_array( uint_array_t array, uint value ) if (elt < value) bot = i + 1; else - top = i - 1; + top = i; } return 0; } _______________________________________________ isync-devel mailing list isync-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/isync-devel