[FFmpeg-cvslog] r25339 - trunk/libavutil/rational.c

Stefano Sabatini stefano.sabatini-lala
Tue Oct 5 10:52:53 CEST 2010


On date Tuesday 2010-10-05 03:43:34 +0200, michael wrote:
> Author: michael
> Date: Tue Oct  5 03:43:34 2010
> New Revision: 25339
> 
> Log:
> Add selftest code for av_cmp_q().
> 
> Modified:
>    trunk/libavutil/rational.c
> 
> Modified: trunk/libavutil/rational.c
> ==============================================================================
> --- trunk/libavutil/rational.c	Tue Oct  5 03:43:31 2010	(r25338)
> +++ trunk/libavutil/rational.c	Tue Oct  5 03:43:34 2010	(r25339)
> @@ -133,3 +133,23 @@ int av_find_nearest_q_idx(AVRational q, 
>  
>      return nearest_q_idx;
>  }
> +
> +#ifdef TEST
> +main(){
> +    AVRational a,b;
> +    for(a.num=-2; a.num<=2; a.num++){
> +        for(a.den=-2; a.den<=2; a.den++){
> +            for(b.num=-2; b.num<=2; b.num++){
> +                for(b.den=-2; b.den<=2; b.den++){
> +                    int c= av_cmp_q(a,b);
> +                    double d= av_q2d(a) == av_q2d(b) ? 0 : (av_q2d(a) - av_q2d(b));
> +                    if(d>0) d=1;
> +                    else if(d<0) d=-1;
> +                    else if(d != d) d= INT_MIN;
> +                    if(c!=d) av_log(0, AV_LOG_ERROR, "%d/%d %d/%d, %d %f\n", a.num, a.den, b.num, b.den, c,d);
> +                }
> +            }
> +        }
> +    }
> +}
> +#endif

Weird style.

Me and others would really appreciate if you would do an effort to
keep your style consistent with K&R and with the most part of
FFmpeg. That basically means to add some more spaces if( -> if_(, for(
-> for_(, a= b -> a_= b, and really shouldn't take much effort neither
time from you (no need of external tools to check that), and would led
to a style which many find more readable.

Regards.



More information about the ffmpeg-cvslog mailing list