File: warnings.patch

package info (click to toggle)
gamazons 0.83-13
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,392 kB
  • sloc: ansic: 5,199; sh: 673; makefile: 109
file content (262 lines) | stat: -rw-r--r-- 7,260 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
From: Bart Martens <bartm@debian.org>
Date: Thu, 26 Dec 2013 11:01:00 +0000
Subject: warnings

===================================================================
---
 src/board.c     | 56 +++++++++++---------------------------------------------
 src/callbacks.c | 22 +++++++++-------------
 2 files changed, 20 insertions(+), 58 deletions(-)

diff --git a/src/board.c b/src/board.c
index 6a02f7d..ac3c00d 100644
--- a/src/board.c
+++ b/src/board.c
@@ -1,3 +1,5 @@
+#define _GNU_SOURCE
+#include <stdio.h>
 #include <time.h>
 #include <assert.h>
 #include <gnome.h>
@@ -11,9 +13,6 @@
 /* local Prototypes */
 
 
-static void fill_a_square(GnomeCanvasGroup *group,
-       	double x1, double y1, double x2, double y2, char *color);
-static void get_square_color(int square, char *color);
 static void draw_a_line(GnomeCanvasGroup *group, 
 	int x1, int y1, int x2, int y2, char *color);
 static void draw_grid();
@@ -33,7 +32,6 @@ int state_hash;
 void init_game_board(GtkWidget *GamazonsMain)
 {
    int i,j;
-   char color[256];
    GtkWidget *w = (GtkWidget *) lookup_widget(GamazonsMain, BOARD_NAME);
    GtkWidget *force_button, *undo_button;
    GtkTextView *view;
@@ -115,32 +113,6 @@ void init_game_board(GtkWidget *GamazonsMain)
 }
 
 
