On Mon, Jan 17, 2011 at 09:08:32PM +0100, Reimar Döffinger wrote:
On Wed, Jan 12, 2011 at 11:44:32PM +0100, Clément Bœsch wrote:
I just made a small equivalent to the GNU asprintf function (since I suppose it's not available on all system supported by mplayer) in order to use it in a few places instead of fixed size buffers like BUFLENGTH in some vo (jpeg, png, …) and maybe a few other PATH_MAX we were speaking a while ago.
Well, I wonder which case you think is worth the effort. PATH_MAX + stack isn't so great but it's not such a big issue,
I thought about using PATH_MAX in a few places, but under Linux (at least here), it is set to 4096, which make quiet a big buffer for nothing… And even though, it may not be enough sometimes while in most case it is too much.
and actually it may be a smaller issue that using this method and ending up bringing the PC to its knees swapping because someone by accident gave a 2GB file as playlist and MPlayer tries to actually use a 2GB string as file name...
This is imo a special case which could be handled differently, and we can still use PATH_MAX in some places. The point is that it may be a good helper in a few places. And we could use this function in a few other places, for example all the manual snprintf workaround we recently made regarding the http streaming and proxy. -- Clément B.