From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 16E9246C86 for ; Tue, 8 Aug 2023 11:12:07 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8DEF068C7BF; Tue, 8 Aug 2023 14:12:04 +0300 (EEST) Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03olkn2038.outbound.protection.outlook.com [40.92.59.38]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 470AB68C613 for ; Tue, 8 Aug 2023 14:11:57 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kw5nspx86iZm6TWCXCUfc0QNsyuzmjF420lPzYpXVOsCZ20uKiYrLrKQD9zFkwn6Q1az49KDhN8NJyPbkmETmJVDwvBj0/Qjuo436HwrDUh/SqAfMpq37o3KkT6pH9QWRq56HHpo2cZnjrK8DLEp0Pf2ll3Gr+s6w2Ng7M3jolOFEcBZMZchMyyDRH6Hg7jpQmAJLTrvnSHm6bOCipDlo2pHnoI4UUgUdBfrJTtM+2jQUUyeqxRAjwBIRciIiLdkwl+KlghLJ/GIB92szCvhZyGDEm66rEHPG6PPJeze0jhquYb3UoBQdxf9SV9iH4CjXSR7u3zHUjCyKIOOZnruYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=NwV2gYvNQIHOQkvTnbnb3BTy3rq47kNq9KzgE98yZYg=; b=E30TU1/ofzC6q7tqBWYRTSr6Q7UtBGf3KlRXFnRkjcdV1TwKooQ89MlX3OJFSuKda69mViW9RzQGax6sFgK+3iJ/b5dKkKYuofxbW+R0+G4alLDMbfAczCcuB9LdbWCDXTQoDJTGSZw9GyL+dK3PsTa7QGfGNNvZU46SozJ9SdXwJoBYR2/xATNKKbo8ciHWauoaW2lt0HQU0Xoon5oNOvCWITi0+JQaypVe5cGsYC9vA7mzE0vdt/3558Lcgw50zAzXU69PQwSeh4fnr2Si4fBBI0xtSoWakR8L1E0QxbNWtXMwaLtE+qRM4408dpySpCDZr+HzcTvQ264xdjBydg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NwV2gYvNQIHOQkvTnbnb3BTy3rq47kNq9KzgE98yZYg=; b=F06MfZmZgvwUZ2s+licD0atOmivJ1s0pjMHbaikVzmwtSsx5lmds5DrDTSewpulQVRJy+gNubyQms4YTBTErRgtx6B8FIv1gglz6vXJNwfsWM/jhxJy4FvowzYY6QYZWymhEY3bUI/mZHW+xrqC8HVfAEaUDMmPJko81AJFMVde2rbRI79S53GdM6J2YwfdkfgRLUlIlkbLkBicuEJ/yvzxKlboBiU0Y1U6f/cyGSG8KxcZXHSyEUqZYeOc3NVJXy+222NvTopiV2gWR+YgQ4W6IzFX0/diCF3n98L2yfsN+jGTg8bsDUZrx97kTtxWTurWdDzD6ENat8pRolh4bjQ== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by AM8P250MB0137.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:320::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.27; Tue, 8 Aug 2023 11:11:55 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::5e01:aea5:d3a8:cafa]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::5e01:aea5:d3a8:cafa%3]) with mapi id 15.20.6652.021; Tue, 8 Aug 2023 11:11:55 +0000 Message-ID: Date: Tue, 8 Aug 2023 13:13:08 +0200 To: FFmpeg development discussions and patches References: <20230808071418.GA4305@mariano> Content-Language: en-US From: Andreas Rheinhardt In-Reply-To: <20230808071418.GA4305@mariano> X-TMN: [ABFw7GWcVn17kautIW8uw0jaXSSZ42x2ER39Wc/R0y0=] X-ClientProxiedBy: FR3P281CA0114.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a3::6) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <52e3795a-22a5-58a0-1141-9a796585823f@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|AM8P250MB0137:EE_ X-MS-Office365-Filtering-Correlation-Id: 3190a516-ceb7-40d2-ef32-08db9800468c X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iVS3698gRLxC2y77/UxeAMArhnD0ZUj8OU1klwpY9QbW+1s58SbutJEEzDgF9EAr5GY8nRBSOWCu3PpK5XFMvtoMv175Y4ChVNIwtOYAN9Wty2as+hxaW70zY1dfE5+PSYoQmEKEDfIZN03B+Sq/MWHHu8zJHESw5dDvGJBKQ+lRWwBacnxpU/TgIZsC0R8/pVAYzF6k8Sca4iCpmYib/80kg/WogfxeP5S/E31XXrWZ7Om1+FqXlkvnTxlxrEhLFwLe8tLvaP/cB3IqmhsVtdoSorStiGmVrt7gzPF35FwaZOMPjOg+jmvnU/NByRZyNELrU0O0Qh8k95Aj+qgl8cb/tCsklfb4lPQm02xRiEZTGQuQkVX+l9D4FnkKOmDPNrOARB9WL2UbrGjsJx8TF06woALjnDtBbUi97uN1LjeSODOOSv+t6aNDI+j0rftKnldsJyz9JoP7L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WVGVXNXJtLzRyYmozS0FCaExVdUVLT0xJdVdBeHFMZURyMWI2?= =?utf-8?Q?9ovtZOPYch35IONa96Gv?= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3190a516-ceb7-40d2-ef32-08db9800468c X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Aug 2023 11:11:55.6884 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8P250MB0137 Subject: Re: [FFmpeg-devel] [PATCH] fftools/ffprobe: Use proper enum type 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: Stefano Sabatini: > On date Sunday 2023-08-06 15:28:00 +0200, Andreas Rheinhardt wrote: >> This is a bit cleaner as int need not be the underlying type >> of an enum if a smaller type can hold all its values. >> Also declare the children_ids array as const as it never changes. >> >> Signed-off-by: Andreas Rheinhardt >> --- >> fftools/ffprobe.c | 38 ++++++++++++++++++-------------------- >> 1 file changed, 18 insertions(+), 20 deletions(-) >> >> diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c >> index 5c2d4cbff1..4fcfe1164b 100644 >> --- a/fftools/ffprobe.c >> +++ b/fftools/ffprobe.c >> @@ -161,22 +161,6 @@ static int find_stream_info = 1; >> >> #define SECTION_MAX_NB_CHILDREN 10 >> >> -struct section { >> - int id; ///< unique id identifying a section >> - const char *name; >> - >> -#define SECTION_FLAG_IS_WRAPPER 1 ///< the section only contains other sections, but has no data at its own level >> -#define SECTION_FLAG_IS_ARRAY 2 ///< the section contains an array of elements of the same type >> -#define SECTION_FLAG_HAS_VARIABLE_FIELDS 4 ///< the section may contain a variable number of fields with variable keys. >> - /// For these sections the element_name field is mandatory. >> - int flags; >> - int children_ids[SECTION_MAX_NB_CHILDREN+1]; ///< list of children section IDS, terminated by -1 >> - const char *element_name; ///< name of the contained element, if provided >> - const char *unique_name; ///< unique section name, in case the name is ambiguous >> - AVDictionary *entries_to_show; >> - int show_all_entries; >> -}; >> - >> typedef enum { >> SECTION_ID_NONE = -1, >> SECTION_ID_CHAPTER, >> @@ -229,6 +213,22 @@ typedef enum { >> SECTION_ID_SUBTITLE, >> } SectionID; >> >> +struct section { >> + int id; ///< unique id identifying a section >> + const char *name; >> + >> +#define SECTION_FLAG_IS_WRAPPER 1 ///< the section only contains other sections, but has no data at its own level >> +#define SECTION_FLAG_IS_ARRAY 2 ///< the section contains an array of elements of the same type >> +#define SECTION_FLAG_HAS_VARIABLE_FIELDS 4 ///< the section may contain a variable number of fields with variable keys. >> + /// For these sections the element_name field is mandatory. >> + int flags; >> + const SectionID children_ids[SECTION_MAX_NB_CHILDREN+1]; ///< list of children section IDS, terminated by -1 >> + const char *element_name; ///< name of the contained element, if provided >> + const char *unique_name; ///< unique section name, in case the name is ambiguous >> + AVDictionary *entries_to_show; >> + int show_all_entries; >> +}; >> + >> static struct section sections[] = { >> [SECTION_ID_CHAPTERS] = { SECTION_ID_CHAPTERS, "chapters", SECTION_FLAG_IS_ARRAY, { SECTION_ID_CHAPTER, -1 } }, >> [SECTION_ID_CHAPTER] = { SECTION_ID_CHAPTER, "chapter", 0, { SECTION_ID_CHAPTER_TAGS, -1 } }, >> @@ -3688,8 +3688,7 @@ static inline void mark_section_show_entries(SectionID section_id, >> >> section->show_all_entries = show_all_entries; >> if (show_all_entries) { >> - SectionID *id; >> - for (id = section->children_ids; *id != -1; id++) >> + for (const SectionID *id = section->children_ids; *id != -1; id++) >> mark_section_show_entries(*id, show_all_entries, entries); >> } else { >> av_dict_copy(§ion->entries_to_show, entries, 0); >> @@ -4072,11 +4071,10 @@ static const OptionDef real_options[] = { >> > >> static inline int check_section_show_entries(int section_id) >> { >> - int *id; >> struct section *section = §ions[section_id]; >> if (sections[section_id].show_all_entries || sections[section_id].entries_to_show) >> return 1; > >> - for (id = section->children_ids; *id != -1; id++) >> + for (const SectionID *id = section->children_ids; *id != -1; id++) > > I remember this might trigger a C90 style warning (mixed declarations > and statements), make sure it's not the case anymore. > There was no warning. We completely allow declarations in for-loops (as C99 does) and use it everywhere. >> if (check_section_show_entries(*id)) >> return 1; >> return 0; >> -- >> 2.34.1 > > LGTM, thanks. _______________________________________________ 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".