Fix c++ compiler warnings
authorColin Clark <colin.clark@cclark.uk>
Sun, 2 Apr 2023 09:16:00 +0000 (10:16 +0100)
committerColin Clark <colin.clark@cclark.uk>
Sun, 2 Apr 2023 09:16:00 +0000 (10:16 +0100)
const gchar * casts

32 files changed:
src/advanced-exif.cc
src/bar-exif.cc
src/bar-gps.cc
src/bar-keywords.cc
src/collect-table.cc
src/dnd.cc
src/dupe.cc
src/image-load-collection.cc
src/image-load-cr3.cc
src/image-load-dds.cc
src/image-load-djvu.cc
src/image-load-external.cc
src/image-load-ffmpegthumbnailer.cc
src/image-load-heif.cc
src/image-load-j2k.cc
src/image-load-jpeg.cc
src/image-load-jpegxl.cc
src/image-load-pdf.cc
src/image-load-psd.cc
src/image-load-svgz.cc
src/image-load-tiff.cc
src/image-load-zxscr.cc
src/osd.cc
src/preferences.cc
src/rcfile.h
src/search.cc
src/toolbar.cc
src/typedefs.h
src/ui-bookmark.cc
src/ui-pathsel.cc
src/utilops.cc
src/view-dir.cc

index 4c77bb7..90a80d3 100644 (file)
@@ -178,7 +178,7 @@ void advanced_exif_set_fd(GtkWidget *window, FileData *fd)
 }
 
 static GtkTargetEntry advanced_exif_drag_types[] = {
-       { "text/plain", 0, TARGET_TEXT_PLAIN }
+       { const_cast<gchar *>("text/plain"), 0, TARGET_TEXT_PLAIN }
 };
 static gint n_exif_drag_types = 1;
 
