#45985: sdl2: 'count' in popup_diplomatic_objects() unsigned Open Date: 2022-10-27 04:27 Last Update: 2022-10-29 22:08 URL for this Ticket: https://osdn.net//projects/freeciv/ticket/45985 RSS feed for this Ticket: https://osdn.net/ticket/ticket_rss.php?group_id=12505&tid=45985 --------------------------------------------------------------------- Last Changes/Comment on this Ticket: 2022-10-29 22:08 Updated by: cazfi * Owner Update from (None) to cazfi * Resolution Update from None to Accepted Comment: Attached patches touch a couple of other variables too (size, width and height, related ones) --------------------------------------------------------------------- Ticket Status: Reporter: cazfi Owner: cazfi Type: Patches Status: Open [Owner assigned] Priority: 5 - Medium MileStone: 3.0.5 Component: SDL2-client Severity: 5 - Medium Resolution: Accepted --------------------------------------------------------------------- Ticket details: To human eye, 'count' in popup_diplomatic_objects() is clearly always positive (initialized as 0, and ever only increased by 1). Clang analyzer seems to fail realize that, as it gives warning about division by zero that could happen only if 'count < 0' (count must be smaller than the divider). Formally declaring 'count' unsigned makes the warning to go away. -- Ticket information of Freeciv project Freeciv Project is hosted on OSDN Project URL: https://osdn.net/projects/freeciv/ OSDN: https://osdn.net URL for this Ticket: https://osdn.net/projects/freeciv/ticket/45985 RSS feed for this Ticket: https://osdn.net/ticket/ticket_rss.php?group_id=12505&tid=45985