[poppler] Annot Improving (II)

Jeff Muizelaar jeff at infidigm.net
Tue Nov 6 11:06:06 PST 2007


On Tue, Nov 06, 2007 at 09:53:44AM +0100, Iñigo Martínez wrote:
> 2007/11/6, Jeff Muizelaar <jeff at infidigm.net>:
> > On Tue, Nov 06, 2007 at 12:33:20AM +0100, Iñigo Martínez wrote:
> > > +    (obj1.arrayGet(1, &obj2)->isNum() ? rect->y1 = obj2.getNum() : rect->y1 = 0);
> > > +    obj2.free();
> > > +    (obj1.arrayGet(2, &obj2)->isNum() ? rect->x2 = obj2.getNum() : rect->x2 = 1);
> > > +    obj2.free();
> > > +    (obj1.arrayGet(3, &obj2)->isNum() ? rect->y2 = obj2.getNum() : rect->y2 = 1);
> > > +    obj2.free();
> >
> > The old code defaults to xMax and yMax of 0. Why the change to 1?
> 
> Umm, the old code defaults both xMax and yMax to 0 in the case of the
> object not being a number in the readArrayNum method. But in those
> cases readArrayNum sets 'ok' to false, so once it returns, the code
> checks 'ok' in the condition and sets their values to 1 for both. In
> the new code, it does check every object without caring about the
> rest. If any of them is wrong, the object isn't a number object, it
> does reset the value to its default value.

Yeah, I missed the setting to 1 later on. Sorry :)

> 
> Sincerely, I don't know what should be the correct behaviour. The
> 'Rect' entry is a required field, so if something is wrong there you
> can't ignore the object, it must be filled with something.
> 
> This is a question (one of many :p) I had some time ago. What should
> be done where the data is wrong on an object ? In some entries default
> values are specified, but not in others. Do you use any policy to
> handle this cases ?

Generally, the best approach is to try to determine what acroread does
in the missing data case. This can be quite a bit of work, but it does
give you a pretty authoratative answer.

-Jeff


More information about the poppler mailing list