index 7483686..b48dfe7 100644 (file)
@@ -341,14 +341,14 @@ static void bar_pane_exif_notify_cb(FileData *fd, NotifyType type, gpointer data
  */
 
 static GtkTargetEntry bar_pane_exif_drag_types[] = {
-       { TARGET_APP_EXIF_ENTRY_STRING, GTK_TARGET_SAME_APP, TARGET_APP_EXIF_ENTRY },
-       { "text/plain", 0, TARGET_TEXT_PLAIN }
+       { const_cast<gchar *>(TARGET_APP_EXIF_ENTRY_STRING), GTK_TARGET_SAME_APP, TARGET_APP_EXIF_ENTRY },
+       { const_cast<gchar *>("text/plain"), 0, TARGET_TEXT_PLAIN }
 };
 static gint n_exif_entry_drag_types = 2;
 
 static GtkTargetEntry bar_pane_exif_drop_types[] = {
        { TARGET_APP_EXIF_ENTRY_STRING, GTK_TARGET_SAME_APP, TARGET_APP_EXIF_ENTRY },
-       { "text/plain", 0, TARGET_TEXT_PLAIN }
+       { const_cast<gchar *>("text/plain"), 0, TARGET_TEXT_PLAIN }
 };
 static gint n_exif_entry_drop_types = 2;
 
index c93fbd0..5eeae23 100644 (file)
@@ -94,8 +94,8 @@ enum {
 };
 
 static GtkTargetEntry bar_pane_gps_drop_types[] = {
-       { "text/uri-list", 0, TARGET_URI_LIST },
-       { "text/plain", 0, TARGET_TEXT_PLAIN }
+       { const_cast<gchar *>("text/uri-list"), 0, TARGET_URI_LIST },
+       { const_cast<gchar *>("text/plain"), 0, TARGET_TEXT_PLAIN }
 };
 static gint n_gps_entry_drop_types = 2;
 
index 709032d..41ffea4 100644 (file)
@@ -526,14 +526,14 @@ static void bar_pane_keywords_changed(GtkTextBuffer *UNUSED(buffer), gpointer da
 
 static GtkTargetEntry bar_pane_keywords_drag_types[] = {
        { TARGET_APP_KEYWORD_PATH_STRING, GTK_TARGET_SAME_WIDGET, TARGET_APP_KEYWORD_PATH },
-       { "text/plain", 0, TARGET_TEXT_PLAIN }
+       { const_cast<gchar *>("text/plain"), 0, TARGET_TEXT_PLAIN }
 };
 static gint n_keywords_drag_types = 2;
 
 
 static GtkTargetEntry bar_pane_keywords_drop_types[] = {
        { TARGET_APP_KEYWORD_PATH_STRING, GTK_TARGET_SAME_WIDGET, TARGET_APP_KEYWORD_PATH },
-       { "text/plain", 0, TARGET_TEXT_PLAIN }
+       { const_cast<gchar *>("text/plain"), 0, TARGET_TEXT_PLAIN }
 };
 static gint n_keywords_drop_types = 2;
 
index 6a28730..f374d91 100644 (file)
@@ -2249,14 +2249,14 @@ static GtkWidget *collection_table_drop_menu(CollectTable *ct)
 
 static GtkTargetEntry collection_drag_types[] = {
        { TARGET_APP_COLLECTION_MEMBER_STRING, 0, TARGET_APP_COLLECTION_MEMBER },
-       { "text/uri-list", 0, TARGET_URI_LIST },
-       { "text/plain", 0, TARGET_TEXT_PLAIN }
+       { const_cast<gchar *>("text/uri-list"), 0, TARGET_URI_LIST },
+       { const_cast<gchar *>("text/plain"), 0, TARGET_TEXT_PLAIN }
 };
 static gint n_collection_drag_types = 3;
 
 static GtkTargetEntry collection_drop_types[] = {
        { TARGET_APP_COLLECTION_MEMBER_STRING, 0, TARGET_APP_COLLECTION_MEMBER },
-       { "text/uri-list", 0, TARGET_URI_LIST }
+       { const_cast<gchar *>("text/uri-list"), 0, TARGET_URI_LIST }
 };
 static gint n_collection_drop_types = 2;
 
index 22536b0..861fe86 100644 (file)
 
 
 GtkTargetEntry dnd_file_drag_types[] = {
-       { "text/uri-list", 0, TARGET_URI_LIST },
-       { "text/plain", 0, TARGET_TEXT_PLAIN }
+       { const_cast<gchar *>("text/uri-list"), 0, TARGET_URI_LIST },
+       { const_cast<gchar *>("text/plain"), 0, TARGET_TEXT_PLAIN }
 };
 gint dnd_file_drag_types_count = 2;
 
 GtkTargetEntry dnd_file_drop_types[] = {
        { TARGET_APP_COLLECTION_MEMBER_STRING, 0, TARGET_APP_COLLECTION_MEMBER },
-       { "text/uri-list", 0, TARGET_URI_LIST },
-       { "text/plain", 0, TARGET_TEXT_PLAIN },
+       { const_cast<gchar *>("text/uri-list"), 0, TARGET_URI_LIST },
+       { const_cast<gchar *>("text/plain"), 0, TARGET_TEXT_PLAIN },
 };
 gint dnd_file_drop_types_count = 3;
 
index 4e55413..d3bd9b1 100644 (file)
@@ -4946,14 +4946,14 @@ static GtkWidget *dupe_confirm_dir_list(DupeWindow *dw, GList *list)
  */
 
 static GtkTargetEntry dupe_drag_types[] = {
-       { "text/uri-list", 0, TARGET_URI_LIST },
-       { "text/plain", 0, TARGET_TEXT_PLAIN }
+       { const_cast<gchar *>("text/uri-list"), 0, TARGET_URI_LIST },
+       { const_cast<gchar *>("text/plain"), 0, TARGET_TEXT_PLAIN }
 };
 static gint n_dupe_drag_types = 2;
 
 static GtkTargetEntry dupe_drop_types[] = {
        { TARGET_APP_COLLECTION_MEMBER_STRING, 0, TARGET_APP_COLLECTION_MEMBER },
-       { "text/uri-list", 0, TARGET_URI_LIST }
+       { const_cast<gchar *>("text/uri-list"), 0, TARGET_URI_LIST }
 };
 static gint n_dupe_drop_types = 2;
 
@@ -5349,8 +5349,8 @@ static void pop_menu_export(GList *UNUSED(selection_list), gpointer dupe_window,
 {
        const gint index = GPOINTER_TO_INT(data);
        DupeWindow *dw = static_cast<DupeWindow *>(dupe_window);
-       gchar *title = "Export duplicates data";
-       gchar *default_path = "/tmp/";
+       const gchar *title = "Export duplicates data";
+       const gchar *default_path = "/tmp/";
        gchar *file_extension;
        const gchar *stock_id;
        ExportDupesData *edd;
index 81f99bd..7c0935e 100644 (file)
@@ -143,7 +143,7 @@ static gchar* image_loader_collection_get_format_name(gpointer UNUSED(loader))
 }
 static gchar** image_loader_collection_get_format_mime_types(gpointer UNUSED(loader))
 {
-       static gchar *mime[] = {"image/png", NULL};
+       static const gchar *mime[] = {"image/png", NULL};
        return g_strdupv(mime);
 }
 
index 8788c55..b5d18c5 100644 (file)
@@ -484,7 +484,7 @@ static gchar* image_loader_cr3_get_format_name(gpointer UNUSED(loader))
 }
 static gchar** image_loader_cr3_get_format_mime_types(gpointer UNUSED(loader))
 {
-       static gchar *mime[] = {"image/x-canon-cr3", NULL};
+       static const gchar *mime[] = {"image/x-canon-cr3", NULL};
        return g_strdupv(mime);
 }
 
index 361e1b6..0192516 100644 (file)
@@ -587,7 +587,7 @@ static gchar* image_loader_dds_get_format_name(gpointer UNUSED(loader))
 }
 static gchar** image_loader_dds_get_format_mime_types(gpointer UNUSED(loader))
 {
-       static gchar *mime[] = {"image/vnd-ms.dds", NULL};
+       static const gchar *mime[] = {"image/vnd-ms.dds", NULL};
        return g_strdupv(mime);
 }
 
index 6fdb20b..9f63cfe 100644 (file)
@@ -143,7 +143,7 @@ static gchar* image_loader_djvu_get_format_name(gpointer UNUSED(loader))
 
 static gchar** image_loader_djvu_get_format_mime_types(gpointer UNUSED(loader))
 {
-       static gchar *mime[] = {"image/vnd.djvu", NULL};
+       static const gchar *mime[] = {"image/vnd.djvu", NULL};
        return g_strdupv(mime);
 }
 
index 40a234e..46cd31b 100644 (file)
@@ -97,7 +97,7 @@ static gchar* image_loader_external_get_format_name(gpointer UNUSED(loader))
 
 static gchar** image_loader_external_get_format_mime_types(gpointer UNUSED(loader))
 {
-       static gchar *mime[] = {"application/octet-stream", NULL};
+       static const gchar *mime[] = {"application/octet-stream", NULL};
        return g_strdupv(mime);
 }
 
index 58fe950..bc78e85 100644 (file)
@@ -66,7 +66,7 @@ static gchar* image_loader_ft_get_format_name(gpointer UNUSED(loader))
 
 static gchar** image_loader_ft_get_format_mime_types(gpointer UNUSED(loader))
 {
-       static gchar *mime[] = {"video/mp4", NULL};
+       static const gchar *mime[] = {"video/mp4", NULL};
        return g_strdupv(mime);}
 
 static gpointer image_loader_ft_new(ImageLoaderBackendCbAreaUpdated area_updated_cb, ImageLoaderBackendCbSize size_cb, ImageLoaderBackendCbAreaPrepared area_prepared_cb, gpointer data)
index c877e5a..a0b4938 100644 (file)
@@ -142,7 +142,7 @@ static gchar* image_loader_heif_get_format_name(gpointer UNUSED(loader))
 
 static gchar** image_loader_heif_get_format_mime_types(gpointer UNUSED(loader))
 {
-       static gchar *mime[] = {"image/heic", NULL};
+       static const gchar *mime[] = {"image/heic", NULL};
        return g_strdupv(mime);
 }
 
index 2da2ef2..7b022f1 100644 (file)
@@ -310,7 +310,7 @@ static gchar* image_loader_j2k_get_format_name(gpointer UNUSED(loader))
 
 static gchar** image_loader_j2k_get_format_mime_types(gpointer UNUSED(loader))
 {
-       static gchar *mime[] = {"image/jp2", NULL};
+       static const gchar *mime[] = {"image/jp2", NULL};
        return g_strdupv(mime);
 }
 
index abfe6b1..86e7938 100644 (file)
@@ -446,7 +446,7 @@ static gchar* image_loader_jpeg_get_format_name(gpointer UNUSED(loader))
 }
 static gchar** image_loader_jpeg_get_format_mime_types(gpointer UNUSED(loader))
 {
-       static gchar *mime[] = {"image/jpeg", NULL};
+       static const gchar *mime[] = {"image/jpeg", NULL};
        return g_strdupv(mime);
 }
 
