projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix table function assertions to respect offsets.
[pspp]
/
src
/
tab.c
diff --git
a/src/tab.c
b/src/tab.c
index 862028a8c5ab56959896e8b9cb8c9deb1f9c1c65..118a77cd68df7f26b84af4c32b55a836c3d9a250 100644
(file)
--- a/
src/tab.c
+++ b/
src/tab.c
@@
-252,11
+252,6
@@
tab_vline (struct tab_table *t, int style, int x, int y1, int y2)
int y;
assert (t != NULL);
int y;
assert (t != NULL);
- assert (x > 0);
- assert (x < t->nc);
- assert (y1 >= 0);
- assert (y2 >= y1);
- assert (y2 <= t->nr);
#if GLOBAL_DEBUGGING
if (x + t->col_ofs < 0 || x + t->col_ofs > t->nc
#if GLOBAL_DEBUGGING
if (x + t->col_ofs < 0 || x + t->col_ofs > t->nc
@@
-277,6
+272,12
@@
tab_vline (struct tab_table *t, int style, int x, int y1, int y2)
y1 += t->row_ofs;
y2 += t->row_ofs;
y1 += t->row_ofs;
y2 += t->row_ofs;
+ assert (x > 0);
+ assert (x < t->nc);
+ assert (y1 >= 0);
+ assert (y2 >= y1);
+ assert (y2 <= t->nr);
+
if (style != -1)
{
if ((style & TAL_SPACING) == 0)
if (style != -1)
{
if ((style & TAL_SPACING) == 0)
@@
-295,16
+296,16
@@
tab_hline (struct tab_table * t, int style, int x1, int x2, int y)
assert (t != NULL);
assert (t != NULL);
+ x1 += t->col_ofs;
+ x2 += t->col_ofs;
+ y += t->row_ofs;
+
assert (y >= 0);
assert (y < t->nr);
assert (x2 >= x1 );
assert (x1 >= 0 );
assert (x2 < t->nc);
assert (y >= 0);
assert (y < t->nr);
assert (x2 >= x1 );
assert (x1 >= 0 );
assert (x2 < t->nc);
- x1 += t->col_ofs;
- x2 += t->col_ofs;
- y += t->row_ofs;
-
if (style != -1)
{
if ((style & TAL_SPACING) == 0)
if (style != -1)
{
if ((style & TAL_SPACING) == 0)
@@
-326,13
+327,6
@@
tab_box (struct tab_table *t, int f_h, int f_v, int i_h, int i_v,
{
assert (t != NULL);
{
assert (t != NULL);
- assert (x2 >= x1);
- assert (y2 >= y1);
- assert (x1 >= 0);
- assert (y1 >= 0);
- assert (x2 < t->nc);
- assert (y2 < t->nr);
-
#if GLOBAL_DEBUGGING
if (x1 + t->col_ofs < 0 || x1 + t->col_ofs >= t->nc
|| x2 + t->col_ofs < 0 || x2 + t->col_ofs >= t->nc
#if GLOBAL_DEBUGGING
if (x1 + t->col_ofs < 0 || x1 + t->col_ofs >= t->nc
|| x2 + t->col_ofs < 0 || x2 + t->col_ofs >= t->nc
@@
-355,6
+349,13
@@
tab_box (struct tab_table *t, int f_h, int f_v, int i_h, int i_v,
y1 += t->row_ofs;
y2 += t->row_ofs;
y1 += t->row_ofs;
y2 += t->row_ofs;
+ assert (x2 >= x1);
+ assert (y2 >= y1);
+ assert (x1 >= 0);
+ assert (y1 >= 0);
+ assert (x2 < t->nc);
+ assert (y2 < t->nr);
+
if (f_h != -1)
{
int x;
if (f_h != -1)
{
int x;
@@
-570,7
+571,6
@@
tab_value (struct tab_table *table, int c, int r, unsigned char opt,
const union value *v, const struct fmt_spec *f)
{
char *contents;
const union value *v, const struct fmt_spec *f)
{
char *contents;
- union value temp_val;
assert (table != NULL && v != NULL && f != NULL);
#if GLOBAL_DEBUGGING
assert (table != NULL && v != NULL && f != NULL);
#if GLOBAL_DEBUGGING
@@
-591,11
+591,6
@@
tab_value (struct tab_table *table, int c, int r, unsigned char opt,
ls_init (&table->cc[c + r * table->cf], contents, f->w);
table->ct[c + r * table->cf] = opt;
ls_init (&table->cc[c + r * table->cf], contents, f->w);
table->ct[c + r * table->cf] = opt;
- if (formats[f->type].cat & FCAT_STRING)
- {
- temp_val.c = (char *) v->s;
- v = &temp_val;
- }
data_out (contents, f, v);
}
data_out (contents, f, v);
}
@@
-609,6
+604,7
@@
tab_float (struct tab_table *table, int c, int r, unsigned char opt,
char buf[40], *cp;
struct fmt_spec f;
char buf[40], *cp;
struct fmt_spec f;
+ union value double_value;
assert (table != NULL && w <= 40);
assert (table != NULL && w <= 40);
@@
-635,7
+631,9
@@
tab_float (struct tab_table *table, int c, int r, unsigned char opt,
}
#endif
}
#endif
- data_out (buf, &f, (union value *) &val);
+ double_value.f = val;
+ data_out (buf, &f, &double_value);
+
cp = buf;
while (isspace ((unsigned char) *cp) && cp < &buf[w])
cp++;
cp = buf;
while (isspace ((unsigned char) *cp) && cp < &buf[w])
cp++;
@@
-692,12
+690,12
@@
tab_joint_text (struct tab_table *table, int x1, int y1, int x2, int y2,
assert (table != NULL && text != NULL);
assert (table != NULL && text != NULL);
- assert (x1 >= 0);
- assert (y1 >= 0);
+ assert (x1
+ table->col_ofs
>= 0);
+ assert (y1
+ table->row_ofs
>= 0);
assert (y2 >= y1);
assert (x2 >= x1);
assert (y2 >= y1);
assert (x2 >= x1);
- assert (y2 < table->nr);
- assert (x2 < table->nc);
+ assert (y2
+ table->row_ofs
< table->nr);
+ assert (x2
+ table->col_ofs
< table->nc);
#if GLOBAL_DEBUGGING
if (x1 + table->col_ofs < 0 || x1 + table->col_ofs >= table->nc
#if GLOBAL_DEBUGGING
if (x1 + table->col_ofs < 0 || x1 + table->col_ofs >= table->nc