Hi Alvin,
what I can confirm for sure is that a text length is not a buffer size,
so the text length is exactly the size of the strings _without_ the null 
terminator.
So the current behavior is the good one.

IMHO, If you saw a different behavior in 1.3 ; this was clearly a bug that is 
solved today apparently.

Fabien

> Alvin wrote:
>
> > Hello,
> >
> > I'm using FLTK 1.3 r6634 and I am seeing a potential off-by-one error with
> > Fl:event_length(). In past revision of FLTK 1.3.x, Fl::event_length()
> > would return the number of bytes stored in Fl::event_text() (upon
> > receiving a FL_PASTE after a FL_DND_RELEASE event). However, what I am
> > seeing now is the Fl::event_length() is returning the number of
> > characters. The difference this make is that the null-terminator is not
> > included in the count returned by Fl::event_length().
> >
> > The effect this has is when I try to copy the text that is returned by
> > Fl::event_text() I append the null-terminator at
> > copy_text[Fl::event_length()-1] = '\0'; What this does in r6638 is remove
> > the last character. So, with a URL of "/home/alvin/file.png" I
> > get "/home/alvin/file.pn". In past revision (not sure when this
> > started) I would get "/home/alvin/file.png"
> >
> > Anyone else experiencing this?
> >
> > P.S. I had to manipulate this message in order to be able to post this
> > message. For some reason news.easysw.com say this post as spam?
> >
>
> Just to follow up on the P.S. statement, the problem was that my subject was
> original "DnD". Perhaps it was too short?
>
> Also, the paths I mention in the above method should include the file://
> prefix, but I removed them when trying to post this message.
> --
> Alvin

_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to