43 lines
1.5 KiB
Diff
43 lines
1.5 KiB
Diff
From d007389422007adf9cee50830b8dae9884802d77 Mon Sep 17 00:00:00 2001
|
||
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
|
||
Date: Thu, 12 Sep 2019 12:43:56 +0200
|
||
Subject: [PATCH] test: Fix signedness mismatch
|
||
MIME-Version: 1.0
|
||
Content-Type: text/plain; charset=UTF-8
|
||
Content-Transfer-Encoding: 8bit
|
||
|
||
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.
|
||
|
||
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
||
---
|
||
tests/Recode.pyx | 2 +-
|
||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||
|
||
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))
|
||
--
|
||
2.21.0
|
||
|