[FFmpeg-devel] [PATCH] Fix MSVC warnings about possible value truncation.
Reimar.Doeffinger at gmx.de
Sat Aug 30 01:26:46 CEST 2014
On 30.08.2014, at 00:44, Peter Kasting <pkasting at google.com> wrote:
> Hi FFMPEG devs, please forgive any errors here as I'm normally a Chromium
> developer and this is my first submission to FFMPEG.
> The attached patch fixes instances of MSVC warning C4244 about possible
> value truncation (e.g. when assigning double to float or int64_t to int).
> This warning is currently disabled in Chromium's MSVC build and I'm trying
> to enable it.
> The patch touches a couple dozen files, however each file's changes are
> basically standalone, so I could split this up into arbitrarily smaller
> pieces, all the way down to one patch per file. I'm happy to break this up
> in any way desired if reviewers would prefer. (One possibility would be
> separate patches for each of the four directories touched.)
> This is not a rubber-stamp review. While I intended there to be no
> discernable behavior change, it wasn't always clear what the best way to
> fix each warning was. I've marked cases in particular need of review with
> "// !!! ..." comments asking what to do, but even in other places, in
> particular floating-point casting changes where there may be precision
> loss, reviewers should use care.
First, this needs very, very careful review. I am not at all convinced that these will not change behaviour.
Second, I believe powf and sinf are less commonly available than pow and sin, so I think this will break compilation on some platforms (but haven't double-checked).
Third, _if_ we want this, I would expect we want to enable the corresponding gcc warning as well. Only a minority of developers has access to MSVC and I consider this kind of thing not maintainable if most people will not get the warnings.
More information about the ffmpeg-devel