[FFmpeg-devel] [PATCH] param check in sws_getCachedContext()
Måns Rullgård
mans
Wed Jan 16 20:53:30 CET 2008
Michael Niedermayer <michaelni at gmx.at> writes:
> On Thu, Jan 17, 2008 at 12:15:23AM +0900, KO Myung-Hun wrote:
>> Hi/2.
>>
>> Michael Niedermayer wrote:
>> > On Wed, Jan 09, 2008 at 07:15:19PM +0900, KO Myung-Hun wrote:
>> >
>> >> Hi/2.
>> >>
>> >> sws_getCachecContext() always calls sws_getContext() if 'param' is NULL
>> >> or its address is changed.
>> >>
>> >> So, 'param' should be checked as the patch.
>>
>> How about this ?
> [...]
>> Index: libswscale/swscale.c
>> ===================================================================
>> --- libswscale/swscale.c (revision 25625)
>> +++ libswscale/swscale.c (working copy)
>> @@ -2959,12 +2959,17 @@
>> int dstW, int dstH, int dstFormat, int flags,
>> SwsFilter *srcFilter, SwsFilter *dstFilter, double *param)
>> {
>> + static double default_param[ 2 ] = { SWS_PARAM_DEFAULT, SWS_PARAM_DEFAULT };
>
> static const
>
>> +
>> + if( !param )
>> + param = default_param;
>> +
>> if (context != NULL) {
>> if ((context->srcW != srcW) || (context->srcH != srcH) ||
>> (context->srcFormat != srcFormat) ||
>> (context->dstW != dstW) || (context->dstH != dstH) ||
>> (context->dstFormat != dstFormat) || (context->flags != flags) ||
>> - (context->param != param))
>> + (context->param[ 0 ] != param[ 0 ]) || (context->param[ 1 ] != param[ 1 ]))
>
> and please loose the extra spaces inside () {} []
And all the useless (). In C, relational operators have higher
precedence than logical operators (all varieties).
Somehow, I don't know why, I don't really mind spaces inside {}, though.
--
M?ns Rullg?rd
mans at mansr.com
More information about the ffmpeg-devel
mailing list