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 CE6EE409AE for ; Wed, 2 Feb 2022 00:51:32 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8796468B1BD; Wed, 2 Feb 2022 02:51:30 +0200 (EET) Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C7F0868B1BD for ; Wed, 2 Feb 2022 02:51:23 +0200 (EET) Received: by mail-wr1-f54.google.com with SMTP id s9so35176993wrb.6 for ; Tue, 01 Feb 2022 16:51:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=ve023L/65dT5HSJmB4B4J9kh9mH3nPo4Bw7iHXHYMsY=; b=gD4Y2iznJjzK7OIpUVg5zSy54oJ+Kow6OaGmS23Yq6ynj2FpXjwQgBhKHtrj1M7S4F fT7l6rdK0mmk0yyRHr8AbIILkQ85HDeAsLdmAJTnirYKW0BLnJYgV9x9nnegqhPy4TxB zszTV3Al18IlOA4O2zpehZHD7RLXLNMXSOmRfqsKfGPi6qJit1CFxZm0vm7TB4EmqtVc 2owGCaNXTlMPuwsNMc6L1y4e/edLXy5ofmSJJp+9wu4+Q7m7AX7lYh20a6RWlHK52I+U rUrJE+Evh0aF5e0hQ81lIRYqY0DtcmtQPyEf+hfYoBWNtQ0HlZgAnWORQfokGQHLWOiD MUAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=ve023L/65dT5HSJmB4B4J9kh9mH3nPo4Bw7iHXHYMsY=; b=wngE9IWw/JFl2bdNcCwl5yJxdHVF9syALL9qs2l0PgpDa+afEgVVscMLhPcpwIktvI H0JW+VVS4wplJTCcVAo0+0V0pyFWDXC7KYTZL9mnQ31pAzmp3ljsoB31TbefkH1GXhe9 RcTioASsFD/2JMSZd29LPZbKSXvqJyaMN3NSmXduENrG7SCx1eowoQjazCkwNJ2/KDdT iqq9aFHbRXpmm2KTzX7ZmIFJ4+gwrbAFrodorYrOVcgdcVwyZ4cdSGveFB04w62uhw+G YOwQji7hFxCPTKgJt7MVTRw35lmueii7U0EPeCVMwiEfroYkHpZBtDAqXAHrVLf69L8c uzyQ== X-Gm-Message-State: AOAM531ujoqRF0Htyse+ZVcBDXYyQoJCJ/we1pCMDbuZX+DYzkMtp45q BOQV2e6i2QXQXRybM47KxFoGY3yspijUzpgbuHAzy1W5i64= X-Google-Smtp-Source: ABdhPJzo5Sazf6xswvR6M+5xBhBDAAt2PM5DZiVpGmM64BzniHsGYJOVo3Qjzz89LyT9RGuclCj0nu71Bv/c4/LSyfw= X-Received: by 2002:a05:6000:1881:: with SMTP id a1mr22555792wri.561.1643763083036; Tue, 01 Feb 2022 16:51:23 -0800 (PST) MIME-Version: 1.0 References: <20220201215830.65635-1-markg85@gmail.com> <20220201215830.65635-2-markg85@gmail.com> <65259fb0-1c02-2d1d-ca8c-ed55801f5181@rothenpieler.org> <2d44135b-a3f9-711a-ee60-df38d148db92@rothenpieler.org> In-Reply-To: <2d44135b-a3f9-711a-ee60-df38d148db92@rothenpieler.org> From: Mark Gaiser Date: Wed, 2 Feb 2022 01:50:05 +0100 Message-ID: To: FFmpeg development discussions and patches X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: Re: [FFmpeg-devel] [PATCH v2 1/1] avformat: Add IPFS protocol support. 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-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On Wed, Feb 2, 2022 at 1:49 AM Timo Rothenpieler wrote: > On 02.02.2022 01:44, Andreas Rheinhardt wrote: > > Timo Rothenpieler: > >> On 02.02.2022 01:33, Mark Gaiser wrote: > >>> On Wed, Feb 2, 2022 at 1:27 AM Timo Rothenpieler < > timo@rothenpieler.org> > >>> wrote: > >>> > >>>> On 01.02.2022 22:58, Mark Gaiser wrote: > >>>>> +static int translate_ipfs_to_http(URLContext *h, const char *uri, > int > >>>> flags, AVDictionary **options) > >>>>> +{ > >>>>> + const char *ipfs_cid; > >>>>> + const char *protocol_path_suffix = "ipfs/"; > >>>>> + char *fulluri; > >>>>> + int ret; > >>>>> + Context *c = h->priv_data; > >>>>> + int is_ipfs = (av_strstart(uri, "ipfs://", &ipfs_cid) || > >>>> av_strstart(uri, "ipfs:", &ipfs_cid)); > >>>>> + int is_ipns = (av_strstart(uri, "ipns://", &ipfs_cid) || > >>>> av_strstart(uri, "ipns:", &ipfs_cid)); > >>>> > >>>> What's the point of this logic? > >>>> The first half of each check seems pointless, since the second half is > >>>> true for everything the first one would cover. > >>>> > >>> > >>> Hi Time, > >>> > >>> The point it to allow > >>> ipfs:// and ipfs: > >>> > >>> So for that i want to test for all possible true situations (ipfs://, > >>> ipfs:, ipns:// and ipns:). > >> > >> If the url starts with "ipns://", it obviously also starts with "ipns:", > >> so checking for the longer of the two is pointless. > >> Same for "ipfs:". > > > > You forgot that av_strstart() also sets ipfs_cid which is used later; > > the above code exists to strip the leading protocol part away. > > Ah, yeah. That's a very confusing side effect there. > I guess it's fine, but I can't say I like using it like that. > Since there's a large risk someone else might in the future think the > same and break it. > I'm fine changing it to someone that would feel more intuitive. Do you have a suggestion to make it better? > _______________________________________________ > 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". > _______________________________________________ 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".