[vlc-devel] [PATCH] Enable aspectratio parameter in mozilla plugin

jpd at videolan.org jpd at videolan.org
Wed Jun 10 12:52:46 CEST 2009


On Wed, Jun 10, 2009 at 12:25:08PM +0200, Vicente Jim?nez wrote:
> Could somebody review this patch?

The indentation is off but more importantly, it'll probably segfault.

> +	    ppsz_argv[ppsz_argc++] = "--aspect-ratio=" + argv[i];

Short answer: The arguments are (const) char *.


Long answer: Doing arithmetic on char * will not yield the expected
results. The alternative using operator+ would use std::string temporaries
and at best generate a memory leak, but more likely a stale pointer. This
is C code at heart so concatenating requires an extra, visible, buffer,
but you'll be better off not trying to concatenate the strings at all,
instead drop the = and use a separate ppsz_argv entry for the argument.




More information about the vlc-devel mailing list