From: Petr Písař Date: Thu, 12 Sep 2019 10:43:56 +0000 (+0200) Subject: test: Fix signedness mismatch X-Git-Tag: v3.7.6~3^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d007389422007adf9cee50830b8dae9884802d77;p=recode test: Fix signedness mismatch GCC 9.2.1 warns: Recode.c: In function ‘__pyx_pf_6Recode_7Request_8pair_sequence’: Recode.c:3096:45: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘short int’ [-Wsign-compare] 3096 | for (__pyx_v_counter = 0; __pyx_v_counter < __pyx_t_2; __pyx_v_counter++) { | ^ A comparison between differently signed variable is dangerous because the signed value is converted to an unsigned value of the same width and that mangles the value and leads to comparing unintended values. This patch fixes it. --- diff --git a/tests/Recode.pyx b/tests/Recode.pyx index a7982a2..545c1a1 100644 --- a/tests/Recode.pyx +++ b/tests/Recode.pyx @@ -604,7 +604,7 @@ cdef class Request: def pair_sequence(self): list = [] cdef recode_step step - cdef unsigned counter + cdef short counter for counter from 0 <= counter < self.request.sequence_length: step = self.request.sequence_array[counter] list.append((step.before.name, step.after.name))