--- psiconv/trunk/lib/psiconv/parse_word.c 2000/12/20 22:07:49 70 +++ psiconv/trunk/lib/psiconv/parse_word.c 2003/06/16 17:48:39 151 @@ -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) @@ -266,7 +274,7 @@ if (!(style = malloc(sizeof(*style)))) goto ERROR5; style->hotkey = 0; - if (!(psiconv_list_add((*result)->styles,style))) { + if (psiconv_list_add((*result)->styles,style)) { free(style); goto ERROR5; } @@ -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;