From d6389cfd4723ca0c6a61730b3ce8c303f2a28fe6 Mon Sep 17 00:00:00 2001 From: Friedrich Beckmann Date: Tue, 25 Aug 2020 09:42:55 +0200 Subject: [PATCH] Warning: adhere to const qualifier for initializations and assignments MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This commit avoids the warnings: warning: initialization discards ‘const’ qualifier from pointer target type warning: assignment discards ‘const’ qualifier from pointer target type --- src/ui/gui/help-menu.c | 9 ++++---- src/ui/gui/psppire-output-view.c | 30 ++++++++++++++++----------- src/ui/gui/psppire-syntax-window.c | 19 ++++++++++------- src/ui/gui/psppire-var-sheet-header.c | 2 +- 4 files changed, 36 insertions(+), 24 deletions(-) diff --git a/src/ui/gui/help-menu.c b/src/ui/gui/help-menu.c index 1dc2daf309..da87e235ed 100644 --- a/src/ui/gui/help-menu.c +++ b/src/ui/gui/help-menu.c @@ -34,11 +34,11 @@ /* Try to open html documentation uri via the default browser on the operating system */ #ifdef __APPLE__ -#define HTMLOPENARGV {"open", 0, 0} +#define HTMLOPENAPP "open" #elif _WIN32 -#define HTMLOPENARGV {"wscript", 0, 0} +#define HTMLOPENAPP "wscript" #else -#define HTMLOPENARGV {"xdg-open", 0, 0} +#define HTMLOPENAPP "xdg-open" #endif static const gchar *artists[] = { "Bastián Díaz", "Hugo Alejandro", NULL}; @@ -132,7 +132,8 @@ void online_help (const char *page) { GError *htmlerr = NULL; - gchar *htmlargv[3] = HTMLOPENARGV; + gchar helpapp[] = HTMLOPENAPP; + gchar *htmlargv[3] = {helpapp, 0, 0}; gchar *htmlfilename = NULL; gchar *htmlfullname = NULL; gchar *htmluri = NULL; diff --git a/src/ui/gui/psppire-output-view.c b/src/ui/gui/psppire-output-view.c index 2ac85a52ad..58454acbe5 100644 --- a/src/ui/gui/psppire-output-view.c +++ b/src/ui/gui/psppire-output-view.c @@ -628,19 +628,25 @@ clipboard_clear_cb (GtkClipboard *clipboard, { } -static const GtkTargetEntry targets[] = { - - { "STRING", 0, SELECT_FMT_TEXT }, - { "TEXT", 0, SELECT_FMT_TEXT }, - { "COMPOUND_TEXT", 0, SELECT_FMT_TEXT }, - { "text/plain", 0, SELECT_FMT_TEXT }, - - { "UTF8_STRING", 0, SELECT_FMT_UTF8 }, - { "text/plain;charset=utf-8", 0, SELECT_FMT_UTF8 }, +#define CBTARGETS \ +CT ( ctn1, "STRING", 0, SELECT_FMT_TEXT ) \ +CT ( ctn2, "TEXT", 0, SELECT_FMT_TEXT ) \ +CT ( ctn3, "COMPOUND_TEXT", 0, SELECT_FMT_TEXT ) \ +CT ( ctn4, "text/plain", 0, SELECT_FMT_TEXT ) \ +CT ( ctn5, "UTF8_STRING", 0, SELECT_FMT_UTF8 ) \ +CT ( ctn6, "text/plain;charset=utf-8", 0, SELECT_FMT_UTF8 ) \ +CT ( ctn7, "text/html", 0, SELECT_FMT_HTML ) + +#define CT(ID, TARGET, FLAGS, INFO) static gchar ID[] = TARGET; +CBTARGETS +#undef CT +gchar ctnlast[] = "application/vnd.oasis.opendocument.text"; - { "text/html", 0, SELECT_FMT_HTML }, - - { "application/vnd.oasis.opendocument.text", 0, SELECT_FMT_ODT } +static const GtkTargetEntry targets[] = { +#define CT(ID, TARGET, FLAGS, INFO) { ID, FLAGS, INFO }, + CBTARGETS +#undef CT + { ctnlast, 0, SELECT_FMT_ODT } }; static void diff --git a/src/ui/gui/psppire-syntax-window.c b/src/ui/gui/psppire-syntax-window.c index 61587c7d00..eebaac5b28 100644 --- a/src/ui/gui/psppire-syntax-window.c +++ b/src/ui/gui/psppire-syntax-window.c @@ -392,17 +392,22 @@ clipboard_clear_cb (GtkClipboard *clipboard, sw->cliptext = NULL; } +static gchar tn1[] = "UTF8_STRING"; +static gchar tn2[] = "STRING"; +static gchar tn3[] = "TEXT"; +static gchar tn4[] = "COMPOUND_TEXT"; +static gchar tn5[] = "text/plain;charset=utf-8"; +static gchar tn6[] = "text/plain"; static const GtkTargetEntry targets[] = { - { "UTF8_STRING", 0, SELECT_FMT_TEXT }, - { "STRING", 0, SELECT_FMT_TEXT }, - { "TEXT", 0, SELECT_FMT_TEXT }, - { "COMPOUND_TEXT", 0, SELECT_FMT_TEXT }, - { "text/plain;charset=utf-8", 0, SELECT_FMT_TEXT }, - { "text/plain", 0, SELECT_FMT_TEXT }, + { tn1, 0, SELECT_FMT_TEXT }, + { tn2, 0, SELECT_FMT_TEXT }, + { tn3, 0, SELECT_FMT_TEXT }, + { tn4, 0, SELECT_FMT_TEXT }, + { tn5, 0, SELECT_FMT_TEXT }, + { tn6, 0, SELECT_FMT_TEXT } }; - /* Store a clip containing the currently selected text. Returns true iff something was set. diff --git a/src/ui/gui/psppire-var-sheet-header.c b/src/ui/gui/psppire-var-sheet-header.c index c3c25042ec..029b8432f2 100644 --- a/src/ui/gui/psppire-var-sheet-header.c +++ b/src/ui/gui/psppire-var-sheet-header.c @@ -47,7 +47,7 @@ static gpointer gi (GListModel *list, guint position) { GtkWidget *button = gtk_button_new (); - gchar *text = NULL; + const gchar *text = NULL; switch (position) { -- 2.30.2