index 1f3edfc..969fa0c 100644 (file)
@@ -211,7 +211,7 @@ static gchar* image_loader_jpegxl_get_format_name(gpointer loader)
 
 static gchar** image_loader_jpegxl_get_format_mime_types(gpointer loader)
 {
-       static gchar *mime[] = {"image/jxl", NULL};
+       static const gchar *mime[] = {"image/jxl", NULL};
        return g_strdupv(mime);
 }
 
index 63dded9..4ad52bb 100644 (file)
@@ -123,7 +123,7 @@ static gchar* image_loader_pdf_get_format_name(gpointer UNUSED(loader))
 
 static gchar** image_loader_pdf_get_format_mime_types(gpointer UNUSED(loader))
 {
-       static gchar *mime[] = {"application/pdf", NULL};
+       static const gchar *mime[] = {"application/pdf", NULL};
        return g_strdupv(mime);
 }
 
index 2af9e60..611cd33 100644 (file)
@@ -557,7 +557,7 @@ static gchar* image_loader_psd_get_format_name(gpointer UNUSED(loader))
 
 static gchar** image_loader_psd_get_format_mime_types(gpointer UNUSED(loader))
 {
-       static gchar *mime[] = {"application/psd", NULL};
+       static const gchar *mime[] = {"application/psd", NULL};
        return g_strdupv(mime);
 }
 
