aboutsummaryrefslogtreecommitdiffstats
path: root/table.c
diff options
context:
space:
mode:
authorFumitoshi UKAI <ukai@debian.or.jp>2002-04-09 14:53:54 +0000
committerFumitoshi UKAI <ukai@debian.or.jp>2002-04-09 14:53:54 +0000
commit47450051219efc80975ac105ffd87ee764c87482 (patch)
tree59c678a40b5a8095e286bcc9e14ab213c6fac3f0 /table.c
parent[w3m-dev 03167] xface2xbm -> xface2xpm (current imlib can't handle XBM) (diff)
downloadw3m-47450051219efc80975ac105ffd87ee764c87482.tar.gz
w3m-47450051219efc80975ac105ffd87ee764c87482.zip
[w3m-dev 03169] Can't calculate table height if number of cells > 20.
* table.c (check_table_height): change row, rowspan, indexarray, height from array to pointer From: Hironori Sakamoto <hsaka@mth.biglobe.ne.jp>
Diffstat (limited to 'table.c')
-rw-r--r--table.c53
1 files changed, 35 insertions, 18 deletions
diff --git a/table.c b/table.c
index 54eeaa6..2d9d28d 100644
--- a/table.c
+++ b/table.c
@@ -1,4 +1,4 @@
-/* $Id: table.c,v 1.22 2002/03/12 16:59:50 ukai Exp $ */
+/* $Id: table.c,v 1.23 2002/04/09 14:53:54 ukai Exp $ */
/*
* HTML table
*/
@@ -1475,14 +1475,16 @@ check_table_height(struct table *t)
{
int i, j, k;
struct {
- short row[MAXCELL];
- short rowspan[MAXCELL];
- char indexarray[MAXCELL];
+ short *row;
+ short *rowspan;
+ char *indexarray;
short maxcell;
- short height[MAXCELL];
+ short size;
+ short *height;
} cell;
int space = 0;
+ cell.size = 0;
cell.maxcell = -1;
for (j = 0; j <= t->maxrow; j++) {
@@ -1509,21 +1511,36 @@ check_table_height(struct table *t)
if (cell.row[idx] == j && cell.rowspan[idx] == rowspan)
c = idx;
}
- if (c < MAXCELL) {
- if (c > cell.maxcell) {
- cell.maxcell++;
- cell.row[cell.maxcell] = j;
- cell.rowspan[cell.maxcell] = rowspan;
- cell.height[cell.maxcell] = 0;
- if (cell.maxcell > k)
- bcopy(cell.indexarray + k, cell.indexarray + k + 1,
- cell.maxcell - k);
- cell.indexarray[k] = cell.maxcell;
+ if (c >= cell.size) {
+ if (cell.size == 0) {
+ cell.size = max(MAXCELL, c + 1);
+ cell.row = NewAtom_N(short, cell.size);
+ cell.rowspan = NewAtom_N(short, cell.size);
+ cell.indexarray = NewAtom_N(char, cell.size);
+ cell.height = NewAtom_N(short, cell.size);
+ } else {
+ cell.size = max(cell.size + MAXCELL, c + 1);
+ cell.row = New_Reuse(short, cell.row, cell.size);
+ cell.rowspan = New_Reuse(short, cell.rowspan,
+ cell.size);
+ cell.indexarray = New_Reuse(char, cell.indexarray,
+ cell.size);
+ cell.height = New_Reuse(short, cell.height, cell.size);
}
-
- if (cell.height[c] < t_dep)
- cell.height[c] = t_dep;
}
+ if (c > cell.maxcell) {
+ cell.maxcell++;
+ cell.row[cell.maxcell] = j;
+ cell.rowspan[cell.maxcell] = rowspan;
+ cell.height[cell.maxcell] = 0;
+ if (cell.maxcell > k)
+ bcopy(cell.indexarray + k, cell.indexarray + k + 1,
+ cell.maxcell - k);
+ cell.indexarray[k] = cell.maxcell;
+ }
+
+ if (cell.height[c] < t_dep)
+ cell.height[c] = t_dep;
continue;
}
if (t->tabheight[j] < t_dep)