--- psiconv/trunk/lib/psiconv/parse_page.c 2000/12/15 00:21:51 64 +++ psiconv/trunk/lib/psiconv/parse_page.c 2000/12/25 00:26:53 76 @@ -18,11 +18,13 @@ */ #include "config.h" +#include "compat.h" + #include #include -#include "data.h" #include "parse_routines.h" +#include "error.h" int psiconv_parse_page_header(const psiconv_buffer buf,int lev,psiconv_u32 off, int *length,psiconv_page_header *result) @@ -39,7 +41,7 @@ psiconv_progress(lev+2,off+len, "Going to read the first byte (0x01 expected)"); temp = psiconv_read_u8(buf,lev+2,off+len,&res); - if (!res) + if (res) goto ERROR2; if (temp != 0x01) { psiconv_warn(lev+2,off+len,"Page header first byte mismatch"); @@ -194,28 +196,38 @@ temp = psiconv_read_u32(buf,lev+2,off+len,&res); if (res) goto ERROR4; - if (temp != PSICONV_ID_PAGE_DIMENSIONS) { + if ((temp != PSICONV_ID_PAGE_DIMENSIONS1) && + (temp != PSICONV_ID_PAGE_DIMENSIONS2)) { psiconv_warn(lev+2,off+len, "Page layout section page dimensions marker not found"); psiconv_debug(lev+2,off+len, - "Page dimensions marker: read %08x, expected %08x",temp, - PSICONV_ID_PAGE_DIMENSIONS); + "Page dimensions marker: read %08x, expected %08x or %08x", + temp, PSICONV_ID_PAGE_DIMENSIONS1, + PSICONV_ID_PAGE_DIMENSIONS2); } + len += 4; psiconv_progress(lev+2,off+len,"Going to read the page width"); (*result)->page_width = psiconv_read_length(buf,lev+2,off+len,&leng,&res); - if (!res) + if (res) goto ERROR4; psiconv_debug(lev+2,off+len,"Page width: %6.3f",(*result)->page_width); len += leng; psiconv_progress(lev+2,off+len,"Going to read the page height"); (*result)->page_height = psiconv_read_length(buf,lev+2,off+len,&leng,&res); - if (!res) + if (res) goto ERROR4; psiconv_debug(lev+2,off+len,"Page height: %6.3f",(*result)->page_height); len += leng; + psiconv_progress(lev+2,off+len,"Going to read page portrait/landscape"); + if ((res = psiconv_parse_bool(buf,lev+2,off+len,&leng,&(*result)->landscape))) + goto ERROR4; + psiconv_debug(lev+2,off+len,"Landscape: %d",(*result)->landscape); + len += leng; + + if (length) *length = len;