From: John Darrington Date: Fri, 22 Dec 2006 10:24:18 +0000 (+0000) Subject: Fixed bug #17420 (table columns exceeded with /FORMAT=nolabels ) X-Git-Tag: v0.6.0~620 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dda5e7a6be2af282b1644e04415f24b7b2381d97;p=pspp-builds.git Fixed bug #17420 (table columns exceeded with /FORMAT=nolabels ) --- diff --git a/src/language/stats/ChangeLog b/src/language/stats/ChangeLog index 05cba5c3..6b0c3e63 100644 --- a/src/language/stats/ChangeLog +++ b/src/language/stats/ChangeLog @@ -1,3 +1,8 @@ +Fri Dec 22 19:22:18 WST 2006 John Darrington + + * frequencies.q : Fixed bug #17420, where the table bounds were overun + when /FORMAT=nolabels was given. + Wed Dec 20 18:45:31 WST 2006 John Darrington * binomial.c binomial.h : New files. Thanks to Jason Stover diff --git a/src/language/stats/frequencies.q b/src/language/stats/frequencies.q index 535e6907..506d7ca3 100644 --- a/src/language/stats/frequencies.q +++ b/src/language/stats/frequencies.q @@ -1100,13 +1100,19 @@ compare_freq_alpha_d (const void *a_, const void *b_, const void *v_) static void full_dim (struct tab_table *t, struct outp_driver *d) { - int lab = cmd.labels == FRQ_LABELS; - int i; + int i = 0; + int columns = 5; - if (lab) + if (cmd.labels == FRQ_LABELS) + { t->w[0] = MIN (tab_natural_width (t, d, 0), d->prop_em_width * 15); - for (i = lab; i < lab + 5; i++) + i = 1; + columns ++; + } + + for (;i < columns; i++) t->w[i] = MAX (tab_natural_width (t, d, i), d->prop_em_width * 8); + for (i = 0; i < t->nr; i++) t->h[i] = d->font_height; } @@ -1148,7 +1154,7 @@ dump_full (struct variable *v) {-1, -1, NULL}, }; - int lab = cmd.labels == FRQ_LABELS; + const bool lab = (cmd.labels == FRQ_LABELS); vf = get_var_freqs (v); ft = &vf->tab; @@ -1159,8 +1165,9 @@ dump_full (struct variable *v) if (lab) tab_text (t, 0, 1, TAB_CENTER | TAT_TITLE, _("Value Label")); + for (p = vec; p->s; p++) - tab_text (t, p->c - (p->r ? !lab : 0), p->r, + tab_text (t, lab ? p->c : p->c - 1, p->r, TAB_CENTER | TAT_TITLE, gettext (p->s)); r = 2; @@ -1176,11 +1183,6 @@ dump_full (struct variable *v) if (lab) { -#if 0 -<<<<<<< frequencies.q - const char *label = val_labs_find (v->val_labs, f->value[0]); -======= -#endif const char *label = var_lookup_value_label (v, &f->value[0]); if (label != NULL) tab_text (t, 0, r, TAB_LEFT, label); diff --git a/tests/automake.mk b/tests/automake.mk index 947dc445..72481b63 100644 --- a/tests/automake.mk +++ b/tests/automake.mk @@ -91,6 +91,7 @@ TESTS = \ tests/bugs/get.sh \ tests/bugs/examine-1sample.sh \ tests/bugs/examine-missing.sh \ + tests/bugs/freq-nolabels.sh \ tests/bugs/get-no-file.sh \ tests/bugs/html-frequency.sh \ tests/bugs/if_crash.sh \