From patchwork Wed Feb 24 11:53:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 25964 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id A287B44B5C7 for ; Wed, 24 Feb 2021 13:54:37 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8483B68AA64; Wed, 24 Feb 2021 13:54:37 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 96FA168A9EA for ; Wed, 24 Feb 2021 13:54:28 +0200 (EET) Received: by mail-wr1-f48.google.com with SMTP id n4so1631824wrx.1 for ; Wed, 24 Feb 2021 03:54:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=BByPkMyD8gVpBjo/kBMcBMqAnYflHoa4EMz59diuVrY=; b=gz2yoXbkMHQ0KoKEZ/eu8zY9bwiIRG4FK9WE9c2KhgNCVvizgYB+TLFi9kMvcotKPH HUFwHjsh82iJShbhZJ8PKy8vnwiZQTElB77BXUdmLrttyP6ypPzsWuyYRc7RhQTfzSb4 GL9k8ftc8m1V2F6bVuArsmIjW08zkFBBtOaxP75BB5p0dW9vJ+V9vxCuRev1Htnc4DXS gQfiCMCjGz5Dv4qdgSmiUdfDXtbhAoXyYgiLnffXotN41Xg8KHrKwhI9f5LPxhYzNTmH r3LbKI5htrXBSJwwiPUXLE70fHBSK7aWd5xR1tkDB8IEabf/hvEJjIBBJW+DEBL7e9Uf otIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BByPkMyD8gVpBjo/kBMcBMqAnYflHoa4EMz59diuVrY=; b=aXwg9j+13dTtJFmOdA0+S/K+iN/nkmCGqkKK2EVmpu+jplfCEW8EPuqKqgvXi5Uc/+ GapzPzhGBEJrmZzgHr1NsyepLhnp4ZYESQ8SyG61/dXIMRR4wcpaNzJZj500WIF2KUUd gn7MvwclVJrO14FxQBzy3Lc0Kr06qVl5THWqFsC6kqhd9Hj0Jdo+wAzGiOhFCfn/VNyb vcwMshtkYfrL4ggvXgtYmKziqbuPb4SBPuF6JErt6qFUH4c7sKHDu91vcFCT2W8ab6DG 7Un1jdEGlxuP5HdCbkjkyeZKbeCMiCWwrls03eTaOT2RYN4+8NiwWyFvg0HbOBqeF6bt ES/g== X-Gm-Message-State: AOAM533aUmZjiuXwlMLIZqS1lAYZx5+oO99L5wssJDvgLx4dg2AyA3wY uZC+FLCuPaot2GKX/cToY2TiZ99SEv8= X-Google-Smtp-Source: ABdhPJwNLZdrgW7L5mVCZvwd/y7qF6EMwHdxhdeBj0rjE4ypTXiWX2TVUiaYg/ZK4ELWu8mRQB5GTQ== X-Received: by 2002:a5d:6643:: with SMTP id f3mr10138291wrw.182.1614167667933; Wed, 24 Feb 2021 03:54:27 -0800 (PST) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id k15sm3911776wrn.0.2021.02.24.03.54.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Feb 2021 03:54:27 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 24 Feb 2021 12:53:39 +0100 Message-Id: <20210224115341.794293-13-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210224115341.794293-1-andreas.rheinhardt@gmail.com> References: <20210224115341.794293-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 13/15] avformat/avio: Use av_strstart instead of strncmp X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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 Cc: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" It makes the intent clearer and avoids calculating the length in advance. Signed-off-by: Andreas Rheinhardt --- libavformat/avio.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libavformat/avio.c b/libavformat/avio.c index fbe07e44bc..8011482e76 100644 --- a/libavformat/avio.c +++ b/libavformat/avio.c @@ -114,11 +114,10 @@ static int url_alloc_for_protocol(URLContext **puc, const URLProtocol *up, goto fail; } if (up->priv_data_class) { - int proto_len= strlen(up->name); - char *start = strchr(uc->filename, ','); + char *start; *(const AVClass **)uc->priv_data = up->priv_data_class; av_opt_set_defaults(uc->priv_data); - if(!strncmp(up->name, uc->filename, proto_len) && uc->filename + proto_len == start){ + if (av_strstart(uc->filename, up->name, (const char**)&start) && *start == ',') { int ret= 0; char *p= start; char sep= *++p;