projects
/
pspp-builds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixed some problems with value labels not reporting correctly.
[pspp-builds.git]
/
src
/
value-labels.c
diff --git
a/src/value-labels.c
b/src/value-labels.c
index 4c1d1a5f234d4b79250784bf9e711b4e34d0c600..91dd1702e1f69beaac15933077d8b27beb90c3e7 100644
(file)
--- a/
src/value-labels.c
+++ b/
src/value-labels.c
@@
-498,6
+498,7
@@
free_atom (void *atom_, void *aux UNUSED)
const char *
value_to_string(const union value *val, const struct variable *var)
{
const char *
value_to_string(const union value *val, const struct variable *var)
{
+ static char buf[100];
char *s;
const struct val_labs *val_labs = var->val_labs;
char *s;
const struct val_labs *val_labs = var->val_labs;
@@
-507,12
+508,11
@@
value_to_string(const union value *val, const struct variable *var)
return s;
if ( 0 == var->width )
return s;
if ( 0 == var->width )
+ snprintf(buf,100,"%g",val->f);
+ else
{
{
- static char buf[100];
- snprintf(buf,100,"%g",val->f);
- return buf;
+ strncpy(buf,val->s,MAX_SHORT_STRING);
+ strcat(buf,"\0");
}
}
- else
- return val->s;
-
+ return buf;
}
}