Xine-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Original]

Re: [xine-devel] PATCH: fix possible FPE in demux_asf


To: Diego 'Flameeyes' Pettenò <flameeyes@xxxxxxxxxx>
Subject: Re: [xine-devel] PATCH: fix possible FPE in demux_asf
From: Vedran Rodic <vedran@xxxxxxxxxx>
Date: Tue, 28 Feb 2006 14:10:40 +0100
Cc: xine-devel@xxxxxxxxxxxxxxxxxxxxx
Delivered-to: itdp@localhost
In-reply-to: <200602281315.17945@enterprise.flameeyes.is-a-geek.org>
References: <44043AE5.3020405@vodatel.hr> <200602281315.17945@enterprise.flameeyes.is-a-geek.org>
User-agent: Debian Thunderbird 1.0.7 (X11/20051017)

Diego 'Flameeyes' Pettenò wrote:

On Tuesday 28 February 2006 12:58, Vedran Rodic wrote:


This patch fixes it and is pretty self explanatory.


I'd rather put it as "this->length >= 1000"; divisions are usually less performant that comparative tests.

Or it could just change the division (without changing the if clause) to

this->rate = (file_size*1000) / this->length;

so that the number of operations remain constant.



You're right. The last option seems ok.




Index: src/demuxers/demux_asf.c
===================================================================
RCS file: /cvsroot/xine/xine-lib/src/demuxers/demux_asf.c,v
retrieving revision 1.173
diff -u -r1.173 demux_asf.c
--- src/demuxers/demux_asf.c    14 Nov 2005 12:34:46 -0000      1.173
+++ src/demuxers/demux_asf.c    28 Feb 2006 13:05:48 -0000
@@ -434,7 +434,7 @@
 
           if (this->length) {
             /* FIXME: the rate is not constant ! */
-            this->rate = file_size / (this->length / 1000);
+            this->rate = (file_size * 1000) / this->length;
           } else {
             this->rate = 0;
           }

[Prev in Thread] Current Thread [Next in Thread]