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

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

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

Revision 42 Revision 43
446 "End of sketch section (total length: %08x)", len); 446 "End of sketch section (total length: %08x)", len);
447 447
448 return res; 448 return res;
449} 449}
450 450
451
452int psiconv_parse_clipart_section(const psiconv_buffer buf,int lev,
453 psiconv_u32 off, int *length,
454 psiconv_clipart_section *result)
455{
456 int res=0;
457 int len=0;
458 int leng;
459 psiconv_u32 temp;
460
461 psiconv_progress(lev+1,off+len,"Going to read the clipart section");
462 *result = malloc(sizeof(**result));
463
464 psiconv_progress(lev+2,off+len,"Going to read the section ID");
465 temp = psiconv_read_u32(buf,lev+2,off+len);
466 if (temp != PSICONV_ID_CLIPART_ITEM) {
467 psiconv_warn(lev+2,off+len,
468 "Unexpected value in clipart section preamble");
469 psiconv_debug(lev+2,off+len,"Read %08x, expected %08x",temp,
470 PSICONV_ID_CLIPART_ITEM);
471 res = -1;
472 } else
473 psiconv_debug(lev+2,off+len,"Clipart ID: %08x", temp);
474 off += 4;
475
476 psiconv_progress(lev+2,off+len,"Going to read an unknown long");
477 temp = psiconv_read_u32(buf,lev+2,off+len);
478 if (temp != 0x02) {
479 psiconv_warn(lev+2,off+len,
480 "Unexpected value in clipart section preamble");
481 psiconv_debug(lev+2,off+len,"Read %08x, expected %08x",temp,
482 0x02);
483 res = -1;
484 } else
485 psiconv_debug(lev+2,off+len,"First unknown long: %08x", temp);
486 off += 4;
487
488 psiconv_progress(lev+2,off+len,"Going to read a second unknown long");
489 temp = psiconv_read_u32(buf,lev+2,off+len);
490 if (temp != 0) {
491 psiconv_warn(lev+2,off+len,
492 "Unexpected value in clipart section preamble");
493 psiconv_debug(lev+2,off+len,"Read %08x, expected %08x",temp, 0);
494 res = -1;
495 } else
496 psiconv_debug(lev+2,off+len,"Second unknown long: %08x", temp);
497 off += 4;
498
499 psiconv_progress(lev+2,off+len,"Going to read a third unknown long");
500 temp = psiconv_read_u32(buf,lev+2,off+len);
501 if (temp != 0) {
502 psiconv_warn(lev+2,off+len,
503 "Unexpected value in clipart section preamble");
504 psiconv_debug(lev+2,off+len,"Read %08x, expected %08x",temp, 0);
505 res = -1;
506 } else
507 psiconv_debug(lev+2,off+len,"Third unknown long: %08x", temp);
508 off += 4;
509
510 psiconv_progress(lev+2,off+len,"Going to read a fourth unknown long");
511 temp = psiconv_read_u32(buf,lev+2,off+len);
512 if ((temp != 0x0c) && (temp != 0x08)) {
513 psiconv_warn(lev+2,off+len,
514 "Unexpected value in clipart section preamble");
515 psiconv_debug(lev+2,off+len,"Read %08x, expected %08x or %08x",temp,
516 0x0c, 0x08);
517 res = -1;
518 } else
519 psiconv_debug(lev+2,off+len,"Fourth unknown long: %08x", temp);
520 off += 4;
521
522 psiconv_progress(lev+2,off+len,"Going to read the Paint Data Section");
523 res |= psiconv_parse_paint_data_section(buf,lev+2,off+len,&leng,
524 &((*result)->picture));
525 len += leng;
526
527 if (length)
528 *length = len;
529
530 psiconv_progress(lev,off+len-1,
531 "End of clipart section (total length: %08x)", len);
532
533 return res;
534}

Legend:
Removed from v.42  
changed lines
  Added in v.43

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