Fix more c++ compiler warnings
authorColin Clark <colin.clark@cclark.uk>
Wed, 29 Mar 2023 18:27:41 +0000 (19:27 +0100)
committerColin Clark <colin.clark@cclark.uk>
Wed, 29 Mar 2023 18:27:41 +0000 (19:27 +0100)
15 files changed:
src/bar.cc
src/editors.cc
src/keymap-template.cc
src/layout-util.cc
src/main.cc
src/misc.cc
src/misc.h
src/osd.cc
src/osd.h
src/preferences.cc
src/rcfile.cc
src/rcfile.h
src/remote.cc
src/typedefs.h
src/window.cc

index c4f97c8..9e51021 100644 (file)
@@ -33,8 +33,8 @@ typedef struct _KnownPanes KnownPanes;
 struct _KnownPanes
 {
        PaneType type;
-       gchar *id;
-       gchar *title;
+       const gchar *id;
+       const gchar *title;
        const gchar *config;
 };
 
index 2bdd001..44a2295 100644 (file)
@@ -633,7 +633,7 @@ static EditorVerboseData *editor_verbose_window(EditorData *ed, const gchar *tex
        return vd;
 }
 
-static void editor_verbose_window_fill(EditorVerboseData *vd, gchar *text, gint len)
+static void editor_verbose_window_fill(EditorVerboseData *vd, const gchar *text, gint len)
 {
        GtkTextBuffer *buffer;
        GtkTextIter iter;
index d8eec33..fa76939 100644 (file)
@@ -21,7 +21,7 @@
 
 #include <stddef.h>
 
-char *keymap_template [] = {
+const char *keymap_template [] = {
 "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>",
 "<!-- Created with Inkscape (http://www.inkscape.org/) -->",
 "",
index f3319f8..af35e29 100644 (file)
@@ -1214,7 +1214,7 @@ static void layout_menu_changelog_cb(GtkAction *UNUSED(action), gpointer data)
        help_window_show("changelog");
 }
 
-static char *keyboard_map_hardcoded[][2] = {
+static const char *keyboard_map_hardcoded[][2] = {
        {"Scroll","Left"},
        {"FastScroll", "&lt;Shift&gt;Left"},
        {"Left Border", "&lt;Primary&gt;Left"},
@@ -2973,8 +2973,8 @@ static gchar *menu_translate(const gchar *path, gpointer UNUSED(data))
        return (gchar *)(_(path));
 }
 
-static void layout_actions_setup_mark(LayoutWindow *lw, gint mark, gchar *name_tmpl,
-                                     gchar *label_tmpl, gchar *accel_tmpl, gchar *tooltip_tmpl, GCallback cb)
+static void layout_actions_setup_mark(LayoutWindow *lw, gint mark, const gchar *name_tmpl,
+                                     const gchar *label_tmpl, const gchar *accel_tmpl, const gchar *tooltip_tmpl, GCallback cb)
 {
        gchar name[50];
        gchar label[100];
index d7c93c8..0b17662 100644 (file)
@@ -90,7 +90,7 @@ void sig_handler_cb(int signo, siginfo_t *info, void *UNUSED(context))
        struct signals
                {
                gint sig_no;
-               gchar *sig_name;
+               const gchar *sig_name;
                };
        struct signals signals_list[7];
 
index 8031969..d0d8ec3 100644 (file)
@@ -191,7 +191,7 @@ gchar *decode_geo_parameters(const gchar *input_text)
 }
 
 /* Run a command like system() but may output debug messages. */
-int runcmd(gchar *cmd)
+int runcmd(const gchar *cmd)
 {
 #if 1
        return system(cmd);
index c562682..f68d4c2 100644 (file)
@@ -25,7 +25,7 @@ gdouble get_zoom_increment(void);
 gchar *utf8_validate_or_convert(const gchar *text);
 gint utf8_compare(const gchar *s1, const gchar *s2, gboolean case_sensitive);
 gchar *expand_tilde(const gchar *filename);
-int runcmd(gchar *cmd);
+int runcmd(const gchar *cmd);
 gchar *decode_geo_parameters(const gchar *input_text);
 gint date_get_first_day_of_week();
 gchar *date_get_abbreviated_day_name(gint day);
index 8dce377..1e14ef4 100644 (file)
@@ -456,7 +456,7 @@ gchar *image_osd_mkinfo(const gchar *str, FileData *fd, GHashTable *vars)
        return ret;
 }
 
-void osd_template_insert(GHashTable *vars, gchar *keyword, gchar *value, OsdTemplateFlags flags)
+void osd_template_insert(GHashTable *vars, const gchar *keyword, const gchar *value, OsdTemplateFlags flags)
 {
        if (!value)
                {
index 886359e..249e8e6 100644 (file)
--- a/src/osd.h
+++ b/src/osd.h
@@ -29,6 +29,6 @@ typedef enum {
 
 GtkWidget *osd_new(gint max_cols, GtkWidget *template_view);
 gchar *image_osd_mkinfo(const gchar *str, FileData *fd, GHashTable *vars);
-void osd_template_insert(GHashTable *vars, gchar *keyword, gchar *value, OsdTemplateFlags flags);
+void osd_template_insert(GHashTable *vars, const gchar *keyword, const gchar *value, OsdTemplateFlags flags);
 #endif
 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */
index cf2fdaa..ea1fe16 100644 (file)
@@ -523,7 +523,7 @@ static void config_window_help_cb(GtkWidget *UNUSED(widget), gpointer data)
        GtkWidget *notebook = (GtkWidget *)data;
        gint i;
 
-       static gchar *html_section[] =
+       static const gchar *html_section[] =
        {
        "GuideOptionsGeneral.html",
        "GuideOptionsImage.html",
index 9d928a3..0038092 100644 (file)
@@ -274,7 +274,7 @@ gboolean read_int_unit_option(const gchar *option, const gchar *label, const gch
        return TRUE;
 }
 
-void write_bool_option(GString *str, gint UNUSED(indent), gchar *label, gint n)
+void write_bool_option(GString *str, gint UNUSED(indent), const gchar *label, gint n)
 {
        g_string_append_printf(str, "%s = \"%s\" ", label, n ? "true" : "false");
 }
index 7aa1bf9..05d3df1 100644 (file)
@@ -39,7 +39,7 @@ gboolean read_uint_option_clamp(const gchar *option, const gchar *label, const g
 gboolean read_int_option_clamp(const gchar *option, const gchar *label, const gchar *value, gint *n, gint min, gint max);
 void write_int_unit_option(GString *str, gint indent, gchar *label, gint n, gint subunits);
 gboolean read_int_unit_option(const gchar *option, const gchar *label, const gchar *value, gint *n, gint subunits);
-void write_bool_option(GString *str, gint indent, gchar *label, gint n);
+void write_bool_option(GString *str, gint indent, const gchar *label, gint n);
 gboolean read_bool_option(const gchar *option, const gchar *label, const gchar *value, gint *n);
 
 #define WRITE_BOOL(_source_, _name_) write_bool_option(outstr, indent, #_name_, (_source_)._name_)
index c768af5..4b9c3b4 100644 (file)
@@ -1585,13 +1585,13 @@ static void gr_lua(const gchar *text, GIOChannel *channel, gpointer UNUSED(data)
 
 typedef struct _RemoteCommandEntry RemoteCommandEntry;
 struct _RemoteCommandEntry {
-       gchar *opt_s;
-       gchar *opt_l;
+       const gchar *opt_s;
+       const gchar *opt_l;
        void (*func)(const gchar *text, GIOChannel *channel, gpointer data);
        gboolean needs_extra;
        gboolean prefer_command_line;
-       gchar *parameter;
-       gchar *description;
+       const gchar *parameter;
+       const gchar *description;
 };
 
 static RemoteCommandEntry remote_commands[] = {
index e49f65b..7793018 100644 (file)
@@ -1137,7 +1137,7 @@ typedef struct _hard_coded_window_keys hard_coded_window_keys;
 struct _hard_coded_window_keys {
        GdkModifierType mask; /**< modifier key mask */
        guint key_value;  /**< GDK_keyval */
-       gchar *text;  /**< menu item label - NULL if end of list */
+       const gchar *text;  /**< menu item label - NULL if end of list */
 };
 
 #endif
index aeefccf..00d7b6e 100644 (file)
@@ -169,7 +169,7 @@ static int help_browser_command(const gchar *command, const gchar *path)
  *        string   exec string and use results for command line
  *        !string  use text following ! as command line, replacing optional %s with html file path
 */
-static gchar *html_browsers[] =
+static const gchar *html_browsers[] =
 {
        /* Our specific script */
        GQ_APPNAME_LC "_html_browser", NULL,