changeset 135:eadfed7674ac

misc: fix all warnings
author David Demelier <markand@malikania.fr>
date Sun, 11 Oct 2020 15:01:26 +0200
parents 197374e9f0b2
children 30b68089ae70
files examples/example-inventory.c examples/example-message.c examples/example-sound.c libadventure/adventure/panic_state.c libcore/core/inventory_dialog.c libcore/core/inventory_dialog.h libcore/core/maths.c libcore/core/message.c libcore/core/theme.c
diffstat 9 files changed, 28 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/examples/example-inventory.c	Sun Oct 11 14:54:27 2020 +0200
+++ b/examples/example-inventory.c	Sun Oct 11 15:01:26 2020 +0200
@@ -165,6 +165,9 @@
 int
 main(int argc, char **argv)
 {
+	(void)argc;
+	(void)argv;
+
 	init();
 	basic();
 	quit();
--- a/examples/example-message.c	Sun Oct 11 14:54:27 2020 +0200
+++ b/examples/example-message.c	Sun Oct 11 15:01:26 2020 +0200
@@ -127,6 +127,9 @@
 int
 main(int argc, char **argv)
 {
+	(void)argc;
+	(void)argv;
+
 	init();
 	basic();
 	automatic();
--- a/examples/example-sound.c	Sun Oct 11 14:54:27 2020 +0200
+++ b/examples/example-sound.c	Sun Oct 11 15:01:26 2020 +0200
@@ -120,6 +120,9 @@
 int
 main(int argc, char **argv)
 {
+	(void)argc;
+	(void)argv;
+
 	init();
 	run();
 	quit();
--- a/libadventure/adventure/panic_state.c	Sun Oct 11 14:54:27 2020 +0200
+++ b/libadventure/adventure/panic_state.c	Sun Oct 11 15:01:26 2020 +0200
@@ -53,13 +53,13 @@
 } data;
 
 static struct label headers[] = {
-	{ "An unrecoverable error occured and the game cannot continue.", 0 },
-	{ "Please report the detailed error as provided below.", 0 },
+	{ .text = "An unrecoverable error occured and the game cannot continue." },
+	{ .text = "Please report the detailed error as provided below." },
 };
 
 static struct label bottom[] = {
-	{ "Press <s> to save information and generate a core dump.", 0 },
-	{ "Press <q> to quit without saving information.", 0 }
+	{ .text = "Press <s> to save information and generate a core dump." },
+	{ .text = "Press <q> to quit without saving information." }
 };
 
 static struct label lerror;
--- a/libcore/core/inventory_dialog.c	Sun Oct 11 14:54:27 2020 +0200
+++ b/libcore/core/inventory_dialog.c	Sun Oct 11 15:01:26 2020 +0200
@@ -144,8 +144,8 @@
 	int x, y;
 	bool selected;
 
-	for (int r = 0; r < INVENTORY_ROWS_MAX; ++r) {
-		for (int c = 0; c < INVENTORY_COLS_MAX; ++c) {
+	for (unsigned int r = 0; r < INVENTORY_ROWS_MAX; ++r) {
+		for (unsigned int c = 0; c < INVENTORY_COLS_MAX; ++c) {
 			selected = r == dlg->selrow && c == dlg->selcol;
 			compute_box_position(dlg, r, c, &x, &y);
 			draw_grid_item(&dlg->inv->items[r][c], x, y, selected);
@@ -299,6 +299,9 @@
 inventory_dialog_move(struct inventory_dialog *dlg, int x, int y)
 {
 	assert(dlg);
+
+	dlg->x = x;
+	dlg->y = y;
 }
 
 void
--- a/libcore/core/inventory_dialog.h	Sun Oct 11 14:54:27 2020 +0200
+++ b/libcore/core/inventory_dialog.h	Sun Oct 11 15:01:26 2020 +0200
@@ -40,8 +40,8 @@
  * \brief Inventory dialog.
  */
 struct inventory_dialog {
-	int x;                                  /*!< (RO) Position in x. */
-	int y;                                  /*!< (RO) Position in y. */
+	int x;                                  /*!< (RW) Position in x. */
+	int y;                                  /*!< (RW) Position in y. */
 	struct inventory *inv;                  /*!< (RW, ref) Inventory to use. */
 	struct theme *theme;                    /*!< (RW, ref, optional) Theme to use. */
 	struct button bsort;                    /*!< (RO) Button sort. */
--- a/libcore/core/maths.c	Sun Oct 11 14:54:27 2020 +0200
+++ b/libcore/core/maths.c	Sun Oct 11 15:01:26 2020 +0200
@@ -23,8 +23,8 @@
 {
 	return px >= x &&
 	       py >= y &&
-	       px <= x + w &&
-	       py <= y + h;
+	       px <= x + (int)w &&
+	       py <= y + (int)h;
 }
 
 void
--- a/libcore/core/message.c	Sun Oct 11 14:54:27 2020 +0200
+++ b/libcore/core/message.c	Sun Oct 11 15:01:26 2020 +0200
@@ -202,7 +202,7 @@
 		 * The function label_draw will normally use
 		 * THEME_FONT_INTERFACE so update its color if needed.
 		 */
-		if (msg->flags & MESSAGE_QUESTION && msg->index == i)
+		if (msg->flags & MESSAGE_QUESTION && msg->index == (unsigned int)i)
 			label.color = THEME(msg)->colors[THEME_COLOR_SELECTED];
 
 		label_draw(&label);
--- a/libcore/core/theme.c	Sun Oct 11 14:54:27 2020 +0200
+++ b/libcore/core/theme.c	Sun Oct 11 15:01:26 2020 +0200
@@ -55,6 +55,8 @@
 static void
 draw_frame(struct theme *t, const struct frame *frame)
 {
+	(void)t;
+
 	if (frame->style == FRAME_STYLE_BOX)
 		painter_set_color(0x6e4c30ff);
 	else
@@ -108,6 +110,8 @@
 static void
 draw_button(struct theme *t, const struct button *button)
 {
+	(void)t;
+
 	struct label label = {
 		.text = button->text,
 		.x = button->x,
@@ -165,7 +169,7 @@
 
 /* Default font catalog. */
 #define FONT(bin, size, index)                                          \
-        { bin, sizeof (bin), size, &default_theme.fonts[index] }
+	{ bin, sizeof (bin), size, &default_theme.fonts[index], {0} }
 
 static struct font_catalog {
 	const unsigned char *data;