From e7eaf047cc3f6b716db95b3cf3077c6dfe6e2d0b Mon Sep 17 00:00:00 2001 From: Piotr Kubaj Date: Wed, 30 Jul 2025 20:22:45 +0000 Subject: [PATCH] _rencode.pyx: fix build warnings [1/1] Cythonizing rencode/_rencode.pyx rencode/_rencode.c:2927:28: warning: result of comparison of constant 128 with expression of type 'signed char' is always true [-Wtautological-constant-out-of-range-compare] 2927 | __pyx_t_1 = (__pyx_v_x < 0x80); | ~~~~~~~~~ ^ ~~~~ rencode/_rencode.c:7905:35: warning: result of comparison of constant 256 with expression of type 'unsigned char' is always true [-Wtautological-constant-out-of-range-compare] 7905 | __pyx_t_1 = (__pyx_v_typecode < (__pyx_e_7rencode_8_rencode_LIST_FIXED_START + __pyx_e_7rencode_8_rencode_LIST_FIXED_COUNT)); | ~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 warnings generated. --- rencode/_rencode.pyx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rencode/_rencode.pyx b/rencode/_rencode.pyx index 9796b7e..010792c 100644 --- a/rencode/_rencode.pyx +++ b/rencode/_rencode.pyx @@ -73,7 +73,7 @@ cdef enum: STR_FIXED_COUNT = 64 # Lists with length embedded in typecode. LIST_FIXED_START = STR_FIXED_START+STR_FIXED_COUNT - LIST_FIXED_COUNT = 64 + LIST_FIXED_COUNT = 63 cdef char _float_bits @@ -163,7 +163,7 @@ cdef encode_char(char **buf, unsigned int *pos, signed char x): write_buffer_char(buf, pos, INT_POS_FIXED_START + x) elif -INT_NEG_FIXED_COUNT <= x < 0: write_buffer_char(buf, pos, INT_NEG_FIXED_START - 1 - x) - elif -128 <= x < 128: + elif -128 <= x < 127: write_buffer_char(buf, pos, CHR_INT1) write_buffer_char(buf, pos, x)