index 0f02422..0ade737 100644 (file)
@@ -30,7 +30,7 @@ static gchar* image_loader_svgz_get_format_name(gpointer UNUSED(loader))
 }
 static gchar** image_loader_svgz_get_format_mime_types(gpointer UNUSED(loader))
 {
-       static gchar *mime[] = {"image/svg", NULL};
+       static const gchar *mime[] = {"image/svg", NULL};
        return g_strdupv(mime);
 }
 
index 6f9844f..9bc95f0 100644 (file)
@@ -359,7 +359,7 @@ static gchar* image_loader_tiff_get_format_name(gpointer UNUSED(loader))
 }
 static gchar** image_loader_tiff_get_format_mime_types(gpointer UNUSED(loader))
 {
-       static gchar *mime[] = {"image/tiff", NULL};
+       static const gchar *mime[] = {"image/tiff", NULL};
        return g_strdupv(mime);
 }
 
index f3a4a8c..0bb3e9f 100644 (file)
@@ -174,7 +174,7 @@ static gchar *image_loader_zxscr_get_format_name(gpointer UNUSED(loader))
 
 static gchar **image_loader_zxscr_get_format_mime_types(gpointer UNUSED(loader))
 {
-       static gchar *mime[] = {"application/octet-stream", NULL};
+       static const gchar *mime[] = {"application/octet-stream", NULL};
        return g_strdupv(mime);
 }
 
