From patchwork Mon Apr 20 18:46:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 11499663 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 89BC8913 for ; Mon, 20 Apr 2020 18:46:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5A9272078C for ; Mon, 20 Apr 2020 18:46:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="M5eabWT/" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728117AbgDTSqy (ORCPT ); Mon, 20 Apr 2020 14:46:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726439AbgDTSqx (ORCPT ); Mon, 20 Apr 2020 14:46:53 -0400 Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A5FBC061A0C for ; Mon, 20 Apr 2020 11:46:53 -0700 (PDT) Received: by mail-pg1-x543.google.com with SMTP id w11so5500191pga.12 for ; Mon, 20 Apr 2020 11:46:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=ZAcvQsC/lhnYJsNLGp/lHCMugut0Tsr5xJWMqk91SuI=; b=M5eabWT/IxbWsypkZLd4jf9MEt1Ap0aIFAeG6vfOxlUBhHUTssR3sQMnnw5+Ay2j4S bzxHy1iTmohEoIuovOi0lphP2rN2wj+9WmOB/vfF+sjauBL2wfCiteHUHYw81adq/EOt feKSvH0aKnxpAj4GWLgHP2jnEy6e0o36fMzK7GAi2CS4owDCMzR0I7Avq+jOryNeQOXK chSHNgU8IrPJzo59j9xjAaZgdHeoTlDATcraa56LrWJcHHDM9gqPzra9+HuxNxwf6NOi UUEInKLTkUXfryZautzCaoHm3ITfDb56KjQ+3kjWqcB4468rGLyNY0UIlk2lvbD6mQvp LjEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=ZAcvQsC/lhnYJsNLGp/lHCMugut0Tsr5xJWMqk91SuI=; b=tB6J+wODJMIk+wfYbUFMXZBYOWjWyieDszL/995Yci0dLNYR327MDqR5KjaNyO1qd0 2jtOABsIIuMVk9qlsFotw3ci+4NjfQFTTU1KENzBeKajte9ac5X11QS8964zi6vCeHNc 1L09OVg5ga8KTX3k7WOq49qeemjdwrjGg2OQIS8Y8pFQ3+XoCLDkvO9Iyl6u/PExWlmg pxpEE21MMZ8R1ziZVJ0G/cp2eu7V2lee/MuvIVwic/U8kJAFj3IDX8MwwVKeiucjcLdn DZTbzSrLFcFRiJ/5IALPIpCj0mMwSbOKuIjQfwAr4LhOOrcfY2Khmo+G2ht3vydCxLhi r5Vw== X-Gm-Message-State: AGi0PuZNbW7XUXdVG7k0W5YN+cGcP7/ygtB5yUZAl7ZvOZ2ULFQP9w+i wsl7NpDJ2nZYjlssFMcM9tMC0iTJ X-Google-Smtp-Source: APiQypKpsvobGZ32EdlCjTeGVXSq7WrjyLwGUJEbUt9XsHv4DNi4EZNBow2TghI2wAxnonDz+byOuQ== X-Received: by 2002:a63:5642:: with SMTP id g2mr18446077pgm.211.1587408411680; Mon, 20 Apr 2020 11:46:51 -0700 (PDT) Received: from localhost.localdomain (76-14-109-232.rk.wavecable.com. [76.14.109.232]) by smtp.gmail.com with ESMTPSA id n8sm182443pfq.213.2020.04.20.11.46.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Apr 2020 11:46:50 -0700 (PDT) From: Rosen Penev To: linux-media@vger.kernel.org Subject: [PATCH 1/7] treewide: fix mismatching declarations Date: Mon, 20 Apr 2020 11:46:43 -0700 Message-Id: <20200420184649.4202-1-rosenp@gmail.com> X-Mailer: git-send-email 2.25.2 MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Found with clang-tidy's readability-inconsistent-declaration-parameter-name Signed-off-by: Rosen Penev --- lib/include/libdvbv5/atsc_eit.h | 4 +- lib/include/libdvbv5/cat.h | 4 +- lib/include/libdvbv5/descriptors.h | 2 +- lib/include/libdvbv5/dvb-demux.h | 2 +- lib/include/libdvbv5/dvb-dev.h | 2 +- lib/include/libdvbv5/dvb-fe.h | 2 +- lib/include/libdvbv5/dvb-file.h | 4 +- lib/include/libdvbv5/dvb-scan.h | 16 +++---- lib/include/libdvbv5/eit.h | 4 +- lib/include/libdvbv5/header.h | 4 +- lib/include/libdvbv5/mgt.h | 4 +- lib/include/libdvbv5/mpeg_pes.h | 2 +- lib/include/libdvbv5/nit.h | 6 +-- lib/include/libdvbv5/pat.h | 4 +- lib/include/libdvbv5/pmt.h | 4 +- lib/include/libdvbv5/sdt.h | 4 +- lib/include/libdvbv5/vct.h | 4 +- lib/include/libv4l2.h | 2 +- lib/libdvbv5/parse_string.h | 2 +- lib/libv4lconvert/libv4lconvert-priv.h | 48 +++++++++---------- .../processing/libv4lprocessing.h | 2 +- lib/libv4lconvert/tinyjpeg.h | 2 +- utils/cec-compliance/cec-compliance.h | 3 +- utils/common/v4l-stream.h | 4 +- utils/keytable/bpf.h | 6 +-- utils/libcecutil/cec-log.cpp | 12 ++--- 26 files changed, 76 insertions(+), 77 deletions(-) diff --git a/lib/include/libdvbv5/atsc_eit.h b/lib/include/libdvbv5/atsc_eit.h index 5e52087c..18ae599d 100644 --- a/lib/include/libdvbv5/atsc_eit.h +++ b/lib/include/libdvbv5/atsc_eit.h @@ -192,7 +192,7 @@ ssize_t atsc_table_eit_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf, * * @param table pointer to struct atsc_table_eit to be freed */ -void atsc_table_eit_free(struct atsc_table_eit *table); +void atsc_table_eit_free(struct atsc_table_eit *eit); /** * @brief Prints the content of the ATSC EIT table @@ -202,7 +202,7 @@ void atsc_table_eit_free(struct atsc_table_eit *table); * @param table pointer to struct atsc_table_eit */ void atsc_table_eit_print(struct dvb_v5_fe_parms *parms, - struct atsc_table_eit *table); + struct atsc_table_eit *eit); /** * @brief Converts an ATSC EIT formatted timestamp into struct tm diff --git a/lib/include/libdvbv5/cat.h b/lib/include/libdvbv5/cat.h index 612c2c35..2e767ddc 100644 --- a/lib/include/libdvbv5/cat.h +++ b/lib/include/libdvbv5/cat.h @@ -88,7 +88,7 @@ ssize_t dvb_table_cat_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf, * * @param table pointer to struct dvb_table_cat to be freed */ -void dvb_table_cat_free(struct dvb_table_cat *table); +void dvb_table_cat_free(struct dvb_table_cat *cat); /** * @brief Prints the content of the CAT table @@ -97,7 +97,7 @@ void dvb_table_cat_free(struct dvb_table_cat *table); * @param table pointer to struct dvb_table_cat */ void dvb_table_cat_print(struct dvb_v5_fe_parms *parms, - struct dvb_table_cat *table); + struct dvb_table_cat *cat); #ifdef __cplusplus } diff --git a/lib/include/libdvbv5/descriptors.h b/lib/include/libdvbv5/descriptors.h index cb21470c..8f3900f2 100644 --- a/lib/include/libdvbv5/descriptors.h +++ b/lib/include/libdvbv5/descriptors.h @@ -157,7 +157,7 @@ uint32_t dvb_bcd(uint32_t bcd); * @param len Number of bytes to show */ void dvb_hexdump(struct dvb_v5_fe_parms *parms, const char *prefix, - const unsigned char *buf, int len); + const unsigned char *data, int len); /** * @brief parse MPEG-TS descriptors diff --git a/lib/include/libdvbv5/dvb-demux.h b/lib/include/libdvbv5/dvb-demux.h index 971c27f6..d3bc02a9 100644 --- a/lib/include/libdvbv5/dvb-demux.h +++ b/lib/include/libdvbv5/dvb-demux.h @@ -148,7 +148,7 @@ int dvb_set_section_filter(int dmxfd, int pid, unsigned filtsize, * * @warning This function currently assumes that the PAT fits into one session. */ -int dvb_get_pmt_pid(int dmxfd, int sid); +int dvb_get_pmt_pid(int patfd, int sid); #ifdef __cplusplus } diff --git a/lib/include/libdvbv5/dvb-dev.h b/lib/include/libdvbv5/dvb-dev.h index 2eeae516..5a9cc1a2 100644 --- a/lib/include/libdvbv5/dvb-dev.h +++ b/lib/include/libdvbv5/dvb-dev.h @@ -398,7 +398,7 @@ int dvb_dev_set_bufsize(struct dvb_open_descriptor *open_dev, */ int dvb_dev_dmx_set_pesfilter(struct dvb_open_descriptor *open_dev, int pid, dmx_pes_type_t type, - dmx_output_t output, int buffersize); + dmx_output_t output, int bufsize); /** * @brief Sets a MPEG-TS section filter diff --git a/lib/include/libdvbv5/dvb-fe.h b/lib/include/libdvbv5/dvb-fe.h index 96657013..4bd94108 100644 --- a/lib/include/libdvbv5/dvb-fe.h +++ b/lib/include/libdvbv5/dvb-fe.h @@ -732,7 +732,7 @@ int dvb_fe_is_satellite(uint32_t delivery_system); * "COUNTRY" property in dvb_fe_set_parm() overrides the setting. */ int dvb_fe_set_default_country(struct dvb_v5_fe_parms *parms, - const char *country); + const char *cc); #ifdef __cplusplus } diff --git a/lib/include/libdvbv5/dvb-file.h b/lib/include/libdvbv5/dvb-file.h index 1f1a6386..9c8c54d9 100644 --- a/lib/include/libdvbv5/dvb-file.h +++ b/lib/include/libdvbv5/dvb-file.h @@ -423,8 +423,8 @@ int dvb_retrieve_entry_prop(struct dvb_entry *entry, * @return Returns 0 if success, or, -1 if error. */ int dvb_store_channel(struct dvb_file **dvb_file, - struct dvb_v5_fe_parms *parms, - struct dvb_v5_descriptors *dvb_desc, + struct dvb_v5_fe_parms *__p, + struct dvb_v5_descriptors *dvb_scan_handler, int get_detected, int get_nit); /** diff --git a/lib/include/libdvbv5/dvb-scan.h b/lib/include/libdvbv5/dvb-scan.h index 2666d906..50846b98 100644 --- a/lib/include/libdvbv5/dvb-scan.h +++ b/lib/include/libdvbv5/dvb-scan.h @@ -222,7 +222,7 @@ int dvb_read_section(struct dvb_v5_fe_parms *parms, int dmx_fd, * This is a variant of dvb_read_section() that uses a struct dvb_table_filter * to specify the filter to use. */ -int dvb_read_sections(struct dvb_v5_fe_parms *parms, int dmx_fd, +int dvb_read_sections(struct dvb_v5_fe_parms *__p, int dmx_fd, struct dvb_table_filter *sect, unsigned timeout); @@ -265,7 +265,7 @@ void dvb_scan_free_handler_table(struct dvb_v5_descriptors *dvb_scan_handler); * On sucess, it returns a pointer to a struct dvb_v5_descriptors, that can * either be used to tune into a service or to be stored inside a file. */ -struct dvb_v5_descriptors *dvb_get_ts_tables(struct dvb_v5_fe_parms *parms, int dmx_fd, +struct dvb_v5_descriptors *dvb_get_ts_tables(struct dvb_v5_fe_parms *__p, int dmx_fd, uint32_t delivery_system, unsigned other_nit, unsigned timeout_multiply); @@ -337,7 +337,7 @@ typedef int (check_frontend_t)(void *args, struct dvb_v5_fe_parms *parms); * } * @endcode */ -struct dvb_v5_descriptors *dvb_scan_transponder(struct dvb_v5_fe_parms *parms, +struct dvb_v5_descriptors *dvb_scan_transponder(struct dvb_v5_fe_parms *__p, struct dvb_entry *entry, int dmx_fd, check_frontend_t *check_frontend, @@ -388,7 +388,7 @@ struct dvb_v5_descriptors *dvb_scan_transponder(struct dvb_v5_fe_parms *parms, * } * @endcode */ -void dvb_add_scaned_transponders(struct dvb_v5_fe_parms *parms, +void dvb_add_scaned_transponders(struct dvb_v5_fe_parms *__p, struct dvb_v5_descriptors *dvb_scan_handler, struct dvb_entry *first_entry, struct dvb_entry *entry); @@ -398,12 +398,12 @@ void dvb_add_scaned_transponders(struct dvb_v5_fe_parms *parms, * Some ancillary functions used internally inside the library, used to * identify duplicated transport streams and add new found transponder entries */ -int dvb_estimate_freq_shift(struct dvb_v5_fe_parms *parms); +int dvb_estimate_freq_shift(struct dvb_v5_fe_parms *__p); int dvb_new_freq_is_needed(struct dvb_entry *entry, struct dvb_entry *last_entry, uint32_t freq, enum dvb_sat_polarization pol, int shift); -struct dvb_entry *dvb_scan_add_entry(struct dvb_v5_fe_parms *parms, +struct dvb_entry *dvb_scan_add_entry(struct dvb_v5_fe_parms *__p, struct dvb_entry *first_entry, struct dvb_entry *entry, uint32_t freq, uint32_t shift, @@ -414,14 +414,14 @@ int dvb_new_entry_is_needed(struct dvb_entry *entry, uint32_t freq, int shift, enum dvb_sat_polarization pol, uint32_t stream_id); -struct dvb_entry *dvb_scan_add_entry_ex(struct dvb_v5_fe_parms *parms, +struct dvb_entry *dvb_scan_add_entry_ex(struct dvb_v5_fe_parms *__p, struct dvb_entry *first_entry, struct dvb_entry *entry, uint32_t freq, uint32_t shift, enum dvb_sat_polarization pol, uint32_t stream_id); -void dvb_update_transponders(struct dvb_v5_fe_parms *parms, +void dvb_update_transponders(struct dvb_v5_fe_parms *__p, struct dvb_v5_descriptors *dvb_scan_handler, struct dvb_entry *first_entry, struct dvb_entry *entry); diff --git a/lib/include/libdvbv5/eit.h b/lib/include/libdvbv5/eit.h index 9129861e..5510707b 100644 --- a/lib/include/libdvbv5/eit.h +++ b/lib/include/libdvbv5/eit.h @@ -197,7 +197,7 @@ ssize_t dvb_table_eit_init (struct dvb_v5_fe_parms *parms, const uint8_t *buf, * * @param table pointer to struct dvb_table_eit to be freed */ -void dvb_table_eit_free(struct dvb_table_eit *table); +void dvb_table_eit_free(struct dvb_table_eit *eit); /** * @brief Prints the content of the DVB EIT table @@ -207,7 +207,7 @@ void dvb_table_eit_free(struct dvb_table_eit *table); * @param table pointer to struct dvb_table_eit */ void dvb_table_eit_print(struct dvb_v5_fe_parms *parms, - struct dvb_table_eit *table); + struct dvb_table_eit *eit); /** * @brief Converts a DVB EIT formatted timestamp into struct tm diff --git a/lib/include/libdvbv5/header.h b/lib/include/libdvbv5/header.h index 2a459f9d..ccf67422 100644 --- a/lib/include/libdvbv5/header.h +++ b/lib/include/libdvbv5/header.h @@ -132,7 +132,7 @@ extern "C" { * * @param header pointer to struct dvb_table_header to be parsed */ -void dvb_table_header_init (struct dvb_table_header *header); +void dvb_table_header_init (struct dvb_table_header *t); /** * @brief Prints the content of the MPEG-TS table header * @ingroup dvb_table @@ -141,7 +141,7 @@ void dvb_table_header_init (struct dvb_table_header *header); * @param header pointer to struct dvb_table_header to be printed */ void dvb_table_header_print(struct dvb_v5_fe_parms *parms, - const struct dvb_table_header *header); + const struct dvb_table_header *t); #ifdef __cplusplus } diff --git a/lib/include/libdvbv5/mgt.h b/lib/include/libdvbv5/mgt.h index 7aa92d6c..62b5a7ab 100644 --- a/lib/include/libdvbv5/mgt.h +++ b/lib/include/libdvbv5/mgt.h @@ -168,7 +168,7 @@ ssize_t atsc_table_mgt_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf, * * @param table pointer to struct atsc_table_mgt to be freed */ -void atsc_table_mgt_free(struct atsc_table_mgt *table); +void atsc_table_mgt_free(struct atsc_table_mgt *mgt); /** * @brief Prints the content of the MGT table @@ -178,7 +178,7 @@ void atsc_table_mgt_free(struct atsc_table_mgt *table); * @param table pointer to struct atsc_table_mgt */ void atsc_table_mgt_print(struct dvb_v5_fe_parms *parms, - struct atsc_table_mgt *table); + struct atsc_table_mgt *mgt); #ifdef __cplusplus } diff --git a/lib/include/libdvbv5/mpeg_pes.h b/lib/include/libdvbv5/mpeg_pes.h index 9f214b26..b2b13584 100644 --- a/lib/include/libdvbv5/mpeg_pes.h +++ b/lib/include/libdvbv5/mpeg_pes.h @@ -228,7 +228,7 @@ ssize_t dvb_mpeg_pes_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf, ssi * If the pointer pes was allocated dynamically, this function * can be used to free the memory. */ -void dvb_mpeg_pes_free(struct dvb_mpeg_pes *pes); +void dvb_mpeg_pes_free(struct dvb_mpeg_pes *ts); /** * @brief Print details of struct dvb_mpeg_pes diff --git a/lib/include/libdvbv5/nit.h b/lib/include/libdvbv5/nit.h index f8e0e730..ef0f1bc1 100644 --- a/lib/include/libdvbv5/nit.h +++ b/lib/include/libdvbv5/nit.h @@ -221,7 +221,7 @@ ssize_t dvb_table_nit_init (struct dvb_v5_fe_parms *parms, const uint8_t *buf, * * @param table pointer to struct dvb_table_nit to be freed */ -void dvb_table_nit_free(struct dvb_table_nit *table); +void dvb_table_nit_free(struct dvb_table_nit *nit); /** * @brief Prints the content of the NIT table @@ -230,7 +230,7 @@ void dvb_table_nit_free(struct dvb_table_nit *table); * @param parms struct dvb_v5_fe_parms pointer to the opened device * @param table pointer to struct dvb_table_nit */ -void dvb_table_nit_print(struct dvb_v5_fe_parms *parms, struct dvb_table_nit *table); +void dvb_table_nit_print(struct dvb_v5_fe_parms *parms, struct dvb_table_nit *nit); /** * @brief For each entry at NIT and NIT transport tables, call a callback @@ -263,7 +263,7 @@ void dvb_table_nit_print(struct dvb_v5_fe_parms *parms, struct dvb_table_nit *ta */ void dvb_table_nit_descriptor_handler( struct dvb_v5_fe_parms *parms, - struct dvb_table_nit *table, + struct dvb_table_nit *nit, enum descriptors descriptor, nit_handler_callback_t *call_nit, nit_tran_handler_callback_t *call_tran, diff --git a/lib/include/libdvbv5/pat.h b/lib/include/libdvbv5/pat.h index bdf31ab5..9b1303a1 100644 --- a/lib/include/libdvbv5/pat.h +++ b/lib/include/libdvbv5/pat.h @@ -153,7 +153,7 @@ ssize_t dvb_table_pat_init (struct dvb_v5_fe_parms *parms, const uint8_t *buf, * * @param table pointer to struct dvb_table_pat to be freed */ -void dvb_table_pat_free(struct dvb_table_pat *table); +void dvb_table_pat_free(struct dvb_table_pat *pat); /** * @brief Prints the content of the PAT table @@ -163,7 +163,7 @@ void dvb_table_pat_free(struct dvb_table_pat *table); * @param table pointer to struct dvb_table_pat */ void dvb_table_pat_print(struct dvb_v5_fe_parms *parms, - struct dvb_table_pat *table); + struct dvb_table_pat *pat); #ifdef __cplusplus } diff --git a/lib/include/libdvbv5/pmt.h b/lib/include/libdvbv5/pmt.h index 5876c594..45ce88b0 100644 --- a/lib/include/libdvbv5/pmt.h +++ b/lib/include/libdvbv5/pmt.h @@ -281,7 +281,7 @@ ssize_t dvb_table_pmt_init (struct dvb_v5_fe_parms *parms, const uint8_t *buf, * * @param table pointer to struct dvb_table_pmt to be freed */ -void dvb_table_pmt_free(struct dvb_table_pmt *table); +void dvb_table_pmt_free(struct dvb_table_pmt *pmt); /** * @brief Prints the content of the PAT table @@ -291,7 +291,7 @@ void dvb_table_pmt_free(struct dvb_table_pmt *table); * @param table pointer to struct dvb_table_pmt */ void dvb_table_pmt_print(struct dvb_v5_fe_parms *parms, - const struct dvb_table_pmt *table); + const struct dvb_table_pmt *pmt); #ifdef __cplusplus } diff --git a/lib/include/libdvbv5/sdt.h b/lib/include/libdvbv5/sdt.h index 52fdf07f..1292f82d 100644 --- a/lib/include/libdvbv5/sdt.h +++ b/lib/include/libdvbv5/sdt.h @@ -169,7 +169,7 @@ ssize_t dvb_table_sdt_init (struct dvb_v5_fe_parms *parms, const uint8_t *buf, * * @param table pointer to struct dvb_table_sdt to be freed */ -void dvb_table_sdt_free(struct dvb_table_sdt *table); +void dvb_table_sdt_free(struct dvb_table_sdt *sdt); /** * @brief Prints the content of the SDT table @@ -178,7 +178,7 @@ void dvb_table_sdt_free(struct dvb_table_sdt *table); * @param parms struct dvb_v5_fe_parms pointer to the opened device * @param table pointer to struct dvb_table_sdt */ -void dvb_table_sdt_print(struct dvb_v5_fe_parms *parms, struct dvb_table_sdt *table); +void dvb_table_sdt_print(struct dvb_v5_fe_parms *parms, struct dvb_table_sdt *sdt); #ifdef __cplusplus } diff --git a/lib/include/libdvbv5/vct.h b/lib/include/libdvbv5/vct.h index 374c73a8..86c4728a 100644 --- a/lib/include/libdvbv5/vct.h +++ b/lib/include/libdvbv5/vct.h @@ -233,7 +233,7 @@ ssize_t atsc_table_vct_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf, * * @param table pointer to struct atsc_table_vct to be freed */ -void atsc_table_vct_free(struct atsc_table_vct *table); +void atsc_table_vct_free(struct atsc_table_vct *vct); /** * @brief Prints the content of the VCT table * @ingroup dvb_table @@ -242,7 +242,7 @@ void atsc_table_vct_free(struct atsc_table_vct *table); * @param table pointer to struct atsc_table_vct */ void atsc_table_vct_print(struct dvb_v5_fe_parms *parms, - struct atsc_table_vct *table); + struct atsc_table_vct *vct); #ifdef __cplusplus } diff --git a/lib/include/libv4l2.h b/lib/include/libv4l2.h index ea1870db..5c093067 100644 --- a/lib/include/libv4l2.h +++ b/lib/include/libv4l2.h @@ -64,7 +64,7 @@ LIBV4L_PUBLIC int v4l2_open(const char *file, int oflag, ...); LIBV4L_PUBLIC int v4l2_close(int fd); LIBV4L_PUBLIC int v4l2_dup(int fd); LIBV4L_PUBLIC int v4l2_ioctl(int fd, unsigned long int request, ...); -LIBV4L_PUBLIC ssize_t v4l2_read(int fd, void *buffer, size_t n); +LIBV4L_PUBLIC ssize_t v4l2_read(int fd, void *dest, size_t n); LIBV4L_PUBLIC ssize_t v4l2_write(int fd, const void *buffer, size_t n); LIBV4L_PUBLIC void *v4l2_mmap(void *start, size_t length, int prot, int flags, int fd, int64_t offset); diff --git a/lib/libdvbv5/parse_string.h b/lib/libdvbv5/parse_string.h index b0884bfb..86604bde 100644 --- a/lib/libdvbv5/parse_string.h +++ b/lib/libdvbv5/parse_string.h @@ -27,7 +27,7 @@ void dvb_iconv_to_charset(struct dvb_v5_fe_parms *parms, size_t destlen, const unsigned char *src, size_t len, - char *type, char *output_charset); + char *input_charset, char *output_charset); void dvb_parse_string(struct dvb_v5_fe_parms *parms, char **dest, char **emph, const unsigned char *src, size_t len); diff --git a/lib/libv4lconvert/libv4lconvert-priv.h b/lib/libv4lconvert/libv4lconvert-priv.h index ce5970c9..dd168424 100644 --- a/lib/libv4lconvert/libv4lconvert-priv.h +++ b/lib/libv4lconvert/libv4lconvert-priv.h @@ -117,43 +117,43 @@ int v4lconvert_oom_error(struct v4lconvert_data *data); void v4lconvert_rgb24_to_yuv420(const unsigned char *src, unsigned char *dest, const struct v4l2_format *src_fmt, int bgr, int yvu, int bpp); -void v4lconvert_yuv420_to_rgb24(const unsigned char *src, unsigned char *dst, +void v4lconvert_yuv420_to_rgb24(const unsigned char *src, unsigned char *dest, int width, int height, int yvu); -void v4lconvert_yuv420_to_bgr24(const unsigned char *src, unsigned char *dst, +void v4lconvert_yuv420_to_bgr24(const unsigned char *src, unsigned char *dest, int width, int height, int yvu); -void v4lconvert_yuyv_to_rgb24(const unsigned char *src, unsigned char *dst, +void v4lconvert_yuyv_to_rgb24(const unsigned char *src, unsigned char *dest, int width, int height, int stride); -void v4lconvert_yuyv_to_bgr24(const unsigned char *src, unsigned char *dst, +void v4lconvert_yuyv_to_bgr24(const unsigned char *src, unsigned char *dest, int width, int height, int stride); -void v4lconvert_yuyv_to_yuv420(const unsigned char *src, unsigned char *dst, +void v4lconvert_yuyv_to_yuv420(const unsigned char *src, unsigned char *dest, int width, int height, int stride, int yvu); void v4lconvert_nv16_to_yuyv(const unsigned char *src, unsigned char *dest, int width, int height); -void v4lconvert_yvyu_to_rgb24(const unsigned char *src, unsigned char *dst, +void v4lconvert_yvyu_to_rgb24(const unsigned char *src, unsigned char *dest, int width, int height, int stride); -void v4lconvert_yvyu_to_bgr24(const unsigned char *src, unsigned char *dst, +void v4lconvert_yvyu_to_bgr24(const unsigned char *src, unsigned char *dest, int width, int height, int stride); -void v4lconvert_uyvy_to_rgb24(const unsigned char *src, unsigned char *dst, +void v4lconvert_uyvy_to_rgb24(const unsigned char *src, unsigned char *dest, int width, int height, int stride); -void v4lconvert_uyvy_to_bgr24(const unsigned char *src, unsigned char *dst, +void v4lconvert_uyvy_to_bgr24(const unsigned char *src, unsigned char *dest, int width, int height, int stride); -void v4lconvert_uyvy_to_yuv420(const unsigned char *src, unsigned char *dst, +void v4lconvert_uyvy_to_yuv420(const unsigned char *src, unsigned char *dest, int width, int height, int stride, int yvu); void v4lconvert_swap_rgb(const unsigned char *src, unsigned char *dst, int width, int height); -void v4lconvert_swap_uv(const unsigned char *src, unsigned char *dst, +void v4lconvert_swap_uv(const unsigned char *src, unsigned char *dest, const struct v4l2_format *src_fmt); void v4lconvert_grey_to_rgb24(const unsigned char *src, unsigned char *dest, @@ -209,9 +209,9 @@ void v4lconvert_m420_to_yuv420(const unsigned char *src, int v4lconvert_cpia1_to_yuv420(struct v4lconvert_data *data, const unsigned char *src, int src_size, - unsigned char *dst, int width, int height, int yvu); + unsigned char *dest, int width, int height, int yvu); -void v4lconvert_sn9c20x_to_yuv420(const unsigned char *src, unsigned char *dst, +void v4lconvert_sn9c20x_to_yuv420(const unsigned char *raw, unsigned char *i420, int width, int height, int yvu); int v4lconvert_se401_to_rgb24(struct v4lconvert_data *data, @@ -226,13 +226,13 @@ int v4lconvert_decode_jpeg_libjpeg(struct v4lconvert_data *data, unsigned char *src, int src_size, unsigned char *dest, struct v4l2_format *fmt, unsigned int dest_pix_fmt); -int v4lconvert_decode_jpgl(const unsigned char *src, int src_size, - unsigned int dest_pix_fmt, unsigned char *dest, int width, int height); +int v4lconvert_decode_jpgl(const unsigned char *inp, int src_size, + unsigned int dest_pix_fmt, unsigned char *fb, int width, int height); -void v4lconvert_decode_spca561(const unsigned char *src, unsigned char *dst, +void v4lconvert_decode_spca561(const unsigned char *inbuf, unsigned char *outbuf, int width, int height); -void v4lconvert_decode_sn9c10x(const unsigned char *src, unsigned char *dst, +void v4lconvert_decode_sn9c10x(const unsigned char *inp, unsigned char *outp, int width, int height); int v4lconvert_decode_pac207(struct v4lconvert_data *data, @@ -240,7 +240,7 @@ int v4lconvert_decode_pac207(struct v4lconvert_data *data, int width, int height); int v4lconvert_decode_mr97310a(struct v4lconvert_data *data, - const unsigned char *src, int src_size, unsigned char *dst, + const unsigned char *inp, int src_size, unsigned char *outp, int width, int height); int v4lconvert_decode_jl2005bcd(struct v4lconvert_data *data, @@ -257,10 +257,10 @@ void v4lconvert_decode_stv0680(const unsigned char *src, unsigned char *dst, int width, int height); void v4lconvert_bayer_to_rgb24(const unsigned char *bayer, - unsigned char *rgb, int width, int height, const unsigned int stride, unsigned int pixfmt); + unsigned char *bgr, int width, int height, const unsigned int stride, unsigned int pixfmt); void v4lconvert_bayer_to_bgr24(const unsigned char *bayer, - unsigned char *rgb, int width, int height, const unsigned int stride, unsigned int pixfmt); + unsigned char *bgr, int width, int height, const unsigned int stride, unsigned int pixfmt); void v4lconvert_bayer_to_yuv420(const unsigned char *bayer, unsigned char *yuv, int width, int height, const unsigned int stride, unsigned int src_pixfmt, int yvu); @@ -275,13 +275,13 @@ void v4lconvert_bayer16_to_bayer8(unsigned char *bayer16, unsigned char *bayer8, int width, int height); void v4lconvert_hm12_to_rgb24(const unsigned char *src, - unsigned char *dst, int width, int height); + unsigned char *dest, int width, int height); void v4lconvert_hm12_to_bgr24(const unsigned char *src, - unsigned char *dst, int width, int height); + unsigned char *dest, int width, int height); void v4lconvert_hm12_to_yuv420(const unsigned char *src, - unsigned char *dst, int width, int height, int yvu); + unsigned char *dest, int width, int height, int yvu); void v4lconvert_hsv_to_rgb24(const unsigned char *src, unsigned char *dest, int width, int height, int bgr, int Xin, unsigned char hsv_enc); @@ -303,7 +303,7 @@ void v4lconvert_crop(unsigned char *src, unsigned char *dest, int v4lconvert_helper_decompress(struct v4lconvert_data *data, const char *helper, const unsigned char *src, int src_size, - unsigned char *dest, int dest_size, int width, int height, int command); + unsigned char *dest, int dest_size, int width, int height, int flags); void v4lconvert_helper_cleanup(struct v4lconvert_data *data); diff --git a/lib/libv4lconvert/processing/libv4lprocessing.h b/lib/libv4lconvert/processing/libv4lprocessing.h index d135a9d6..52184a7c 100644 --- a/lib/libv4lconvert/processing/libv4lprocessing.h +++ b/lib/libv4lconvert/processing/libv4lprocessing.h @@ -31,7 +31,7 @@ struct v4lprocessing_data; struct v4lcontrol_data; -struct v4lprocessing_data *v4lprocessing_create(int fd, struct v4lcontrol_data *data); +struct v4lprocessing_data *v4lprocessing_create(int fd, struct v4lcontrol_data *control); void v4lprocessing_destroy(struct v4lprocessing_data *data); /* Prepare to process 1 frame, returns 1 if processing is necesary, diff --git a/lib/libv4lconvert/tinyjpeg.h b/lib/libv4lconvert/tinyjpeg.h index ee61d234..857f833d 100644 --- a/lib/libv4lconvert/tinyjpeg.h +++ b/lib/libv4lconvert/tinyjpeg.h @@ -58,7 +58,7 @@ struct jdec_private *tinyjpeg_init(void); void tinyjpeg_free(struct jdec_private *priv); int tinyjpeg_parse_header(struct jdec_private *priv, const unsigned char *buf, unsigned int size); -int tinyjpeg_decode(struct jdec_private *priv, int pixel_format); +int tinyjpeg_decode(struct jdec_private *priv, int pixfmt); const char *tinyjpeg_get_errorstring(struct jdec_private *priv); void tinyjpeg_get_size(struct jdec_private *priv, unsigned int *width, unsigned int *height); int tinyjpeg_get_components(struct jdec_private *priv, unsigned char **components); diff --git a/utils/cec-compliance/cec-compliance.h b/utils/cec-compliance/cec-compliance.h index f50ea483..7342d75e 100644 --- a/utils/cec-compliance/cec-compliance.h +++ b/utils/cec-compliance/cec-compliance.h @@ -285,8 +285,7 @@ struct remote_subtest { if (test) { \ if (version >= CEC_OP_CEC_VERSION_2_0) \ return fail("%s\n", #test); \ - else \ - warn("fails in CEC 2.0: %s\n", #test); \ + warn("fails in CEC 2.0: %s\n", #test); \ } \ } while(0) diff --git a/utils/common/v4l-stream.h b/utils/common/v4l-stream.h index fe5dfe90..e6b6c27d 100644 --- a/utils/common/v4l-stream.h +++ b/utils/common/v4l-stream.h @@ -144,8 +144,8 @@ struct codec_ctx { u32 comp_max_size; }; -unsigned rle_compress(__u8 *buf, unsigned size, unsigned bytesperline); -void rle_decompress(__u8 *buf, unsigned size, unsigned rle_size, unsigned bytesperline); +unsigned rle_compress(__u8 *buf, unsigned size, unsigned bpl); +void rle_decompress(__u8 *buf, unsigned size, unsigned rle_size, unsigned bpl); struct codec_ctx *fwht_alloc(unsigned pixfmt, unsigned visible_width, unsigned visible_height, unsigned coded_width, unsigned coded_height, unsigned field, unsigned colorspace, unsigned xfer_func, unsigned ycbcr_enc, diff --git a/utils/keytable/bpf.h b/utils/keytable/bpf.h index fb3896c9..f09232cf 100644 --- a/utils/keytable/bpf.h +++ b/utils/keytable/bpf.h @@ -89,10 +89,10 @@ int bpf_map_delete_elem(int fd, const void *key); int bpf_map_get_next_key(int fd, const void *key, void *next_key); int bpf_obj_pin(int fd, const char *pathname); int bpf_obj_get(const char *pathname); -int bpf_prog_attach(int prog_fd, int attachable_fd, enum bpf_attach_type type, +int bpf_prog_attach(int prog_fd, int target_fd, enum bpf_attach_type type, unsigned int flags); -int bpf_prog_detach(int attachable_fd, enum bpf_attach_type type); -int bpf_prog_detach2(int prog_fd, int attachable_fd, enum bpf_attach_type type); +int bpf_prog_detach(int target_fd, enum bpf_attach_type type); +int bpf_prog_detach2(int prog_fd, int target_fd, enum bpf_attach_type type); int bpf_prog_test_run(int prog_fd, int repeat, void *data, __u32 size, void *data_out, __u32 *size_out, __u32 *retval, __u32 *duration); diff --git a/utils/libcecutil/cec-log.cpp b/utils/libcecutil/cec-log.cpp index 0ce1e023..f83839b5 100644 --- a/utils/libcecutil/cec-log.cpp +++ b/utils/libcecutil/cec-log.cpp @@ -101,12 +101,12 @@ static const struct cec_arg arg_rec_src_type = { }; static void log_digital(const char *arg_name, const struct cec_op_digital_service_id *digital); -static void log_rec_src(const char *arg_name, const struct cec_op_record_src *rec_src); -static void log_tuner_dev_info(const char *arg_name, const struct cec_op_tuner_device_info *tuner_dev_info); -static void log_features(const struct cec_arg *arg, const char *arg_name, const __u8 *p); -static void log_ui_command(const char *arg_name, const struct cec_op_ui_command *ui_cmd); -static void log_descriptors(const char *arg_name, unsigned num, const __u32 *descriptors); -static void log_u8_array(const char *arg_name, unsigned num, const __u8 *vals); +static void log_rec_src(const char *arg_string, const struct cec_op_record_src *rec_src); +static void log_tuner_dev_info(const char *arg_string, const struct cec_op_tuner_device_info *tuner_dev_info); +static void log_features(const struct cec_arg *arg, const char *arg_string, const __u8 *p); +static void log_ui_command(const char *arg_string, const struct cec_op_ui_command *ui_cmd); +static void log_descriptors(const char *arg_string, unsigned num, const __u32 *descriptors); +static void log_u8_array(const char *arg_string, unsigned num, const __u8 *vals); static void log_unknown_msg(const struct cec_msg *msg); static void log_htng_unknown_msg(const struct cec_msg *msg); From patchwork Mon Apr 20 18:46:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 11499675 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4E89D913 for ; Mon, 20 Apr 2020 18:47:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1BA892078C for ; Mon, 20 Apr 2020 18:47:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="X3KevWd5" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728159AbgDTSrC (ORCPT ); Mon, 20 Apr 2020 14:47:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728119AbgDTSqz (ORCPT ); Mon, 20 Apr 2020 14:46:55 -0400 Received: from mail-pg1-x52a.google.com (mail-pg1-x52a.google.com [IPv6:2607:f8b0:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A165C061A0F for ; Mon, 20 Apr 2020 11:46:55 -0700 (PDT) Received: by mail-pg1-x52a.google.com with SMTP id o10so2276695pgb.6 for ; Mon, 20 Apr 2020 11:46:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=4SWfbj2hB9nx5sjtD4Q6O5QT64jYtShIQdeZ2+yrV6c=; b=X3KevWd5PAIuMxz18kE4JDIjep2NwfBEZ1xm55WkdK5BzO0ypEs7f+RMxrSAOj/436 /OjmU9i5lsw3014vDndcKiHiUbamxtBYMNfOFycJIXFVQ+qt0e9nUO5lnaYhtIaHgfQj rILuT6qxnGxR/2nphY6kdP8dSQBQJNqpFtCE4lBa2Ar2aQez/BTQgHwx/ZFYg5er8vIH xbm2iyH0umLz48A4JjDZqWtrb4fBs+xA4rpY25LSXwfrMMgL9uyGav+4SX3CvkGWEDbn pEkpkwaaByUVYZnN+7f6B08p/riRB9Qv5TedcGy4q/tj85Wx5pksbQkQ6pli4z5omxPJ fPgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4SWfbj2hB9nx5sjtD4Q6O5QT64jYtShIQdeZ2+yrV6c=; b=rpCYthfcXlu+2vF3B26+TIYNL5BO5fFblfMflJxd5+x/M/djYDZgV5xhTfnCCH0Jhs Nsf3ly9Z9tG9TQHqqwisKst39bbG4OBWcLV4SJBd9EhTvk9L1AAIfF4+aSizwk6w5cc3 3x/0wNS80MeGi5KtHf/x/7MbsQuHRHMe/Q1NaIbJXcMV16sAVToo6y81Tbjfj2gn97fu qDwsVSiCmOaVrIukLhyeA8sJn6qxtUhtZfTmz4n/oEC0Z4NsiTegcf3vqZgi21X8eEHS 5G3H/XrF++5srwYOco25toA9j2NqY7B9O3uCEjCSuuSFjKV9buNW+vZg96g9CSRRnx7S mBJw== X-Gm-Message-State: AGi0Puaphhpj5wkkU4dMg4C2Po3ck7JVZJzGeEiK9tAXOO5mlaUwV/3n pzsuKe1CiBt2Q/vaNTN06af5Zl0t X-Google-Smtp-Source: APiQypK7CP2wt9ZuqJW7TAmp9sQiLf6P7nLNawNZtzvU/7GMkz+HhDNq9FTx160gT3y5o/BBr/T31A== X-Received: by 2002:a62:e307:: with SMTP id g7mr17204540pfh.197.1587408412728; Mon, 20 Apr 2020 11:46:52 -0700 (PDT) Received: from localhost.localdomain (76-14-109-232.rk.wavecable.com. [76.14.109.232]) by smtp.gmail.com with ESMTPSA id n8sm182443pfq.213.2020.04.20.11.46.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Apr 2020 11:46:52 -0700 (PDT) From: Rosen Penev To: linux-media@vger.kernel.org Subject: [PATCH 2/7] treewide: replace C casts with C++ Date: Mon, 20 Apr 2020 11:46:44 -0700 Message-Id: <20200420184649.4202-2-rosenp@gmail.com> X-Mailer: git-send-email 2.25.2 In-Reply-To: <20200420184649.4202-1-rosenp@gmail.com> References: <20200420184649.4202-1-rosenp@gmail.com> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Also removed usedless casts. Found with clang-tidy's google-readability-casting Signed-off-by: Rosen Penev --- lib/libdvbv5/tables/mgt.c | 2 +- lib/libdvbv5/tables/nit.c | 4 +- lib/libdvbv5/tables/pmt.c | 2 +- lib/libdvbv5/tables/vct.c | 2 +- utils/cec-compliance/cec-compliance.cpp | 12 ++--- utils/cec-compliance/cec-test.cpp | 2 +- utils/cec-ctl/cec-ctl.cpp | 4 +- utils/cec-follower/cec-follower.cpp | 8 ++-- utils/cec-follower/cec-tuner.cpp | 2 +- utils/cx18-ctl/cx18-ctl.c | 10 ++--- utils/ivtv-ctl/ivtv-ctl.c | 2 +- utils/libcecutil/cec-log.cpp | 2 +- utils/libcecutil/cec-parse.cpp | 2 +- utils/rds-ctl/rds-ctl.cpp | 12 ++--- utils/v4l2-compliance/v4l2-compliance.cpp | 14 +++--- utils/v4l2-compliance/v4l2-test-buffers.cpp | 22 +++++----- utils/v4l2-compliance/v4l2-test-colors.cpp | 4 +- utils/v4l2-compliance/v4l2-test-controls.cpp | 12 ++--- utils/v4l2-compliance/v4l2-test-formats.cpp | 6 +-- .../v4l2-test-input-output.cpp | 4 +- utils/v4l2-compliance/v4l2-test-media.cpp | 4 +- utils/v4l2-ctl/v4l2-ctl-common.cpp | 20 ++++----- utils/v4l2-ctl/v4l2-ctl-edid.cpp | 6 +-- utils/v4l2-ctl/v4l2-ctl-io.cpp | 4 +- utils/v4l2-ctl/v4l2-ctl-meta.cpp | 8 ++-- utils/v4l2-ctl/v4l2-ctl-modes.cpp | 12 ++--- utils/v4l2-ctl/v4l2-ctl-overlay.cpp | 10 ++--- utils/v4l2-ctl/v4l2-ctl-stds.cpp | 16 +++---- utils/v4l2-ctl/v4l2-ctl-streaming.cpp | 44 +++++++++---------- utils/v4l2-ctl/v4l2-ctl-vidcap.cpp | 4 +- utils/v4l2-ctl/v4l2-ctl.cpp | 12 ++--- utils/v4l2-dbg/v4l2-dbg.cpp | 4 +- 32 files changed, 136 insertions(+), 136 deletions(-) diff --git a/lib/libdvbv5/tables/mgt.c b/lib/libdvbv5/tables/mgt.c index 784e70f4..828c9e7b 100644 --- a/lib/libdvbv5/tables/mgt.c +++ b/lib/libdvbv5/tables/mgt.c @@ -121,7 +121,7 @@ void atsc_table_mgt_free(struct atsc_table_mgt *mgt) { struct atsc_table_mgt_table *table = mgt->table; - dvb_desc_free((struct dvb_desc **) &mgt->descriptor); + dvb_desc_free(&mgt->descriptor); while (table) { struct atsc_table_mgt_table *tmp = table; diff --git a/lib/libdvbv5/tables/nit.c b/lib/libdvbv5/tables/nit.c index c343d4e9..ab29d319 100644 --- a/lib/libdvbv5/tables/nit.c +++ b/lib/libdvbv5/tables/nit.c @@ -133,9 +133,9 @@ ssize_t dvb_table_nit_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf, void dvb_table_nit_free(struct dvb_table_nit *nit) { struct dvb_table_nit_transport *transport = nit->transport; - dvb_desc_free((struct dvb_desc **) &nit->descriptor); + dvb_desc_free(&nit->descriptor); while (transport) { - dvb_desc_free((struct dvb_desc **) &transport->descriptor); + dvb_desc_free(&transport->descriptor); struct dvb_table_nit_transport *tmp = transport; transport = transport->next; free(tmp); diff --git a/lib/libdvbv5/tables/pmt.c b/lib/libdvbv5/tables/pmt.c index 5ba0bb2e..1234bdfd 100644 --- a/lib/libdvbv5/tables/pmt.c +++ b/lib/libdvbv5/tables/pmt.c @@ -147,7 +147,7 @@ void dvb_table_pmt_free(struct dvb_table_pmt *pmt) stream = stream->next; free(tmp); } - dvb_desc_free((struct dvb_desc **) &pmt->descriptor); + dvb_desc_free(&pmt->descriptor); free(pmt); } diff --git a/lib/libdvbv5/tables/vct.c b/lib/libdvbv5/tables/vct.c index 1ecd61f8..5d37ed58 100644 --- a/lib/libdvbv5/tables/vct.c +++ b/lib/libdvbv5/tables/vct.c @@ -160,7 +160,7 @@ void atsc_table_vct_free(struct atsc_table_vct *vct) channel = channel->next; free(tmp); } - dvb_desc_free((struct dvb_desc **) &vct->descriptor); + dvb_desc_free(&vct->descriptor); free(vct); } diff --git a/utils/cec-compliance/cec-compliance.cpp b/utils/cec-compliance/cec-compliance.cpp index 003b49a2..b665303e 100644 --- a/utils/cec-compliance/cec-compliance.cpp +++ b/utils/cec-compliance/cec-compliance.cpp @@ -378,7 +378,7 @@ std::string short_audio_desc2s(const struct short_audio_desc &sad) oss << audio_format_code2s(sad.format_code); else oss << extension_type_code2s(sad.extension_type_code); - oss << ", " << (int)sad.num_channels << " channels"; + oss << ", " << static_cast(sad.num_channels) << " channels"; oss << ", sampling rates (kHz): "; if (sad.sample_freq_mask & SAD_SAMPLE_FREQ_MASK_32) @@ -631,7 +631,7 @@ std::string opcode2s(const struct cec_msg *msg) if (name) return name; - oss << "CDC: 0x" << std::hex << (unsigned)cdc_opcode; + oss << "CDC: 0x" << std::hex << static_cast(cdc_opcode); return oss.str(); } @@ -639,7 +639,7 @@ std::string opcode2s(const struct cec_msg *msg) if (name) return name; - oss << "0x" << std::hex << (unsigned)opcode; + oss << "0x" << std::hex << static_cast(opcode); return oss.str(); } @@ -648,7 +648,7 @@ int cec_named_ioctl(struct node *node, const char *name, { int retval; int e; - struct cec_msg *msg = (struct cec_msg *)parm; + struct cec_msg *msg = static_cast(parm); __u8 opcode = 0; std::string opname; @@ -802,7 +802,7 @@ const char *ok(int res) int check_0(const void *p, int len) { - const __u8 *q = (const __u8 *)p; + const __u8 *q = static_cast(p); while (len--) if (*q++) @@ -1175,7 +1175,7 @@ int main(int argc, char **argv) if (ch == -1) break; - options[(int)ch] = 1; + options[ch] = 1; if (!option_index) { for (i = 0; long_options[i].val; i++) { if (long_options[i].val == ch) { diff --git a/utils/cec-compliance/cec-test.cpp b/utils/cec-compliance/cec-test.cpp index 0ac43afe..9a08f54b 100644 --- a/utils/cec-compliance/cec-test.cpp +++ b/utils/cec-compliance/cec-test.cpp @@ -613,7 +613,7 @@ static int dev_menu_ctl_request(struct node *node, unsigned me, unsigned la, boo } static struct remote_subtest dev_menu_ctl_subtests[] = { - { "Menu Request", (__u16)~CEC_LOG_ADDR_MASK_TV, dev_menu_ctl_request }, + { "Menu Request", static_cast<__u16>(~CEC_LOG_ADDR_MASK_TV), dev_menu_ctl_request }, { "User Control Pressed", CEC_LOG_ADDR_MASK_ALL, rc_passthrough_user_ctrl_pressed }, { "User Control Released", CEC_LOG_ADDR_MASK_ALL, rc_passthrough_user_ctrl_released }, }; diff --git a/utils/cec-ctl/cec-ctl.cpp b/utils/cec-ctl/cec-ctl.cpp index ae668806..3495883e 100644 --- a/utils/cec-ctl/cec-ctl.cpp +++ b/utils/cec-ctl/cec-ctl.cpp @@ -386,7 +386,7 @@ std::string ts2s(double ts) sprintf(buf, "%10.06f", ts); return buf; } - return ts2s((__u64)(ts * 1000000000.0)); + return ts2s(static_cast<__u64>(ts * 1000000000.0)); } static __u64 current_ts() @@ -1875,7 +1875,7 @@ int main(int argc, char **argv) cec_msg_init(&msg, 0, 0); msg.msg[0] = options[OptTo] ? to : 0xf0; - options[(int)ch] = 1; + options[ch] = 1; switch (ch) { case OptHelp: diff --git a/utils/cec-follower/cec-follower.cpp b/utils/cec-follower/cec-follower.cpp index 6ccd2ae2..12bb5f15 100644 --- a/utils/cec-follower/cec-follower.cpp +++ b/utils/cec-follower/cec-follower.cpp @@ -244,7 +244,7 @@ std::string opcode2s(const struct cec_msg *msg) if (name) return name; - oss << "CDC: 0x" << std::hex << (unsigned)cdc_opcode; + oss << "CDC: 0x" << std::hex << static_cast(cdc_opcode); return oss.str(); } @@ -252,7 +252,7 @@ std::string opcode2s(const struct cec_msg *msg) if (name) return name; - oss << "0x" << std::hex << (unsigned)opcode; + oss << "0x" << std::hex << static_cast(opcode); return oss.str(); } @@ -270,7 +270,7 @@ int cec_named_ioctl(int fd, const char *name, name, retval, strerror(e)); if (!retval) { - const struct cec_msg *msg = (const struct cec_msg *)parm; + const struct cec_msg *msg = static_cast(parm); /* Update the timestamp whenever we successfully transmit to an LA, or whenever we receive something from the LA */ @@ -340,7 +340,7 @@ int main(int argc, char **argv) if (ch == -1) break; - options[(int)ch] = 1; + options[ch] = 1; if (!option_index) { for (i = 0; long_options[i].val; i++) { if (long_options[i].val == ch) { diff --git a/utils/cec-follower/cec-tuner.cpp b/utils/cec-follower/cec-tuner.cpp index bf33c440..aa19f55d 100644 --- a/utils/cec-follower/cec-tuner.cpp +++ b/utils/cec-follower/cec-tuner.cpp @@ -402,7 +402,7 @@ static bool digital_update_tuner_dev_info(struct node *node, int idx, default: break; } - if (node->state.service_idx != (unsigned)idx && node->state.tuner_report_changes) { + if (node->state.service_idx != static_cast(idx) && node->state.tuner_report_changes) { cec_msg_set_reply_to(msg, msg); cec_msg_tuner_device_status(msg, &node->state.tuner_dev_info); transmit(node, msg); diff --git a/utils/cx18-ctl/cx18-ctl.c b/utils/cx18-ctl/cx18-ctl.c index ba95fffe..3ce7c018 100644 --- a/utils/cx18-ctl/cx18-ctl.c +++ b/utils/cx18-ctl/cx18-ctl.c @@ -255,7 +255,7 @@ int main(int argc, char **argv) if (ch == -1) break; - options[(int)ch] = 1; + options[ch] = 1; switch (ch) { case OptHelp: usage(); @@ -344,22 +344,22 @@ int main(int argc, char **argv) reg.match.type = V4L2_CHIP_MATCH_HOST; reg.match.addr = 0; reg.reg = CX18_REG_GPIO_DIR1; - reg.val = (unsigned)((gpio_dir & 0xffff) << 16); + reg.val = ((gpio_dir & 0xffff) << 16); if (gpio_set_dir && doioctl(fd, VIDIOC_DBG_S_REGISTER, ®, "VIDIOC_DBG_S_REGISTER") == 0) printf("GPIO dir 1 set to 0x%08llx\n", reg.val); reg.reg = CX18_REG_GPIO_DIR2; - reg.val = (unsigned)(gpio_dir & 0xffff0000); + reg.val = (gpio_dir & 0xffff0000); if (gpio_set_dir && doioctl(fd, VIDIOC_DBG_S_REGISTER, ®, "VIDIOC_DBG_S_REGISTER") == 0) printf("GPIO dir 2 set to 0x%08llx\n", reg.val); reg.reg = CX18_REG_GPIO_OUT1; - reg.val = (unsigned)((gpio_dir & 0xffff) << 16) | (gpio_out & 0xffff); + reg.val = ((gpio_dir & 0xffff) << 16) | (gpio_out & 0xffff); if (doioctl(fd, VIDIOC_DBG_S_REGISTER, ®, "VIDIOC_DBG_S_REGISTER") == 0) printf("GPIO out 1 set to 0x%08llx\n", reg.val); reg.reg = CX18_REG_GPIO_OUT2; - reg.val = (unsigned)(gpio_dir & 0xffff0000) | (gpio_out >> 16); + reg.val = (gpio_dir & 0xffff0000) | (gpio_out >> 16); if (doioctl(fd, VIDIOC_DBG_S_REGISTER, ®, "VIDIOC_DBG_S_REGISTER") == 0) printf("GPIO out 2 set to 0x%08llx\n", reg.val); diff --git a/utils/ivtv-ctl/ivtv-ctl.c b/utils/ivtv-ctl/ivtv-ctl.c index adf8d11e..9923827e 100644 --- a/utils/ivtv-ctl/ivtv-ctl.c +++ b/utils/ivtv-ctl/ivtv-ctl.c @@ -310,7 +310,7 @@ int main(int argc, char **argv) if (ch == -1) break; - options[(int)ch] = 1; + options[ch] = 1; switch (ch) { case OptSetYuvMode: { diff --git a/utils/libcecutil/cec-log.cpp b/utils/libcecutil/cec-log.cpp index f83839b5..d4d5c290 100644 --- a/utils/libcecutil/cec-log.cpp +++ b/utils/libcecutil/cec-log.cpp @@ -187,7 +187,7 @@ static void log_features(const struct cec_arg *arg, const char *arg_name, const __u8 *p) { do { - log_arg(arg, arg_name, (__u32)((*p) & ~CEC_OP_FEAT_EXT)); + log_arg(arg, arg_name, static_cast<__u32>((*p) & ~CEC_OP_FEAT_EXT)); } while ((*p++) & CEC_OP_FEAT_EXT); } diff --git a/utils/libcecutil/cec-parse.cpp b/utils/libcecutil/cec-parse.cpp index bb73fe57..5fffcce7 100644 --- a/utils/libcecutil/cec-parse.cpp +++ b/utils/libcecutil/cec-parse.cpp @@ -162,7 +162,7 @@ static __u8 *args2short_aud_fmt_codes(__u8 audio_format_code1, int cec_parse_subopt(char **subs, const char * const *subopts, char **value) { - int opt = getsubopt(subs, (char * const *)subopts, value); + int opt = getsubopt(subs, const_cast(subopts), value); if (opt == -1) { fprintf(stderr, "Invalid suboptions specified\n"); diff --git a/utils/rds-ctl/rds-ctl.cpp b/utils/rds-ctl/rds-ctl.cpp index 770497d4..2d561481 100644 --- a/utils/rds-ctl/rds-ctl.cpp +++ b/utils/rds-ctl/rds-ctl.cpp @@ -314,9 +314,9 @@ static void print_devices(dev_vec files) continue; doioctl(fd, VIDIOC_QUERYCAP, &vcap); close(fd); - bus_info = (const char *)vcap.bus_info; + bus_info = reinterpret_cast(vcap.bus_info); if (cards[bus_info].empty()) - cards[bus_info] += std::string((char *)vcap.card) + cards[bus_info] += std::string(reinterpret_cast(vcap.card)) + " (" + bus_info + "):\n"; cards[bus_info] += "\t" + (*iter); cards[bus_info] += "\n"; @@ -375,7 +375,7 @@ static dev_vec list_devices(void) static int parse_subopt(char **subs, const char * const *subopts, char **value) { - int opt = getsubopt(subs, (char * const *)subopts, value); + int opt = getsubopt(subs, const_cast(subopts), value); if (opt == -1) { fprintf(stderr, "Invalid suboptions specified\n"); @@ -525,7 +525,7 @@ static void print_rds_statistics(const struct v4l2_rds_statistics *statistics) if (statistics->block_cnt) block_error_percentage = - ((float)statistics->block_error_cnt / statistics->block_cnt) * 100.0; + (static_cast(statistics->block_error_cnt) / statistics->block_cnt) * 100.0; printf("block errors / group errors: %u (%3.2f%%) / %u \n", statistics->block_error_cnt, block_error_percentage, statistics->group_error_cnt); @@ -534,7 +534,7 @@ static void print_rds_statistics(const struct v4l2_rds_statistics *statistics) if (statistics->block_cnt) block_corrected_percentage = ( - (float)statistics->block_corrected_cnt / statistics->block_cnt) * 100.0; + static_cast(statistics->block_corrected_cnt) / statistics->block_cnt) * 100.0; printf("corrected blocks: %u (%3.2f%%)\n", statistics->block_corrected_cnt, block_corrected_percentage); for (int i = 0; i < 16; i++) @@ -766,7 +766,7 @@ static int parse_cl(int argc, char **argv) if (opt == -1) break; - params.options[(int)opt] = 1; + params.options[opt] = 1; switch (opt) { case OptSetDevice: strncpy(params.fd_name, optarg, sizeof(params.fd_name) - 1); diff --git a/utils/v4l2-compliance/v4l2-compliance.cpp b/utils/v4l2-compliance/v4l2-compliance.cpp index 3983a8a8..938c7c35 100644 --- a/utils/v4l2-compliance/v4l2-compliance.cpp +++ b/utils/v4l2-compliance/v4l2-compliance.cpp @@ -285,12 +285,12 @@ int check_string(const char *s, size_t len) int check_ustring(const __u8 *s, int len) { - return check_string((const char *)s, len); + return check_string(reinterpret_cast(s), len); } int check_0(const void *p, int len) { - const __u8 *q = (const __u8 *)p; + const __u8 *q = static_cast(p); while (len--) if (*q++) @@ -630,7 +630,7 @@ static int testCap(struct node *node) memcmp(vcap.bus_info, "rmi4:", 5)) return fail("missing bus_info prefix ('%s')\n", vcap.bus_info); if (!node->media_bus_info.empty() && - node->media_bus_info != std::string((const char *)vcap.bus_info)) + node->media_bus_info != std::string(reinterpret_cast(vcap.bus_info))) warn("media bus_info '%s' differs from V4L2 bus_info '%s'\n", node->media_bus_info.c_str(), vcap.bus_info); fail_on_test((vcap.version >> 16) < 3); @@ -808,7 +808,7 @@ static void streamingSetup(struct node *node) static int parse_subopt(char **subs, const char * const *subopts, char **value) { - int opt = getsubopt(subs, (char * const *)subopts, value); + int opt = getsubopt(subs, const_cast(subopts), value); if (opt == -1) { fprintf(stderr, "Invalid suboptions specified\n"); @@ -947,10 +947,10 @@ void testNode(struct node &node, struct node &node_m2m_cap, struct node &expbuf_ if (node.is_v4l2()) { doioctl(&node, VIDIOC_QUERYCAP, &vcap); - driver = (const char *)vcap.driver; + driver = reinterpret_cast(vcap.driver); is_vivid = driver == "vivid"; if (is_vivid) - node.bus_info = (const char *)vcap.bus_info; + node.bus_info = reinterpret_cast(vcap.bus_info); determine_codec_mask(node); } else { memset(&vcap, 0, sizeof(vcap)); @@ -1528,7 +1528,7 @@ int main(int argc, char **argv) if (ch == -1) break; - options[(int)ch] = 1; + options[ch] = 1; if (!option_index) { for (i = 0; long_options[i].val; i++) { if (long_options[i].val == ch) { diff --git a/utils/v4l2-compliance/v4l2-test-buffers.cpp b/utils/v4l2-compliance/v4l2-test-buffers.cpp index a103e463..3b45711d 100644 --- a/utils/v4l2-compliance/v4l2-test-buffers.cpp +++ b/utils/v4l2-compliance/v4l2-test-buffers.cpp @@ -161,7 +161,7 @@ static bool fill_output_buffer(const cv4l_queue &q, cv4l_buffer &buf, bool first if (!stream_use_hdr) { ssize_t sz = read(stream_from_fd, q.g_dataptr(buf.g_index(), p), len); - if (sz < (ssize_t)len) { + if (sz < static_cast(len)) { seek = true; break; } @@ -183,7 +183,7 @@ static bool fill_output_buffer(const cv4l_queue &q, cv4l_buffer &buf, bool first ssize_t sz = read(stream_from_fd, q.g_dataptr(buf.g_index(), p), bytesused); - if (sz < (ssize_t)bytesused) { + if (sz < static_cast(bytesused)) { seek = true; break; } @@ -432,26 +432,26 @@ int buffer::check(unsigned type, unsigned memory, unsigned index, fail_on_test(g_field() == seq.last_field); seq.field_nr ^= 1; if (seq.field_nr) { - if ((int)g_sequence() != seq.last_seq) + if (static_cast(g_sequence()) != seq.last_seq) warn("got sequence number %u, expected %u\n", g_sequence(), seq.last_seq); } else { fail_on_test((int)g_sequence() == seq.last_seq + 1); - if ((int)g_sequence() != seq.last_seq + 1) + if (static_cast(g_sequence()) != seq.last_seq + 1) warn("got sequence number %u, expected %u\n", g_sequence(), seq.last_seq + 1); } } else { fail_on_test(g_field() != fmt.g_field()); - if ((int)g_sequence() != seq.last_seq + 1) + if (static_cast(g_sequence()) != seq.last_seq + 1) warn("got sequence number %u, expected %u\n", g_sequence(), seq.last_seq + 1); } - } else if ((int)g_sequence() != seq.last_seq + 1) { + } else if (static_cast(g_sequence()) != seq.last_seq + 1) { warn("got sequence number %u, expected %u\n", g_sequence(), seq.last_seq + 1); } - seq.last_seq = (int)g_sequence(); + seq.last_seq = static_cast(g_sequence()); seq.last_field = g_field(); } else { fail_on_test(g_sequence()); @@ -985,7 +985,7 @@ static int captureBufs(struct node *node, struct node *node_m2m_cap, const cv4l_ buf.g_index(), buf.g_sequence(), field2s(buf.g_field()).c_str(), buf.g_bytesused(), bufferflags2s(buf.g_flags()).c_str(), - (__u64)buf.g_timestamp().tv_sec, (__u64)buf.g_timestamp().tv_usec); + static_cast<__u64>(buf.g_timestamp().tv_sec), static_cast<__u64>(buf.g_timestamp().tv_usec)); for (unsigned p = 0; p < buf.g_num_planes(); p++) { if (max_bytesused[p] < buf.g_bytesused(p)) max_bytesused[p] = buf.g_bytesused(p); @@ -1072,7 +1072,7 @@ static int captureBufs(struct node *node, struct node *node_m2m_cap, const cv4l_ buf.g_index(), buf.g_sequence(), field2s(buf.g_field()).c_str(), buf.g_bytesused(), bufferflags2s(buf.g_flags()).c_str(), - (__u64)buf.g_timestamp().tv_sec, (__u64)buf.g_timestamp().tv_usec); + static_cast<__u64>(buf.g_timestamp().tv_sec), static_cast<__u64>(buf.g_timestamp().tv_usec)); fail_on_test(ret); if (v4l_type_is_capture(buf.g_type()) && buf.g_bytesused()) fail_on_test(buf.check(m2m_q, last_m2m_seq, true)); @@ -1607,7 +1607,7 @@ int testUserPtr(struct node *node, struct node *node_m2m_cap, unsigned frame_cou for (unsigned p = 0; p < q.g_num_planes(); p++) { /* ensure that len is a multiple of 4 */ __u32 len = ((q.g_length(p) + 3) & ~0x3) + 4 * 4096; - __u32 *m = (__u32 *)malloc(len); + __u32 *m = static_cast<__u32 *>(malloc(len)); fail_on_test(!m); fail_on_test((uintptr_t)m & 0x7); @@ -1666,7 +1666,7 @@ int testUserPtr(struct node *node, struct node *node_m2m_cap, unsigned frame_cou __u32 buflen = (q.g_length(p) + 3U) & ~3U; __u32 memlen = buflen + 4 * 4096; __u32 *m = buffers[i][p]; - __u32 *u = (__u32 *)q.g_userptr(i, p); + __u32 *u = static_cast<__u32 *>(q.g_userptr(i, p)); for (__u32 *x = m; x < u; x++) if (*x != filler) diff --git a/utils/v4l2-compliance/v4l2-test-colors.cpp b/utils/v4l2-compliance/v4l2-test-colors.cpp index de4dd184..887b198b 100644 --- a/utils/v4l2-compliance/v4l2-test-colors.cpp +++ b/utils/v4l2-compliance/v4l2-test-colors.cpp @@ -505,7 +505,7 @@ static int testColorsFmt(struct node *node, unsigned component, } fail_on_test(skip); for (unsigned i = 0; i < fmt.g_num_planes(); i++) - planes[i] = (__u8 *)q.g_dataptr(buf.g_index(), i); + planes[i] = static_cast<__u8 *>(q.g_dataptr(buf.g_index(), i)); } else { fail_on_test(!(node->g_caps() & V4L2_CAP_READWRITE)); @@ -519,7 +519,7 @@ static int testColorsFmt(struct node *node, unsigned component, ret = node->read(tmp, size); fail_on_test(ret != size); } - planes[0] = (__u8 *)tmp; + planes[0] = static_cast<__u8 *>(tmp); } setupPlanes(fmt, planes); diff --git a/utils/v4l2-compliance/v4l2-test-controls.cpp b/utils/v4l2-compliance/v4l2-test-controls.cpp index 2a3f64e8..8c4480be 100644 --- a/utils/v4l2-compliance/v4l2-test-controls.cpp +++ b/utils/v4l2-compliance/v4l2-test-controls.cpp @@ -82,7 +82,7 @@ static int checkQCtrl(struct node *node, struct test_query_ext_ctrl &qctrl) return fail("step == 0\n"); if (qctrl.step < 0) return fail("step < 0\n"); - if ((unsigned)qctrl.step > (unsigned)(qctrl.maximum - qctrl.minimum) && + if (static_cast(qctrl.step) > static_cast(qctrl.maximum - qctrl.minimum) && qctrl.maximum != qctrl.minimum) return fail("step > max - min\n"); if ((qctrl.maximum - qctrl.minimum) % qctrl.step) { @@ -162,7 +162,7 @@ static int checkQCtrl(struct node *node, struct test_query_ext_ctrl &qctrl) continue; if (i < qctrl.minimum || i > qctrl.maximum) return fail("can get menu for out-of-range index\n"); - if (qmenu.index != (__u32)i || qmenu.id != qctrl.id) + if (qmenu.index != static_cast<__u32>(i) || qmenu.id != qctrl.id) return fail("id or index changed\n"); if (qctrl.type == V4L2_CTRL_TYPE_MENU && check_ustring(qmenu.name, sizeof(qmenu.name))) @@ -369,7 +369,7 @@ static int checkSimpleCtrl(struct v4l2_control &ctrl, struct test_query_ext_ctrl } break; case V4L2_CTRL_TYPE_BITMASK: - if ((__u32)ctrl.value & ~qctrl.maximum) + if (static_cast<__u32>(ctrl.value) & ~qctrl.maximum) return fail("returned control value out of range\n"); break; case V4L2_CTRL_TYPE_BUTTON: @@ -556,7 +556,7 @@ static int checkExtendedCtrl(struct v4l2_ext_control &ctrl, struct test_query_ex } break; case V4L2_CTRL_TYPE_BITMASK: - if ((__u32)ctrl.value & ~qctrl.maximum) + if (static_cast<__u32>(ctrl.value) & ~qctrl.maximum) return fail("returned control value out of range\n"); break; case V4L2_CTRL_TYPE_BUTTON: @@ -932,9 +932,9 @@ int testJpegComp(struct node *node) if (ret) return fail("VIDIOC_G_JPEGCOMP gave an error\n"); have_jpegcomp = true; - if (jc.COM_len < 0 || jc.COM_len > (int)sizeof(jc.COM_data)) + if (jc.COM_len < 0 || jc.COM_len > static_cast(sizeof(jc.COM_data))) return fail("invalid COM_len value\n"); - if (jc.APP_len < 0 || jc.APP_len > (int)sizeof(jc.APP_data)) + if (jc.APP_len < 0 || jc.APP_len > static_cast(sizeof(jc.APP_data))) return fail("invalid APP_len value\n"); if (jc.quality < 0 || jc.quality > 100) warn("weird quality value: %d\n", jc.quality); diff --git a/utils/v4l2-compliance/v4l2-test-formats.cpp b/utils/v4l2-compliance/v4l2-test-formats.cpp index 9bc109db..3fc87316 100644 --- a/utils/v4l2-compliance/v4l2-test-formats.cpp +++ b/utils/v4l2-compliance/v4l2-test-formats.cpp @@ -174,7 +174,7 @@ static int testEnumFrameSizes(struct node *node, __u32 pixfmt) return ret; if (ret == 0 && !(node->g_caps() & (V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VIDEO_CAPTURE_MPLANE))) return fail("found discrete framesizes when no video capture is supported\n"); - cookie = ((__u64)pixfmt << 32) | + cookie = (static_cast<__u64>(pixfmt) << 32) | (frmsize.discrete.width << 16) | frmsize.discrete.height; node->frmsizes.insert(cookie); @@ -1727,7 +1727,7 @@ static int testBasicScaling(struct node *node, const struct v4l2_format &cur) compose_is_crop = compose_w == crop_w && compose_h == crop_h; - cookie = ((__u64)v4l_format_g_pixelformat(&fmt) << 32) | + cookie = (static_cast<__u64>(v4l_format_g_pixelformat(&fmt)) << 32) | (v4l_format_g_width(&fmt) << 16) | v4l_format_g_height(&fmt); if (node->can_output) { @@ -1767,7 +1767,7 @@ static int testBasicScaling(struct node *node, const struct v4l2_format &cur) if (compose_is_crop) compose_is_crop = sel_compose.r.width == sel_crop.r.width && sel_compose.r.height == sel_crop.r.height; - cookie = ((__u64)v4l_format_g_pixelformat(&fmt) << 32) | + cookie = (static_cast<__u64>(v4l_format_g_pixelformat(&fmt)) << 32) | (v4l_format_g_width(&fmt) << 16) | v4l_format_g_height(&fmt); if (node->can_output) { diff --git a/utils/v4l2-compliance/v4l2-test-input-output.cpp b/utils/v4l2-compliance/v4l2-test-input-output.cpp index 2bf338e6..fb8d12b1 100644 --- a/utils/v4l2-compliance/v4l2-test-input-output.cpp +++ b/utils/v4l2-compliance/v4l2-test-input-output.cpp @@ -233,7 +233,7 @@ int testTunerFreq(struct node *node) ret = doioctl(node, VIDIOC_G_TUNER, &tuner); if (ret) return fail("could not get tuner %d\n", t); - last_type = (enum v4l2_tuner_type)tuner.type; + last_type = static_cast(tuner.type); memset(&freq, 0, sizeof(freq)); freq.tuner = t; ret = doioctl(node, VIDIOC_G_FREQUENCY, &freq); @@ -259,7 +259,7 @@ int testTunerFreq(struct node *node) warn("returned tuner %d frequency out of range (%d not in [%d...%d])\n", t, freq.frequency, tuner.rangelow, tuner.rangehigh); - freq.type = (enum v4l2_tuner_type)0; + freq.type = static_cast(0); ret = doioctl(node, VIDIOC_S_FREQUENCY, &freq); if (ret != EINVAL) return fail("did not return EINVAL when passed tuner type 0\n"); diff --git a/utils/v4l2-compliance/v4l2-test-media.cpp b/utils/v4l2-compliance/v4l2-test-media.cpp index 6ac71400..bcd8a725 100644 --- a/utils/v4l2-compliance/v4l2-test-media.cpp +++ b/utils/v4l2-compliance/v4l2-test-media.cpp @@ -256,7 +256,7 @@ int testMediaTopology(struct node *node) fail_on_test(pad.index == ~0U); fail_on_test(v2_entity_pad_idx_set.find((__u64)pad.entity_id << 32 | pad.index) != v2_entity_pad_idx_set.end()); - v2_entity_pad_idx_set.insert((__u64)pad.entity_id << 32 | pad.index); + v2_entity_pad_idx_set.insert(static_cast<__u64>(pad.entity_id) << 32 | pad.index); } else { fail_on_test(pad.index); } @@ -429,7 +429,7 @@ int testMediaEnum(struct node *node) (MEDIA_PAD_FL_SINK | MEDIA_PAD_FL_SOURCE)); if (node->topology && MEDIA_V2_PAD_HAS_INDEX(node->media_version)) { - __u64 key = (__u64)ent.id << 32 | links.pads[i].index; + __u64 key = static_cast<__u64>(ent.id) << 32 | links.pads[i].index; fail_on_test(v2_entity_pad_idx_set.find(key) == v2_entity_pad_idx_set.end()); diff --git a/utils/v4l2-ctl/v4l2-ctl-common.cpp b/utils/v4l2-ctl/v4l2-ctl-common.cpp index ce6ac2fd..f2997951 100644 --- a/utils/v4l2-ctl/v4l2-ctl-common.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-common.cpp @@ -314,8 +314,8 @@ static void list_devices() card = mdi.driver; } } else { - bus_info = (const char *)vcap.bus_info; - card = (const char *)vcap.card; + bus_info = reinterpret_cast(vcap.bus_info); + card = reinterpret_cast(vcap.card); } close(fd); if (err) @@ -385,7 +385,7 @@ static std::string safename(const unsigned char *name) static std::string safename(const char *name) { - return safename((const unsigned char *)name); + return safename(reinterpret_cast(name)); } static void print_qctrl(int fd, struct v4l2_query_ext_ctrl *queryctrl, @@ -543,7 +543,7 @@ static int print_control(int fd, struct v4l2_query_ext_ctrl &qctrl, int show_men qctrl.id < V4L2_CID_PRIVATE_BASE)) { if (qctrl.type == V4L2_CTRL_TYPE_STRING) { ext_ctrl.size = qctrl.maximum + 1; - ext_ctrl.string = (char *)malloc(ext_ctrl.size); + ext_ctrl.string = static_cast(malloc(ext_ctrl.size)); ext_ctrl.string[0] = 0; } if (test_ioctl(fd, VIDIOC_G_EXT_CTRLS, &ctrls)) { @@ -584,8 +584,8 @@ static int query_ext_ctrl_ioctl(int fd, struct v4l2_query_ext_ctrl &qctrl) memcpy(qctrl.name, qc.name, sizeof(qctrl.name)); qctrl.minimum = qc.minimum; if (qc.type == V4L2_CTRL_TYPE_BITMASK) { - qctrl.maximum = (__u32)qc.maximum; - qctrl.default_value = (__u32)qc.default_value; + qctrl.maximum = static_cast<__u32>(qc.maximum); + qctrl.default_value = static_cast<__u32>(qc.default_value); } else { qctrl.maximum = qc.maximum; qctrl.default_value = qc.default_value; @@ -840,7 +840,7 @@ void common_cmd(const std::string &media_bus_info, int ch, char *optarg) } break; case OptSetPriority: - prio = (enum v4l2_priority)strtoul(optarg, 0L, 0); + prio = static_cast(strtoul(optarg, 0L, 0)); break; case OptListDevices: if (media_bus_info.empty()) @@ -1064,7 +1064,7 @@ static void print_array(const struct v4l2_query_ext_ctrl &qc, void *p) switch (qc.type) { case V4L2_CTRL_TYPE_U8: for (i = from; i <= to; i++) { - printf("%4d", ((__u8 *)p)[idx + i]); + printf("%4d", (static_cast<__u8 *>(p))[idx + i]); if (i < to) printf(", "); } @@ -1072,7 +1072,7 @@ static void print_array(const struct v4l2_query_ext_ctrl &qc, void *p) break; case V4L2_CTRL_TYPE_U16: for (i = from; i <= to; i++) { - printf("%6d", ((__u16 *)p)[idx + i]); + printf("%6d", (static_cast<__u16 *>(p))[idx + i]); if (i < to) printf(", "); } @@ -1080,7 +1080,7 @@ static void print_array(const struct v4l2_query_ext_ctrl &qc, void *p) break; case V4L2_CTRL_TYPE_U32: for (i = from; i <= to; i++) { - printf("%6d", ((__u32 *)p)[idx + i]); + printf("%6d", (static_cast<__u32 *>(p))[idx + i]); if (i < to) printf(", "); } diff --git a/utils/v4l2-ctl/v4l2-ctl-edid.cpp b/utils/v4l2-ctl/v4l2-ctl-edid.cpp index 319cbb4b..366e6522 100644 --- a/utils/v4l2-ctl/v4l2-ctl-edid.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-edid.cpp @@ -235,7 +235,7 @@ static void edid_add_block(struct v4l2_edid *e) e->edid = NULL; exit(1); } - e->edid = (unsigned char *)realloc(e->edid, e->blocks * 128); + e->edid = static_cast(realloc(e->edid, e->blocks * 128)); } static void read_edid_file(FILE *f, struct v4l2_edid *e) @@ -1332,7 +1332,7 @@ void edid_get(cv4l_fd &_fd) exit(1); } } - gedid.edid = (unsigned char *)malloc(gedid.blocks * 128); + gedid.edid = static_cast(malloc(gedid.blocks * 128)); if (doioctl(fd, VIDIOC_G_EDID, &gedid) == 0) { if (options[OptFixEdidChecksums]) fix_edid(&gedid); @@ -1344,7 +1344,7 @@ void edid_get(cv4l_fd &_fd) } if (options[OptInfoEdid]) { info_edid.blocks = 2; - info_edid.edid = (unsigned char *)malloc(info_edid.blocks * 128); + info_edid.edid = static_cast(malloc(info_edid.blocks * 128)); if (doioctl(fd, VIDIOC_G_EDID, &info_edid) == 0) print_edid_mods(&info_edid); free(info_edid.edid); diff --git a/utils/v4l2-ctl/v4l2-ctl-io.cpp b/utils/v4l2-ctl/v4l2-ctl-io.cpp index dc2756c8..1130fdc0 100644 --- a/utils/v4l2-ctl/v4l2-ctl-io.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-io.cpp @@ -184,7 +184,7 @@ void io_list(cv4l_fd &_fd) printf("\tType : 0x%08X (%s)\n", vin.type, inputtype2s(vin.type)); printf("\tAudioset : 0x%08X\n", vin.audioset); printf("\tTuner : 0x%08X\n", vin.tuner); - printf("\tStandard : 0x%016llX (%s)\n", (unsigned long long)vin.std, + printf("\tStandard : 0x%016llX (%s)\n", static_cast(vin.std), std2s(vin.std).c_str()); printf("\tStatus : 0x%08X (%s)\n", vin.status, in_status2s(vin.status).c_str()); printf("\tCapabilities: 0x%08X (%s)\n", vin.capabilities, input_cap2s(vin.capabilities).c_str()); @@ -204,7 +204,7 @@ void io_list(cv4l_fd &_fd) printf("\tName : %s\n", vout.name); printf("\tType : 0x%08X (%s)\n", vout.type, outputtype2s(vout.type)); printf("\tAudioset : 0x%08X\n", vout.audioset); - printf("\tStandard : 0x%016llX (%s)\n", (unsigned long long)vout.std, + printf("\tStandard : 0x%016llX (%s)\n", static_cast(vout.std), std2s(vout.std).c_str()); printf("\tCapabilities: 0x%08X (%s)\n", vout.capabilities, output_cap2s(vout.capabilities).c_str()); vout.index++; diff --git a/utils/v4l2-ctl/v4l2-ctl-meta.cpp b/utils/v4l2-ctl/v4l2-ctl-meta.cpp index b1288297..0e1071b0 100644 --- a/utils/v4l2-ctl/v4l2-ctl-meta.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-meta.cpp @@ -155,10 +155,10 @@ void print_meta_buffer(FILE *f, cv4l_buffer &buf, cv4l_fmt &fmt, cv4l_queue &q) switch (fmt.g_pixelformat()) { case V4L2_META_FMT_UVC: fprintf(f, "UVC: "); - vbuf = (vivid_uvc_meta_buf *)q.g_dataptr(buf.g_index(), 0); + vbuf = static_cast(q.g_dataptr(buf.g_index(), 0)); fprintf(f, "%.6fs sof: %4d len: %u flags: 0x%02x", - (double)vbuf->ns / 1000000000.0, + static_cast(vbuf->ns) / 1000000000.0, vbuf->sof, vbuf->length, vbuf->flags); @@ -174,7 +174,7 @@ void print_meta_buffer(FILE *f, cv4l_buffer &buf, cv4l_fmt &fmt, cv4l_queue &q) break; case V4L2_META_FMT_VIVID: fprintf(f, "VIVID:"); - vbuf_out = (vivid_meta_out_buf *)q.g_dataptr(buf.g_index(), 0); + vbuf_out = static_cast(q.g_dataptr(buf.g_index(), 0)); fprintf(f, " brightness: %u contrast: %u saturation: %u hue: %d\n", vbuf_out->brightness, vbuf_out->contrast, @@ -189,7 +189,7 @@ void meta_fillbuffer(cv4l_buffer &buf, cv4l_fmt &fmt, cv4l_queue &q) switch (fmt.g_pixelformat()) { case V4L2_META_FMT_VIVID: - vbuf = (vivid_meta_out_buf *)q.g_dataptr(buf.g_index(), 0); + vbuf = static_cast(q.g_dataptr(buf.g_index(), 0)); vbuf->brightness = buf.g_sequence() % 192 + 64; vbuf->contrast = (buf.g_sequence() + 10) % 192 + 64; vbuf->saturation = (buf.g_sequence() + 20) % 256; diff --git a/utils/v4l2-ctl/v4l2-ctl-modes.cpp b/utils/v4l2-ctl/v4l2-ctl-modes.cpp index 9db07f1a..b311ce5d 100644 --- a/utils/v4l2-ctl/v4l2-ctl-modes.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-modes.cpp @@ -224,7 +224,7 @@ bool calc_cvt_modeline(int image_width, int image_height, if (ideal_blank_duty_cycle < 20 * HV_FACTOR) ideal_blank_duty_cycle = 20 * HV_FACTOR; - h_blank = active_h_pixel * (long long)ideal_blank_duty_cycle / + h_blank = active_h_pixel * static_cast(ideal_blank_duty_cycle) / (100 * HV_FACTOR - ideal_blank_duty_cycle); h_blank -= h_blank % (2 * CVT_CELL_GRAN); @@ -238,7 +238,7 @@ bool calc_cvt_modeline(int image_width, int image_height, h_bp = h_blank / 2; h_fp = h_blank - h_bp - h_sync; - pixel_clock = ((long long)total_h_pixel * HV_FACTOR * 1000000) + pixel_clock = (static_cast(total_h_pixel) * HV_FACTOR * 1000000) / h_period; pixel_clock -= pixel_clock % clk_gran; } else { @@ -468,10 +468,10 @@ bool calc_gtf_modeline(int image_width, int image_height, v_blank = v_sync + v_bp + v_fp; total_v_lines = active_v_lines + v_blank; - v_refresh_est = (2 * HV_FACTOR * (long long)1000000) / + v_refresh_est = (2 * HV_FACTOR * static_cast(1000000)) / (h_period_est * (2 * total_v_lines + interlace) / HV_FACTOR); - h_period = ((long long)h_period_est * v_refresh_est) / + h_period = (static_cast(h_period_est) * v_refresh_est) / (v_refresh * HV_FACTOR); if (!reduced_blanking) @@ -481,7 +481,7 @@ bool calc_gtf_modeline(int image_width, int image_height, ideal_blank_duty_cycle = (GTF_S_C_PRIME * HV_FACTOR) - GTF_S_M_PRIME * h_period / 1000; - h_blank = active_h_pixel * (long long)ideal_blank_duty_cycle / + h_blank = active_h_pixel * static_cast(ideal_blank_duty_cycle) / (100 * HV_FACTOR - ideal_blank_duty_cycle); h_blank = ((h_blank + GTF_CELL_GRAN) / (2 * GTF_CELL_GRAN)) * (2 * GTF_CELL_GRAN); @@ -493,7 +493,7 @@ bool calc_gtf_modeline(int image_width, int image_height, h_fp = h_blank / 2 - h_sync; h_bp = h_fp + h_sync; - pixel_clock = ((long long)total_h_pixel * HV_FACTOR * 1000000) + pixel_clock = (static_cast(total_h_pixel) * HV_FACTOR * 1000000) / h_period; /* Not sure if clock value needs to be truncated to multiple * of 25000. The formula given in standard does not indicate diff --git a/utils/v4l2-ctl/v4l2-ctl-overlay.cpp b/utils/v4l2-ctl/v4l2-ctl-overlay.cpp index 162248bc..4c9609d6 100644 --- a/utils/v4l2-ctl/v4l2-ctl-overlay.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-overlay.cpp @@ -402,12 +402,12 @@ static void do_try_set_overlay(struct v4l2_format &fmt, int fd) win.bitmap = NULL; if (keep_old_bitmap) { - bitmap = (unsigned char *)calloc(1, stride * win.w.height); + bitmap = static_cast(calloc(1, stride * win.w.height)); win.bitmap = bitmap; } if (keep_old_clip) { if (win.clipcount) - cliplist = (struct v4l2_clip *)malloc(win.clipcount * sizeof(*cliplist)); + cliplist = static_cast(malloc(win.clipcount * sizeof(*cliplist))); win.clips = cliplist; } if (keep_old_clip || keep_old_bitmap) @@ -435,7 +435,7 @@ static void do_try_set_overlay(struct v4l2_format &fmt, int fd) if (!bitmap_rects.empty()) { free(bitmap); stride = (win.w.width + 7) / 8; - bitmap = (unsigned char *)calloc(1, stride * win.w.height); + bitmap = static_cast(calloc(1, stride * win.w.height)); win.bitmap = bitmap; for (unsigned i = 0; i < bitmap_rects.size(); i++) { const v4l2_rect &r = bitmap_rects[i]; @@ -518,8 +518,8 @@ void overlay_get(cv4l_fd &_fd) unsigned stride = (fmt.fmt.win.w.width + 7) / 8; if (fmt.fmt.win.clipcount) - fmt.fmt.win.clips = (struct v4l2_clip *)malloc(fmt.fmt.win.clipcount * sizeof(clips[0])); - bitmap = (unsigned char *)calloc(1, stride * fmt.fmt.win.w.height); + fmt.fmt.win.clips = static_cast(malloc(fmt.fmt.win.clipcount * sizeof(clips[0]))); + bitmap = static_cast(calloc(1, stride * fmt.fmt.win.w.height)); fmt.fmt.win.bitmap = bitmap; doioctl(fd, VIDIOC_G_FMT, &fmt); printfmt(fd, fmt); diff --git a/utils/v4l2-ctl/v4l2-ctl-stds.cpp b/utils/v4l2-ctl/v4l2-ctl-stds.cpp index d2cbae74..7ba44ae3 100644 --- a/utils/v4l2-ctl/v4l2-ctl-stds.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-stds.cpp @@ -379,7 +379,7 @@ static void print_dv_timings(const struct v4l2_dv_timings *t) if (options[OptConcise]) { printf("\t%dx%d%c%.2f %s\n", bt->width, bt->height, bt->interlaced ? 'i' : 'p', - (double)bt->pixelclock / + static_cast(bt->pixelclock) / (tot_width * (tot_height / (bt->interlaced ? 2 : 1))), dvflags2s(bt->vsync, bt->flags).c_str()); break; @@ -399,10 +399,10 @@ static void print_dv_timings(const struct v4l2_dv_timings *t) printf("\tPixelclock: %lld Hz", bt->pixelclock); if (bt->width && bt->height) { if (bt->interlaced) - printf(" (%.2f fields per second)", (double)bt->pixelclock / + printf(" (%.2f fields per second)", static_cast(bt->pixelclock) / (tot_width * (tot_height / 2))); else - printf(" (%.2f frames per second)", (double)bt->pixelclock / + printf(" (%.2f frames per second)", static_cast(bt->pixelclock) / (tot_width * tot_height)); } printf("\n"); @@ -495,7 +495,7 @@ void stds_set(cv4l_fd &_fd) } } if (doioctl(fd, VIDIOC_S_STD, &standard) == 0) - printf("Standard set to %08llx\n", (unsigned long long)standard); + printf("Standard set to %08llx\n", static_cast(standard)); } if (options[OptSetDvBtTimings]) { @@ -585,7 +585,7 @@ void stds_get(cv4l_fd &_fd) if (options[OptGetStandard]) { if (doioctl(fd, VIDIOC_G_STD, &standard) == 0) { - printf("Video Standard = 0x%08llx\n", (unsigned long long)standard); + printf("Video Standard = 0x%08llx\n", static_cast(standard)); printf("\t%s\n", std2s(standard, "\n\t").c_str()); } } @@ -624,7 +624,7 @@ void stds_get(cv4l_fd &_fd) if (options[OptQueryStandard]) { if (doioctl(fd, VIDIOC_QUERYSTD, &standard) == 0) { - printf("Video Standard = 0x%08llx\n", (unsigned long long)standard); + printf("Video Standard = 0x%08llx\n", static_cast(standard)); printf("\t%s\n", std2s(standard, "\n\t").c_str()); } } @@ -647,12 +647,12 @@ void stds_list(cv4l_fd &_fd) while (test_ioctl(fd, VIDIOC_ENUMSTD, &vs) >= 0) { if (options[OptConcise]) { printf("\t%2d: 0x%016llX %s\n", vs.index, - (unsigned long long)vs.id, vs.name); + static_cast(vs.id), vs.name); } else { if (vs.index) printf("\n"); printf("\tIndex : %d\n", vs.index); - printf("\tID : 0x%016llX\n", (unsigned long long)vs.id); + printf("\tID : 0x%016llX\n", static_cast(vs.id)); printf("\tName : %s\n", vs.name); printf("\tFrame period: %d/%d\n", vs.frameperiod.numerator, diff --git a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp index d9a307f9..de40c5ad 100644 --- a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp @@ -253,7 +253,7 @@ double fps_timestamps::fps() double period = sum / cnt; double fps = 1.0 / period; - first += (unsigned)(ts[prev_idx] - first); + first += static_cast(ts[prev_idx] - first); return fps; }; @@ -510,7 +510,7 @@ static void print_buffer(FILE *f, struct v4l2_buffer &buf) fprintf(f, "\tLength : %u\n", buf.length); fprintf(f, "\tBytesused: %u\n", buf.bytesused); fprintf(f, "\tTimestamp: %llu.%06llus (%s, %s)\n", - (__u64)buf.timestamp.tv_sec, (__u64)buf.timestamp.tv_usec, + static_cast<__u64>(buf.timestamp.tv_sec), static_cast<__u64>(buf.timestamp.tv_usec), timestamp_type2s(buf.flags).c_str(), timestamp_src2s(buf.flags).c_str()); if (buf.flags & V4L2_BUF_FLAG_TIMECODE) { static const int fps_types[] = { 0, 24, 25, 30, 50, 60 }; @@ -721,9 +721,9 @@ void streaming_cmd(int ch, char *optarg) if (speed > 3) speed = 3; if (ch == OptStreamOutHorSpeed) - stream_out_hor_mode = (tpg_move_mode)(speed + 3); + stream_out_hor_mode = static_cast(speed + 3); else - stream_out_vert_mode = (tpg_move_mode)(speed + 3); + stream_out_vert_mode = static_cast(speed + 3); break; case OptStreamOutPercFill: stream_out_perc_fill = strtoul(optarg, 0L, 0); @@ -1023,7 +1023,7 @@ static bool fill_buffer_from_file(cv4l_fd &fd, cv4l_queue &q, cv4l_buffer &b, read_u32(fin); // ignore field read_u32(fin); // ignore flags for (unsigned j = 0; j < q.g_num_planes(); j++) { - __u8 *buf = (__u8 *)q.g_dataptr(b.g_index(), j); + __u8 *buf = static_cast<__u8 *>(q.g_dataptr(b.g_index(), j)); sz = read_u32(fin); if (sz != V4L_STREAM_PACKET_FRAME_VIDEO_SIZE_PLANE_HDR) { @@ -1052,7 +1052,7 @@ static bool fill_buffer_from_file(cv4l_fd &fd, cv4l_queue &q, cv4l_buffer &b, fprintf(stderr, "error reading %d bytes\n", sz); return false; } - if ((__u32)n == sz) + if (static_cast<__u32>(n) == sz) break; offset += n; sz -= n; @@ -1108,10 +1108,10 @@ restart: } if (fmt.g_pixelformat() == V4L2_PIX_FMT_FWHT_STATELESS) - res = read_fwht_frame(fmt, (unsigned char *)buf, fin, + res = read_fwht_frame(fmt, static_cast(buf), fin, sz, expected_len, buf_len); else if (support_out_crop && v4l2_fwht_find_pixfmt(fmt.g_pixelformat())) - res = read_write_padded_frame(fmt, (unsigned char *)buf, + res = read_write_padded_frame(fmt, static_cast(buf), fin, sz, expected_len, buf_len, true); else sz = fread(buf, 1, expected_len, fin); @@ -1197,7 +1197,7 @@ static int do_setup_out_buffers(cv4l_fd &fd, cv4l_queue &q, FILE *fin, bool qbuf for (p = 0; p < fmt.g_num_planes(); p++) tpg_s_bytesperline(&tpg, p, fmt.g_bytesperline(p)); - tpg_s_pattern(&tpg, (tpg_pattern)stream_pat); + tpg_s_pattern(&tpg, static_cast(stream_pat)); tpg_s_mv_hor_mode(&tpg, stream_out_hor_mode); tpg_s_mv_vert_mode(&tpg, stream_out_vert_mode); tpg_s_show_square(&tpg, stream_out_square); @@ -1215,7 +1215,7 @@ static int do_setup_out_buffers(cv4l_fd &fd, cv4l_queue &q, FILE *fin, bool qbuf tpg_s_pixel_aspect(&tpg, aspect); break; default: - tpg_s_pixel_aspect(&tpg, (tpg_pixel_aspect)stream_out_pixel_aspect); + tpg_s_pixel_aspect(&tpg, static_cast(stream_out_pixel_aspect)); break; } field = output_field; @@ -1245,7 +1245,7 @@ static int do_setup_out_buffers(cv4l_fd &fd, cv4l_queue &q, FILE *fin, bool qbuf if (can_fill) { for (unsigned j = 0; j < q.g_num_planes(); j++) - tpg_fillbuffer(&tpg, stream_out_std, j, (u8 *)q.g_dataptr(i, j)); + tpg_fillbuffer(&tpg, stream_out_std, j, static_cast(q.g_dataptr(i, j))); } } if (is_meta) @@ -1318,7 +1318,7 @@ static void write_buffer_to_file(cv4l_fd &fd, cv4l_queue &q, cv4l_buffer &buf, for (unsigned j = 0; j < buf.g_num_planes(); j++) { __u32 used = buf.g_bytesused(j); unsigned offset = buf.g_data_offset(j); - u8 *p = (u8 *)q.g_dataptr(buf.g_index(), j) + offset; + u8 *p = static_cast(q.g_dataptr(buf.g_index(), j)) + offset; if (ctx) { comp_ptr[j] = fwht_compress(ctx, p, @@ -1365,10 +1365,10 @@ static void write_buffer_to_file(cv4l_fd &fd, cv4l_queue &q, cv4l_buffer &buf, if (host_fd_to >= 0) sz = fwrite(comp_ptr[j] + offset, 1, used, fout); else if (support_cap_compose && v4l2_fwht_find_pixfmt(fmt.g_pixelformat())) - read_write_padded_frame(fmt, (u8 *)q.g_dataptr(buf.g_index(), j) + offset, + read_write_padded_frame(fmt, static_cast(q.g_dataptr(buf.g_index(), j)) + offset, fout, sz, used, used, false); else - sz = fwrite((u8 *)q.g_dataptr(buf.g_index(), j) + offset, 1, used, fout); + sz = fwrite(static_cast(q.g_dataptr(buf.g_index(), j)) + offset, 1, used, fout); if (sz != used) fprintf(stderr, "%u != %u\n", sz, used); @@ -1500,7 +1500,7 @@ static int do_handle_out(cv4l_fd &fd, cv4l_queue &q, FILE *fin, cv4l_buffer *cap unsigned data_offset = cap->g_data_offset(j); if (q.g_memory() == V4L2_MEMORY_USERPTR) { - buf.s_userptr((u8 *)cap->g_userptr(j) + data_offset, j); + buf.s_userptr(static_cast(cap->g_userptr(j)) + data_offset, j); buf.s_bytesused(cap->g_bytesused(j) - data_offset, j); buf.s_data_offset(0, j); } else if (q.g_memory() == V4L2_MEMORY_DMABUF) { @@ -1551,7 +1551,7 @@ static int do_handle_out(cv4l_fd &fd, cv4l_queue &q, FILE *fin, cv4l_buffer *cap if (!fin && stream_out_refresh) { for (unsigned j = 0; j < buf.g_num_planes(); j++) tpg_fillbuffer(&tpg, stream_out_std, j, - (u8 *)q.g_dataptr(buf.g_index(), j)); + static_cast(q.g_dataptr(buf.g_index(), j))); } if (is_meta) meta_fillbuffer(buf, fmt, q); @@ -1683,13 +1683,13 @@ static FILE *open_output_file(cv4l_fd &fd) fprintf(stderr, "no such host %s\n", host_to); exit(0); } - memset((char *)&serv_addr, 0, sizeof(serv_addr)); + memset(reinterpret_cast(&serv_addr), 0, sizeof(serv_addr)); serv_addr.sin_family = AF_INET; - memcpy((char *)&serv_addr.sin_addr.s_addr, - (char *)server->h_addr, + memcpy(reinterpret_cast(&serv_addr.sin_addr.s_addr), + server->h_addr, server->h_length); serv_addr.sin_port = htons(host_port_to); - if (connect(host_fd_to, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) < 0) { + if (connect(host_fd_to, reinterpret_cast(&serv_addr), sizeof(serv_addr)) < 0) { fprintf(stderr, "could not connect\n"); exit(0); } @@ -1941,13 +1941,13 @@ static FILE *open_input_file(cv4l_fd &fd, __u32 type) serv_addr.sin_family = AF_INET; serv_addr.sin_addr.s_addr = INADDR_ANY; serv_addr.sin_port = htons(host_port_from); - if (bind(listen_fd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) < 0) { + if (bind(listen_fd, reinterpret_cast(&serv_addr), sizeof(serv_addr)) < 0) { fprintf(stderr, "could not bind\n"); exit(1); } listen(listen_fd, 1); clilen = sizeof(cli_addr); - host_fd_from = accept(listen_fd, (struct sockaddr *)&cli_addr, &clilen); + host_fd_from = accept(listen_fd, reinterpret_cast(&cli_addr), &clilen); if (host_fd_from < 0) { fprintf(stderr, "could not accept\n"); exit(1); diff --git a/utils/v4l2-ctl/v4l2-ctl-vidcap.cpp b/utils/v4l2-ctl/v4l2-ctl-vidcap.cpp index 8f87ecbd..a9ef8eed 100644 --- a/utils/v4l2-ctl/v4l2-ctl-vidcap.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-vidcap.cpp @@ -365,7 +365,7 @@ void print_touch_buffer(FILE *f, cv4l_buffer &buf, cv4l_fmt &fmt, cv4l_queue &q) '.', ',', ':', ';', '!', '|', 'i', 'c', 'n', 'o', 'm', 'I', 'C', 'N', 'O', 'M', }; - __s16 *vbuf = (__s16 *)q.g_dataptr(buf.g_index(), 0); + __s16 *vbuf = static_cast<__s16 *>(q.g_dataptr(buf.g_index(), 0)); __u32 x, y; switch (fmt.g_pixelformat()) { @@ -374,7 +374,7 @@ void print_touch_buffer(FILE *f, cv4l_buffer &buf, cv4l_fmt &fmt, cv4l_queue &q) fprintf(f, "TD16: "); for (x = 0; x < fmt.g_width(); x++, vbuf++) { - __s16 v = (__s16)le16toh(*vbuf); + __s16 v = static_cast<__s16>(le16toh(*vbuf)); if (!options[OptConcise]) fprintf(f, "% 4d", v); diff --git a/utils/v4l2-ctl/v4l2-ctl.cpp b/utils/v4l2-ctl/v4l2-ctl.cpp index 1866172f..42889ef8 100644 --- a/utils/v4l2-ctl/v4l2-ctl.cpp +++ b/utils/v4l2-ctl/v4l2-ctl.cpp @@ -396,7 +396,7 @@ static std::string printfmtname(int fd, __u32 type, __u32 pixfmt) fmt.type = type; while (test_ioctl(fd, VIDIOC_ENUM_FMT, &fmt) >= 0) { if (fmt.pixelformat == pixfmt) - return s + (const char *)fmt.description + ")"; + return s + reinterpret_cast(fmt.description) + ")"; fmt.index++; } return ""; @@ -476,7 +476,7 @@ void printfmt(int fd, const struct v4l2_format &vfmt) } printf("\tClip Bitmap : %s", vfmt.fmt.win.bitmap ? "Yes, " : "No\n"); if (vfmt.fmt.win.bitmap) { - unsigned char *bitmap = (unsigned char *)vfmt.fmt.win.bitmap; + unsigned char *bitmap = static_cast(vfmt.fmt.win.bitmap); unsigned stride = (vfmt.fmt.win.w.width + 7) / 8; unsigned cnt = 0; @@ -493,7 +493,7 @@ void printfmt(int fd, const struct v4l2_format &vfmt) printf("\tSampling Rate : %u Hz\n", vfmt.fmt.vbi.sampling_rate); printf("\tOffset : %u samples (%g secs after leading edge)\n", vfmt.fmt.vbi.offset, - (double)vfmt.fmt.vbi.offset / (double)vfmt.fmt.vbi.sampling_rate); + static_cast(vfmt.fmt.vbi.offset) / static_cast(vfmt.fmt.vbi.sampling_rate)); printf("\tSamples per Line: %u\n", vfmt.fmt.vbi.samples_per_line); printf("\tSample Format : '%s'\n", fcc2s(vfmt.fmt.vbi.sample_format).c_str()); printf("\tStart 1st Field : %u\n", vfmt.fmt.vbi.start[0]); @@ -657,7 +657,7 @@ void print_video_formats_ext(cv4l_fd &fd, __u32 type) int parse_subopt(char **subs, const char * const *subopts, char **value) { - int opt = getsubopt(subs, (char * const *)subopts, value); + int opt = getsubopt(subs, const_cast(subopts), value); if (opt == -1) { fprintf(stderr, "Invalid suboptions specified\n"); @@ -886,7 +886,7 @@ int parse_selection_target(const char *s, unsigned int &target) static void print_event(const struct v4l2_event *ev) { printf("%lld.%06ld: event %u, pending %u: ", - (__u64)ev->timestamp.tv_sec, ev->timestamp.tv_nsec / 1000, + static_cast<__u64>(ev->timestamp.tv_sec), ev->timestamp.tv_nsec / 1000, ev->sequence, ev->pending); switch (ev->type) { case V4L2_EVENT_VSYNC: @@ -1154,7 +1154,7 @@ int main(int argc, char **argv) if (ch == -1) break; - options[(int)ch] = 1; + options[ch] = 1; if (!option_index) { for (i = 0; long_options[i].val; i++) { if (long_options[i].val == ch) { diff --git a/utils/v4l2-dbg/v4l2-dbg.cpp b/utils/v4l2-dbg/v4l2-dbg.cpp index 8fb70775..17ab0210 100644 --- a/utils/v4l2-dbg/v4l2-dbg.cpp +++ b/utils/v4l2-dbg/v4l2-dbg.cpp @@ -382,7 +382,7 @@ static int doioctl(int fd, unsigned long int request, void *parm, const char *na static int parse_subopt(char **subs, const char * const *subopts, char **value) { - int opt = getsubopt(subs, (char * const *)subopts, value); + int opt = getsubopt(subs, const_cast(subopts), value); if (opt == -1) { fprintf(stderr, "Invalid suboptions specified\n"); @@ -451,7 +451,7 @@ int main(int argc, char **argv) if (ch == -1) break; - options[(int)ch] = 1; + options[ch] = 1; if (!option_index) { for (i = 0; long_options[i].val; i++) { if (long_options[i].val == ch) { From patchwork Mon Apr 20 18:46:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 11499665 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 27ED2913 for ; Mon, 20 Apr 2020 18:46:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0975C2084D for ; Mon, 20 Apr 2020 18:46:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WHIwiCWE" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728126AbgDTSq4 (ORCPT ); Mon, 20 Apr 2020 14:46:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726439AbgDTSqz (ORCPT ); Mon, 20 Apr 2020 14:46:55 -0400 Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55D67C061A0C for ; Mon, 20 Apr 2020 11:46:55 -0700 (PDT) Received: by mail-pg1-x52c.google.com with SMTP id h69so5509959pgc.8 for ; Mon, 20 Apr 2020 11:46:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=9kZyrpoILwGtiw85vGBttiJNgt55hwAV1pgsqDbFCQs=; b=WHIwiCWExIKI07uceS4v/j8VPWBGIF6FgeiOlXYlIEL1+HCFhonY0exaDq98AmCiyJ opcKNpxPa42im3chQkHmXsbTgtNLKUnvWZVKsQlIV0zktIU0Bc0CWJAdqm0Q1KYNhAfd pnxx82MmSq/uii9OsjsLxSoJSOSywiJ/W6tX2ZoBZOyLbc7l2m6QBTGcNmt1u/kuaT3L ZK2NTUs9Wl91oGkcvLWulEMoLeuaBoSLW5abEecJrP475f7ZaexxKaJlQKI0zgnCtc6E SQzhemp/LUN/fCPrJ7YAOUdXCMYYEG26RxBUoIFFExDuOHal9M/+z61W4z19Xhk7QWcd nsZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9kZyrpoILwGtiw85vGBttiJNgt55hwAV1pgsqDbFCQs=; b=HyDmCm3Qz7nf+A+rwagjFK91oMryAiRBIb2thp2ii7xg3KDs+WlmN4KvFmsWlpsX67 sGXn+HrisykUBCNpcjHEFjnZzD4QHFzL7XE879qlFV9Zv3avB+2ERmviATunPfg7GwAh T7l4wJmlxBlqjR5Q9TdKVjF958uok1Ra9LfAfdwPOGlJEb3xHsxeJAcyEpWRaILXuHeF lMsftR2/f/m06aRu1LZmynkTzGwSllj8RJi31zbjD3l8OaGkGmykcpYNC8VF7Jpn1AFH r4CBrESAOkxorrn5PyZ4xSLnY72eBiu8k+4cYXIAkEEhLi+t30mZFB6wy+k5KSJg2vtR US1g== X-Gm-Message-State: AGi0PuZ64SpG7HbRCnmdogT/P+azfmJlLw/Le1VV7ad9LRcmUXYdbwlA St5ia+dK7KYGuJq2SKwlS1vfplc0 X-Google-Smtp-Source: APiQypLv3Oj3O0za1qVNPfFcq9JG86gS3jr3+3E9k6GeZKiyFgvKVVtf+R6vt4uHDHB+4uq2FRP83w== X-Received: by 2002:a63:ef02:: with SMTP id u2mr17741543pgh.21.1587408413915; Mon, 20 Apr 2020 11:46:53 -0700 (PDT) Received: from localhost.localdomain (76-14-109-232.rk.wavecable.com. [76.14.109.232]) by smtp.gmail.com with ESMTPSA id n8sm182443pfq.213.2020.04.20.11.46.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Apr 2020 11:46:53 -0700 (PDT) From: Rosen Penev To: linux-media@vger.kernel.org Subject: [PATCH 3/7] treewide: fix wrong *cmp function usage Date: Mon, 20 Apr 2020 11:46:45 -0700 Message-Id: <20200420184649.4202-3-rosenp@gmail.com> X-Mailer: git-send-email 2.25.2 In-Reply-To: <20200420184649.4202-1-rosenp@gmail.com> References: <20200420184649.4202-1-rosenp@gmail.com> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Found with bugprone-suspicious-string-compare Signed-off-by: Rosen Penev --- lib/libdvbv5/countries.c | 2 +- lib/libdvbv5/dvb-dev-remote.c | 4 ++-- lib/libdvbv5/parse_string.c | 4 ++-- lib/libv4l2rds/libv4l2rds.c | 6 +++--- utils/cec-compliance/cec-test-adapter.cpp | 2 +- utils/cec-compliance/cec-test.cpp | 8 ++++---- utils/cec-ctl/cec-ctl.cpp | 2 +- utils/common/media-info.cpp | 4 ++-- utils/dvb/dvbv5-daemon.c | 2 +- utils/dvb/dvbv5-scan.c | 2 +- utils/ir-ctl/ir-ctl.c | 4 ++-- utils/keytable/keytable.c | 6 +++--- utils/libmedia_dev/get_media_devices.c | 4 ++-- utils/media-ctl/libmediactl.c | 2 +- utils/media-ctl/libv4l2subdev.c | 2 +- utils/v4l2-compliance/v4l2-compliance.cpp | 18 +++++++++--------- utils/v4l2-compliance/v4l2-test-buffers.cpp | 4 ++-- utils/v4l2-compliance/v4l2-test-media.cpp | 16 ++++++++-------- utils/v4l2-compliance/v4l2-test-subdevs.cpp | 4 ++-- utils/v4l2-ctl/v4l2-ctl-common.cpp | 2 +- 20 files changed, 49 insertions(+), 49 deletions(-) diff --git a/lib/libdvbv5/countries.c b/lib/libdvbv5/countries.c index 609add0b..c5682365 100644 --- a/lib/libdvbv5/countries.c +++ b/lib/libdvbv5/countries.c @@ -395,7 +395,7 @@ enum dvb_country_t dvb_guess_user_country(void) continue; if (! strncmp(buf, "POSIX", MIN(strlen(buf), 5)) || - ! (strncmp(buf, "en", MIN(strlen(buf), 2)) && !isalpha(buf[2])) ) + ! (strncmp(buf, "en", MIN(strlen(buf), 2)) != 0 && !isalpha(buf[2])) ) continue; buf = strdup(buf); diff --git a/lib/libdvbv5/dvb-dev-remote.c b/lib/libdvbv5/dvb-dev-remote.c index ebb1bdb7..643ca559 100644 --- a/lib/libdvbv5/dvb-dev-remote.c +++ b/lib/libdvbv5/dvb-dev-remote.c @@ -733,7 +733,7 @@ static void *receive_data(void *privdata) handled = 1; - if (strcmp(msg->cmd, cmd)) { + if (strcmp(msg->cmd, cmd) != 0) { dvb_logerr("msg #%d: Expecting '%s', got '%s'", seq, msg->cmd, cmd); free_msg(dvb, msg); @@ -792,7 +792,7 @@ static int dvb_remote_get_version(struct dvb_device_priv *dvb) goto error; } - if (strcmp(version, daemon_version)) { + if (strcmp(version, daemon_version) != 0) { dvb_logerr("Wrong version. Expecting '%s', received '%s'", daemon_version, version); ret = 0; diff --git a/lib/libdvbv5/parse_string.c b/lib/libdvbv5/parse_string.c index d354f497..b3518291 100644 --- a/lib/libdvbv5/parse_string.c +++ b/lib/libdvbv5/parse_string.c @@ -348,7 +348,7 @@ static void charset_conversion(struct dvb_v5_fe_parms *parms, char **dest, const *p = '\0'; /* If desired charset is not UTF-8, prepare for conversion */ - if (strcasecmp(parms->output_charset, "UTF-8")) { + if (strcasecmp(parms->output_charset, "UTF-8") != 0) { tmp = (unsigned char *)*dest; len = p - *dest; @@ -391,7 +391,7 @@ void dvb_parse_string(struct dvb_v5_fe_parms *parms, char **dest, char **emph, * Strings in ISDB-S/T(JP) do not start with a charset identifier, * and can start with a control character (< 0x20). */ - if (strcasecmp(type, "ARIB-STD-B24") && *src < 0x20) { + if (strcasecmp(type, "ARIB-STD-B24") != 0 && *src < 0x20) { switch (*src) { case 0x00: type = "ISO-6937"; break; case 0x01: type = "ISO-8859-5"; break; diff --git a/lib/libv4l2rds/libv4l2rds.c b/lib/libv4l2rds/libv4l2rds.c index 2e67d060..a053adea 100644 --- a/lib/libv4l2rds/libv4l2rds.c +++ b/lib/libv4l2rds/libv4l2rds.c @@ -920,7 +920,7 @@ static uint32_t rds_decode_group2(struct rds_private_state *priv_state) if (segment == 0x0f) { handle->rt_length = 64; handle->valid_fields |= V4L2_RDS_RT; - if (memcmp(handle->rt, priv_state->new_rt, 64)) { + if (memcmp(handle->rt, priv_state->new_rt, 64) != 0) { memcpy(handle->rt, priv_state->new_rt, 64); updated_fields |= V4L2_RDS_RT; } @@ -937,7 +937,7 @@ static uint32_t rds_decode_group2(struct rds_private_state *priv_state) handle->rt_length = 32; handle->valid_fields |= V4L2_RDS_RT; updated_fields |= V4L2_RDS_RT; - if (memcmp(handle->rt, priv_state->new_rt, 32)) { + if (memcmp(handle->rt, priv_state->new_rt, 32) != 0) { memcpy(handle->rt, priv_state->new_rt, 32); updated_fields |= V4L2_RDS_RT; } @@ -954,7 +954,7 @@ static uint32_t rds_decode_group2(struct rds_private_state *priv_state) priv_state->new_rt[i] = '\0'; handle->rt_length = i; handle->valid_fields |= V4L2_RDS_RT; - if (memcmp(handle->rt, priv_state->new_rt, handle->rt_length)) { + if (memcmp(handle->rt, priv_state->new_rt, handle->rt_length) != 0) { memcpy(handle->rt, priv_state->new_rt, handle->rt_length); updated_fields |= V4L2_RDS_RT; diff --git a/utils/cec-compliance/cec-test-adapter.cpp b/utils/cec-compliance/cec-test-adapter.cpp index 0675ccb7..27c742b3 100644 --- a/utils/cec-compliance/cec-test-adapter.cpp +++ b/utils/cec-compliance/cec-test-adapter.cpp @@ -193,7 +193,7 @@ static int testAdapLogAddrs(struct node *node) fail_on_test(laddrs.log_addr_mask == 0); for (unsigned i = 0; i < laddrs.num_log_addrs; i++) { fail_on_test(laddrs.log_addr[i] == CEC_LOG_ADDR_INVALID); - fail_on_test(memcmp(laddrs.features[i], features, 4)); + fail_on_test(memcmp(laddrs.features[i], features, 4) != 0); fail_on_test(check_0(laddrs.features[i] + 4, 8)); } for (unsigned i = laddrs.num_log_addrs; i < CEC_MAX_LOG_ADDRS; i++) { diff --git a/utils/cec-compliance/cec-test.cpp b/utils/cec-compliance/cec-test.cpp index 9a08f54b..4aa54afc 100644 --- a/utils/cec-compliance/cec-test.cpp +++ b/utils/cec-compliance/cec-test.cpp @@ -116,7 +116,7 @@ int system_info_get_menu_lang(struct node *node, unsigned me, unsigned la, bool if (cec_msg_status_is_abort(&msg)) return OK_PRESUMED; cec_ops_set_menu_language(&msg, language); - fail_on_test(strcmp(node->remote[la].language, language)); + fail_on_test(strcmp(node->remote[la].language, language) != 0); return 0; } @@ -319,7 +319,7 @@ int device_osd_transfer_give(struct node *node, unsigned me, unsigned la, bool i char osd_name[15]; cec_ops_set_osd_name(&msg, osd_name); fail_on_test(!osd_name[0]); - fail_on_test(strcmp(node->remote[la].osd_name, osd_name)); + fail_on_test(strcmp(node->remote[la].osd_name, osd_name) != 0); fail_on_test(msg.len != strlen(osd_name) + 2); return 0; @@ -937,11 +937,11 @@ static int tuner_ctl_test(struct node *node, unsigned me, unsigned la, bool inte fail_on_test(timed_out_or_abort(&msg)); info = {}; cec_ops_tuner_device_status(&msg, &info); - if (memcmp(&info, &(*iter), sizeof(info))) { + if (memcmp(&info, &(*iter), sizeof(info)) != 0) { log_tuner_service(info); log_tuner_service(*iter); } - fail_on_test(memcmp(&info, &(*iter), sizeof(info))); + fail_on_test(memcmp(&info, &(*iter), sizeof(info)) != 0); } printf("\t Finished Channel Test\n"); diff --git a/utils/cec-ctl/cec-ctl.cpp b/utils/cec-ctl/cec-ctl.cpp index 3495883e..be37ae3c 100644 --- a/utils/cec-ctl/cec-ctl.cpp +++ b/utils/cec-ctl/cec-ctl.cpp @@ -975,7 +975,7 @@ static void analyze(const char *analyze_pin) exit(1); } if (!fgets(s, sizeof(s), fanalyze) || - strcmp(s, "# cec-ctl --store-pin\n")) + strcmp(s, "# cec-ctl --store-pin\n") != 0) goto err; line++; if (!fgets(s, sizeof(s), fanalyze) || diff --git a/utils/common/media-info.cpp b/utils/common/media-info.cpp index a5b429a0..b0f0bc41 100644 --- a/utils/common/media-info.cpp +++ b/utils/common/media-info.cpp @@ -187,7 +187,7 @@ std::string mi_get_devpath_from_dev_t(dev_t dev) if (bytes <= 0) break; line[bytes - 1] = 0; - if (memcmp(line, "DEVNAME=", 8) || !line[8]) + if ((memcmp(line, "DEVNAME=", 8) != 0) || !line[8]) continue; devpath = "/dev/"; devpath += line + 8; @@ -229,7 +229,7 @@ int mi_get_media_fd(int fd, const char *bus_info) if (bus_info && (ioctl(media_fd, MEDIA_IOC_DEVICE_INFO, &mdinfo) || - strcmp(mdinfo.bus_info, bus_info))) { + (strcmp(mdinfo.bus_info, bus_info) != 0))) { close(media_fd); continue; } diff --git a/utils/dvb/dvbv5-daemon.c b/utils/dvb/dvbv5-daemon.c index ad1197b7..a17233b2 100644 --- a/utils/dvb/dvbv5-daemon.c +++ b/utils/dvb/dvbv5-daemon.c @@ -1203,7 +1203,7 @@ static int dev_set_parms(uint32_t seq, char *cmd, int fd, if (!*new_lnb) { par->lnb = NULL; - } else if (strcmp(old_lnb, new_lnb)) { + } else if (strcmp(old_lnb, new_lnb) != 0) { int lnb = dvb_sat_search_lnb(new_lnb); if (lnb < 0) { diff --git a/utils/dvb/dvbv5-scan.c b/utils/dvb/dvbv5-scan.c index 0a522433..30f8385f 100644 --- a/utils/dvb/dvbv5-scan.c +++ b/utils/dvb/dvbv5-scan.c @@ -288,7 +288,7 @@ static int run_scan(struct arguments *args, struct dvb_device *dvb) * to avoid linear search of LNB types for every entries. */ if (!args->lnb_name && entry->lnb && - (!parms->lnb || strcasecmp(entry->lnb, parms->lnb->alias))) + (!parms->lnb || strcasecmp(entry->lnb, parms->lnb->alias) != 0)) parms->lnb = dvb_sat_get_lnb(dvb_sat_search_lnb(entry->lnb)); /* diff --git a/utils/ir-ctl/ir-ctl.c b/utils/ir-ctl/ir-ctl.c index ba454619..9f8c1c5d 100644 --- a/utils/ir-ctl/ir-ctl.c +++ b/utils/ir-ctl/ir-ctl.c @@ -739,7 +739,7 @@ static struct send* convert_keycode(struct keymap *map, const char *keycode) struct raw_entry *re; for (re = map->raw; re; re = re->next) { - if (strcmp(re->keycode, keycode)) + if (strcmp(re->keycode, keycode) != 0) continue; count++; @@ -760,7 +760,7 @@ static struct send* convert_keycode(struct keymap *map, const char *keycode) const char *proto_str; enum rc_proto proto; - if (strcmp(se->keycode, keycode)) + if (strcmp(se->keycode, keycode) != 0) continue; count++; diff --git a/utils/keytable/keytable.c b/utils/keytable/keytable.c index 4db91267..2c76f52b 100644 --- a/utils/keytable/keytable.c +++ b/utils/keytable/keytable.c @@ -360,7 +360,7 @@ static void add_bpf_protocol(struct bpf_protocol *new) struct bpf_protocol *a; for (a = bpf_protocol; a; a = a->next) { - if (strcmp(a->name, new->name)) + if (strcmp(a->name, new->name) != 0) continue; if (compare_parameters(a->param, new->param) && @@ -2075,9 +2075,9 @@ int main(int argc, char *argv[]) int matches = 0; for (cur = &cfg; cur->next; cur = cur->next) { - if ((!rc_dev.drv_name || strcasecmp(cur->driver, rc_dev.drv_name)) && strcasecmp(cur->driver, "*")) + if ((!rc_dev.drv_name || strcasecmp(cur->driver, rc_dev.drv_name) != 0) && strcasecmp(cur->driver, "*") != 0) continue; - if ((!rc_dev.keytable_name || strcasecmp(cur->table, rc_dev.keytable_name)) && strcasecmp(cur->table, "*")) + if ((!rc_dev.keytable_name || strcasecmp(cur->table, rc_dev.keytable_name) != 0) && strcasecmp(cur->table, "*") != 0) continue; if (debug) diff --git a/utils/libmedia_dev/get_media_devices.c b/utils/libmedia_dev/get_media_devices.c index 491a94da..462b8b97 100644 --- a/utils/libmedia_dev/get_media_devices.c +++ b/utils/libmedia_dev/get_media_devices.c @@ -431,7 +431,7 @@ void display_media_devices(void *opaque) char *prev = ""; for (i = 0; i < md->md_size; i++) { - if (strcmp(prev, md_ptr->device)) { + if (strcmp(prev, md_ptr->device) != 0) { printf("\nDevice %s:\n\t", md_ptr->device); prev = md_ptr->device; } @@ -584,7 +584,7 @@ const char *get_not_associated_device(void *opaque, } if (last_seek && !found) continue; - if (strcmp(prev, md_ptr->device)) { + if (strcmp(prev, md_ptr->device) != 0) { if (!skip && result) break; prev = md_ptr->device; diff --git a/utils/media-ctl/libmediactl.c b/utils/media-ctl/libmediactl.c index 1fd6525b..6ef9a3f5 100644 --- a/utils/media-ctl/libmediactl.c +++ b/utils/media-ctl/libmediactl.c @@ -475,7 +475,7 @@ static int media_get_devname_sysfs(struct media_entity *entity) if (strstr(p + 1, "dvb")) { char *s = p + 1; - if (strncmp(s, "dvb", 3)) + if (strncmp(s, "dvb", 3) != 0) return -EINVAL; s += 3; p = strchr(s, '.'); diff --git a/utils/media-ctl/libv4l2subdev.c b/utils/media-ctl/libv4l2subdev.c index 0d0afbe7..3b4490aa 100644 --- a/utils/media-ctl/libv4l2subdev.c +++ b/utils/media-ctl/libv4l2subdev.c @@ -433,7 +433,7 @@ static bool strhazit(const char *str, const char **p) { int len = strlen(str); - if (strncmp(str, *p, len)) + if (strncmp(str, *p, len) != 0) return false; for (*p += len; isspace(**p); ++*p); diff --git a/utils/v4l2-compliance/v4l2-compliance.cpp b/utils/v4l2-compliance/v4l2-compliance.cpp index 938c7c35..0c3af294 100644 --- a/utils/v4l2-compliance/v4l2-compliance.cpp +++ b/utils/v4l2-compliance/v4l2-compliance.cpp @@ -620,14 +620,14 @@ static int testCap(struct node *node) fail_on_test(check_ustring(vcap.card, sizeof(vcap.card))); fail_on_test(check_ustring(vcap.bus_info, sizeof(vcap.bus_info))); // Check for valid prefixes - if (memcmp(vcap.bus_info, "usb-", 4) && - memcmp(vcap.bus_info, "PCI:", 4) && - memcmp(vcap.bus_info, "PCIe:", 5) && - memcmp(vcap.bus_info, "ISA:", 4) && - memcmp(vcap.bus_info, "I2C:", 4) && - memcmp(vcap.bus_info, "parport", 7) && - memcmp(vcap.bus_info, "platform:", 9) && - memcmp(vcap.bus_info, "rmi4:", 5)) + if (memcmp(vcap.bus_info, "usb-", 4) != 0 && + memcmp(vcap.bus_info, "PCI:", 4) != 0 && + memcmp(vcap.bus_info, "PCIe:", 5) != 0 && + memcmp(vcap.bus_info, "ISA:", 4) != 0 && + memcmp(vcap.bus_info, "I2C:", 4) != 0 && + memcmp(vcap.bus_info, "parport", 7) != 0 && + memcmp(vcap.bus_info, "platform:", 9) != 0 && + memcmp(vcap.bus_info, "rmi4:", 5) != 0) return fail("missing bus_info prefix ('%s')\n", vcap.bus_info); if (!node->media_bus_info.empty() && node->media_bus_info != std::string(reinterpret_cast(vcap.bus_info))) @@ -834,7 +834,7 @@ static int open_media_bus_info(const std::string &bus_info, std::string &media_d while ((ep = readdir(dp))) { const char *name = ep->d_name; - if (!memcmp(name, "media", 5) && isdigit(name[5])) { + if ((!memcmp(name, "media", 5) != 0) && isdigit(name[5])) { struct media_device_info mdi; media_devname = std::string("/dev/") + name; diff --git a/utils/v4l2-compliance/v4l2-test-buffers.cpp b/utils/v4l2-compliance/v4l2-test-buffers.cpp index 3b45711d..004de314 100644 --- a/utils/v4l2-compliance/v4l2-test-buffers.cpp +++ b/utils/v4l2-compliance/v4l2-test-buffers.cpp @@ -1011,7 +1011,7 @@ static int captureBufs(struct node *node, struct node *node_m2m_cap, const cv4l_ (orig_buf.flags & valid_output_flags)); if (buf.g_flags() & V4L2_BUF_FLAG_TIMECODE) fail_on_test(memcmp(&buf.g_timecode(), &orig_buf.timecode, - sizeof(orig_buf.timecode))); + sizeof(orig_buf.timecode)) != 0); } fail_on_test(buf.g_flags() & V4L2_BUF_FLAG_DONE); @@ -1085,7 +1085,7 @@ static int captureBufs(struct node *node, struct node *node_m2m_cap, const cv4l_ (orig_buf.flags & valid_output_flags)); if (buf.g_flags() & V4L2_BUF_FLAG_TIMECODE) fail_on_test(memcmp(&buf.g_timecode(), &orig_buf.timecode, - sizeof(orig_buf.timecode))); + sizeof(orig_buf.timecode)) != 0); } fail_on_test(buf.g_flags() & V4L2_BUF_FLAG_DONE); if (!count || stopped) { diff --git a/utils/v4l2-compliance/v4l2-test-media.cpp b/utils/v4l2-compliance/v4l2-test-media.cpp index bcd8a725..bcba3b15 100644 --- a/utils/v4l2-compliance/v4l2-test-media.cpp +++ b/utils/v4l2-compliance/v4l2-test-media.cpp @@ -53,14 +53,14 @@ int testMediaDeviceInfo(struct node *node) } else { fail_on_test(check_string(mdinfo.bus_info, sizeof(mdinfo.bus_info))); // Check for valid prefixes - if (memcmp(mdinfo.bus_info, "usb-", 4) && - memcmp(mdinfo.bus_info, "PCI:", 4) && - memcmp(mdinfo.bus_info, "PCIe:", 5) && - memcmp(mdinfo.bus_info, "ISA:", 4) && - memcmp(mdinfo.bus_info, "I2C:", 4) && - memcmp(mdinfo.bus_info, "parport", 7) && - memcmp(mdinfo.bus_info, "platform:", 9) && - memcmp(mdinfo.bus_info, "rmi4:", 5)) + if (memcmp(mdinfo.bus_info, "usb-", 4) != 0 && + memcmp(mdinfo.bus_info, "PCI:", 4) != 0 && + memcmp(mdinfo.bus_info, "PCIe:", 5) != 0 && + memcmp(mdinfo.bus_info, "ISA:", 4) != 0 && + memcmp(mdinfo.bus_info, "I2C:", 4) != 0 && + memcmp(mdinfo.bus_info, "parport", 7) != 0 && + memcmp(mdinfo.bus_info, "platform:", 9) != 0 && + memcmp(mdinfo.bus_info, "rmi4:", 5) != 0) return fail("missing bus_info prefix ('%s')\n", mdinfo.bus_info); } fail_on_test(mdinfo.media_version == 0); diff --git a/utils/v4l2-compliance/v4l2-test-subdevs.cpp b/utils/v4l2-compliance/v4l2-test-subdevs.cpp index 489639fb..998f63be 100644 --- a/utils/v4l2-compliance/v4l2-test-subdevs.cpp +++ b/utils/v4l2-compliance/v4l2-test-subdevs.cpp @@ -433,7 +433,7 @@ int testSubDevSelection(struct node *node, unsigned which, unsigned pad) fail_on_test(check_0(crop.reserved, sizeof(crop.reserved))); fail_on_test(crop.which != which); fail_on_test(crop.pad != pad); - fail_on_test(memcmp(&crop.rect, &sel.r, sizeof(sel.r))); + fail_on_test(memcmp(&crop.rect, &sel.r, sizeof(sel.r)) != 0); for (unsigned tgt = 0; targets[tgt].target != ~0U; tgt++) { targets[tgt].found = false; @@ -476,7 +476,7 @@ int testSubDevSelection(struct node *node, unsigned which, unsigned pad) fail_on_test(check_0(crop.reserved, sizeof(crop.reserved))); fail_on_test(crop.which != which); fail_on_test(crop.pad != pad); - fail_on_test(memcmp(&crop.rect, &sel.r, sizeof(sel.r))); + fail_on_test(memcmp(&crop.rect, &sel.r, sizeof(sel.r)) != 0); } } fail_on_test(!ret && targets[tgt].readonly); diff --git a/utils/v4l2-ctl/v4l2-ctl-common.cpp b/utils/v4l2-ctl/v4l2-ctl-common.cpp index f2997951..5dde39b9 100644 --- a/utils/v4l2-ctl/v4l2-ctl-common.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-common.cpp @@ -190,7 +190,7 @@ static void list_media_devices(const std::string &media_bus_info) std::string s("/dev/"); s += ep->d_name; - if (memcmp(ep->d_name, "media", 5)) { + if (memcmp(ep->d_name, "media", 5) != 0) { if (!is_v4l_dev(ep->d_name)) continue; struct stat st; From patchwork Mon Apr 20 18:46:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 11499667 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C4C3215AB for ; Mon, 20 Apr 2020 18:46:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AB1AB208FE for ; Mon, 20 Apr 2020 18:46:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="IPjH7gfz" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728130AbgDTSq4 (ORCPT ); Mon, 20 Apr 2020 14:46:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728118AbgDTSqz (ORCPT ); Mon, 20 Apr 2020 14:46:55 -0400 Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A883C061A10 for ; Mon, 20 Apr 2020 11:46:55 -0700 (PDT) Received: by mail-pf1-x42f.google.com with SMTP id x3so5371462pfp.7 for ; Mon, 20 Apr 2020 11:46:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=YMKCiBqOo3NYeVY2TxxXAO5i0dheV6Bw/cbrfxZRXk8=; b=IPjH7gfz8PHBS2a1xbaP/i5y0daI/qVxVqctG0H95pcgdvmeJbcUVfVhWw84lEFjn2 fcqczc7S+RoT+jH0ZeQMJ8yFuD4nB8X6KP68/2x/dxljriXRU1Jbag7hpZ5WswNJ+EWW 979q1bXJc5ydByFX8NpXS0nO2WHj2Kasis0MMGl0a2JSTFEx9H1/YXyOjJR3sKDMRqYy J0zUgM+aGCjxkki8FcAyHcpKofrrYuTuaPHnYrpgzK+6u7/YO5O052C8fgwT68/4kxAJ hZxpBPahfRpmzP3PseXOXYalDNGYiywKlxr1Q7AeoqcR4Q39NgLbS/YHHmieAVH6GGoR vAzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YMKCiBqOo3NYeVY2TxxXAO5i0dheV6Bw/cbrfxZRXk8=; b=Y9QBiyWZ+sbI8F4zbB/a8LIac2i7dNAAQVUuJjaXjp+moiJMY69ML1mKRfD8ixsdnq bddkAvSxlBmPPNhtayLXXQYoKyB21cZahy0aKe8knOOQz22EVZ6tdWlPs6EKi+5BPgfJ teZUZ1ZQwjL/8eOnjOQjXbqtYF30EFPROQ5/n1FxmazwYvQ2cfGlCtjJ9nJmlkSY3i0S y4SFR/7pHdPUQgqWsB4XW1sULkNQnmwhBzunAk4iiPoX/XSQSCwnCuNorTUUjJnpwWiG d3uzbPpYGZ7kJuFPpbYNM3bmP1ZTxTF7yTYFKKNHFbxlQDStDOF8K+SQHxnQuP2nskIs 1fGQ== X-Gm-Message-State: AGi0PubocgKdAyZyf8Nt6Id4FEFV7ER6wx2qP/+20ACzBMG6J4NhLFPM Sy5wwEZg/DY2p7TznvYY74UZpefL X-Google-Smtp-Source: APiQypIAk/Na4lvV5wIF+8hRm8zaguXIOnrdZZV6YIugM+bCIOyZbMOE9GMif5CrW5Wv+bbVd+8m9A== X-Received: by 2002:a63:5fd0:: with SMTP id t199mr18145536pgb.207.1587408414717; Mon, 20 Apr 2020 11:46:54 -0700 (PDT) Received: from localhost.localdomain (76-14-109-232.rk.wavecable.com. [76.14.109.232]) by smtp.gmail.com with ESMTPSA id n8sm182443pfq.213.2020.04.20.11.46.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Apr 2020 11:46:54 -0700 (PDT) From: Rosen Penev To: linux-media@vger.kernel.org Subject: [PATCH 4/7] treewide: apply performance fixes Date: Mon, 20 Apr 2020 11:46:46 -0700 Message-Id: <20200420184649.4202-4-rosenp@gmail.com> X-Mailer: git-send-email 2.25.2 In-Reply-To: <20200420184649.4202-1-rosenp@gmail.com> References: <20200420184649.4202-1-rosenp@gmail.com> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Found with performance* Signed-off-by: Rosen Penev --- utils/v4l2-compliance/v4l2-compliance.cpp | 2 +- utils/v4l2-compliance/v4l2-compliance.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/v4l2-compliance/v4l2-compliance.cpp b/utils/v4l2-compliance/v4l2-compliance.cpp index 0c3af294..bb32bae6 100644 --- a/utils/v4l2-compliance/v4l2-compliance.cpp +++ b/utils/v4l2-compliance/v4l2-compliance.cpp @@ -301,7 +301,7 @@ int check_0(const void *p, int len) static std::map stream_from_map; static std::map stream_hdr_map; -std::string stream_from(std::string pixelformat, bool &use_hdr) +std::string stream_from(const std::string& pixelformat, bool &use_hdr) { if (stream_from_map.find(pixelformat) == stream_from_map.end()) { if (pixelformat.empty()) diff --git a/utils/v4l2-compliance/v4l2-compliance.h b/utils/v4l2-compliance/v4l2-compliance.h index 43754519..921e15be 100644 --- a/utils/v4l2-compliance/v4l2-compliance.h +++ b/utils/v4l2-compliance/v4l2-compliance.h @@ -263,7 +263,7 @@ int check_0(const void *p, int len); int restoreFormat(struct node *node); void testNode(struct node &node, struct node &node_m2m_cap, struct node &expbuf_node, media_type type, unsigned frame_count, unsigned all_fmt_frame_count); -std::string stream_from(std::string pixelformat, bool &use_hdr); +std::string stream_from(const std::string& pixelformat, bool &use_hdr); // Media Controller ioctl tests int testMediaDeviceInfo(struct node *node); From patchwork Mon Apr 20 18:46:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 11499669 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A2A4B913 for ; Mon, 20 Apr 2020 18:46:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7F511208FE for ; Mon, 20 Apr 2020 18:46:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JpEf1otN" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728132AbgDTSq5 (ORCPT ); Mon, 20 Apr 2020 14:46:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726439AbgDTSq4 (ORCPT ); Mon, 20 Apr 2020 14:46:56 -0400 Received: from mail-pg1-x532.google.com (mail-pg1-x532.google.com [IPv6:2607:f8b0:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1551C061A0C for ; Mon, 20 Apr 2020 11:46:56 -0700 (PDT) Received: by mail-pg1-x532.google.com with SMTP id w11so5500266pga.12 for ; Mon, 20 Apr 2020 11:46:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=g68zxpe+2p1NhAysww2SRNsJk2ocGU1FZ0mv5f1WMCw=; b=JpEf1otNdl4cQ2Pt/XJibMzCWmcxMgt27j75VnGmysvSuoQwds15nqMtc6UBs4iq/2 cEgS48p/ZGRT0c0TCsOM8ZU2+9FLr96ocGO9ghYx+1k8gUD+qY/a0b61thjy2Ib2+Pp1 1Je/l1WH6k0/u5SbJTiIGULEVuDGeHpqJCju9lvbKX6A7WW5HtIUcfz4ZMJF+sHUydrK mWxmH3jzkwSLtDOD8pR1vucjPOOg58KCEiS2mjo5ZCGdohLD96aNOaCo+Itl8B75UmHN o3p5fivoo/KEdZBZ2XKnPPUlmn7uo71uNMBT+jUv/VJtDAb9vc30rc6iNr+5kjEd4Ezz R2mQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=g68zxpe+2p1NhAysww2SRNsJk2ocGU1FZ0mv5f1WMCw=; b=fCOhu1tC1p7OZoJlaRRhVBOdXsAPkQghTnB8yfciBs+N+cTHhTkvXpzLUhOIyvT0q0 Aq2kVuDNJQ86HwQBcXQI9yWDMARdyEMgHQIHoSG/UObeAs2ZLcUr5tJPIcPqMLTdiJZg iRdwmoEGKm0L1WvjUycDeA4dKLq+0yMnVpUAL5TNT/j1ywB2HMySukSE+nkOuQlQ5I5G oMjbsTCqxFbtk38rJIjEKJrJA02onQY4rDXJHqomZExBbhmWgcpndJrngW7ybwvUxyWs /4Sb4on9zcCexDGV+ODUmuTAPeAdzIVgPl4CMAv+x0A9GKxhvY881ook46WrgZSZPukp JuJA== X-Gm-Message-State: AGi0Pua4oXuDZfGGiSj8HwCL3O48Roplt8RiHaR+7IYMsM0LnNAnwQbO v20SC/qfz3iI1+X3Vt1efKfxCWhP X-Google-Smtp-Source: APiQypKglNl/Nv97ICUb6Zee1CnoZoEhs4ebLDlnrDTzOo0yHA0PKOpj1vb1quBImGavTeec8uzUyg== X-Received: by 2002:a62:62c3:: with SMTP id w186mr17641447pfb.105.1587408415991; Mon, 20 Apr 2020 11:46:55 -0700 (PDT) Received: from localhost.localdomain (76-14-109-232.rk.wavecable.com. [76.14.109.232]) by smtp.gmail.com with ESMTPSA id n8sm182443pfq.213.2020.04.20.11.46.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Apr 2020 11:46:55 -0700 (PDT) From: Rosen Penev To: linux-media@vger.kernel.org Subject: [PATCH 5/7] media-info: fix NULL check Date: Mon, 20 Apr 2020 11:46:47 -0700 Message-Id: <20200420184649.4202-5-rosenp@gmail.com> X-Mailer: git-send-email 2.25.2 In-Reply-To: <20200420184649.4202-1-rosenp@gmail.com> References: <20200420184649.4202-1-rosenp@gmail.com> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Found with clang-tidy's bugprone-bool-pointer-implicit-conversion Signed-off-by: Rosen Penev --- utils/common/media-info.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/common/media-info.cpp b/utils/common/media-info.cpp index b0f0bc41..cb48d0df 100644 --- a/utils/common/media-info.cpp +++ b/utils/common/media-info.cpp @@ -357,7 +357,7 @@ std::string mi_entfunction2s(__u32 function, bool *is_invalid) return fail ? entity_functions_def[i].str + 6 : entity_functions_def[i].str; } } - if (is_invalid) + if (is_invalid != NULL) return "WARNING: Unknown Function (" + num2s(function) + "), is v4l2-compliance out-of-date?"; return "Unknown Function (" + num2s(function) + ")"; } From patchwork Mon Apr 20 18:46:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 11499673 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D368C15AB for ; Mon, 20 Apr 2020 18:47:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B23C32084D for ; Mon, 20 Apr 2020 18:47:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="jm1pOrUq" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728155AbgDTSrA (ORCPT ); Mon, 20 Apr 2020 14:47:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726439AbgDTSq5 (ORCPT ); Mon, 20 Apr 2020 14:46:57 -0400 Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF736C061A0C for ; Mon, 20 Apr 2020 11:46:57 -0700 (PDT) Received: by mail-pg1-x52f.google.com with SMTP id q18so1975593pgm.11 for ; Mon, 20 Apr 2020 11:46:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=dbc6bBjmOjn91LFI3iLqIf4tlnB59fgQ2kz1YMzz1Iw=; b=jm1pOrUqECvH7wTzwvS6uJZwmzoYl8oAtZnWNCgRJ3WqTPu22R5L9kzFqv0SFuQ1Fw AkdrmOmOpNvWzYm2v/cI5Pxq5/jTB+px7U6TGiXDZF6eq1wt1lijHp9Q+EjZ6SWUvjI5 5NMiZcNXNw7xdv5hEdF8mIYcXgShT7Omm9GZ+P3aesxBE15MnfMTPFtbl6UTklBvisxm 3Ia1UCheSIN1Am90h8V1agXmGOCNk/WXlEcpX+U9SzDAUDZMrfKq84BP0BUHnUJvEFX9 uR1uxMRdUKYfl4jgQiw6kMVMJ17dpKkTJcTMfphOpqE/sp/jmxeSZi/+e2c95zapr8t/ C/1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dbc6bBjmOjn91LFI3iLqIf4tlnB59fgQ2kz1YMzz1Iw=; b=p7U5gXVY6fAOZbk0YlNnI0Jsrn5WQaGJlAAMkATwKmoqtg725UNDZv5u+R9Q2a6mLD 6KnWKjm/kjYNIanmNmSdyNzUR2+cnH42Vi/t7F7KM+RQYQaPVpuYZgPSxSb009sv9EUn J3svwKL3YIAmxRM+ehnfGXJiBxmGOwjGbuRAZhm6cc2lAmRhKk/1AcqghJq4vKaHqc+M c3+ofbHthv1lXYENAKc5dA/FjOadDKYJ/3fsoYAip02DqszC5zc0Zb+/8RTBF1547ya4 MgRTI9I4U3rqZgnYOPjh2TfkNaR9qpc733ziBAvczLdld4syHVSBhpwPZFvs22uC1tLQ ReMw== X-Gm-Message-State: AGi0PuaCZol9uR1PD+0ZD0IUH4XtWzHU5kfoABLLVv5ENyf7LVMKnad+ KIAe0eC2m1uWKUwtIVdc2ygGE8Wj X-Google-Smtp-Source: APiQypKGSrtAwaGUNy5rXKy0JIuANfVfYYWAuLKRjDXxGWNfmCUWlyJPPebK5WGDzVpeV/Q+QEnKUg== X-Received: by 2002:a62:144c:: with SMTP id 73mr18482789pfu.37.1587408417012; Mon, 20 Apr 2020 11:46:57 -0700 (PDT) Received: from localhost.localdomain (76-14-109-232.rk.wavecable.com. [76.14.109.232]) by smtp.gmail.com with ESMTPSA id n8sm182443pfq.213.2020.04.20.11.46.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Apr 2020 11:46:56 -0700 (PDT) From: Rosen Penev To: linux-media@vger.kernel.org Subject: [PATCH 6/7] utils: use bool literals Date: Mon, 20 Apr 2020 11:46:48 -0700 Message-Id: <20200420184649.4202-6-rosenp@gmail.com> X-Mailer: git-send-email 2.25.2 In-Reply-To: <20200420184649.4202-1-rosenp@gmail.com> References: <20200420184649.4202-1-rosenp@gmail.com> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Found with clang-tidy's modernize-use-bool-literals Signed-off-by: Rosen Penev --- utils/cec-compliance/cec-compliance.cpp | 2 +- utils/cec-compliance/cec-test.cpp | 2 +- utils/cec-ctl/cec-ctl.cpp | 2 +- utils/cec-follower/cec-follower.cpp | 2 +- utils/cec-follower/cec-processing.cpp | 2 +- utils/rds-ctl/rds-ctl.cpp | 2 +- utils/v4l2-compliance/v4l2-compliance.cpp | 4 ++-- utils/v4l2-ctl/v4l2-ctl-streaming.cpp | 2 +- utils/v4l2-ctl/v4l2-ctl.cpp | 6 +++--- utils/v4l2-dbg/v4l2-dbg.cpp | 2 +- 10 files changed, 13 insertions(+), 13 deletions(-) diff --git a/utils/cec-compliance/cec-compliance.cpp b/utils/cec-compliance/cec-compliance.cpp index b665303e..6d07bfc9 100644 --- a/utils/cec-compliance/cec-compliance.cpp +++ b/utils/cec-compliance/cec-compliance.cpp @@ -1166,7 +1166,7 @@ int main(int argc, char **argv) short_options[idx++] = ':'; } } - while (1) { + while (true) { int option_index = 0; short_options[idx] = 0; diff --git a/utils/cec-compliance/cec-test.cpp b/utils/cec-compliance/cec-test.cpp index 4aa54afc..a82069ad 100644 --- a/utils/cec-compliance/cec-test.cpp +++ b/utils/cec-compliance/cec-test.cpp @@ -889,7 +889,7 @@ static int tuner_ctl_test(struct node *node, unsigned me, unsigned la, bool inte if (ret) return ret; - while (1) { + while (true) { cec_msg_init(&msg, me, la); cec_msg_tuner_step_increment(&msg); fail_on_test(!transmit(node, &msg)); diff --git a/utils/cec-ctl/cec-ctl.cpp b/utils/cec-ctl/cec-ctl.cpp index be37ae3c..46cfcd80 100644 --- a/utils/cec-ctl/cec-ctl.cpp +++ b/utils/cec-ctl/cec-ctl.cpp @@ -1863,7 +1863,7 @@ int main(int argc, char **argv) if (long_options[i].has_arg == required_argument) short_options[idx++] = ':'; } - while (1) { + while (true) { int option_index = 0; struct cec_msg msg; diff --git a/utils/cec-follower/cec-follower.cpp b/utils/cec-follower/cec-follower.cpp index 12bb5f15..ab3113b6 100644 --- a/utils/cec-follower/cec-follower.cpp +++ b/utils/cec-follower/cec-follower.cpp @@ -331,7 +331,7 @@ int main(int argc, char **argv) short_options[idx++] = ':'; } } - while (1) { + while (true) { int option_index = 0; short_options[idx] = 0; diff --git a/utils/cec-follower/cec-processing.cpp b/utils/cec-follower/cec-processing.cpp index 34b54fa3..8e3a33a2 100644 --- a/utils/cec-follower/cec-processing.cpp +++ b/utils/cec-follower/cec-processing.cpp @@ -885,7 +885,7 @@ void testProcessing(struct node *node, bool wallclock) poll_remote_devs(node, me); - while (1) { + while (true) { int res; struct timeval timeval = {}; diff --git a/utils/rds-ctl/rds-ctl.cpp b/utils/rds-ctl/rds-ctl.cpp index 2d561481..fef2a3f1 100644 --- a/utils/rds-ctl/rds-ctl.cpp +++ b/utils/rds-ctl/rds-ctl.cpp @@ -757,7 +757,7 @@ static int parse_cl(int argc, char **argv) if (long_options[i].has_arg == required_argument) short_options[idx++] = ':'; } - while (1) { + while (true) { int option_index = 0; short_options[idx] = 0; diff --git a/utils/v4l2-compliance/v4l2-compliance.cpp b/utils/v4l2-compliance/v4l2-compliance.cpp index bb32bae6..39dd1aec 100644 --- a/utils/v4l2-compliance/v4l2-compliance.cpp +++ b/utils/v4l2-compliance/v4l2-compliance.cpp @@ -834,7 +834,7 @@ static int open_media_bus_info(const std::string &bus_info, std::string &media_d while ((ep = readdir(dp))) { const char *name = ep->d_name; - if ((!memcmp(name, "media", 5) != 0) && isdigit(name[5])) { + if ((!(memcmp(name, "media", 5) != 0)) && isdigit(name[5])) { struct media_device_info mdi; media_devname = std::string("/dev/") + name; @@ -1519,7 +1519,7 @@ int main(int argc, char **argv) short_options[idx++] = ':'; } } - while (1) { + while (true) { int option_index = 0; short_options[idx] = 0; diff --git a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp index de40c5ad..833263b6 100644 --- a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp @@ -2742,7 +2742,7 @@ static void streaming_set_cap2out(cv4l_fd &fd, cv4l_fd &out_fd) if (use_poll) fcntl(fd.g_fd(), F_SETFL, fd_flags | O_NONBLOCK); - while (1) { + while (true) { struct timeval tv = { use_poll ? 2 : 0, 0 }; int r = 0; diff --git a/utils/v4l2-ctl/v4l2-ctl.cpp b/utils/v4l2-ctl/v4l2-ctl.cpp index 42889ef8..c0097203 100644 --- a/utils/v4l2-ctl/v4l2-ctl.cpp +++ b/utils/v4l2-ctl/v4l2-ctl.cpp @@ -1145,7 +1145,7 @@ int main(int argc, char **argv) short_options[idx++] = ':'; } } - while (1) { + while (true) { int option_index = 0; short_options[idx] = 0; @@ -1531,7 +1531,7 @@ int main(int argc, char **argv) __u32 seq = 0; fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_NONBLOCK); - while (1) { + while (true) { int res; FD_ZERO(&fds); @@ -1572,7 +1572,7 @@ int main(int argc, char **argv) fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_NONBLOCK); epoll_ctl(epollfd, EPOLL_CTL_ADD, fd, &epoll_ev); - while (1) { + while (true) { int res; res = epoll_wait(epollfd, &epoll_ev, 1, -1); diff --git a/utils/v4l2-dbg/v4l2-dbg.cpp b/utils/v4l2-dbg/v4l2-dbg.cpp index 17ab0210..dcf8200a 100644 --- a/utils/v4l2-dbg/v4l2-dbg.cpp +++ b/utils/v4l2-dbg/v4l2-dbg.cpp @@ -442,7 +442,7 @@ int main(int argc, char **argv) short_options[idx++] = ':'; } } - while (1) { + while (true) { int option_index = 0; short_options[idx] = 0; From patchwork Mon Apr 20 18:46:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 11499671 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 67706913 for ; Mon, 20 Apr 2020 18:47:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 448D52084D for ; Mon, 20 Apr 2020 18:47:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="b3kin/z+" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728152AbgDTSrA (ORCPT ); Mon, 20 Apr 2020 14:47:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728151AbgDTSq7 (ORCPT ); Mon, 20 Apr 2020 14:46:59 -0400 Received: from mail-pl1-x642.google.com (mail-pl1-x642.google.com [IPv6:2607:f8b0:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0978C061A0C for ; Mon, 20 Apr 2020 11:46:58 -0700 (PDT) Received: by mail-pl1-x642.google.com with SMTP id ay1so4288058plb.0 for ; Mon, 20 Apr 2020 11:46:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=pmXgVfrCaEJM4XqVQF1wL6sqq2+r90tusGJ6s4f3xzY=; b=b3kin/z+Cvl+1rYfGzrN3EvGx9pjv2rXI+SI71Jc/n9f9F4/yz0UIEVatY2EIMDnSu Gjyvzt7Vvqs8U1xwpVAdCw4G6teI7EcJKQrvWUhKiJM7JbidCDRMQL6+msZblINEDFwm iAmXn17f2JA1NkAD5OCendXgE7H4KelxAkuaLOgB8SiRxxxUVRJjNxxU2aTIS3PgvCEQ KdO5c83inIyQDEh7tAw9epuNwhhSNutG3KUskXx8M6u1i08v34oO9Gvu5+HAP7Zd3P4/ CNXYX3aVAZyYGwMPYaaRQgft8Drnn0bjT398lQWYr2RZB6aRcm/PsKjvFPPqUmhzv5xi 26ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pmXgVfrCaEJM4XqVQF1wL6sqq2+r90tusGJ6s4f3xzY=; b=JjqPKCfEwsBk61KLpk9oHwLVap+xLvxYSd9eBA4SC/yD9yv7Gytmi8miluFkaxIpdh NwMfeD1wNzZn2d4yUyzSHVnoFfYkmXpiJVndL86+//kL32nNpIsbO+PAHgWW/VUZiD27 FYx88eCJAXShLiEDGKWhIDa3BgaNj0YEyEfS12gG9oBT87bOyG3XElfZO3eFIW3UK8Lq b0msiNwOTTbmtaxw2zIq/QhpKzKwiaQLFO/k7AETFnomeBvgTND4z9NLp2b3Hsm1k+IW nB9BxUcs3fWFLKFdlY8dgBBdl/9+eBid41Dhcx0wXKmi71LvTzoGxhxpMA/4DBI70Inb /FRg== X-Gm-Message-State: AGi0PuY3EuI7Esmd4p/JVcJqw8MJXoiU7VpbpZdMUXJH7LLmUzNbe0z5 onDMGEe8fNdNZ/K6hND0yuuRCYJE X-Google-Smtp-Source: APiQypLh5xDWTcNC0FCOjy1erKlUez/CbmwK/di55CAAGf8+D4NLmymaB+rTe9nHxsoqFs4wvfv9Mw== X-Received: by 2002:a17:902:bd8f:: with SMTP id q15mr1489840pls.76.1587408417937; Mon, 20 Apr 2020 11:46:57 -0700 (PDT) Received: from localhost.localdomain (76-14-109-232.rk.wavecable.com. [76.14.109.232]) by smtp.gmail.com with ESMTPSA id n8sm182443pfq.213.2020.04.20.11.46.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Apr 2020 11:46:57 -0700 (PDT) From: Rosen Penev To: linux-media@vger.kernel.org Subject: [PATCH 7/7] utils: do not use empty void with C++ Date: Mon, 20 Apr 2020 11:46:49 -0700 Message-Id: <20200420184649.4202-7-rosenp@gmail.com> X-Mailer: git-send-email 2.25.2 In-Reply-To: <20200420184649.4202-1-rosenp@gmail.com> References: <20200420184649.4202-1-rosenp@gmail.com> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Found with clang-tidy's modernize-redundant-void-arg Signed-off-by: Rosen Penev --- utils/cec-compliance/cec-compliance.cpp | 2 +- utils/cec-compliance/cec-test.cpp | 4 ++-- utils/cec-ctl/cec-ctl.cpp | 2 +- utils/cec-follower/cec-follower.cpp | 2 +- utils/rds-ctl/rds-ctl.cpp | 12 ++++++------ utils/v4l2-compliance/v4l2-compliance.cpp | 2 +- utils/v4l2-ctl/v4l2-ctl-common.cpp | 2 +- utils/v4l2-ctl/v4l2-ctl-edid.cpp | 2 +- utils/v4l2-ctl/v4l2-ctl-io.cpp | 2 +- utils/v4l2-ctl/v4l2-ctl-meta.cpp | 2 +- utils/v4l2-ctl/v4l2-ctl-misc.cpp | 2 +- utils/v4l2-ctl/v4l2-ctl-overlay.cpp | 2 +- utils/v4l2-ctl/v4l2-ctl-sdr.cpp | 2 +- utils/v4l2-ctl/v4l2-ctl-selection.cpp | 2 +- utils/v4l2-ctl/v4l2-ctl-stds.cpp | 2 +- utils/v4l2-ctl/v4l2-ctl-streaming.cpp | 2 +- utils/v4l2-ctl/v4l2-ctl-subdev.cpp | 2 +- utils/v4l2-ctl/v4l2-ctl-tuner.cpp | 2 +- utils/v4l2-ctl/v4l2-ctl-vbi.cpp | 2 +- utils/v4l2-ctl/v4l2-ctl-vidcap.cpp | 2 +- utils/v4l2-ctl/v4l2-ctl-vidout.cpp | 2 +- utils/v4l2-ctl/v4l2-ctl.cpp | 2 +- utils/v4l2-dbg/v4l2-dbg.cpp | 2 +- 23 files changed, 29 insertions(+), 29 deletions(-) diff --git a/utils/cec-compliance/cec-compliance.cpp b/utils/cec-compliance/cec-compliance.cpp index 6d07bfc9..713e2a58 100644 --- a/utils/cec-compliance/cec-compliance.cpp +++ b/utils/cec-compliance/cec-compliance.cpp @@ -178,7 +178,7 @@ static struct option long_options[] = { {0, 0, 0, 0} }; -static void usage(void) +static void usage() { printf("Usage:\n" " -d, --device Use device instead of /dev/cec0\n" diff --git a/utils/cec-compliance/cec-test.cpp b/utils/cec-compliance/cec-test.cpp index a82069ad..af9f3d38 100644 --- a/utils/cec-compliance/cec-test.cpp +++ b/utils/cec-compliance/cec-test.cpp @@ -1494,7 +1494,7 @@ static const unsigned num_tests = sizeof(tests) / sizeof(struct remote_test); static std::map mapTests; static std::map mapTestsNoWarnings; -void collectTests(void) +void collectTests() { std::map mapTestFuncs; @@ -1516,7 +1516,7 @@ void collectTests(void) } } -void listTests(void) +void listTests() { for (unsigned i = 0; i < num_tests; i++) { printf("%s:\n", tests[i].name); diff --git a/utils/cec-ctl/cec-ctl.cpp b/utils/cec-ctl/cec-ctl.cpp index 46cfcd80..929928e2 100644 --- a/utils/cec-ctl/cec-ctl.cpp +++ b/utils/cec-ctl/cec-ctl.cpp @@ -229,7 +229,7 @@ static struct option long_options[] = { { 0, 0, 0, 0 } }; -static void usage(void) +static void usage() { printf("Usage:\n" " -d, --device Use device instead of /dev/cec0\n" diff --git a/utils/cec-follower/cec-follower.cpp b/utils/cec-follower/cec-follower.cpp index ab3113b6..36bd2fbb 100644 --- a/utils/cec-follower/cec-follower.cpp +++ b/utils/cec-follower/cec-follower.cpp @@ -71,7 +71,7 @@ static struct option long_options[] = { { 0, 0, 0, 0 } }; -static void usage(void) +static void usage() { printf("Usage:\n" " -d, --device Use device instead of /dev/cec0\n" diff --git a/utils/rds-ctl/rds-ctl.cpp b/utils/rds-ctl/rds-ctl.cpp index fef2a3f1..0511fe5d 100644 --- a/utils/rds-ctl/rds-ctl.cpp +++ b/utils/rds-ctl/rds-ctl.cpp @@ -108,12 +108,12 @@ static struct option long_options[] = { {0, 0, 0, 0} }; -static void usage_hint(void) +static void usage_hint() { fprintf(stderr, "Try 'rds-ctl --help' for more information.\n"); } -static void usage_common(void) +static void usage_common() { printf("\nGeneral/Common options:\n" " --all display all device information available\n" @@ -127,7 +127,7 @@ static void usage_common(void) ); } -static void usage_tuner(void) +static void usage_tuner() { printf("\nTuner/Modulator options:\n" " -F, --get-freq query the frequency [VIDIOC_G_FREQUENCY]\n" @@ -145,7 +145,7 @@ static void usage_tuner(void) ); } -static void usage_rds(void) +static void usage_rds() { printf("\nRDS options: \n" " -b, --rbds parse the RDS data according to the RBDS standard\n" @@ -164,7 +164,7 @@ static void usage_rds(void) ); } -static void usage(void) +static void usage() { printf("Usage:\n"); usage_common(); @@ -326,7 +326,7 @@ static void print_devices(dev_vec files) printf("%s\n", iter->second.c_str()); } } -static dev_vec list_devices(void) +static dev_vec list_devices() { DIR *dp; struct dirent *ep; diff --git a/utils/v4l2-compliance/v4l2-compliance.cpp b/utils/v4l2-compliance/v4l2-compliance.cpp index 39dd1aec..3211b492 100644 --- a/utils/v4l2-compliance/v4l2-compliance.cpp +++ b/utils/v4l2-compliance/v4l2-compliance.cpp @@ -155,7 +155,7 @@ static struct option long_options[] = { {0, 0, 0, 0} }; -static void usage(void) +static void usage() { printf("Usage:\n"); printf("Common options:\n"); diff --git a/utils/v4l2-ctl/v4l2-ctl-common.cpp b/utils/v4l2-ctl/v4l2-ctl-common.cpp index 5dde39b9..3ca02087 100644 --- a/utils/v4l2-ctl/v4l2-ctl-common.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-common.cpp @@ -55,7 +55,7 @@ static enum v4l2_priority prio = V4L2_PRIORITY_UNSET; static bool have_query_ext_ctrl; -void common_usage(void) +void common_usage() { printf("\nGeneral/Common options:\n" " --all display all information available\n" diff --git a/utils/v4l2-ctl/v4l2-ctl-edid.cpp b/utils/v4l2-ctl/v4l2-ctl-edid.cpp index 366e6522..9c7c6bc4 100644 --- a/utils/v4l2-ctl/v4l2-ctl-edid.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-edid.cpp @@ -122,7 +122,7 @@ static __u8 toggle_hdr_md_flags; #define HDR_MD_SMPTE_2084 (1 << 2) #define HDR_MD_HLG (1 << 3) -void edid_usage(void) +void edid_usage() { printf("\nEDID options:\n" " --set-edid pad=[,type=|file=][,format=][modifiers]\n" diff --git a/utils/v4l2-ctl/v4l2-ctl-io.cpp b/utils/v4l2-ctl/v4l2-ctl-io.cpp index 1130fdc0..9e83c03a 100644 --- a/utils/v4l2-ctl/v4l2-ctl-io.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-io.cpp @@ -21,7 +21,7 @@ static struct v4l2_audioout vaudout; /* audio outputs */ static int input; /* set_input/get_input */ static int output; /* set_output/get_output */ -void io_usage(void) +void io_usage() { printf("\nInput/Output options:\n" " -I, --get-input query the video input [VIDIOC_G_INPUT]\n" diff --git a/utils/v4l2-ctl/v4l2-ctl-meta.cpp b/utils/v4l2-ctl/v4l2-ctl-meta.cpp index 0e1071b0..76d4b1dd 100644 --- a/utils/v4l2-ctl/v4l2-ctl-meta.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-meta.cpp @@ -18,7 +18,7 @@ static struct v4l2_format vfmt; /* set_format/get_format */ -void meta_usage(void) +void meta_usage() { printf("\nMetadata Formats options:\n" " --list-formats-meta display supported metadata capture formats [VIDIOC_ENUM_FMT]\n" diff --git a/utils/v4l2-ctl/v4l2-ctl-misc.cpp b/utils/v4l2-ctl/v4l2-ctl-misc.cpp index 23a0fd38..cb933217 100644 --- a/utils/v4l2-ctl/v4l2-ctl-misc.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-misc.cpp @@ -23,7 +23,7 @@ static struct v4l2_streamparm parm; /* get/set parm */ static double fps = 0; /* set framerate speed, in fps */ static double output_fps = 0; /* set framerate speed, in fps */ -void misc_usage(void) +void misc_usage() { printf("\nMiscellaneous options:\n" " --wait-for-event \n" diff --git a/utils/v4l2-ctl/v4l2-ctl-overlay.cpp b/utils/v4l2-ctl/v4l2-ctl-overlay.cpp index 4c9609d6..16344a15 100644 --- a/utils/v4l2-ctl/v4l2-ctl-overlay.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-overlay.cpp @@ -28,7 +28,7 @@ static const char *fb_device; static std::vector clips; static std::vector bitmap_rects; -void overlay_usage(void) +void overlay_usage() { printf("\nVideo Overlay options:\n" " --list-formats-overlay\n" diff --git a/utils/v4l2-ctl/v4l2-ctl-sdr.cpp b/utils/v4l2-ctl/v4l2-ctl-sdr.cpp index d13f5c76..0b7c4cdc 100644 --- a/utils/v4l2-ctl/v4l2-ctl-sdr.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-sdr.cpp @@ -18,7 +18,7 @@ static struct v4l2_format vfmt; /* set_format/get_format */ -void sdr_usage(void) +void sdr_usage() { printf("\nSDR Formats options:\n" " --list-formats-sdr display supported SDR capture formats [VIDIOC_ENUM_FMT]\n" diff --git a/utils/v4l2-ctl/v4l2-ctl-selection.cpp b/utils/v4l2-ctl/v4l2-ctl-selection.cpp index c35d0536..ac5a1d7b 100644 --- a/utils/v4l2-ctl/v4l2-ctl-selection.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-selection.cpp @@ -44,7 +44,7 @@ static struct v4l2_rect vcrop_out_overlay; /* crop rect */ static struct v4l2_selection vselection; /* capture selection */ static struct v4l2_selection vselection_out; /* output selection */ -void selection_usage(void) +void selection_usage() { printf("\nSelection/Cropping options:\n" " --get-cropcap query the crop capabilities [VIDIOC_CROPCAP]\n" diff --git a/utils/v4l2-ctl/v4l2-ctl-stds.cpp b/utils/v4l2-ctl/v4l2-ctl-stds.cpp index 7ba44ae3..62f57a44 100644 --- a/utils/v4l2-ctl/v4l2-ctl-stds.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-stds.cpp @@ -25,7 +25,7 @@ static unsigned set_dv_timing_opts; static __u32 list_dv_timings_pad; static __u32 dv_timings_cap_pad; -void stds_usage(void) +void stds_usage() { printf("\nStandards/Timings options:\n" " --list-standards display supported video standards [VIDIOC_ENUMSTD]\n" diff --git a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp index 833263b6..663d0254 100644 --- a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp @@ -257,7 +257,7 @@ double fps_timestamps::fps() return fps; }; -void streaming_usage(void) +void streaming_usage() { printf("\nVideo Streaming options:\n" " --stream-count \n" diff --git a/utils/v4l2-ctl/v4l2-ctl-subdev.cpp b/utils/v4l2-ctl/v4l2-ctl-subdev.cpp index 17532d5e..747f1699 100644 --- a/utils/v4l2-ctl/v4l2-ctl-subdev.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-subdev.cpp @@ -49,7 +49,7 @@ static struct v4l2_subdev_frame_interval_enum frmival; static __u32 set_fps_pad; static double set_fps; -void subdev_usage(void) +void subdev_usage() { printf("\nSub-Device options:\n" " --list-subdev-mbus-codes \n" diff --git a/utils/v4l2-ctl/v4l2-ctl-tuner.cpp b/utils/v4l2-ctl/v4l2-ctl-tuner.cpp index 4c291eb3..bc397ec2 100644 --- a/utils/v4l2-ctl/v4l2-ctl-tuner.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-tuner.cpp @@ -26,7 +26,7 @@ static struct v4l2_hw_freq_seek freq_seek; /* freq-seek */ static double low, high; /* freq-seek frequency range */ static int mode = V4L2_TUNER_MODE_STEREO; /* set audio mode */ -void tuner_usage(void) +void tuner_usage() { printf("\nTuner/Modulator options:\n" " -F, --get-freq query the frequency [VIDIOC_G_FREQUENCY]\n" diff --git a/utils/v4l2-ctl/v4l2-ctl-vbi.cpp b/utils/v4l2-ctl/v4l2-ctl-vbi.cpp index 148c9e65..c5960f78 100644 --- a/utils/v4l2-ctl/v4l2-ctl-vbi.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-vbi.cpp @@ -21,7 +21,7 @@ static struct v4l2_format sliced_fmt_out; /* set_format/get_format for sliced VB static struct v4l2_format raw_fmt; /* set_format/get_format for VBI */ static struct v4l2_format raw_fmt_out; /* set_format/get_format for VBI output */ -void vbi_usage(void) +void vbi_usage() { printf("\nVBI Formats options:\n" " --get-sliced-vbi-cap\n" diff --git a/utils/v4l2-ctl/v4l2-ctl-vidcap.cpp b/utils/v4l2-ctl/v4l2-ctl-vidcap.cpp index a9ef8eed..49c20200 100644 --- a/utils/v4l2-ctl/v4l2-ctl-vidcap.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-vidcap.cpp @@ -23,7 +23,7 @@ static __u32 width, height, pixfmt, field, flags; static __u32 bytesperline[VIDEO_MAX_PLANES]; static __u32 sizeimage[VIDEO_MAX_PLANES]; -void vidcap_usage(void) +void vidcap_usage() { printf("\nVideo Capture Formats options:\n" " --list-formats display supported video formats [VIDIOC_ENUM_FMT]\n" diff --git a/utils/v4l2-ctl/v4l2-ctl-vidout.cpp b/utils/v4l2-ctl/v4l2-ctl-vidout.cpp index 227d624f..955b2c50 100644 --- a/utils/v4l2-ctl/v4l2-ctl-vidout.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-vidout.cpp @@ -21,7 +21,7 @@ static __u32 width, height, pixfmt, field, colorspace, xfer_func, ycbcr, quantiz static __u32 bytesperline[VIDEO_MAX_PLANES]; static __u32 sizeimage[VIDEO_MAX_PLANES]; -void vidout_usage(void) +void vidout_usage() { printf("\nVideo Output Formats options:\n" " --list-formats-out display supported video output formats [VIDIOC_ENUM_FMT]\n" diff --git a/utils/v4l2-ctl/v4l2-ctl.cpp b/utils/v4l2-ctl/v4l2-ctl.cpp index c0097203..f6e90f51 100644 --- a/utils/v4l2-ctl/v4l2-ctl.cpp +++ b/utils/v4l2-ctl/v4l2-ctl.cpp @@ -287,7 +287,7 @@ static struct option long_options[] = { {0, 0, 0, 0} }; -static void usage_all(void) +static void usage_all() { common_usage(); tuner_usage(); diff --git a/utils/v4l2-dbg/v4l2-dbg.cpp b/utils/v4l2-dbg/v4l2-dbg.cpp index dcf8200a..cd387d1d 100644 --- a/utils/v4l2-dbg/v4l2-dbg.cpp +++ b/utils/v4l2-dbg/v4l2-dbg.cpp @@ -162,7 +162,7 @@ static struct option long_options[] = { {0, 0, 0, 0} }; -static void usage(void) +static void usage() { printf("Usage: v4l2-dbg [options] [values]\n" " -D, --info Show driver info [VIDIOC_QUERYCAP]\n"