-void fill_a_square(GnomeCanvasGroup *group,
-       	double x1, double y1, double x2, double y2, char *color)
-{
-   /* draw a box*/
-   gnome_canvas_item_new(group,
-	   gnome_canvas_rect_get_type(),
-	   "x1", x1,
-	   "y1", y1,
-	   "x2", x2,
-	   "y2", y2,
-	   "outline_color", "black",
-	   "fill_color", color,
-	   "width_pixels", (double)THICKNESS,
-	   NULL, NULL);
-
-}
-
-static void get_square_color(int square, char *color)
-{
-   if ((square % 2) == 0)
-      strcpy(color, SQUARE_COLOR_1);
-   else
-      strcpy(color, SQUARE_COLOR_2);
-}
-
-
 static void draw_grid()
 {
    int x,y;
@@ -190,14 +162,12 @@ static void draw_a_line(GnomeCanvasGroup *group,
 void draw_board()
 {
    int i,j,k;
-   int black_i = 0;
    GdkPixbuf *white_pb, *black_pb;
    GdkPixbuf *white_sq, *grey_sq, *arrow_sq;
-   char color[256];
    GnomeCanvasItem *image;
-   GnomeCanvasGroup *root = GNOME_CANVAS_GROUP(gnome_canvas_root (GNOME_CANVAS (board->canvas)));
-   static int first_game = 1;
+   GnomeCanvasGroup *root = NULL;
    
+   root = GNOME_CANVAS_GROUP(gnome_canvas_root (GNOME_CANVAS (board->canvas)));
 
 
    /* Find images */
@@ -426,12 +396,10 @@ void move_piece_to(Square to, GnomeCanvasItem *item)
 {
    double Lx, Uy, Rx, By;
    double to_Lx, to_Uy;
-   int x, y;
-   int i,j;
+   int x = 0, y = 0;
    int game_life;
    GtkWidget *speed = (GtkWidget *)lookup_widget(main_window, "MovementSpeedSpinner");
    int inc = gtk_spin_button_get_value_as_int((GtkSpinButton *)speed);
-   int count = 0;
 
    game_life = bstate_get_game_life();
    to_Lx = get_x_from_square(to);
@@ -601,7 +569,9 @@ void fire_arrow(Square sq)
    int x,y;
    GdkPixbuf *arrow_sq;
    GnomeCanvasItem *image;
-   GnomeCanvasGroup *root = GNOME_CANVAS_GROUP(gnome_canvas_root (GNOME_CANVAS (board->canvas)));
+   GnomeCanvasGroup *root = NULL;
+
+   root = GNOME_CANVAS_GROUP(gnome_canvas_root (GNOME_CANVAS (board->canvas)));
 
    x = sq % 10;
    y = sq / 10;
@@ -809,7 +779,6 @@ void register_move_with_engine(Square arrow_sq)
    move movelist[3000];
    int move_count;
    int i;
-   int tocol, torow;
    int found = FALSE;
    char move_str[32];
    char err_msg[256];
@@ -890,9 +859,7 @@ int is_queen_square(Square sq)
 void gen_legal_moves(Square sq)
 {
    int arr_i = 0;
-   int i;
    int row, col, sq_row, sq_col;
-   int scanning;
 
    sq_col = get_x_int_from_square(sq);
    sq_row = get_y_int_from_square(sq);
@@ -1141,7 +1108,7 @@ int game_over()
  *
  * Updates the status bar based on the current value of what_next
  */
-update_status_bar()
+int update_status_bar()
 {
    GtkStatusbar *status = (GtkStatusbar *) lookup_widget(main_window, "statusbar1");
    guint context_id = bstate_get_what_next();
@@ -1175,6 +1142,7 @@ update_status_bar()
 
      }
 
+     return 0;
 }
 
 /*==============================================================================
@@ -1213,8 +1181,6 @@ void print_board()
  */
 void destroy_board()
 {
-   int i;
-   GtkWidget *CNVS_GAMEBOARD, *w, *scrolledwindow4, *table1;
 
 
 #ifdef DEBUG
@@ -1412,7 +1378,7 @@ int read_in_moves(FILE *history_fd)
    int replay_mode = bstate_get_replay_mode();
    int replay_delay = 0;
    int game_life = bstate_get_game_life();
-   GtkWidget *delay;
+   GtkWidget *delay = NULL;
 
    if (replay_mode)
      {
diff --git a/src/callbacks.c b/src/callbacks.c
index df046b1..b2bae83 100644
--- a/src/callbacks.c
+++ b/src/callbacks.c
@@ -18,7 +18,7 @@ extern struct game_states states;
 extern Square legal_moves[100];
 extern int ok;
 extern GtkWidget *main_window;
-extern state_hash;
+extern int state_hash;
 int grabbed_queen;
 GtkWidget *PlayerSettingsWindow;
 extern int moving_ai;
@@ -218,8 +218,6 @@ void
 on_BT_UNDO_clicked                     (GtkButton       *button,
                                         gpointer         user_data)
 {
-   int temp;
-   GtkWidget *undo_button;
    int i;
 
    if (bstate_get_moving_piece())
@@ -351,25 +349,24 @@ int board_press_cb (GnomeCanvasItem *item, GdkEvent *event, gpointer data)
    double new_x, new_y;
    int from_row, from_col, to_row, to_col;
 //   int from;
-   int i,j,k;
-   GtkWidget *auto_button, *undo_button;
+   int k;
    static Square to;
    static Square from;
 
    if (bstate_get_moving_piece())
      {
       //printf("Can't do that while a piece is moving\n");
-      return;
+      return 0;
      }
    if (bstate_get_open_dialog())
      {
       //printf("Can't do that while another window is open\n");
-      return;
+      return 0;
      }
    if (bstate_get_what_next() == NEW_GAME)
      {
       //printf("Can't do that while I'm expecting a new game to start\n");
-      return;
+      return 0;
      }
    if (bstate_get_replay_mode())
       return 0;
@@ -543,7 +540,8 @@ int board_press_cb (GnomeCanvasItem *item, GdkEvent *event, gpointer data)
 	   printf("what_next = %d\n", bstate_get_what_next());
 #endif
 	   break;
-       //default:
+       default:
+	   break;
    }
 
    return 1;
@@ -615,7 +613,8 @@ int arrow_fire_cb(GnomeCanvasItem *item, GdkEvent *event, gpointer data)
 	   dup_state(s, states.s[++(states.current_state)]);
 	   if (bstate_get_what_next() == WAIT_FOR_AI)
 	      move_ai();
-       //default:
+       default:
+	   break;
      }
 
    return 0;
@@ -767,7 +766,6 @@ on_save_as1_activate                   (GtkMenuItem     *menuitem,
                                         gpointer         user_data)
 {
    //char home[256];
-   char *home_env;
 
    if (bstate_get_open_dialog())
       return;
@@ -860,7 +858,6 @@ on_open_activate                       (GtkMenuItem     *menuitem,
                                         gpointer         user_data)
 {
    //char home[256];
-   char *home_env;
 
    if (bstate_get_open_dialog())
       return;
@@ -960,7 +957,6 @@ on_BT_REPLAY_clicked                   (GtkButton       *button,
                                         gpointer         user_data)
 {
    //char home[256];
-   char *home_env;
 
    if (bstate_get_open_dialog())
       return;