From: Ben Pfaff Date: Sat, 11 Jun 2011 04:55:47 +0000 (-0700) Subject: gui: Drop 'dict' parameter from text_to_value(). X-Git-Tag: v0.7.9~272 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=320267625a64914733f6ab2e87b48f93c53fd6c5;p=pspp-builds.git gui: Drop 'dict' parameter from text_to_value(). This parameter is used only to obtain the dictionary's encoding, which may also be obtained through the variable. --- diff --git a/src/ui/gui/find-dialog.c b/src/ui/gui/find-dialog.c index 63604cf4..11a90594 100644 --- a/src/ui/gui/find-dialog.c +++ b/src/ui/gui/find-dialog.c @@ -1,5 +1,5 @@ /* PSPPIRE - a graphical user interface for PSPP. - Copyright (C) 2007, 2009 Free Software Foundation + Copyright (C) 2007, 2009, 2011 Free Software Foundation This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -592,7 +592,7 @@ value_comparator_create (const struct variable *var, const PsppireDict *dict, co cmptr->destroy = cmptr_value_destroy; cmptr->dict = dict; - text_to_value (target, dict, var, &vc->pattern); + text_to_value (target, var, &vc->pattern); return cmptr; } diff --git a/src/ui/gui/helper.c b/src/ui/gui/helper.c index 3f52a61f..71b1fb72 100644 --- a/src/ui/gui/helper.c +++ b/src/ui/gui/helper.c @@ -65,14 +65,12 @@ value_to_text (union value v, const PsppireDict *dict, struct fmt_spec format) VAL will be initialised and filled by this function. It is the caller's responsibility to destroy VAL when no longer needed. - VAR and DICT must be the variable and dictionary with which VAL - is associated. + VAR must be the variable with which VAL is associated. On success, VAL is returned, NULL otherwise. */ union value * text_to_value (const gchar *text, - const PsppireDict *dict, const struct variable *var, union value *val) { @@ -98,7 +96,7 @@ text_to_value (const gchar *text, value_init (val, width); free (data_in (ss_cstr (text), UTF8, format->type, val, width, - dict_get_encoding (dict->dict))); + var_get_encoding (var))); return val; } diff --git a/src/ui/gui/helper.h b/src/ui/gui/helper.h index e7fb6257..78cd22cf 100644 --- a/src/ui/gui/helper.h +++ b/src/ui/gui/helper.h @@ -55,7 +55,6 @@ gchar * value_to_text (union value v, const PsppireDict *dict, struct fmt_spec f union value * text_to_value (const gchar *text, - const PsppireDict *dict, const struct variable *var, union value *); diff --git a/src/ui/gui/missing-val-dialog.c b/src/ui/gui/missing-val-dialog.c index 7e04b854..7222fd1a 100644 --- a/src/ui/gui/missing-val-dialog.c +++ b/src/ui/gui/missing-val-dialog.c @@ -1,5 +1,5 @@ /* PSPPIRE - a graphical user interface for PSPP. - Copyright (C) 2005, 2006, 2009 Free Software Foundation + Copyright (C) 2005, 2006, 2009, 2011 Free Software Foundation This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -98,7 +98,7 @@ missing_val_dialog_accept (GtkWidget *w, gpointer data) continue; } - if ( text_to_value (text, dialog->dict, dialog->pv, &v)) + if ( text_to_value (text, dialog->pv, &v)) { nvals++; mv_add_value (&dialog->mvl, &v); @@ -125,9 +125,9 @@ missing_val_dialog_accept (GtkWidget *w, gpointer data) const gchar *low_text = gtk_entry_get_text (GTK_ENTRY (dialog->low)); const gchar *high_text = gtk_entry_get_text (GTK_ENTRY (dialog->high)); - if ( text_to_value (low_text, dialog->dict, dialog->pv, &low_val) + if ( text_to_value (low_text, dialog->pv, &low_val) && - text_to_value (high_text, dialog->dict, dialog->pv, &high_val)) + text_to_value (high_text, dialog->pv, &high_val)) { if ( low_val.f > high_val.f ) { @@ -160,7 +160,6 @@ missing_val_dialog_accept (GtkWidget *w, gpointer data) { union value discrete_val; if ( !text_to_value (discrete_text, - dialog->dict, dialog->pv, &discrete_val)) { diff --git a/src/ui/gui/val-labs-dialog.c b/src/ui/gui/val-labs-dialog.c index 950a59e6..610e5244 100644 --- a/src/ui/gui/val-labs-dialog.c +++ b/src/ui/gui/val-labs-dialog.c @@ -77,7 +77,6 @@ on_label_entry_change (GtkEntry *entry, gpointer data) text = gtk_entry_get_text (GTK_ENTRY (dialog->value_entry)); text_to_value (text, - dialog->dict, dialog->pv, &v); @@ -150,7 +149,6 @@ on_value_entry_change (GtkEntry *entry, gpointer data) union value v; text_to_value (text, - dialog->dict, dialog->pv, &v); @@ -282,7 +280,6 @@ on_change (GtkWidget *w, gpointer data) union value v; text_to_value (val_text, - dialog->dict, dialog->pv, &v); @@ -308,7 +305,6 @@ on_add (GtkWidget *w, gpointer data) const gchar *text = gtk_entry_get_text (GTK_ENTRY (dialog->value_entry)); text_to_value (text, - dialog->dict, dialog->pv, &v);