aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2015-03-24 19:20:03 +0000
committerSimon Tatham <anakin@pobox.com>2015-03-24 19:20:03 +0000
commit195217a48062c3ee64a47b1d0b5327e5838a105c (patch)
tree3cfaa978f9f8bea8085b6b5d844ce8f506c1030a
parent05b533d1f899e448fae25e27614543147f9acffa (diff)
downloadpuzzles-195217a48062c3ee64a47b1d0b5327e5838a105c.zip
puzzles-195217a48062c3ee64a47b1d0b5327e5838a105c.tar.gz
puzzles-195217a48062c3ee64a47b1d0b5327e5838a105c.tar.bz2
puzzles-195217a48062c3ee64a47b1d0b5327e5838a105c.tar.xz
Fix a compile warning on ARM.
Aapo Rantalainen points out that comparing 'char c' against zero gives rise to gcc's "comparison is always false" warning, which escalates to an error under -Werror. This is one of those situations where the warning is doing more harm than good, but here's a rephrasing which casts to unsigned so that both negative numbers and positive out-of-range ones can be caught by the same comparison.
-rw-r--r--flood.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/flood.c b/flood.c
index 557da95..bbba915 100644
--- a/flood.c
+++ b/flood.c
@@ -609,7 +609,7 @@ static char *validate_desc(const game_params *params, const char *desc)
c = 10 + (c - 'A');
else
return "Bad character in grid description";
- if (c < 0 || c >= params->colours)
+ if ((unsigned)c >= params->colours)
return "Colour out of range in grid description";
}
if (*desc != ',')