[FFmpeg-devel] [PATCH] Fix warnings about int64 toint32conversion

Gavin Kinsey gkinsey at ad-holdings.co.uk
Mon May 21 14:29:32 CEST 2012


On Wednesday 16 May 2012 12:18:57 Don Moir wrote:
> 
> I think the pragma in ffmpeg would be more clutter then the cast but I
> have a ffmpeg.h file that does whatever for my needs. For the include
> part it does this:
> 
> extern "C"
> {
>     #pragma warning(disable:4244)
>     #include <libavcodec/avcodec.h>
>     #include <libavformat/avformat.h>
>     #include <libswscale/swscale.h>
>     #include <libswresample/swresample.h>
>     #include <libavutil/opt.h>
>     #pragma warning(default:4244)
> }
> 
> The #pragma warning number is going to be compiler specific but this does
> the trick for MS compiler. I would prefer not to use the pragma so I will
> know if I get a warning but it can be so annoying that I do it for
> ffmpeg.

I do the same but in what is a slightly more cross-platform way.  The 
following disables the warnings for Visual Studio and clang, these are the 
only two compilers I've found so far that emit warnings for this code.

// Switch off the conversion warning we get from libavutil/common.h
#if defined(_MSC_VER) 
#pragma warning( push )
#pragma warning( disable : 4244 )
#elif defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wconversion"
#endif

extern "C" {
#    include "libavcodec/avcodec.h"
#    include "libavfilter/avfilter.h"
--
#    include "libswscale/swscale.h"
}

// Re-enable conversion warning
#if defined(_MSC_VER) 
#pragma warning( pop )
#elif defined(__clang__)
#pragma clang diagnostic pop
#endif

-- 
Gavin Kinsey
AD Holdings Plc


--------------------------------------------------------
Benefit from the transition to HD IP Video with SD Advanced and Excel Hybrid DVRs, the pure IP NVR Media Server with integrated switch - full range of new CamVu 720, HD IP cameras, 360 Degree, 3/5Mpx cameras - with integrated solid state and dual recording. Into enterprise IP video? then see our dedicated network appliances - NV8 NVR and Cloud NVR with the new Network and Storage Controller. Beyond security FireVu Dome provides early detection and visual verification of fire in commercial premises.  Come and see us at IFSEC, Birmingham UK, at the front of Hall 4 on Stand E10.

--------------------------------------------------------
This email and any files transmitted with it are CONFIDENTIAL and intended solely for the use of the individual or entity to whom they are addressed. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system; you may not copy this message or disclose its contents to anyone. The recipient should check this email and any attachments for the presence of viruses. The Company accepts no liability for any damage caused by any virus transmitted by this email. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the Company. Contact Customer Services for details customerservices at dmicros.com


More information about the ffmpeg-devel mailing list