>From 293f98887c17367aa902100d8dcd6238188ec45d Mon Sep 17 00:00:00 2001
From: Matthew Brush <mbrush@codebrainz.ca>
Date: Fri, 28 Oct 2011 12:55:33 -0700
Subject: [PATCH 02/11] gdb: Partial cleanup of warnings

---
 geany-plugins/geanygdb/src/gdb-io-break.c |   26 +++++++-------
 geany-plugins/geanygdb/src/gdb-io-frame.c |   46 +++++++++++++-------------
 geany-plugins/geanygdb/src/gdb-io-priv.h  |   10 +++---
 geany-plugins/geanygdb/src/gdb-io-read.c  |   50 ++++++++++++++++-------------
 geany-plugins/geanygdb/src/gdb-io-run.c   |   32 +++++++++----------
 geany-plugins/geanygdb/src/gdb-io.h       |    4 +-
 geany-plugins/geanygdb/src/gdb-lex.c      |   16 ++++-----
 geany-plugins/geanygdb/src/gdb-lex.h      |   10 +++---
 geany-plugins/geanygdb/src/gdb-ui-envir.c |    2 +-
 geany-plugins/geanygdb/src/gdb-ui-frame.c |    2 +-
 geany-plugins/geanygdb/src/gdb-ui-main.c  |    4 +-
 geany-plugins/geanygdb/src/gdb-ui.h       |    2 +-
 12 files changed, 103 insertions(+), 101 deletions(-)

diff --git a/geany-plugins/geanygdb/src/gdb-io-break.c b/geany-plugins/geanygdb/src/gdb-io-break.c
index aaf012b..1b7d221 100644
--- a/geany-plugins/geanygdb/src/gdb-io-break.c
+++ b/geany-plugins/geanygdb/src/gdb-io-break.c
@@ -99,7 +99,7 @@ breakpoint_cb(gpointer data, gpointer user_data)
 
 
 static void
-parse_break_list(gint seq, gchar ** list, gchar * resp)
+parse_break_list(gint seq, const gchar ** list, const gchar * resp)
 {
 	GHashTable *h = gdbio_get_results(resp, list);
 	HTAB(h, BreakpointTable);
@@ -131,14 +131,14 @@ gdbio_show_breaks(GdbListFunc func)
 	gdbio_break_list_func = func;
 	if (func)
 	{
-		gdbio_send_seq_cmd(parse_break_list, "-break-list\n");
+		gdbio_send_seq_cmd((ResponseHandler) parse_break_list, "-break-list\n");
 	}
 }
 
 
 
 static void
-added_break(gint seq, gchar ** list, gchar * resp)
+added_break(gint seq, const gchar ** list, const gchar * resp)
 {
 	GHashTable *h = gdbio_get_results(resp, list);
 	gdbio_pop_seq(seq);
@@ -209,7 +209,7 @@ void
 gdbio_add_watch(GdbListFunc func, const gchar * option, const gchar * varname)
 {
 	gdbio_break_list_func = func;
-	gdbio_send_seq_cmd(added_break, "-break-watch %s %s\n", option ? option : "", varname);
+	gdbio_send_seq_cmd((ResponseHandler) added_break, "-break-watch %s %s\n", option ? option : "", varname);
 }
 
 
@@ -220,17 +220,17 @@ gdbio_add_break(GdbListFunc func, const gchar * filename, const gchar * locn)
 	gdbio_break_list_func = func;
 	if (filename && *filename)
 	{
-		gdbio_send_seq_cmd(added_break, "-break-insert %s:%s\n", filename, locn);
+		gdbio_send_seq_cmd((ResponseHandler) added_break, "-break-insert %s:%s\n", filename, locn);
 	}
 	else
 	{
-		gdbio_send_seq_cmd(added_break, "-break-insert %s\n", locn);
+		gdbio_send_seq_cmd((ResponseHandler) added_break, "-break-insert %s\n", locn);
 	}
 }
 
 
 static void
