[vlc-devel] [PATCH 4/5] stream_ReadLine: support arbitrary length limit

Pierre Ynard linkfanel at yahoo.fr
Tue Sep 8 15:53:33 CEST 2020


> - Rémi doesn't want to extend ReadLine for html parsing because html
>   parsing should not be done by line. He is right on that point.

Either way, as I've been trying to make that point, I believe that
stream_ReadLine() should be extended anyway, in particular because it
seems like a better solution to address Rémi's own concerns about it.

> My main question is : how long will it take to fix the lua parsing to
> not use readline?

We can't make it go away from the lua API. It's what makes it popular
and successful, and we need to keep it for all current scripts that use
it anyway.

If you're talking about converting individual scripts, that's different;
but I'm the main maintainer of in-tree scripts and I don't believe it
should be done at all.

> I don't really understand the purpose of readline here, since a html
> element can break into multiples lines anyway.

As I said previously, the reality is that in my experience it's never
been a practical issue. Even if it happens to be broken up across lines
in a troublesome way, it's always possible to manually call readline()
again after anchoring on the beginning of it; some scripts do that.

> What you could do instead, is creating a ReadElements in lua, that
> read a chunk of data and ensure the buffer starts with a '<' and ends
> with a '>' (and keep the part past the last '>' for the next read).

You still need to navigate the stream to search and find the beginning
of that element of interest.

-- 
Pierre Ynard
"Une âme dans un corps, c'est comme un dessin sur une feuille de papier."


More information about the vlc-devel mailing list