summaryrefslogtreecommitdiffstats
path: root/meta/recipes-sato/puzzles/files/0001-palisade-Fix-warnings-with-clang-on-arm.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-sato/puzzles/files/0001-palisade-Fix-warnings-with-clang-on-arm.patch')
-rw-r--r--meta/recipes-sato/puzzles/files/0001-palisade-Fix-warnings-with-clang-on-arm.patch96
1 files changed, 50 insertions, 46 deletions
diff --git a/meta/recipes-sato/puzzles/files/0001-palisade-Fix-warnings-with-clang-on-arm.patch b/meta/recipes-sato/puzzles/files/0001-palisade-Fix-warnings-with-clang-on-arm.patch
index 143e898a51..07eb1d32f6 100644
--- a/meta/recipes-sato/puzzles/files/0001-palisade-Fix-warnings-with-clang-on-arm.patch
+++ b/meta/recipes-sato/puzzles/files/0001-palisade-Fix-warnings-with-clang-on-arm.patch
@@ -1,7 +1,6 @@
1From 453587d714473b806473b309727f865b673cbc06 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 1From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 13 Jan 2016 23:10:19 -0800 2
4Subject: [PATCH] palisade: Fix warnings with clang on arm 3palisade: Fix warnings with clang on arm
5 4
6ARM treats 'char' as unsigned char when 'char' is not qualified with 5ARM treats 'char' as unsigned char when 'char' is not qualified with
7'signed' or 'unsigned' explicitly. 6'signed' or 'unsigned' explicitly.
@@ -15,54 +14,59 @@ type 'clue' (aka 'char') is always false
15 14
16Therefore, typcast the contant to char in such places to be explicit 15Therefore, typcast the contant to char in such places to be explicit
17 16
17Upstream-Status: Submitted [email discussion with upstream]
18
19Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
18Signed-off-by: Khem Raj <raj.khem@gmail.com> 20Signed-off-by: Khem Raj <raj.khem@gmail.com>
19Upstream-Status: Submitted
20---
21 palisade.c | 10 +++++-----
22 1 file changed, 5 insertions(+), 5 deletions(-)
23 21
24diff --git a/palisade.c b/palisade.c 22Index: git/palisade.c
25index 6ffbf2d..8b54d42 100644 23===================================================================
26--- a/palisade.c 24--- git.orig/palisade.c
27+++ b/palisade.c 25+++ git/palisade.c
28@@ -304,11 +304,11 @@ static void solver_connected_clues_versus_region_size(solver_ctx *ctx) 26@@ -46,7 +46,7 @@ struct game_params {
29 * If p = q = 3 then the region has size exactly 2. */ 27 int w, h, k;
28 };
30 29
31 for (i = 0; i < wh; ++i) { 30-typedef char clue;
32- if (ctx->clues[i] == EMPTY) continue; 31+typedef signed char clue;
33+ if (ctx->clues[i] == (char)EMPTY) continue; 32 typedef unsigned char borderflag;
34 for (dir = 0; dir < 4; ++dir) {
35 int j = i + dx[dir] + w*dy[dir];
36 if (disconnected(ctx, i, j, dir)) continue;
37- if (ctx->clues[j] == EMPTY) continue;
38+ if (ctx->clues[j] == (char)EMPTY) continue;
39 if ((8 - ctx->clues[i] - ctx->clues[j] > ctx->params->k) ||
40 (ctx->clues[i] == 3 && ctx->clues[j] == 3 &&
41 ctx->params->k != 2))
42@@ -326,7 +326,7 @@ static bool solver_number_exhausted(solver_ctx *ctx)
43 bool changed = false;
44 33
45 for (i = 0; i < wh; ++i) { 34 typedef struct shared_state {
46- if (ctx->clues[i] == EMPTY) continue; 35@@ -242,7 +242,7 @@ typedef struct solver_ctx {
47+ if (ctx->clues[i] == (char)EMPTY) continue; 36 * thing is done. See how it is propagated across multiple squares.]
37 */
48 38
49 if (bitcount[(ctx->borders[i] & BORDER_MASK)] == ctx->clues[i]) { 39-#define EMPTY (~0)
50 for (dir = 0; dir < 4; ++dir) { 40+#define EMPTY ((clue)-1)
51@@ -538,7 +538,7 @@ static bool is_solved(const game_params *params, clue *clues,
52 for (i = 0; i < wh; ++i) {
53 if (dsf[i] == UNVISITED) dfs_dsf(i, params->w, border, dsf, true);
54 if (dsf_size(dsf, i) != k) goto error;
55- if (clues[i] == EMPTY) continue;
56+ if (clues[i] == (char)EMPTY) continue;
57 if (clues[i] != bitcount[border[i] & BORDER_MASK]) goto error;
58 }
59 41
60@@ -685,7 +685,7 @@ static char *new_game_desc(const game_params *params, random_state *rs, 42 #define BIT(i) (1 << (i))
61 p = numbers; 43 #define BORDER(i) BIT(i)
44@@ -622,7 +622,7 @@ static char *new_game_desc(const game_pa
45 {
46 int w = params->w, h = params->h, wh = w*h, k = params->k;
47
48- clue *numbers = snewn(wh + 1, clue), *p;
49+ clue *numbers = snewn(wh + 1, clue);
50 borderflag *rim = snewn(wh, borderflag);
51 borderflag *scratch_borders = snewn(wh, borderflag);
52
53@@ -682,7 +682,8 @@ static char *new_game_desc(const game_pa
54 sfree(shuf);
55 sfree(dsf);
56
57- p = numbers;
58+ char *output = snewn(wh + 1, char), *p = output;
59+
62 r = 0; 60 r = 0;
63 for (i = 0; i < wh; ++i) { 61 for (i = 0; i < wh; ++i) {
64- if (numbers[i] != EMPTY) { 62 if (numbers[i] != EMPTY) {
65+ if (numbers[i] != (char)EMPTY) { 63@@ -699,7 +700,8 @@ static char *new_game_desc(const game_pa
66 while (r) { 64 }
67 while (r > 26) { 65 *p++ = '\0';
68 *p++ = 'z'; 66
67- return sresize(numbers, p - numbers, clue);
68+ sfree(numbers);
69+ return sresize(output, p - output, char);
70 }
71
72 static const char *validate_desc(const game_params *params, const char *desc)