[FFmpeg-devel] [PATCH] Cast AV_NOPTS_VALUE to int64_t implicitly

Reimar Döffinger Reimar.Doeffinger at gmx.de
Wed Sep 19 19:44:13 CEST 2012


On Wed, Sep 19, 2012 at 08:08:00PM +0300, Andrey Utkin wrote:
> Thus comparsion against int64_t value will not raise warning
> (from -Wextra set) about comparsion of unsigned and signed integer
> ---
>  libavutil/avutil.h |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/libavutil/avutil.h b/libavutil/avutil.h
> index 94f9ee8..ebfb13e 100644
> --- a/libavutil/avutil.h
> +++ b/libavutil/avutil.h
> @@ -223,7 +223,7 @@ const char *av_get_media_type_string(enum AVMediaType media_type);
>   * either pts or dts.
>   */
>  
> -#define AV_NOPTS_VALUE          INT64_C(0x8000000000000000)
> +#define AV_NOPTS_VALUE          (int64_t)INT64_C(0x8000000000000000)

Hm, I kind of wonder if that warning behaviour is actually matching
the C standard, as hard to believe as that may be.
Still, I do not like this approach.
An alternative would be to just do
#define AV_NOPTS_VALUE INT64_MIN
As an aside: to avoid this issue, INT64_MIN is defined as
-INT64_C(0x7fffffffffffffff) - 1


More information about the ffmpeg-devel mailing list