From: Ben Pfaff Date: Mon, 26 Jun 2006 05:40:29 +0000 (+0000) Subject: * value-labels.c (value_to_string): When there's no value label, X-Git-Tag: v0.6.0~806 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ea1077f400b06da0cf011f9f037b3c4d1b6e7b3b;p=pspp-builds.git * value-labels.c (value_to_string): When there's no value label, format the variable according to its print format, instead of always effectively using A or F format. --- diff --git a/src/data/ChangeLog b/src/data/ChangeLog index 0faa3504..f1132b2b 100644 --- a/src/data/ChangeLog +++ b/src/data/ChangeLog @@ -1,3 +1,9 @@ +Sun Jun 25 22:39:32 2006 Ben Pfaff + + * value-labels.c (value_to_string): When there's no value label, + format the variable according to its print format, instead of + always effectively using A or F format. + Mon Jun 19 18:05:42 WST 2006 John Darrington * casefile.c (casefile_get_random_reader): Nasty hack to get around diff --git a/src/data/value-labels.c b/src/data/value-labels.c index b9c85d54..92a2db48 100644 --- a/src/data/value-labels.c +++ b/src/data/value-labels.c @@ -547,11 +547,9 @@ value_to_string (const union value *val, const struct variable *var) s = val_labs_find (var->val_labs, *val); if (s == NULL) { - static char buf[256]; - if (var->width != 0) - str_copy_buf_trunc (buf, sizeof buf, val->s, var->width); - else - snprintf(buf, 100, "%g", val->f); + static char buf[MAX_STRING + 1]; + data_out (buf, &var->print, val); + buf[var->print.w] = '\0'; s = buf; }