From b936c01ca2fa27e7e632643fa36bd963c7ac36b6 Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Tue, 6 Dec 2011 22:27:44 +0100 Subject: [PATCH] Make const char * string argument In chimara_if_run_game(), the game file argument should be const char *. --- libchimara/chimara-if.c | 8 ++++---- libchimara/chimara-if.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libchimara/chimara-if.c b/libchimara/chimara-if.c index 3879a12..a459ac0 100644 --- a/libchimara/chimara-if.c +++ b/libchimara/chimara-if.c @@ -574,7 +574,7 @@ chimara_if_get_preferred_interpreter(ChimaraIF *self, ChimaraIFFormat format) * case @error is set. */ gboolean -chimara_if_run_game(ChimaraIF *self, gchar *gamefile, GError **error) +chimara_if_run_game(ChimaraIF *self, const char *gamefile, GError **error) { g_return_val_if_fail(self && CHIMARA_IS_IF(self), FALSE); g_return_val_if_fail(gamefile, FALSE); @@ -679,7 +679,7 @@ chimara_if_run_game(ChimaraIF *self, gchar *gamefile, GError **error) } /* Game file and external blorb file */ - args = g_slist_prepend(args, gamefile); + args = g_slist_prepend(args, (gpointer)gamefile); if(priv->graphics_file && (interpreter == CHIMARA_IF_INTERPRETER_FROTZ || interpreter == CHIMARA_IF_INTERPRETER_NITFOL) && g_file_test(priv->graphics_file, G_FILE_TEST_EXISTS)) { @@ -696,7 +696,7 @@ chimara_if_run_game(ChimaraIF *self, gchar *gamefile, GError **error) int count; GSList *ptr; for(count = 0, ptr = args; ptr; count++, ptr = g_slist_next(ptr)) - argv[count] = ptr->data; + argv[count] = g_strdup(ptr->data); /* Set the story name */ /* We peek into ChimaraGlk's private data here, because GObject has no @@ -706,7 +706,7 @@ chimara_if_run_game(ChimaraIF *self, gchar *gamefile, GError **error) g_object_notify(G_OBJECT(self), "story-name"); gboolean retval = chimara_glk_run(CHIMARA_GLK(self), pluginpath, argc, argv, error); - g_free(argv); + g_strfreev(argv); if(terpnumstr) g_free(terpnumstr); if(randomstr) diff --git a/libchimara/chimara-if.h b/libchimara/chimara-if.h index deda647..c0763ee 100644 --- a/libchimara/chimara-if.h +++ b/libchimara/chimara-if.h @@ -116,7 +116,7 @@ GType chimara_if_get_type(void) G_GNUC_CONST; GtkWidget *chimara_if_new(void); void chimara_if_set_preferred_interpreter(ChimaraIF *self, ChimaraIFFormat format, ChimaraIFInterpreter interpreter); ChimaraIFInterpreter chimara_if_get_preferred_interpreter(ChimaraIF *self, ChimaraIFFormat format); -gboolean chimara_if_run_game(ChimaraIF *self, gchar *gamefile, GError **error); +gboolean chimara_if_run_game(ChimaraIF *self, const char *gamefile, GError **error); ChimaraIFFormat chimara_if_get_format(ChimaraIF *self); ChimaraIFInterpreter chimara_if_get_interpreter(ChimaraIF *self); -- 2.30.2