#45985: sdl2: 'count' in popup_diplomatic_objects() unsigned Open Date: 2022-10-27 04:27 Last Update: 2022-10-27 04:27 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-27 04:27 Updated by: cazfi * New Ticket "sdl2: 'count' in popup_diplomatic_objects() unsigned" created --------------------------------------------------------------------- Ticket Status: Reporter: cazfi Owner: (None) Type: Patches Status: Open Priority: 5 - Medium MileStone: 3.0.5 Component: SDL2-client Severity: 5 - Medium Resolution: None --------------------------------------------------------------------- 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