[FFmpeg-devel] [PATCH]lavf/chromaprint: Silence compilation warnings

Andriy Gelman andriy.gelman at gmail.com
Sun Apr 5 20:45:32 EEST 2020


lgtm with a couple of minor comments

On Sun, 05. Apr 10:49, Carl Eugen Hoyos wrote:
> Am Di., 13. Aug. 2019 um 12:45 Uhr schrieb Carl Eugen Hoyos
> <ceffmpeg at gmail.com>:
> 
> > Attached patch fixes several compilation warnings when building with
> > chromapring.
> 
> I will push this patch if there are no objections.
> 

> diff --git a/libavformat/chromaprint.c b/libavformat/chromaprint.c
> index f39c09ddb9..77015d9c10 100644
> --- a/libavformat/chromaprint.c
> +++ b/libavformat/chromaprint.c
> @@ -114,14 +114,15 @@ fail:
> static int write_packet(AVFormatContext *s, AVPacket *pkt)
> {
>     ChromaprintMuxContext *cpr = s->priv_data;
> -    return chromaprint_feed(cpr->ctx, pkt->data, pkt->size / 2) ? 0 : AVERROR(EINVAL);

> +    return chromaprint_feed(cpr->ctx, (const uint16_t *)pkt->data, pkt->size / 2) ? 0 : AVERROR(EINVAL);
> }

I noticed that second argument is const int16_t* in chromaprint.h

uint16_t* and int16_t* are compatible types in C (I was a bit surprised..) so
this doesn't show up as warning.
Do you think it's better to change cast to const int16_t* ? 

> static int write_trailer(AVFormatContext *s)
> {
>     ChromaprintMuxContext *cpr = s->priv_data;
>     AVIOContext *pb = s->pb;
> -    void *fp = NULL, *enc_fp = NULL;
> +    void *fp = NULL;
> +    char *enc_fp = NULL;
>     int size, enc_size, ret = AVERROR(EINVAL);
>  
>     if (!chromaprint_finish(cpr->ctx)) {
> @@ -129,7 +130,7 @@ static int write_trailer(AVFormatContext *s)
>         goto fail;
>     }
> 
> -    if (!chromaprint_get_raw_fingerprint(cpr->ctx, &fp, &size)) {
> +    if (!chromaprint_get_raw_fingerprint(cpr->ctx, (uint32_t **)&fp, &size)) {

The second argument used to be void**, so this will show up as a warning in
older versions. But probably this is fine.

Thanks,
-- 
Andriy


More information about the ffmpeg-devel mailing list