vendor/swftools/lib/pdf/xpdf/XRef.cc
GBool XRef::readXRef(Guint *pos) {
  Parser *parser;
  Object obj;
  GBool more;

  // start up a parser, parse one token
  obj.initNull();
  parser = new Parser(NULL,
	     new Lexer(NULL,
	       str->makeSubStream(start + *pos, gFalse, 0, &obj)),
	     gTrue);
  parser->getObj(&obj);

  // parse an old-style xref table
  if (obj.isCmd("xref")) {
    obj.free();
    more = readXRefTable(parser, pos);

  // parse an xref stream
  } else if (obj.isInt()) {
    obj.free();
    if (!parser->getObj(&obj)->isInt()) {
      goto err1;
    }
    obj.free();
    if (!parser->getObj(&obj)->isCmd("obj")) {
      goto err1;
    }
    obj.free();
    if (!parser->getObj(&obj)->isStream()) {
      goto err1;
    }
    more = readXRefStream(obj.getStream(), pos);
    obj.free();

  } else {
    goto err1;
  }

  delete parser;
  return more;

 err1:
  obj.free();
  delete parser;
  ok = gFalse;
  return gFalse;
}
// Read one xref table section.  Also reads the associated trailer
// dictionary, and returns the prev pointer (if any).
Read one xref table section.  Also reads the associated trailer
dictionary, and returns the prev pointer (if any).
Read one xref table section . Also reads the associated trailer dictionary and returns the prev pointer ( if any ) .
GBool XRef::readXRef(Guint *pos) {
  Parser *parser;
  Object obj;
  GBool more;
  obj.initNull();
  parser = new Parser(NULL,
	     new Lexer(NULL,
	       str->makeSubStream(start + *pos, gFalse, 0, &obj)),
	     gTrue);
  parser->getObj(&obj);
  if (obj.isCmd("xref")) {
    obj.free();
    more = readXRefTable(parser, pos);
  } else if (obj.isInt()) {
    obj.free();
    if (!parser->getObj(&obj)->isInt()) {
      goto err1;
    }
    obj.free();
    if (!parser->getObj(&obj)->isCmd("obj")) {
      goto err1;
    }
    obj.free();
    if (!parser->getObj(&obj)->isStream()) {
      goto err1;
    }
    more = readXRefStream(obj.getStream(), pos);
    obj.free();
  } else {
    goto err1;
  }
  delete parser;
  return more;
 err1:
  obj.free();
  delete parser;
  ok = gFalse;
  return gFalse;
}
GBool XRef :: readXRef ( Guint * pos ) { Parser * parser ; Object obj ; GBool more ; obj . initNull ( ) ; parser = new Parser ( NULL , new Lexer ( NULL , str -> makeSubStream ( start + * pos , gFalse , 0 , & obj ) ) , gTrue ) ; parser -> getObj ( & obj ) ; if ( obj . isCmd ( " " ) ) { obj . free ( ) ; more = readXRefTable ( parser , pos ) ; } else if ( obj . isInt ( ) ) { obj . free ( ) ; if ( ! parser -> getObj ( & obj ) -> isInt ( ) ) { goto err1 ; } obj . free ( ) ; if ( ! parser -> getObj ( & obj ) -> isCmd ( " " ) ) { goto err1 ; } obj . free ( ) ; if ( ! parser -> getObj ( & obj ) -> isStream ( ) ) { goto err1 ; } more = readXRefStream ( obj . getStream ( ) , pos ) ; obj . free ( ) ; } else { goto err1 ; } delete parser ; return more ; err1 : obj . free ( ) ; delete parser ; ok = gFalse ; return gFalse ; }
Read one xref table section.
Read one xref table section .
// start up a parser, parse one token // parse an old-style xref table // parse an xref stream