From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <ffmpeg-devel-bounces@ffmpeg.org>
Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100])
	by master.gitmailbox.com (Postfix) with ESMTPS id 1A4DD4E82F
	for <ffmpegdev@gitmailbox.com>; Thu,  8 May 2025 00:14:35 +0000 (UTC)
Received: from [127.0.1.1] (localhost [127.0.0.1])
	by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 40E2868C033;
	Thu,  8 May 2025 03:14:31 +0300 (EEST)
Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com
 [209.85.128.47])
 by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4923368B722
 for <ffmpeg-devel@ffmpeg.org>; Thu,  8 May 2025 03:14:25 +0300 (EEST)
Received: by mail-wm1-f47.google.com with SMTP id
 5b1f17b1804b1-43cebe06e9eso3212355e9.3
 for <ffmpeg-devel@ffmpeg.org>; Wed, 07 May 2025 17:14:25 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1746663264; x=1747268064; darn=ffmpeg.org;
 h=user-agent:in-reply-to:content-disposition:mime-version:references
 :mail-followup-to:message-id:subject:cc:to:from:date:from:to:cc
 :subject:date:message-id:reply-to;
 bh=ZxKg+UA8goZ2qijHkZQPm1Rr0Tj6iyDMIcni7Rk8SpY=;
 b=l0Gr/IXkZ3/tj8VjiXcJzFzuJwr//cH4EVTw2lGXg74W4713ToT87YgYgpQExbMQN+
 uIiAju+LdutcuVI/p93U4XAdZrJj1hkD5tLCkCxE/PYCnwafFzbqaGVL6AJJVFx4eGGA
 ReGllRwT7PZYRWzyvpbyF7xt5H75YhhbnxBNnfFNmrq+n3FkJ9cwq4Qcuu3vB5UGYlgO
 /wsHL4AA89RjmUgjA3KkH5ONBmfLoQLjdGmtbghb4mNjT4s5ZA/5XhCx4yGKY9k3/1Ua
 lxBrjgVtYaMY8WrPnr1uuHVogGdbb9Q5vru1+t9qIAs6/5StXVQioEdOOkpkN8GeYd84
 69Fg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1746663264; x=1747268064;
 h=user-agent:in-reply-to:content-disposition:mime-version:references
 :mail-followup-to:message-id:subject:cc:to:from:date
 :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=ZxKg+UA8goZ2qijHkZQPm1Rr0Tj6iyDMIcni7Rk8SpY=;
 b=rNM80XN6rvRw1j66Ng9EuiQAZeCdgXuTPXQOBnCB78g1RKqEX15S5GQsgxfG4A3Hlj
 a+S2/JKcFSF4oa6L03GhiQkrJInokUFeh27ZagCU2/GcEvQ09q14lyZyvM06qAzWzX0C
 VlMpv8Ka2OPkLOM5q8cwT8n0kJnFSalhN0fioEaHNrUBqHjuToYRsSe7/QV3N1YUrz7B
 tadYc5OfAceU9faxJi4lAK3gOJ3a71J9t16+12FItz2LiRrOVyhUWm3qkDaj1WBka/46
 w87aia53biFLfzYRLGx2Yw2QlQIrACstyJO/5F+nRMuwIcLqq/fszMHvS59DkLmvi9lP
 pgIw==
X-Gm-Message-State: AOJu0Ywwj0w34eAWOOMQnqFZcDDVYZATyPwjed03BAO+3POi8E899d5u
 DqK/P1z5zCVRdBKOLgfEdbhRsUhkEqoV4sPLybJPTj5rslxOQkyoXWj3rw==
X-Gm-Gg: ASbGncuuBQ2Q9+cavONYuzO01AQvMOtOVapxHvrSKQqBqGVC48jIeIUgj0Wrei2pXRm
 ykmfMxd+Jml1RxJYB7QamYJdpRaHgFshhYIXdGh5+ovmsMw46fpZgEVBWSLqpso/Qq+FucjQSHW
 HzYXqJrCoyAChNp24nGhXWDQB6xnDZN61LrO+6n/1t1or9IicLXMaF6q+hNIveKlyyCSH793qJu
 xsKdnRFY0dLwwvvk8t83FCct+ijqVMgJYe6lwbFxrycSaHyJLdLHUkAMfsbuYCxY+lWp+K0LtYF
 C+HlQ6hl3vbCNVFFpYkThYKxqVMNcJKAYBfd71S0L9qjAN53ljaryVm8fRvWEWRN0cCsOoxQQjB
 vyzv5
