From cec63a80d01c17c190ab091b0b6f4abf6717d185 Mon Sep 17 00:00:00 2001 From: Alina Lenk Date: Wed, 20 Jul 2022 19:32:31 +0200 Subject: [PATCH] generate_packets.py: Don't compare constant array size to itself Reported by Marko Lindqvist See osdn#45159 Signed-off-by: Alina Lenk --- common/generate_packets.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/common/generate_packets.py b/common/generate_packets.py index 363022226b..2616ad5c1e 100755 --- a/common/generate_packets.py +++ b/common/generate_packets.py @@ -275,13 +275,24 @@ class Field: array_size_o=self.array_size1_o elif self.is_struct: c="!are_%(dataio_type)ss_equal(&old->%(name)s[i], &real_packet->%(name)s[i])"%self.__dict__ + array_size_u = self.array_size_u + array_size_o = self.array_size_o else: c="old->%(name)s[i] != real_packet->%(name)s[i]"%self.__dict__ + array_size_u = self.array_size_u + array_size_o = self.array_size_o - return ''' + if array_size_u != array_size_o: + head = ''' { differ = (%(array_size_o)s != %(array_size_u)s); - if (!differ) { + if (!differ) {''' % self.get_dict(vars()) + else: + head = ''' + { + differ = FALSE; + {''' + return head + ''' int i; for (i = 0; i < %(array_size_u)s; i++) { -- 2.34.1