* [PATCH 1/7] treewide: fix mismatching declarations
@ 2020-04-20 18:46 Rosen Penev
2020-04-20 18:46 ` [PATCH 2/7] treewide: replace C casts with C++ Rosen Penev
` (6 more replies)
0 siblings, 7 replies; 12+ messages in thread
From: Rosen Penev @ 2020-04-20 18:46 UTC (permalink / raw)
To: linux-media
Found with clang-tidy's
readability-inconsistent-declaration-parameter-name
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
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 +-
| 4 +-
lib/include/libdvbv5/mgt.h | 4 +-
lib/include/libdvbv5/mpeg_pes.h | 2 +-
lib/include/libdvbv5/nit.h | 6 +--
lib/include/libdvbv5/pat.h | 4 +-
lib/include/libdvbv5/pmt.h | 4 +-
lib/include/libdvbv5/sdt.h | 4 +-
lib/include/libdvbv5/vct.h | 4 +-
lib/include/libv4l2.h | 2 +-
lib/libdvbv5/parse_string.h | 2 +-
lib/libv4lconvert/libv4lconvert-priv.h | 48 +++++++++----------
.../processing/libv4lprocessing.h | 2 +-
lib/libv4lconvert/tinyjpeg.h | 2 +-
utils/cec-compliance/cec-compliance.h | 3 +-
utils/common/v4l-stream.h | 4 +-
utils/keytable/bpf.h | 6 +--
utils/libcecutil/cec-log.cpp | 12 ++---
26 files changed, 76 insertions(+), 77 deletions(-)
diff --git a/lib/include/libdvbv5/atsc_eit.h b/lib/include/libdvbv5/atsc_eit.h
index 5e52087c..18ae599d 100644
--- a/lib/include/libdvbv5/atsc_eit.h
+++ b/lib/include/libdvbv5/atsc_eit.h
@@ -192,7 +192,7 @@ ssize_t atsc_table_eit_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf,
*
* @param table pointer to struct atsc_table_eit to be freed
*/
-void atsc_table_eit_free(struct atsc_table_eit *table);
+void atsc_table_eit_free(struct atsc_table_eit *eit);
/**
* @brief Prints the content of the ATSC EIT table
@@ -202,7 +202,7 @@ void atsc_table_eit_free(struct atsc_table_eit *table);
* @param table pointer to struct atsc_table_eit
*/
void atsc_table_eit_print(struct dvb_v5_fe_parms *parms,
- struct atsc_table_eit *table);
+ struct atsc_table_eit *eit);
/**
* @brief Converts an ATSC EIT formatted timestamp into struct tm
diff --git a/lib/include/libdvbv5/cat.h b/lib/include/libdvbv5/cat.h
index 612c2c35..2e767ddc 100644
--- a/lib/include/libdvbv5/cat.h
+++ b/lib/include/libdvbv5/cat.h
@@ -88,7 +88,7 @@ ssize_t dvb_table_cat_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf,
*
* @param table pointer to struct dvb_table_cat to be freed
*/
-void dvb_table_cat_free(struct dvb_table_cat *table);
+void dvb_table_cat_free(struct dvb_table_cat *cat);
/**
* @brief Prints the content of the CAT table
@@ -97,7 +97,7 @@ void dvb_table_cat_free(struct dvb_table_cat *table);
* @param table pointer to struct dvb_table_cat
*/
void dvb_table_cat_print(struct dvb_v5_fe_parms *parms,
- struct dvb_table_cat *table);
+ struct dvb_table_cat *cat);
#ifdef __cplusplus
}
diff --git a/lib/include/libdvbv5/descriptors.h b/lib/include/libdvbv5/descriptors.h
index cb21470c..8f3900f2 100644
--- a/lib/include/libdvbv5/descriptors.h
+++ b/lib/include/libdvbv5/descriptors.h
@@ -157,7 +157,7 @@ uint32_t dvb_bcd(uint32_t bcd);
* @param len Number of bytes to show
*/
void dvb_hexdump(struct dvb_v5_fe_parms *parms, const char *prefix,
- const unsigned char *buf, int len);
+ const unsigned char *data, int len);
/**
* @brief parse MPEG-TS descriptors
diff --git a/lib/include/libdvbv5/dvb-demux.h b/lib/include/libdvbv5/dvb-demux.h
index 971c27f6..d3bc02a9 100644
--- a/lib/include/libdvbv5/dvb-demux.h
+++ b/lib/include/libdvbv5/dvb-demux.h
@@ -148,7 +148,7 @@ int dvb_set_section_filter(int dmxfd, int pid, unsigned filtsize,
*
* @warning This function currently assumes that the PAT fits into one session.
*/
-int dvb_get_pmt_pid(int dmxfd, int sid);
+int dvb_get_pmt_pid(int patfd, int sid);
#ifdef __cplusplus
}
diff --git a/lib/include/libdvbv5/dvb-dev.h b/lib/include/libdvbv5/dvb-dev.h
index 2eeae516..5a9cc1a2 100644
--- a/lib/include/libdvbv5/dvb-dev.h
+++ b/lib/include/libdvbv5/dvb-dev.h
@@ -398,7 +398,7 @@ int dvb_dev_set_bufsize(struct dvb_open_descriptor *open_dev,
*/
int dvb_dev_dmx_set_pesfilter(struct dvb_open_descriptor *open_dev,
int pid, dmx_pes_type_t type,
- dmx_output_t output, int buffersize);
+ dmx_output_t output, int bufsize);
/**
* @brief Sets a MPEG-TS section filter
diff --git a/lib/include/libdvbv5/dvb-fe.h b/lib/include/libdvbv5/dvb-fe.h
index 96657013..4bd94108 100644
--- a/lib/include/libdvbv5/dvb-fe.h
+++ b/lib/include/libdvbv5/dvb-fe.h
@@ -732,7 +732,7 @@ int dvb_fe_is_satellite(uint32_t delivery_system);
* "COUNTRY" property in dvb_fe_set_parm() overrides the setting.
*/
int dvb_fe_set_default_country(struct dvb_v5_fe_parms *parms,
- const char *country);
+ const char *cc);
#ifdef __cplusplus
}
diff --git a/lib/include/libdvbv5/dvb-file.h b/lib/include/libdvbv5/dvb-file.h
index 1f1a6386..9c8c54d9 100644
--- a/lib/include/libdvbv5/dvb-file.h
+++ b/lib/include/libdvbv5/dvb-file.h
@@ -423,8 +423,8 @@ int dvb_retrieve_entry_prop(struct dvb_entry *entry,
* @return Returns 0 if success, or, -1 if error.
*/
int dvb_store_channel(struct dvb_file **dvb_file,
- struct dvb_v5_fe_parms *parms,
- struct dvb_v5_descriptors *dvb_desc,
+ struct dvb_v5_fe_parms *__p,
+ struct dvb_v5_descriptors *dvb_scan_handler,
int get_detected, int get_nit);
/**
diff --git a/lib/include/libdvbv5/dvb-scan.h b/lib/include/libdvbv5/dvb-scan.h
index 2666d906..50846b98 100644
--- a/lib/include/libdvbv5/dvb-scan.h
+++ b/lib/include/libdvbv5/dvb-scan.h
@@ -222,7 +222,7 @@ int dvb_read_section(struct dvb_v5_fe_parms *parms, int dmx_fd,
* This is a variant of dvb_read_section() that uses a struct dvb_table_filter
* to specify the filter to use.
*/
-int dvb_read_sections(struct dvb_v5_fe_parms *parms, int dmx_fd,
+int dvb_read_sections(struct dvb_v5_fe_parms *__p, int dmx_fd,
struct dvb_table_filter *sect,
unsigned timeout);
@@ -265,7 +265,7 @@ void dvb_scan_free_handler_table(struct dvb_v5_descriptors *dvb_scan_handler);
* On sucess, it returns a pointer to a struct dvb_v5_descriptors, that can
* either be used to tune into a service or to be stored inside a file.
*/
-struct dvb_v5_descriptors *dvb_get_ts_tables(struct dvb_v5_fe_parms *parms, int dmx_fd,
+struct dvb_v5_descriptors *dvb_get_ts_tables(struct dvb_v5_fe_parms *__p, int dmx_fd,
uint32_t delivery_system,
unsigned other_nit,
unsigned timeout_multiply);
@@ -337,7 +337,7 @@ typedef int (check_frontend_t)(void *args, struct dvb_v5_fe_parms *parms);
* }
* @endcode
*/
-struct dvb_v5_descriptors *dvb_scan_transponder(struct dvb_v5_fe_parms *parms,
+struct dvb_v5_descriptors *dvb_scan_transponder(struct dvb_v5_fe_parms *__p,
struct dvb_entry *entry,
int dmx_fd,
check_frontend_t *check_frontend,
@@ -388,7 +388,7 @@ struct dvb_v5_descriptors *dvb_scan_transponder(struct dvb_v5_fe_parms *parms,
* }
* @endcode
*/
-void dvb_add_scaned_transponders(struct dvb_v5_fe_parms *parms,
+void dvb_add_scaned_transponders(struct dvb_v5_fe_parms *__p,
struct dvb_v5_descriptors *dvb_scan_handler,
struct dvb_entry *first_entry,
struct dvb_entry *entry);
@@ -398,12 +398,12 @@ void dvb_add_scaned_transponders(struct dvb_v5_fe_parms *parms,
* Some ancillary functions used internally inside the library, used to
* identify duplicated transport streams and add new found transponder entries
*/
-int dvb_estimate_freq_shift(struct dvb_v5_fe_parms *parms);
+int dvb_estimate_freq_shift(struct dvb_v5_fe_parms *__p);
int dvb_new_freq_is_needed(struct dvb_entry *entry, struct dvb_entry *last_entry,
uint32_t freq, enum dvb_sat_polarization pol, int shift);
-struct dvb_entry *dvb_scan_add_entry(struct dvb_v5_fe_parms *parms,
+struct dvb_entry *dvb_scan_add_entry(struct dvb_v5_fe_parms *__p,
struct dvb_entry *first_entry,
struct dvb_entry *entry,
uint32_t freq, uint32_t shift,
@@ -414,14 +414,14 @@ int dvb_new_entry_is_needed(struct dvb_entry *entry,
uint32_t freq, int shift,
enum dvb_sat_polarization pol, uint32_t stream_id);
-struct dvb_entry *dvb_scan_add_entry_ex(struct dvb_v5_fe_parms *parms,
+struct dvb_entry *dvb_scan_add_entry_ex(struct dvb_v5_fe_parms *__p,
struct dvb_entry *first_entry,
struct dvb_entry *entry,
uint32_t freq, uint32_t shift,
enum dvb_sat_polarization pol,
uint32_t stream_id);
-void dvb_update_transponders(struct dvb_v5_fe_parms *parms,
+void dvb_update_transponders(struct dvb_v5_fe_parms *__p,
struct dvb_v5_descriptors *dvb_scan_handler,
struct dvb_entry *first_entry,
struct dvb_entry *entry);
diff --git a/lib/include/libdvbv5/eit.h b/lib/include/libdvbv5/eit.h
index 9129861e..5510707b 100644
--- a/lib/include/libdvbv5/eit.h
+++ b/lib/include/libdvbv5/eit.h
@@ -197,7 +197,7 @@ ssize_t dvb_table_eit_init (struct dvb_v5_fe_parms *parms, const uint8_t *buf,
*
* @param table pointer to struct dvb_table_eit to be freed
*/
-void dvb_table_eit_free(struct dvb_table_eit *table);
+void dvb_table_eit_free(struct dvb_table_eit *eit);
/**
* @brief Prints the content of the DVB EIT table
@@ -207,7 +207,7 @@ void dvb_table_eit_free(struct dvb_table_eit *table);
* @param table pointer to struct dvb_table_eit
*/
void dvb_table_eit_print(struct dvb_v5_fe_parms *parms,
- struct dvb_table_eit *table);
+ struct dvb_table_eit *eit);
/**
* @brief Converts a DVB EIT formatted timestamp into struct tm
--git a/lib/include/libdvbv5/header.h b/lib/include/libdvbv5/header.h
index 2a459f9d..ccf67422 100644
--- a/lib/include/libdvbv5/header.h
+++ b/lib/include/libdvbv5/header.h
@@ -132,7 +132,7 @@ extern "C" {
*
* @param header pointer to struct dvb_table_header to be parsed
*/
-void dvb_table_header_init (struct dvb_table_header *header);
+void dvb_table_header_init (struct dvb_table_header *t);
/**
* @brief Prints the content of the MPEG-TS table header
* @ingroup dvb_table
@@ -141,7 +141,7 @@ void dvb_table_header_init (struct dvb_table_header *header);
* @param header pointer to struct dvb_table_header to be printed
*/
void dvb_table_header_print(struct dvb_v5_fe_parms *parms,
- const struct dvb_table_header *header);
+ const struct dvb_table_header *t);
#ifdef __cplusplus
}
diff --git a/lib/include/libdvbv5/mgt.h b/lib/include/libdvbv5/mgt.h
index 7aa92d6c..62b5a7ab 100644
--- a/lib/include/libdvbv5/mgt.h
+++ b/lib/include/libdvbv5/mgt.h
@@ -168,7 +168,7 @@ ssize_t atsc_table_mgt_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf,
*
* @param table pointer to struct atsc_table_mgt to be freed
*/
-void atsc_table_mgt_free(struct atsc_table_mgt *table);
+void atsc_table_mgt_free(struct atsc_table_mgt *mgt);
/**
* @brief Prints the content of the MGT table
@@ -178,7 +178,7 @@ void atsc_table_mgt_free(struct atsc_table_mgt *table);
* @param table pointer to struct atsc_table_mgt
*/
void atsc_table_mgt_print(struct dvb_v5_fe_parms *parms,
- struct atsc_table_mgt *table);
+ struct atsc_table_mgt *mgt);
#ifdef __cplusplus
}
diff --git a/lib/include/libdvbv5/mpeg_pes.h b/lib/include/libdvbv5/mpeg_pes.h
index 9f214b26..b2b13584 100644
--- a/lib/include/libdvbv5/mpeg_pes.h
+++ b/lib/include/libdvbv5/mpeg_pes.h
@@ -228,7 +228,7 @@ ssize_t dvb_mpeg_pes_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf, ssi
* If the pointer pes was allocated dynamically, this function
* can be used to free the memory.
*/
-void dvb_mpeg_pes_free(struct dvb_mpeg_pes *pes);
+void dvb_mpeg_pes_free(struct dvb_mpeg_pes *ts);
/**
* @brief Print details of struct dvb_mpeg_pes
diff --git a/lib/include/libdvbv5/nit.h b/lib/include/libdvbv5/nit.h
index f8e0e730..ef0f1bc1 100644
--- a/lib/include/libdvbv5/nit.h
+++ b/lib/include/libdvbv5/nit.h
@@ -221,7 +221,7 @@ ssize_t dvb_table_nit_init (struct dvb_v5_fe_parms *parms, const uint8_t *buf,
*
* @param table pointer to struct dvb_table_nit to be freed
*/
-void dvb_table_nit_free(struct dvb_table_nit *table);
+void dvb_table_nit_free(struct dvb_table_nit *nit);
/**
* @brief Prints the content of the NIT table
@@ -230,7 +230,7 @@ void dvb_table_nit_free(struct dvb_table_nit *table);
* @param parms struct dvb_v5_fe_parms pointer to the opened device
* @param table pointer to struct dvb_table_nit
*/
-void dvb_table_nit_print(struct dvb_v5_fe_parms *parms, struct dvb_table_nit *table);
+void dvb_table_nit_print(struct dvb_v5_fe_parms *parms, struct dvb_table_nit *nit);
/**
* @brief For each entry at NIT and NIT transport tables, call a callback
@@ -263,7 +263,7 @@ void dvb_table_nit_print(struct dvb_v5_fe_parms *parms, struct dvb_table_nit *ta
*/
void dvb_table_nit_descriptor_handler(
struct dvb_v5_fe_parms *parms,
- struct dvb_table_nit *table,
+ struct dvb_table_nit *nit,
enum descriptors descriptor,
nit_handler_callback_t *call_nit,
nit_tran_handler_callback_t *call_tran,
diff --git a/lib/include/libdvbv5/pat.h b/lib/include/libdvbv5/pat.h
index bdf31ab5..9b1303a1 100644
--- a/lib/include/libdvbv5/pat.h
+++ b/lib/include/libdvbv5/pat.h
@@ -153,7 +153,7 @@ ssize_t dvb_table_pat_init (struct dvb_v5_fe_parms *parms, const uint8_t *buf,
*
* @param table pointer to struct dvb_table_pat to be freed
*/
-void dvb_table_pat_free(struct dvb_table_pat *table);
+void dvb_table_pat_free(struct dvb_table_pat *pat);
/**
* @brief Prints the content of the PAT table
@@ -163,7 +163,7 @@ void dvb_table_pat_free(struct dvb_table_pat *table);
* @param table pointer to struct dvb_table_pat
*/
void dvb_table_pat_print(struct dvb_v5_fe_parms *parms,
- struct dvb_table_pat *table);
+ struct dvb_table_pat *pat);
#ifdef __cplusplus
}
diff --git a/lib/include/libdvbv5/pmt.h b/lib/include/libdvbv5/pmt.h
index 5876c594..45ce88b0 100644
--- a/lib/include/libdvbv5/pmt.h
+++ b/lib/include/libdvbv5/pmt.h
@@ -281,7 +281,7 @@ ssize_t dvb_table_pmt_init (struct dvb_v5_fe_parms *parms, const uint8_t *buf,
*
* @param table pointer to struct dvb_table_pmt to be freed
*/
-void dvb_table_pmt_free(struct dvb_table_pmt *table);
+void dvb_table_pmt_free(struct dvb_table_pmt *pmt);
/**
* @brief Prints the content of the PAT table
@@ -291,7 +291,7 @@ void dvb_table_pmt_free(struct dvb_table_pmt *table);
* @param table pointer to struct dvb_table_pmt
*/
void dvb_table_pmt_print(struct dvb_v5_fe_parms *parms,
- const struct dvb_table_pmt *table);
+ const struct dvb_table_pmt *pmt);
#ifdef __cplusplus
}
diff --git a/lib/include/libdvbv5/sdt.h b/lib/include/libdvbv5/sdt.h
index 52fdf07f..1292f82d 100644
--- a/lib/include/libdvbv5/sdt.h
+++ b/lib/include/libdvbv5/sdt.h
@@ -169,7 +169,7 @@ ssize_t dvb_table_sdt_init (struct dvb_v5_fe_parms *parms, const uint8_t *buf,
*
* @param table pointer to struct dvb_table_sdt to be freed
*/
-void dvb_table_sdt_free(struct dvb_table_sdt *table);
+void dvb_table_sdt_free(struct dvb_table_sdt *sdt);
/**
* @brief Prints the content of the SDT table
@@ -178,7 +178,7 @@ void dvb_table_sdt_free(struct dvb_table_sdt *table);
* @param parms struct dvb_v5_fe_parms pointer to the opened device
* @param table pointer to struct dvb_table_sdt
*/
-void dvb_table_sdt_print(struct dvb_v5_fe_parms *parms, struct dvb_table_sdt *table);
+void dvb_table_sdt_print(struct dvb_v5_fe_parms *parms, struct dvb_table_sdt *sdt);
#ifdef __cplusplus
}
diff --git a/lib/include/libdvbv5/vct.h b/lib/include/libdvbv5/vct.h
index 374c73a8..86c4728a 100644
--- a/lib/include/libdvbv5/vct.h
+++ b/lib/include/libdvbv5/vct.h
@@ -233,7 +233,7 @@ ssize_t atsc_table_vct_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf,
*
* @param table pointer to struct atsc_table_vct to be freed
*/
-void atsc_table_vct_free(struct atsc_table_vct *table);
+void atsc_table_vct_free(struct atsc_table_vct *vct);
/**
* @brief Prints the content of the VCT table
* @ingroup dvb_table
@@ -242,7 +242,7 @@ void atsc_table_vct_free(struct atsc_table_vct *table);
* @param table pointer to struct atsc_table_vct
*/
void atsc_table_vct_print(struct dvb_v5_fe_parms *parms,
- struct atsc_table_vct *table);
+ struct atsc_table_vct *vct);
#ifdef __cplusplus
}
diff --git a/lib/include/libv4l2.h b/lib/include/libv4l2.h
index ea1870db..5c093067 100644
--- a/lib/include/libv4l2.h
+++ b/lib/include/libv4l2.h
@@ -64,7 +64,7 @@ LIBV4L_PUBLIC int v4l2_open(const char *file, int oflag, ...);
LIBV4L_PUBLIC int v4l2_close(int fd);
LIBV4L_PUBLIC int v4l2_dup(int fd);
LIBV4L_PUBLIC int v4l2_ioctl(int fd, unsigned long int request, ...);
-LIBV4L_PUBLIC ssize_t v4l2_read(int fd, void *buffer, size_t n);
+LIBV4L_PUBLIC ssize_t v4l2_read(int fd, void *dest, size_t n);
LIBV4L_PUBLIC ssize_t v4l2_write(int fd, const void *buffer, size_t n);
LIBV4L_PUBLIC void *v4l2_mmap(void *start, size_t length, int prot, int flags,
int fd, int64_t offset);
diff --git a/lib/libdvbv5/parse_string.h b/lib/libdvbv5/parse_string.h
index b0884bfb..86604bde 100644
--- a/lib/libdvbv5/parse_string.h
+++ b/lib/libdvbv5/parse_string.h
@@ -27,7 +27,7 @@ void dvb_iconv_to_charset(struct dvb_v5_fe_parms *parms,
size_t destlen,
const unsigned char *src,
size_t len,
- char *type, char *output_charset);
+ char *input_charset, char *output_charset);
void dvb_parse_string(struct dvb_v5_fe_parms *parms, char **dest, char **emph,
const unsigned char *src, size_t len);
diff --git a/lib/libv4lconvert/libv4lconvert-priv.h b/lib/libv4lconvert/libv4lconvert-priv.h
index ce5970c9..dd168424 100644
--- a/lib/libv4lconvert/libv4lconvert-priv.h
+++ b/lib/libv4lconvert/libv4lconvert-priv.h
@@ -117,43 +117,43 @@ int v4lconvert_oom_error(struct v4lconvert_data *data);
void v4lconvert_rgb24_to_yuv420(const unsigned char *src, unsigned char *dest,
const struct v4l2_format *src_fmt, int bgr, int yvu, int bpp);
-void v4lconvert_yuv420_to_rgb24(const unsigned char *src, unsigned char *dst,
+void v4lconvert_yuv420_to_rgb24(const unsigned char *src, unsigned char *dest,
int width, int height, int yvu);
-void v4lconvert_yuv420_to_bgr24(const unsigned char *src, unsigned char *dst,
+void v4lconvert_yuv420_to_bgr24(const unsigned char *src, unsigned char *dest,
int width, int height, int yvu);
-void v4lconvert_yuyv_to_rgb24(const unsigned char *src, unsigned char *dst,
+void v4lconvert_yuyv_to_rgb24(const unsigned char *src, unsigned char *dest,
int width, int height, int stride);
-void v4lconvert_yuyv_to_bgr24(const unsigned char *src, unsigned char *dst,
+void v4lconvert_yuyv_to_bgr24(const unsigned char *src, unsigned char *dest,
int width, int height, int stride);
-void v4lconvert_yuyv_to_yuv420(const unsigned char *src, unsigned char *dst,
+void v4lconvert_yuyv_to_yuv420(const unsigned char *src, unsigned char *dest,
int width, int height, int stride, int yvu);
void v4lconvert_nv16_to_yuyv(const unsigned char *src, unsigned char *dest,
int width, int height);
-void v4lconvert_yvyu_to_rgb24(const unsigned char *src, unsigned char *dst,
+void v4lconvert_yvyu_to_rgb24(const unsigned char *src, unsigned char *dest,
int width, int height, int stride);
-void v4lconvert_yvyu_to_bgr24(const unsigned char *src, unsigned char *dst,
+void v4lconvert_yvyu_to_bgr24(const unsigned char *src, unsigned char *dest,
int width, int height, int stride);
-void v4lconvert_uyvy_to_rgb24(const unsigned char *src, unsigned char *dst,
+void v4lconvert_uyvy_to_rgb24(const unsigned char *src, unsigned char *dest,
int width, int height, int stride);
-void v4lconvert_uyvy_to_bgr24(const unsigned char *src, unsigned char *dst,
+void v4lconvert_uyvy_to_bgr24(const unsigned char *src, unsigned char *dest,
int width, int height, int stride);
-void v4lconvert_uyvy_to_yuv420(const unsigned char *src, unsigned char *dst,
+void v4lconvert_uyvy_to_yuv420(const unsigned char *src, unsigned char *dest,
int width, int height, int stride, int yvu);
void v4lconvert_swap_rgb(const unsigned char *src, unsigned char *dst,
int width, int height);
-void v4lconvert_swap_uv(const unsigned char *src, unsigned char *dst,
+void v4lconvert_swap_uv(const unsigned char *src, unsigned char *dest,
const struct v4l2_format *src_fmt);
void v4lconvert_grey_to_rgb24(const unsigned char *src, unsigned char *dest,
@@ -209,9 +209,9 @@ void v4lconvert_m420_to_yuv420(const unsigned char *src,
int v4lconvert_cpia1_to_yuv420(struct v4lconvert_data *data,
const unsigned char *src, int src_size,
- unsigned char *dst, int width, int height, int yvu);
+ unsigned char *dest, int width, int height, int yvu);
-void v4lconvert_sn9c20x_to_yuv420(const unsigned char *src, unsigned char *dst,
+void v4lconvert_sn9c20x_to_yuv420(const unsigned char *raw, unsigned char *i420,
int width, int height, int yvu);
int v4lconvert_se401_to_rgb24(struct v4lconvert_data *data,
@@ -226,13 +226,13 @@ int v4lconvert_decode_jpeg_libjpeg(struct v4lconvert_data *data,
unsigned char *src, int src_size, unsigned char *dest,
struct v4l2_format *fmt, unsigned int dest_pix_fmt);
-int v4lconvert_decode_jpgl(const unsigned char *src, int src_size,
- unsigned int dest_pix_fmt, unsigned char *dest, int width, int height);
+int v4lconvert_decode_jpgl(const unsigned char *inp, int src_size,
+ unsigned int dest_pix_fmt, unsigned char *fb, int width, int height);
-void v4lconvert_decode_spca561(const unsigned char *src, unsigned char *dst,
+void v4lconvert_decode_spca561(const unsigned char *inbuf, unsigned char *outbuf,
int width, int height);
-void v4lconvert_decode_sn9c10x(const unsigned char *src, unsigned char *dst,
+void v4lconvert_decode_sn9c10x(const unsigned char *inp, unsigned char *outp,
int width, int height);
int v4lconvert_decode_pac207(struct v4lconvert_data *data,
@@ -240,7 +240,7 @@ int v4lconvert_decode_pac207(struct v4lconvert_data *data,
int width, int height);
int v4lconvert_decode_mr97310a(struct v4lconvert_data *data,
- const unsigned char *src, int src_size, unsigned char *dst,
+ const unsigned char *inp, int src_size, unsigned char *outp,
int width, int height);
int v4lconvert_decode_jl2005bcd(struct v4lconvert_data *data,
@@ -257,10 +257,10 @@ void v4lconvert_decode_stv0680(const unsigned char *src, unsigned char *dst,
int width, int height);
void v4lconvert_bayer_to_rgb24(const unsigned char *bayer,
- unsigned char *rgb, int width, int height, const unsigned int stride, unsigned int pixfmt);
+ unsigned char *bgr, int width, int height, const unsigned int stride, unsigned int pixfmt);
void v4lconvert_bayer_to_bgr24(const unsigned char *bayer,
- unsigned char *rgb, int width, int height, const unsigned int stride, unsigned int pixfmt);
+ unsigned char *bgr, int width, int height, const unsigned int stride, unsigned int pixfmt);
void v4lconvert_bayer_to_yuv420(const unsigned char *bayer, unsigned char *yuv,
int width, int height, const unsigned int stride, unsigned int src_pixfmt, int yvu);
@@ -275,13 +275,13 @@ void v4lconvert_bayer16_to_bayer8(unsigned char *bayer16,
unsigned char *bayer8, int width, int height);
void v4lconvert_hm12_to_rgb24(const unsigned char *src,
- unsigned char *dst, int width, int height);
+ unsigned char *dest, int width, int height);
void v4lconvert_hm12_to_bgr24(const unsigned char *src,
- unsigned char *dst, int width, int height);
+ unsigned char *dest, int width, int height);
void v4lconvert_hm12_to_yuv420(const unsigned char *src,
- unsigned char *dst, int width, int height, int yvu);
+ unsigned char *dest, int width, int height, int yvu);
void v4lconvert_hsv_to_rgb24(const unsigned char *src, unsigned char *dest,
int width, int height, int bgr, int Xin, unsigned char hsv_enc);
@@ -303,7 +303,7 @@ void v4lconvert_crop(unsigned char *src, unsigned char *dest,
int v4lconvert_helper_decompress(struct v4lconvert_data *data,
const char *helper, const unsigned char *src, int src_size,
- unsigned char *dest, int dest_size, int width, int height, int command);
+ unsigned char *dest, int dest_size, int width, int height, int flags);
void v4lconvert_helper_cleanup(struct v4lconvert_data *data);
diff --git a/lib/libv4lconvert/processing/libv4lprocessing.h b/lib/libv4lconvert/processing/libv4lprocessing.h
index d135a9d6..52184a7c 100644
--- a/lib/libv4lconvert/processing/libv4lprocessing.h
+++ b/lib/libv4lconvert/processing/libv4lprocessing.h
@@ -31,7 +31,7 @@
struct v4lprocessing_data;
struct v4lcontrol_data;
-struct v4lprocessing_data *v4lprocessing_create(int fd, struct v4lcontrol_data *data);
+struct v4lprocessing_data *v4lprocessing_create(int fd, struct v4lcontrol_data *control);
void v4lprocessing_destroy(struct v4lprocessing_data *data);
/* Prepare to process 1 frame, returns 1 if processing is necesary,
diff --git a/lib/libv4lconvert/tinyjpeg.h b/lib/libv4lconvert/tinyjpeg.h
index ee61d234..857f833d 100644
--- a/lib/libv4lconvert/tinyjpeg.h
+++ b/lib/libv4lconvert/tinyjpeg.h
@@ -58,7 +58,7 @@ struct jdec_private *tinyjpeg_init(void);
void tinyjpeg_free(struct jdec_private *priv);
int tinyjpeg_parse_header(struct jdec_private *priv, const unsigned char *buf, unsigned int size);
-int tinyjpeg_decode(struct jdec_private *priv, int pixel_format);
+int tinyjpeg_decode(struct jdec_private *priv, int pixfmt);
const char *tinyjpeg_get_errorstring(struct jdec_private *priv);
void tinyjpeg_get_size(struct jdec_private *priv, unsigned int *width, unsigned int *height);
int tinyjpeg_get_components(struct jdec_private *priv, unsigned char **components);
diff --git a/utils/cec-compliance/cec-compliance.h b/utils/cec-compliance/cec-compliance.h
index f50ea483..7342d75e 100644
--- a/utils/cec-compliance/cec-compliance.h
+++ b/utils/cec-compliance/cec-compliance.h
@@ -285,8 +285,7 @@ struct remote_subtest {
if (test) { \
if (version >= CEC_OP_CEC_VERSION_2_0) \
return fail("%s\n", #test); \
- else \
- warn("fails in CEC 2.0: %s\n", #test); \
+ warn("fails in CEC 2.0: %s\n", #test); \
} \
} while(0)
diff --git a/utils/common/v4l-stream.h b/utils/common/v4l-stream.h
index fe5dfe90..e6b6c27d 100644
--- a/utils/common/v4l-stream.h
+++ b/utils/common/v4l-stream.h
@@ -144,8 +144,8 @@ struct codec_ctx {
u32 comp_max_size;
};
-unsigned rle_compress(__u8 *buf, unsigned size, unsigned bytesperline);
-void rle_decompress(__u8 *buf, unsigned size, unsigned rle_size, unsigned bytesperline);
+unsigned rle_compress(__u8 *buf, unsigned size, unsigned bpl);
+void rle_decompress(__u8 *buf, unsigned size, unsigned rle_size, unsigned bpl);
struct codec_ctx *fwht_alloc(unsigned pixfmt, unsigned visible_width, unsigned visible_height,
unsigned coded_width, unsigned coded_height, unsigned field,
unsigned colorspace, unsigned xfer_func, unsigned ycbcr_enc,
diff --git a/utils/keytable/bpf.h b/utils/keytable/bpf.h
index fb3896c9..f09232cf 100644
--- a/utils/keytable/bpf.h
+++ b/utils/keytable/bpf.h
@@ -89,10 +89,10 @@ int bpf_map_delete_elem(int fd, const void *key);
int bpf_map_get_next_key(int fd, const void *key, void *next_key);
int bpf_obj_pin(int fd, const char *pathname);
int bpf_obj_get(const char *pathname);
-int bpf_prog_attach(int prog_fd, int attachable_fd, enum bpf_attach_type type,
+int bpf_prog_attach(int prog_fd, int target_fd, enum bpf_attach_type type,
unsigned int flags);
-int bpf_prog_detach(int attachable_fd, enum bpf_attach_type type);
-int bpf_prog_detach2(int prog_fd, int attachable_fd, enum bpf_attach_type type);
+int bpf_prog_detach(int target_fd, enum bpf_attach_type type);
+int bpf_prog_detach2(int prog_fd, int target_fd, enum bpf_attach_type type);
int bpf_prog_test_run(int prog_fd, int repeat, void *data, __u32 size,
void *data_out, __u32 *size_out, __u32 *retval,
__u32 *duration);
diff --git a/utils/libcecutil/cec-log.cpp b/utils/libcecutil/cec-log.cpp
index 0ce1e023..f83839b5 100644
--- a/utils/libcecutil/cec-log.cpp
+++ b/utils/libcecutil/cec-log.cpp
@@ -101,12 +101,12 @@ static const struct cec_arg arg_rec_src_type = {
};
static void log_digital(const char *arg_name, const struct cec_op_digital_service_id *digital);
-static void log_rec_src(const char *arg_name, const struct cec_op_record_src *rec_src);
-static void log_tuner_dev_info(const char *arg_name, const struct cec_op_tuner_device_info *tuner_dev_info);
-static void log_features(const struct cec_arg *arg, const char *arg_name, const __u8 *p);
-static void log_ui_command(const char *arg_name, const struct cec_op_ui_command *ui_cmd);
-static void log_descriptors(const char *arg_name, unsigned num, const __u32 *descriptors);
-static void log_u8_array(const char *arg_name, unsigned num, const __u8 *vals);
+static void log_rec_src(const char *arg_string, const struct cec_op_record_src *rec_src);
+static void log_tuner_dev_info(const char *arg_string, const struct cec_op_tuner_device_info *tuner_dev_info);
+static void log_features(const struct cec_arg *arg, const char *arg_string, const __u8 *p);
+static void log_ui_command(const char *arg_string, const struct cec_op_ui_command *ui_cmd);
+static void log_descriptors(const char *arg_string, unsigned num, const __u32 *descriptors);
+static void log_u8_array(const char *arg_string, unsigned num, const __u8 *vals);
static void log_unknown_msg(const struct cec_msg *msg);
static void log_htng_unknown_msg(const struct cec_msg *msg);
--
2.25.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 2/7] treewide: replace C casts with C++
2020-04-20 18:46 [PATCH 1/7] treewide: fix mismatching declarations Rosen Penev
@ 2020-04-20 18:46 ` Rosen Penev
2020-04-20 18:46 ` [PATCH 3/7] treewide: fix wrong *cmp function usage Rosen Penev
` (5 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: Rosen Penev @ 2020-04-20 18:46 UTC (permalink / raw)
To: linux-media
Also removed usedless casts.
Found with clang-tidy's google-readability-casting
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
lib/libdvbv5/tables/mgt.c | 2 +-
lib/libdvbv5/tables/nit.c | 4 +-
lib/libdvbv5/tables/pmt.c | 2 +-
lib/libdvbv5/tables/vct.c | 2 +-
utils/cec-compliance/cec-compliance.cpp | 12 ++---
utils/cec-compliance/cec-test.cpp | 2 +-
utils/cec-ctl/cec-ctl.cpp | 4 +-
utils/cec-follower/cec-follower.cpp | 8 ++--
utils/cec-follower/cec-tuner.cpp | 2 +-
utils/cx18-ctl/cx18-ctl.c | 10 ++---
utils/ivtv-ctl/ivtv-ctl.c | 2 +-
utils/libcecutil/cec-log.cpp | 2 +-
utils/libcecutil/cec-parse.cpp | 2 +-
utils/rds-ctl/rds-ctl.cpp | 12 ++---
utils/v4l2-compliance/v4l2-compliance.cpp | 14 +++---
utils/v4l2-compliance/v4l2-test-buffers.cpp | 22 +++++-----
utils/v4l2-compliance/v4l2-test-colors.cpp | 4 +-
utils/v4l2-compliance/v4l2-test-controls.cpp | 12 ++---
utils/v4l2-compliance/v4l2-test-formats.cpp | 6 +--
.../v4l2-test-input-output.cpp | 4 +-
utils/v4l2-compliance/v4l2-test-media.cpp | 4 +-
utils/v4l2-ctl/v4l2-ctl-common.cpp | 20 ++++-----
utils/v4l2-ctl/v4l2-ctl-edid.cpp | 6 +--
utils/v4l2-ctl/v4l2-ctl-io.cpp | 4 +-
utils/v4l2-ctl/v4l2-ctl-meta.cpp | 8 ++--
utils/v4l2-ctl/v4l2-ctl-modes.cpp | 12 ++---
utils/v4l2-ctl/v4l2-ctl-overlay.cpp | 10 ++---
utils/v4l2-ctl/v4l2-ctl-stds.cpp | 16 +++----
utils/v4l2-ctl/v4l2-ctl-streaming.cpp | 44 +++++++++----------
utils/v4l2-ctl/v4l2-ctl-vidcap.cpp | 4 +-
utils/v4l2-ctl/v4l2-ctl.cpp | 12 ++---
utils/v4l2-dbg/v4l2-dbg.cpp | 4 +-
32 files changed, 136 insertions(+), 136 deletions(-)
diff --git a/lib/libdvbv5/tables/mgt.c b/lib/libdvbv5/tables/mgt.c
index 784e70f4..828c9e7b 100644
--- a/lib/libdvbv5/tables/mgt.c
+++ b/lib/libdvbv5/tables/mgt.c
@@ -121,7 +121,7 @@ void atsc_table_mgt_free(struct atsc_table_mgt *mgt)
{
struct atsc_table_mgt_table *table = mgt->table;
- dvb_desc_free((struct dvb_desc **) &mgt->descriptor);
+ dvb_desc_free(&mgt->descriptor);
while (table) {
struct atsc_table_mgt_table *tmp = table;
diff --git a/lib/libdvbv5/tables/nit.c b/lib/libdvbv5/tables/nit.c
index c343d4e9..ab29d319 100644
--- a/lib/libdvbv5/tables/nit.c
+++ b/lib/libdvbv5/tables/nit.c
@@ -133,9 +133,9 @@ ssize_t dvb_table_nit_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf,
void dvb_table_nit_free(struct dvb_table_nit *nit)
{
struct dvb_table_nit_transport *transport = nit->transport;
- dvb_desc_free((struct dvb_desc **) &nit->descriptor);
+ dvb_desc_free(&nit->descriptor);
while (transport) {
- dvb_desc_free((struct dvb_desc **) &transport->descriptor);
+ dvb_desc_free(&transport->descriptor);
struct dvb_table_nit_transport *tmp = transport;
transport = transport->next;
free(tmp);
diff --git a/lib/libdvbv5/tables/pmt.c b/lib/libdvbv5/tables/pmt.c
index 5ba0bb2e..1234bdfd 100644
--- a/lib/libdvbv5/tables/pmt.c
+++ b/lib/libdvbv5/tables/pmt.c
@@ -147,7 +147,7 @@ void dvb_table_pmt_free(struct dvb_table_pmt *pmt)
stream = stream->next;
free(tmp);
}
- dvb_desc_free((struct dvb_desc **) &pmt->descriptor);
+ dvb_desc_free(&pmt->descriptor);
free(pmt);
}
diff --git a/lib/libdvbv5/tables/vct.c b/lib/libdvbv5/tables/vct.c
index 1ecd61f8..5d37ed58 100644
--- a/lib/libdvbv5/tables/vct.c
+++ b/lib/libdvbv5/tables/vct.c
@@ -160,7 +160,7 @@ void atsc_table_vct_free(struct atsc_table_vct *vct)
channel = channel->next;
free(tmp);
}
- dvb_desc_free((struct dvb_desc **) &vct->descriptor);
+ dvb_desc_free(&vct->descriptor);
free(vct);
}
diff --git a/utils/cec-compliance/cec-compliance.cpp b/utils/cec-compliance/cec-compliance.cpp
index 003b49a2..b665303e 100644
--- a/utils/cec-compliance/cec-compliance.cpp
+++ b/utils/cec-compliance/cec-compliance.cpp
@@ -378,7 +378,7 @@ std::string short_audio_desc2s(const struct short_audio_desc &sad)
oss << audio_format_code2s(sad.format_code);
else
oss << extension_type_code2s(sad.extension_type_code);
- oss << ", " << (int)sad.num_channels << " channels";
+ oss << ", " << static_cast<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) {
diff --git a/utils/cec-compliance/cec-test.cpp b/utils/cec-compliance/cec-test.cpp
index 0ac43afe..9a08f54b 100644
--- a/utils/cec-compliance/cec-test.cpp
+++ b/utils/cec-compliance/cec-test.cpp
@@ -613,7 +613,7 @@ static int dev_menu_ctl_request(struct node *node, unsigned me, unsigned la, boo
}
static struct remote_subtest dev_menu_ctl_subtests[] = {
- { "Menu Request", (__u16)~CEC_LOG_ADDR_MASK_TV, dev_menu_ctl_request },
+ { "Menu Request", static_cast<__u16>(~CEC_LOG_ADDR_MASK_TV), dev_menu_ctl_request },
{ "User Control Pressed", CEC_LOG_ADDR_MASK_ALL, rc_passthrough_user_ctrl_pressed },
{ "User Control Released", CEC_LOG_ADDR_MASK_ALL, rc_passthrough_user_ctrl_released },
};
diff --git a/utils/cec-ctl/cec-ctl.cpp b/utils/cec-ctl/cec-ctl.cpp
index ae668806..3495883e 100644
--- a/utils/cec-ctl/cec-ctl.cpp
+++ b/utils/cec-ctl/cec-ctl.cpp
@@ -386,7 +386,7 @@ std::string ts2s(double ts)
sprintf(buf, "%10.06f", ts);
return buf;
}
- return ts2s((__u64)(ts * 1000000000.0));
+ return ts2s(static_cast<__u64>(ts * 1000000000.0));
}
static __u64 current_ts()
@@ -1875,7 +1875,7 @@ int main(int argc, char **argv)
cec_msg_init(&msg, 0, 0);
msg.msg[0] = options[OptTo] ? to : 0xf0;
- options[(int)ch] = 1;
+ options[ch] = 1;
switch (ch) {
case OptHelp:
diff --git a/utils/cec-follower/cec-follower.cpp b/utils/cec-follower/cec-follower.cpp
index 6ccd2ae2..12bb5f15 100644
--- a/utils/cec-follower/cec-follower.cpp
+++ b/utils/cec-follower/cec-follower.cpp
@@ -244,7 +244,7 @@ std::string opcode2s(const struct cec_msg *msg)
if (name)
return name;
- oss << "CDC: 0x" << std::hex << (unsigned)cdc_opcode;
+ oss << "CDC: 0x" << std::hex << static_cast<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) {
diff --git a/utils/cec-follower/cec-tuner.cpp b/utils/cec-follower/cec-tuner.cpp
index bf33c440..aa19f55d 100644
--- a/utils/cec-follower/cec-tuner.cpp
+++ b/utils/cec-follower/cec-tuner.cpp
@@ -402,7 +402,7 @@ static bool digital_update_tuner_dev_info(struct node *node, int idx,
default:
break;
}
- if (node->state.service_idx != (unsigned)idx && node->state.tuner_report_changes) {
+ if (node->state.service_idx != static_cast<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);
diff --git a/utils/cx18-ctl/cx18-ctl.c b/utils/cx18-ctl/cx18-ctl.c
index ba95fffe..3ce7c018 100644
--- a/utils/cx18-ctl/cx18-ctl.c
+++ b/utils/cx18-ctl/cx18-ctl.c
@@ -255,7 +255,7 @@ int main(int argc, char **argv)
if (ch == -1)
break;
- options[(int)ch] = 1;
+ options[ch] = 1;
switch (ch) {
case OptHelp:
usage();
@@ -344,22 +344,22 @@ int main(int argc, char **argv)
reg.match.type = V4L2_CHIP_MATCH_HOST;
reg.match.addr = 0;
reg.reg = CX18_REG_GPIO_DIR1;
- reg.val = (unsigned)((gpio_dir & 0xffff) << 16);
+ reg.val = ((gpio_dir & 0xffff) << 16);
if (gpio_set_dir && doioctl(fd, VIDIOC_DBG_S_REGISTER, ®,
"VIDIOC_DBG_S_REGISTER") == 0)
printf("GPIO dir 1 set to 0x%08llx\n", reg.val);
reg.reg = CX18_REG_GPIO_DIR2;
- reg.val = (unsigned)(gpio_dir & 0xffff0000);
+ reg.val = (gpio_dir & 0xffff0000);
if (gpio_set_dir && doioctl(fd, VIDIOC_DBG_S_REGISTER, ®,
"VIDIOC_DBG_S_REGISTER") == 0)
printf("GPIO dir 2 set to 0x%08llx\n", reg.val);
reg.reg = CX18_REG_GPIO_OUT1;
- reg.val = (unsigned)((gpio_dir & 0xffff) << 16) | (gpio_out & 0xffff);
+ reg.val = ((gpio_dir & 0xffff) << 16) | (gpio_out & 0xffff);
if (doioctl(fd, VIDIOC_DBG_S_REGISTER, ®,
"VIDIOC_DBG_S_REGISTER") == 0)
printf("GPIO out 1 set to 0x%08llx\n", reg.val);
reg.reg = CX18_REG_GPIO_OUT2;
- reg.val = (unsigned)(gpio_dir & 0xffff0000) | (gpio_out >> 16);
+ reg.val = (gpio_dir & 0xffff0000) | (gpio_out >> 16);
if (doioctl(fd, VIDIOC_DBG_S_REGISTER, ®,
"VIDIOC_DBG_S_REGISTER") == 0)
printf("GPIO out 2 set to 0x%08llx\n", reg.val);
diff --git a/utils/ivtv-ctl/ivtv-ctl.c b/utils/ivtv-ctl/ivtv-ctl.c
index adf8d11e..9923827e 100644
--- a/utils/ivtv-ctl/ivtv-ctl.c
+++ b/utils/ivtv-ctl/ivtv-ctl.c
@@ -310,7 +310,7 @@ int main(int argc, char **argv)
if (ch == -1)
break;
- options[(int)ch] = 1;
+ options[ch] = 1;
switch (ch) {
case OptSetYuvMode:
{
diff --git a/utils/libcecutil/cec-log.cpp b/utils/libcecutil/cec-log.cpp
index f83839b5..d4d5c290 100644
--- a/utils/libcecutil/cec-log.cpp
+++ b/utils/libcecutil/cec-log.cpp
@@ -187,7 +187,7 @@ static void log_features(const struct cec_arg *arg,
const char *arg_name, const __u8 *p)
{
do {
- log_arg(arg, arg_name, (__u32)((*p) & ~CEC_OP_FEAT_EXT));
+ log_arg(arg, arg_name, static_cast<__u32>((*p) & ~CEC_OP_FEAT_EXT));
} while ((*p++) & CEC_OP_FEAT_EXT);
}
diff --git a/utils/libcecutil/cec-parse.cpp b/utils/libcecutil/cec-parse.cpp
index bb73fe57..5fffcce7 100644
--- a/utils/libcecutil/cec-parse.cpp
+++ b/utils/libcecutil/cec-parse.cpp
@@ -162,7 +162,7 @@ static __u8 *args2short_aud_fmt_codes(__u8 audio_format_code1,
int cec_parse_subopt(char **subs, const char * const *subopts, char **value)
{
- int opt = getsubopt(subs, (char * const *)subopts, value);
+ int opt = getsubopt(subs, const_cast<char * const *>(subopts), value);
if (opt == -1) {
fprintf(stderr, "Invalid suboptions specified\n");
diff --git a/utils/rds-ctl/rds-ctl.cpp b/utils/rds-ctl/rds-ctl.cpp
index 770497d4..2d561481 100644
--- a/utils/rds-ctl/rds-ctl.cpp
+++ b/utils/rds-ctl/rds-ctl.cpp
@@ -314,9 +314,9 @@ static void print_devices(dev_vec files)
continue;
doioctl(fd, VIDIOC_QUERYCAP, &vcap);
close(fd);
- bus_info = (const char *)vcap.bus_info;
+ bus_info = reinterpret_cast<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);
diff --git a/utils/v4l2-compliance/v4l2-compliance.cpp b/utils/v4l2-compliance/v4l2-compliance.cpp
index 3983a8a8..938c7c35 100644
--- a/utils/v4l2-compliance/v4l2-compliance.cpp
+++ b/utils/v4l2-compliance/v4l2-compliance.cpp
@@ -285,12 +285,12 @@ int check_string(const char *s, size_t len)
int check_ustring(const __u8 *s, int len)
{
- return check_string((const char *)s, len);
+ return check_string(reinterpret_cast<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) {
diff --git a/utils/v4l2-compliance/v4l2-test-buffers.cpp b/utils/v4l2-compliance/v4l2-test-buffers.cpp
index a103e463..3b45711d 100644
--- a/utils/v4l2-compliance/v4l2-test-buffers.cpp
+++ b/utils/v4l2-compliance/v4l2-test-buffers.cpp
@@ -161,7 +161,7 @@ static bool fill_output_buffer(const cv4l_queue &q, cv4l_buffer &buf, bool first
if (!stream_use_hdr) {
ssize_t sz = read(stream_from_fd, q.g_dataptr(buf.g_index(), p), len);
- if (sz < (ssize_t)len) {
+ if (sz < static_cast<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)
diff --git a/utils/v4l2-compliance/v4l2-test-colors.cpp b/utils/v4l2-compliance/v4l2-test-colors.cpp
index de4dd184..887b198b 100644
--- a/utils/v4l2-compliance/v4l2-test-colors.cpp
+++ b/utils/v4l2-compliance/v4l2-test-colors.cpp
@@ -505,7 +505,7 @@ static int testColorsFmt(struct node *node, unsigned component,
}
fail_on_test(skip);
for (unsigned i = 0; i < fmt.g_num_planes(); i++)
- planes[i] = (__u8 *)q.g_dataptr(buf.g_index(), i);
+ planes[i] = static_cast<__u8 *>(q.g_dataptr(buf.g_index(), i));
} else {
fail_on_test(!(node->g_caps() & V4L2_CAP_READWRITE));
@@ -519,7 +519,7 @@ static int testColorsFmt(struct node *node, unsigned component,
ret = node->read(tmp, size);
fail_on_test(ret != size);
}
- planes[0] = (__u8 *)tmp;
+ planes[0] = static_cast<__u8 *>(tmp);
}
setupPlanes(fmt, planes);
diff --git a/utils/v4l2-compliance/v4l2-test-controls.cpp b/utils/v4l2-compliance/v4l2-test-controls.cpp
index 2a3f64e8..8c4480be 100644
--- a/utils/v4l2-compliance/v4l2-test-controls.cpp
+++ b/utils/v4l2-compliance/v4l2-test-controls.cpp
@@ -82,7 +82,7 @@ static int checkQCtrl(struct node *node, struct test_query_ext_ctrl &qctrl)
return fail("step == 0\n");
if (qctrl.step < 0)
return fail("step < 0\n");
- if ((unsigned)qctrl.step > (unsigned)(qctrl.maximum - qctrl.minimum) &&
+ if (static_cast<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);
diff --git a/utils/v4l2-compliance/v4l2-test-formats.cpp b/utils/v4l2-compliance/v4l2-test-formats.cpp
index 9bc109db..3fc87316 100644
--- a/utils/v4l2-compliance/v4l2-test-formats.cpp
+++ b/utils/v4l2-compliance/v4l2-test-formats.cpp
@@ -174,7 +174,7 @@ static int testEnumFrameSizes(struct node *node, __u32 pixfmt)
return ret;
if (ret == 0 && !(node->g_caps() & (V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VIDEO_CAPTURE_MPLANE)))
return fail("found discrete framesizes when no video capture is supported\n");
- cookie = ((__u64)pixfmt << 32) |
+ cookie = (static_cast<__u64>(pixfmt) << 32) |
(frmsize.discrete.width << 16) |
frmsize.discrete.height;
node->frmsizes.insert(cookie);
@@ -1727,7 +1727,7 @@ static int testBasicScaling(struct node *node, const struct v4l2_format &cur)
compose_is_crop = compose_w == crop_w &&
compose_h == crop_h;
- cookie = ((__u64)v4l_format_g_pixelformat(&fmt) << 32) |
+ cookie = (static_cast<__u64>(v4l_format_g_pixelformat(&fmt)) << 32) |
(v4l_format_g_width(&fmt) << 16) |
v4l_format_g_height(&fmt);
if (node->can_output) {
@@ -1767,7 +1767,7 @@ static int testBasicScaling(struct node *node, const struct v4l2_format &cur)
if (compose_is_crop)
compose_is_crop = sel_compose.r.width == sel_crop.r.width &&
sel_compose.r.height == sel_crop.r.height;
- cookie = ((__u64)v4l_format_g_pixelformat(&fmt) << 32) |
+ cookie = (static_cast<__u64>(v4l_format_g_pixelformat(&fmt)) << 32) |
(v4l_format_g_width(&fmt) << 16) |
v4l_format_g_height(&fmt);
if (node->can_output) {
diff --git a/utils/v4l2-compliance/v4l2-test-input-output.cpp b/utils/v4l2-compliance/v4l2-test-input-output.cpp
index 2bf338e6..fb8d12b1 100644
--- a/utils/v4l2-compliance/v4l2-test-input-output.cpp
+++ b/utils/v4l2-compliance/v4l2-test-input-output.cpp
@@ -233,7 +233,7 @@ int testTunerFreq(struct node *node)
ret = doioctl(node, VIDIOC_G_TUNER, &tuner);
if (ret)
return fail("could not get tuner %d\n", t);
- last_type = (enum v4l2_tuner_type)tuner.type;
+ last_type = static_cast<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");
diff --git a/utils/v4l2-compliance/v4l2-test-media.cpp b/utils/v4l2-compliance/v4l2-test-media.cpp
index 6ac71400..bcd8a725 100644
--- a/utils/v4l2-compliance/v4l2-test-media.cpp
+++ b/utils/v4l2-compliance/v4l2-test-media.cpp
@@ -256,7 +256,7 @@ int testMediaTopology(struct node *node)
fail_on_test(pad.index == ~0U);
fail_on_test(v2_entity_pad_idx_set.find((__u64)pad.entity_id << 32 | pad.index) !=
v2_entity_pad_idx_set.end());
- v2_entity_pad_idx_set.insert((__u64)pad.entity_id << 32 | pad.index);
+ v2_entity_pad_idx_set.insert(static_cast<__u64>(pad.entity_id) << 32 | pad.index);
} else {
fail_on_test(pad.index);
}
@@ -429,7 +429,7 @@ int testMediaEnum(struct node *node)
(MEDIA_PAD_FL_SINK | MEDIA_PAD_FL_SOURCE));
if (node->topology &&
MEDIA_V2_PAD_HAS_INDEX(node->media_version)) {
- __u64 key = (__u64)ent.id << 32 | links.pads[i].index;
+ __u64 key = static_cast<__u64>(ent.id) << 32 | links.pads[i].index;
fail_on_test(v2_entity_pad_idx_set.find(key) ==
v2_entity_pad_idx_set.end());
diff --git a/utils/v4l2-ctl/v4l2-ctl-common.cpp b/utils/v4l2-ctl/v4l2-ctl-common.cpp
index ce6ac2fd..f2997951 100644
--- a/utils/v4l2-ctl/v4l2-ctl-common.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-common.cpp
@@ -314,8 +314,8 @@ static void list_devices()
card = mdi.driver;
}
} else {
- bus_info = (const char *)vcap.bus_info;
- card = (const char *)vcap.card;
+ bus_info = reinterpret_cast<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(", ");
}
diff --git a/utils/v4l2-ctl/v4l2-ctl-edid.cpp b/utils/v4l2-ctl/v4l2-ctl-edid.cpp
index 319cbb4b..366e6522 100644
--- a/utils/v4l2-ctl/v4l2-ctl-edid.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-edid.cpp
@@ -235,7 +235,7 @@ static void edid_add_block(struct v4l2_edid *e)
e->edid = NULL;
exit(1);
}
- e->edid = (unsigned char *)realloc(e->edid, e->blocks * 128);
+ e->edid = static_cast<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);
diff --git a/utils/v4l2-ctl/v4l2-ctl-io.cpp b/utils/v4l2-ctl/v4l2-ctl-io.cpp
index dc2756c8..1130fdc0 100644
--- a/utils/v4l2-ctl/v4l2-ctl-io.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-io.cpp
@@ -184,7 +184,7 @@ void io_list(cv4l_fd &_fd)
printf("\tType : 0x%08X (%s)\n", vin.type, inputtype2s(vin.type));
printf("\tAudioset : 0x%08X\n", vin.audioset);
printf("\tTuner : 0x%08X\n", vin.tuner);
- printf("\tStandard : 0x%016llX (%s)\n", (unsigned long long)vin.std,
+ printf("\tStandard : 0x%016llX (%s)\n", static_cast<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++;
diff --git a/utils/v4l2-ctl/v4l2-ctl-meta.cpp b/utils/v4l2-ctl/v4l2-ctl-meta.cpp
index b1288297..0e1071b0 100644
--- a/utils/v4l2-ctl/v4l2-ctl-meta.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-meta.cpp
@@ -155,10 +155,10 @@ void print_meta_buffer(FILE *f, cv4l_buffer &buf, cv4l_fmt &fmt, cv4l_queue &q)
switch (fmt.g_pixelformat()) {
case V4L2_META_FMT_UVC:
fprintf(f, "UVC: ");
- vbuf = (vivid_uvc_meta_buf *)q.g_dataptr(buf.g_index(), 0);
+ vbuf = static_cast<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;
diff --git a/utils/v4l2-ctl/v4l2-ctl-modes.cpp b/utils/v4l2-ctl/v4l2-ctl-modes.cpp
index 9db07f1a..b311ce5d 100644
--- a/utils/v4l2-ctl/v4l2-ctl-modes.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-modes.cpp
@@ -224,7 +224,7 @@ bool calc_cvt_modeline(int image_width, int image_height,
if (ideal_blank_duty_cycle < 20 * HV_FACTOR)
ideal_blank_duty_cycle = 20 * HV_FACTOR;
- h_blank = active_h_pixel * (long long)ideal_blank_duty_cycle /
+ h_blank = active_h_pixel * static_cast<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
diff --git a/utils/v4l2-ctl/v4l2-ctl-overlay.cpp b/utils/v4l2-ctl/v4l2-ctl-overlay.cpp
index 162248bc..4c9609d6 100644
--- a/utils/v4l2-ctl/v4l2-ctl-overlay.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-overlay.cpp
@@ -402,12 +402,12 @@ static void do_try_set_overlay(struct v4l2_format &fmt, int fd)
win.bitmap = NULL;
if (keep_old_bitmap) {
- bitmap = (unsigned char *)calloc(1, stride * win.w.height);
+ bitmap = static_cast<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);
diff --git a/utils/v4l2-ctl/v4l2-ctl-stds.cpp b/utils/v4l2-ctl/v4l2-ctl-stds.cpp
index d2cbae74..7ba44ae3 100644
--- a/utils/v4l2-ctl/v4l2-ctl-stds.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-stds.cpp
@@ -379,7 +379,7 @@ static void print_dv_timings(const struct v4l2_dv_timings *t)
if (options[OptConcise]) {
printf("\t%dx%d%c%.2f %s\n", bt->width, bt->height,
bt->interlaced ? 'i' : 'p',
- (double)bt->pixelclock /
+ static_cast<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,
diff --git a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
index d9a307f9..de40c5ad 100644
--- a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
@@ -253,7 +253,7 @@ double fps_timestamps::fps()
double period = sum / cnt;
double fps = 1.0 / period;
- first += (unsigned)(ts[prev_idx] - first);
+ first += static_cast<unsigned>(ts[prev_idx] - first);
return fps;
};
@@ -510,7 +510,7 @@ static void print_buffer(FILE *f, struct v4l2_buffer &buf)
fprintf(f, "\tLength : %u\n", buf.length);
fprintf(f, "\tBytesused: %u\n", buf.bytesused);
fprintf(f, "\tTimestamp: %llu.%06llus (%s, %s)\n",
- (__u64)buf.timestamp.tv_sec, (__u64)buf.timestamp.tv_usec,
+ static_cast<__u64>(buf.timestamp.tv_sec), static_cast<__u64>(buf.timestamp.tv_usec),
timestamp_type2s(buf.flags).c_str(), timestamp_src2s(buf.flags).c_str());
if (buf.flags & V4L2_BUF_FLAG_TIMECODE) {
static const int fps_types[] = { 0, 24, 25, 30, 50, 60 };
@@ -721,9 +721,9 @@ void streaming_cmd(int ch, char *optarg)
if (speed > 3)
speed = 3;
if (ch == OptStreamOutHorSpeed)
- stream_out_hor_mode = (tpg_move_mode)(speed + 3);
+ stream_out_hor_mode = static_cast<tpg_move_mode>(speed + 3);
else
- stream_out_vert_mode = (tpg_move_mode)(speed + 3);
+ stream_out_vert_mode = static_cast<tpg_move_mode>(speed + 3);
break;
case OptStreamOutPercFill:
stream_out_perc_fill = strtoul(optarg, 0L, 0);
@@ -1023,7 +1023,7 @@ static bool fill_buffer_from_file(cv4l_fd &fd, cv4l_queue &q, cv4l_buffer &b,
read_u32(fin); // ignore field
read_u32(fin); // ignore flags
for (unsigned j = 0; j < q.g_num_planes(); j++) {
- __u8 *buf = (__u8 *)q.g_dataptr(b.g_index(), j);
+ __u8 *buf = static_cast<__u8 *>(q.g_dataptr(b.g_index(), j));
sz = read_u32(fin);
if (sz != V4L_STREAM_PACKET_FRAME_VIDEO_SIZE_PLANE_HDR) {
@@ -1052,7 +1052,7 @@ static bool fill_buffer_from_file(cv4l_fd &fd, cv4l_queue &q, cv4l_buffer &b,
fprintf(stderr, "error reading %d bytes\n", sz);
return false;
}
- if ((__u32)n == sz)
+ if (static_cast<__u32>(n) == sz)
break;
offset += n;
sz -= n;
@@ -1108,10 +1108,10 @@ restart:
}
if (fmt.g_pixelformat() == V4L2_PIX_FMT_FWHT_STATELESS)
- res = read_fwht_frame(fmt, (unsigned char *)buf, fin,
+ res = read_fwht_frame(fmt, static_cast<unsigned char *>(buf), fin,
sz, expected_len, buf_len);
else if (support_out_crop && v4l2_fwht_find_pixfmt(fmt.g_pixelformat()))
- res = read_write_padded_frame(fmt, (unsigned char *)buf,
+ res = read_write_padded_frame(fmt, static_cast<unsigned char *>(buf),
fin, sz, expected_len, buf_len, true);
else
sz = fread(buf, 1, expected_len, fin);
@@ -1197,7 +1197,7 @@ static int do_setup_out_buffers(cv4l_fd &fd, cv4l_queue &q, FILE *fin, bool qbuf
for (p = 0; p < fmt.g_num_planes(); p++)
tpg_s_bytesperline(&tpg, p,
fmt.g_bytesperline(p));
- tpg_s_pattern(&tpg, (tpg_pattern)stream_pat);
+ tpg_s_pattern(&tpg, static_cast<tpg_pattern>(stream_pat));
tpg_s_mv_hor_mode(&tpg, stream_out_hor_mode);
tpg_s_mv_vert_mode(&tpg, stream_out_vert_mode);
tpg_s_show_square(&tpg, stream_out_square);
@@ -1215,7 +1215,7 @@ static int do_setup_out_buffers(cv4l_fd &fd, cv4l_queue &q, FILE *fin, bool qbuf
tpg_s_pixel_aspect(&tpg, aspect);
break;
default:
- tpg_s_pixel_aspect(&tpg, (tpg_pixel_aspect)stream_out_pixel_aspect);
+ tpg_s_pixel_aspect(&tpg, static_cast<tpg_pixel_aspect>(stream_out_pixel_aspect));
break;
}
field = output_field;
@@ -1245,7 +1245,7 @@ static int do_setup_out_buffers(cv4l_fd &fd, cv4l_queue &q, FILE *fin, bool qbuf
if (can_fill) {
for (unsigned j = 0; j < q.g_num_planes(); j++)
- tpg_fillbuffer(&tpg, stream_out_std, j, (u8 *)q.g_dataptr(i, j));
+ tpg_fillbuffer(&tpg, stream_out_std, j, static_cast<u8 *>(q.g_dataptr(i, j)));
}
}
if (is_meta)
@@ -1318,7 +1318,7 @@ static void write_buffer_to_file(cv4l_fd &fd, cv4l_queue &q, cv4l_buffer &buf,
for (unsigned j = 0; j < buf.g_num_planes(); j++) {
__u32 used = buf.g_bytesused(j);
unsigned offset = buf.g_data_offset(j);
- u8 *p = (u8 *)q.g_dataptr(buf.g_index(), j) + offset;
+ u8 *p = static_cast<u8 *>(q.g_dataptr(buf.g_index(), j)) + offset;
if (ctx) {
comp_ptr[j] = fwht_compress(ctx, p,
@@ -1365,10 +1365,10 @@ static void write_buffer_to_file(cv4l_fd &fd, cv4l_queue &q, cv4l_buffer &buf,
if (host_fd_to >= 0)
sz = fwrite(comp_ptr[j] + offset, 1, used, fout);
else if (support_cap_compose && v4l2_fwht_find_pixfmt(fmt.g_pixelformat()))
- read_write_padded_frame(fmt, (u8 *)q.g_dataptr(buf.g_index(), j) + offset,
+ read_write_padded_frame(fmt, static_cast<u8 *>(q.g_dataptr(buf.g_index(), j)) + offset,
fout, sz, used, used, false);
else
- sz = fwrite((u8 *)q.g_dataptr(buf.g_index(), j) + offset, 1, used, fout);
+ sz = fwrite(static_cast<u8 *>(q.g_dataptr(buf.g_index(), j)) + offset, 1, used, fout);
if (sz != used)
fprintf(stderr, "%u != %u\n", sz, used);
@@ -1500,7 +1500,7 @@ static int do_handle_out(cv4l_fd &fd, cv4l_queue &q, FILE *fin, cv4l_buffer *cap
unsigned data_offset = cap->g_data_offset(j);
if (q.g_memory() == V4L2_MEMORY_USERPTR) {
- buf.s_userptr((u8 *)cap->g_userptr(j) + data_offset, j);
+ buf.s_userptr(static_cast<u8 *>(cap->g_userptr(j)) + data_offset, j);
buf.s_bytesused(cap->g_bytesused(j) - data_offset, j);
buf.s_data_offset(0, j);
} else if (q.g_memory() == V4L2_MEMORY_DMABUF) {
@@ -1551,7 +1551,7 @@ static int do_handle_out(cv4l_fd &fd, cv4l_queue &q, FILE *fin, cv4l_buffer *cap
if (!fin && stream_out_refresh) {
for (unsigned j = 0; j < buf.g_num_planes(); j++)
tpg_fillbuffer(&tpg, stream_out_std, j,
- (u8 *)q.g_dataptr(buf.g_index(), j));
+ static_cast<u8 *>(q.g_dataptr(buf.g_index(), j)));
}
if (is_meta)
meta_fillbuffer(buf, fmt, q);
@@ -1683,13 +1683,13 @@ static FILE *open_output_file(cv4l_fd &fd)
fprintf(stderr, "no such host %s\n", host_to);
exit(0);
}
- memset((char *)&serv_addr, 0, sizeof(serv_addr));
+ memset(reinterpret_cast<char *>(&serv_addr), 0, sizeof(serv_addr));
serv_addr.sin_family = AF_INET;
- memcpy((char *)&serv_addr.sin_addr.s_addr,
- (char *)server->h_addr,
+ memcpy(reinterpret_cast<char *>(&serv_addr.sin_addr.s_addr),
+ server->h_addr,
server->h_length);
serv_addr.sin_port = htons(host_port_to);
- if (connect(host_fd_to, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) < 0) {
+ if (connect(host_fd_to, reinterpret_cast<struct sockaddr *>(&serv_addr), sizeof(serv_addr)) < 0) {
fprintf(stderr, "could not connect\n");
exit(0);
}
@@ -1941,13 +1941,13 @@ static FILE *open_input_file(cv4l_fd &fd, __u32 type)
serv_addr.sin_family = AF_INET;
serv_addr.sin_addr.s_addr = INADDR_ANY;
serv_addr.sin_port = htons(host_port_from);
- if (bind(listen_fd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) < 0) {
+ if (bind(listen_fd, reinterpret_cast<struct sockaddr *>(&serv_addr), sizeof(serv_addr)) < 0) {
fprintf(stderr, "could not bind\n");
exit(1);
}
listen(listen_fd, 1);
clilen = sizeof(cli_addr);
- host_fd_from = accept(listen_fd, (struct sockaddr *)&cli_addr, &clilen);
+ host_fd_from = accept(listen_fd, reinterpret_cast<struct sockaddr *>(&cli_addr), &clilen);
if (host_fd_from < 0) {
fprintf(stderr, "could not accept\n");
exit(1);
diff --git a/utils/v4l2-ctl/v4l2-ctl-vidcap.cpp b/utils/v4l2-ctl/v4l2-ctl-vidcap.cpp
index 8f87ecbd..a9ef8eed 100644
--- a/utils/v4l2-ctl/v4l2-ctl-vidcap.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-vidcap.cpp
@@ -365,7 +365,7 @@ void print_touch_buffer(FILE *f, cv4l_buffer &buf, cv4l_fmt &fmt, cv4l_queue &q)
'.', ',', ':', ';', '!', '|', 'i', 'c',
'n', 'o', 'm', 'I', 'C', 'N', 'O', 'M',
};
- __s16 *vbuf = (__s16 *)q.g_dataptr(buf.g_index(), 0);
+ __s16 *vbuf = static_cast<__s16 *>(q.g_dataptr(buf.g_index(), 0));
__u32 x, y;
switch (fmt.g_pixelformat()) {
@@ -374,7 +374,7 @@ void print_touch_buffer(FILE *f, cv4l_buffer &buf, cv4l_fmt &fmt, cv4l_queue &q)
fprintf(f, "TD16: ");
for (x = 0; x < fmt.g_width(); x++, vbuf++) {
- __s16 v = (__s16)le16toh(*vbuf);
+ __s16 v = static_cast<__s16>(le16toh(*vbuf));
if (!options[OptConcise])
fprintf(f, "% 4d", v);
diff --git a/utils/v4l2-ctl/v4l2-ctl.cpp b/utils/v4l2-ctl/v4l2-ctl.cpp
index 1866172f..42889ef8 100644
--- a/utils/v4l2-ctl/v4l2-ctl.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl.cpp
@@ -396,7 +396,7 @@ static std::string printfmtname(int fd, __u32 type, __u32 pixfmt)
fmt.type = type;
while (test_ioctl(fd, VIDIOC_ENUM_FMT, &fmt) >= 0) {
if (fmt.pixelformat == pixfmt)
- return s + (const char *)fmt.description + ")";
+ return s + reinterpret_cast<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) {
diff --git a/utils/v4l2-dbg/v4l2-dbg.cpp b/utils/v4l2-dbg/v4l2-dbg.cpp
index 8fb70775..17ab0210 100644
--- a/utils/v4l2-dbg/v4l2-dbg.cpp
+++ b/utils/v4l2-dbg/v4l2-dbg.cpp
@@ -382,7 +382,7 @@ static int doioctl(int fd, unsigned long int request, void *parm, const char *na
static int parse_subopt(char **subs, const char * const *subopts, char **value)
{
- int opt = getsubopt(subs, (char * const *)subopts, value);
+ int opt = getsubopt(subs, const_cast<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) {
--
2.25.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 3/7] treewide: fix wrong *cmp function usage
2020-04-20 18:46 [PATCH 1/7] treewide: fix mismatching declarations Rosen Penev
2020-04-20 18:46 ` [PATCH 2/7] treewide: replace C casts with C++ Rosen Penev
@ 2020-04-20 18:46 ` Rosen Penev
2020-04-21 7:31 ` Hans Verkuil
2020-04-20 18:46 ` [PATCH 4/7] treewide: apply performance fixes Rosen Penev
` (4 subsequent siblings)
6 siblings, 1 reply; 12+ messages in thread
From: Rosen Penev @ 2020-04-20 18:46 UTC (permalink / raw)
To: linux-media
Found with bugprone-suspicious-string-compare
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
lib/libdvbv5/countries.c | 2 +-
lib/libdvbv5/dvb-dev-remote.c | 4 ++--
lib/libdvbv5/parse_string.c | 4 ++--
lib/libv4l2rds/libv4l2rds.c | 6 +++---
utils/cec-compliance/cec-test-adapter.cpp | 2 +-
utils/cec-compliance/cec-test.cpp | 8 ++++----
utils/cec-ctl/cec-ctl.cpp | 2 +-
utils/common/media-info.cpp | 4 ++--
utils/dvb/dvbv5-daemon.c | 2 +-
utils/dvb/dvbv5-scan.c | 2 +-
utils/ir-ctl/ir-ctl.c | 4 ++--
utils/keytable/keytable.c | 6 +++---
utils/libmedia_dev/get_media_devices.c | 4 ++--
utils/media-ctl/libmediactl.c | 2 +-
utils/media-ctl/libv4l2subdev.c | 2 +-
utils/v4l2-compliance/v4l2-compliance.cpp | 18 +++++++++---------
utils/v4l2-compliance/v4l2-test-buffers.cpp | 4 ++--
utils/v4l2-compliance/v4l2-test-media.cpp | 16 ++++++++--------
utils/v4l2-compliance/v4l2-test-subdevs.cpp | 4 ++--
utils/v4l2-ctl/v4l2-ctl-common.cpp | 2 +-
20 files changed, 49 insertions(+), 49 deletions(-)
diff --git a/lib/libdvbv5/countries.c b/lib/libdvbv5/countries.c
index 609add0b..c5682365 100644
--- a/lib/libdvbv5/countries.c
+++ b/lib/libdvbv5/countries.c
@@ -395,7 +395,7 @@ enum dvb_country_t dvb_guess_user_country(void)
continue;
if (! strncmp(buf, "POSIX", MIN(strlen(buf), 5)) ||
- ! (strncmp(buf, "en", MIN(strlen(buf), 2)) && !isalpha(buf[2])) )
+ ! (strncmp(buf, "en", MIN(strlen(buf), 2)) != 0 && !isalpha(buf[2])) )
continue;
buf = strdup(buf);
diff --git a/lib/libdvbv5/dvb-dev-remote.c b/lib/libdvbv5/dvb-dev-remote.c
index ebb1bdb7..643ca559 100644
--- a/lib/libdvbv5/dvb-dev-remote.c
+++ b/lib/libdvbv5/dvb-dev-remote.c
@@ -733,7 +733,7 @@ static void *receive_data(void *privdata)
handled = 1;
- if (strcmp(msg->cmd, cmd)) {
+ if (strcmp(msg->cmd, cmd) != 0) {
dvb_logerr("msg #%d: Expecting '%s', got '%s'",
seq, msg->cmd, cmd);
free_msg(dvb, msg);
@@ -792,7 +792,7 @@ static int dvb_remote_get_version(struct dvb_device_priv *dvb)
goto error;
}
- if (strcmp(version, daemon_version)) {
+ if (strcmp(version, daemon_version) != 0) {
dvb_logerr("Wrong version. Expecting '%s', received '%s'",
daemon_version, version);
ret = 0;
diff --git a/lib/libdvbv5/parse_string.c b/lib/libdvbv5/parse_string.c
index d354f497..b3518291 100644
--- a/lib/libdvbv5/parse_string.c
+++ b/lib/libdvbv5/parse_string.c
@@ -348,7 +348,7 @@ static void charset_conversion(struct dvb_v5_fe_parms *parms, char **dest, const
*p = '\0';
/* If desired charset is not UTF-8, prepare for conversion */
- if (strcasecmp(parms->output_charset, "UTF-8")) {
+ if (strcasecmp(parms->output_charset, "UTF-8") != 0) {
tmp = (unsigned char *)*dest;
len = p - *dest;
@@ -391,7 +391,7 @@ void dvb_parse_string(struct dvb_v5_fe_parms *parms, char **dest, char **emph,
* Strings in ISDB-S/T(JP) do not start with a charset identifier,
* and can start with a control character (< 0x20).
*/
- if (strcasecmp(type, "ARIB-STD-B24") && *src < 0x20) {
+ if (strcasecmp(type, "ARIB-STD-B24") != 0 && *src < 0x20) {
switch (*src) {
case 0x00: type = "ISO-6937"; break;
case 0x01: type = "ISO-8859-5"; break;
diff --git a/lib/libv4l2rds/libv4l2rds.c b/lib/libv4l2rds/libv4l2rds.c
index 2e67d060..a053adea 100644
--- a/lib/libv4l2rds/libv4l2rds.c
+++ b/lib/libv4l2rds/libv4l2rds.c
@@ -920,7 +920,7 @@ static uint32_t rds_decode_group2(struct rds_private_state *priv_state)
if (segment == 0x0f) {
handle->rt_length = 64;
handle->valid_fields |= V4L2_RDS_RT;
- if (memcmp(handle->rt, priv_state->new_rt, 64)) {
+ if (memcmp(handle->rt, priv_state->new_rt, 64) != 0) {
memcpy(handle->rt, priv_state->new_rt, 64);
updated_fields |= V4L2_RDS_RT;
}
@@ -937,7 +937,7 @@ static uint32_t rds_decode_group2(struct rds_private_state *priv_state)
handle->rt_length = 32;
handle->valid_fields |= V4L2_RDS_RT;
updated_fields |= V4L2_RDS_RT;
- if (memcmp(handle->rt, priv_state->new_rt, 32)) {
+ if (memcmp(handle->rt, priv_state->new_rt, 32) != 0) {
memcpy(handle->rt, priv_state->new_rt, 32);
updated_fields |= V4L2_RDS_RT;
}
@@ -954,7 +954,7 @@ static uint32_t rds_decode_group2(struct rds_private_state *priv_state)
priv_state->new_rt[i] = '\0';
handle->rt_length = i;
handle->valid_fields |= V4L2_RDS_RT;
- if (memcmp(handle->rt, priv_state->new_rt, handle->rt_length)) {
+ if (memcmp(handle->rt, priv_state->new_rt, handle->rt_length) != 0) {
memcpy(handle->rt, priv_state->new_rt,
handle->rt_length);
updated_fields |= V4L2_RDS_RT;
diff --git a/utils/cec-compliance/cec-test-adapter.cpp b/utils/cec-compliance/cec-test-adapter.cpp
index 0675ccb7..27c742b3 100644
--- a/utils/cec-compliance/cec-test-adapter.cpp
+++ b/utils/cec-compliance/cec-test-adapter.cpp
@@ -193,7 +193,7 @@ static int testAdapLogAddrs(struct node *node)
fail_on_test(laddrs.log_addr_mask == 0);
for (unsigned i = 0; i < laddrs.num_log_addrs; i++) {
fail_on_test(laddrs.log_addr[i] == CEC_LOG_ADDR_INVALID);
- fail_on_test(memcmp(laddrs.features[i], features, 4));
+ fail_on_test(memcmp(laddrs.features[i], features, 4) != 0);
fail_on_test(check_0(laddrs.features[i] + 4, 8));
}
for (unsigned i = laddrs.num_log_addrs; i < CEC_MAX_LOG_ADDRS; i++) {
diff --git a/utils/cec-compliance/cec-test.cpp b/utils/cec-compliance/cec-test.cpp
index 9a08f54b..4aa54afc 100644
--- a/utils/cec-compliance/cec-test.cpp
+++ b/utils/cec-compliance/cec-test.cpp
@@ -116,7 +116,7 @@ int system_info_get_menu_lang(struct node *node, unsigned me, unsigned la, bool
if (cec_msg_status_is_abort(&msg))
return OK_PRESUMED;
cec_ops_set_menu_language(&msg, language);
- fail_on_test(strcmp(node->remote[la].language, language));
+ fail_on_test(strcmp(node->remote[la].language, language) != 0);
return 0;
}
@@ -319,7 +319,7 @@ int device_osd_transfer_give(struct node *node, unsigned me, unsigned la, bool i
char osd_name[15];
cec_ops_set_osd_name(&msg, osd_name);
fail_on_test(!osd_name[0]);
- fail_on_test(strcmp(node->remote[la].osd_name, osd_name));
+ fail_on_test(strcmp(node->remote[la].osd_name, osd_name) != 0);
fail_on_test(msg.len != strlen(osd_name) + 2);
return 0;
@@ -937,11 +937,11 @@ static int tuner_ctl_test(struct node *node, unsigned me, unsigned la, bool inte
fail_on_test(timed_out_or_abort(&msg));
info = {};
cec_ops_tuner_device_status(&msg, &info);
- if (memcmp(&info, &(*iter), sizeof(info))) {
+ if (memcmp(&info, &(*iter), sizeof(info)) != 0) {
log_tuner_service(info);
log_tuner_service(*iter);
}
- fail_on_test(memcmp(&info, &(*iter), sizeof(info)));
+ fail_on_test(memcmp(&info, &(*iter), sizeof(info)) != 0);
}
printf("\t Finished Channel Test\n");
diff --git a/utils/cec-ctl/cec-ctl.cpp b/utils/cec-ctl/cec-ctl.cpp
index 3495883e..be37ae3c 100644
--- a/utils/cec-ctl/cec-ctl.cpp
+++ b/utils/cec-ctl/cec-ctl.cpp
@@ -975,7 +975,7 @@ static void analyze(const char *analyze_pin)
exit(1);
}
if (!fgets(s, sizeof(s), fanalyze) ||
- strcmp(s, "# cec-ctl --store-pin\n"))
+ strcmp(s, "# cec-ctl --store-pin\n") != 0)
goto err;
line++;
if (!fgets(s, sizeof(s), fanalyze) ||
diff --git a/utils/common/media-info.cpp b/utils/common/media-info.cpp
index a5b429a0..b0f0bc41 100644
--- a/utils/common/media-info.cpp
+++ b/utils/common/media-info.cpp
@@ -187,7 +187,7 @@ std::string mi_get_devpath_from_dev_t(dev_t dev)
if (bytes <= 0)
break;
line[bytes - 1] = 0;
- if (memcmp(line, "DEVNAME=", 8) || !line[8])
+ if ((memcmp(line, "DEVNAME=", 8) != 0) || !line[8])
continue;
devpath = "/dev/";
devpath += line + 8;
@@ -229,7 +229,7 @@ int mi_get_media_fd(int fd, const char *bus_info)
if (bus_info &&
(ioctl(media_fd, MEDIA_IOC_DEVICE_INFO, &mdinfo) ||
- strcmp(mdinfo.bus_info, bus_info))) {
+ (strcmp(mdinfo.bus_info, bus_info) != 0))) {
close(media_fd);
continue;
}
diff --git a/utils/dvb/dvbv5-daemon.c b/utils/dvb/dvbv5-daemon.c
index ad1197b7..a17233b2 100644
--- a/utils/dvb/dvbv5-daemon.c
+++ b/utils/dvb/dvbv5-daemon.c
@@ -1203,7 +1203,7 @@ static int dev_set_parms(uint32_t seq, char *cmd, int fd,
if (!*new_lnb) {
par->lnb = NULL;
- } else if (strcmp(old_lnb, new_lnb)) {
+ } else if (strcmp(old_lnb, new_lnb) != 0) {
int lnb = dvb_sat_search_lnb(new_lnb);
if (lnb < 0) {
diff --git a/utils/dvb/dvbv5-scan.c b/utils/dvb/dvbv5-scan.c
index 0a522433..30f8385f 100644
--- a/utils/dvb/dvbv5-scan.c
+++ b/utils/dvb/dvbv5-scan.c
@@ -288,7 +288,7 @@ static int run_scan(struct arguments *args, struct dvb_device *dvb)
* to avoid linear search of LNB types for every entries.
*/
if (!args->lnb_name && entry->lnb &&
- (!parms->lnb || strcasecmp(entry->lnb, parms->lnb->alias)))
+ (!parms->lnb || strcasecmp(entry->lnb, parms->lnb->alias) != 0))
parms->lnb = dvb_sat_get_lnb(dvb_sat_search_lnb(entry->lnb));
/*
diff --git a/utils/ir-ctl/ir-ctl.c b/utils/ir-ctl/ir-ctl.c
index ba454619..9f8c1c5d 100644
--- a/utils/ir-ctl/ir-ctl.c
+++ b/utils/ir-ctl/ir-ctl.c
@@ -739,7 +739,7 @@ static struct send* convert_keycode(struct keymap *map, const char *keycode)
struct raw_entry *re;
for (re = map->raw; re; re = re->next) {
- if (strcmp(re->keycode, keycode))
+ if (strcmp(re->keycode, keycode) != 0)
continue;
count++;
@@ -760,7 +760,7 @@ static struct send* convert_keycode(struct keymap *map, const char *keycode)
const char *proto_str;
enum rc_proto proto;
- if (strcmp(se->keycode, keycode))
+ if (strcmp(se->keycode, keycode) != 0)
continue;
count++;
diff --git a/utils/keytable/keytable.c b/utils/keytable/keytable.c
index 4db91267..2c76f52b 100644
--- a/utils/keytable/keytable.c
+++ b/utils/keytable/keytable.c
@@ -360,7 +360,7 @@ static void add_bpf_protocol(struct bpf_protocol *new)
struct bpf_protocol *a;
for (a = bpf_protocol; a; a = a->next) {
- if (strcmp(a->name, new->name))
+ if (strcmp(a->name, new->name) != 0)
continue;
if (compare_parameters(a->param, new->param) &&
@@ -2075,9 +2075,9 @@ int main(int argc, char *argv[])
int matches = 0;
for (cur = &cfg; cur->next; cur = cur->next) {
- if ((!rc_dev.drv_name || strcasecmp(cur->driver, rc_dev.drv_name)) && strcasecmp(cur->driver, "*"))
+ if ((!rc_dev.drv_name || strcasecmp(cur->driver, rc_dev.drv_name) != 0) && strcasecmp(cur->driver, "*") != 0)
continue;
- if ((!rc_dev.keytable_name || strcasecmp(cur->table, rc_dev.keytable_name)) && strcasecmp(cur->table, "*"))
+ if ((!rc_dev.keytable_name || strcasecmp(cur->table, rc_dev.keytable_name) != 0) && strcasecmp(cur->table, "*") != 0)
continue;
if (debug)
diff --git a/utils/libmedia_dev/get_media_devices.c b/utils/libmedia_dev/get_media_devices.c
index 491a94da..462b8b97 100644
--- a/utils/libmedia_dev/get_media_devices.c
+++ b/utils/libmedia_dev/get_media_devices.c
@@ -431,7 +431,7 @@ void display_media_devices(void *opaque)
char *prev = "";
for (i = 0; i < md->md_size; i++) {
- if (strcmp(prev, md_ptr->device)) {
+ if (strcmp(prev, md_ptr->device) != 0) {
printf("\nDevice %s:\n\t", md_ptr->device);
prev = md_ptr->device;
}
@@ -584,7 +584,7 @@ const char *get_not_associated_device(void *opaque,
}
if (last_seek && !found)
continue;
- if (strcmp(prev, md_ptr->device)) {
+ if (strcmp(prev, md_ptr->device) != 0) {
if (!skip && result)
break;
prev = md_ptr->device;
diff --git a/utils/media-ctl/libmediactl.c b/utils/media-ctl/libmediactl.c
index 1fd6525b..6ef9a3f5 100644
--- a/utils/media-ctl/libmediactl.c
+++ b/utils/media-ctl/libmediactl.c
@@ -475,7 +475,7 @@ static int media_get_devname_sysfs(struct media_entity *entity)
if (strstr(p + 1, "dvb")) {
char *s = p + 1;
- if (strncmp(s, "dvb", 3))
+ if (strncmp(s, "dvb", 3) != 0)
return -EINVAL;
s += 3;
p = strchr(s, '.');
diff --git a/utils/media-ctl/libv4l2subdev.c b/utils/media-ctl/libv4l2subdev.c
index 0d0afbe7..3b4490aa 100644
--- a/utils/media-ctl/libv4l2subdev.c
+++ b/utils/media-ctl/libv4l2subdev.c
@@ -433,7 +433,7 @@ static bool strhazit(const char *str, const char **p)
{
int len = strlen(str);
- if (strncmp(str, *p, len))
+ if (strncmp(str, *p, len) != 0)
return false;
for (*p += len; isspace(**p); ++*p);
diff --git a/utils/v4l2-compliance/v4l2-compliance.cpp b/utils/v4l2-compliance/v4l2-compliance.cpp
index 938c7c35..0c3af294 100644
--- a/utils/v4l2-compliance/v4l2-compliance.cpp
+++ b/utils/v4l2-compliance/v4l2-compliance.cpp
@@ -620,14 +620,14 @@ static int testCap(struct node *node)
fail_on_test(check_ustring(vcap.card, sizeof(vcap.card)));
fail_on_test(check_ustring(vcap.bus_info, sizeof(vcap.bus_info)));
// Check for valid prefixes
- if (memcmp(vcap.bus_info, "usb-", 4) &&
- memcmp(vcap.bus_info, "PCI:", 4) &&
- memcmp(vcap.bus_info, "PCIe:", 5) &&
- memcmp(vcap.bus_info, "ISA:", 4) &&
- memcmp(vcap.bus_info, "I2C:", 4) &&
- memcmp(vcap.bus_info, "parport", 7) &&
- memcmp(vcap.bus_info, "platform:", 9) &&
- memcmp(vcap.bus_info, "rmi4:", 5))
+ if (memcmp(vcap.bus_info, "usb-", 4) != 0 &&
+ memcmp(vcap.bus_info, "PCI:", 4) != 0 &&
+ memcmp(vcap.bus_info, "PCIe:", 5) != 0 &&
+ memcmp(vcap.bus_info, "ISA:", 4) != 0 &&
+ memcmp(vcap.bus_info, "I2C:", 4) != 0 &&
+ memcmp(vcap.bus_info, "parport", 7) != 0 &&
+ memcmp(vcap.bus_info, "platform:", 9) != 0 &&
+ memcmp(vcap.bus_info, "rmi4:", 5) != 0)
return fail("missing bus_info prefix ('%s')\n", vcap.bus_info);
if (!node->media_bus_info.empty() &&
node->media_bus_info != std::string(reinterpret_cast<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;
diff --git a/utils/v4l2-compliance/v4l2-test-buffers.cpp b/utils/v4l2-compliance/v4l2-test-buffers.cpp
index 3b45711d..004de314 100644
--- a/utils/v4l2-compliance/v4l2-test-buffers.cpp
+++ b/utils/v4l2-compliance/v4l2-test-buffers.cpp
@@ -1011,7 +1011,7 @@ static int captureBufs(struct node *node, struct node *node_m2m_cap, const cv4l_
(orig_buf.flags & valid_output_flags));
if (buf.g_flags() & V4L2_BUF_FLAG_TIMECODE)
fail_on_test(memcmp(&buf.g_timecode(), &orig_buf.timecode,
- sizeof(orig_buf.timecode)));
+ sizeof(orig_buf.timecode)) != 0);
}
fail_on_test(buf.g_flags() & V4L2_BUF_FLAG_DONE);
@@ -1085,7 +1085,7 @@ static int captureBufs(struct node *node, struct node *node_m2m_cap, const cv4l_
(orig_buf.flags & valid_output_flags));
if (buf.g_flags() & V4L2_BUF_FLAG_TIMECODE)
fail_on_test(memcmp(&buf.g_timecode(), &orig_buf.timecode,
- sizeof(orig_buf.timecode)));
+ sizeof(orig_buf.timecode)) != 0);
}
fail_on_test(buf.g_flags() & V4L2_BUF_FLAG_DONE);
if (!count || stopped) {
diff --git a/utils/v4l2-compliance/v4l2-test-media.cpp b/utils/v4l2-compliance/v4l2-test-media.cpp
index bcd8a725..bcba3b15 100644
--- a/utils/v4l2-compliance/v4l2-test-media.cpp
+++ b/utils/v4l2-compliance/v4l2-test-media.cpp
@@ -53,14 +53,14 @@ int testMediaDeviceInfo(struct node *node)
} else {
fail_on_test(check_string(mdinfo.bus_info, sizeof(mdinfo.bus_info)));
// Check for valid prefixes
- if (memcmp(mdinfo.bus_info, "usb-", 4) &&
- memcmp(mdinfo.bus_info, "PCI:", 4) &&
- memcmp(mdinfo.bus_info, "PCIe:", 5) &&
- memcmp(mdinfo.bus_info, "ISA:", 4) &&
- memcmp(mdinfo.bus_info, "I2C:", 4) &&
- memcmp(mdinfo.bus_info, "parport", 7) &&
- memcmp(mdinfo.bus_info, "platform:", 9) &&
- memcmp(mdinfo.bus_info, "rmi4:", 5))
+ if (memcmp(mdinfo.bus_info, "usb-", 4) != 0 &&
+ memcmp(mdinfo.bus_info, "PCI:", 4) != 0 &&
+ memcmp(mdinfo.bus_info, "PCIe:", 5) != 0 &&
+ memcmp(mdinfo.bus_info, "ISA:", 4) != 0 &&
+ memcmp(mdinfo.bus_info, "I2C:", 4) != 0 &&
+ memcmp(mdinfo.bus_info, "parport", 7) != 0 &&
+ memcmp(mdinfo.bus_info, "platform:", 9) != 0 &&
+ memcmp(mdinfo.bus_info, "rmi4:", 5) != 0)
return fail("missing bus_info prefix ('%s')\n", mdinfo.bus_info);
}
fail_on_test(mdinfo.media_version == 0);
diff --git a/utils/v4l2-compliance/v4l2-test-subdevs.cpp b/utils/v4l2-compliance/v4l2-test-subdevs.cpp
index 489639fb..998f63be 100644
--- a/utils/v4l2-compliance/v4l2-test-subdevs.cpp
+++ b/utils/v4l2-compliance/v4l2-test-subdevs.cpp
@@ -433,7 +433,7 @@ int testSubDevSelection(struct node *node, unsigned which, unsigned pad)
fail_on_test(check_0(crop.reserved, sizeof(crop.reserved)));
fail_on_test(crop.which != which);
fail_on_test(crop.pad != pad);
- fail_on_test(memcmp(&crop.rect, &sel.r, sizeof(sel.r)));
+ fail_on_test(memcmp(&crop.rect, &sel.r, sizeof(sel.r)) != 0);
for (unsigned tgt = 0; targets[tgt].target != ~0U; tgt++) {
targets[tgt].found = false;
@@ -476,7 +476,7 @@ int testSubDevSelection(struct node *node, unsigned which, unsigned pad)
fail_on_test(check_0(crop.reserved, sizeof(crop.reserved)));
fail_on_test(crop.which != which);
fail_on_test(crop.pad != pad);
- fail_on_test(memcmp(&crop.rect, &sel.r, sizeof(sel.r)));
+ fail_on_test(memcmp(&crop.rect, &sel.r, sizeof(sel.r)) != 0);
}
}
fail_on_test(!ret && targets[tgt].readonly);
diff --git a/utils/v4l2-ctl/v4l2-ctl-common.cpp b/utils/v4l2-ctl/v4l2-ctl-common.cpp
index f2997951..5dde39b9 100644
--- a/utils/v4l2-ctl/v4l2-ctl-common.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-common.cpp
@@ -190,7 +190,7 @@ static void list_media_devices(const std::string &media_bus_info)
std::string s("/dev/");
s += ep->d_name;
- if (memcmp(ep->d_name, "media", 5)) {
+ if (memcmp(ep->d_name, "media", 5) != 0) {
if (!is_v4l_dev(ep->d_name))
continue;
struct stat st;
--
2.25.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 4/7] treewide: apply performance fixes
2020-04-20 18:46 [PATCH 1/7] treewide: fix mismatching declarations Rosen Penev
2020-04-20 18:46 ` [PATCH 2/7] treewide: replace C casts with C++ Rosen Penev
2020-04-20 18:46 ` [PATCH 3/7] treewide: fix wrong *cmp function usage Rosen Penev
@ 2020-04-20 18:46 ` Rosen Penev
2020-04-20 18:46 ` [PATCH 5/7] media-info: fix NULL check Rosen Penev
` (3 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: Rosen Penev @ 2020-04-20 18:46 UTC (permalink / raw)
To: linux-media
Found with performance*
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
utils/v4l2-compliance/v4l2-compliance.cpp | 2 +-
utils/v4l2-compliance/v4l2-compliance.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/utils/v4l2-compliance/v4l2-compliance.cpp b/utils/v4l2-compliance/v4l2-compliance.cpp
index 0c3af294..bb32bae6 100644
--- a/utils/v4l2-compliance/v4l2-compliance.cpp
+++ b/utils/v4l2-compliance/v4l2-compliance.cpp
@@ -301,7 +301,7 @@ int check_0(const void *p, int len)
static std::map<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())
diff --git a/utils/v4l2-compliance/v4l2-compliance.h b/utils/v4l2-compliance/v4l2-compliance.h
index 43754519..921e15be 100644
--- a/utils/v4l2-compliance/v4l2-compliance.h
+++ b/utils/v4l2-compliance/v4l2-compliance.h
@@ -263,7 +263,7 @@ int check_0(const void *p, int len);
int restoreFormat(struct node *node);
void testNode(struct node &node, struct node &node_m2m_cap, struct node &expbuf_node, media_type type,
unsigned frame_count, unsigned all_fmt_frame_count);
-std::string stream_from(std::string pixelformat, bool &use_hdr);
+std::string stream_from(const std::string& pixelformat, bool &use_hdr);
// Media Controller ioctl tests
int testMediaDeviceInfo(struct node *node);
--
2.25.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 5/7] media-info: fix NULL check
2020-04-20 18:46 [PATCH 1/7] treewide: fix mismatching declarations Rosen Penev
` (2 preceding siblings ...)
2020-04-20 18:46 ` [PATCH 4/7] treewide: apply performance fixes Rosen Penev
@ 2020-04-20 18:46 ` Rosen Penev
2020-04-21 8:41 ` Hans Verkuil
2020-04-20 18:46 ` [PATCH 6/7] utils: use bool literals Rosen Penev
` (2 subsequent siblings)
6 siblings, 1 reply; 12+ messages in thread
From: Rosen Penev @ 2020-04-20 18:46 UTC (permalink / raw)
To: linux-media
Found with clang-tidy's bugprone-bool-pointer-implicit-conversion
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
utils/common/media-info.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/utils/common/media-info.cpp b/utils/common/media-info.cpp
index b0f0bc41..cb48d0df 100644
--- a/utils/common/media-info.cpp
+++ b/utils/common/media-info.cpp
@@ -357,7 +357,7 @@ std::string mi_entfunction2s(__u32 function, bool *is_invalid)
return fail ? entity_functions_def[i].str + 6 : entity_functions_def[i].str;
}
}
- if (is_invalid)
+ if (is_invalid != NULL)
return "WARNING: Unknown Function (" + num2s(function) + "), is v4l2-compliance out-of-date?";
return "Unknown Function (" + num2s(function) + ")";
}
--
2.25.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 6/7] utils: use bool literals
2020-04-20 18:46 [PATCH 1/7] treewide: fix mismatching declarations Rosen Penev
` (3 preceding siblings ...)
2020-04-20 18:46 ` [PATCH 5/7] media-info: fix NULL check Rosen Penev
@ 2020-04-20 18:46 ` Rosen Penev
2020-04-21 8:44 ` Hans Verkuil
2020-04-20 18:46 ` [PATCH 7/7] utils: do not use empty void with C++ Rosen Penev
2020-04-21 7:23 ` [PATCH 1/7] treewide: fix mismatching declarations Hans Verkuil
6 siblings, 1 reply; 12+ messages in thread
From: Rosen Penev @ 2020-04-20 18:46 UTC (permalink / raw)
To: linux-media
Found with clang-tidy's modernize-use-bool-literals
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
utils/cec-compliance/cec-compliance.cpp | 2 +-
utils/cec-compliance/cec-test.cpp | 2 +-
utils/cec-ctl/cec-ctl.cpp | 2 +-
utils/cec-follower/cec-follower.cpp | 2 +-
utils/cec-follower/cec-processing.cpp | 2 +-
utils/rds-ctl/rds-ctl.cpp | 2 +-
utils/v4l2-compliance/v4l2-compliance.cpp | 4 ++--
utils/v4l2-ctl/v4l2-ctl-streaming.cpp | 2 +-
utils/v4l2-ctl/v4l2-ctl.cpp | 6 +++---
utils/v4l2-dbg/v4l2-dbg.cpp | 2 +-
10 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/utils/cec-compliance/cec-compliance.cpp b/utils/cec-compliance/cec-compliance.cpp
index b665303e..6d07bfc9 100644
--- a/utils/cec-compliance/cec-compliance.cpp
+++ b/utils/cec-compliance/cec-compliance.cpp
@@ -1166,7 +1166,7 @@ int main(int argc, char **argv)
short_options[idx++] = ':';
}
}
- while (1) {
+ while (true) {
int option_index = 0;
short_options[idx] = 0;
diff --git a/utils/cec-compliance/cec-test.cpp b/utils/cec-compliance/cec-test.cpp
index 4aa54afc..a82069ad 100644
--- a/utils/cec-compliance/cec-test.cpp
+++ b/utils/cec-compliance/cec-test.cpp
@@ -889,7 +889,7 @@ static int tuner_ctl_test(struct node *node, unsigned me, unsigned la, bool inte
if (ret)
return ret;
- while (1) {
+ while (true) {
cec_msg_init(&msg, me, la);
cec_msg_tuner_step_increment(&msg);
fail_on_test(!transmit(node, &msg));
diff --git a/utils/cec-ctl/cec-ctl.cpp b/utils/cec-ctl/cec-ctl.cpp
index be37ae3c..46cfcd80 100644
--- a/utils/cec-ctl/cec-ctl.cpp
+++ b/utils/cec-ctl/cec-ctl.cpp
@@ -1863,7 +1863,7 @@ int main(int argc, char **argv)
if (long_options[i].has_arg == required_argument)
short_options[idx++] = ':';
}
- while (1) {
+ while (true) {
int option_index = 0;
struct cec_msg msg;
diff --git a/utils/cec-follower/cec-follower.cpp b/utils/cec-follower/cec-follower.cpp
index 12bb5f15..ab3113b6 100644
--- a/utils/cec-follower/cec-follower.cpp
+++ b/utils/cec-follower/cec-follower.cpp
@@ -331,7 +331,7 @@ int main(int argc, char **argv)
short_options[idx++] = ':';
}
}
- while (1) {
+ while (true) {
int option_index = 0;
short_options[idx] = 0;
diff --git a/utils/cec-follower/cec-processing.cpp b/utils/cec-follower/cec-processing.cpp
index 34b54fa3..8e3a33a2 100644
--- a/utils/cec-follower/cec-processing.cpp
+++ b/utils/cec-follower/cec-processing.cpp
@@ -885,7 +885,7 @@ void testProcessing(struct node *node, bool wallclock)
poll_remote_devs(node, me);
- while (1) {
+ while (true) {
int res;
struct timeval timeval = {};
diff --git a/utils/rds-ctl/rds-ctl.cpp b/utils/rds-ctl/rds-ctl.cpp
index 2d561481..fef2a3f1 100644
--- a/utils/rds-ctl/rds-ctl.cpp
+++ b/utils/rds-ctl/rds-ctl.cpp
@@ -757,7 +757,7 @@ static int parse_cl(int argc, char **argv)
if (long_options[i].has_arg == required_argument)
short_options[idx++] = ':';
}
- while (1) {
+ while (true) {
int option_index = 0;
short_options[idx] = 0;
diff --git a/utils/v4l2-compliance/v4l2-compliance.cpp b/utils/v4l2-compliance/v4l2-compliance.cpp
index bb32bae6..39dd1aec 100644
--- a/utils/v4l2-compliance/v4l2-compliance.cpp
+++ b/utils/v4l2-compliance/v4l2-compliance.cpp
@@ -834,7 +834,7 @@ static int open_media_bus_info(const std::string &bus_info, std::string &media_d
while ((ep = readdir(dp))) {
const char *name = ep->d_name;
- if ((!memcmp(name, "media", 5) != 0) && isdigit(name[5])) {
+ if ((!(memcmp(name, "media", 5) != 0)) && isdigit(name[5])) {
struct media_device_info mdi;
media_devname = std::string("/dev/") + name;
@@ -1519,7 +1519,7 @@ int main(int argc, char **argv)
short_options[idx++] = ':';
}
}
- while (1) {
+ while (true) {
int option_index = 0;
short_options[idx] = 0;
diff --git a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
index de40c5ad..833263b6 100644
--- a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
@@ -2742,7 +2742,7 @@ static void streaming_set_cap2out(cv4l_fd &fd, cv4l_fd &out_fd)
if (use_poll)
fcntl(fd.g_fd(), F_SETFL, fd_flags | O_NONBLOCK);
- while (1) {
+ while (true) {
struct timeval tv = { use_poll ? 2 : 0, 0 };
int r = 0;
diff --git a/utils/v4l2-ctl/v4l2-ctl.cpp b/utils/v4l2-ctl/v4l2-ctl.cpp
index 42889ef8..c0097203 100644
--- a/utils/v4l2-ctl/v4l2-ctl.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl.cpp
@@ -1145,7 +1145,7 @@ int main(int argc, char **argv)
short_options[idx++] = ':';
}
}
- while (1) {
+ while (true) {
int option_index = 0;
short_options[idx] = 0;
@@ -1531,7 +1531,7 @@ int main(int argc, char **argv)
__u32 seq = 0;
fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_NONBLOCK);
- while (1) {
+ while (true) {
int res;
FD_ZERO(&fds);
@@ -1572,7 +1572,7 @@ int main(int argc, char **argv)
fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_NONBLOCK);
epoll_ctl(epollfd, EPOLL_CTL_ADD, fd, &epoll_ev);
- while (1) {
+ while (true) {
int res;
res = epoll_wait(epollfd, &epoll_ev, 1, -1);
diff --git a/utils/v4l2-dbg/v4l2-dbg.cpp b/utils/v4l2-dbg/v4l2-dbg.cpp
index 17ab0210..dcf8200a 100644
--- a/utils/v4l2-dbg/v4l2-dbg.cpp
+++ b/utils/v4l2-dbg/v4l2-dbg.cpp
@@ -442,7 +442,7 @@ int main(int argc, char **argv)
short_options[idx++] = ':';
}
}
- while (1) {
+ while (true) {
int option_index = 0;
short_options[idx] = 0;
--
2.25.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 7/7] utils: do not use empty void with C++
2020-04-20 18:46 [PATCH 1/7] treewide: fix mismatching declarations Rosen Penev
` (4 preceding siblings ...)
2020-04-20 18:46 ` [PATCH 6/7] utils: use bool literals Rosen Penev
@ 2020-04-20 18:46 ` Rosen Penev
2020-04-21 7:23 ` [PATCH 1/7] treewide: fix mismatching declarations Hans Verkuil
6 siblings, 0 replies; 12+ messages in thread
From: Rosen Penev @ 2020-04-20 18:46 UTC (permalink / raw)
To: linux-media
Found with clang-tidy's modernize-redundant-void-arg
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
utils/cec-compliance/cec-compliance.cpp | 2 +-
utils/cec-compliance/cec-test.cpp | 4 ++--
utils/cec-ctl/cec-ctl.cpp | 2 +-
utils/cec-follower/cec-follower.cpp | 2 +-
utils/rds-ctl/rds-ctl.cpp | 12 ++++++------
utils/v4l2-compliance/v4l2-compliance.cpp | 2 +-
utils/v4l2-ctl/v4l2-ctl-common.cpp | 2 +-
utils/v4l2-ctl/v4l2-ctl-edid.cpp | 2 +-
utils/v4l2-ctl/v4l2-ctl-io.cpp | 2 +-
utils/v4l2-ctl/v4l2-ctl-meta.cpp | 2 +-
utils/v4l2-ctl/v4l2-ctl-misc.cpp | 2 +-
utils/v4l2-ctl/v4l2-ctl-overlay.cpp | 2 +-
utils/v4l2-ctl/v4l2-ctl-sdr.cpp | 2 +-
utils/v4l2-ctl/v4l2-ctl-selection.cpp | 2 +-
utils/v4l2-ctl/v4l2-ctl-stds.cpp | 2 +-
utils/v4l2-ctl/v4l2-ctl-streaming.cpp | 2 +-
utils/v4l2-ctl/v4l2-ctl-subdev.cpp | 2 +-
utils/v4l2-ctl/v4l2-ctl-tuner.cpp | 2 +-
utils/v4l2-ctl/v4l2-ctl-vbi.cpp | 2 +-
utils/v4l2-ctl/v4l2-ctl-vidcap.cpp | 2 +-
utils/v4l2-ctl/v4l2-ctl-vidout.cpp | 2 +-
utils/v4l2-ctl/v4l2-ctl.cpp | 2 +-
utils/v4l2-dbg/v4l2-dbg.cpp | 2 +-
23 files changed, 29 insertions(+), 29 deletions(-)
diff --git a/utils/cec-compliance/cec-compliance.cpp b/utils/cec-compliance/cec-compliance.cpp
index 6d07bfc9..713e2a58 100644
--- a/utils/cec-compliance/cec-compliance.cpp
+++ b/utils/cec-compliance/cec-compliance.cpp
@@ -178,7 +178,7 @@ static struct option long_options[] = {
{0, 0, 0, 0}
};
-static void usage(void)
+static void usage()
{
printf("Usage:\n"
" -d, --device <dev> Use device <dev> instead of /dev/cec0\n"
diff --git a/utils/cec-compliance/cec-test.cpp b/utils/cec-compliance/cec-test.cpp
index a82069ad..af9f3d38 100644
--- a/utils/cec-compliance/cec-test.cpp
+++ b/utils/cec-compliance/cec-test.cpp
@@ -1494,7 +1494,7 @@ static const unsigned num_tests = sizeof(tests) / sizeof(struct remote_test);
static std::map<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);
diff --git a/utils/cec-ctl/cec-ctl.cpp b/utils/cec-ctl/cec-ctl.cpp
index 46cfcd80..929928e2 100644
--- a/utils/cec-ctl/cec-ctl.cpp
+++ b/utils/cec-ctl/cec-ctl.cpp
@@ -229,7 +229,7 @@ static struct option long_options[] = {
{ 0, 0, 0, 0 }
};
-static void usage(void)
+static void usage()
{
printf("Usage:\n"
" -d, --device <dev> Use device <dev> instead of /dev/cec0\n"
diff --git a/utils/cec-follower/cec-follower.cpp b/utils/cec-follower/cec-follower.cpp
index ab3113b6..36bd2fbb 100644
--- a/utils/cec-follower/cec-follower.cpp
+++ b/utils/cec-follower/cec-follower.cpp
@@ -71,7 +71,7 @@ static struct option long_options[] = {
{ 0, 0, 0, 0 }
};
-static void usage(void)
+static void usage()
{
printf("Usage:\n"
" -d, --device <dev> Use device <dev> instead of /dev/cec0\n"
diff --git a/utils/rds-ctl/rds-ctl.cpp b/utils/rds-ctl/rds-ctl.cpp
index fef2a3f1..0511fe5d 100644
--- a/utils/rds-ctl/rds-ctl.cpp
+++ b/utils/rds-ctl/rds-ctl.cpp
@@ -108,12 +108,12 @@ static struct option long_options[] = {
{0, 0, 0, 0}
};
-static void usage_hint(void)
+static void usage_hint()
{
fprintf(stderr, "Try 'rds-ctl --help' for more information.\n");
}
-static void usage_common(void)
+static void usage_common()
{
printf("\nGeneral/Common options:\n"
" --all display all device information available\n"
@@ -127,7 +127,7 @@ static void usage_common(void)
);
}
-static void usage_tuner(void)
+static void usage_tuner()
{
printf("\nTuner/Modulator options:\n"
" -F, --get-freq query the frequency [VIDIOC_G_FREQUENCY]\n"
@@ -145,7 +145,7 @@ static void usage_tuner(void)
);
}
-static void usage_rds(void)
+static void usage_rds()
{
printf("\nRDS options: \n"
" -b, --rbds parse the RDS data according to the RBDS standard\n"
@@ -164,7 +164,7 @@ static void usage_rds(void)
);
}
-static void usage(void)
+static void usage()
{
printf("Usage:\n");
usage_common();
@@ -326,7 +326,7 @@ static void print_devices(dev_vec files)
printf("%s\n", iter->second.c_str());
}
}
-static dev_vec list_devices(void)
+static dev_vec list_devices()
{
DIR *dp;
struct dirent *ep;
diff --git a/utils/v4l2-compliance/v4l2-compliance.cpp b/utils/v4l2-compliance/v4l2-compliance.cpp
index 39dd1aec..3211b492 100644
--- a/utils/v4l2-compliance/v4l2-compliance.cpp
+++ b/utils/v4l2-compliance/v4l2-compliance.cpp
@@ -155,7 +155,7 @@ static struct option long_options[] = {
{0, 0, 0, 0}
};
-static void usage(void)
+static void usage()
{
printf("Usage:\n");
printf("Common options:\n");
diff --git a/utils/v4l2-ctl/v4l2-ctl-common.cpp b/utils/v4l2-ctl/v4l2-ctl-common.cpp
index 5dde39b9..3ca02087 100644
--- a/utils/v4l2-ctl/v4l2-ctl-common.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-common.cpp
@@ -55,7 +55,7 @@ static enum v4l2_priority prio = V4L2_PRIORITY_UNSET;
static bool have_query_ext_ctrl;
-void common_usage(void)
+void common_usage()
{
printf("\nGeneral/Common options:\n"
" --all display all information available\n"
diff --git a/utils/v4l2-ctl/v4l2-ctl-edid.cpp b/utils/v4l2-ctl/v4l2-ctl-edid.cpp
index 366e6522..9c7c6bc4 100644
--- a/utils/v4l2-ctl/v4l2-ctl-edid.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-edid.cpp
@@ -122,7 +122,7 @@ static __u8 toggle_hdr_md_flags;
#define HDR_MD_SMPTE_2084 (1 << 2)
#define HDR_MD_HLG (1 << 3)
-void edid_usage(void)
+void edid_usage()
{
printf("\nEDID options:\n"
" --set-edid pad=<pad>[,type=<type>|file=<file>][,format=<fmt>][modifiers]\n"
diff --git a/utils/v4l2-ctl/v4l2-ctl-io.cpp b/utils/v4l2-ctl/v4l2-ctl-io.cpp
index 1130fdc0..9e83c03a 100644
--- a/utils/v4l2-ctl/v4l2-ctl-io.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-io.cpp
@@ -21,7 +21,7 @@ static struct v4l2_audioout vaudout; /* audio outputs */
static int input; /* set_input/get_input */
static int output; /* set_output/get_output */
-void io_usage(void)
+void io_usage()
{
printf("\nInput/Output options:\n"
" -I, --get-input query the video input [VIDIOC_G_INPUT]\n"
diff --git a/utils/v4l2-ctl/v4l2-ctl-meta.cpp b/utils/v4l2-ctl/v4l2-ctl-meta.cpp
index 0e1071b0..76d4b1dd 100644
--- a/utils/v4l2-ctl/v4l2-ctl-meta.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-meta.cpp
@@ -18,7 +18,7 @@
static struct v4l2_format vfmt; /* set_format/get_format */
-void meta_usage(void)
+void meta_usage()
{
printf("\nMetadata Formats options:\n"
" --list-formats-meta display supported metadata capture formats [VIDIOC_ENUM_FMT]\n"
diff --git a/utils/v4l2-ctl/v4l2-ctl-misc.cpp b/utils/v4l2-ctl/v4l2-ctl-misc.cpp
index 23a0fd38..cb933217 100644
--- a/utils/v4l2-ctl/v4l2-ctl-misc.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-misc.cpp
@@ -23,7 +23,7 @@ static struct v4l2_streamparm parm; /* get/set parm */
static double fps = 0; /* set framerate speed, in fps */
static double output_fps = 0; /* set framerate speed, in fps */
-void misc_usage(void)
+void misc_usage()
{
printf("\nMiscellaneous options:\n"
" --wait-for-event <event>\n"
diff --git a/utils/v4l2-ctl/v4l2-ctl-overlay.cpp b/utils/v4l2-ctl/v4l2-ctl-overlay.cpp
index 4c9609d6..16344a15 100644
--- a/utils/v4l2-ctl/v4l2-ctl-overlay.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-overlay.cpp
@@ -28,7 +28,7 @@ static const char *fb_device;
static std::vector<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"
diff --git a/utils/v4l2-ctl/v4l2-ctl-sdr.cpp b/utils/v4l2-ctl/v4l2-ctl-sdr.cpp
index d13f5c76..0b7c4cdc 100644
--- a/utils/v4l2-ctl/v4l2-ctl-sdr.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-sdr.cpp
@@ -18,7 +18,7 @@
static struct v4l2_format vfmt; /* set_format/get_format */
-void sdr_usage(void)
+void sdr_usage()
{
printf("\nSDR Formats options:\n"
" --list-formats-sdr display supported SDR capture formats [VIDIOC_ENUM_FMT]\n"
diff --git a/utils/v4l2-ctl/v4l2-ctl-selection.cpp b/utils/v4l2-ctl/v4l2-ctl-selection.cpp
index c35d0536..ac5a1d7b 100644
--- a/utils/v4l2-ctl/v4l2-ctl-selection.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-selection.cpp
@@ -44,7 +44,7 @@ static struct v4l2_rect vcrop_out_overlay; /* crop rect */
static struct v4l2_selection vselection; /* capture selection */
static struct v4l2_selection vselection_out; /* output selection */
-void selection_usage(void)
+void selection_usage()
{
printf("\nSelection/Cropping options:\n"
" --get-cropcap query the crop capabilities [VIDIOC_CROPCAP]\n"
diff --git a/utils/v4l2-ctl/v4l2-ctl-stds.cpp b/utils/v4l2-ctl/v4l2-ctl-stds.cpp
index 7ba44ae3..62f57a44 100644
--- a/utils/v4l2-ctl/v4l2-ctl-stds.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-stds.cpp
@@ -25,7 +25,7 @@ static unsigned set_dv_timing_opts;
static __u32 list_dv_timings_pad;
static __u32 dv_timings_cap_pad;
-void stds_usage(void)
+void stds_usage()
{
printf("\nStandards/Timings options:\n"
" --list-standards display supported video standards [VIDIOC_ENUMSTD]\n"
diff --git a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
index 833263b6..663d0254 100644
--- a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
@@ -257,7 +257,7 @@ double fps_timestamps::fps()
return fps;
};
-void streaming_usage(void)
+void streaming_usage()
{
printf("\nVideo Streaming options:\n"
" --stream-count <count>\n"
diff --git a/utils/v4l2-ctl/v4l2-ctl-subdev.cpp b/utils/v4l2-ctl/v4l2-ctl-subdev.cpp
index 17532d5e..747f1699 100644
--- a/utils/v4l2-ctl/v4l2-ctl-subdev.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-subdev.cpp
@@ -49,7 +49,7 @@ static struct v4l2_subdev_frame_interval_enum frmival;
static __u32 set_fps_pad;
static double set_fps;
-void subdev_usage(void)
+void subdev_usage()
{
printf("\nSub-Device options:\n"
" --list-subdev-mbus-codes <pad>\n"
diff --git a/utils/v4l2-ctl/v4l2-ctl-tuner.cpp b/utils/v4l2-ctl/v4l2-ctl-tuner.cpp
index 4c291eb3..bc397ec2 100644
--- a/utils/v4l2-ctl/v4l2-ctl-tuner.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-tuner.cpp
@@ -26,7 +26,7 @@ static struct v4l2_hw_freq_seek freq_seek; /* freq-seek */
static double low, high; /* freq-seek frequency range */
static int mode = V4L2_TUNER_MODE_STEREO; /* set audio mode */
-void tuner_usage(void)
+void tuner_usage()
{
printf("\nTuner/Modulator options:\n"
" -F, --get-freq query the frequency [VIDIOC_G_FREQUENCY]\n"
diff --git a/utils/v4l2-ctl/v4l2-ctl-vbi.cpp b/utils/v4l2-ctl/v4l2-ctl-vbi.cpp
index 148c9e65..c5960f78 100644
--- a/utils/v4l2-ctl/v4l2-ctl-vbi.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-vbi.cpp
@@ -21,7 +21,7 @@ static struct v4l2_format sliced_fmt_out; /* set_format/get_format for sliced VB
static struct v4l2_format raw_fmt; /* set_format/get_format for VBI */
static struct v4l2_format raw_fmt_out; /* set_format/get_format for VBI output */
-void vbi_usage(void)
+void vbi_usage()
{
printf("\nVBI Formats options:\n"
" --get-sliced-vbi-cap\n"
diff --git a/utils/v4l2-ctl/v4l2-ctl-vidcap.cpp b/utils/v4l2-ctl/v4l2-ctl-vidcap.cpp
index a9ef8eed..49c20200 100644
--- a/utils/v4l2-ctl/v4l2-ctl-vidcap.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-vidcap.cpp
@@ -23,7 +23,7 @@ static __u32 width, height, pixfmt, field, flags;
static __u32 bytesperline[VIDEO_MAX_PLANES];
static __u32 sizeimage[VIDEO_MAX_PLANES];
-void vidcap_usage(void)
+void vidcap_usage()
{
printf("\nVideo Capture Formats options:\n"
" --list-formats display supported video formats [VIDIOC_ENUM_FMT]\n"
diff --git a/utils/v4l2-ctl/v4l2-ctl-vidout.cpp b/utils/v4l2-ctl/v4l2-ctl-vidout.cpp
index 227d624f..955b2c50 100644
--- a/utils/v4l2-ctl/v4l2-ctl-vidout.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-vidout.cpp
@@ -21,7 +21,7 @@ static __u32 width, height, pixfmt, field, colorspace, xfer_func, ycbcr, quantiz
static __u32 bytesperline[VIDEO_MAX_PLANES];
static __u32 sizeimage[VIDEO_MAX_PLANES];
-void vidout_usage(void)
+void vidout_usage()
{
printf("\nVideo Output Formats options:\n"
" --list-formats-out display supported video output formats [VIDIOC_ENUM_FMT]\n"
diff --git a/utils/v4l2-ctl/v4l2-ctl.cpp b/utils/v4l2-ctl/v4l2-ctl.cpp
index c0097203..f6e90f51 100644
--- a/utils/v4l2-ctl/v4l2-ctl.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl.cpp
@@ -287,7 +287,7 @@ static struct option long_options[] = {
{0, 0, 0, 0}
};
-static void usage_all(void)
+static void usage_all()
{
common_usage();
tuner_usage();
diff --git a/utils/v4l2-dbg/v4l2-dbg.cpp b/utils/v4l2-dbg/v4l2-dbg.cpp
index dcf8200a..cd387d1d 100644
--- a/utils/v4l2-dbg/v4l2-dbg.cpp
+++ b/utils/v4l2-dbg/v4l2-dbg.cpp
@@ -162,7 +162,7 @@ static struct option long_options[] = {
{0, 0, 0, 0}
};
-static void usage(void)
+static void usage()
{
printf("Usage: v4l2-dbg [options] [values]\n"
" -D, --info Show driver info [VIDIOC_QUERYCAP]\n"
--
2.25.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 1/7] treewide: fix mismatching declarations
2020-04-20 18:46 [PATCH 1/7] treewide: fix mismatching declarations Rosen Penev
` (5 preceding siblings ...)
2020-04-20 18:46 ` [PATCH 7/7] utils: do not use empty void with C++ Rosen Penev
@ 2020-04-21 7:23 ` Hans Verkuil
2020-04-21 7:26 ` Hans Verkuil
6 siblings, 1 reply; 12+ messages in thread
From: Hans Verkuil @ 2020-04-21 7:23 UTC (permalink / raw)
To: Rosen Penev, linux-media
On 20/04/2020 20:46, Rosen Penev wrote:
> Found with clang-tidy's
> readability-inconsistent-declaration-parameter-name
>
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> ---
> lib/include/libdvbv5/atsc_eit.h | 4 +-
> lib/include/libdvbv5/cat.h | 4 +-
> lib/include/libdvbv5/descriptors.h | 2 +-
> lib/include/libdvbv5/dvb-demux.h | 2 +-
> lib/include/libdvbv5/dvb-dev.h | 2 +-
> lib/include/libdvbv5/dvb-fe.h | 2 +-
> lib/include/libdvbv5/dvb-file.h | 4 +-
> lib/include/libdvbv5/dvb-scan.h | 16 +++----
> lib/include/libdvbv5/eit.h | 4 +-
> lib/include/libdvbv5/header.h | 4 +-
> lib/include/libdvbv5/mgt.h | 4 +-
> lib/include/libdvbv5/mpeg_pes.h | 2 +-
> lib/include/libdvbv5/nit.h | 6 +--
> lib/include/libdvbv5/pat.h | 4 +-
> lib/include/libdvbv5/pmt.h | 4 +-
> lib/include/libdvbv5/sdt.h | 4 +-
> lib/include/libdvbv5/vct.h | 4 +-
> lib/include/libv4l2.h | 2 +-
> lib/libdvbv5/parse_string.h | 2 +-
> lib/libv4lconvert/libv4lconvert-priv.h | 48 +++++++++----------
> .../processing/libv4lprocessing.h | 2 +-
> lib/libv4lconvert/tinyjpeg.h | 2 +-
> utils/cec-compliance/cec-compliance.h | 3 +-
> utils/common/v4l-stream.h | 4 +-
> utils/keytable/bpf.h | 6 +--
> utils/libcecutil/cec-log.cpp | 12 ++---
> 26 files changed, 76 insertions(+), 77 deletions(-)
>
> diff --git a/lib/include/libdvbv5/atsc_eit.h b/lib/include/libdvbv5/atsc_eit.h
> index 5e52087c..18ae599d 100644
> --- a/lib/include/libdvbv5/atsc_eit.h
> +++ b/lib/include/libdvbv5/atsc_eit.h
> @@ -192,7 +192,7 @@ ssize_t atsc_table_eit_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf,
> *
> * @param table pointer to struct atsc_table_eit to be freed
> */
> -void atsc_table_eit_free(struct atsc_table_eit *table);
> +void atsc_table_eit_free(struct atsc_table_eit *eit);
You need to update the docbook comment as well: @param table should become @param eit.
Same elsewhere.
Regards,
Hans
>
> /**
> * @brief Prints the content of the ATSC EIT table
> @@ -202,7 +202,7 @@ void atsc_table_eit_free(struct atsc_table_eit *table);
> * @param table pointer to struct atsc_table_eit
> */
> void atsc_table_eit_print(struct dvb_v5_fe_parms *parms,
> - struct atsc_table_eit *table);
> + struct atsc_table_eit *eit);
>
> /**
> * @brief Converts an ATSC EIT formatted timestamp into struct tm
> diff --git a/lib/include/libdvbv5/cat.h b/lib/include/libdvbv5/cat.h
> index 612c2c35..2e767ddc 100644
> --- a/lib/include/libdvbv5/cat.h
> +++ b/lib/include/libdvbv5/cat.h
> @@ -88,7 +88,7 @@ ssize_t dvb_table_cat_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf,
> *
> * @param table pointer to struct dvb_table_cat to be freed
> */
> -void dvb_table_cat_free(struct dvb_table_cat *table);
> +void dvb_table_cat_free(struct dvb_table_cat *cat);
>
> /**
> * @brief Prints the content of the CAT table
> @@ -97,7 +97,7 @@ void dvb_table_cat_free(struct dvb_table_cat *table);
> * @param table pointer to struct dvb_table_cat
> */
> void dvb_table_cat_print(struct dvb_v5_fe_parms *parms,
> - struct dvb_table_cat *table);
> + struct dvb_table_cat *cat);
>
> #ifdef __cplusplus
> }
> diff --git a/lib/include/libdvbv5/descriptors.h b/lib/include/libdvbv5/descriptors.h
> index cb21470c..8f3900f2 100644
> --- a/lib/include/libdvbv5/descriptors.h
> +++ b/lib/include/libdvbv5/descriptors.h
> @@ -157,7 +157,7 @@ uint32_t dvb_bcd(uint32_t bcd);
> * @param len Number of bytes to show
> */
> void dvb_hexdump(struct dvb_v5_fe_parms *parms, const char *prefix,
> - const unsigned char *buf, int len);
> + const unsigned char *data, int len);
>
> /**
> * @brief parse MPEG-TS descriptors
> diff --git a/lib/include/libdvbv5/dvb-demux.h b/lib/include/libdvbv5/dvb-demux.h
> index 971c27f6..d3bc02a9 100644
> --- a/lib/include/libdvbv5/dvb-demux.h
> +++ b/lib/include/libdvbv5/dvb-demux.h
> @@ -148,7 +148,7 @@ int dvb_set_section_filter(int dmxfd, int pid, unsigned filtsize,
> *
> * @warning This function currently assumes that the PAT fits into one session.
> */
> -int dvb_get_pmt_pid(int dmxfd, int sid);
> +int dvb_get_pmt_pid(int patfd, int sid);
>
> #ifdef __cplusplus
> }
> diff --git a/lib/include/libdvbv5/dvb-dev.h b/lib/include/libdvbv5/dvb-dev.h
> index 2eeae516..5a9cc1a2 100644
> --- a/lib/include/libdvbv5/dvb-dev.h
> +++ b/lib/include/libdvbv5/dvb-dev.h
> @@ -398,7 +398,7 @@ int dvb_dev_set_bufsize(struct dvb_open_descriptor *open_dev,
> */
> int dvb_dev_dmx_set_pesfilter(struct dvb_open_descriptor *open_dev,
> int pid, dmx_pes_type_t type,
> - dmx_output_t output, int buffersize);
> + dmx_output_t output, int bufsize);
>
> /**
> * @brief Sets a MPEG-TS section filter
> diff --git a/lib/include/libdvbv5/dvb-fe.h b/lib/include/libdvbv5/dvb-fe.h
> index 96657013..4bd94108 100644
> --- a/lib/include/libdvbv5/dvb-fe.h
> +++ b/lib/include/libdvbv5/dvb-fe.h
> @@ -732,7 +732,7 @@ int dvb_fe_is_satellite(uint32_t delivery_system);
> * "COUNTRY" property in dvb_fe_set_parm() overrides the setting.
> */
> int dvb_fe_set_default_country(struct dvb_v5_fe_parms *parms,
> - const char *country);
> + const char *cc);
>
> #ifdef __cplusplus
> }
> diff --git a/lib/include/libdvbv5/dvb-file.h b/lib/include/libdvbv5/dvb-file.h
> index 1f1a6386..9c8c54d9 100644
> --- a/lib/include/libdvbv5/dvb-file.h
> +++ b/lib/include/libdvbv5/dvb-file.h
> @@ -423,8 +423,8 @@ int dvb_retrieve_entry_prop(struct dvb_entry *entry,
> * @return Returns 0 if success, or, -1 if error.
> */
> int dvb_store_channel(struct dvb_file **dvb_file,
> - struct dvb_v5_fe_parms *parms,
> - struct dvb_v5_descriptors *dvb_desc,
> + struct dvb_v5_fe_parms *__p,
> + struct dvb_v5_descriptors *dvb_scan_handler,
> int get_detected, int get_nit);
>
> /**
> diff --git a/lib/include/libdvbv5/dvb-scan.h b/lib/include/libdvbv5/dvb-scan.h
> index 2666d906..50846b98 100644
> --- a/lib/include/libdvbv5/dvb-scan.h
> +++ b/lib/include/libdvbv5/dvb-scan.h
> @@ -222,7 +222,7 @@ int dvb_read_section(struct dvb_v5_fe_parms *parms, int dmx_fd,
> * This is a variant of dvb_read_section() that uses a struct dvb_table_filter
> * to specify the filter to use.
> */
> -int dvb_read_sections(struct dvb_v5_fe_parms *parms, int dmx_fd,
> +int dvb_read_sections(struct dvb_v5_fe_parms *__p, int dmx_fd,
> struct dvb_table_filter *sect,
> unsigned timeout);
>
> @@ -265,7 +265,7 @@ void dvb_scan_free_handler_table(struct dvb_v5_descriptors *dvb_scan_handler);
> * On sucess, it returns a pointer to a struct dvb_v5_descriptors, that can
> * either be used to tune into a service or to be stored inside a file.
> */
> -struct dvb_v5_descriptors *dvb_get_ts_tables(struct dvb_v5_fe_parms *parms, int dmx_fd,
> +struct dvb_v5_descriptors *dvb_get_ts_tables(struct dvb_v5_fe_parms *__p, int dmx_fd,
> uint32_t delivery_system,
> unsigned other_nit,
> unsigned timeout_multiply);
> @@ -337,7 +337,7 @@ typedef int (check_frontend_t)(void *args, struct dvb_v5_fe_parms *parms);
> * }
> * @endcode
> */
> -struct dvb_v5_descriptors *dvb_scan_transponder(struct dvb_v5_fe_parms *parms,
> +struct dvb_v5_descriptors *dvb_scan_transponder(struct dvb_v5_fe_parms *__p,
> struct dvb_entry *entry,
> int dmx_fd,
> check_frontend_t *check_frontend,
> @@ -388,7 +388,7 @@ struct dvb_v5_descriptors *dvb_scan_transponder(struct dvb_v5_fe_parms *parms,
> * }
> * @endcode
> */
> -void dvb_add_scaned_transponders(struct dvb_v5_fe_parms *parms,
> +void dvb_add_scaned_transponders(struct dvb_v5_fe_parms *__p,
> struct dvb_v5_descriptors *dvb_scan_handler,
> struct dvb_entry *first_entry,
> struct dvb_entry *entry);
> @@ -398,12 +398,12 @@ void dvb_add_scaned_transponders(struct dvb_v5_fe_parms *parms,
> * Some ancillary functions used internally inside the library, used to
> * identify duplicated transport streams and add new found transponder entries
> */
> -int dvb_estimate_freq_shift(struct dvb_v5_fe_parms *parms);
> +int dvb_estimate_freq_shift(struct dvb_v5_fe_parms *__p);
>
> int dvb_new_freq_is_needed(struct dvb_entry *entry, struct dvb_entry *last_entry,
> uint32_t freq, enum dvb_sat_polarization pol, int shift);
>
> -struct dvb_entry *dvb_scan_add_entry(struct dvb_v5_fe_parms *parms,
> +struct dvb_entry *dvb_scan_add_entry(struct dvb_v5_fe_parms *__p,
> struct dvb_entry *first_entry,
> struct dvb_entry *entry,
> uint32_t freq, uint32_t shift,
> @@ -414,14 +414,14 @@ int dvb_new_entry_is_needed(struct dvb_entry *entry,
> uint32_t freq, int shift,
> enum dvb_sat_polarization pol, uint32_t stream_id);
>
> -struct dvb_entry *dvb_scan_add_entry_ex(struct dvb_v5_fe_parms *parms,
> +struct dvb_entry *dvb_scan_add_entry_ex(struct dvb_v5_fe_parms *__p,
> struct dvb_entry *first_entry,
> struct dvb_entry *entry,
> uint32_t freq, uint32_t shift,
> enum dvb_sat_polarization pol,
> uint32_t stream_id);
>
> -void dvb_update_transponders(struct dvb_v5_fe_parms *parms,
> +void dvb_update_transponders(struct dvb_v5_fe_parms *__p,
> struct dvb_v5_descriptors *dvb_scan_handler,
> struct dvb_entry *first_entry,
> struct dvb_entry *entry);
> diff --git a/lib/include/libdvbv5/eit.h b/lib/include/libdvbv5/eit.h
> index 9129861e..5510707b 100644
> --- a/lib/include/libdvbv5/eit.h
> +++ b/lib/include/libdvbv5/eit.h
> @@ -197,7 +197,7 @@ ssize_t dvb_table_eit_init (struct dvb_v5_fe_parms *parms, const uint8_t *buf,
> *
> * @param table pointer to struct dvb_table_eit to be freed
> */
> -void dvb_table_eit_free(struct dvb_table_eit *table);
> +void dvb_table_eit_free(struct dvb_table_eit *eit);
>
> /**
> * @brief Prints the content of the DVB EIT table
> @@ -207,7 +207,7 @@ void dvb_table_eit_free(struct dvb_table_eit *table);
> * @param table pointer to struct dvb_table_eit
> */
> void dvb_table_eit_print(struct dvb_v5_fe_parms *parms,
> - struct dvb_table_eit *table);
> + struct dvb_table_eit *eit);
>
> /**
> * @brief Converts a DVB EIT formatted timestamp into struct tm
> diff --git a/lib/include/libdvbv5/header.h b/lib/include/libdvbv5/header.h
> index 2a459f9d..ccf67422 100644
> --- a/lib/include/libdvbv5/header.h
> +++ b/lib/include/libdvbv5/header.h
> @@ -132,7 +132,7 @@ extern "C" {
> *
> * @param header pointer to struct dvb_table_header to be parsed
> */
> -void dvb_table_header_init (struct dvb_table_header *header);
> +void dvb_table_header_init (struct dvb_table_header *t);
> /**
> * @brief Prints the content of the MPEG-TS table header
> * @ingroup dvb_table
> @@ -141,7 +141,7 @@ void dvb_table_header_init (struct dvb_table_header *header);
> * @param header pointer to struct dvb_table_header to be printed
> */
> void dvb_table_header_print(struct dvb_v5_fe_parms *parms,
> - const struct dvb_table_header *header);
> + const struct dvb_table_header *t);
>
> #ifdef __cplusplus
> }
> diff --git a/lib/include/libdvbv5/mgt.h b/lib/include/libdvbv5/mgt.h
> index 7aa92d6c..62b5a7ab 100644
> --- a/lib/include/libdvbv5/mgt.h
> +++ b/lib/include/libdvbv5/mgt.h
> @@ -168,7 +168,7 @@ ssize_t atsc_table_mgt_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf,
> *
> * @param table pointer to struct atsc_table_mgt to be freed
> */
> -void atsc_table_mgt_free(struct atsc_table_mgt *table);
> +void atsc_table_mgt_free(struct atsc_table_mgt *mgt);
>
> /**
> * @brief Prints the content of the MGT table
> @@ -178,7 +178,7 @@ void atsc_table_mgt_free(struct atsc_table_mgt *table);
> * @param table pointer to struct atsc_table_mgt
> */
> void atsc_table_mgt_print(struct dvb_v5_fe_parms *parms,
> - struct atsc_table_mgt *table);
> + struct atsc_table_mgt *mgt);
>
> #ifdef __cplusplus
> }
> diff --git a/lib/include/libdvbv5/mpeg_pes.h b/lib/include/libdvbv5/mpeg_pes.h
> index 9f214b26..b2b13584 100644
> --- a/lib/include/libdvbv5/mpeg_pes.h
> +++ b/lib/include/libdvbv5/mpeg_pes.h
> @@ -228,7 +228,7 @@ ssize_t dvb_mpeg_pes_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf, ssi
> * If the pointer pes was allocated dynamically, this function
> * can be used to free the memory.
> */
> -void dvb_mpeg_pes_free(struct dvb_mpeg_pes *pes);
> +void dvb_mpeg_pes_free(struct dvb_mpeg_pes *ts);
>
> /**
> * @brief Print details of struct dvb_mpeg_pes
> diff --git a/lib/include/libdvbv5/nit.h b/lib/include/libdvbv5/nit.h
> index f8e0e730..ef0f1bc1 100644
> --- a/lib/include/libdvbv5/nit.h
> +++ b/lib/include/libdvbv5/nit.h
> @@ -221,7 +221,7 @@ ssize_t dvb_table_nit_init (struct dvb_v5_fe_parms *parms, const uint8_t *buf,
> *
> * @param table pointer to struct dvb_table_nit to be freed
> */
> -void dvb_table_nit_free(struct dvb_table_nit *table);
> +void dvb_table_nit_free(struct dvb_table_nit *nit);
>
> /**
> * @brief Prints the content of the NIT table
> @@ -230,7 +230,7 @@ void dvb_table_nit_free(struct dvb_table_nit *table);
> * @param parms struct dvb_v5_fe_parms pointer to the opened device
> * @param table pointer to struct dvb_table_nit
> */
> -void dvb_table_nit_print(struct dvb_v5_fe_parms *parms, struct dvb_table_nit *table);
> +void dvb_table_nit_print(struct dvb_v5_fe_parms *parms, struct dvb_table_nit *nit);
>
> /**
> * @brief For each entry at NIT and NIT transport tables, call a callback
> @@ -263,7 +263,7 @@ void dvb_table_nit_print(struct dvb_v5_fe_parms *parms, struct dvb_table_nit *ta
> */
> void dvb_table_nit_descriptor_handler(
> struct dvb_v5_fe_parms *parms,
> - struct dvb_table_nit *table,
> + struct dvb_table_nit *nit,
> enum descriptors descriptor,
> nit_handler_callback_t *call_nit,
> nit_tran_handler_callback_t *call_tran,
> diff --git a/lib/include/libdvbv5/pat.h b/lib/include/libdvbv5/pat.h
> index bdf31ab5..9b1303a1 100644
> --- a/lib/include/libdvbv5/pat.h
> +++ b/lib/include/libdvbv5/pat.h
> @@ -153,7 +153,7 @@ ssize_t dvb_table_pat_init (struct dvb_v5_fe_parms *parms, const uint8_t *buf,
> *
> * @param table pointer to struct dvb_table_pat to be freed
> */
> -void dvb_table_pat_free(struct dvb_table_pat *table);
> +void dvb_table_pat_free(struct dvb_table_pat *pat);
>
> /**
> * @brief Prints the content of the PAT table
> @@ -163,7 +163,7 @@ void dvb_table_pat_free(struct dvb_table_pat *table);
> * @param table pointer to struct dvb_table_pat
> */
> void dvb_table_pat_print(struct dvb_v5_fe_parms *parms,
> - struct dvb_table_pat *table);
> + struct dvb_table_pat *pat);
>
> #ifdef __cplusplus
> }
> diff --git a/lib/include/libdvbv5/pmt.h b/lib/include/libdvbv5/pmt.h
> index 5876c594..45ce88b0 100644
> --- a/lib/include/libdvbv5/pmt.h
> +++ b/lib/include/libdvbv5/pmt.h
> @@ -281,7 +281,7 @@ ssize_t dvb_table_pmt_init (struct dvb_v5_fe_parms *parms, const uint8_t *buf,
> *
> * @param table pointer to struct dvb_table_pmt to be freed
> */
> -void dvb_table_pmt_free(struct dvb_table_pmt *table);
> +void dvb_table_pmt_free(struct dvb_table_pmt *pmt);
>
> /**
> * @brief Prints the content of the PAT table
> @@ -291,7 +291,7 @@ void dvb_table_pmt_free(struct dvb_table_pmt *table);
> * @param table pointer to struct dvb_table_pmt
> */
> void dvb_table_pmt_print(struct dvb_v5_fe_parms *parms,
> - const struct dvb_table_pmt *table);
> + const struct dvb_table_pmt *pmt);
>
> #ifdef __cplusplus
> }
> diff --git a/lib/include/libdvbv5/sdt.h b/lib/include/libdvbv5/sdt.h
> index 52fdf07f..1292f82d 100644
> --- a/lib/include/libdvbv5/sdt.h
> +++ b/lib/include/libdvbv5/sdt.h
> @@ -169,7 +169,7 @@ ssize_t dvb_table_sdt_init (struct dvb_v5_fe_parms *parms, const uint8_t *buf,
> *
> * @param table pointer to struct dvb_table_sdt to be freed
> */
> -void dvb_table_sdt_free(struct dvb_table_sdt *table);
> +void dvb_table_sdt_free(struct dvb_table_sdt *sdt);
>
> /**
> * @brief Prints the content of the SDT table
> @@ -178,7 +178,7 @@ void dvb_table_sdt_free(struct dvb_table_sdt *table);
> * @param parms struct dvb_v5_fe_parms pointer to the opened device
> * @param table pointer to struct dvb_table_sdt
> */
> -void dvb_table_sdt_print(struct dvb_v5_fe_parms *parms, struct dvb_table_sdt *table);
> +void dvb_table_sdt_print(struct dvb_v5_fe_parms *parms, struct dvb_table_sdt *sdt);
>
> #ifdef __cplusplus
> }
> diff --git a/lib/include/libdvbv5/vct.h b/lib/include/libdvbv5/vct.h
> index 374c73a8..86c4728a 100644
> --- a/lib/include/libdvbv5/vct.h
> +++ b/lib/include/libdvbv5/vct.h
> @@ -233,7 +233,7 @@ ssize_t atsc_table_vct_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf,
> *
> * @param table pointer to struct atsc_table_vct to be freed
> */
> -void atsc_table_vct_free(struct atsc_table_vct *table);
> +void atsc_table_vct_free(struct atsc_table_vct *vct);
> /**
> * @brief Prints the content of the VCT table
> * @ingroup dvb_table
> @@ -242,7 +242,7 @@ void atsc_table_vct_free(struct atsc_table_vct *table);
> * @param table pointer to struct atsc_table_vct
> */
> void atsc_table_vct_print(struct dvb_v5_fe_parms *parms,
> - struct atsc_table_vct *table);
> + struct atsc_table_vct *vct);
>
> #ifdef __cplusplus
> }
> diff --git a/lib/include/libv4l2.h b/lib/include/libv4l2.h
> index ea1870db..5c093067 100644
> --- a/lib/include/libv4l2.h
> +++ b/lib/include/libv4l2.h
> @@ -64,7 +64,7 @@ LIBV4L_PUBLIC int v4l2_open(const char *file, int oflag, ...);
> LIBV4L_PUBLIC int v4l2_close(int fd);
> LIBV4L_PUBLIC int v4l2_dup(int fd);
> LIBV4L_PUBLIC int v4l2_ioctl(int fd, unsigned long int request, ...);
> -LIBV4L_PUBLIC ssize_t v4l2_read(int fd, void *buffer, size_t n);
> +LIBV4L_PUBLIC ssize_t v4l2_read(int fd, void *dest, size_t n);
> LIBV4L_PUBLIC ssize_t v4l2_write(int fd, const void *buffer, size_t n);
> LIBV4L_PUBLIC void *v4l2_mmap(void *start, size_t length, int prot, int flags,
> int fd, int64_t offset);
> diff --git a/lib/libdvbv5/parse_string.h b/lib/libdvbv5/parse_string.h
> index b0884bfb..86604bde 100644
> --- a/lib/libdvbv5/parse_string.h
> +++ b/lib/libdvbv5/parse_string.h
> @@ -27,7 +27,7 @@ void dvb_iconv_to_charset(struct dvb_v5_fe_parms *parms,
> size_t destlen,
> const unsigned char *src,
> size_t len,
> - char *type, char *output_charset);
> + char *input_charset, char *output_charset);
>
> void dvb_parse_string(struct dvb_v5_fe_parms *parms, char **dest, char **emph,
> const unsigned char *src, size_t len);
> diff --git a/lib/libv4lconvert/libv4lconvert-priv.h b/lib/libv4lconvert/libv4lconvert-priv.h
> index ce5970c9..dd168424 100644
> --- a/lib/libv4lconvert/libv4lconvert-priv.h
> +++ b/lib/libv4lconvert/libv4lconvert-priv.h
> @@ -117,43 +117,43 @@ int v4lconvert_oom_error(struct v4lconvert_data *data);
> void v4lconvert_rgb24_to_yuv420(const unsigned char *src, unsigned char *dest,
> const struct v4l2_format *src_fmt, int bgr, int yvu, int bpp);
>
> -void v4lconvert_yuv420_to_rgb24(const unsigned char *src, unsigned char *dst,
> +void v4lconvert_yuv420_to_rgb24(const unsigned char *src, unsigned char *dest,
> int width, int height, int yvu);
>
> -void v4lconvert_yuv420_to_bgr24(const unsigned char *src, unsigned char *dst,
> +void v4lconvert_yuv420_to_bgr24(const unsigned char *src, unsigned char *dest,
> int width, int height, int yvu);
>
> -void v4lconvert_yuyv_to_rgb24(const unsigned char *src, unsigned char *dst,
> +void v4lconvert_yuyv_to_rgb24(const unsigned char *src, unsigned char *dest,
> int width, int height, int stride);
>
> -void v4lconvert_yuyv_to_bgr24(const unsigned char *src, unsigned char *dst,
> +void v4lconvert_yuyv_to_bgr24(const unsigned char *src, unsigned char *dest,
> int width, int height, int stride);
>
> -void v4lconvert_yuyv_to_yuv420(const unsigned char *src, unsigned char *dst,
> +void v4lconvert_yuyv_to_yuv420(const unsigned char *src, unsigned char *dest,
> int width, int height, int stride, int yvu);
>
> void v4lconvert_nv16_to_yuyv(const unsigned char *src, unsigned char *dest,
> int width, int height);
>
> -void v4lconvert_yvyu_to_rgb24(const unsigned char *src, unsigned char *dst,
> +void v4lconvert_yvyu_to_rgb24(const unsigned char *src, unsigned char *dest,
> int width, int height, int stride);
>
> -void v4lconvert_yvyu_to_bgr24(const unsigned char *src, unsigned char *dst,
> +void v4lconvert_yvyu_to_bgr24(const unsigned char *src, unsigned char *dest,
> int width, int height, int stride);
>
> -void v4lconvert_uyvy_to_rgb24(const unsigned char *src, unsigned char *dst,
> +void v4lconvert_uyvy_to_rgb24(const unsigned char *src, unsigned char *dest,
> int width, int height, int stride);
>
> -void v4lconvert_uyvy_to_bgr24(const unsigned char *src, unsigned char *dst,
> +void v4lconvert_uyvy_to_bgr24(const unsigned char *src, unsigned char *dest,
> int width, int height, int stride);
>
> -void v4lconvert_uyvy_to_yuv420(const unsigned char *src, unsigned char *dst,
> +void v4lconvert_uyvy_to_yuv420(const unsigned char *src, unsigned char *dest,
> int width, int height, int stride, int yvu);
>
> void v4lconvert_swap_rgb(const unsigned char *src, unsigned char *dst,
> int width, int height);
>
> -void v4lconvert_swap_uv(const unsigned char *src, unsigned char *dst,
> +void v4lconvert_swap_uv(const unsigned char *src, unsigned char *dest,
> const struct v4l2_format *src_fmt);
>
> void v4lconvert_grey_to_rgb24(const unsigned char *src, unsigned char *dest,
> @@ -209,9 +209,9 @@ void v4lconvert_m420_to_yuv420(const unsigned char *src,
>
> int v4lconvert_cpia1_to_yuv420(struct v4lconvert_data *data,
> const unsigned char *src, int src_size,
> - unsigned char *dst, int width, int height, int yvu);
> + unsigned char *dest, int width, int height, int yvu);
>
> -void v4lconvert_sn9c20x_to_yuv420(const unsigned char *src, unsigned char *dst,
> +void v4lconvert_sn9c20x_to_yuv420(const unsigned char *raw, unsigned char *i420,
> int width, int height, int yvu);
>
> int v4lconvert_se401_to_rgb24(struct v4lconvert_data *data,
> @@ -226,13 +226,13 @@ int v4lconvert_decode_jpeg_libjpeg(struct v4lconvert_data *data,
> unsigned char *src, int src_size, unsigned char *dest,
> struct v4l2_format *fmt, unsigned int dest_pix_fmt);
>
> -int v4lconvert_decode_jpgl(const unsigned char *src, int src_size,
> - unsigned int dest_pix_fmt, unsigned char *dest, int width, int height);
> +int v4lconvert_decode_jpgl(const unsigned char *inp, int src_size,
> + unsigned int dest_pix_fmt, unsigned char *fb, int width, int height);
>
> -void v4lconvert_decode_spca561(const unsigned char *src, unsigned char *dst,
> +void v4lconvert_decode_spca561(const unsigned char *inbuf, unsigned char *outbuf,
> int width, int height);
>
> -void v4lconvert_decode_sn9c10x(const unsigned char *src, unsigned char *dst,
> +void v4lconvert_decode_sn9c10x(const unsigned char *inp, unsigned char *outp,
> int width, int height);
>
> int v4lconvert_decode_pac207(struct v4lconvert_data *data,
> @@ -240,7 +240,7 @@ int v4lconvert_decode_pac207(struct v4lconvert_data *data,
> int width, int height);
>
> int v4lconvert_decode_mr97310a(struct v4lconvert_data *data,
> - const unsigned char *src, int src_size, unsigned char *dst,
> + const unsigned char *inp, int src_size, unsigned char *outp,
> int width, int height);
>
> int v4lconvert_decode_jl2005bcd(struct v4lconvert_data *data,
> @@ -257,10 +257,10 @@ void v4lconvert_decode_stv0680(const unsigned char *src, unsigned char *dst,
> int width, int height);
>
> void v4lconvert_bayer_to_rgb24(const unsigned char *bayer,
> - unsigned char *rgb, int width, int height, const unsigned int stride, unsigned int pixfmt);
> + unsigned char *bgr, int width, int height, const unsigned int stride, unsigned int pixfmt);
>
> void v4lconvert_bayer_to_bgr24(const unsigned char *bayer,
> - unsigned char *rgb, int width, int height, const unsigned int stride, unsigned int pixfmt);
> + unsigned char *bgr, int width, int height, const unsigned int stride, unsigned int pixfmt);
>
> void v4lconvert_bayer_to_yuv420(const unsigned char *bayer, unsigned char *yuv,
> int width, int height, const unsigned int stride, unsigned int src_pixfmt, int yvu);
> @@ -275,13 +275,13 @@ void v4lconvert_bayer16_to_bayer8(unsigned char *bayer16,
> unsigned char *bayer8, int width, int height);
>
> void v4lconvert_hm12_to_rgb24(const unsigned char *src,
> - unsigned char *dst, int width, int height);
> + unsigned char *dest, int width, int height);
>
> void v4lconvert_hm12_to_bgr24(const unsigned char *src,
> - unsigned char *dst, int width, int height);
> + unsigned char *dest, int width, int height);
>
> void v4lconvert_hm12_to_yuv420(const unsigned char *src,
> - unsigned char *dst, int width, int height, int yvu);
> + unsigned char *dest, int width, int height, int yvu);
>
> void v4lconvert_hsv_to_rgb24(const unsigned char *src, unsigned char *dest,
> int width, int height, int bgr, int Xin, unsigned char hsv_enc);
> @@ -303,7 +303,7 @@ void v4lconvert_crop(unsigned char *src, unsigned char *dest,
>
> int v4lconvert_helper_decompress(struct v4lconvert_data *data,
> const char *helper, const unsigned char *src, int src_size,
> - unsigned char *dest, int dest_size, int width, int height, int command);
> + unsigned char *dest, int dest_size, int width, int height, int flags);
>
> void v4lconvert_helper_cleanup(struct v4lconvert_data *data);
>
> diff --git a/lib/libv4lconvert/processing/libv4lprocessing.h b/lib/libv4lconvert/processing/libv4lprocessing.h
> index d135a9d6..52184a7c 100644
> --- a/lib/libv4lconvert/processing/libv4lprocessing.h
> +++ b/lib/libv4lconvert/processing/libv4lprocessing.h
> @@ -31,7 +31,7 @@
> struct v4lprocessing_data;
> struct v4lcontrol_data;
>
> -struct v4lprocessing_data *v4lprocessing_create(int fd, struct v4lcontrol_data *data);
> +struct v4lprocessing_data *v4lprocessing_create(int fd, struct v4lcontrol_data *control);
> void v4lprocessing_destroy(struct v4lprocessing_data *data);
>
> /* Prepare to process 1 frame, returns 1 if processing is necesary,
> diff --git a/lib/libv4lconvert/tinyjpeg.h b/lib/libv4lconvert/tinyjpeg.h
> index ee61d234..857f833d 100644
> --- a/lib/libv4lconvert/tinyjpeg.h
> +++ b/lib/libv4lconvert/tinyjpeg.h
> @@ -58,7 +58,7 @@ struct jdec_private *tinyjpeg_init(void);
> void tinyjpeg_free(struct jdec_private *priv);
>
> int tinyjpeg_parse_header(struct jdec_private *priv, const unsigned char *buf, unsigned int size);
> -int tinyjpeg_decode(struct jdec_private *priv, int pixel_format);
> +int tinyjpeg_decode(struct jdec_private *priv, int pixfmt);
> const char *tinyjpeg_get_errorstring(struct jdec_private *priv);
> void tinyjpeg_get_size(struct jdec_private *priv, unsigned int *width, unsigned int *height);
> int tinyjpeg_get_components(struct jdec_private *priv, unsigned char **components);
> diff --git a/utils/cec-compliance/cec-compliance.h b/utils/cec-compliance/cec-compliance.h
> index f50ea483..7342d75e 100644
> --- a/utils/cec-compliance/cec-compliance.h
> +++ b/utils/cec-compliance/cec-compliance.h
> @@ -285,8 +285,7 @@ struct remote_subtest {
> if (test) { \
> if (version >= CEC_OP_CEC_VERSION_2_0) \
> return fail("%s\n", #test); \
> - else \
> - warn("fails in CEC 2.0: %s\n", #test); \
> + warn("fails in CEC 2.0: %s\n", #test); \
> } \
> } while(0)
>
> diff --git a/utils/common/v4l-stream.h b/utils/common/v4l-stream.h
> index fe5dfe90..e6b6c27d 100644
> --- a/utils/common/v4l-stream.h
> +++ b/utils/common/v4l-stream.h
> @@ -144,8 +144,8 @@ struct codec_ctx {
> u32 comp_max_size;
> };
>
> -unsigned rle_compress(__u8 *buf, unsigned size, unsigned bytesperline);
> -void rle_decompress(__u8 *buf, unsigned size, unsigned rle_size, unsigned bytesperline);
> +unsigned rle_compress(__u8 *buf, unsigned size, unsigned bpl);
> +void rle_decompress(__u8 *buf, unsigned size, unsigned rle_size, unsigned bpl);
> struct codec_ctx *fwht_alloc(unsigned pixfmt, unsigned visible_width, unsigned visible_height,
> unsigned coded_width, unsigned coded_height, unsigned field,
> unsigned colorspace, unsigned xfer_func, unsigned ycbcr_enc,
> diff --git a/utils/keytable/bpf.h b/utils/keytable/bpf.h
> index fb3896c9..f09232cf 100644
> --- a/utils/keytable/bpf.h
> +++ b/utils/keytable/bpf.h
> @@ -89,10 +89,10 @@ int bpf_map_delete_elem(int fd, const void *key);
> int bpf_map_get_next_key(int fd, const void *key, void *next_key);
> int bpf_obj_pin(int fd, const char *pathname);
> int bpf_obj_get(const char *pathname);
> -int bpf_prog_attach(int prog_fd, int attachable_fd, enum bpf_attach_type type,
> +int bpf_prog_attach(int prog_fd, int target_fd, enum bpf_attach_type type,
> unsigned int flags);
> -int bpf_prog_detach(int attachable_fd, enum bpf_attach_type type);
> -int bpf_prog_detach2(int prog_fd, int attachable_fd, enum bpf_attach_type type);
> +int bpf_prog_detach(int target_fd, enum bpf_attach_type type);
> +int bpf_prog_detach2(int prog_fd, int target_fd, enum bpf_attach_type type);
> int bpf_prog_test_run(int prog_fd, int repeat, void *data, __u32 size,
> void *data_out, __u32 *size_out, __u32 *retval,
> __u32 *duration);
> diff --git a/utils/libcecutil/cec-log.cpp b/utils/libcecutil/cec-log.cpp
> index 0ce1e023..f83839b5 100644
> --- a/utils/libcecutil/cec-log.cpp
> +++ b/utils/libcecutil/cec-log.cpp
> @@ -101,12 +101,12 @@ static const struct cec_arg arg_rec_src_type = {
> };
>
> static void log_digital(const char *arg_name, const struct cec_op_digital_service_id *digital);
> -static void log_rec_src(const char *arg_name, const struct cec_op_record_src *rec_src);
> -static void log_tuner_dev_info(const char *arg_name, const struct cec_op_tuner_device_info *tuner_dev_info);
> -static void log_features(const struct cec_arg *arg, const char *arg_name, const __u8 *p);
> -static void log_ui_command(const char *arg_name, const struct cec_op_ui_command *ui_cmd);
> -static void log_descriptors(const char *arg_name, unsigned num, const __u32 *descriptors);
> -static void log_u8_array(const char *arg_name, unsigned num, const __u8 *vals);
> +static void log_rec_src(const char *arg_string, const struct cec_op_record_src *rec_src);
> +static void log_tuner_dev_info(const char *arg_string, const struct cec_op_tuner_device_info *tuner_dev_info);
> +static void log_features(const struct cec_arg *arg, const char *arg_string, const __u8 *p);
> +static void log_ui_command(const char *arg_string, const struct cec_op_ui_command *ui_cmd);
> +static void log_descriptors(const char *arg_string, unsigned num, const __u32 *descriptors);
> +static void log_u8_array(const char *arg_string, unsigned num, const __u8 *vals);
> static void log_unknown_msg(const struct cec_msg *msg);
> static void log_htng_unknown_msg(const struct cec_msg *msg);
>
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/7] treewide: fix mismatching declarations
2020-04-21 7:23 ` [PATCH 1/7] treewide: fix mismatching declarations Hans Verkuil
@ 2020-04-21 7:26 ` Hans Verkuil
0 siblings, 0 replies; 12+ messages in thread
From: Hans Verkuil @ 2020-04-21 7:26 UTC (permalink / raw)
To: Rosen Penev, linux-media
On 21/04/2020 09:23, Hans Verkuil wrote:
> On 20/04/2020 20:46, Rosen Penev wrote:
>> Found with clang-tidy's
>> readability-inconsistent-declaration-parameter-name
>>
>> Signed-off-by: Rosen Penev <rosenp@gmail.com>
>> ---
>> lib/include/libdvbv5/atsc_eit.h | 4 +-
>> lib/include/libdvbv5/cat.h | 4 +-
>> lib/include/libdvbv5/descriptors.h | 2 +-
>> lib/include/libdvbv5/dvb-demux.h | 2 +-
>> lib/include/libdvbv5/dvb-dev.h | 2 +-
>> lib/include/libdvbv5/dvb-fe.h | 2 +-
>> lib/include/libdvbv5/dvb-file.h | 4 +-
>> lib/include/libdvbv5/dvb-scan.h | 16 +++----
>> lib/include/libdvbv5/eit.h | 4 +-
>> lib/include/libdvbv5/header.h | 4 +-
>> lib/include/libdvbv5/mgt.h | 4 +-
>> lib/include/libdvbv5/mpeg_pes.h | 2 +-
>> lib/include/libdvbv5/nit.h | 6 +--
>> lib/include/libdvbv5/pat.h | 4 +-
>> lib/include/libdvbv5/pmt.h | 4 +-
>> lib/include/libdvbv5/sdt.h | 4 +-
>> lib/include/libdvbv5/vct.h | 4 +-
>> lib/include/libv4l2.h | 2 +-
>> lib/libdvbv5/parse_string.h | 2 +-
>> lib/libv4lconvert/libv4lconvert-priv.h | 48 +++++++++----------
>> .../processing/libv4lprocessing.h | 2 +-
>> lib/libv4lconvert/tinyjpeg.h | 2 +-
>> utils/cec-compliance/cec-compliance.h | 3 +-
>> utils/common/v4l-stream.h | 4 +-
>> utils/keytable/bpf.h | 6 +--
>> utils/libcecutil/cec-log.cpp | 12 ++---
>> 26 files changed, 76 insertions(+), 77 deletions(-)
>>
>> diff --git a/lib/include/libdvbv5/atsc_eit.h b/lib/include/libdvbv5/atsc_eit.h
>> index 5e52087c..18ae599d 100644
>> --- a/lib/include/libdvbv5/atsc_eit.h
>> +++ b/lib/include/libdvbv5/atsc_eit.h
>> @@ -192,7 +192,7 @@ ssize_t atsc_table_eit_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf,
>> *
>> * @param table pointer to struct atsc_table_eit to be freed
>> */
>> -void atsc_table_eit_free(struct atsc_table_eit *table);
>> +void atsc_table_eit_free(struct atsc_table_eit *eit);
>
> You need to update the docbook comment as well: @param table should become @param eit.
>
> Same elsewhere.
On second thought, I think I'll reject this patch. It's not worth the
trouble.
Regards,
Hans
>
> Regards,
>
> Hans
>
>>
>> /**
>> * @brief Prints the content of the ATSC EIT table
>> @@ -202,7 +202,7 @@ void atsc_table_eit_free(struct atsc_table_eit *table);
>> * @param table pointer to struct atsc_table_eit
>> */
>> void atsc_table_eit_print(struct dvb_v5_fe_parms *parms,
>> - struct atsc_table_eit *table);
>> + struct atsc_table_eit *eit);
>>
>> /**
>> * @brief Converts an ATSC EIT formatted timestamp into struct tm
>> diff --git a/lib/include/libdvbv5/cat.h b/lib/include/libdvbv5/cat.h
>> index 612c2c35..2e767ddc 100644
>> --- a/lib/include/libdvbv5/cat.h
>> +++ b/lib/include/libdvbv5/cat.h
>> @@ -88,7 +88,7 @@ ssize_t dvb_table_cat_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf,
>> *
>> * @param table pointer to struct dvb_table_cat to be freed
>> */
>> -void dvb_table_cat_free(struct dvb_table_cat *table);
>> +void dvb_table_cat_free(struct dvb_table_cat *cat);
>>
>> /**
>> * @brief Prints the content of the CAT table
>> @@ -97,7 +97,7 @@ void dvb_table_cat_free(struct dvb_table_cat *table);
>> * @param table pointer to struct dvb_table_cat
>> */
>> void dvb_table_cat_print(struct dvb_v5_fe_parms *parms,
>> - struct dvb_table_cat *table);
>> + struct dvb_table_cat *cat);
>>
>> #ifdef __cplusplus
>> }
>> diff --git a/lib/include/libdvbv5/descriptors.h b/lib/include/libdvbv5/descriptors.h
>> index cb21470c..8f3900f2 100644
>> --- a/lib/include/libdvbv5/descriptors.h
>> +++ b/lib/include/libdvbv5/descriptors.h
>> @@ -157,7 +157,7 @@ uint32_t dvb_bcd(uint32_t bcd);
>> * @param len Number of bytes to show
>> */
>> void dvb_hexdump(struct dvb_v5_fe_parms *parms, const char *prefix,
>> - const unsigned char *buf, int len);
>> + const unsigned char *data, int len);
>>
>> /**
>> * @brief parse MPEG-TS descriptors
>> diff --git a/lib/include/libdvbv5/dvb-demux.h b/lib/include/libdvbv5/dvb-demux.h
>> index 971c27f6..d3bc02a9 100644
>> --- a/lib/include/libdvbv5/dvb-demux.h
>> +++ b/lib/include/libdvbv5/dvb-demux.h
>> @@ -148,7 +148,7 @@ int dvb_set_section_filter(int dmxfd, int pid, unsigned filtsize,
>> *
>> * @warning This function currently assumes that the PAT fits into one session.
>> */
>> -int dvb_get_pmt_pid(int dmxfd, int sid);
>> +int dvb_get_pmt_pid(int patfd, int sid);
>>
>> #ifdef __cplusplus
>> }
>> diff --git a/lib/include/libdvbv5/dvb-dev.h b/lib/include/libdvbv5/dvb-dev.h
>> index 2eeae516..5a9cc1a2 100644
>> --- a/lib/include/libdvbv5/dvb-dev.h
>> +++ b/lib/include/libdvbv5/dvb-dev.h
>> @@ -398,7 +398,7 @@ int dvb_dev_set_bufsize(struct dvb_open_descriptor *open_dev,
>> */
>> int dvb_dev_dmx_set_pesfilter(struct dvb_open_descriptor *open_dev,
>> int pid, dmx_pes_type_t type,
>> - dmx_output_t output, int buffersize);
>> + dmx_output_t output, int bufsize);
>>
>> /**
>> * @brief Sets a MPEG-TS section filter
>> diff --git a/lib/include/libdvbv5/dvb-fe.h b/lib/include/libdvbv5/dvb-fe.h
>> index 96657013..4bd94108 100644
>> --- a/lib/include/libdvbv5/dvb-fe.h
>> +++ b/lib/include/libdvbv5/dvb-fe.h
>> @@ -732,7 +732,7 @@ int dvb_fe_is_satellite(uint32_t delivery_system);
>> * "COUNTRY" property in dvb_fe_set_parm() overrides the setting.
>> */
>> int dvb_fe_set_default_country(struct dvb_v5_fe_parms *parms,
>> - const char *country);
>> + const char *cc);
>>
>> #ifdef __cplusplus
>> }
>> diff --git a/lib/include/libdvbv5/dvb-file.h b/lib/include/libdvbv5/dvb-file.h
>> index 1f1a6386..9c8c54d9 100644
>> --- a/lib/include/libdvbv5/dvb-file.h
>> +++ b/lib/include/libdvbv5/dvb-file.h
>> @@ -423,8 +423,8 @@ int dvb_retrieve_entry_prop(struct dvb_entry *entry,
>> * @return Returns 0 if success, or, -1 if error.
>> */
>> int dvb_store_channel(struct dvb_file **dvb_file,
>> - struct dvb_v5_fe_parms *parms,
>> - struct dvb_v5_descriptors *dvb_desc,
>> + struct dvb_v5_fe_parms *__p,
>> + struct dvb_v5_descriptors *dvb_scan_handler,
>> int get_detected, int get_nit);
>>
>> /**
>> diff --git a/lib/include/libdvbv5/dvb-scan.h b/lib/include/libdvbv5/dvb-scan.h
>> index 2666d906..50846b98 100644
>> --- a/lib/include/libdvbv5/dvb-scan.h
>> +++ b/lib/include/libdvbv5/dvb-scan.h
>> @@ -222,7 +222,7 @@ int dvb_read_section(struct dvb_v5_fe_parms *parms, int dmx_fd,
>> * This is a variant of dvb_read_section() that uses a struct dvb_table_filter
>> * to specify the filter to use.
>> */
>> -int dvb_read_sections(struct dvb_v5_fe_parms *parms, int dmx_fd,
>> +int dvb_read_sections(struct dvb_v5_fe_parms *__p, int dmx_fd,
>> struct dvb_table_filter *sect,
>> unsigned timeout);
>>
>> @@ -265,7 +265,7 @@ void dvb_scan_free_handler_table(struct dvb_v5_descriptors *dvb_scan_handler);
>> * On sucess, it returns a pointer to a struct dvb_v5_descriptors, that can
>> * either be used to tune into a service or to be stored inside a file.
>> */
>> -struct dvb_v5_descriptors *dvb_get_ts_tables(struct dvb_v5_fe_parms *parms, int dmx_fd,
>> +struct dvb_v5_descriptors *dvb_get_ts_tables(struct dvb_v5_fe_parms *__p, int dmx_fd,
>> uint32_t delivery_system,
>> unsigned other_nit,
>> unsigned timeout_multiply);
>> @@ -337,7 +337,7 @@ typedef int (check_frontend_t)(void *args, struct dvb_v5_fe_parms *parms);
>> * }
>> * @endcode
>> */
>> -struct dvb_v5_descriptors *dvb_scan_transponder(struct dvb_v5_fe_parms *parms,
>> +struct dvb_v5_descriptors *dvb_scan_transponder(struct dvb_v5_fe_parms *__p,
>> struct dvb_entry *entry,
>> int dmx_fd,
>> check_frontend_t *check_frontend,
>> @@ -388,7 +388,7 @@ struct dvb_v5_descriptors *dvb_scan_transponder(struct dvb_v5_fe_parms *parms,
>> * }
>> * @endcode
>> */
>> -void dvb_add_scaned_transponders(struct dvb_v5_fe_parms *parms,
>> +void dvb_add_scaned_transponders(struct dvb_v5_fe_parms *__p,
>> struct dvb_v5_descriptors *dvb_scan_handler,
>> struct dvb_entry *first_entry,
>> struct dvb_entry *entry);
>> @@ -398,12 +398,12 @@ void dvb_add_scaned_transponders(struct dvb_v5_fe_parms *parms,
>> * Some ancillary functions used internally inside the library, used to
>> * identify duplicated transport streams and add new found transponder entries
>> */
>> -int dvb_estimate_freq_shift(struct dvb_v5_fe_parms *parms);
>> +int dvb_estimate_freq_shift(struct dvb_v5_fe_parms *__p);
>>
>> int dvb_new_freq_is_needed(struct dvb_entry *entry, struct dvb_entry *last_entry,
>> uint32_t freq, enum dvb_sat_polarization pol, int shift);
>>
>> -struct dvb_entry *dvb_scan_add_entry(struct dvb_v5_fe_parms *parms,
>> +struct dvb_entry *dvb_scan_add_entry(struct dvb_v5_fe_parms *__p,
>> struct dvb_entry *first_entry,
>> struct dvb_entry *entry,
>> uint32_t freq, uint32_t shift,
>> @@ -414,14 +414,14 @@ int dvb_new_entry_is_needed(struct dvb_entry *entry,
>> uint32_t freq, int shift,
>> enum dvb_sat_polarization pol, uint32_t stream_id);
>>
>> -struct dvb_entry *dvb_scan_add_entry_ex(struct dvb_v5_fe_parms *parms,
>> +struct dvb_entry *dvb_scan_add_entry_ex(struct dvb_v5_fe_parms *__p,
>> struct dvb_entry *first_entry,
>> struct dvb_entry *entry,
>> uint32_t freq, uint32_t shift,
>> enum dvb_sat_polarization pol,
>> uint32_t stream_id);
>>
>> -void dvb_update_transponders(struct dvb_v5_fe_parms *parms,
>> +void dvb_update_transponders(struct dvb_v5_fe_parms *__p,
>> struct dvb_v5_descriptors *dvb_scan_handler,
>> struct dvb_entry *first_entry,
>> struct dvb_entry *entry);
>> diff --git a/lib/include/libdvbv5/eit.h b/lib/include/libdvbv5/eit.h
>> index 9129861e..5510707b 100644
>> --- a/lib/include/libdvbv5/eit.h
>> +++ b/lib/include/libdvbv5/eit.h
>> @@ -197,7 +197,7 @@ ssize_t dvb_table_eit_init (struct dvb_v5_fe_parms *parms, const uint8_t *buf,
>> *
>> * @param table pointer to struct dvb_table_eit to be freed
>> */
>> -void dvb_table_eit_free(struct dvb_table_eit *table);
>> +void dvb_table_eit_free(struct dvb_table_eit *eit);
>>
>> /**
>> * @brief Prints the content of the DVB EIT table
>> @@ -207,7 +207,7 @@ void dvb_table_eit_free(struct dvb_table_eit *table);
>> * @param table pointer to struct dvb_table_eit
>> */
>> void dvb_table_eit_print(struct dvb_v5_fe_parms *parms,
>> - struct dvb_table_eit *table);
>> + struct dvb_table_eit *eit);
>>
>> /**
>> * @brief Converts a DVB EIT formatted timestamp into struct tm
>> diff --git a/lib/include/libdvbv5/header.h b/lib/include/libdvbv5/header.h
>> index 2a459f9d..ccf67422 100644
>> --- a/lib/include/libdvbv5/header.h
>> +++ b/lib/include/libdvbv5/header.h
>> @@ -132,7 +132,7 @@ extern "C" {
>> *
>> * @param header pointer to struct dvb_table_header to be parsed
>> */
>> -void dvb_table_header_init (struct dvb_table_header *header);
>> +void dvb_table_header_init (struct dvb_table_header *t);
>> /**
>> * @brief Prints the content of the MPEG-TS table header
>> * @ingroup dvb_table
>> @@ -141,7 +141,7 @@ void dvb_table_header_init (struct dvb_table_header *header);
>> * @param header pointer to struct dvb_table_header to be printed
>> */
>> void dvb_table_header_print(struct dvb_v5_fe_parms *parms,
>> - const struct dvb_table_header *header);
>> + const struct dvb_table_header *t);
>>
>> #ifdef __cplusplus
>> }
>> diff --git a/lib/include/libdvbv5/mgt.h b/lib/include/libdvbv5/mgt.h
>> index 7aa92d6c..62b5a7ab 100644
>> --- a/lib/include/libdvbv5/mgt.h
>> +++ b/lib/include/libdvbv5/mgt.h
>> @@ -168,7 +168,7 @@ ssize_t atsc_table_mgt_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf,
>> *
>> * @param table pointer to struct atsc_table_mgt to be freed
>> */
>> -void atsc_table_mgt_free(struct atsc_table_mgt *table);
>> +void atsc_table_mgt_free(struct atsc_table_mgt *mgt);
>>
>> /**
>> * @brief Prints the content of the MGT table
>> @@ -178,7 +178,7 @@ void atsc_table_mgt_free(struct atsc_table_mgt *table);
>> * @param table pointer to struct atsc_table_mgt
>> */
>> void atsc_table_mgt_print(struct dvb_v5_fe_parms *parms,
>> - struct atsc_table_mgt *table);
>> + struct atsc_table_mgt *mgt);
>>
>> #ifdef __cplusplus
>> }
>> diff --git a/lib/include/libdvbv5/mpeg_pes.h b/lib/include/libdvbv5/mpeg_pes.h
>> index 9f214b26..b2b13584 100644
>> --- a/lib/include/libdvbv5/mpeg_pes.h
>> +++ b/lib/include/libdvbv5/mpeg_pes.h
>> @@ -228,7 +228,7 @@ ssize_t dvb_mpeg_pes_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf, ssi
>> * If the pointer pes was allocated dynamically, this function
>> * can be used to free the memory.
>> */
>> -void dvb_mpeg_pes_free(struct dvb_mpeg_pes *pes);
>> +void dvb_mpeg_pes_free(struct dvb_mpeg_pes *ts);
>>
>> /**
>> * @brief Print details of struct dvb_mpeg_pes
>> diff --git a/lib/include/libdvbv5/nit.h b/lib/include/libdvbv5/nit.h
>> index f8e0e730..ef0f1bc1 100644
>> --- a/lib/include/libdvbv5/nit.h
>> +++ b/lib/include/libdvbv5/nit.h
>> @@ -221,7 +221,7 @@ ssize_t dvb_table_nit_init (struct dvb_v5_fe_parms *parms, const uint8_t *buf,
>> *
>> * @param table pointer to struct dvb_table_nit to be freed
>> */
>> -void dvb_table_nit_free(struct dvb_table_nit *table);
>> +void dvb_table_nit_free(struct dvb_table_nit *nit);
>>
>> /**
>> * @brief Prints the content of the NIT table
>> @@ -230,7 +230,7 @@ void dvb_table_nit_free(struct dvb_table_nit *table);
>> * @param parms struct dvb_v5_fe_parms pointer to the opened device
>> * @param table pointer to struct dvb_table_nit
>> */
>> -void dvb_table_nit_print(struct dvb_v5_fe_parms *parms, struct dvb_table_nit *table);
>> +void dvb_table_nit_print(struct dvb_v5_fe_parms *parms, struct dvb_table_nit *nit);
>>
>> /**
>> * @brief For each entry at NIT and NIT transport tables, call a callback
>> @@ -263,7 +263,7 @@ void dvb_table_nit_print(struct dvb_v5_fe_parms *parms, struct dvb_table_nit *ta
>> */
>> void dvb_table_nit_descriptor_handler(
>> struct dvb_v5_fe_parms *parms,
>> - struct dvb_table_nit *table,
>> + struct dvb_table_nit *nit,
>> enum descriptors descriptor,
>> nit_handler_callback_t *call_nit,
>> nit_tran_handler_callback_t *call_tran,
>> diff --git a/lib/include/libdvbv5/pat.h b/lib/include/libdvbv5/pat.h
>> index bdf31ab5..9b1303a1 100644
>> --- a/lib/include/libdvbv5/pat.h
>> +++ b/lib/include/libdvbv5/pat.h
>> @@ -153,7 +153,7 @@ ssize_t dvb_table_pat_init (struct dvb_v5_fe_parms *parms, const uint8_t *buf,
>> *
>> * @param table pointer to struct dvb_table_pat to be freed
>> */
>> -void dvb_table_pat_free(struct dvb_table_pat *table);
>> +void dvb_table_pat_free(struct dvb_table_pat *pat);
>>
>> /**
>> * @brief Prints the content of the PAT table
>> @@ -163,7 +163,7 @@ void dvb_table_pat_free(struct dvb_table_pat *table);
>> * @param table pointer to struct dvb_table_pat
>> */
>> void dvb_table_pat_print(struct dvb_v5_fe_parms *parms,
>> - struct dvb_table_pat *table);
>> + struct dvb_table_pat *pat);
>>
>> #ifdef __cplusplus
>> }
>> diff --git a/lib/include/libdvbv5/pmt.h b/lib/include/libdvbv5/pmt.h
>> index 5876c594..45ce88b0 100644
>> --- a/lib/include/libdvbv5/pmt.h
>> +++ b/lib/include/libdvbv5/pmt.h
>> @@ -281,7 +281,7 @@ ssize_t dvb_table_pmt_init (struct dvb_v5_fe_parms *parms, const uint8_t *buf,
>> *
>> * @param table pointer to struct dvb_table_pmt to be freed
>> */
>> -void dvb_table_pmt_free(struct dvb_table_pmt *table);
>> +void dvb_table_pmt_free(struct dvb_table_pmt *pmt);
>>
>> /**
>> * @brief Prints the content of the PAT table
>> @@ -291,7 +291,7 @@ void dvb_table_pmt_free(struct dvb_table_pmt *table);
>> * @param table pointer to struct dvb_table_pmt
>> */
>> void dvb_table_pmt_print(struct dvb_v5_fe_parms *parms,
>> - const struct dvb_table_pmt *table);
>> + const struct dvb_table_pmt *pmt);
>>
>> #ifdef __cplusplus
>> }
>> diff --git a/lib/include/libdvbv5/sdt.h b/lib/include/libdvbv5/sdt.h
>> index 52fdf07f..1292f82d 100644
>> --- a/lib/include/libdvbv5/sdt.h
>> +++ b/lib/include/libdvbv5/sdt.h
>> @@ -169,7 +169,7 @@ ssize_t dvb_table_sdt_init (struct dvb_v5_fe_parms *parms, const uint8_t *buf,
>> *
>> * @param table pointer to struct dvb_table_sdt to be freed
>> */
>> -void dvb_table_sdt_free(struct dvb_table_sdt *table);
>> +void dvb_table_sdt_free(struct dvb_table_sdt *sdt);
>>
>> /**
>> * @brief Prints the content of the SDT table
>> @@ -178,7 +178,7 @@ void dvb_table_sdt_free(struct dvb_table_sdt *table);
>> * @param parms struct dvb_v5_fe_parms pointer to the opened device
>> * @param table pointer to struct dvb_table_sdt
>> */
>> -void dvb_table_sdt_print(struct dvb_v5_fe_parms *parms, struct dvb_table_sdt *table);
>> +void dvb_table_sdt_print(struct dvb_v5_fe_parms *parms, struct dvb_table_sdt *sdt);
>>
>> #ifdef __cplusplus
>> }
>> diff --git a/lib/include/libdvbv5/vct.h b/lib/include/libdvbv5/vct.h
>> index 374c73a8..86c4728a 100644
>> --- a/lib/include/libdvbv5/vct.h
>> +++ b/lib/include/libdvbv5/vct.h
>> @@ -233,7 +233,7 @@ ssize_t atsc_table_vct_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf,
>> *
>> * @param table pointer to struct atsc_table_vct to be freed
>> */
>> -void atsc_table_vct_free(struct atsc_table_vct *table);
>> +void atsc_table_vct_free(struct atsc_table_vct *vct);
>> /**
>> * @brief Prints the content of the VCT table
>> * @ingroup dvb_table
>> @@ -242,7 +242,7 @@ void atsc_table_vct_free(struct atsc_table_vct *table);
>> * @param table pointer to struct atsc_table_vct
>> */
>> void atsc_table_vct_print(struct dvb_v5_fe_parms *parms,
>> - struct atsc_table_vct *table);
>> + struct atsc_table_vct *vct);
>>
>> #ifdef __cplusplus
>> }
>> diff --git a/lib/include/libv4l2.h b/lib/include/libv4l2.h
>> index ea1870db..5c093067 100644
>> --- a/lib/include/libv4l2.h
>> +++ b/lib/include/libv4l2.h
>> @@ -64,7 +64,7 @@ LIBV4L_PUBLIC int v4l2_open(const char *file, int oflag, ...);
>> LIBV4L_PUBLIC int v4l2_close(int fd);
>> LIBV4L_PUBLIC int v4l2_dup(int fd);
>> LIBV4L_PUBLIC int v4l2_ioctl(int fd, unsigned long int request, ...);
>> -LIBV4L_PUBLIC ssize_t v4l2_read(int fd, void *buffer, size_t n);
>> +LIBV4L_PUBLIC ssize_t v4l2_read(int fd, void *dest, size_t n);
>> LIBV4L_PUBLIC ssize_t v4l2_write(int fd, const void *buffer, size_t n);
>> LIBV4L_PUBLIC void *v4l2_mmap(void *start, size_t length, int prot, int flags,
>> int fd, int64_t offset);
>> diff --git a/lib/libdvbv5/parse_string.h b/lib/libdvbv5/parse_string.h
>> index b0884bfb..86604bde 100644
>> --- a/lib/libdvbv5/parse_string.h
>> +++ b/lib/libdvbv5/parse_string.h
>> @@ -27,7 +27,7 @@ void dvb_iconv_to_charset(struct dvb_v5_fe_parms *parms,
>> size_t destlen,
>> const unsigned char *src,
>> size_t len,
>> - char *type, char *output_charset);
>> + char *input_charset, char *output_charset);
>>
>> void dvb_parse_string(struct dvb_v5_fe_parms *parms, char **dest, char **emph,
>> const unsigned char *src, size_t len);
>> diff --git a/lib/libv4lconvert/libv4lconvert-priv.h b/lib/libv4lconvert/libv4lconvert-priv.h
>> index ce5970c9..dd168424 100644
>> --- a/lib/libv4lconvert/libv4lconvert-priv.h
>> +++ b/lib/libv4lconvert/libv4lconvert-priv.h
>> @@ -117,43 +117,43 @@ int v4lconvert_oom_error(struct v4lconvert_data *data);
>> void v4lconvert_rgb24_to_yuv420(const unsigned char *src, unsigned char *dest,
>> const struct v4l2_format *src_fmt, int bgr, int yvu, int bpp);
>>
>> -void v4lconvert_yuv420_to_rgb24(const unsigned char *src, unsigned char *dst,
>> +void v4lconvert_yuv420_to_rgb24(const unsigned char *src, unsigned char *dest,
>> int width, int height, int yvu);
>>
>> -void v4lconvert_yuv420_to_bgr24(const unsigned char *src, unsigned char *dst,
>> +void v4lconvert_yuv420_to_bgr24(const unsigned char *src, unsigned char *dest,
>> int width, int height, int yvu);
>>
>> -void v4lconvert_yuyv_to_rgb24(const unsigned char *src, unsigned char *dst,
>> +void v4lconvert_yuyv_to_rgb24(const unsigned char *src, unsigned char *dest,
>> int width, int height, int stride);
>>
>> -void v4lconvert_yuyv_to_bgr24(const unsigned char *src, unsigned char *dst,
>> +void v4lconvert_yuyv_to_bgr24(const unsigned char *src, unsigned char *dest,
>> int width, int height, int stride);
>>
>> -void v4lconvert_yuyv_to_yuv420(const unsigned char *src, unsigned char *dst,
>> +void v4lconvert_yuyv_to_yuv420(const unsigned char *src, unsigned char *dest,
>> int width, int height, int stride, int yvu);
>>
>> void v4lconvert_nv16_to_yuyv(const unsigned char *src, unsigned char *dest,
>> int width, int height);
>>
>> -void v4lconvert_yvyu_to_rgb24(const unsigned char *src, unsigned char *dst,
>> +void v4lconvert_yvyu_to_rgb24(const unsigned char *src, unsigned char *dest,
>> int width, int height, int stride);
>>
>> -void v4lconvert_yvyu_to_bgr24(const unsigned char *src, unsigned char *dst,
>> +void v4lconvert_yvyu_to_bgr24(const unsigned char *src, unsigned char *dest,
>> int width, int height, int stride);
>>
>> -void v4lconvert_uyvy_to_rgb24(const unsigned char *src, unsigned char *dst,
>> +void v4lconvert_uyvy_to_rgb24(const unsigned char *src, unsigned char *dest,
>> int width, int height, int stride);
>>
>> -void v4lconvert_uyvy_to_bgr24(const unsigned char *src, unsigned char *dst,
>> +void v4lconvert_uyvy_to_bgr24(const unsigned char *src, unsigned char *dest,
>> int width, int height, int stride);
>>
>> -void v4lconvert_uyvy_to_yuv420(const unsigned char *src, unsigned char *dst,
>> +void v4lconvert_uyvy_to_yuv420(const unsigned char *src, unsigned char *dest,
>> int width, int height, int stride, int yvu);
>>
>> void v4lconvert_swap_rgb(const unsigned char *src, unsigned char *dst,
>> int width, int height);
>>
>> -void v4lconvert_swap_uv(const unsigned char *src, unsigned char *dst,
>> +void v4lconvert_swap_uv(const unsigned char *src, unsigned char *dest,
>> const struct v4l2_format *src_fmt);
>>
>> void v4lconvert_grey_to_rgb24(const unsigned char *src, unsigned char *dest,
>> @@ -209,9 +209,9 @@ void v4lconvert_m420_to_yuv420(const unsigned char *src,
>>
>> int v4lconvert_cpia1_to_yuv420(struct v4lconvert_data *data,
>> const unsigned char *src, int src_size,
>> - unsigned char *dst, int width, int height, int yvu);
>> + unsigned char *dest, int width, int height, int yvu);
>>
>> -void v4lconvert_sn9c20x_to_yuv420(const unsigned char *src, unsigned char *dst,
>> +void v4lconvert_sn9c20x_to_yuv420(const unsigned char *raw, unsigned char *i420,
>> int width, int height, int yvu);
>>
>> int v4lconvert_se401_to_rgb24(struct v4lconvert_data *data,
>> @@ -226,13 +226,13 @@ int v4lconvert_decode_jpeg_libjpeg(struct v4lconvert_data *data,
>> unsigned char *src, int src_size, unsigned char *dest,
>> struct v4l2_format *fmt, unsigned int dest_pix_fmt);
>>
>> -int v4lconvert_decode_jpgl(const unsigned char *src, int src_size,
>> - unsigned int dest_pix_fmt, unsigned char *dest, int width, int height);
>> +int v4lconvert_decode_jpgl(const unsigned char *inp, int src_size,
>> + unsigned int dest_pix_fmt, unsigned char *fb, int width, int height);
>>
>> -void v4lconvert_decode_spca561(const unsigned char *src, unsigned char *dst,
>> +void v4lconvert_decode_spca561(const unsigned char *inbuf, unsigned char *outbuf,
>> int width, int height);
>>
>> -void v4lconvert_decode_sn9c10x(const unsigned char *src, unsigned char *dst,
>> +void v4lconvert_decode_sn9c10x(const unsigned char *inp, unsigned char *outp,
>> int width, int height);
>>
>> int v4lconvert_decode_pac207(struct v4lconvert_data *data,
>> @@ -240,7 +240,7 @@ int v4lconvert_decode_pac207(struct v4lconvert_data *data,
>> int width, int height);
>>
>> int v4lconvert_decode_mr97310a(struct v4lconvert_data *data,
>> - const unsigned char *src, int src_size, unsigned char *dst,
>> + const unsigned char *inp, int src_size, unsigned char *outp,
>> int width, int height);
>>
>> int v4lconvert_decode_jl2005bcd(struct v4lconvert_data *data,
>> @@ -257,10 +257,10 @@ void v4lconvert_decode_stv0680(const unsigned char *src, unsigned char *dst,
>> int width, int height);
>>
>> void v4lconvert_bayer_to_rgb24(const unsigned char *bayer,
>> - unsigned char *rgb, int width, int height, const unsigned int stride, unsigned int pixfmt);
>> + unsigned char *bgr, int width, int height, const unsigned int stride, unsigned int pixfmt);
>>
>> void v4lconvert_bayer_to_bgr24(const unsigned char *bayer,
>> - unsigned char *rgb, int width, int height, const unsigned int stride, unsigned int pixfmt);
>> + unsigned char *bgr, int width, int height, const unsigned int stride, unsigned int pixfmt);
>>
>> void v4lconvert_bayer_to_yuv420(const unsigned char *bayer, unsigned char *yuv,
>> int width, int height, const unsigned int stride, unsigned int src_pixfmt, int yvu);
>> @@ -275,13 +275,13 @@ void v4lconvert_bayer16_to_bayer8(unsigned char *bayer16,
>> unsigned char *bayer8, int width, int height);
>>
>> void v4lconvert_hm12_to_rgb24(const unsigned char *src,
>> - unsigned char *dst, int width, int height);
>> + unsigned char *dest, int width, int height);
>>
>> void v4lconvert_hm12_to_bgr24(const unsigned char *src,
>> - unsigned char *dst, int width, int height);
>> + unsigned char *dest, int width, int height);
>>
>> void v4lconvert_hm12_to_yuv420(const unsigned char *src,
>> - unsigned char *dst, int width, int height, int yvu);
>> + unsigned char *dest, int width, int height, int yvu);
>>
>> void v4lconvert_hsv_to_rgb24(const unsigned char *src, unsigned char *dest,
>> int width, int height, int bgr, int Xin, unsigned char hsv_enc);
>> @@ -303,7 +303,7 @@ void v4lconvert_crop(unsigned char *src, unsigned char *dest,
>>
>> int v4lconvert_helper_decompress(struct v4lconvert_data *data,
>> const char *helper, const unsigned char *src, int src_size,
>> - unsigned char *dest, int dest_size, int width, int height, int command);
>> + unsigned char *dest, int dest_size, int width, int height, int flags);
>>
>> void v4lconvert_helper_cleanup(struct v4lconvert_data *data);
>>
>> diff --git a/lib/libv4lconvert/processing/libv4lprocessing.h b/lib/libv4lconvert/processing/libv4lprocessing.h
>> index d135a9d6..52184a7c 100644
>> --- a/lib/libv4lconvert/processing/libv4lprocessing.h
>> +++ b/lib/libv4lconvert/processing/libv4lprocessing.h
>> @@ -31,7 +31,7 @@
>> struct v4lprocessing_data;
>> struct v4lcontrol_data;
>>
>> -struct v4lprocessing_data *v4lprocessing_create(int fd, struct v4lcontrol_data *data);
>> +struct v4lprocessing_data *v4lprocessing_create(int fd, struct v4lcontrol_data *control);
>> void v4lprocessing_destroy(struct v4lprocessing_data *data);
>>
>> /* Prepare to process 1 frame, returns 1 if processing is necesary,
>> diff --git a/lib/libv4lconvert/tinyjpeg.h b/lib/libv4lconvert/tinyjpeg.h
>> index ee61d234..857f833d 100644
>> --- a/lib/libv4lconvert/tinyjpeg.h
>> +++ b/lib/libv4lconvert/tinyjpeg.h
>> @@ -58,7 +58,7 @@ struct jdec_private *tinyjpeg_init(void);
>> void tinyjpeg_free(struct jdec_private *priv);
>>
>> int tinyjpeg_parse_header(struct jdec_private *priv, const unsigned char *buf, unsigned int size);
>> -int tinyjpeg_decode(struct jdec_private *priv, int pixel_format);
>> +int tinyjpeg_decode(struct jdec_private *priv, int pixfmt);
>> const char *tinyjpeg_get_errorstring(struct jdec_private *priv);
>> void tinyjpeg_get_size(struct jdec_private *priv, unsigned int *width, unsigned int *height);
>> int tinyjpeg_get_components(struct jdec_private *priv, unsigned char **components);
>> diff --git a/utils/cec-compliance/cec-compliance.h b/utils/cec-compliance/cec-compliance.h
>> index f50ea483..7342d75e 100644
>> --- a/utils/cec-compliance/cec-compliance.h
>> +++ b/utils/cec-compliance/cec-compliance.h
>> @@ -285,8 +285,7 @@ struct remote_subtest {
>> if (test) { \
>> if (version >= CEC_OP_CEC_VERSION_2_0) \
>> return fail("%s\n", #test); \
>> - else \
>> - warn("fails in CEC 2.0: %s\n", #test); \
>> + warn("fails in CEC 2.0: %s\n", #test); \
>> } \
>> } while(0)
>>
>> diff --git a/utils/common/v4l-stream.h b/utils/common/v4l-stream.h
>> index fe5dfe90..e6b6c27d 100644
>> --- a/utils/common/v4l-stream.h
>> +++ b/utils/common/v4l-stream.h
>> @@ -144,8 +144,8 @@ struct codec_ctx {
>> u32 comp_max_size;
>> };
>>
>> -unsigned rle_compress(__u8 *buf, unsigned size, unsigned bytesperline);
>> -void rle_decompress(__u8 *buf, unsigned size, unsigned rle_size, unsigned bytesperline);
>> +unsigned rle_compress(__u8 *buf, unsigned size, unsigned bpl);
>> +void rle_decompress(__u8 *buf, unsigned size, unsigned rle_size, unsigned bpl);
>> struct codec_ctx *fwht_alloc(unsigned pixfmt, unsigned visible_width, unsigned visible_height,
>> unsigned coded_width, unsigned coded_height, unsigned field,
>> unsigned colorspace, unsigned xfer_func, unsigned ycbcr_enc,
>> diff --git a/utils/keytable/bpf.h b/utils/keytable/bpf.h
>> index fb3896c9..f09232cf 100644
>> --- a/utils/keytable/bpf.h
>> +++ b/utils/keytable/bpf.h
>> @@ -89,10 +89,10 @@ int bpf_map_delete_elem(int fd, const void *key);
>> int bpf_map_get_next_key(int fd, const void *key, void *next_key);
>> int bpf_obj_pin(int fd, const char *pathname);
>> int bpf_obj_get(const char *pathname);
>> -int bpf_prog_attach(int prog_fd, int attachable_fd, enum bpf_attach_type type,
>> +int bpf_prog_attach(int prog_fd, int target_fd, enum bpf_attach_type type,
>> unsigned int flags);
>> -int bpf_prog_detach(int attachable_fd, enum bpf_attach_type type);
>> -int bpf_prog_detach2(int prog_fd, int attachable_fd, enum bpf_attach_type type);
>> +int bpf_prog_detach(int target_fd, enum bpf_attach_type type);
>> +int bpf_prog_detach2(int prog_fd, int target_fd, enum bpf_attach_type type);
>> int bpf_prog_test_run(int prog_fd, int repeat, void *data, __u32 size,
>> void *data_out, __u32 *size_out, __u32 *retval,
>> __u32 *duration);
>> diff --git a/utils/libcecutil/cec-log.cpp b/utils/libcecutil/cec-log.cpp
>> index 0ce1e023..f83839b5 100644
>> --- a/utils/libcecutil/cec-log.cpp
>> +++ b/utils/libcecutil/cec-log.cpp
>> @@ -101,12 +101,12 @@ static const struct cec_arg arg_rec_src_type = {
>> };
>>
>> static void log_digital(const char *arg_name, const struct cec_op_digital_service_id *digital);
>> -static void log_rec_src(const char *arg_name, const struct cec_op_record_src *rec_src);
>> -static void log_tuner_dev_info(const char *arg_name, const struct cec_op_tuner_device_info *tuner_dev_info);
>> -static void log_features(const struct cec_arg *arg, const char *arg_name, const __u8 *p);
>> -static void log_ui_command(const char *arg_name, const struct cec_op_ui_command *ui_cmd);
>> -static void log_descriptors(const char *arg_name, unsigned num, const __u32 *descriptors);
>> -static void log_u8_array(const char *arg_name, unsigned num, const __u8 *vals);
>> +static void log_rec_src(const char *arg_string, const struct cec_op_record_src *rec_src);
>> +static void log_tuner_dev_info(const char *arg_string, const struct cec_op_tuner_device_info *tuner_dev_info);
>> +static void log_features(const struct cec_arg *arg, const char *arg_string, const __u8 *p);
>> +static void log_ui_command(const char *arg_string, const struct cec_op_ui_command *ui_cmd);
>> +static void log_descriptors(const char *arg_string, unsigned num, const __u32 *descriptors);
>> +static void log_u8_array(const char *arg_string, unsigned num, const __u8 *vals);
>> static void log_unknown_msg(const struct cec_msg *msg);
>> static void log_htng_unknown_msg(const struct cec_msg *msg);
>>
>>
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 3/7] treewide: fix wrong *cmp function usage
2020-04-20 18:46 ` [PATCH 3/7] treewide: fix wrong *cmp function usage Rosen Penev
@ 2020-04-21 7:31 ` Hans Verkuil
0 siblings, 0 replies; 12+ messages in thread
From: Hans Verkuil @ 2020-04-21 7:31 UTC (permalink / raw)
To: Rosen Penev, linux-media
On 20/04/2020 20:46, Rosen Penev wrote:
> Found with bugprone-suspicious-string-compare
>
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> ---
> 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(-)
This is standard C/C++ idiom, changing this is nonsensical.
Regards,
Hans
>
> diff --git a/lib/libdvbv5/countries.c b/lib/libdvbv5/countries.c
> index 609add0b..c5682365 100644
> --- a/lib/libdvbv5/countries.c
> +++ b/lib/libdvbv5/countries.c
> @@ -395,7 +395,7 @@ enum dvb_country_t dvb_guess_user_country(void)
> continue;
>
> if (! strncmp(buf, "POSIX", MIN(strlen(buf), 5)) ||
> - ! (strncmp(buf, "en", MIN(strlen(buf), 2)) && !isalpha(buf[2])) )
> + ! (strncmp(buf, "en", MIN(strlen(buf), 2)) != 0 && !isalpha(buf[2])) )
> continue;
>
> buf = strdup(buf);
> diff --git a/lib/libdvbv5/dvb-dev-remote.c b/lib/libdvbv5/dvb-dev-remote.c
> index ebb1bdb7..643ca559 100644
> --- a/lib/libdvbv5/dvb-dev-remote.c
> +++ b/lib/libdvbv5/dvb-dev-remote.c
> @@ -733,7 +733,7 @@ static void *receive_data(void *privdata)
>
> handled = 1;
>
> - if (strcmp(msg->cmd, cmd)) {
> + if (strcmp(msg->cmd, cmd) != 0) {
> dvb_logerr("msg #%d: Expecting '%s', got '%s'",
> seq, msg->cmd, cmd);
> free_msg(dvb, msg);
> @@ -792,7 +792,7 @@ static int dvb_remote_get_version(struct dvb_device_priv *dvb)
> goto error;
> }
>
> - if (strcmp(version, daemon_version)) {
> + if (strcmp(version, daemon_version) != 0) {
> dvb_logerr("Wrong version. Expecting '%s', received '%s'",
> daemon_version, version);
> ret = 0;
> diff --git a/lib/libdvbv5/parse_string.c b/lib/libdvbv5/parse_string.c
> index d354f497..b3518291 100644
> --- a/lib/libdvbv5/parse_string.c
> +++ b/lib/libdvbv5/parse_string.c
> @@ -348,7 +348,7 @@ static void charset_conversion(struct dvb_v5_fe_parms *parms, char **dest, const
> *p = '\0';
>
> /* If desired charset is not UTF-8, prepare for conversion */
> - if (strcasecmp(parms->output_charset, "UTF-8")) {
> + if (strcasecmp(parms->output_charset, "UTF-8") != 0) {
> tmp = (unsigned char *)*dest;
> len = p - *dest;
>
> @@ -391,7 +391,7 @@ void dvb_parse_string(struct dvb_v5_fe_parms *parms, char **dest, char **emph,
> * Strings in ISDB-S/T(JP) do not start with a charset identifier,
> * and can start with a control character (< 0x20).
> */
> - if (strcasecmp(type, "ARIB-STD-B24") && *src < 0x20) {
> + if (strcasecmp(type, "ARIB-STD-B24") != 0 && *src < 0x20) {
> switch (*src) {
> case 0x00: type = "ISO-6937"; break;
> case 0x01: type = "ISO-8859-5"; break;
> diff --git a/lib/libv4l2rds/libv4l2rds.c b/lib/libv4l2rds/libv4l2rds.c
> index 2e67d060..a053adea 100644
> --- a/lib/libv4l2rds/libv4l2rds.c
> +++ b/lib/libv4l2rds/libv4l2rds.c
> @@ -920,7 +920,7 @@ static uint32_t rds_decode_group2(struct rds_private_state *priv_state)
> if (segment == 0x0f) {
> handle->rt_length = 64;
> handle->valid_fields |= V4L2_RDS_RT;
> - if (memcmp(handle->rt, priv_state->new_rt, 64)) {
> + if (memcmp(handle->rt, priv_state->new_rt, 64) != 0) {
> memcpy(handle->rt, priv_state->new_rt, 64);
> updated_fields |= V4L2_RDS_RT;
> }
> @@ -937,7 +937,7 @@ static uint32_t rds_decode_group2(struct rds_private_state *priv_state)
> handle->rt_length = 32;
> handle->valid_fields |= V4L2_RDS_RT;
> updated_fields |= V4L2_RDS_RT;
> - if (memcmp(handle->rt, priv_state->new_rt, 32)) {
> + if (memcmp(handle->rt, priv_state->new_rt, 32) != 0) {
> memcpy(handle->rt, priv_state->new_rt, 32);
> updated_fields |= V4L2_RDS_RT;
> }
> @@ -954,7 +954,7 @@ static uint32_t rds_decode_group2(struct rds_private_state *priv_state)
> priv_state->new_rt[i] = '\0';
> handle->rt_length = i;
> handle->valid_fields |= V4L2_RDS_RT;
> - if (memcmp(handle->rt, priv_state->new_rt, handle->rt_length)) {
> + if (memcmp(handle->rt, priv_state->new_rt, handle->rt_length) != 0) {
> memcpy(handle->rt, priv_state->new_rt,
> handle->rt_length);
> updated_fields |= V4L2_RDS_RT;
> diff --git a/utils/cec-compliance/cec-test-adapter.cpp b/utils/cec-compliance/cec-test-adapter.cpp
> index 0675ccb7..27c742b3 100644
> --- a/utils/cec-compliance/cec-test-adapter.cpp
> +++ b/utils/cec-compliance/cec-test-adapter.cpp
> @@ -193,7 +193,7 @@ static int testAdapLogAddrs(struct node *node)
> fail_on_test(laddrs.log_addr_mask == 0);
> for (unsigned i = 0; i < laddrs.num_log_addrs; i++) {
> fail_on_test(laddrs.log_addr[i] == CEC_LOG_ADDR_INVALID);
> - fail_on_test(memcmp(laddrs.features[i], features, 4));
> + fail_on_test(memcmp(laddrs.features[i], features, 4) != 0);
> fail_on_test(check_0(laddrs.features[i] + 4, 8));
> }
> for (unsigned i = laddrs.num_log_addrs; i < CEC_MAX_LOG_ADDRS; i++) {
> diff --git a/utils/cec-compliance/cec-test.cpp b/utils/cec-compliance/cec-test.cpp
> index 9a08f54b..4aa54afc 100644
> --- a/utils/cec-compliance/cec-test.cpp
> +++ b/utils/cec-compliance/cec-test.cpp
> @@ -116,7 +116,7 @@ int system_info_get_menu_lang(struct node *node, unsigned me, unsigned la, bool
> if (cec_msg_status_is_abort(&msg))
> return OK_PRESUMED;
> cec_ops_set_menu_language(&msg, language);
> - fail_on_test(strcmp(node->remote[la].language, language));
> + fail_on_test(strcmp(node->remote[la].language, language) != 0);
>
> return 0;
> }
> @@ -319,7 +319,7 @@ int device_osd_transfer_give(struct node *node, unsigned me, unsigned la, bool i
> char osd_name[15];
> cec_ops_set_osd_name(&msg, osd_name);
> fail_on_test(!osd_name[0]);
> - fail_on_test(strcmp(node->remote[la].osd_name, osd_name));
> + fail_on_test(strcmp(node->remote[la].osd_name, osd_name) != 0);
> fail_on_test(msg.len != strlen(osd_name) + 2);
>
> return 0;
> @@ -937,11 +937,11 @@ static int tuner_ctl_test(struct node *node, unsigned me, unsigned la, bool inte
> fail_on_test(timed_out_or_abort(&msg));
> info = {};
> cec_ops_tuner_device_status(&msg, &info);
> - if (memcmp(&info, &(*iter), sizeof(info))) {
> + if (memcmp(&info, &(*iter), sizeof(info)) != 0) {
> log_tuner_service(info);
> log_tuner_service(*iter);
> }
> - fail_on_test(memcmp(&info, &(*iter), sizeof(info)));
> + fail_on_test(memcmp(&info, &(*iter), sizeof(info)) != 0);
> }
> printf("\t Finished Channel Test\n");
>
> diff --git a/utils/cec-ctl/cec-ctl.cpp b/utils/cec-ctl/cec-ctl.cpp
> index 3495883e..be37ae3c 100644
> --- a/utils/cec-ctl/cec-ctl.cpp
> +++ b/utils/cec-ctl/cec-ctl.cpp
> @@ -975,7 +975,7 @@ static void analyze(const char *analyze_pin)
> exit(1);
> }
> if (!fgets(s, sizeof(s), fanalyze) ||
> - strcmp(s, "# cec-ctl --store-pin\n"))
> + strcmp(s, "# cec-ctl --store-pin\n") != 0)
> goto err;
> line++;
> if (!fgets(s, sizeof(s), fanalyze) ||
> diff --git a/utils/common/media-info.cpp b/utils/common/media-info.cpp
> index a5b429a0..b0f0bc41 100644
> --- a/utils/common/media-info.cpp
> +++ b/utils/common/media-info.cpp
> @@ -187,7 +187,7 @@ std::string mi_get_devpath_from_dev_t(dev_t dev)
> if (bytes <= 0)
> break;
> line[bytes - 1] = 0;
> - if (memcmp(line, "DEVNAME=", 8) || !line[8])
> + if ((memcmp(line, "DEVNAME=", 8) != 0) || !line[8])
> continue;
> devpath = "/dev/";
> devpath += line + 8;
> @@ -229,7 +229,7 @@ int mi_get_media_fd(int fd, const char *bus_info)
>
> if (bus_info &&
> (ioctl(media_fd, MEDIA_IOC_DEVICE_INFO, &mdinfo) ||
> - strcmp(mdinfo.bus_info, bus_info))) {
> + (strcmp(mdinfo.bus_info, bus_info) != 0))) {
> close(media_fd);
> continue;
> }
> diff --git a/utils/dvb/dvbv5-daemon.c b/utils/dvb/dvbv5-daemon.c
> index ad1197b7..a17233b2 100644
> --- a/utils/dvb/dvbv5-daemon.c
> +++ b/utils/dvb/dvbv5-daemon.c
> @@ -1203,7 +1203,7 @@ static int dev_set_parms(uint32_t seq, char *cmd, int fd,
>
> if (!*new_lnb) {
> par->lnb = NULL;
> - } else if (strcmp(old_lnb, new_lnb)) {
> + } else if (strcmp(old_lnb, new_lnb) != 0) {
> int lnb = dvb_sat_search_lnb(new_lnb);
>
> if (lnb < 0) {
> diff --git a/utils/dvb/dvbv5-scan.c b/utils/dvb/dvbv5-scan.c
> index 0a522433..30f8385f 100644
> --- a/utils/dvb/dvbv5-scan.c
> +++ b/utils/dvb/dvbv5-scan.c
> @@ -288,7 +288,7 @@ static int run_scan(struct arguments *args, struct dvb_device *dvb)
> * to avoid linear search of LNB types for every entries.
> */
> if (!args->lnb_name && entry->lnb &&
> - (!parms->lnb || strcasecmp(entry->lnb, parms->lnb->alias)))
> + (!parms->lnb || strcasecmp(entry->lnb, parms->lnb->alias) != 0))
> parms->lnb = dvb_sat_get_lnb(dvb_sat_search_lnb(entry->lnb));
>
> /*
> diff --git a/utils/ir-ctl/ir-ctl.c b/utils/ir-ctl/ir-ctl.c
> index ba454619..9f8c1c5d 100644
> --- a/utils/ir-ctl/ir-ctl.c
> +++ b/utils/ir-ctl/ir-ctl.c
> @@ -739,7 +739,7 @@ static struct send* convert_keycode(struct keymap *map, const char *keycode)
> struct raw_entry *re;
>
> for (re = map->raw; re; re = re->next) {
> - if (strcmp(re->keycode, keycode))
> + if (strcmp(re->keycode, keycode) != 0)
> continue;
>
> count++;
> @@ -760,7 +760,7 @@ static struct send* convert_keycode(struct keymap *map, const char *keycode)
> const char *proto_str;
> enum rc_proto proto;
>
> - if (strcmp(se->keycode, keycode))
> + if (strcmp(se->keycode, keycode) != 0)
> continue;
>
> count++;
> diff --git a/utils/keytable/keytable.c b/utils/keytable/keytable.c
> index 4db91267..2c76f52b 100644
> --- a/utils/keytable/keytable.c
> +++ b/utils/keytable/keytable.c
> @@ -360,7 +360,7 @@ static void add_bpf_protocol(struct bpf_protocol *new)
> struct bpf_protocol *a;
>
> for (a = bpf_protocol; a; a = a->next) {
> - if (strcmp(a->name, new->name))
> + if (strcmp(a->name, new->name) != 0)
> continue;
>
> if (compare_parameters(a->param, new->param) &&
> @@ -2075,9 +2075,9 @@ int main(int argc, char *argv[])
> int matches = 0;
>
> for (cur = &cfg; cur->next; cur = cur->next) {
> - if ((!rc_dev.drv_name || strcasecmp(cur->driver, rc_dev.drv_name)) && strcasecmp(cur->driver, "*"))
> + if ((!rc_dev.drv_name || strcasecmp(cur->driver, rc_dev.drv_name) != 0) && strcasecmp(cur->driver, "*") != 0)
> continue;
> - if ((!rc_dev.keytable_name || strcasecmp(cur->table, rc_dev.keytable_name)) && strcasecmp(cur->table, "*"))
> + if ((!rc_dev.keytable_name || strcasecmp(cur->table, rc_dev.keytable_name) != 0) && strcasecmp(cur->table, "*") != 0)
> continue;
>
> if (debug)
> diff --git a/utils/libmedia_dev/get_media_devices.c b/utils/libmedia_dev/get_media_devices.c
> index 491a94da..462b8b97 100644
> --- a/utils/libmedia_dev/get_media_devices.c
> +++ b/utils/libmedia_dev/get_media_devices.c
> @@ -431,7 +431,7 @@ void display_media_devices(void *opaque)
> char *prev = "";
>
> for (i = 0; i < md->md_size; i++) {
> - if (strcmp(prev, md_ptr->device)) {
> + if (strcmp(prev, md_ptr->device) != 0) {
> printf("\nDevice %s:\n\t", md_ptr->device);
> prev = md_ptr->device;
> }
> @@ -584,7 +584,7 @@ const char *get_not_associated_device(void *opaque,
> }
> if (last_seek && !found)
> continue;
> - if (strcmp(prev, md_ptr->device)) {
> + if (strcmp(prev, md_ptr->device) != 0) {
> if (!skip && result)
> break;
> prev = md_ptr->device;
> diff --git a/utils/media-ctl/libmediactl.c b/utils/media-ctl/libmediactl.c
> index 1fd6525b..6ef9a3f5 100644
> --- a/utils/media-ctl/libmediactl.c
> +++ b/utils/media-ctl/libmediactl.c
> @@ -475,7 +475,7 @@ static int media_get_devname_sysfs(struct media_entity *entity)
> if (strstr(p + 1, "dvb")) {
> char *s = p + 1;
>
> - if (strncmp(s, "dvb", 3))
> + if (strncmp(s, "dvb", 3) != 0)
> return -EINVAL;
> s += 3;
> p = strchr(s, '.');
> diff --git a/utils/media-ctl/libv4l2subdev.c b/utils/media-ctl/libv4l2subdev.c
> index 0d0afbe7..3b4490aa 100644
> --- a/utils/media-ctl/libv4l2subdev.c
> +++ b/utils/media-ctl/libv4l2subdev.c
> @@ -433,7 +433,7 @@ static bool strhazit(const char *str, const char **p)
> {
> int len = strlen(str);
>
> - if (strncmp(str, *p, len))
> + if (strncmp(str, *p, len) != 0)
> return false;
>
> for (*p += len; isspace(**p); ++*p);
> diff --git a/utils/v4l2-compliance/v4l2-compliance.cpp b/utils/v4l2-compliance/v4l2-compliance.cpp
> index 938c7c35..0c3af294 100644
> --- a/utils/v4l2-compliance/v4l2-compliance.cpp
> +++ b/utils/v4l2-compliance/v4l2-compliance.cpp
> @@ -620,14 +620,14 @@ static int testCap(struct node *node)
> fail_on_test(check_ustring(vcap.card, sizeof(vcap.card)));
> fail_on_test(check_ustring(vcap.bus_info, sizeof(vcap.bus_info)));
> // Check for valid prefixes
> - if (memcmp(vcap.bus_info, "usb-", 4) &&
> - memcmp(vcap.bus_info, "PCI:", 4) &&
> - memcmp(vcap.bus_info, "PCIe:", 5) &&
> - memcmp(vcap.bus_info, "ISA:", 4) &&
> - memcmp(vcap.bus_info, "I2C:", 4) &&
> - memcmp(vcap.bus_info, "parport", 7) &&
> - memcmp(vcap.bus_info, "platform:", 9) &&
> - memcmp(vcap.bus_info, "rmi4:", 5))
> + if (memcmp(vcap.bus_info, "usb-", 4) != 0 &&
> + memcmp(vcap.bus_info, "PCI:", 4) != 0 &&
> + memcmp(vcap.bus_info, "PCIe:", 5) != 0 &&
> + memcmp(vcap.bus_info, "ISA:", 4) != 0 &&
> + memcmp(vcap.bus_info, "I2C:", 4) != 0 &&
> + memcmp(vcap.bus_info, "parport", 7) != 0 &&
> + memcmp(vcap.bus_info, "platform:", 9) != 0 &&
> + memcmp(vcap.bus_info, "rmi4:", 5) != 0)
> return fail("missing bus_info prefix ('%s')\n", vcap.bus_info);
> if (!node->media_bus_info.empty() &&
> node->media_bus_info != std::string(reinterpret_cast<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;
>
> diff --git a/utils/v4l2-compliance/v4l2-test-buffers.cpp b/utils/v4l2-compliance/v4l2-test-buffers.cpp
> index 3b45711d..004de314 100644
> --- a/utils/v4l2-compliance/v4l2-test-buffers.cpp
> +++ b/utils/v4l2-compliance/v4l2-test-buffers.cpp
> @@ -1011,7 +1011,7 @@ static int captureBufs(struct node *node, struct node *node_m2m_cap, const cv4l_
> (orig_buf.flags & valid_output_flags));
> if (buf.g_flags() & V4L2_BUF_FLAG_TIMECODE)
> fail_on_test(memcmp(&buf.g_timecode(), &orig_buf.timecode,
> - sizeof(orig_buf.timecode)));
> + sizeof(orig_buf.timecode)) != 0);
> }
> fail_on_test(buf.g_flags() & V4L2_BUF_FLAG_DONE);
>
> @@ -1085,7 +1085,7 @@ static int captureBufs(struct node *node, struct node *node_m2m_cap, const cv4l_
> (orig_buf.flags & valid_output_flags));
> if (buf.g_flags() & V4L2_BUF_FLAG_TIMECODE)
> fail_on_test(memcmp(&buf.g_timecode(), &orig_buf.timecode,
> - sizeof(orig_buf.timecode)));
> + sizeof(orig_buf.timecode)) != 0);
> }
> fail_on_test(buf.g_flags() & V4L2_BUF_FLAG_DONE);
> if (!count || stopped) {
> diff --git a/utils/v4l2-compliance/v4l2-test-media.cpp b/utils/v4l2-compliance/v4l2-test-media.cpp
> index bcd8a725..bcba3b15 100644
> --- a/utils/v4l2-compliance/v4l2-test-media.cpp
> +++ b/utils/v4l2-compliance/v4l2-test-media.cpp
> @@ -53,14 +53,14 @@ int testMediaDeviceInfo(struct node *node)
> } else {
> fail_on_test(check_string(mdinfo.bus_info, sizeof(mdinfo.bus_info)));
> // Check for valid prefixes
> - if (memcmp(mdinfo.bus_info, "usb-", 4) &&
> - memcmp(mdinfo.bus_info, "PCI:", 4) &&
> - memcmp(mdinfo.bus_info, "PCIe:", 5) &&
> - memcmp(mdinfo.bus_info, "ISA:", 4) &&
> - memcmp(mdinfo.bus_info, "I2C:", 4) &&
> - memcmp(mdinfo.bus_info, "parport", 7) &&
> - memcmp(mdinfo.bus_info, "platform:", 9) &&
> - memcmp(mdinfo.bus_info, "rmi4:", 5))
> + if (memcmp(mdinfo.bus_info, "usb-", 4) != 0 &&
> + memcmp(mdinfo.bus_info, "PCI:", 4) != 0 &&
> + memcmp(mdinfo.bus_info, "PCIe:", 5) != 0 &&
> + memcmp(mdinfo.bus_info, "ISA:", 4) != 0 &&
> + memcmp(mdinfo.bus_info, "I2C:", 4) != 0 &&
> + memcmp(mdinfo.bus_info, "parport", 7) != 0 &&
> + memcmp(mdinfo.bus_info, "platform:", 9) != 0 &&
> + memcmp(mdinfo.bus_info, "rmi4:", 5) != 0)
> return fail("missing bus_info prefix ('%s')\n", mdinfo.bus_info);
> }
> fail_on_test(mdinfo.media_version == 0);
> diff --git a/utils/v4l2-compliance/v4l2-test-subdevs.cpp b/utils/v4l2-compliance/v4l2-test-subdevs.cpp
> index 489639fb..998f63be 100644
> --- a/utils/v4l2-compliance/v4l2-test-subdevs.cpp
> +++ b/utils/v4l2-compliance/v4l2-test-subdevs.cpp
> @@ -433,7 +433,7 @@ int testSubDevSelection(struct node *node, unsigned which, unsigned pad)
> fail_on_test(check_0(crop.reserved, sizeof(crop.reserved)));
> fail_on_test(crop.which != which);
> fail_on_test(crop.pad != pad);
> - fail_on_test(memcmp(&crop.rect, &sel.r, sizeof(sel.r)));
> + fail_on_test(memcmp(&crop.rect, &sel.r, sizeof(sel.r)) != 0);
>
> for (unsigned tgt = 0; targets[tgt].target != ~0U; tgt++) {
> targets[tgt].found = false;
> @@ -476,7 +476,7 @@ int testSubDevSelection(struct node *node, unsigned which, unsigned pad)
> fail_on_test(check_0(crop.reserved, sizeof(crop.reserved)));
> fail_on_test(crop.which != which);
> fail_on_test(crop.pad != pad);
> - fail_on_test(memcmp(&crop.rect, &sel.r, sizeof(sel.r)));
> + fail_on_test(memcmp(&crop.rect, &sel.r, sizeof(sel.r)) != 0);
> }
> }
> fail_on_test(!ret && targets[tgt].readonly);
> diff --git a/utils/v4l2-ctl/v4l2-ctl-common.cpp b/utils/v4l2-ctl/v4l2-ctl-common.cpp
> index f2997951..5dde39b9 100644
> --- a/utils/v4l2-ctl/v4l2-ctl-common.cpp
> +++ b/utils/v4l2-ctl/v4l2-ctl-common.cpp
> @@ -190,7 +190,7 @@ static void list_media_devices(const std::string &media_bus_info)
> std::string s("/dev/");
>
> s += ep->d_name;
> - if (memcmp(ep->d_name, "media", 5)) {
> + if (memcmp(ep->d_name, "media", 5) != 0) {
> if (!is_v4l_dev(ep->d_name))
> continue;
> struct stat st;
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 5/7] media-info: fix NULL check
2020-04-20 18:46 ` [PATCH 5/7] media-info: fix NULL check Rosen Penev
@ 2020-04-21 8:41 ` Hans Verkuil
0 siblings, 0 replies; 12+ messages in thread
From: Hans Verkuil @ 2020-04-21 8:41 UTC (permalink / raw)
To: Rosen Penev, linux-media
On 20/04/2020 20:46, Rosen Penev wrote:
> Found with clang-tidy's bugprone-bool-pointer-implicit-conversion
>
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> ---
> utils/common/media-info.cpp | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/utils/common/media-info.cpp b/utils/common/media-info.cpp
> index b0f0bc41..cb48d0df 100644
> --- a/utils/common/media-info.cpp
> +++ b/utils/common/media-info.cpp
> @@ -357,7 +357,7 @@ std::string mi_entfunction2s(__u32 function, bool *is_invalid)
> return fail ? entity_functions_def[i].str + 6 : entity_functions_def[i].str;
> }
> }
> - if (is_invalid)
> + if (is_invalid != NULL)
> return "WARNING: Unknown Function (" + num2s(function) + "), is v4l2-compliance out-of-date?";
> return "Unknown Function (" + num2s(function) + ")";
> }
>
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
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 6/7] utils: use bool literals
2020-04-20 18:46 ` [PATCH 6/7] utils: use bool literals Rosen Penev
@ 2020-04-21 8:44 ` Hans Verkuil
0 siblings, 0 replies; 12+ messages in thread
From: Hans Verkuil @ 2020-04-21 8:44 UTC (permalink / raw)
To: Rosen Penev, linux-media
On 20/04/2020 20:46, Rosen Penev wrote:
> Found with clang-tidy's modernize-use-bool-literals
>
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> ---
> utils/cec-compliance/cec-compliance.cpp | 2 +-
> utils/cec-compliance/cec-test.cpp | 2 +-
> utils/cec-ctl/cec-ctl.cpp | 2 +-
> utils/cec-follower/cec-follower.cpp | 2 +-
> utils/cec-follower/cec-processing.cpp | 2 +-
> utils/rds-ctl/rds-ctl.cpp | 2 +-
> utils/v4l2-compliance/v4l2-compliance.cpp | 4 ++--
> utils/v4l2-ctl/v4l2-ctl-streaming.cpp | 2 +-
> utils/v4l2-ctl/v4l2-ctl.cpp | 6 +++---
> utils/v4l2-dbg/v4l2-dbg.cpp | 2 +-
> 10 files changed, 13 insertions(+), 13 deletions(-)
>
> diff --git a/utils/cec-compliance/cec-compliance.cpp b/utils/cec-compliance/cec-compliance.cpp
> index b665303e..6d07bfc9 100644
> --- a/utils/cec-compliance/cec-compliance.cpp
> +++ b/utils/cec-compliance/cec-compliance.cpp
> @@ -1166,7 +1166,7 @@ int main(int argc, char **argv)
> short_options[idx++] = ':';
> }
> }
> - while (1) {
> + while (true) {
> int option_index = 0;
>
> short_options[idx] = 0;
> diff --git a/utils/cec-compliance/cec-test.cpp b/utils/cec-compliance/cec-test.cpp
> index 4aa54afc..a82069ad 100644
> --- a/utils/cec-compliance/cec-test.cpp
> +++ b/utils/cec-compliance/cec-test.cpp
> @@ -889,7 +889,7 @@ static int tuner_ctl_test(struct node *node, unsigned me, unsigned la, bool inte
> if (ret)
> return ret;
>
> - while (1) {
> + while (true) {
> cec_msg_init(&msg, me, la);
> cec_msg_tuner_step_increment(&msg);
> fail_on_test(!transmit(node, &msg));
> diff --git a/utils/cec-ctl/cec-ctl.cpp b/utils/cec-ctl/cec-ctl.cpp
> index be37ae3c..46cfcd80 100644
> --- a/utils/cec-ctl/cec-ctl.cpp
> +++ b/utils/cec-ctl/cec-ctl.cpp
> @@ -1863,7 +1863,7 @@ int main(int argc, char **argv)
> if (long_options[i].has_arg == required_argument)
> short_options[idx++] = ':';
> }
> - while (1) {
> + while (true) {
> int option_index = 0;
> struct cec_msg msg;
>
> diff --git a/utils/cec-follower/cec-follower.cpp b/utils/cec-follower/cec-follower.cpp
> index 12bb5f15..ab3113b6 100644
> --- a/utils/cec-follower/cec-follower.cpp
> +++ b/utils/cec-follower/cec-follower.cpp
> @@ -331,7 +331,7 @@ int main(int argc, char **argv)
> short_options[idx++] = ':';
> }
> }
> - while (1) {
> + while (true) {
> int option_index = 0;
>
> short_options[idx] = 0;
> diff --git a/utils/cec-follower/cec-processing.cpp b/utils/cec-follower/cec-processing.cpp
> index 34b54fa3..8e3a33a2 100644
> --- a/utils/cec-follower/cec-processing.cpp
> +++ b/utils/cec-follower/cec-processing.cpp
> @@ -885,7 +885,7 @@ void testProcessing(struct node *node, bool wallclock)
>
> poll_remote_devs(node, me);
>
> - while (1) {
> + while (true) {
> int res;
> struct timeval timeval = {};
>
> diff --git a/utils/rds-ctl/rds-ctl.cpp b/utils/rds-ctl/rds-ctl.cpp
> index 2d561481..fef2a3f1 100644
> --- a/utils/rds-ctl/rds-ctl.cpp
> +++ b/utils/rds-ctl/rds-ctl.cpp
> @@ -757,7 +757,7 @@ static int parse_cl(int argc, char **argv)
> if (long_options[i].has_arg == required_argument)
> short_options[idx++] = ':';
> }
> - while (1) {
> + while (true) {
> int option_index = 0;
>
> short_options[idx] = 0;
> diff --git a/utils/v4l2-compliance/v4l2-compliance.cpp b/utils/v4l2-compliance/v4l2-compliance.cpp
> index bb32bae6..39dd1aec 100644
> --- a/utils/v4l2-compliance/v4l2-compliance.cpp
> +++ b/utils/v4l2-compliance/v4l2-compliance.cpp
> @@ -834,7 +834,7 @@ static int open_media_bus_info(const std::string &bus_info, std::string &media_d
> while ((ep = readdir(dp))) {
> const char *name = ep->d_name;
>
> - if ((!memcmp(name, "media", 5) != 0) && isdigit(name[5])) {
> + if ((!(memcmp(name, "media", 5) != 0)) && isdigit(name[5])) {
Huh? Seems a stray change.
I'm skipping this change, but I'll apply the remainder of this patch.
Regards,
Hans
> struct media_device_info mdi;
> media_devname = std::string("/dev/") + name;
>
> @@ -1519,7 +1519,7 @@ int main(int argc, char **argv)
> short_options[idx++] = ':';
> }
> }
> - while (1) {
> + while (true) {
> int option_index = 0;
>
> short_options[idx] = 0;
> diff --git a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
> index de40c5ad..833263b6 100644
> --- a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
> +++ b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
> @@ -2742,7 +2742,7 @@ static void streaming_set_cap2out(cv4l_fd &fd, cv4l_fd &out_fd)
> if (use_poll)
> fcntl(fd.g_fd(), F_SETFL, fd_flags | O_NONBLOCK);
>
> - while (1) {
> + while (true) {
> struct timeval tv = { use_poll ? 2 : 0, 0 };
> int r = 0;
>
> diff --git a/utils/v4l2-ctl/v4l2-ctl.cpp b/utils/v4l2-ctl/v4l2-ctl.cpp
> index 42889ef8..c0097203 100644
> --- a/utils/v4l2-ctl/v4l2-ctl.cpp
> +++ b/utils/v4l2-ctl/v4l2-ctl.cpp
> @@ -1145,7 +1145,7 @@ int main(int argc, char **argv)
> short_options[idx++] = ':';
> }
> }
> - while (1) {
> + while (true) {
> int option_index = 0;
>
> short_options[idx] = 0;
> @@ -1531,7 +1531,7 @@ int main(int argc, char **argv)
> __u32 seq = 0;
>
> fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_NONBLOCK);
> - while (1) {
> + while (true) {
> int res;
>
> FD_ZERO(&fds);
> @@ -1572,7 +1572,7 @@ int main(int argc, char **argv)
>
> fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_NONBLOCK);
> epoll_ctl(epollfd, EPOLL_CTL_ADD, fd, &epoll_ev);
> - while (1) {
> + while (true) {
> int res;
>
> res = epoll_wait(epollfd, &epoll_ev, 1, -1);
> diff --git a/utils/v4l2-dbg/v4l2-dbg.cpp b/utils/v4l2-dbg/v4l2-dbg.cpp
> index 17ab0210..dcf8200a 100644
> --- a/utils/v4l2-dbg/v4l2-dbg.cpp
> +++ b/utils/v4l2-dbg/v4l2-dbg.cpp
> @@ -442,7 +442,7 @@ int main(int argc, char **argv)
> short_options[idx++] = ':';
> }
> }
> - while (1) {
> + while (true) {
> int option_index = 0;
>
> short_options[idx] = 0;
>
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2020-04-21 8:44 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-20 18:46 [PATCH 1/7] treewide: fix mismatching declarations Rosen Penev
2020-04-20 18:46 ` [PATCH 2/7] treewide: replace C casts with C++ Rosen Penev
2020-04-20 18:46 ` [PATCH 3/7] treewide: fix wrong *cmp function usage Rosen Penev
2020-04-21 7:31 ` Hans Verkuil
2020-04-20 18:46 ` [PATCH 4/7] treewide: apply performance fixes Rosen Penev
2020-04-20 18:46 ` [PATCH 5/7] media-info: fix NULL check Rosen Penev
2020-04-21 8:41 ` Hans Verkuil
2020-04-20 18:46 ` [PATCH 6/7] utils: use bool literals Rosen Penev
2020-04-21 8:44 ` Hans Verkuil
2020-04-20 18:46 ` [PATCH 7/7] utils: do not use empty void with C++ Rosen Penev
2020-04-21 7:23 ` [PATCH 1/7] treewide: fix mismatching declarations Hans Verkuil
2020-04-21 7:26 ` Hans Verkuil
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.