index c7f3e49..08f6079 100644 (file)
@@ -81,7 +81,7 @@ static const gchar *predefined_tags[][2] = {
        {NULL, NULL}};
 
 static GtkTargetEntry osd_drag_types[] = {
-       { "text/plain", GTK_TARGET_SAME_APP, TARGET_TEXT_PLAIN }
+       { const_cast<gchar *>("text/plain"), GTK_TARGET_SAME_APP, TARGET_TEXT_PLAIN }
 };
 
 typedef struct _TagData TagData;
index 5dfb5cc..bc801aa 100644 (file)
@@ -120,7 +120,7 @@ enum {
        FILETYPES_COLUMN_COUNT
 };
 
-gchar *format_class_list[] = {
+const gchar *format_class_list[] = {
        N_("Unknown"),
        N_("Image"),
        N_("RAW Image"),
@@ -772,9 +772,9 @@ static void add_zoom_style_selection_menu(GtkWidget *table, gint column, gint ro
 typedef struct _UseableMouseItems UseableMouseItems;
 struct _UseableMouseItems
 {
-       gchar *name; /* GtkActionEntry terminology */
-       gchar *label;
-       gchar *stock_id;
+       const gchar *name; /* GtkActionEntry terminology */
+       const gchar *label;
+       const gchar *stock_id;
 };
 
 static const UseableMouseItems useable_mouse_items[] = {
index 05d3df1..729f366 100644 (file)
@@ -37,7 +37,7 @@ void write_uint_option(GString *str, gint indent, const gchar *label, guint n);
 gboolean read_uint_option(const gchar *option, const gchar *label, const gchar *value, guint *n);
 gboolean read_uint_option_clamp(const gchar *option, const gchar *label, const gchar *value, guint *n, guint min, guint max);
 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);
+void write_int_unit_option(GString *str, gint indent, const 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, const gchar *label, gint n);
 gboolean read_bool_option(const gchar *option, const gchar *label, const gchar *value, gint *n);
index d8e1691..2bc56a0 100644 (file)
@@ -1491,14 +1491,14 @@ static gboolean search_window_keypress_cb(GtkWidget *UNUSED(widget), GdkEventKey
  */
 
 static GtkTargetEntry result_drag_types[] = {
-       { "text/uri-list", 0, TARGET_URI_LIST },
-       { "text/plain", 0, TARGET_TEXT_PLAIN }
+       { const_cast<gchar *>("text/uri-list"), 0, TARGET_URI_LIST },
+       { const_cast<gchar *>("text/plain"), 0, TARGET_TEXT_PLAIN }
 };
 static gint n_result_drag_types = 2;
 
 static GtkTargetEntry result_drop_types[] = {
-       { "text/uri-list", 0, TARGET_URI_LIST },
-       { "text/plain", 0, TARGET_TEXT_PLAIN }
+       { const_cast<gchar *>("text/uri-list"), 0, TARGET_URI_LIST },
+       { const_cast<gchar *>("text/plain"), 0, TARGET_TEXT_PLAIN }
 };
 static gint n_result_drop_types = 2;
 
index a3c2962..cf93059 100644 (file)
@@ -50,8 +50,8 @@ struct _ToolbarButtonData
        GtkWidget *button_label;
        GtkWidget *image;
 
-       gchar *name; /* GtkActionEntry terminology */
-       gchar *stock_id;
+       const gchar *name; /* GtkActionEntry terminology */
+       const gchar *stock_id;
 };
 
 static ToolbarData *toolbarlist[2];
@@ -59,9 +59,9 @@ static ToolbarData *toolbarlist[2];
 typedef struct _UseableToolbarItems UseableToolbarItems;
 struct _UseableToolbarItems
 {
-       gchar *name; /* GtkActionEntry terminology */
-       gchar *label;
-       gchar *stock_id;
+       const gchar *name; /* GtkActionEntry terminology */
+       const gchar *label;
+       const gchar *stock_id;
 };
 
 /** @FIXME Should be created by program from menu_entries[]
index 7793018..2c7e6b3 100644 (file)
@@ -169,7 +169,7 @@ typedef enum {
        FILE_FORMAT_CLASSES
 } FileFormatClass;
 
-extern gchar *format_class_list[]; /**< defined in preferences.cc */
+extern const gchar *format_class_list[]; /**< defined in preferences.cc */
 
 /**
  * @typedef SecureSaveErrno
index 61267a0..f8ef298 100644 (file)
@@ -93,15 +93,15 @@ enum {
 };
 
 static GtkTargetEntry bookmark_drop_types[] = {
-       { "text/uri-list", 0, TARGET_URI_LIST },
+       { const_cast<gchar *>("text/uri-list"), 0, TARGET_URI_LIST },
        { "x-url/http",    0, TARGET_X_URL },
        { "_NETSCAPE_URL", 0, TARGET_X_URL }
 };
 #define bookmark_drop_types_n 3
 
 static GtkTargetEntry bookmark_drag_types[] = {
-       { "text/uri-list", 0, TARGET_URI_LIST },
-       { "text/plain",    0, TARGET_TEXT_PLAIN }
+       { const_cast<gchar *>("text/uri-list"), 0, TARGET_URI_LIST },
+       { const_cast<gchar *>("text/plain"),    0, TARGET_TEXT_PLAIN }
 };
 #define bookmark_drag_types_n 2
 
index 35ce43f..ba8dbd7 100644 (file)
@@ -317,8 +317,8 @@ enum {
 };
 
 static GtkTargetEntry dest_drag_types[] = {
-       { "text/uri-list", 0, TARGET_URI_LIST },
-       { "text/plain",    0, TARGET_TEXT_PLAIN }
+       { const_cast<gchar *>("text/uri-list"), 0, TARGET_URI_LIST },
+       { const_cast<gchar *>("text/plain"),    0, TARGET_TEXT_PLAIN }
 };
 #define dest_drag_types_n 2
 
index 57e9181..ab31bb6 100644 (file)
@@ -41,8 +41,8 @@ static GdkPixbuf *file_util_get_error_icon(FileData *fd, GList *list, GtkWidget
 
 static GtkTargetEntry target_types[] =
 {
-       {(gchar *)"text/plain", 0, CLIPBOARD_TEXT_PLAIN},
-       {(gchar *)"text/uri-list", 0, CLIPBOARD_TEXT_URI_LIST},
+       {(gchar *)const_cast<gchar *>("text/plain"), 0, CLIPBOARD_TEXT_PLAIN},
+       {(gchar *)const_cast<gchar *>("text/uri-list"), 0, CLIPBOARD_TEXT_URI_LIST},
        {(gchar *)"x-special/gnome-copied-files", 0, CLIPBOARD_X_SPECIAL_GNOME_COPIED_FILES},
        {(gchar *)"UTF8_STRING", 0, CLIPBOARD_UTF8_STRING}
 };
@@ -278,11 +278,11 @@ enum {
 
 typedef struct _UtilityDataMessages UtilityDataMessages;
 struct _UtilityDataMessages {
-       gchar *title;
-       gchar *question;
-       gchar *desc_flist;
-       gchar *desc_source_fd;
-       gchar *fail;
+       const gchar *title;
+       const gchar *question;
+       const gchar *desc_flist;
+       const gchar *desc_source_fd;
+       const gchar *fail;
 };
 
 typedef struct _UtilityData UtilityData;
index 5f169a7..6f5f82a 100644 (file)
@@ -782,7 +782,7 @@ void vd_new_folder(ViewDir *vd, FileData *dir_fd)
  */
 
 static GtkTargetEntry vd_dnd_drop_types[] = {
-       { "text/uri-list", 0, TARGET_URI_LIST }
+       { const_cast<gchar *>("text/uri-list"), 0, TARGET_URI_LIST }
 };
 static gint vd_dnd_drop_types_count = 1;