From patchwork Wed Feb 24 11:53:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 25965 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 3ECFC44B5C7 for ; Wed, 24 Feb 2021 13:54:41 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2667868A78A; Wed, 24 Feb 2021 13:54:41 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 75F4C68AA3E for ; Wed, 24 Feb 2021 13:54:29 +0200 (EET) Received: by mail-wm1-f54.google.com with SMTP id i9so1247248wml.0 for ; Wed, 24 Feb 2021 03:54:29 -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=70FuqK+MGIWPEpAFb5bhS+NdKtQzUNskhxVJ2pV1k+s=; b=UkKgNQFsV4OmEkZ3ZkM4cUfBT2QxqyM0wW9IzBa5tSwSu9v0nwrORDX8b2LKnbfY1i REjOcen+HMq+/bhIkOVIfn6ie5zC7bTNoVBoHWZZZ2Hm6J3CPSXDQET1rodQvZxH8xbn qgW2vP0OH6eNdwP4obG7BwWHAf/yVFeDy6aiu7REgyud+uXzZjDO8lJPG6/0mV2Lic5Q 06TD3rwFq2XdikfMyyaAKZVLxpDPJQzj+EQc5DA09n5GsdrV/cQ1kXiArRuIZGeJbqZU wProAi8fzjtrFq4Oz2p4BGNjAUb7UQQ1b6z7IVUWMiwCDk066Dt9qvoDjslQoY70an3d PNoA== 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=70FuqK+MGIWPEpAFb5bhS+NdKtQzUNskhxVJ2pV1k+s=; b=RT50HLWPrHhbXi6Yef2j6Uie0kVBeHRlUivvTfLjDRe1C/RHXT8OMuD8+Bq739U5gr JSX8YE+lQ/yU+XsAhP4WkQm8LHRo0N7ARqWqrPcjXLl6R25i2U2OYxcwCF4AkL6kTl/n BDdXJMSmNsRTNF62RW4B/kcFB7pUyPCA1SxvOg4ZLIinTuHv6zHzOovE3NxkYT8zfWKn 8hiSk5jTNk2oop6lp1uy2Zzkfzon8XZYItFLwWaA9SJYV14koGkzS9siG3wqN/4k9vFt qWpDax9kQXd7Z29JnAR/sT8xn/SA+9OF2T/Fops/KrIuW+H00mq1EVzu2plwPDGnkpnp h0tg== X-Gm-Message-State: AOAM5324yFVIoMsz/r9+ccQf+T9UxnU9XNHf8yiirnmBmDmGapZEIhwP x680w0ACTXGsfWTwGga9VriCkQgm2U4= X-Google-Smtp-Source: ABdhPJwaA/zAtVaNlOd9xNViAwnDD/8/hs1xCGfe3QYfvE5uzI5868P0ri/d5P7sKqW4Pj7r3SyM5g== X-Received: by 2002:a1c:e409:: with SMTP id b9mr258733wmh.173.1614167668731; Wed, 24 Feb 2021 03:54:28 -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:28 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 24 Feb 2021 12:53:40 +0100 Message-Id: <20210224115341.794293-14-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 14/15] avformat/matroskadec: 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 separately. Signed-off-by: Andreas Rheinhardt --- libavformat/matroskadec.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 1f96b49fc4..c03cd8bd09 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -2470,8 +2470,7 @@ static int matroska_parse_tracks(AVFormatContext *s) encodings[0].compression.settings.size); for (j = 0; ff_mkv_codec_tags[j].id != AV_CODEC_ID_NONE; j++) { - if (!strncmp(ff_mkv_codec_tags[j].str, track->codec_id, - strlen(ff_mkv_codec_tags[j].str))) { + if (av_strstart(track->codec_id, ff_mkv_codec_tags[j].str, NULL)) { codec_id = ff_mkv_codec_tags[j].id; break; } @@ -2986,8 +2985,7 @@ static int matroska_read_header(AVFormatContext *s) st->codecpar->codec_id = AV_CODEC_ID_NONE; for (i = 0; mkv_image_mime_tags[i].id != AV_CODEC_ID_NONE; i++) { - if (!strncmp(mkv_image_mime_tags[i].str, attachments[j].mime, - strlen(mkv_image_mime_tags[i].str))) { + if (av_strstart(attachments[j].mime, mkv_image_mime_tags[i].str, NULL)) { st->codecpar->codec_id = mkv_image_mime_tags[i].id; break; } @@ -3016,8 +3014,7 @@ static int matroska_read_header(AVFormatContext *s) attachments[j].bin.size); for (i = 0; mkv_mime_tags[i].id != AV_CODEC_ID_NONE; i++) { - if (!strncmp(mkv_mime_tags[i].str, attachments[j].mime, - strlen(mkv_mime_tags[i].str))) { + if (av_strstart(attachments[j].mime, mkv_mime_tags[i].str, NULL)) { st->codecpar->codec_id = mkv_mime_tags[i].id; break; }