From e371c5d3ef0199fa913884cb6847a361c37e0e80 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Sat, 28 Sep 2013 16:26:08 -0700 Subject: [PATCH] psppire-data-store: Don't try to parse strings as custom currency formats. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Custom currency formats are not usable for input, only for output, but this code tried to use them for input if the format was changed to a custom currency format in the GUI. This commit fixes the problem by using a DOLLAR format, instead, for parsing. Reported by Bastián Díaz . --- src/ui/gui/psppire-data-store.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ui/gui/psppire-data-store.c b/src/ui/gui/psppire-data-store.c index ea42339b35..8832e5175e 100644 --- a/src/ui/gui/psppire-data-store.c +++ b/src/ui/gui/psppire-data-store.c @@ -226,7 +226,10 @@ resize_datum (const union value *old, union value *new, const void *aux_) const char *enc = dict_get_encoding (aux->dict); const struct fmt_spec *newfmt = var_get_print_format (aux->new_variable); char *s = data_out (old, enc, var_get_print_format (aux->old_variable)); - free (data_in (ss_cstr (s), enc, newfmt->type, new, new_width, enc)); + enum fmt_type type = (fmt_usable_for_input (newfmt->type) + ? newfmt->type + : FMT_DOLLAR); + free (data_in (ss_cstr (s), enc, type, new, new_width, enc)); free (s); } -- 2.30.2