summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBradley Smith2008-03-08 00:41:15 +0000
committerBradley Smith2008-03-08 00:41:15 +0000
commit19a9f6592f2ea08a2efdadc8ec08a96cad201720 (patch)
tree0c7435f3a8dd1afdcf86a0d890a36a5aae27073a
parentAdd myself to copyright in changed files, and correct address. (diff)
downloadgnurobots-19a9f6592f2ea08a2efdadc8ec08a96cad201720.tar.gz
Add -Wall and -Wfatal-errors compile flags, and correct code to compile cleanly.
Signed-off-by: Bradley Smith <brad@brad-smith.co.uk>
-rw-r--r--configure.ac2
-rw-r--r--lib/cursesplugin.c7
-rw-r--r--lib/textplugin.c13
-rw-r--r--lib/x11plugin.c12
-rw-r--r--src/grobot.c3
-rw-r--r--src/main.c6
-rw-r--r--src/map.c3
7 files changed, 22 insertions, 24 deletions
diff --git a/configure.ac b/configure.ac
index 9e129e0..3a1b1bc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -162,7 +162,7 @@ AC_CHECK_HEADERS(unistd.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
-CFLAGS="-pedantic-errors -Werror"
+CFLAGS="-pedantic-errors -Werror -Wall -Wfatal-errors"
dnl Done.
AC_CONFIG_FILES([Makefile
diff --git a/lib/cursesplugin.c b/lib/cursesplugin.c
index 872ad15..06b1cba 100644
--- a/lib/cursesplugin.c
+++ b/lib/cursesplugin.c
@@ -124,17 +124,16 @@ curses_plugin_init (GObject * object)
}
static GObject *
-curses_plugin_constructor (GType type,
- guint n_construct_properties,
+curses_plugin_constructor (GType type,
+ guint n_construct_properties,
GObjectConstructParam *construct_properties)
{
GObject *object;
CursesPlugin *curses;
- gint color_pair;
/* Chain up to the parent first */
object = parent_class->constructor (type, n_construct_properties, construct_properties);
-
+
curses = CURSES_PLUGIN (object);
/* Initialize curses mode */
diff --git a/lib/textplugin.c b/lib/textplugin.c
index da08710..61110d5 100644
--- a/lib/textplugin.c
+++ b/lib/textplugin.c
@@ -21,6 +21,7 @@
*/
#include <glib.h>
+#include <glib/gprintf.h>
#include <stdio.h>
#include "configs.h"
#include "textplugin.h"
@@ -127,25 +128,25 @@ text_plugin_init (GObject * object)
}
static GObject *
-text_plugin_constructor (GType type,
- guint n_construct_properties,
+text_plugin_constructor (GType type,
+ guint n_construct_properties,
GObjectConstructParam *construct_properties)
{
GObject *object;
/* Chain up to the parent first */
object = parent_class->constructor (type, n_construct_properties, construct_properties);
-
+
g_printf ("GNU Robots starting..\n");
-
+
return object;
}
-static void
+static void
text_plugin_dispose (GObject * object)
{
TextPlugin *text = TEXT_PLUGIN (object);
-
+
if (text->map != NULL) {
g_object_unref (G_OBJECT (text->map));
diff --git a/lib/x11plugin.c b/lib/x11plugin.c
index 93f0ae5..1459530 100644
--- a/lib/x11plugin.c
+++ b/lib/x11plugin.c
@@ -21,6 +21,7 @@
*/
#include <glib.h>
+#include <glib/gprintf.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -28,6 +29,7 @@
#include "x11plugin.h"
#include <readline.h>
+#include <history.h>
enum
{
@@ -155,7 +157,6 @@ x11_plugin_constructor (GType type,
XWMHints wmhints;
XGCValues values;
Atom delete_win;
- gint x;
/* Chain up to the parent first */
object = parent_class->constructor (type, n_construct_properties, construct_properties);
@@ -613,19 +614,19 @@ inline void x11_update_status (X11Plugin *x11,
XDrawString (x11->dpy, x11->win_buf, x11->gc, 3, x11->map_size->num_rows * TILE_SIZE + 16, s, strlen (s));
if (energy > -1) {
- g_sprintf (status, "Robot Energy: %3d", energy);
+ g_sprintf (status, "Robot Energy: %3ld", energy);
XDrawString (x11->dpy, x11->win_buf, x11->gc, 240, x11->map_size->num_rows * TILE_SIZE + 12, status,
strlen (status));
}
if (score > -1) {
- g_sprintf (status, "Robot Score: %3d", score);
+ g_sprintf (status, "Robot Score: %3ld", score);
XDrawString (x11->dpy, x11->win_buf, x11->gc, 240, x11->map_size->num_rows * TILE_SIZE + 25, status,
strlen (status));
}
if (shields > -1) {
- g_sprintf (status, "Robot Shields: %3d", shields);
+ g_sprintf (status, "Robot Shields: %3ld", shields);
XDrawString (x11->dpy, x11->win_buf, x11->gc, 480, x11->map_size->num_rows * TILE_SIZE + 12, status,
strlen (status));
}
@@ -637,7 +638,6 @@ inline void x11_plugin_update_status (X11Plugin *x11,
glong score,
glong shields)
{
- gint x;
XEvent ev;
x11_update_status (x11, s, energy, score, shields);
@@ -671,8 +671,6 @@ shm_error_handler (X11Plugin *x11, Display * d, XErrorEvent * e)
static void
setup_winbuf (X11Plugin *x11)
{
- gint major, minor;
- Bool shared;
XVisualInfo *matches;
XVisualInfo plate;
gint count;
diff --git a/src/grobot.c b/src/grobot.c
index 03b7e0e..f54224d 100644
--- a/src/grobot.c
+++ b/src/grobot.c
@@ -24,6 +24,9 @@
#include "userinterface.h" /* GNU Robots UI */
#include <stdio.h>
#include <glib.h>
+#include <string.h>
+#include <stdlib.h>
+#include "sign.h"
enum
{
diff --git a/src/main.c b/src/main.c
index 0359ba3..960d8cc 100644
--- a/src/main.c
+++ b/src/main.c
@@ -26,6 +26,7 @@
#include <string.h> /* for strdup */
#include <glib.h>
+#include <glib/gprintf.h>
#include <gmodule.h>
#include <libguile.h>
@@ -61,6 +62,7 @@ GModule *plugin;
UserInterface *load_ui_module (gchar *module_name, Map *map);
SCM catch_handler (void *data, SCM tag, SCM throw_args);
+gint is_file_readable (const gchar *filename);
/************************************************************************
* gint main(gint argc, gchar *argv[]) *
@@ -296,7 +298,6 @@ main (gint argc, gchar *argv[])
void
main_prog (void *closure, gint argc, gchar *argv[])
{
- gint i;
gchar *map_file = argv[1];
gchar *robot_program = argv[2];
gchar *module = argv[3];
@@ -402,13 +403,12 @@ load_ui_module (gchar *module_name, Map *map)
gchar module_full_name[MODULE_NAME_MAX];
gchar module_path[MODULE_PATH_MAX];
gchar *module_full_path;
- gint errors = 0;
const char *path = getenv (MODULE_PATH_ENV);
if (!g_module_supported ())
{
g_printf ("load_ui_module: %s\n", g_module_error ());
- return;
+ return NULL;
}
if (path != NULL)
diff --git a/src/map.c b/src/map.c
index ac47d79..6dd1a28 100644
--- a/src/map.c
+++ b/src/map.c
@@ -270,10 +270,7 @@ map_get_property (GObject *object, guint prop_id,
Map *
map_new_from_file (const gchar *map_file, gint num_rows, gint num_cols)
{
- GObject *object;
Map *map;
- gint **buf;
- guint i;
FILE *stream;
MapSize size;