rrthomas / recode

Charset converter tool and library
GNU General Public License v3.0
130 stars 12 forks source link

test: Fix signedness mismatch #23

Closed ppisar closed 4 years ago

ppisar commented 4 years ago

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.

rrthomas commented 4 years ago

Thanks very much for this!