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

Vicente Jiménez googuy at gmail.com
Wed Jun 10 13:29:07 CEST 2009


Thanks for the review!

I've suposed it was C++ code because of the file extension. I was
looking for similar parameter operations in the code but found none
and I supposed that the concatenation could be done with +. Thanks for
the clarifications.

You mean to do:
            ppsz_argv[ppsz_argc++] = "--aspect-ratio";
            ppsz_argv[ppsz_argc++] = argv[i];

Is this correct?

I attached a corrected patch.

Best regards
vicente

On Wed, Jun 10, 2009 at 12:52 PM, <jpd at videolan.org> wrote:
> 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.
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> http://mailman.videolan.org/listinfo/vlc-devel
>



More information about the vlc-devel mailing list