From d530b69de773b769650be7b89707fb81eb665173 Mon Sep 17 00:00:00 2001 From: slidedraw Date: Mon, 8 Apr 2002 21:11:26 +0000 Subject: [PATCH] Added support for filenames up to 256 characters. --- xlhtml/xlhtml.c | 84 ++----------------------------------------------- xlhtml/xlhtml.h | 79 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+), 81 deletions(-) diff --git a/xlhtml/xlhtml.c b/xlhtml/xlhtml.c index 9574c99..3fc974f 100644 --- a/xlhtml/xlhtml.c +++ b/xlhtml/xlhtml.c @@ -27,86 +27,8 @@ #include "tuneable.h" #include "xlhtml.h" -static char SectionName[2][12] = /* The section of the Excel Stream where the workbooks are kept */ -{ - "/Workbook", /*!< Excel 97 & 2000 */ - "/Book" /*!< Everything else ? */ -}; -typedef struct /*!< This encapsulates the Unicode String */ -{ - U8 uni; /*!< Unicode String: 0==ASCII/8859-1, 1==windows-1252, 2==utf-8 */ - U8 *str; /*!< Characters of string */ - U16 len; /*!< Length of string */ - U8 *fmt_run; /*!< formatting run, short pairs: offset, index to font */ - U8 crun_cnt; /*!< The count of format runs */ -}uni_string; - -typedef struct /*!< This is everything we need for a cell */ -{ - U16 xfmt; /*!< The high bit will tell us which version 0 =< 2; 1 == 2+ */ - U16 type; /*!< This will record the record type that generated the cell */ - U16 spanned; /*!< If 1 don't output */ - uni_string ustr; /*!< The cell's displayed contents */ - U16 rowspan; /*!< rows to span */ - U16 colspan; /*!< columns to span */ - uni_string h_link; /*!< If a hyperlinked cell, this is the link*/ -}cell; - -typedef struct /*!< This encapsulates some information about each worksheet */ -{ - U32 first_row; - S32 biggest_row; - U32 max_rows; - U16 first_col; - S16 biggest_col; - U16 max_cols; - uni_string ws_title; - cell **c_array; - U16 spanned; -}work_sheet; - -typedef struct /*!< This is everything we need to know about fonts */ -{ - U16 size; - U16 attr; - U16 c_idx; - U16 bold; - U16 super; - U8 underline; - uni_string name; -}font_attr; - -typedef struct -{ - uni_string *name; - U16 cnt; -}fnt_cnt; - -typedef struct /*!< This covers the Extended Format records */ -{ - U16 fnt_idx; - U16 fmt_idx; - U16 gen; - U16 align; - U16 indent; - U16 b_style; - U16 b_l_color; - U32 b_t_color; - U16 cell_color; -}xf_attr; - -typedef struct /*!< HTML Attribute */ -{ - int fflag; /*!< Font Flag */ - int bflag; /*!< Bold Flag */ - int iflag; /*!< Itallic Flag */ - int sflag; /*!< Strike thru flag */ - int uflag; /*!< Underline flag */ - int sbflag; /*!< Subscript */ - int spflag; /*!< Superscript */ -}html_attr; static int numCustomColors = 0; @@ -251,7 +173,7 @@ static void add_xf_array(U16 fnt_idx, U16 fmt_idx, U16 gen, U16 align, /* Global data */ -static char filename[128]; +static char filename[256]; static int file_version = 0; static U32 next_string=0; static unsigned int next_font=0, next_ws_title=0, next_xf=0; @@ -345,8 +267,8 @@ int main (int argc, char **argv) } else { - strncpy(filename, argv[argc-1], 124); - filename[124] = 0; + strncpy(filename, argv[argc-1], 252); + filename[252] = 0; for (i=1; i<(argc-1); i++) { if (strcmp(argv[i], "-nc") == 0) diff --git a/xlhtml/xlhtml.h b/xlhtml/xlhtml.h index 221a85c..2f11f74 100644 --- a/xlhtml/xlhtml.h +++ b/xlhtml/xlhtml.h @@ -42,3 +42,82 @@ U16 HARD_MAX_ROWS = HARD_MAX_ROWS_97; #define GLOBAL_UMASK (2) #endif +typedef struct /*!< This encapsulates the Unicode String */ +{ + U8 uni; /*!< Unicode String: 0==ASCII/8859-1, 1==windows-1252, 2==utf-8 */ + U8 *str; /*!< Characters of string */ + U16 len; /*!< Length of string */ + U8 *fmt_run; /*!< formatting run, short pairs: offset, index to font */ + U8 crun_cnt; /*!< The count of format runs */ +}uni_string; + +typedef struct /*!< This is everything we need for a cell */ +{ + U16 xfmt; /*!< The high bit will tell us which version 0 =< 2; 1 == 2+ */ + U16 type; /*!< This will record the record type that generated the cell */ + U16 spanned; /*!< If 1 don't output */ + uni_string ustr; /*!< The cell's displayed contents */ + U16 rowspan; /*!< rows to span */ + U16 colspan; /*!< columns to span */ + uni_string h_link; /*!< If a hyperlinked cell, this is the link*/ +}cell; + +typedef struct /*!< This encapsulates some information about each worksheet */ +{ + U32 first_row; + S32 biggest_row; + U32 max_rows; + U16 first_col; + S16 biggest_col; + U16 max_cols; + uni_string ws_title; + cell **c_array; + U16 spanned; +}work_sheet; + +typedef struct /*!< This is everything we need to know about fonts */ +{ + U16 size; + U16 attr; + U16 c_idx; + U16 bold; + U16 super; + U8 underline; + uni_string name; +}font_attr; + +typedef struct +{ + uni_string *name; + U16 cnt; +}fnt_cnt; + +typedef struct /*!< This covers the Extended Format records */ +{ + U16 fnt_idx; + U16 fmt_idx; + U16 gen; + U16 align; + U16 indent; + U16 b_style; + U16 b_l_color; + U32 b_t_color; + U16 cell_color; +}xf_attr; + +typedef struct /*!< HTML Attribute */ +{ + int fflag; /*!< Font Flag */ + int bflag; /*!< Bold Flag */ + int iflag; /*!< Itallic Flag */ + int sflag; /*!< Strike thru flag */ + int uflag; /*!< Underline flag */ + int sbflag; /*!< Subscript */ + int spflag; /*!< Superscript */ +}html_attr; + +static char SectionName[2][12] = /* The section of the Excel Stream where the workbooks are kept */ +{ + "/Workbook", /*!< Excel 97 & 2000 */ + "/Book" /*!< Everything else ? */ +};