Treat table height as int instead of short
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=838952
This commit is contained in:
@@ -278,7 +278,7 @@ newTable()
|
|||||||
t->max_rowsize = MAXROW;
|
t->max_rowsize = MAXROW;
|
||||||
t->tabdata = New_N(GeneralList **, MAXROW);
|
t->tabdata = New_N(GeneralList **, MAXROW);
|
||||||
t->tabattr = New_N(table_attr *, MAXROW);
|
t->tabattr = New_N(table_attr *, MAXROW);
|
||||||
t->tabheight = NewAtom_N(short, MAXROW);
|
t->tabheight = NewAtom_N(int, MAXROW);
|
||||||
#ifdef ID_EXT
|
#ifdef ID_EXT
|
||||||
t->tabidvalue = New_N(Str *, MAXROW);
|
t->tabidvalue = New_N(Str *, MAXROW);
|
||||||
t->tridvalue = New_N(Str, MAXROW);
|
t->tridvalue = New_N(Str, MAXROW);
|
||||||
@@ -331,7 +331,7 @@ check_row(struct table *t, int row)
|
|||||||
int i, r;
|
int i, r;
|
||||||
GeneralList ***tabdata;
|
GeneralList ***tabdata;
|
||||||
table_attr **tabattr;
|
table_attr **tabattr;
|
||||||
short *tabheight;
|
int *tabheight;
|
||||||
#ifdef ID_EXT
|
#ifdef ID_EXT
|
||||||
Str **tabidvalue;
|
Str **tabidvalue;
|
||||||
Str *tridvalue;
|
Str *tridvalue;
|
||||||
@@ -341,7 +341,7 @@ check_row(struct table *t, int row)
|
|||||||
r = max(t->max_rowsize * 2, row + 1);
|
r = max(t->max_rowsize * 2, row + 1);
|
||||||
tabdata = New_N(GeneralList **, r);
|
tabdata = New_N(GeneralList **, r);
|
||||||
tabattr = New_N(table_attr *, r);
|
tabattr = New_N(table_attr *, r);
|
||||||
tabheight = NewAtom_N(short, r);
|
tabheight = NewAtom_N(int, r);
|
||||||
#ifdef ID_EXT
|
#ifdef ID_EXT
|
||||||
tabidvalue = New_N(Str *, r);
|
tabidvalue = New_N(Str *, r);
|
||||||
tridvalue = New_N(Str, r);
|
tridvalue = New_N(Str, r);
|
||||||
@@ -845,6 +845,39 @@ table_rule_width(struct table *t)
|
|||||||
return RULE_WIDTH;
|
return RULE_WIDTH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
check_cell_height(int *tabheight, int *cellheight,
|
||||||
|
short *row, short *rowspan, short maxcell,
|
||||||
|
short *indexarray, int space, int dir)
|
||||||
|
{
|
||||||
|
int i, j, k, brow, erow;
|
||||||
|
int sheight, height;
|
||||||
|
|
||||||
|
for (k = 0; k <= maxcell; k++) {
|
||||||
|
j = indexarray[k];
|
||||||
|
if (cellheight[j] <= 0)
|
||||||
|
continue;
|
||||||
|
brow = row[j];
|
||||||
|
erow = brow + rowspan[j];
|
||||||
|
sheight = 0;
|
||||||
|
for (i = brow; i < erow; i++)
|
||||||
|
sheight += tabheight[i];
|
||||||
|
|
||||||
|
height = cellheight[j] - (rowspan[j] - 1) * space;
|
||||||
|
if (height > sheight) {
|
||||||
|
int w = (height - sheight) / rowspan[j];
|
||||||
|
int r = (height - sheight) % rowspan[j];
|
||||||
|
for (i = brow; i < erow; i++)
|
||||||
|
tabheight[i] += w;
|
||||||
|
/* dir {0: horizontal, 1: vertical} */
|
||||||
|
if (dir == 1 && r > 0)
|
||||||
|
r = rowspan[j];
|
||||||
|
for (i = 1; i <= r; i++)
|
||||||
|
tabheight[erow - i]++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
check_cell_width(short *tabwidth, short *cellwidth,
|
check_cell_width(short *tabwidth, short *cellwidth,
|
||||||
short *col, short *colspan, short maxcell,
|
short *col, short *colspan, short maxcell,
|
||||||
@@ -1478,7 +1511,7 @@ check_table_height(struct table *t)
|
|||||||
short *indexarray;
|
short *indexarray;
|
||||||
short maxcell;
|
short maxcell;
|
||||||
short size;
|
short size;
|
||||||
short *height;
|
int *height;
|
||||||
} cell;
|
} cell;
|
||||||
int space = 0;
|
int space = 0;
|
||||||
|
|
||||||
@@ -1517,7 +1550,7 @@ check_table_height(struct table *t)
|
|||||||
cell.row = NewAtom_N(short, cell.size);
|
cell.row = NewAtom_N(short, cell.size);
|
||||||
cell.rowspan = NewAtom_N(short, cell.size);
|
cell.rowspan = NewAtom_N(short, cell.size);
|
||||||
cell.indexarray = NewAtom_N(short, cell.size);
|
cell.indexarray = NewAtom_N(short, cell.size);
|
||||||
cell.height = NewAtom_N(short, cell.size);
|
cell.height = NewAtom_N(int, cell.size);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
cell.size = max(cell.size + MAXCELL, c + 1);
|
cell.size = max(cell.size + MAXCELL, c + 1);
|
||||||
@@ -1526,7 +1559,7 @@ check_table_height(struct table *t)
|
|||||||
cell.size);
|
cell.size);
|
||||||
cell.indexarray = New_Reuse(short, cell.indexarray,
|
cell.indexarray = New_Reuse(short, cell.indexarray,
|
||||||
cell.size);
|
cell.size);
|
||||||
cell.height = New_Reuse(short, cell.height, cell.size);
|
cell.height = New_Reuse(int, cell.height, cell.size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (c > cell.maxcell) {
|
if (c > cell.maxcell) {
|
||||||
@@ -1560,7 +1593,7 @@ check_table_height(struct table *t)
|
|||||||
case BORDER_NONE:
|
case BORDER_NONE:
|
||||||
space = 0;
|
space = 0;
|
||||||
}
|
}
|
||||||
check_cell_width(t->tabheight, cell.height, cell.row, cell.rowspan,
|
check_cell_height(t->tabheight, cell.height, cell.row, cell.rowspan,
|
||||||
cell.maxcell, cell.indexarray, space, 1);
|
cell.maxcell, cell.indexarray, space, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ struct table {
|
|||||||
short minimum_width[MAXCOL];
|
short minimum_width[MAXCOL];
|
||||||
short fixed_width[MAXCOL];
|
short fixed_width[MAXCOL];
|
||||||
struct table_cell cell;
|
struct table_cell cell;
|
||||||
short *tabheight;
|
int *tabheight;
|
||||||
struct table_in *tables;
|
struct table_in *tables;
|
||||||
short ntable;
|
short ntable;
|
||||||
short tables_size;
|
short tables_size;
|
||||||
|
|||||||
Reference in New Issue
Block a user