[FFmpeg-devel] [PATCH] Fix MSVC warnings about possible value truncation.

Peter Kasting pkasting at google.com
Sat Aug 30 00:52:25 CEST 2014


On Fri, Aug 29, 2014 at 3:48 PM, Carl Eugen Hoyos <cehoyos at ag.or.at> wrote:

> Peter Kasting <pkasting <at> google.com> writes:
>
> > 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.
>
> Why?
> Did you find an actual issue?


Yes, this warning can catch (and has caught, in Chromium) real bugs, where
the compiler automatically truncated a value where the developer did not
intend to do so.  In general, places that trigger it are worth being
concerned about.

A couple of the places in this patch marked with "!!!" looked like
potential bugs to me.  I'm not familiar enough with FFMPEG code to be
certain.  This is why I'm asking reviewers not to rubber-stamp the changes
here; even changes that simply make explicit the casts the compiler was
previously doing implicitly may actually be incorrect behavior that should
be fixed.

PK


More information about the ffmpeg-devel mailing list