X-Google-Smtp-Source: AGHT+IEuikGnnwe6ZGE9GQmROv+Zy1xKXol0rxILrLlVTAvQF8vJ4IPvbhHJA6z4UslFybL/R3gk4Q==
X-Received: by 2002:a05:600c:3b9d:b0:43d:b3:f95 with SMTP id
 5b1f17b1804b1-441d44e03b7mr33681425e9.28.1746663264209; 
 Wed, 07 May 2025 17:14:24 -0700 (PDT)
Received: from mariano (dynamic-adsl-84-220-189-10.clienti.tiscali.it.
 [84.220.189.10]) by smtp.gmail.com with ESMTPSA id
 5b1f17b1804b1-442cd2b3be5sm18007975e9.0.2025.05.07.17.14.23
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 07 May 2025 17:14:23 -0700 (PDT)
Received: by mariano (Postfix, from userid 1000)
 id 0ABFCBFCE8; Thu,  8 May 2025 02:14:23 +0200 (CEST)
Date: Thu, 8 May 2025 02:14:22 +0200
From: Stefano Sabatini <stefasab@gmail.com>
To: "softworkz ." <softworkz@hotmail.com>
Message-ID: <aBv3XmMY7JrQ9ybC@mariano>
Mail-Followup-To: "softworkz ." <softworkz-at-hotmail.com@ffmpeg.org>,
	FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
References: <pull.66.v9.ffstaging.FFmpeg.1746260565.ffmpegagent@gmail.com>
 <pull.66.v10.ffstaging.FFmpeg.1746327446.ffmpegagent@gmail.com>
 <7e8fddd1b83a4ab9c1330612020f82af9377b6c5.1746327446.git.ffmpegagent@gmail.com>
 <aBvweAMgcV4iz0g5@mariano>
 <DM8P223MB03655C5E0B0F7EED85D2CADEBA88A@DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM>
MIME-Version: 1.0
Content-Disposition: inline
In-Reply-To: <DM8P223MB03655C5E0B0F7EED85D2CADEBA88A@DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM>
User-Agent: Mutt/2.1.4 (2021-12-11)
Subject: Re: [FFmpeg-devel] [PATCH v10 01/15] fftools/textformat: Formatting
 and whitespace changes
X-BeenThere: ffmpeg-devel@ffmpeg.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: FFmpeg development discussions and patches <ffmpeg-devel.ffmpeg.org>
List-Unsubscribe: <https://ffmpeg.org/mailman/options/ffmpeg-devel>,
 <mailto:ffmpeg-devel-request@ffmpeg.org?subject=unsubscribe>
List-Archive: <https://ffmpeg.org/pipermail/ffmpeg-devel>
List-Post: <mailto:ffmpeg-devel@ffmpeg.org>
List-Help: <mailto:ffmpeg-devel-request@ffmpeg.org?subject=help>
List-Subscribe: <https://ffmpeg.org/mailman/listinfo/ffmpeg-devel>,
 <mailto:ffmpeg-devel-request@ffmpeg.org?subject=subscribe>
Reply-To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Cc: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: ffmpeg-devel-bounces@ffmpeg.org
Sender: "ffmpeg-devel" <ffmpeg-devel-bounces@ffmpeg.org>
Archived-At: <https://master.gitmailbox.com/ffmpegdev/aBv3XmMY7JrQ9ybC@mariano/>
List-Archive: <https://master.gitmailbox.com/ffmpegdev/>
List-Post: <mailto:ffmpegdev@gitmailbox.com>

