From patchwork Thu Nov 17 10:16:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 39315 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:999a:b0:a4:2148:650a with SMTP id ve26csp997465pzb; Thu, 17 Nov 2022 02:17:40 -0800 (PST) X-Google-Smtp-Source: AA0mqf7G9q1b2cBwQz81Dwc3Fc7bX8TNYgQXoWZURD/rfYP3ojfRR0B22yDn8CZ0hsrkIeuJgNKQ X-Received: by 2002:a17:906:2804:b0:78d:e7c0:a2b with SMTP id r4-20020a170906280400b0078de7c00a2bmr1586662ejc.273.1668680259891; Thu, 17 Nov 2022 02:17:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668680259; cv=none; d=google.com; s=arc-20160816; b=EERsnS+zWXgZ/TrE9XjZcs55UYWlEhb3atpFmtQpuff1ZnRvaomoijVfSeS7CGYQOp AqYikzv+7nBTlVsNXwzISehCbeUH3Z3mwlBDRJ4FraRvjgFSDKImClritD3mJuqb64c4 HS76J+t4VCZ7KRTrpmR+LHYhDSRD1T1p0+fOve6t41PN4r6G9JcbhQDgW1GCQp7keSfk n7L60vWqEQkeZTYq+u808PzE6pgAgxL89L26Hta8P8YNFOt5UIRd4Ka9psXDqNhjBoND 3OOuW74wse2XxNAoS82EOp4F7Y2Ilo5foZ9owXPnIHsLUbZxR5XAirBCeXC4xJEvzmUO efPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=XU0bsJ3N5rSi5ERTZG39sZ9eohBcDYtowXvaiYpXrhI=; b=ZhwyuYz4R67OrLsNh8TtSvWjbdRSg8+UEl4ra8lj0ko6xXMHkn3i3H3AVjOSu+PYsM OFXyOzo1ZiMaJvZ9wSnxpcd3JHSLgsfvMaD1N1hP8qXcVrdKqa062oqpvbqGEwQ+xjlO cCI4n37qhVrZquMXvFkIEV2buft9ce52RhXmJzSBPVOvPlmVX+kqwXRWVclOnNbUCuA6 soza0SPv8kRnYDltgXFO8/rKNc5Bsgw2qOuXvVV2VAqfa0RUo637JbKzrYbl7yEsAtrA /5DY+SdnG7Nx5oBvFrWPO0wh3eLou+QE4wxTzW3aAqVU95mdFLv8K+w3Fm/Vzqcnf3o3 V14w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id qc24-20020a170906d8b800b007ae8a4b03d7si186738ejb.973.2022.11.17.02.17.39; Thu, 17 Nov 2022 02:17:39 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8385268BD07; Thu, 17 Nov 2022 12:16:56 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 44D1568BD58 for ; Thu, 17 Nov 2022 12:16:49 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 2C7CF2404F7 for ; Thu, 17 Nov 2022 11:16:47 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id a_63r-PJvr1a for ; Thu, 17 Nov 2022 11:16:46 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id 629BD2406CA for ; Thu, 17 Nov 2022 11:16:43 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 5505C3A01E5 for ; Thu, 17 Nov 2022 11:16:43 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 17 Nov 2022 11:16:39 +0100 Message-Id: <20221117101640.6789-9-anton@khirnov.net> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221117101640.6789-1-anton@khirnov.net> References: <20221117101640.6789-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 09/10] fftools/ffmpeg: _-prefix variables in MATCH_PER_STREAM_OPT() 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: SNzG0MgA6vHU Avoids conflicts, e.g. when 'i' is used in the outvar expression. --- fftools/ffmpeg.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index 5fc3b2d3d4..5cae266600 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -783,26 +783,26 @@ InputStream *ist_iter(InputStream *prev); {\ char namestr[128] = "";\ const char *spec = so->specifier && so->specifier[0] ? so->specifier : "";\ - for (i = 0; opt_name_##name[i]; i++)\ - av_strlcatf(namestr, sizeof(namestr), "-%s%s", opt_name_##name[i], opt_name_##name[i+1] ? (opt_name_##name[i+2] ? ", " : " or ") : "");\ + for (int _i = 0; opt_name_##name[_i]; _i++)\ + av_strlcatf(namestr, sizeof(namestr), "-%s%s", opt_name_##name[_i], opt_name_##name[_i+1] ? (opt_name_##name[_i+2] ? ", " : " or ") : "");\ av_log(NULL, AV_LOG_WARNING, "Multiple %s options specified for stream %d, only the last option '-%s%s%s "SPECIFIER_OPT_FMT_##type"' will be used.\n",\ namestr, st->index, opt_name_##name[0], spec[0] ? ":" : "", spec, so->u.type);\ } #define MATCH_PER_STREAM_OPT(name, type, outvar, fmtctx, st)\ {\ - int i, ret, matches = 0;\ + int _ret, _matches = 0;\ SpecifierOpt *so;\ - for (i = 0; i < o->nb_ ## name; i++) {\ - char *spec = o->name[i].specifier;\ - if ((ret = check_stream_specifier(fmtctx, st, spec)) > 0) {\ - outvar = o->name[i].u.type;\ - so = &o->name[i];\ - matches++;\ - } else if (ret < 0)\ + for (int _i = 0; _i < o->nb_ ## name; _i++) {\ + char *spec = o->name[_i].specifier;\ + if ((_ret = check_stream_specifier(fmtctx, st, spec)) > 0) {\ + outvar = o->name[_i].u.type;\ + so = &o->name[_i];\ + _matches++;\ + } else if (_ret < 0)\ exit_program(1);\ }\ - if (matches > 1)\ + if (_matches > 1)\ WARN_MULTIPLE_OPT_USAGE(name, type, so, st);\ }