diff -Naur xlhtml/configure xlhtml-0.5.1.5/configure --- xlhtml/configure 2002-06-08 00:18:06.000000000 +0900 +++ xlhtml-0.5.1.5/configure 2009-10-30 08:35:58.423211000 +0900 @@ -730,7 +730,7 @@ PACKAGE=xlhtml/xlhtml -VERSION=0.5.1 +VERSION=0.5.1.5 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } diff -Naur xlhtml/xlhtml/xlhtml.c xlhtml-0.5.1.5/xlhtml/xlhtml.c --- xlhtml/xlhtml/xlhtml.c 2002-05-17 01:31:32.000000000 +0900 +++ xlhtml-0.5.1.5/xlhtml/xlhtml.c 2009-10-30 09:10:12.337730000 +0900 @@ -333,10 +333,13 @@ Xtract = 1; buf = strdup(argv[i]); ptr = strrchr(buf, '-'); - xr2 = (S16)atoi(ptr+1); + if (ptr != buf) + { + xr2 = (S16)strtol(ptr+1, NULL, 10); *ptr = 0; + } ptr = strchr(buf, ':'); - xr1 = (S16)atoi(ptr+1); + xr1 = (S16)strtol(ptr+1, NULL, 10); free(buf); if (xr1 > xr2) { @@ -700,7 +703,7 @@ void main_line_processor(U16 opcode, U16 version, U32 count, U16 last, U8 data) { int cont_opcode = 0; /* is this the CONTINUE opcode? */ - static U16 last_opcode = -1; /* holds last non-CONTINUE opcode */ + static U16 last_opcode = 0xffff; /* holds last non-CONTINUE opcode */ static U8 working_buffer[WBUFF_SIZE]; static unsigned int bufidx = 0; /* the index into the working buffer */ static unsigned int buflast = 0; /* the expected length of the working buffer */ @@ -750,6 +753,7 @@ case 0x2F: /* File is password protected */ printf("File is password protected. Exiting..."); exit(1); + break; case 0x09: /* BOF */ working_buffer[bufidx++] = data; if (bufidx == last) @@ -773,7 +777,11 @@ } sheet_count++; if (sheet_count >= (int)max_worksheets) - add_more_worksheet_ptrs(); + if (add_more_worksheet_ptrs()) + return; + if (ws_array[sheet_count] == 0) + if (ws_init(sheet_count)) + return; } break; case 0x01: /* Blank */ @@ -1650,7 +1658,8 @@ working_buffer[bufidx++] = data; if (bufidx == last) { - U16 num, fr, lr, fc, lc, i, j, k; + U16 num, fr, lr, i, j; + S16 fc, lc, k; ws_array[sheet_count]->spanned = 1; num = getShort(&working_buffer[0]); if (ws_array[sheet_count]->c_array == 0) @@ -1694,11 +1703,16 @@ { / Need to create one... printf("Bad One at:%d %d %d
\n", sheet_count, j, k); } */ + if (k == lc) break; } + if (j == lr) break; } } /* Now reset the first one... */ /* printf("s:%d fr:%d fc:%d lr:%d lc:%d
\n", sheet_count, fr, fc, lr, lc); */ + if (fr * ws_array[sheet_count]->max_cols >= (ROWS_INCR * COLS_INCR)) { + break; + } c = ws_array[sheet_count]->c_array[(fr*ws_array[sheet_count]->max_cols)+fc]; if (c != 0) { @@ -2906,6 +2920,16 @@ if (Csv) printf("\""); break; + case 0x16: /* Date/Time: m-d-y h:mm */ + if (Csv) + printf ("\""); + num = atol ((char *) u->str); + NumToDate(num, &year, &month, &date); + FracToTime(u->str, &hr, &minu, 0, 0); + printf ("%d-%d-%02d %d:%02d", month, date, year, hr, minu); + if (Csv) + printf ("\""); + break; case 0x25: /* Number with comma, no decimal */ if (Csv) printf("\""); @@ -3043,7 +3067,7 @@ void PrintFloatComma(char *fformat, int is_currency, F64 d) { int len, int_len, dec_len; - char *ptr2, buf[64]; + unsigned char *ptr2, buf[64]; sprintf(buf, fformat, fabs(d)); len = strlen(buf); @@ -3054,7 +3078,7 @@ dec_len = len - int_len; if (isdigit(buf[0]) == 0) { - char *ptr = &buf[0]; + unsigned char *ptr = &buf[0]; while (isdigit(*ptr) == 0) { int_len--; @@ -3072,7 +3096,7 @@ if (int_len > 3) { /* we have to do it the hard way... */ - char rbuf[64], buf2[64]; + unsigned char rbuf[64], buf2[64]; int neg, i, j, count=0; if (d < 0.0) @@ -3874,7 +3898,10 @@ if (numCustomColors) { if ((font_array[fnt_idx]->c_idx < numCustomColors)&&use_colors) + if (font_array[fnt_idx]->c_idx >= 8) { strcpy(color, (char *)customColors[font_array[fnt_idx]->c_idx-8]); + } else + strcpy(color, "000000"); else strcpy(color, "000000"); } diff -Naur xlhtml/xlhtml/xlhtml.h xlhtml-0.5.1.5/xlhtml/xlhtml.h --- xlhtml/xlhtml/xlhtml.h 2002-05-17 01:31:32.000000000 +0900 +++ xlhtml-0.5.1.5/xlhtml/xlhtml.h 2009-10-30 08:35:58.493215000 +0900 @@ -46,7 +46,7 @@ #include /* Used by packed string array Opcode: 0xFC */ -#define HARD_MAX_ROWS_97 0x7FFE /*!< Used in add_wb_array to prevent OOM */ +#define HARD_MAX_ROWS_97 0xFFFF /*!< Used in add_wb_array to prevent OOM */ #define HARD_MAX_ROWS_95 0x3FFF /*!< Used in add_wb_array to prevent OOM */ #define HARD_MAX_COLS 256 /*!< Used in add_wb_array to prevent OOM */ @@ -157,6 +157,7 @@ extern int aggressive; extern int center_tables; extern int NoHeaders; +extern int TableHeaders; extern int formula_warnings; extern int Csv; extern xf_attr **xf_array; @@ -186,6 +187,7 @@ extern int MaxFontsExceeded; extern int UnicodeStrings; extern int CodePage; +extern int WorkingBufferOverflow; void OutputString (uni_string *);