From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id E668946C77 for ; Fri, 7 Jul 2023 01:15:39 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D2BCA68C786; Fri, 7 Jul 2023 04:15:37 +0300 (EEST) Received: from mail-oo1-f41.google.com (mail-oo1-f41.google.com [209.85.161.41]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 85E1968C777 for ; Fri, 7 Jul 2023 04:15:31 +0300 (EEST) Received: by mail-oo1-f41.google.com with SMTP id 006d021491bc7-558a79941c6so947290eaf.3 for ; Thu, 06 Jul 2023 18:15:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1688692529; x=1691284529; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=32uooeY8sEHl0atieg2fvAjYxPUV1C+QnwX67S1/OCQ=; b=M+WeV4W+fNejw29WwGWV/+IuMX7IcnZE/Jsr1bWSbgFDAEVXZWrqLwPmsykbDiPWoa 5ibZukeH2vPPRGNrr/0PX3iwreSGuenjPuQfk62SltlExAc8EBeUpR0RVLtA04maIyRo VR/md/yozA0X4l1mywAPF0wIVMj6sDvWeJCGAOgS3yTOGQPtmW8kP7WmUvhJuida+51B thS1nqbfYK09omIhEGdPJ2OBkHFT9C8jRxfUFEm5oIDQNcpSTKomt6VXjbjhdNYvtjaL V/aB0lb1P6ZpIOpYNrKebqiAWRnigLZ9zKLU/gq6edtruKvEOA+rCTMl+Nhhe9S/YoVD P4cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688692529; x=1691284529; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=32uooeY8sEHl0atieg2fvAjYxPUV1C+QnwX67S1/OCQ=; b=dEk5goDQpB0+lihFp+JrJI+rgTCIhDWzzc9paaiMkyKsKOKhQEviKYqBUiZoHkpBAE tpIhrMJBpHo+xBfAVd9KHgKNjLL3fjuRGcUKJ4SC1rdz7So1EJ0LDcy6CxnArc7KiBSj DMFG6E2wHXilA57j1P6zUBaJTAdv0y8v9Kvo103eMz7ZMrocAro0Z/wKvUUpfxW51xKp 66keEzvrWpl8+gKRnV+/mQZfHdfPVhLDH00B6//LgY7XigM6NGGfjvBTtRI0ll2maNOn AuT17dEHTCurNMtamZvIjHgMr2h+yEXWK/bhY1h7HBYFvRufGkWGTTe3iOTKD1vIGBFC AEHQ== X-Gm-Message-State: ABy/qLYpNFZ3FKH6yrrvvuESy8XrnmHPD/DQtBZkvZ8WyRKCQrLDWY/G +048OyREyhSfVo0jAU3PFVGbrO/139w= X-Google-Smtp-Source: APBJJlF0EDye9DpdEileTLBGFyXKt8BcEnqKDkDixXfOWmdXezwH1XfbJzvFvx+qqCMDeu+38opr5g== X-Received: by 2002:a4a:4992:0:b0:565:84b0:845d with SMTP id z140-20020a4a4992000000b0056584b0845dmr2571329ooa.6.1688692529528; Thu, 06 Jul 2023 18:15:29 -0700 (PDT) Received: from [192.168.0.12] (host197.190-225-105.telecom.net.ar. [190.225.105.197]) by smtp.gmail.com with ESMTPSA id z24-20020a4ade58000000b00566270e616dsm1100463oot.38.2023.07.06.18.15.28 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 06 Jul 2023 18:15:29 -0700 (PDT) Message-ID: <29f96da0-d52b-f351-f2f0-e9d0e4dd8aea@gmail.com> Date: Thu, 6 Jul 2023 22:15:28 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Content-Language: en-US To: ffmpeg-devel@ffmpeg.org References: From: James Almer In-Reply-To: Subject: Re: [FFmpeg-devel] [PATCH 1/3] avformat/evcdec: Avoid nonsense casts X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On 7/6/2023 6:06 PM, Andreas Rheinhardt wrote: > For uint8_t buf[EVC_NALU_LENGTH_PREFIX_SIZE], &buf still points > to the beginning of buf, but it is of type "pointer to array of > EVC_NALU_LENGTH_PREFIX_SIZE uint8_t" (i.e. pointer arithmetic > would operate on blocks of size EVC_NALU_LENGTH_PREFIX_SIZE). > This is of course a different type than uint8_t*, which is why > there have been casts in evc_read_packet(). But these are unnecessary > if one justs removes the unnecessary address-of operator. > > Signed-off-by: Andreas Rheinhardt > --- > libavformat/evcdec.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/libavformat/evcdec.c b/libavformat/evcdec.c > index 73aab6c52f..9886542311 100644 > --- a/libavformat/evcdec.c > +++ b/libavformat/evcdec.c > @@ -65,7 +65,7 @@ static int annexb_probe(const AVProbeData *p) > int nalu_type; > size_t nalu_size; > int got_sps = 0, got_pps = 0, got_idr = 0, got_nonidr = 0; > - unsigned char *bits = (unsigned char *)p->buf; > + unsigned char *bits = p->buf; > int bytes_to_read = p->buf_size; > > while (bytes_to_read > EVC_NALU_LENGTH_PREFIX_SIZE) { > @@ -159,11 +159,11 @@ static int evc_read_packet(AVFormatContext *s, AVPacket *pkt) > if (ret < 0) > return ret; > > - ret = avio_read(s->pb, (unsigned char *)&buf, EVC_NALU_LENGTH_PREFIX_SIZE); > + ret = avio_read(s->pb, buf, EVC_NALU_LENGTH_PREFIX_SIZE); > if (ret < 0) > return ret; > > - nalu_size = evc_read_nal_unit_length((const uint8_t *)&buf, EVC_NALU_LENGTH_PREFIX_SIZE); > + nalu_size = evc_read_nal_unit_length(buf, EVC_NALU_LENGTH_PREFIX_SIZE); > if (!nalu_size || nalu_size > INT_MAX) > return AVERROR_INVALIDDATA; LGTM. _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".