[Poppler-bugs] [Bug 70901] Add getter and setter for annotation's rectangle

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Thu Nov 7 00:12:26 PST 2013


https://bugs.freedesktop.org/show_bug.cgi?id=70901

--- Comment #8 from Carlos Garcia Campos <carlosgc at gnome.org> ---
(In reply to comment #6)
> (In reply to comment #5)
> > (In reply to comment #3)
> > > Created attachment 88728 [details] [review] [review] [review]
> > > glib: Add getter and setter for annotation's rectangle
> > > 
> > > Updated patch.
> > > 
> > > Instead of using a reference in poppler_annot_get_rectangle, I think it is
> > > better to just return a PopplerRectangle. I am unsure of the default values
> > > for g_return_val_if_fail.  Either 0,0,0,0 or -1,-1,-1,-1.
> > 
> > Same idea here. Instead of returning the struct, you can return a pointer as
> > an out parameter. To avoid the problem of how to represent an invalid
> > rectangle, make the function return a boolean. When the function returns
> > FALSE the value of the rectangle is undefined, whatever the user passed.
> > 
> > PopplerRectangle rect;
> > if (!poppler_annot_get_rect (annot, &rect))
> >     /* Do whatever with the rect */
> 
> This is what the first patch did.

Yes, and I only asked when can this return FALSE, because I still think that
from the user point of view, this should never be false. The rectangle is a
required field of any annotation, so it should always return a valid rectangle,
otherwise it's a bug because we are discarding invalid annots in the core. So,
I think we should just make it void and add g_return_if_fail if the passed in
pointer is not an annot. It's a programmer error to pass an invalid annot.
Sorry for the misunderstanding.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/poppler-bugs/attachments/20131107/aa311cf0/attachment-0001.html>


More information about the Poppler-bugs mailing list