[FFmpeg-devel] [PATCH 1/2] avcodec/vda_h264: use multichar literal portably

Michael Niedermayer michaelni at gmx.at
Sat Sep 19 00:35:03 CEST 2015


On Fri, Sep 18, 2015 at 06:16:18PM -0400, Ganesh Ajjanagadde wrote:
> Multichar literals are implementation defined, and thus trigger -Wmultichar:
> http://fate.ffmpeg.org/log.cgi?time=20150918202532&log=compile&slot=x86_64-darwin-gcc-5.
> http://www.zipcon.net/~swhite/docs/computers/languages/c_multi-char_const.html
> gives a good summary of how to deal with them; in particular this patch
> results in behavior identical to that generated by GCC (which I assume is correct this case).
> 
> Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
> ---
>  libavcodec/vda_h264.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/vda_h264.c b/libavcodec/vda_h264.c
> index 8c526c0..3279afa 100644
> --- a/libavcodec/vda_h264.c
> +++ b/libavcodec/vda_h264.c
> @@ -339,7 +339,9 @@ int ff_vda_default_init(AVCodecContext *avctx)
>      CFMutableDictionaryRef buffer_attributes;
>      CFMutableDictionaryRef io_surface_properties;
>      CFNumberRef cv_pix_fmt;
> -    int32_t fmt = 'avc1', pix_fmt = vda_ctx->cv_pix_fmt_type;
> +#define LE_CHR(a,b,c,d) ( ((a)<<24) | ((b)<<16) | ((c)<<8) | (d) )
> +    int32_t fmt = LE_CHR( 'a', 'v', 'c', '1');

please use AV_RB32("avc1")
its simpler and used elsewhere

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Breaking DRM is a little like attempting to break through a door even
though the window is wide open and the only thing in the house is a bunch
of things you dont want and which you would get tomorrow for free anyway
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150919/5302c6da/attachment.sig>


More information about the ffmpeg-devel mailing list