pspp-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sheet prep 1/6] gui: Drop 'dict' parameter from text_to_value().


From: Ben Pfaff
Subject: [sheet prep 1/6] gui: Drop 'dict' parameter from text_to_value().
Date: Wed, 22 Jun 2011 20:33:10 -0700

This parameter is used only to obtain the dictionary's
encoding, which may also be obtained through the variable.
---
 src/ui/gui/find-dialog.c        |    4 ++--
 src/ui/gui/helper.c             |    6 ++----
 src/ui/gui/helper.h             |    1 -
 src/ui/gui/missing-val-dialog.c |    9 ++++-----
 src/ui/gui/val-labs-dialog.c    |    4 ----
 5 files changed, 8 insertions(+), 16 deletions(-)

diff --git a/src/ui/gui/find-dialog.c b/src/ui/gui/find-dialog.c
index 63604cf..11a9059 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 3f52a61..71b1fb7 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 e7fb625..78cd22c 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 7e04b85..7222fd1 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 950a59e..610e524 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);
 
-- 
1.7.2.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]