From: John Darrington Date: Wed, 8 Jul 2009 19:05:24 +0000 (+0800) Subject: Remove recoding in data_store. X-Git-Tag: build37~53^2~11 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4a8a4cd81b9d7d9e6b757be4d0a8a62b48325051;p=pspp-builds.git Remove recoding in data_store. It's no longer appropriate to perform recoding in the gui. Instead, this is expected to be done in the backend. --- diff --git a/src/ui/gui/psppire-data-store.c b/src/ui/gui/psppire-data-store.c index 65001dd1..a97cbbb3 100644 --- a/src/ui/gui/psppire-data-store.c +++ b/src/ui/gui/psppire-data-store.c @@ -664,7 +664,6 @@ gboolean psppire_data_store_set_string (PsppireDataStore *store, const gchar *text, glong row, glong col) { - gchar *s; glong n_cases; const struct variable *pv = psppire_dict_get_variable (store->dict, col); if ( NULL == pv) @@ -678,12 +677,9 @@ psppire_data_store_set_string (PsppireDataStore *store, if (row == n_cases) psppire_data_store_insert_new_case (store, row); - s = recode_string (psppire_dict_encoding (store->dict), UTF8, text, -1); - psppire_data_store_data_in (store, row, - var_get_case_index (pv), ss_cstr (s), + var_get_case_index (pv), ss_cstr (text), var_get_write_format (pv)); - free (s); psppire_sheet_model_range_changed (PSPPIRE_SHEET_MODEL (store), row, col, row, col); @@ -948,18 +944,22 @@ psppire_data_store_data_in (PsppireDataStore *ds, casenumber casenum, gint idx, int width; bool ok; + PsppireDict *dict; + g_return_val_if_fail (ds, FALSE); g_return_val_if_fail (ds->datasheet, FALSE); g_return_val_if_fail (idx < datasheet_get_n_columns (ds->datasheet), FALSE); + dict = ds->dict; + width = fmt_var_width (fmt); g_return_val_if_fail (caseproto_get_width ( datasheet_get_proto (ds->datasheet), idx) == width, FALSE); value_init (&value, width); ok = (datasheet_get_value (ds->datasheet, casenum, idx, &value) - && data_in (input, LEGACY_NATIVE, fmt->type, 0, 0, 0, &value, width) + && data_in (input, dict_get_encoding (dict->dict), fmt->type, 0, 0, 0, &value, width) && datasheet_put_value (ds->datasheet, casenum, idx, &value)); value_destroy (&value, width);