| From 453587d714473b806473b309727f865b673cbc06 Mon Sep 17 00:00:00 2001 |
| From: Khem Raj <raj.khem@gmail.com> |
| Date: Wed, 13 Jan 2016 23:10:19 -0800 |
| Subject: [PATCH] palisade: Fix warnings with clang on arm |
| |
| ARM treats 'char' as unsigned char when 'char' is not qualified with |
| 'signed' or 'unsigned' explicitly. |
| |
| This results in warnings e.g. |
| |
| palisade.c:531:22: error: comparison of constant -1 with expression of |
| type 'clue' (aka 'char') is always false |
| [-Werror,-Wtautological-constant-out-of-range-compare] |
| if (clues[i] == EMPTY) continue; |
| |
| Therefore, typcast the contant to char in such places to be explicit |
| |
| Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| Upstream-Status: Submitted |
| --- |
| palisade.c | 10 +++++----- |
| 1 file changed, 5 insertions(+), 5 deletions(-) |
| |
| diff --git a/palisade.c b/palisade.c |
| index 6ffbf2d..8b54d42 100644 |
| --- a/palisade.c |
| +++ b/palisade.c |
| @@ -304,11 +304,11 @@ static void solver_connected_clues_versus_region_size(solver_ctx *ctx) |
| * If p = q = 3 then the region has size exactly 2. */ |
| |
| for (i = 0; i < wh; ++i) { |
| - if (ctx->clues[i] == EMPTY) continue; |
| + if (ctx->clues[i] == (char)EMPTY) continue; |
| for (dir = 0; dir < 4; ++dir) { |
| int j = i + dx[dir] + w*dy[dir]; |
| if (disconnected(ctx, i, j, dir)) continue; |
| - if (ctx->clues[j] == EMPTY) continue; |
| + if (ctx->clues[j] == (char)EMPTY) continue; |
| if ((8 - ctx->clues[i] - ctx->clues[j] > ctx->params->k) || |
| (ctx->clues[i] == 3 && ctx->clues[j] == 3 && |
| ctx->params->k != 2)) |
| @@ -326,7 +326,7 @@ static bool solver_number_exhausted(solver_ctx *ctx) |
| bool changed = false; |
| |
| for (i = 0; i < wh; ++i) { |
| - if (ctx->clues[i] == EMPTY) continue; |
| + if (ctx->clues[i] == (char)EMPTY) continue; |
| |
| if (bitcount[(ctx->borders[i] & BORDER_MASK)] == ctx->clues[i]) { |
| for (dir = 0; dir < 4; ++dir) { |
| @@ -538,7 +538,7 @@ static bool is_solved(const game_params *params, clue *clues, |
| for (i = 0; i < wh; ++i) { |
| if (dsf[i] == UNVISITED) dfs_dsf(i, params->w, border, dsf, true); |
| if (dsf_size(dsf, i) != k) goto error; |
| - if (clues[i] == EMPTY) continue; |
| + if (clues[i] == (char)EMPTY) continue; |
| if (clues[i] != bitcount[border[i] & BORDER_MASK]) goto error; |
| } |
| |
| @@ -685,7 +685,7 @@ static char *new_game_desc(const game_params *params, random_state *rs, |
| p = numbers; |
| r = 0; |
| for (i = 0; i < wh; ++i) { |
| - if (numbers[i] != EMPTY) { |
| + if (numbers[i] != (char)EMPTY) { |
| while (r) { |
| while (r > 26) { |
| *p++ = 'z'; |