--- psiconv/trunk/lib/psiconv/parse_word.c 2000/12/15 00:21:51 64 +++ psiconv/trunk/lib/psiconv/parse_word.c 2002/01/29 18:38:38 142 @@ -18,8 +18,16 @@ */ #include "config.h" +#include "compat.h" + #include + #include "parse_routines.h" +#include "error.h" + +#ifdef DMALLOC +#include +#endif int psiconv_parse_word_status_section(const psiconv_buffer buf, int lev, psiconv_u32 off, int *length, @@ -135,11 +143,11 @@ len += 0x04; psiconv_progress(lev+2,off+len,"Going to read display size"); - (*result)->cursor_position = psiconv_read_u32(buf,lev+2,off + len,&res); + (*result)->display_size = psiconv_read_u32(buf,lev+2,off + len,&res); if (res) goto ERROR2; psiconv_debug(lev+2,off+len,"Display size: %08x", - (*result)->cursor_position); + (*result)->display_size); len += 0x04; if (length) @@ -306,14 +314,14 @@ psiconv_debug(lev+3,off+len,"Outline Level: %08x", style->outline_level); len += 4; psiconv_progress(lev+3,off+len,"Going to read the character codes"); - if (!(style->character = psiconv_basic_character_layout())) + if (!(style->character = psiconv_clone_character_layout((*result)->normal->character))) goto ERROR6; if ((res = psiconv_parse_character_layout_list(buf,lev+3,off+len,&leng, style->character))) goto ERROR7; len += leng; psiconv_progress(lev+3,off+len,"Going to read the paragraph codes"); - if (!(style->paragraph = psiconv_basic_paragraph_layout())) + if (!(style->paragraph = psiconv_clone_paragraph_layout((*result)->normal->paragraph))) goto ERROR7; if ((res = psiconv_parse_paragraph_layout_list(buf,lev+3,off+len,&leng, style->paragraph))) @@ -321,6 +329,20 @@ len += leng; } + psiconv_progress(lev+2,off+len,"Reading trailing bytes"); + for (i = 0; i < psiconv_list_length((*result)->styles); i++) { + temp = psiconv_read_u8(buf,lev+3,off+len,&res); + if (res) + goto ERROR4; + if (temp != 0xff) { + psiconv_warn(lev+3,off+len,"Unknown trailing style byte"); + psiconv_debug(lev+3,off+len,"Trailing byte: %02x expected, read %02x", + 0xff,temp); + } else + psiconv_debug(lev+3,off+len,"Read trailing byte 0xff"); + len++; + } + if (length) *length = len;