[FFmpeg-cvslog] r25311 - trunk/libavutil/rational.c
stefano
subversion
Sat Oct 2 11:50:56 CEST 2010
Author: stefano
Date: Sat Oct 2 11:50:56 2010
New Revision: 25311
Log:
Avoid cast of double nan to int.
It may cause exceptions on some platform.
Modified:
trunk/libavutil/rational.c
Modified: trunk/libavutil/rational.c
==============================================================================
--- trunk/libavutil/rational.c Sat Oct 2 11:16:52 2010 (r25310)
+++ trunk/libavutil/rational.c Sat Oct 2 11:50:56 2010 (r25311)
@@ -96,10 +96,12 @@ AVRational av_sub_q(AVRational b, AVRati
AVRational av_d2q(double d, int max){
AVRational a;
#define LOG2 0.69314718055994530941723212145817656807550013436025
- int exponent= FFMAX( (int)(log(fabs(d) + 1e-20)/LOG2), 0);
- int64_t den= 1LL << (61 - exponent);
+ int exponent;
+ int64_t den;
if (isnan(d))
return (AVRational){0,0};
+ exponent = FFMAX( (int)(log(fabs(d) + 1e-20)/LOG2), 0);
+ den = 1LL << (61 - exponent);
av_reduce(&a.num, &a.den, (int64_t)(d * den + 0.5), den, max);
return a;
More information about the ffmpeg-cvslog
mailing list