/[public]/psiconv/trunk/lib/psiconv/parse_page.c
ViewVC logotype

Diff of /psiconv/trunk/lib/psiconv/parse_page.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 65 Revision 76
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18*/ 18*/
19 19
20#include "config.h" 20#include "config.h"
21#include "compat.h"
22
21#include <stdlib.h> 23#include <stdlib.h>
22#include <string.h> 24#include <string.h>
23 25
24#include "data.h"
25#include "parse_routines.h" 26#include "parse_routines.h"
27#include "error.h"
26 28
27int psiconv_parse_page_header(const psiconv_buffer buf,int lev,psiconv_u32 off, 29int psiconv_parse_page_header(const psiconv_buffer buf,int lev,psiconv_u32 off,
28 int *length,psiconv_page_header *result) 30 int *length,psiconv_page_header *result)
29{ 31{
30 int res = 0; 32 int res = 0;
192 194
193 psiconv_progress(lev+2,off+len,"Going to read page dimensions id"); 195 psiconv_progress(lev+2,off+len,"Going to read page dimensions id");
194 temp = psiconv_read_u32(buf,lev+2,off+len,&res); 196 temp = psiconv_read_u32(buf,lev+2,off+len,&res);
195 if (res) 197 if (res)
196 goto ERROR4; 198 goto ERROR4;
197 if (temp != PSICONV_ID_PAGE_DIMENSIONS) { 199 if ((temp != PSICONV_ID_PAGE_DIMENSIONS1) &&
200 (temp != PSICONV_ID_PAGE_DIMENSIONS2)) {
198 psiconv_warn(lev+2,off+len, 201 psiconv_warn(lev+2,off+len,
199 "Page layout section page dimensions marker not found"); 202 "Page layout section page dimensions marker not found");
200 psiconv_debug(lev+2,off+len, 203 psiconv_debug(lev+2,off+len,
201 "Page dimensions marker: read %08x, expected %08x",temp, 204 "Page dimensions marker: read %08x, expected %08x or %08x",
205 temp, PSICONV_ID_PAGE_DIMENSIONS1,
202 PSICONV_ID_PAGE_DIMENSIONS); 206 PSICONV_ID_PAGE_DIMENSIONS2);
203 } 207 }
204 len += 4; 208 len += 4;
205 209
206 psiconv_progress(lev+2,off+len,"Going to read the page width"); 210 psiconv_progress(lev+2,off+len,"Going to read the page width");
207 (*result)->page_width = psiconv_read_length(buf,lev+2,off+len,&leng,&res); 211 (*result)->page_width = psiconv_read_length(buf,lev+2,off+len,&leng,&res);
214 (*result)->page_height = psiconv_read_length(buf,lev+2,off+len,&leng,&res); 218 (*result)->page_height = psiconv_read_length(buf,lev+2,off+len,&leng,&res);
215 if (res) 219 if (res)
216 goto ERROR4; 220 goto ERROR4;
217 psiconv_debug(lev+2,off+len,"Page height: %6.3f",(*result)->page_height); 221 psiconv_debug(lev+2,off+len,"Page height: %6.3f",(*result)->page_height);
218 len += leng; 222 len += leng;
223
224 psiconv_progress(lev+2,off+len,"Going to read page portrait/landscape");
225 if ((res = psiconv_parse_bool(buf,lev+2,off+len,&leng,&(*result)->landscape)))
226 goto ERROR4;
227 psiconv_debug(lev+2,off+len,"Landscape: %d",(*result)->landscape);
228 len += leng;
229
219 230
220 if (length) 231 if (length)
221 *length = len; 232 *length = len;
222 233
223 psiconv_progress(lev,off+len-1,"End of page section (total length: %08x)", 234 psiconv_progress(lev,off+len-1,"End of page section (total length: %08x)",

Legend:
Removed from v.65  
changed lines
  Added in v.76

frodo@frodo.looijaard.name
ViewVC Help
Powered by ViewVC 1.1.26