--- psiconv/trunk/lib/psiconv/parse_page.c 2000/12/25 00:26:53 76 +++ psiconv/trunk/lib/psiconv/parse_page.c 2001/03/06 23:59:46 111 @@ -31,7 +31,7 @@ { int res = 0; int len = 0; - int i,leng; + int i,leng,has_content; psiconv_u32 temp; psiconv_progress(lev+1,off,"Going to read a page header (or footer)"); @@ -39,15 +39,21 @@ goto ERROR1; psiconv_progress(lev+2,off+len, - "Going to read the first byte (0x01 expected)"); + "Going to read the has_content flag"); temp = psiconv_read_u8(buf,lev+2,off+len,&res); if (res) goto ERROR2; - if (temp != 0x01) { - psiconv_warn(lev+2,off+len,"Page header first byte mismatch"); - psiconv_debug(lev+2,off+len,"First byte: read %02x, expected %02x", - temp,0x01); + if (temp == 0x00) + has_content = 0; + else if (temp == 0x01) + has_content = 1; + else { + psiconv_warn(lev+2,off+len, + "Page header has_content flag unknown value (assumed default)"); + psiconv_debug(lev+2,off+len,"Flag: %02x",temp); + has_content = 1; } + psiconv_debug(lev+2,off+len,"Has_content flag: %02x",has_content); len += 1; psiconv_progress(lev+2,off+len,"Going to read displayed-on-first-page flag"); @@ -72,27 +78,34 @@ psiconv_progress(lev+2,off+len,"Going to read base paragraph layout"); if (!((*result)->base_paragraph_layout = psiconv_basic_paragraph_layout())) goto ERROR2; - if ((res = psiconv_parse_paragraph_layout_list(buf,lev+2,off+len,&leng, - (*result)->base_paragraph_layout))) - goto ERROR3; - len += leng; + + if (has_content) { + if ((res = psiconv_parse_paragraph_layout_list(buf,lev+2,off+len,&leng, + (*result)->base_paragraph_layout))) + goto ERROR3; + len += leng; + } psiconv_progress(lev+2,off+len,"Going to read base character layout"); if (!((*result)->base_character_layout = psiconv_basic_character_layout())) goto ERROR3; - if ((res = psiconv_parse_character_layout_list(buf,lev+2,off+len,&leng, - (*result)->base_character_layout))) - goto ERROR4; + if (has_content) { + if ((res = psiconv_parse_character_layout_list(buf,lev+2,off+len,&leng, + (*result)->base_character_layout))) + goto ERROR4; + } len += leng; psiconv_progress(lev+2,off+len,"Going to read the TextEd section"); - if ((res = psiconv_parse_texted_section(buf,lev+2,off+len,&leng, - &(*result)->text, - (*result)->base_character_layout, - (*result)->base_paragraph_layout))) - goto ERROR4; - len += leng; + if (has_content) { + if ((res = psiconv_parse_texted_section(buf,lev+2,off+len,&leng, + &(*result)->text, + (*result)->base_character_layout, + (*result)->base_paragraph_layout))) + goto ERROR4; + len += leng; + } if (length) *length = len;