treewide: fix mismatching declarations
PATCH 1/7 treewide: fix mismatching declarations
Found with clang-tidy's readability-inconsistent-declaration-parameter-name
--- 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(-)
lib/include/libdvbv5/atsc_eit.h +2 -2
@@ -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
lib/include/libdvbv5/cat.h +2 -2
@@ -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 }
lib/include/libdvbv5/descriptors.h +1 -1
@@ -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
lib/include/libdvbv5/dvb-demux.h +1 -1
@@ -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 }
lib/include/libdvbv5/dvb-dev.h +1 -1
@@ -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
lib/include/libdvbv5/dvb-fe.h +1 -1
@@ -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 }
lib/include/libdvbv5/dvb-file.h +2 -2
@@ -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);/**
lib/include/libdvbv5/dvb-scan.h +8 -8
@@ -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);
lib/include/libdvbv5/eit.h +2 -2
@@ -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
lib/include/libdvbv5/header.h +2 -2
@@ -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 }
lib/include/libdvbv5/mgt.h +2 -2
@@ -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 }
lib/include/libdvbv5/mpeg_pes.h +1 -1
@@ -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
lib/include/libdvbv5/nit.h +3 -3
@@ -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,
lib/include/libdvbv5/pat.h +2 -2
@@ -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 }
lib/include/libdvbv5/pmt.h +2 -2
@@ -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 }
lib/include/libdvbv5/sdt.h +2 -2
@@ -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 }
lib/include/libdvbv5/vct.h +2 -2
@@ -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 }
lib/include/libv4l2.h +1 -1
@@ -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);
lib/libdvbv5/parse_string.h +1 -1
@@ -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);
lib/libv4lconvert/libv4lconvert-priv.h +24 -24
126 lines not on this page · raw message
lib/libv4lconvert/processing/libv4lprocessing.h +1 -1
@@ -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,
lib/libv4lconvert/tinyjpeg.h +1 -1
@@ -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);
utils/cec-compliance/cec-compliance.h +1 -2
@@ -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)
utils/common/v4l-stream.h +2 -2
@@ -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,
utils/keytable/bpf.h +3 -3
@@ -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);
utils/libcecutil/cec-log.cpp +6 -6
@@ -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);
Signature · 1 line
2.25.2
PATCH 3/7 treewide: fix wrong *cmp function usage
Found with bugprone-suspicious-string-compare
--- 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(-)
lib/libdvbv5/countries.c +1 -1
@@ -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);
lib/libdvbv5/dvb-dev-remote.c +2 -2
@@ -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 ;
lib/libdvbv5/parse_string.c +2 -2
@@ -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 ;
lib/libv4l2rds/libv4l2rds.c +3 -3
@@ -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 ;
utils/cec-compliance/cec-test-adapter.cpp +1 -1
@@ -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++) {
utils/cec-compliance/cec-test.cpp +4 -4
@@ -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");
utils/cec-ctl/cec-ctl.cpp +1 -1
@@ -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) ||
utils/common/media-info.cpp +2 -2
@@ -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; }
utils/dvb/dvbv5-daemon.c +1 -1
@@ -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 ) {
utils/dvb/dvbv5-scan.c +1 -1
@@ -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));/*
utils/ir-ctl/ir-ctl.c +2 -2
@@ -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++;
utils/keytable/keytable.c +3 -3
@@ -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)
utils/libmedia_dev/get_media_devices.c +2 -2
@@ -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;
utils/media-ctl/libmediactl.c +1 -1
@@ -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,'.' );
utils/media-ctl/libv4l2subdev.c +1 -1
@@ -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);
utils/v4l2-compliance/v4l2-compliance.cpp +9 -9
@@ -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<const char *>(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;
utils/v4l2-compliance/v4l2-test-buffers.cpp +2 -2
@@ -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) {
utils/v4l2-compliance/v4l2-test-media.cpp +8 -8
@@ -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);
utils/v4l2-compliance/v4l2-test-subdevs.cpp +2 -2
@@ -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);
utils/v4l2-ctl/v4l2-ctl-common.cpp +1 -1
@@ -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;
Signature · 1 line
2.25.2
PATCH 4/7 treewide: apply performance fixes
In reply to Rosen PenevFound with performance*
--- utils/v4l2-compliance/v4l2-compliance.cpp | 2 +- utils/v4l2-compliance/v4l2-compliance.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
utils/v4l2-compliance/v4l2-compliance.cpp +1 -1
@@ -301,7 +301,7 @@ int check_0(const void *p, int len) static std::map<std::string, std::string> stream_from_map; static std::map<std::string, bool> 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())
utils/v4l2-compliance/v4l2-compliance.h +1 -1
@@ -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);
Signature · 1 line
2.25.2
PATCH 5/7 media-info: fix NULL check
In reply to Rosen PenevFound with clang-tidy's bugprone-bool-pointer-implicit-conversion
--- utils/common/media-info.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
utils/common/media-info.cpp +1 -1
@@ -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) + ")"; }
Signature · 1 line
2.25.2
PATCH 6/7 utils: use bool literals
In reply to Rosen PenevFound with clang-tidy's modernize-use-bool-literals
--- 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(-)
utils/cec-compliance/cec-compliance.cpp +1 -1
@@ -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;
utils/cec-compliance/cec-test.cpp +1 -1
@@ -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));
utils/cec-ctl/cec-ctl.cpp +1 -1
@@ -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;
utils/cec-follower/cec-follower.cpp +1 -1
@@ -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;
utils/cec-follower/cec-processing.cpp +1 -1
@@ -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 = {};
utils/rds-ctl/rds-ctl.cpp +1 -1
@@ -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;
utils/v4l2-compliance/v4l2-compliance.cpp +2 -2
@@ -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;
utils/v4l2-ctl/v4l2-ctl-streaming.cpp +1 -1
@@ -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;
utils/v4l2-ctl/v4l2-ctl.cpp +3 -3
@@ -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);
utils/v4l2-dbg/v4l2-dbg.cpp +1 -1
@@ -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;
Signature · 1 line
2.25.2
PATCH 7/7 utils: do not use empty void with C++
In reply to Rosen PenevFound with clang-tidy's modernize-redundant-void-arg
--- 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(-)
utils/cec-compliance/cec-compliance.cpp +1 -1
@@ -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 <dev> Use device <dev> instead of /dev/cec0\n"
utils/cec-compliance/cec-test.cpp +2 -2
@@ -1494,7 +1494,7 @@ static const unsigned num_tests = sizeof(tests) / sizeof(struct remote_test); static std::map<std::string, int> mapTests; static std::map<std::string, bool> mapTestsNoWarnings; -void collectTests(void) +void collectTests() { std::map<std::string, __u64> 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);
utils/cec-ctl/cec-ctl.cpp +1 -1
@@ -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 <dev> Use device <dev> instead of /dev/cec0\n"
utils/cec-follower/cec-follower.cpp +1 -1
@@ -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 <dev> Use device <dev> instead of /dev/cec0\n"
utils/rds-ctl/rds-ctl.cpp +6 -6
@@ -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;
utils/v4l2-compliance/v4l2-compliance.cpp +1 -1
@@ -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");
utils/v4l2-ctl/v4l2-ctl-common.cpp +1 -1
@@ -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"
utils/v4l2-ctl/v4l2-ctl-edid.cpp +1 -1
@@ -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=<pad>[,type=<type>|file=<file>][,format=<fmt>][modifiers]\n"
utils/v4l2-ctl/v4l2-ctl-io.cpp +1 -1
@@ -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"
utils/v4l2-ctl/v4l2-ctl-meta.cpp +1 -1
@@ -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"
utils/v4l2-ctl/v4l2-ctl-misc.cpp +1 -1
@@ -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 <event>\n"
utils/v4l2-ctl/v4l2-ctl-overlay.cpp +1 -1
@@ -28,7 +28,7 @@ static const char *fb_device; static std::vector<struct v4l2_clip> clips; static std::vector<struct v4l2_rect> bitmap_rects; -void overlay_usage(void) +void overlay_usage() { printf("\nVideo Overlay options:\n" " --list-formats-overlay\n"
utils/v4l2-ctl/v4l2-ctl-sdr.cpp +1 -1
@@ -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"
utils/v4l2-ctl/v4l2-ctl-selection.cpp +1 -1
@@ -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"
utils/v4l2-ctl/v4l2-ctl-stds.cpp +1 -1
@@ -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"
utils/v4l2-ctl/v4l2-ctl-streaming.cpp +1 -1
@@ -257,7 +257,7 @@ double fps_timestamps::fps() return fps; }; -void streaming_usage(void) +void streaming_usage() { printf("\nVideo Streaming options:\n" " --stream-count <count>\n"
utils/v4l2-ctl/v4l2-ctl-subdev.cpp +1 -1
@@ -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 <pad>\n"
utils/v4l2-ctl/v4l2-ctl-tuner.cpp +1 -1
@@ -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"
utils/v4l2-ctl/v4l2-ctl-vbi.cpp +1 -1
@@ -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"
utils/v4l2-ctl/v4l2-ctl-vidcap.cpp +1 -1
@@ -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"
utils/v4l2-ctl/v4l2-ctl-vidout.cpp +1 -1
@@ -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"
utils/v4l2-ctl/v4l2-ctl.cpp +1 -1
@@ -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();
utils/v4l2-dbg/v4l2-dbg.cpp +1 -1
@@ -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"
Signature · 1 line
2.25.2
PATCH 2/7 treewide: replace C casts with C++
In reply to Rosen PenevAlso removed usedless casts.
Found with clang-tidy's google-readability-casting
--- 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(-)
lib/libdvbv5/tables/mgt.c +1 -1
@@ -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;
lib/libdvbv5/tables/nit.c +2 -2
@@ -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);
lib/libdvbv5/tables/pmt.c +1 -1
@@ -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); }
lib/libdvbv5/tables/vct.c +1 -1
@@ -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); }
utils/cec-compliance/cec-compliance.cpp +6 -6
@@ -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<int>(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<unsigned>(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<unsigned>(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<struct cec_msg *>(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<const __u8 *>(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) {
utils/cec-compliance/cec-test.cpp +1 -1
@@ -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 }, };
utils/cec-ctl/cec-ctl.cpp +2 -2
@@ -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:
utils/cec-follower/cec-follower.cpp +4 -4
@@ -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<unsigned>(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<unsigned>(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<const struct cec_msg *>(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) {
utils/cec-follower/cec-tuner.cpp +1 -1
@@ -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<unsigned>(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);
utils/cx18-ctl/cx18-ctl.c +5 -5
@@ -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);
utils/ivtv-ctl/ivtv-ctl.c +1 -1
@@ -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: {
utils/libcecutil/cec-log.cpp +1 -1
@@ -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); }
utils/libcecutil/cec-parse.cpp +1 -1
@@ -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<char * const *>(subopts), value); if (opt == -1) { fprintf(stderr, "Invalid suboptions specified\n");
utils/rds-ctl/rds-ctl.cpp +6 -6
@@ -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<const char *>(vcap.bus_info); if (cards[bus_info].empty()) - cards[bus_info] += std::string((char *)vcap.card) + cards[bus_info] += std::string(reinterpret_cast<char *>(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<char * const *>(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<float>(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<float>(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);
utils/v4l2-compliance/v4l2-compliance.cpp +7 -7
@@ -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<const char *>(s), len); } int check_0(const void *p, int len) { - const __u8 *q = (const __u8 *)p; + const __u8 *q = static_cast<const __u8 *>(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<const char *>(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<char * const *>(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<const char *>(vcap.driver); is_vivid = driver == "vivid"; if (is_vivid) - node.bus_info = (const char *)vcap.bus_info; + node.bus_info = reinterpret_cast<const char *>(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) {
utils/v4l2-compliance/v4l2-test-buffers.cpp +11 -11
@@ -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<ssize_t>(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<ssize_t>(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<int>(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<int>(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<int>(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<int>(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<int>(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)
utils/v4l2-compliance/v4l2-test-colors.cpp +2 -2
@@ -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);
utils/v4l2-compliance/v4l2-test-controls.cpp +6 -6
@@ -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<unsigned>(qctrl.step) > static_cast<unsigned>(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<int>(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<int>(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);
utils/v4l2-compliance/v4l2-test-formats.cpp +3 -3
@@ -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) {
utils/v4l2-compliance/v4l2-test-input-output.cpp +2 -2
@@ -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<enum v4l2_tuner_type>(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<enum v4l2_tuner_type>(0); ret = doioctl(node, VIDIOC_S_FREQUENCY, &freq); if (ret != EINVAL) return fail("did not return EINVAL when passed tuner type 0\n");
utils/v4l2-compliance/v4l2-test-media.cpp +2 -2
@@ -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());
utils/v4l2-ctl/v4l2-ctl-common.cpp +10 -10
@@ -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<const char *>(vcap.bus_info); + card = reinterpret_cast<const char *>(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<const unsigned char *>(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<char *>(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<enum v4l2_priority>(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(", "); }
utils/v4l2-ctl/v4l2-ctl-edid.cpp +3 -3
@@ -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<unsigned char *>(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<unsigned char *>(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<unsigned char *>(malloc(info_edid.blocks * 128)); if (doioctl(fd, VIDIOC_G_EDID, &info_edid) == 0) print_edid_mods(&info_edid); free(info_edid.edid);
utils/v4l2-ctl/v4l2-ctl-io.cpp +2 -2
@@ -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<unsigned long long>(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<unsigned long long>(vout.std), std2s(vout.std).c_str()); printf("\tCapabilities: 0x%08X (%s)\n", vout.capabilities, output_cap2s(vout.capabilities).c_str()); vout.index++;
utils/v4l2-ctl/v4l2-ctl-meta.cpp +4 -4
@@ -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<vivid_uvc_meta_buf *>(q.g_dataptr(buf.g_index(), 0)); fprintf(f, "%.6fs sof: %4d len: %u flags: 0x%02x", - (double)vbuf->ns / 1000000000.0, + static_cast<double>(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<vivid_meta_out_buf *>(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<vivid_meta_out_buf *>(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;
utils/v4l2-ctl/v4l2-ctl-modes.cpp +6 -6
@@ -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<long long>(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<long long>(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<long long>(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<long long>(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<long long>(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<long long>(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
utils/v4l2-ctl/v4l2-ctl-overlay.cpp +5 -5
@@ -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<unsigned char *>(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<struct v4l2_clip *>(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<unsigned char *>(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<struct v4l2_clip *>(malloc(fmt.fmt.win.clipcount * sizeof(clips[0]))); + bitmap = static_cast<unsigned char *>(calloc(1, stride * fmt.fmt.win.w.height)); fmt.fmt.win.bitmap = bitmap; doioctl(fd, VIDIOC_G_FMT, &fmt); printfmt(fd, fmt);
utils/v4l2-ctl/v4l2-ctl-stds.cpp +8 -8
@@ -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<double>(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<double>(bt->pixelclock) / (tot_width * (tot_height / 2))); else - printf(" (%.2f frames per second)", (double)bt->pixelclock / + printf(" (%.2f frames per second)", static_cast<double>(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<unsigned long long>(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<unsigned long long>(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<unsigned long long>(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<unsigned long long>(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<unsigned long long>(vs.id)); printf("\tName : %s\n", vs.name); printf("\tFrame period: %d/%d\n", vs.frameperiod.numerator,
utils/v4l2-ctl/v4l2-ctl-streaming.cpp +22 -22
147 lines not on this page · raw message
utils/v4l2-ctl/v4l2-ctl-vidcap.cpp +2 -2
@@ -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);
utils/v4l2-ctl/v4l2-ctl.cpp +6 -6
@@ -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<const char *>(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<unsigned char *>(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<double>(vfmt.fmt.vbi.offset) / static_cast<double>(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<char * const *>(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) {
utils/v4l2-dbg/v4l2-dbg.cpp +2 -2
@@ -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<char * const *>(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) {
Signature · 1 line
2.25.2
Quoted 38 lines · Rosen Penev
Found with clang-tidy's readability-inconsistent-declaration-parameter-name
Signed-off-by Rosen Penev <[email protected]>--- 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(-)lib/include/libdvbv5/atsc_eit.h +0
-0
lib/include/libdvbv5/atsc_eit.h ssize_t atsc_table_eit_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf, · line 195
Quoted 5 lines
lib/include/libdvbv5/atsc_eit.h +1
-1@@ -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);
You need to update the docbook comment as well: @param table should become @param eit.
Same elsewhere.
Regards,
Hans
Quoted 631 lines
lib/include/libdvbv5/atsc_eit.h +1
-1/** * @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 lib/include/libdvbv5/cat.h +2
-2@@ -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 }lib/include/libdvbv5/descriptors.h +1
-1@@ -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 lib/include/libdvbv5/dvb-demux.h +1
-1@@ -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 }lib/include/libdvbv5/dvb-dev.h +1
-1@@ -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 lib/include/libdvbv5/dvb-fe.h +1
-1@@ -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 }lib/include/libdvbv5/dvb-file.h +2
-2@@ -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);/** lib/include/libdvbv5/dvb-scan.h +8
-8@@ -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);lib/include/libdvbv5/eit.h +2
-2@@ -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 lib/include/libdvbv5/header.h +2
-2@@ -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 }lib/include/libdvbv5/mgt.h +2
-2@@ -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 }lib/include/libdvbv5/mpeg_pes.h +1
-1@@ -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 lib/include/libdvbv5/nit.h +3
-3@@ -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,lib/include/libdvbv5/pat.h +2
-2@@ -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 }lib/include/libdvbv5/pmt.h +2
-2@@ -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 }lib/include/libdvbv5/sdt.h +2
-2@@ -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 }lib/include/libdvbv5/vct.h +2
-2@@ -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 }lib/include/libv4l2.h +1
-1@@ -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);lib/libdvbv5/parse_string.h +1
-1@@ -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);lib/libv4lconvert/libv4lconvert-priv.h +24
-24@@ -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);lib/libv4lconvert/processing/libv4lprocessing.h +1
-1@@ -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, lib/libv4lconvert/tinyjpeg.h +1
-1@@ -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);utils/cec-compliance/cec-compliance.h +1
-2@@ -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)utils/common/v4l-stream.h +2
-2@@ -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,utils/keytable/bpf.h +3
-3@@ -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);utils/libcecutil/cec-log.cpp +6
-6@@ -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);
Quoted 47 lines · Hans Verkuil
Quoted 38 lines · Rosen Penev
Found with clang-tidy's readability-inconsistent-declaration-parameter-name
Signed-off-by Rosen Penev <[email protected]>--- 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(-)lib/include/libdvbv5/atsc_eit.h +0
-0lib/include/libdvbv5/atsc_eit.h ssize_t atsc_table_eit_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf, · line 195
Quoted 5 lines
lib/include/libdvbv5/atsc_eit.h +1
-1@@ -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);You need to update the docbook comment as well: @param table should become @param eit.
Quoted 1 line
Same elsewhere.
On second thought, I think I'll reject this patch. It's not worth the trouble.
Regards,
Hans
Quoted 637 lines
Regards,
Hans
Quoted 631 lines
lib/include/libdvbv5/atsc_eit.h +1
-1/** * @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 lib/include/libdvbv5/cat.h +2
-2@@ -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 }lib/include/libdvbv5/descriptors.h +1
-1@@ -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 lib/include/libdvbv5/dvb-demux.h +1
-1@@ -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 }lib/include/libdvbv5/dvb-dev.h +1
-1@@ -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 lib/include/libdvbv5/dvb-fe.h +1
-1@@ -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 }lib/include/libdvbv5/dvb-file.h +2
-2@@ -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);/** lib/include/libdvbv5/dvb-scan.h +8
-8@@ -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);lib/include/libdvbv5/eit.h +2
-2@@ -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 lib/include/libdvbv5/header.h +2
-2@@ -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 }lib/include/libdvbv5/mgt.h +2
-2@@ -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 }lib/include/libdvbv5/mpeg_pes.h +1
-1@@ -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 lib/include/libdvbv5/nit.h +3
-3@@ -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,lib/include/libdvbv5/pat.h +2
-2@@ -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 }lib/include/libdvbv5/pmt.h +2
-2@@ -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 }lib/include/libdvbv5/sdt.h +2
-2@@ -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 }lib/include/libdvbv5/vct.h +2
-2@@ -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 }lib/include/libv4l2.h +1
-1@@ -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);lib/libdvbv5/parse_string.h +1
-1@@ -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);lib/libv4lconvert/libv4lconvert-priv.h +24
-24@@ -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);lib/libv4lconvert/processing/libv4lprocessing.h +1
-1@@ -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, lib/libv4lconvert/tinyjpeg.h +1
-1@@ -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);utils/cec-compliance/cec-compliance.h +1
-2@@ -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)utils/common/v4l-stream.h +2
-2@@ -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,utils/keytable/bpf.h +3
-3@@ -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);utils/libcecutil/cec-log.cpp +6
-6@@ -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);
Re: [PATCH 3/7] treewide: fix wrong *cmp function usage
In reply to Rosen PenevQuoted 17 lines · Rosen Penev
Found with bugprone-suspicious-string-compare
Signed-off-by Rosen Penev <[email protected]>--- 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 ++--
Quoted 8 lines
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(-)
This is standard C/C++ idiom, changing this is nonsensical.
Regards,
Hans
Quoted 415 lines
lib/libdvbv5/countries.c +1
-1@@ -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);lib/libdvbv5/dvb-dev-remote.c +2
-2@@ -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 ;lib/libdvbv5/parse_string.c +2
-2@@ -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 ;lib/libv4l2rds/libv4l2rds.c +3
-3@@ -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 ;utils/cec-compliance/cec-test-adapter.cpp +1
-1@@ -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++) {utils/cec-compliance/cec-test.cpp +4
-4@@ -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");utils/cec-ctl/cec-ctl.cpp +1
-1@@ -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) ||utils/common/media-info.cpp +2
-2@@ -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; }utils/dvb/dvbv5-daemon.c +1
-1@@ -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 ) {utils/dvb/dvbv5-scan.c +1
-1@@ -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));/* utils/ir-ctl/ir-ctl.c +2
-2@@ -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++;utils/keytable/keytable.c +3
-3@@ -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)utils/libmedia_dev/get_media_devices.c +2
-2@@ -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;utils/media-ctl/libmediactl.c +1
-1@@ -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,'.' );utils/media-ctl/libv4l2subdev.c +1
-1@@ -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);utils/v4l2-compliance/v4l2-compliance.cpp +9
-9@@ -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<const char *>(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;utils/v4l2-compliance/v4l2-test-buffers.cpp +2
-2@@ -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) {utils/v4l2-compliance/v4l2-test-media.cpp +8
-8@@ -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);utils/v4l2-compliance/v4l2-test-subdevs.cpp +2
-2@@ -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);utils/v4l2-ctl/v4l2-ctl-common.cpp +1
-1@@ -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;
Re: [PATCH 5/7] media-info: fix NULL check
In reply to Rosen PenevQuoted 13 lines · Rosen Penev
Found with clang-tidy's bugprone-bool-pointer-implicit-conversion
Signed-off-by Rosen Penev <[email protected]>--- utils/common/media-info.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)utils/common/media-info.cpp +0
-0
utils/common/media-info.cpp std::string mi_entfunction2s(__u32 function, bool *is_invalid) · line 363
Quoted 8 lines
utils/common/media-info.cpp +1
-1@@ -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) + ")"; }
This makes no sense: why just this instance when there are a lot more 'if (is_invalid)' checks in this function?
In any case, this is also normal idiom and I don't want to apply this patch.
Regards,
Hans
Re: [PATCH 6/7] utils: use bool literals
In reply to Rosen PenevQuoted 99 lines · Rosen Penev
Found with clang-tidy's modernize-use-bool-literals
Signed-off-by Rosen Penev <[email protected]>--- 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(-)utils/cec-compliance/cec-compliance.cpp +1
-1@@ -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;utils/cec-compliance/cec-test.cpp +1
-1@@ -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));utils/cec-ctl/cec-ctl.cpp +1
-1@@ -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;utils/cec-follower/cec-follower.cpp +1
-1@@ -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;utils/cec-follower/cec-processing.cpp +1
-1@@ -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 = {};utils/rds-ctl/rds-ctl.cpp +1
-1@@ -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;utils/v4l2-compliance/v4l2-compliance.cpp +0
-0
utils/v4l2-compliance/v4l2-compliance.cpp static int open_media_bus_info(const std::string &bus_info, std::string &media_d · line 837
Quoted 5 lines
utils/v4l2-compliance/v4l2-compliance.cpp +1
-1@@ -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])) {
Huh? Seems a stray change.
I'm skipping this change, but I'll apply the remainder of this patch.
Regards,
Hans
Quoted 70 lines
utils/v4l2-compliance/v4l2-compliance.cpp +1
-1struct 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;utils/v4l2-ctl/v4l2-ctl-streaming.cpp +1
-1@@ -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;utils/v4l2-ctl/v4l2-ctl.cpp +3
-3@@ -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);utils/v4l2-dbg/v4l2-dbg.cpp +1
-1@@ -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;