On date Wednesday 2025-05-07 23:59:39 +0000, softworkz . wrote:
> 
> 
> > -----Original Message-----
> > From: Stefano Sabatini <stefasab@gmail.com>
> > Sent: Donnerstag, 8. Mai 2025 01:45
> > To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
> > Cc: softworkz <softworkz@hotmail.com>
> > Subject: Re: [FFmpeg-devel] [PATCH v10 01/15] fftools/textformat: Formatting
> > and whitespace changes
> > 
> > On date Sunday 2025-05-04 02:57:12 +0000, softworkz wrote:
> > > From: softworkz <softworkz@hotmail.com>
> > >
> > > Reviewed-by: Stefano Sabatini <stefasab@gmail.com>
> > > Signed-off-by: softworkz <softworkz@hotmail.com>
> > > ---
> > >  fftools/textformat/avtextformat.c  | 92 +++++++++++++++---------------
> > >  fftools/textformat/avtextformat.h  | 20 +++----
> > >  fftools/textformat/avtextwriters.h | 11 ++--
> > >  fftools/textformat/tf_compact.c    | 91 ++++++++++++++++-------------
> > >  fftools/textformat/tf_default.c    | 20 +++----
> > >  fftools/textformat/tf_flat.c       | 26 +++++----
> > >  fftools/textformat/tf_ini.c        | 36 ++++++------
> > >  fftools/textformat/tf_json.c       | 10 ++--
> > >  fftools/textformat/tf_xml.c        | 30 +++++-----
> > >  9 files changed, 177 insertions(+), 159 deletions(-)
> > >
> > [...]
> > > -    if (show_data_hash) {
> > > +    if (show_data_hash)
> > >          if ((ret = av_hash_alloc(&tctx->hash, show_data_hash)) < 0) {
> > >              if (ret == AVERROR(EINVAL)) {
> > >                  const char *n;
> > > @@ -211,7 +211,6 @@ int avtext_context_open(AVTextFormatContext **ptctx,
> > const AVTextFormatter *form
> > >              }
> > >              return ret;
> > >          }
> > > -    }
> > 
> > For the record, I'm a bit against these kind of changes since they do
> > not really add to readability and might led to logical issues in case
> > an instruction is added to the else block and the parentheses are
> > discarded - but not so strongly opposed to block the patch though.
> > 
> > [...]
> > > -void avtext_print_section_header(AVTextFormatContext *tctx,
> > > -                                               const void *data,
> > > -                                               int section_id)
> > > +void avtext_print_section_header(AVTextFormatContext *tctx, const void
> > *data, int section_id)
> > >  {
> > >      tctx->level++;
> > >      av_assert0(tctx->level < SECTION_MAX_NB_LEVELS);
> > > @@ -272,8 +269,9 @@ void avtext_print_section_header(AVTextFormatContext
> > *tctx,
> > 
> > >  void avtext_print_section_footer(AVTextFormatContext *tctx)
> > >  {
> > >      int section_id = tctx->section[tctx->level]->id;
> > > -    int parent_section_id = tctx->level ?
> > > -        tctx->section[tctx->level-1]->id : SECTION_ID_NONE;
> > > +    int parent_section_id = tctx->level
> > > +        ? tctx->section[tctx->level - 1]->id
> > > +        : SECTION_ID_NONE;
> > 
> > nit: I prefer the original form (it now looks less readable).
> > 
> > [...]
> > >          if (section->flags & AV_TEXTFORMAT_SECTION_FLAG_HAS_TYPE) {
> > >              // add /TYPE to prefix
> > > @@ -185,30 +189,33 @@ static void
> > compact_print_section_header(AVTextFormatContext *wctx, const void *
> > >                  char c =
> > >                      (*p >= '0' && *p <= '9') ||
> > >                      (*p >= 'a' && *p <= 'z') ||
> > > -                    (*p >= 'A' && *p <= 'Z') ? av_tolower(*p) : '_';
> > > +                    (*p >= 'A' && *p <= 'Z')
> > > +                    ? (char)(char)av_tolower(*p)
> > > +                    : '_';
> > 
> > Ditto.
> > 
> > [...]
> > 
> > Should be good otherwise.
> 
> 
> Hi Stefano,
> 
> In message "[PATCH] [RFC] global/clang-format: Add .clang-format configuration for consistent formatting" I'm trying to work out a common format that matches the existing code formatting rules.
> 
> The patches above are formatted accordingly.
> 
> Regarding the first above, FFmpeg rules say:
> 
> Don't wrap single-line blocks in braces. Use braces only if there is an accompanying else statement.
> (https://ffmpeg.org/developer.html#Code-formatting-conventions)
> 
> Now, I'm not sure whether this exactly means "single line" - clang-format only supports "single statement/block", so if it means "single line", it might be difficult to replicate.
> 

So, as I wrote, I don't have strong objections against the brace
removals if you want to go with that.

> Seems, we don't have any rule for ternary operator placement, afaik,
> the most common rule is to place them at the beginning of lines, but
> I surely can revert it.

About ternary, I'd drop those changes as they conflict with the style
adopted in the whole FFmpeg codebase.
_______________________________________________
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".