diff --git a/ChangeLog-gtk2.claws b/ChangeLog-gtk2.claws index f113f6d6a..4d63fbb52 100644 --- a/ChangeLog-gtk2.claws +++ b/ChangeLog-gtk2.claws @@ -1,3 +1,11 @@ +2004-11-15 [colin] 0.9.12cvs146.12 + + * src/compose.c + * src/prefs_filtering.c + * src/prefs_filtering_action.c + * src/prefs_toolbar.c + Fix some const-correctness + 2004-11-15 [colin] 0.9.12cvs146.11 * src/summaryview.c diff --git a/PATCHSETS b/PATCHSETS index bd065cd28..5f6296350 100644 --- a/PATCHSETS +++ b/PATCHSETS @@ -236,3 +236,4 @@ ( cvs diff -u -r 1.96.2.34 -r 1.96.2.35 src/textview.c; ) > 0.9.12cvs146.9.patchset ( cvs diff -u -r 1.65.2.18 -r 1.65.2.19 src/codeconv.c; ) > 0.9.12cvs146.10.patchset ( cvs diff -u -r 1.395.2.40 -r 1.395.2.41 src/summaryview.c; cvs diff -u -r 1.3.2.11 -r 1.3.2.12 src/prefs_themes.c; cvs diff -u -r 1.94.2.33 -r 1.94.2.34 src/messageview.c; ) > 0.9.12cvs146.11.patchset +( cvs diff -u -r 1.382.2.64 -r 1.382.2.65 src/compose.c; cvs diff -u -r 1.59.2.9 -r 1.59.2.10 src/prefs_filtering.c; cvs diff -u -r 1.1.4.8 -r 1.1.4.9 src/prefs_filtering_action.c; cvs diff -u -r 1.30.2.6 -r 1.30.2.7 src/prefs_toolbar.c; ) > 0.9.12cvs146.12.patchset diff --git a/configure.ac b/configure.ac index 15b28ecaf..07c9ef9e2 100644 --- a/configure.ac +++ b/configure.ac @@ -13,7 +13,7 @@ INTERFACE_AGE=0 BINARY_AGE=0 EXTRA_VERSION=146 EXTRA_RELEASE= -EXTRA_GTK2_VERSION=.11 +EXTRA_GTK2_VERSION=.12 if test \( $EXTRA_VERSION -eq 0 \) -o \( "x$EXTRA_RELEASE" != "x" \); then VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}${EXTRA_RELEASE}${EXTRA_GTK2_VERSION} diff --git a/src/compose.c b/src/compose.c index 9eadf1b52..46452d951 100644 --- a/src/compose.c +++ b/src/compose.c @@ -4112,7 +4112,7 @@ static gchar *compose_get_header(Compose *compose) compose_add_headerfield_from_headerlist(compose, header, "Bcc", ", "); /* Subject */ - str = (gpointer)gtk_entry_get_text(GTK_ENTRY(compose->subject_entry)); + str = gtk_editable_get_chars(GTK_EDITABLE(compose->subject_entry), 0, -1); if (*str != '\0' && !IS_IN_CUSTOM_HEADER("Subject")) { gchar *tmpstr; @@ -4129,6 +4129,7 @@ static gchar *compose_get_header(Compose *compose) } g_free(tmpstr); } + g_free(str); /* Message-ID */ if (compose->account->gen_msgid) { diff --git a/src/prefs_filtering.c b/src/prefs_filtering.c index 9bf8e01dc..993346fda 100644 --- a/src/prefs_filtering.c +++ b/src/prefs_filtering.c @@ -708,13 +708,15 @@ static void prefs_filtering_condition_define(void) gchar * cond_str; MatcherList * matchers = NULL; - cond_str = (gpointer)gtk_entry_get_text(GTK_ENTRY(filtering.cond_entry)); + cond_str = gtk_editable_get_chars(GTK_EDITABLE(filtering.cond_entry), 0, -1); if (*cond_str != '\0') { matchers = matcher_parser_get_cond(cond_str); if (matchers == NULL) alertpanel_error(_("Condition string is not valid.")); } + + g_free(cond_str); prefs_matcher_open(matchers, prefs_filtering_condition_define_done); @@ -742,13 +744,15 @@ static void prefs_filtering_action_define(void) gchar * action_str; GSList * action_list = NULL; - action_str = (gpointer)gtk_entry_get_text(GTK_ENTRY(filtering.action_entry)); + action_str = gtk_editable_get_chars(GTK_EDITABLE(filtering.action_entry), 0, -1); if (*action_str != '\0') { action_list = matcher_parser_get_action_list(action_str); if (action_list == NULL) alertpanel_error(_("Action string is not valid.")); } + + g_free(action_str); prefs_filtering_action_open(action_list, prefs_filtering_action_define_done); @@ -768,39 +772,43 @@ static void prefs_filtering_action_define(void) static FilteringProp * prefs_filtering_dialog_to_filtering(gboolean alert) { MatcherList * cond; - gchar * cond_str; - gchar * action_str; - FilteringProp * prop; + gchar * cond_str = NULL; + gchar * action_str = NULL; + FilteringProp * prop = NULL; GSList * action_list; - cond_str = (gpointer)gtk_entry_get_text(GTK_ENTRY(filtering.cond_entry)); + cond_str = gtk_editable_get_chars(GTK_EDITABLE(filtering.cond_entry), 0, -1); if (*cond_str == '\0') { if(alert == TRUE) alertpanel_error(_("Condition string is empty.")); - return NULL; + goto fail; } - - action_str = (gpointer)gtk_entry_get_text(GTK_ENTRY(filtering.action_entry)); + + action_str = gtk_editable_get_chars(GTK_EDITABLE(filtering.action_entry), 0, -1); if (*action_str == '\0') { if(alert == TRUE) alertpanel_error(_("Action string is empty.")); - return NULL; + goto fail; } - cond = (gpointer)matcher_parser_get_cond(cond_str); + cond = matcher_parser_get_cond(cond_str); if (cond == NULL) { if(alert == TRUE) alertpanel_error(_("Condition string is not valid.")); - return NULL; + goto fail; } - action_list = (gpointer)matcher_parser_get_action_list(action_str); + action_list = matcher_parser_get_action_list(action_str); + if (action_list == NULL) { if(alert == TRUE) alertpanel_error(_("Action string is not valid.")); - return NULL; + goto fail; } prop = filteringprop_new(cond, action_list); +fail: + g_free(cond_str); + g_free(action_str); return prop; } diff --git a/src/prefs_filtering_action.c b/src/prefs_filtering_action.c index 2557114f2..5fdfb930b 100644 --- a/src/prefs_filtering_action.c +++ b/src/prefs_filtering_action.c @@ -737,10 +737,10 @@ static FilteringAction * prefs_filtering_action_dialog_to_action(gboolean alert) gint action_type; gint list_id; gint account_id; - gchar * destination; + gchar * destination = NULL; gint labelcolor = 0; FilteringAction * action; - gchar * score_str; + gchar * score_str = NULL; gint score; action_id = get_sel_from_list(GTK_LIST(filtering_action.action_type_list)); @@ -754,24 +754,24 @@ static FilteringAction * prefs_filtering_action_dialog_to_action(gboolean alert) case ACTION_MOVE: case ACTION_COPY: case ACTION_EXECUTE: - destination = (gpointer)gtk_entry_get_text( - GTK_ENTRY(filtering_action.dest_entry)); + destination = gtk_editable_get_chars(GTK_EDITABLE(filtering_action.dest_entry), 0, -1); if (*destination == '\0') { if (alert) alertpanel_error(action_id == ACTION_EXECUTE ? _("Command line not set") : _("Destination is not set.")); + g_free(destination); return NULL; } break; case ACTION_FORWARD: case ACTION_FORWARD_AS_ATTACHMENT: case ACTION_REDIRECT: - destination = (gpointer)gtk_entry_get_text( - GTK_ENTRY(filtering_action.dest_entry)); + destination = gtk_editable_get_chars(GTK_EDITABLE(filtering_action.dest_entry), 0, -1); if (*destination == '\0') { if (alert) alertpanel_error(_("Recipient is not set.")); + g_free(destination); return NULL; } break; @@ -782,10 +782,11 @@ static FilteringAction * prefs_filtering_action_dialog_to_action(gboolean alert) break; case ACTION_CHANGE_SCORE: case ACTION_SET_SCORE: - score_str = (gpointer)gtk_entry_get_text(GTK_ENTRY(filtering_action.dest_entry)); + score_str = gtk_editable_get_chars(GTK_EDITABLE(filtering_action.dest_entry), 0, -1); if (*score_str == '\0') { if (alert) alertpanel_error(_("Score is not set")); + g_free(score_str); return NULL; } score = strtol(score_str, NULL, 10); @@ -805,8 +806,10 @@ static FilteringAction * prefs_filtering_action_dialog_to_action(gboolean alert) action = filteringaction_new(action_type, account_id, destination, labelcolor, score); - - return action; + + g_free(destination); + g_free(score_str); + return action; } /*! diff --git a/src/prefs_toolbar.c b/src/prefs_toolbar.c index 896913579..5c9fbb60c 100644 --- a/src/prefs_toolbar.c +++ b/src/prefs_toolbar.c @@ -339,7 +339,7 @@ static void prefs_toolbar_default(GtkButton *button, ToolbarPage *prefs_toolbar) prefs_toolbar_set_displayed(prefs_toolbar); } -static void get_action_name(gchar *entry, gchar **menu) +static void get_action_name(const gchar *entry, gchar **menu) { gchar *act, *act_p; @@ -398,7 +398,7 @@ static void prefs_toolbar_register(GtkButton *button, ToolbarPage *prefs_toolbar if (g_utf8_collate(item[3], syl_act) == 0) { - gchar *entry = (gpointer)gtk_entry_get_text(GTK_ENTRY(prefs_toolbar->combo_syl_entry)); + const gchar *entry = gtk_entry_get_text(GTK_ENTRY(prefs_toolbar->combo_syl_entry)); get_action_name(entry, &item[2]); } else { @@ -468,8 +468,7 @@ static void prefs_toolbar_substitute(GtkButton *button, ToolbarPage *prefs_toolb &xpm, &xpmmask); if (g_utf8_collate(item[3], syl_act) == 0) { - - gchar *entry = (gpointer)gtk_entry_get_text(GTK_ENTRY(prefs_toolbar->combo_syl_entry)); + const gchar *entry = gtk_entry_get_text(GTK_ENTRY(prefs_toolbar->combo_syl_entry)); get_action_name(entry, &item[2]); } else { item[2] = g_strdup(gtk_entry_get_text(GTK_ENTRY(prefs_toolbar->entry_icon_text)));