-deleted_break(gint seq, gchar ** list, gchar * resp)
+deleted_break(gint seq, const gchar ** list, const gchar * resp)
 {
 	GHashTable *h = gdbio_get_results(resp, list);
 	gdbio_pop_seq(seq);
@@ -248,7 +248,7 @@ deleted_break(gint seq, gchar ** list, gchar * resp)
 
 
 static void
-toggled_break(gint seq, gchar ** list, gchar * resp)
+toggled_break(gint seq, const gchar ** list, const gchar * resp)
 {
 	gdbio_pop_seq(seq);
 	if (strncmp(resp, "^error", 6) == 0)
@@ -286,7 +286,7 @@ toggled_break(gint seq, gchar ** list, gchar * resp)
 
 
 static void
-edited_break(gint seq, gchar ** list, gchar * resp)
+edited_break(gint seq, const gchar ** list, const gchar * resp)
 {
 	GHashTable *h = gdbio_get_results(resp, list);
 	gdbio_pop_seq(seq);
@@ -302,26 +302,26 @@ void
 gdbio_delete_break(GdbListFunc func, const gchar * number)
 {
 	gdbio_break_list_func = func;
-	gdbio_send_seq_cmd(deleted_break, "-break-delete %s\n", number);
+	gdbio_send_seq_cmd((ResponseHandler) deleted_break, "-break-delete %s\n", number);
 }
 
 
 void
 gdbio_enable_break(const gchar * number, gboolean enabled)
 {
-	gdbio_send_seq_cmd(toggled_break, "-break-%s %s\n", enabled ? "enable" : "disable", number);
+	gdbio_send_seq_cmd((ResponseHandler) toggled_break, "-break-%s %s\n", enabled ? "enable" : "disable", number);
 }
 
 
 void
 gdbio_ignore_break(const gchar * number, const gchar * times)
 {
-	gdbio_send_seq_cmd(edited_break, "-break-after %s %s\n", number, times);
+	gdbio_send_seq_cmd((ResponseHandler) edited_break, "-break-after %s %s\n", number, times);
 }
 
 
 void
 gdbio_break_cond(const gchar * number, const gchar * expr)
 {
-	gdbio_send_seq_cmd(edited_break, "-break-condition %s %s\n", number, expr);
+	gdbio_send_seq_cmd((ResponseHandler) edited_break, "-break-condition %s %s\n", number, expr);
 }
diff --git a/geany-plugins/geanygdb/src/gdb-io-frame.c b/geany-plugins/geanygdb/src/gdb-io-frame.c
index 479ffeb..cd4e0e0 100644
--- a/geany-plugins/geanygdb/src/gdb-io-frame.c
+++ b/geany-plugins/geanygdb/src/gdb-io-frame.c
@@ -38,8 +38,8 @@ static gint locals_index = 0;
 static gint args_index = 0;
 static gint *which_index = NULL;
 
-static void var_created(gint seq, gchar ** list, gchar * resp);
-static void got_varlist(gint seq, gchar ** list, gchar * resp);
+static void var_created(gint seq, const gchar ** list, const gchar * resp);
+static void got_varlist(gint seq, const gchar ** list, const gchar * resp);
 
 typedef enum _FrameProcState
 {
@@ -102,20 +102,20 @@ get_arglist()
 {
 	which_list = &current_frame.args;
 	which_index = &args_index;
-	gdbio_send_seq_cmd(got_varlist, "-stack-list-arguments 1 %s %s\n",
+	gdbio_send_seq_cmd((ResponseHandler) got_varlist, "-stack-list-arguments 1 %s %s\n",
 			   current_frame.level, current_frame.level);
 }
 
 
 static void
-create_var(gchar * varname)
+create_var(const gchar * varname)
 {
-	gdbio_send_seq_cmd(var_created, "-var-create x%s * %s\n", varname, varname);
+	gdbio_send_seq_cmd((ResponseHandler) var_created, "-var-create x%s * %s\n", varname, varname);
 }
 
 
 static void
-var_deleted(gint seq, gchar ** list, gchar * resp)
+var_deleted(gint seq, const gchar ** list, const gchar * resp)
 {
 	GdbVar *lv;
 	gdbio_pop_seq(seq);
@@ -146,15 +146,15 @@ var_deleted(gint seq, gchar ** list, gchar * resp)
 
 
 static void
-delete_var(gchar * varname)
+delete_var(const gchar * varname)
 {
-	gdbio_send_seq_cmd(var_deleted, "-var-delete x%s\n", varname);
+	gdbio_send_seq_cmd((ResponseHandler) var_deleted, "-var-delete x%s\n", varname);
 }
 
 
 
 static gchar *
-fmt_val(gchar * value)
+fmt_val(const gchar * value)
 {
 	gchar buf[256];
 	if (!value)
@@ -171,7 +171,7 @@ fmt_val(gchar * value)
 
 
 static void
-var_created(gint seq, gchar ** list, gchar * resp)
+var_created(gint seq, const gchar ** list, const gchar * resp)
 {
 	GHashTable *h = gdbio_get_results(resp, list);
 	HSTR(h, type);
@@ -196,7 +196,7 @@ var_created(gint seq, gchar ** list, gchar * resp)
 
 
 void
-got_varlist(gint seq, gchar ** list, gchar * resp)
+got_varlist(gint seq, const gchar ** list, const gchar * resp)
 {
 	GHashTable *h = gdbio_get_results(resp, list);
 	GSList *hlist = NULL;
@@ -267,7 +267,7 @@ got_varlist(gint seq, gchar ** list, gchar * resp)
 
 
 static void
-got_current_level(gint seq, gchar ** list, gchar * resp)
+got_current_level(gint seq, const gchar ** list, const gchar * resp)
 {
 	GHashTable *h = gdbio_get_results(resp, list);
 	HTAB(h, frame);
@@ -293,23 +293,23 @@ got_current_level(gint seq, gchar ** list, gchar * resp)
 	}
 	if (h)
 		g_hash_table_destroy(h);
-	gdbio_send_seq_cmd(got_varlist, "-stack-list-locals 1\n");
+	gdbio_send_seq_cmd((ResponseHandler) got_varlist, "-stack-list-locals 1\n");
 }
 
 
 static void
-set_current_level(gint seq, gchar ** list, gchar * resp)
+set_current_level(gint seq, const gchar ** list, gchar * resp)
 {
 	gdbio_pop_seq(seq);
-	gdbio_send_seq_cmd(got_current_level, "-stack-info-frame\n");
+	gdbio_send_seq_cmd((ResponseHandler) got_current_level, "-stack-info-frame\n");
 }
 
 void
-gdbio_show_locals(GdbFrameFunc func, gchar * level)
+gdbio_show_locals(GdbFrameFunc func, const gchar * level)
 {
 	free_lists();
 	gdbio_locals_func = func;
-	gdbio_send_seq_cmd(set_current_level, "-stack-select-frame %s\n", level);
+	gdbio_send_seq_cmd((ResponseHandler) set_current_level, "-stack-select-frame %s\n", level);
 }
 
 
@@ -437,7 +437,7 @@ done_top()
 
 
 static void
-object_deleted(gint seq, gchar ** list, gchar * resp)
+object_deleted(gint seq, const gchar ** list, const gchar * resp)
 {
 	GHashTable *h = gdbio_get_results(resp, list);
 	gdbio_pop_seq(seq);
@@ -511,7 +511,7 @@ hash_list_to_var_list(GSList * hlist)
 
 
 static void
-object_listed(gint seq, gchar ** list, gchar * resp)
+object_listed(gint seq, const gchar ** list, const gchar * resp)
 {
 	GHashTable *h = gdbio_get_results(resp, list);
 	gdbio_pop_seq(seq);
@@ -522,7 +522,7 @@ object_listed(gint seq, gchar ** list, gchar * resp)
 		{
 			push_list(hash_list_to_var_list(children));
 		}
-		gdbio_send_seq_cmd(object_deleted, "-var-delete x%s\n", top_var()->name);
+		gdbio_send_seq_cmd((ResponseHandler) object_deleted, "-var-delete x%s\n", top_var()->name);
 		g_hash_table_destroy(h);
 	}
 }
@@ -530,7 +530,7 @@ object_listed(gint seq, gchar ** list, gchar * resp)
 
 
 static void
-object_created(gint seq, gchar ** list, gchar * resp)
+object_created(gint seq,const gchar ** list, const gchar * resp)
 {
 	GHashTable *h = gdbio_get_results(resp, list);
 	gdbio_pop_seq(seq);
@@ -540,7 +540,7 @@ object_created(gint seq, gchar ** list, gchar * resp)
 		if (name)
 		{
 			push_var(hash_val_to_var(h));
-			gdbio_send_seq_cmd(object_listed, "-var-list-children 1 %s\n", name);
+			gdbio_send_seq_cmd((ResponseHandler) object_listed, "-var-list-children 1 %s\n", name);
 		}
 		g_hash_table_destroy(h);
 	}
@@ -554,6 +554,6 @@ gdbio_show_object(GdbObjectFunc func, const gchar * varname)
 	if (func)
 	{
 		push_func(func);
-		gdbio_send_seq_cmd(object_created, "-var-create x%s * %s\n", varname, varname);
+		gdbio_send_seq_cmd((ResponseHandler) object_created, "-var-create x%s * %s\n", varname, varname);
 	}
 }
diff --git a/geany-plugins/geanygdb/src/gdb-io-priv.h b/geany-plugins/geanygdb/src/gdb-io-priv.h
index e22832b..dcb2350 100644
--- a/geany-plugins/geanygdb/src/gdb-io-priv.h
+++ b/geany-plugins/geanygdb/src/gdb-io-priv.h
@@ -52,7 +52,7 @@ void gdbio_pop_seq(gint seq);
   unless the response is an error message, it calls the
   error handler function and then returns NULL.
 */
-GHashTable *gdbio_get_results(gchar * resp, gchar ** list);
+GHashTable *gdbio_get_results(const gchar * resp, const gchar ** list);
 
 /*
 Preprocessor sugar for declaring C variables from hash key names, e.g.
@@ -76,12 +76,12 @@ expands to:
 
 
 
-void gdbio_info_func(gchar * fmt, ...);
-void gdbio_error_func(gchar * fmt, ...);
+void gdbio_info_func(const gchar * fmt, ...);
+void gdbio_error_func(const gchar * fmt, ...);
 void gdbio_do_status(GdbStatus s);
 
 
-void gdbio_target_exited(gchar * reason);
+void gdbio_target_exited(const gchar * reason);
 void gdbio_set_target_pid(GPid pid);
 GPid gdbio_get_target_pid();
 void gdbio_set_running(gboolean running);
@@ -102,4 +102,4 @@ that the number of digits for any possible value *must* be exactly SEQ_LEN.
 void gdbio_consume_response(GString * recv_buf);
 
 void gdbio_set_starting(gboolean s);
-void gdbio_target_started(gint seq, gchar ** list, gchar * resp);
+void gdbio_target_started(gint seq, const gchar ** list, const gchar * resp);
diff --git a/geany-plugins/geanygdb/src/gdb-io-read.c b/geany-plugins/geanygdb/src/gdb-io-read.c
index 4659050..68966ff 100644
--- a/geany-plugins/geanygdb/src/gdb-io-read.c
+++ b/geany-plugins/geanygdb/src/gdb-io-read.c
@@ -35,6 +35,8 @@ static GSList *source_files = NULL;
 static gboolean starting = FALSE;
 
 
+static void handle_response_line(const gchar * str, const gchar ** list);
+
 
 static void
 free_string_list(GSList ** list)
@@ -104,11 +106,10 @@ parse_file_list_cb(gpointer data, gpointer user_data)
 
 
 
-static void handle_response_line(gchar * str, gchar ** list);
 
 
 static void
-handle_response_lines(gchar ** list)
+handle_response_lines(const gchar ** list)
 {
 	if (list)
 	{
@@ -123,7 +124,7 @@ handle_response_lines(gchar ** list)
 
 
 static gboolean
-response_is_error(gchar * resp, gchar ** list)
+response_is_error(const gchar * resp, const gchar ** list)
 {
 	if (strncmp(resp, "^error", 6) == 0)
 	{
@@ -141,7 +142,7 @@ response_is_error(gchar * resp, gchar ** list)
 #define IsDigit g_ascii_isdigit
 
 static void
-parse_process_info(gint seq, gchar ** list, gchar * resp)
+parse_process_info(gint seq, const gchar ** list, const gchar * resp)
 {
 	CHK_RESP_ERR(resp, list);
 	gdbio_pop_seq(seq);
@@ -176,7 +177,7 @@ parse_process_info(gint seq, gchar ** list, gchar * resp)
 
 
 GHashTable *
-gdbio_get_results(gchar * resp, gchar ** list)
+gdbio_get_results(const gchar * resp, const gchar ** list)
 {
 	if (strncmp(resp, "^error", 6) == 0)
 	{
@@ -185,19 +186,22 @@ gdbio_get_results(gchar * resp, gchar ** list)
 			GHashTable *h = gdblx_parse_results(resp + 7);
 			HSTR(h, msg);
 			gchar *tmp = NULL;
+			gchar *tm2 = NULL;
 			if (msg)
 			{
 				if (g_str_equal(msg, "unknown error"))
 				{
-					gint len = g_strv_length(list);
+					gint len = g_strv_length((gchar **) list);
 					if ((len > 1) && list[len - 2] && *list[len - 2])
 					{
-						tmp = list[len - 2];
+						tmp = g_strdup(list[len - 2]);
 						if (tmp[0] == '&')
 						{
 							tmp++;
 						}
-						tmp = g_strcompress(tmp);
+						tmp2 = g_strcompress(tmp);
+						g_free(tmp);
+						tmp = tmp2;
 						g_strstrip(tmp);
 						msg = tmp;
 					}
@@ -226,10 +230,6 @@ gdbio_get_results(gchar * resp, gchar ** list)
 }
 
 
-
-static void handle_response_line(gchar * str, gchar ** list);
-
-
 void
 gdbio_set_starting(gboolean s)
 {
@@ -237,7 +237,7 @@ gdbio_set_starting(gboolean s)
 }
 
 void
-gdbio_target_started(gint seq, gchar ** list, gchar * resp)
+gdbio_target_started(gint seq, const gchar ** list, const gchar * resp)
 {
 	if ((strncmp(resp, "^error", 6) == 0) && (!gdbio_get_target_pid()))
 	{
@@ -253,7 +253,7 @@ gdbio_target_started(gint seq, gchar ** list, gchar * resp)
 
 
 static void
-set_main_break(gint seq, gchar ** list, gchar * resp)
+set_main_break(gint seq, const gchar ** list, const gchar * resp)
 {
 	GHashTable *h = gdbio_get_results(resp, list);
 	HTAB(h, bkpt);
@@ -271,7 +271,7 @@ set_main_break(gint seq, gchar ** list, gchar * resp)
 
 
 void
-gdbio_parse_file_list(gint seq, gchar ** list, gchar * resp)
+gdbio_parse_file_list(gint seq, const gchar ** list, const gchar * resp)
 {
 	GHashTable *h = gdbio_get_results(resp, list);
 	HLST(h, files);
@@ -297,7 +297,7 @@ gdbio_parse_file_list(gint seq, gchar ** list, gchar * resp)
 
 
 static gboolean
-do_step_func(GHashTable * h, gchar * reason)
+do_step_func(GHashTable * h, const gchar * reason)
 {
 	HTAB(h, frame);
 	HSTR(frame, fullname);
@@ -645,13 +645,17 @@ handle_results_hash(GHashTable * h, gchar * rectype, gchar ** list)
 
 
 static void
-handle_response_line(gchar * str, gchar ** list)
+handle_response_line(const gchar * str, const gchar ** list)
 {
-	gchar *rv = str;
-	if (!rv)
+	gchar *rv, *tmp;
+	
+	if (!str)
 	{
 		return;
 	}
+	
+	rv = g_strdup(str);
+	
 	switch (rv[0])
 	{
 		case '~':
@@ -668,9 +672,9 @@ handle_response_line(gchar * str, gchar ** list)
 						rv[len - 2] = '\0';
 					}
 				}
-				rv = g_strcompress(rv);
-				gdbio_info_func(rv);
-				g_free(rv);
+				tmp = g_strcompress(rv);
+				gdbio_info_func(tmp);
+				g_free(tmp);
 				break;
 			}
 		case '^':
@@ -710,6 +714,8 @@ handle_response_line(gchar * str, gchar ** list)
 				break;
 			}
 	}
+	
+	g_free(rv);
 }
 
 
diff --git a/geany-plugins/geanygdb/src/gdb-io-run.c b/geany-plugins/geanygdb/src/gdb-io-run.c
index b6d9749..23be9e5 100644
--- a/geany-plugins/geanygdb/src/gdb-io-run.c
+++ b/geany-plugins/geanygdb/src/gdb-io-run.c
@@ -36,7 +36,7 @@ extern gint g_unlink(const gchar * filename);
 GdbIoSetup gdbio_setup;
 
 
-static gchar *gdbio_args[] = { "gdb", "--interpreter=mi", "-nx", NULL };
+static const gchar *gdbio_args[] = { "gdb", "--interpreter=mi", "-nx", NULL };
 
 static GPid gdbio_pid = 0;
 static GPid target_pid = 0;
@@ -47,7 +47,6 @@ static gint gdbio_in;
 static gint gdbio_out;
 static GIOChannel *gdbio_ch_in;
 static GIOChannel *gdbio_ch_out;
-static guint gdbio_id_in;
 static guint gdbio_id_out;
 
 static GString send_buf = { NULL, 0, 0 };
@@ -132,7 +131,7 @@ gdbio_pop_seq(gint seq)
 }
 
 static gboolean
-gerror(gchar * msg, GError ** err)
+gerror(const gchar * msg, GError ** err)
 {
 	if (*err)
 	{
@@ -165,7 +164,7 @@ gdbio_atoi(gchar * str)
 
 
 void
-gdbio_error_func(gchar * fmt, ...)
+gdbio_error_func(const gchar * fmt, ...)
 {
 	va_list args;
 	gchar *msg;
@@ -185,7 +184,7 @@ gdbio_error_func(gchar * fmt, ...)
 
 
 void
-gdbio_info_func(gchar * fmt, ...)
+gdbio_info_func(const gchar * fmt, ...)
 {
 	va_list args;
 	gchar *msg;
@@ -277,9 +276,9 @@ kill_xterm()
 
 
 static gchar *
-start_xterm(gchar * term_cmd)
+start_xterm(const gchar * term_cmd)
 {
-	gchar *term_args[] = { "xterm", "-title", "Debug terminal", "-e", NULL, NULL, NULL };
+	const gchar *term_args[] = { "xterm", "-title", "Debug terminal", "-e", NULL, NULL, NULL };
 	GError *err = NULL;
 	gint i = 0;
 	gchar *tty_name = NULL;
@@ -353,10 +352,10 @@ start_xterm(gchar * term_cmd)
 	}
 	term_args[i] = gdbio_setup.tty_helper;
 	term_args[i + 1] = xterm_tty_file;
-	all = g_strjoinv("\"  \"", term_args);
+	all = g_strjoinv("\"  \"", (gchar **) term_args);
 	gdbio_info_func("\"%s\"\n", all);
 	g_free(all);
-	if (g_spawn_async(NULL, term_args, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, &xterm_pid, &err))
+	if (g_spawn_async(NULL, (gchar **) term_args, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, &xterm_pid, &err))
 	{
 		gchar *contents = NULL;
 		gsize len;
@@ -535,7 +534,7 @@ send_to_gdb(const gchar *data)
 
 
 void
-gdbio_target_exited(gchar * reason)
+gdbio_target_exited(const gchar * reason)
 {
 	gdbio_info_func(_("Target process exited. (pid=%d; %s%s)\n"), target_pid,
 			reason
@@ -578,7 +577,7 @@ gdbio_pause_target()
 
 
 static void
-target_killed(gint seq, gchar ** list, gchar * resp)
+target_killed(gint seq, const gchar ** list, const gchar * resp)
 {
 	GHashTable *h = gdbio_get_results(resp, list);
 	gdbio_pop_seq(seq);
@@ -611,7 +610,7 @@ gdbio_kill_target(gboolean force)
 		if (!force)
 		{
 			gdbio_info_func(_("Shutting down target program.\n"));
-			gdbio_send_seq_cmd(target_killed, "kill\n");
+			gdbio_send_seq_cmd((ResponseHandler) target_killed, "kill\n");
 			gdbio_wait(250);
 			do_loop();
 		}
@@ -759,10 +758,9 @@ static gboolean
 on_read_from_gdb(GIOChannel * src, GIOCondition cond, gpointer data)
 {
 	gchar buf[1024];
-	GIOStatus st;
 	GError *err = NULL;
 	gsize count;
-	st = g_io_channel_read_chars(src, buf, sizeof(buf) - 1, &count, &err);
+	g_io_channel_read_chars(src, buf, sizeof(buf) - 1, &count, &err);
 	buf[count] = '\0';
 	g_string_append_len(&recv_buf, buf, count);
 	gerror("Error reading response", &err);
@@ -789,7 +787,7 @@ gdbio_load(const gchar * exe_name)
 	gchar **gdbio_env = utils_copy_environment(exclude, "LANG", "C", NULL);
 	const gchar *env_lang = g_getenv("LANG");
 	gdbio_exit();
-	if (g_spawn_async_with_pipes(NULL, gdbio_args, gdbio_env,
+	if (g_spawn_async_with_pipes(NULL, (gchar **) gdbio_args, (gchar **) gdbio_env,
 				     GDB_SPAWN_FLAGS, NULL,
 				     NULL, &gdbio_pid, &gdbio_in, &gdbio_out, NULL, &err))
 	{
@@ -828,7 +826,7 @@ gdbio_load(const gchar * exe_name)
 
 
 void
-gdbio_exec_target(gchar * terminal_command)
+gdbio_exec_target(const gchar * terminal_command)
 {
 	if (terminal_command)
 	{
@@ -847,7 +845,7 @@ gdbio_exec_target(gchar * terminal_command)
 	}
 	gdbio_set_starting(TRUE);
 	gdbio_do_status(GdbStartup);
-	process_token = gdbio_send_seq_cmd(gdbio_target_started, "-exec-run\n");
+	process_token = gdbio_send_seq_cmd((ResponseHandler) gdbio_target_started, "-exec-run\n");
 }
 
 
diff --git a/geany-plugins/geanygdb/src/gdb-io.h b/geany-plugins/geanygdb/src/gdb-io.h
index 4cec977..168ada8 100644
--- a/geany-plugins/geanygdb/src/gdb-io.h
+++ b/geany-plugins/geanygdb/src/gdb-io.h
@@ -133,7 +133,7 @@ void gdbio_return();
   be started first, and the target program will be run
   in the resulting console.
 */
-void gdbio_exec_target(gchar * terminal_command);
+void gdbio_exec_target(const gchar * terminal_command);
 
 
 /* Send SIGINT to target */
@@ -189,7 +189,7 @@ void gdbio_show_stack(GdbListFunc func);
   Passes a GdbFrameInfo pointer and a GSList of GdbVar pointers to func
   representing the state of the local variables at the specified level.
 */
-void gdbio_show_locals(GdbFrameFunc func, gchar * level);
+void gdbio_show_locals(GdbFrameFunc func, const gchar * level);
 
 
 /*
diff --git a/geany-plugins/geanygdb/src/gdb-lex.c b/geany-plugins/geanygdb/src/gdb-lex.c
index d91349d..38dbbda 100644
--- a/geany-plugins/geanygdb/src/gdb-lex.c
+++ b/geany-plugins/geanygdb/src/gdb-lex.c
@@ -79,7 +79,7 @@ init_scanner()
 {
 	GScanner *scanner = g_scanner_new(NULL);
 	scanner->msg_handler = scan_error;
-	scanner->config->cset_identifier_nth = ID_NTH;
+	scanner->config->cset_identifier_nth = (gchar *) ID_NTH;
 	return scanner;
 }
 
@@ -129,10 +129,9 @@ add_node(GScanner * scanner, gchar ** key, GdbLxValueType type, gpointer data, G
 static GScanner *scanner = NULL;
 
 GHashTable *
-gdblx_parse_results(gchar * results)
+gdblx_parse_results(const gchar * results)
 {
 	gchar *key = NULL;
-	gboolean equals = FALSE;
 	GHashTable *rv = new_hash();
 	GdbLxValue *top = new_value(vt_HASH, rv);
 	GQueue *queue = g_queue_new();
@@ -204,7 +203,6 @@ gdblx_parse_results(gchar * results)
 			default:
 				{
 				}
-				equals = (tt == G_TOKEN_EQUAL_SIGN);
 		}
 	}
 	while ((tt != G_TOKEN_EOF) && (tt != G_TOKEN_ERROR));
@@ -310,21 +308,21 @@ gdblx_dump_table(GHashTable * hash)
 
 
 static GdbLxValue *
-find_value(GHashTable * hash, gchar * key, GdbLxValueType type)
+find_value(GHashTable * hash, const gchar * key, GdbLxValueType type)
 {
 	GdbLxValue *v = hash ? g_hash_table_lookup(hash, key) : NULL;
 	return v && v->type == type ? v : NULL;
 }
 
 gchar *
-gdblx_lookup_string(GHashTable * hash, gchar * key)
+gdblx_lookup_string(GHashTable * hash, const gchar * key)
 {
 	GdbLxValue *v = find_value(hash, key, vt_STRING);
 	return v ? v->string : NULL;
 }
 
 GHashTable *
-gdblx_lookup_hash(GHashTable * hash, gchar * key)
+gdblx_lookup_hash(GHashTable * hash, const gchar * key)
 {
 	GdbLxValue *v = find_value(hash, key, vt_HASH);
 	return v ? v->hash : NULL;
@@ -332,7 +330,7 @@ gdblx_lookup_hash(GHashTable * hash, gchar * key)
 
 
 GSList *
-gdblx_lookup_list(GHashTable * hash, gchar * key)
+gdblx_lookup_list(GHashTable * hash, const gchar * key)
 {
 	GdbLxValue *v = find_value(hash, key, vt_LIST);
 	return v ? v->list : NULL;
@@ -341,7 +339,7 @@ gdblx_lookup_list(GHashTable * hash, gchar * key)
 
 /* True if key exists, it's a string, and its value matches 'expected' */
 gboolean
-gdblx_check_keyval(GHashTable * hash, gchar * key, gchar * expected)
+gdblx_check_keyval(GHashTable * hash, const gchar * key, const gchar * expected)
 {
 	gchar *value = gdblx_lookup_string(hash, key);
 	return value && g_str_equal(value, expected);
diff --git a/geany-plugins/geanygdb/src/gdb-lex.h b/geany-plugins/geanygdb/src/gdb-lex.h
index 969744c..23c9910 100644
--- a/geany-plugins/geanygdb/src/gdb-lex.h
+++ b/geany-plugins/geanygdb/src/gdb-lex.h
@@ -47,22 +47,22 @@ typedef struct
 
 
 
-GHashTable *gdblx_parse_results(gchar * resutls);
+GHashTable *gdblx_parse_results(const gchar * resutls);
 
 /*
   The gdblx_lookup_* functions below return NULL if their hash is NULL,
   if the key is not found, or if its value is not of the expected
   return type.
 */
-gchar *gdblx_lookup_string(GHashTable * hash, gchar * key);
-GHashTable *gdblx_lookup_hash(GHashTable * hash, gchar * key);
-GSList *gdblx_lookup_list(GHashTable * hash, gchar * key);
+gchar *gdblx_lookup_string(GHashTable * hash, const gchar * key);
+GHashTable *gdblx_lookup_hash(GHashTable * hash, const gchar * key);
+GSList *gdblx_lookup_list(GHashTable * hash, const gchar * key);
 
 /*
   Returns TRUE if hash is not NULL, key exists, and key type is vt_STRING,
   and the key's value matches 'expected'.
 */
-gboolean gdblx_check_keyval(GHashTable * hash, gchar * key, gchar * expected);
+gboolean gdblx_check_keyval(GHashTable * hash, const gchar * key, const gchar * expected);
 
 
 /* Dumps a pretty-printed representation of the hash table to stderr */
diff --git a/geany-plugins/geanygdb/src/gdb-ui-envir.c b/geany-plugins/geanygdb/src/gdb-ui-envir.c
index 177e893..fd252b6 100644
--- a/geany-plugins/geanygdb/src/gdb-ui-envir.c
+++ b/geany-plugins/geanygdb/src/gdb-ui-envir.c
@@ -27,7 +27,7 @@
 
 
 static GtkWidget *
-newlabel(gchar * s)
+newlabel(const gchar * s)
 {
 	GtkWidget *w = gtk_label_new(s);
 	gtk_misc_set_alignment(GTK_MISC(w), 0.0f, 0.0f);
diff --git a/geany-plugins/geanygdb/src/gdb-ui-frame.c b/geany-plugins/geanygdb/src/gdb-ui-frame.c
index 2649454..ce38580 100644
--- a/geany-plugins/geanygdb/src/gdb-ui-frame.c
+++ b/geany-plugins/geanygdb/src/gdb-ui-frame.c
@@ -160,7 +160,7 @@ gdbui_new_dialog(gchar * title)
 
 
 static void
-monospace(GtkWidget * label, gchar * line, gchar * text)
+monospace(GtkWidget * label, const gchar * line, const gchar * text)
 {
 	gchar *esc = g_markup_escape_text(text, -1);
 	gchar *mu;
diff --git a/geany-plugins/geanygdb/src/gdb-ui-main.c b/geany-plugins/geanygdb/src/gdb-ui-main.c
index 3ef416c..93c8d77 100644
--- a/geany-plugins/geanygdb/src/gdb-ui-main.c
+++ b/geany-plugins/geanygdb/src/gdb-ui-main.c
@@ -375,7 +375,7 @@ pipe_click(GtkWidget * w, gpointer user_data)
 
 
 void
-gdbui_set_tip(GtkWidget * w, gchar * tip)
+gdbui_set_tip(GtkWidget * w, const gchar * tip)
 {
 	if (gdbui_setup.options.show_tooltips)
 	{
@@ -390,7 +390,7 @@ gdbui_set_tip(GtkWidget * w, gchar * tip)
 static const gboolean disable_mnemonics = TRUE;
 
 static GtkWidget *
-make_btn(const gchar *text, GtkCallback cb, gchar *img, gchar *tip)
+make_btn(const gchar *text, GtkCallback cb, const gchar *img, const gchar *tip)
 {
 	GtkWidget *button;
 
diff --git a/geany-plugins/geanygdb/src/gdb-ui.h b/geany-plugins/geanygdb/src/gdb-ui.h
index c3a258c..78dfd3a 100644
--- a/geany-plugins/geanygdb/src/gdb-ui.h
+++ b/geany-plugins/geanygdb/src/gdb-ui.h
@@ -71,7 +71,7 @@ GtkWidget *gdbui_create_widgets(GtkWidget * parent);
 void gdbui_create_menu(GtkWidget * parent);
 void gdbui_create_dview(GtkWidget * parent);
 
-void gdbui_set_tip(GtkWidget * w, gchar * tip);
+void gdbui_set_tip(GtkWidget * w, const gchar * tip);
 void gdbui_enable(gboolean enabled);
 
 GtkWidget *gdbui_new_dialog(gchar * title);
-- 
1.7.6.3

