[Webkit-unassigned] [Bug 44258] [EFL] Webkit-EFL API which returns position of n-th text matches mark.

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Aug 23 09:28:07 PDT 2010


https://bugs.webkit.org/show_bug.cgi?id=44258





--- Comment #15 from Rafael Antognolli <antognolli at profusion.mobi>  2010-08-23 09:28:06 PST ---
(In reply to comment #14)
> In exported function you must check all incoming pointers if you are going to modify their content. So:
>     EINA_SAFETY_ON_NULL_RETURN_VAL(x, EINA_FALSE);
>     EINA_SAFETY_ON_NULL_RETURN_VAL(y, EINA_FALSE);
> 
> > +
> > +    Vector<WebCore::IntRect> intRects = sd->frame->document()->markers()->firstRectsForMarkers(WebCore::DocumentMarker::TextMatch);
> > +
> > +    /* remove useless values */
> > +    std::remove_if(intRects.begin(), intRects.end(), isNegativeValue);
> > +
> > +    if (intRects.isEmpty() || n > intRects.size())
> > +      return EINA_FALSE;
> > +
> > +    std::sort(intRects.begin(), intRects.end(), compIntRect);
> > +
> > +    *x = intRects[n - 1].x();
> Otherwise, you could receive a segv here.
> 
> > +    *y = intRects[n - 1].y();
> and here.

Alternatively, you can check if the pointer is not NULL before assigning to it. This would make the parameters not obligatory:

if (x)
    *x = intRects[n - 1].x();

Same for y.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list