Message ID | CAB0OVGqXGdXRwF3bnX0KKtSWDezbG2a_qhR_zJm+u1OMmS5U+g@mail.gmail.com |
---|---|
State | Accepted |
Headers | show |
Am Di., 13. Aug. 2019 um 12:45 Uhr schrieb Carl Eugen Hoyos <ceffmpeg@gmail.com>: > Attached patch fixes several compilation warnings when building with > chromapring. I will push this patch if there are no objections. Carl Eugen
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@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,
Am So., 5. Apr. 2020 um 19:51 Uhr schrieb Andriy Gelman <andriy.gelman@gmail.com>: > > 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@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* ? Done, thank you for spotting this. > > 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. Patch applied. Thank you, Carl Eugen
From 96eb4a33e8b256ee3ae75f3600ba26e6cd9b3bf2 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos <ceffmpeg@gmail.com> Date: Tue, 13 Aug 2019 12:42:27 +0200 Subject: [PATCH] lavf/chromaprint: Silence compilation warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes the following warnings: libavformat/chromaprint.c:117:42: warning: passing argument 2 of ‘chromaprint_feed’ from incompatible pointer type libavformat/chromaprint.c:132:52: warning: passing argument 2 of ‘chromaprint_get_raw_fingerprint’ from incompatible pointer type libavformat/chromaprint.c:143:71: warning: passing argument 4 of ‘chromaprint_encode_fingerprint’ from incompatible pointer type --- libavformat/chromaprint.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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); } 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)) { av_log(s, AV_LOG_ERROR, "Failed to retrieve fingerprint\n"); goto fail; } -- 2.22.0