From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id ECB8A4E915 for ; Thu, 12 Jun 2025 11:25:14 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 2EC9368BF75; Thu, 12 Jun 2025 14:25:10 +0300 (EEST) Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 198D7687D2E for ; Thu, 12 Jun 2025 14:25:03 +0300 (EEST) Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-451dbe494d6so10282475e9.1 for ; Thu, 12 Jun 2025 04:25:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1749727502; x=1750332302; darn=ffmpeg.org; h=mime-version:references:in-reply-to:message-id:date:subject:to:from :from:to:cc:subject:date:message-id:reply-to; bh=pueDsVQWOKohxnG69PtAQSVyhRjzLb4Sc4tssF0h+hc=; b=IE8Oz4VJNnLhAXfjiMqPzWfWwC/xZUaadYMHdf3FZQSe5pr7U25qwCIhV1dLADzrL6 Qu9o/tpic+s84d4GcQtQeKxf8BdyqLNddl71c7zNOVZaVpQUPT1gLUG8itksTn9/WJ73 ZIMIGsc1REPodP/9zNVE4oAT0/q7uPLBQNZMwYzc6hJ6Le5MSwgqHnZZjMP6Fllt3S8+ uIohLlcGHZbOPLWZetCF4bvA4vUgfvwlcfY77YZ5pWDGo7EvJTd/PBIal5RUGt2C6YOG HrPMt9mZIisUsKzjhHmNbz4SxJY3mNQ3osRIMegc3mmd0Ihsn+zhYwxV2vOIOdeo9PtD L0dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749727502; x=1750332302; h=mime-version:references:in-reply-to:message-id:date:subject:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=pueDsVQWOKohxnG69PtAQSVyhRjzLb4Sc4tssF0h+hc=; b=tCmiA44hh3LPdahxE1b4Pai7t8ae9mIjlMRzN8GJ++7vYIiZKnDVqFQ2kCKWPx11BA ZVMRpR+XmjmyRY7U0YQWeG9mpeatmgoHelRH40w2ufqWZLUrM62Qfr9hWzQZyQrM0+3C 6JpP1GX16p8SBMIQZp37X5s04bk99zeIYAwpP667dfhpm9inezgC1d0jShzfFO+360p/ th40Phckot2mN9AIfGhvn64sj0HIYyxfUZ9+wtjHq3L+5Hn2KnNAxG/nzvcxPg8qAQhY YvW+QPihydMNx7/H/gSClS6ib+KDQCjO8+OZw/BF7e81T2M2UK0MjgwkO9P8MwhQauxW tpUQ== X-Gm-Message-State: AOJu0Yw0mdXF7s/4lcHm3/yQb1dfuRL9V/G4wfyZE9S483EWQnTvLbZt HUgPDYR8v71ag6KHm/TLi+tGjAA7QqlVXmY0i4U8m29KVYePYrKLXPWXExVFqQ== X-Gm-Gg: ASbGncvJwlJL2TF99xZLkt9kQJDh3T20ZDm3rZF1NpH92d8arMx16Xu70/1mrzeJ6G8 f7XyyyBTZxxQ7c2avm420xuzvh6xy53D29DHmLJ+yHR6Xe04C5JBh7rxC59EBzuI6Hpwwv1Oxh0 H7vHYHcn5wf1GKM6n2HiK56CHrUby/L8bFbJXVBTyA6jgazVikY/WontQHPhTrbDXEznoBt1Jvf sjdZenDDHkLB14+47zGQmFZEzRq5woFEr+35ec/QKJpebjJGLRoW9DCNTbAEbOGpEBqDiNsbBJk nlACY0pNeeKD7O5KzHn913pqLAJCLRTuUrwVA4pE7E1gWh40AnkQLulhD00ocJ5XEv7YExd4xrd +iRtf+ojmK069ZKZGcy8LrTUYY0gr/talUKJ36qEzGXzqNtgwE9M61Zs9a9LJsxpObImjnErBd0 U= X-Google-Smtp-Source: AGHT+IGcY5+BFw7RVxBkEMk1+EIgB2hcZGlPqY0KAx97TbLQtL3Z21xyP3tTImRBfZ3qmbzohV34TA== X-Received: by 2002:a05:600c:a110:b0:441:b076:fce8 with SMTP id 5b1f17b1804b1-4532e8abfa4mr16281875e9.14.1749727502231; Thu, 12 Jun 2025 04:25:02 -0700 (PDT) Received: from [192.168.178.57] (p200301023700450060f2a9d7350ce887.dip0.t-ipconnect.de. [2003:102:3700:4500:60f2:a9d7:350c:e887]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a561a3cd54sm1674318f8f.47.2025.06.12.04.25.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Jun 2025 04:25:01 -0700 (PDT) From: Marvin Scholz To: FFmpeg development discussions and patches Date: Thu, 12 Jun 2025 13:25:00 +0200 X-Mailer: MailMate (2.0r6222) Message-ID: <395F8F80-4C17-48A4-AD34-442029EF7D11@gmail.com> In-Reply-To: References: <20250611204213.97295-1-epirat07@gmail.com> MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH 1/4] fftools/textformat: narrow variable scopes 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 12 Jun 2025, at 4:26, softworkz . wrote: > Hi Marvin, > >> -----Original Message----- >> From: ffmpeg-devel On Behalf Of >> Marvin Scholz >> Sent: Mittwoch, 11. Juni 2025 22:42 >> To: ffmpeg-devel@ffmpeg.org >> Subject: [FFmpeg-devel] [PATCH 1/4] fftools/textformat: narrow >> variable scopes >> >> --- >> fftools/textformat/avtextformat.c | 15 ++++++--------- >> 1 file changed, 6 insertions(+), 9 deletions(-) >> >> diff --git a/fftools/textformat/avtextformat.c >> b/fftools/textformat/avtextformat.c >> index 14779e6f0c..f1811abb1c 100644 >> --- a/fftools/textformat/avtextformat.c >> +++ b/fftools/textformat/avtextformat.c >> @@ -101,7 +101,6 @@ static void bprint_bytes(AVBPrint *bp, const >> uint8_t *ubuf, size_t ubuf_size) >> int avtext_context_close(AVTextFormatContext **ptctx) >> { >> AVTextFormatContext *tctx = *ptctx; >> - int i; >> int ret = 0; >> >> if (!tctx) >> @@ -117,7 +116,7 @@ int avtext_context_close(AVTextFormatContext >> **ptctx) >> if (tctx->formatter->priv_class) >> av_opt_free(tctx->priv); >> } >> - for (i = 0; i < SECTION_MAX_NB_LEVELS; i++) >> + for (int i = 0; i < SECTION_MAX_NB_LEVELS; i++) >> av_bprint_finalize(&tctx->section_pbuf[i], NULL); >> av_freep(&tctx->priv); >> av_opt_free(tctx); >> @@ -130,7 +129,7 @@ int avtext_context_open(AVTextFormatContext >> **ptctx, const AVTextFormatter *form >> const AVTextFormatSection *sections, int >> nb_sections, AVTextFormatOptions options, char *show_data_hash) >> { >> AVTextFormatContext *tctx; >> - int i, ret = 0; >> + int ret = 0; >> >> av_assert0(ptctx && formatter); >> >> @@ -202,7 +201,7 @@ int avtext_context_open(AVTextFormatContext >> **ptctx, const AVTextFormatter *form >> if (ret == AVERROR(EINVAL)) { >> const char *n; >> av_log(NULL, AV_LOG_ERROR, "Unknown hash algorithm >> '%s'\nKnown algorithms:", show_data_hash); >> - for (i = 0; (n = av_hash_names(i)); i++) >> + for (unsigned i = 0; (n = av_hash_names(i)); i++) >> av_log(NULL, AV_LOG_ERROR, " %s", n); >> av_log(NULL, AV_LOG_ERROR, "\n"); >> } >> @@ -525,13 +524,13 @@ void avtext_print_data(AVTextFormatContext >> *tctx, const char *key, >> { >> AVBPrint bp; >> unsigned offset = 0; >> - int l, i; >> + int i; >> >> av_bprint_init(&bp, 0, AV_BPRINT_SIZE_UNLIMITED); >> av_bprintf(&bp, "\n"); >> while (size) { >> av_bprintf(&bp, "%08x: ", offset); >> - l = FFMIN(size, 16); >> + int l = FFMIN(size, 16); >> for (i = 0; i < l; i++) { >> av_bprintf(&bp, "%02x", data[i]); >> if (i & 1) >> @@ -571,7 +570,6 @@ void avtext_print_integers(AVTextFormatContext >> *tctx, const char *key, >> { >> AVBPrint bp; >> unsigned offset = 0; >> - int l, i; >> >> if (!key || !data || !format || columns <= 0 || bytes <= 0) >> return; >> @@ -580,8 +578,7 @@ void avtext_print_integers(AVTextFormatContext >> *tctx, const char *key, >> av_bprintf(&bp, "\n"); >> while (size) { >> av_bprintf(&bp, "%08x: ", offset); >> - l = FFMIN(size, columns); >> - for (i = 0; i < l; i++) { >> + for (int i = 0, l = FFMIN(size, columns); i < l; i++) { > > You are changing behavior here because size is changed inside the loop. > The pre-evaluation into l is intentional. > I fail to see how I change anything here though? It is still just assigned before the loop runs, just that l is scoped narrower? > The remaining change should be ok. > > Thanks > sw > > _______________________________________________ > 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".