mirror of
https://github.com/pikvm/ustreamer.git
synced 2025-12-23 18:50:00 +00:00
lint fix
This commit is contained in:
parent
f2779f7b44
commit
000be92a0b
@ -13,6 +13,7 @@ commands = cppcheck \
|
||||
--std=c17 \
|
||||
--error-exitcode=1 \
|
||||
--quiet \
|
||||
--check-level=exhaustive \
|
||||
--enable=warning,portability,performance,style \
|
||||
--suppress=assignmentInAssert \
|
||||
--suppress=variableScope \
|
||||
|
||||
@ -111,9 +111,9 @@ int main(int argc, char *argv[]) {
|
||||
US_LOGGING_INIT;
|
||||
US_THREAD_RENAME("main");
|
||||
|
||||
char *sink_name = NULL;
|
||||
const char *sink_name = NULL;
|
||||
unsigned sink_timeout = 1;
|
||||
char *output_path = NULL;
|
||||
const char *output_path = NULL;
|
||||
bool output_json = false;
|
||||
long long count = 0;
|
||||
long double interval = 0;
|
||||
|
||||
@ -83,9 +83,9 @@ static const struct {
|
||||
};
|
||||
|
||||
static int _capture_wait_buffer(us_capture_s *cap);
|
||||
static int _capture_consume_event(us_capture_s *cap);
|
||||
static int _capture_consume_event(const us_capture_s *cap);
|
||||
static void _v4l2_buffer_copy(const struct v4l2_buffer *src, struct v4l2_buffer *dest);
|
||||
static bool _capture_is_buffer_valid(us_capture_s *cap, const struct v4l2_buffer *buf, const u8 *data);
|
||||
static bool _capture_is_buffer_valid(const us_capture_s *cap, const struct v4l2_buffer *buf, const u8 *data);
|
||||
static int _capture_open_check_cap(us_capture_s *cap);
|
||||
static int _capture_open_dv_timings(us_capture_s *cap, bool apply);
|
||||
static int _capture_open_format(us_capture_s *cap, bool first);
|
||||
@ -98,12 +98,12 @@ static int _capture_open_queue_buffers(us_capture_s *cap);
|
||||
static int _capture_open_export_to_dma(us_capture_s *cap);
|
||||
static int _capture_apply_resolution(us_capture_s *cap, uint width, uint height, float hz);
|
||||
|
||||
static void _capture_apply_controls(us_capture_s *cap);
|
||||
static void _capture_apply_controls(const us_capture_s *cap);
|
||||
static int _capture_query_control(
|
||||
us_capture_s *cap, struct v4l2_queryctrl *query,
|
||||
const us_capture_s *cap, struct v4l2_queryctrl *query,
|
||||
const char *name, uint cid, bool quiet);
|
||||
static void _capture_set_control(
|
||||
us_capture_s *cap, const struct v4l2_queryctrl *query,
|
||||
const us_capture_s *cap, const struct v4l2_queryctrl *query,
|
||||
const char *name, uint cid, int value, bool quiet);
|
||||
|
||||
static const char *_format_to_string_nullable(uint format);
|
||||
@ -421,7 +421,7 @@ int us_capture_hwbuf_grab(us_capture_s *cap, us_capture_hwbuf_s **hw) {
|
||||
return buf.index;
|
||||
}
|
||||
|
||||
int us_capture_hwbuf_release(us_capture_s *cap, us_capture_hwbuf_s *hw) {
|
||||
int us_capture_hwbuf_release(const us_capture_s *cap, us_capture_hwbuf_s *hw) {
|
||||
assert(atomic_load(&hw->refs) == 0);
|
||||
const uint index = hw->buf.index;
|
||||
_LOG_DEBUG("Releasing HW buffer=%u ...", index);
|
||||
@ -486,7 +486,7 @@ int _capture_wait_buffer(us_capture_s *cap) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int _capture_consume_event(us_capture_s *cap) {
|
||||
static int _capture_consume_event(const us_capture_s *cap) {
|
||||
struct v4l2_event event;
|
||||
if (us_xioctl(cap->run->fd, VIDIOC_DQEVENT, &event) < 0) {
|
||||
_LOG_PERROR("Can't consume V4L2 event");
|
||||
@ -513,7 +513,7 @@ static void _v4l2_buffer_copy(const struct v4l2_buffer *src, struct v4l2_buffer
|
||||
}
|
||||
}
|
||||
|
||||
bool _capture_is_buffer_valid(us_capture_s *cap, const struct v4l2_buffer *buf, const u8 *data) {
|
||||
bool _capture_is_buffer_valid(const us_capture_s *cap, const struct v4l2_buffer *buf, const u8 *data) {
|
||||
// Workaround for broken, corrupted frames:
|
||||
// Under low light conditions corrupted frames may get captured.
|
||||
// The good thing is such frames are quite small compared to the regular frames.
|
||||
@ -737,7 +737,7 @@ static int _capture_open_format(us_capture_s *cap, bool first) {
|
||||
_format_to_string_supported(cap->format),
|
||||
_format_to_string_supported(FMT(pixelformat)));
|
||||
|
||||
char *format_str;
|
||||
const char *format_str;
|
||||
if ((format_str = (char*)_format_to_string_nullable(FMT(pixelformat))) != NULL) {
|
||||
_LOG_INFO("Falling back to format=%s", format_str);
|
||||
} else {
|
||||
@ -1037,7 +1037,7 @@ static int _capture_apply_resolution(us_capture_s *cap, uint width, uint height,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void _capture_apply_controls(us_capture_s *cap) {
|
||||
static void _capture_apply_controls(const us_capture_s *cap) {
|
||||
# define SET_CID_VALUE(x_cid, x_field, x_value, x_quiet) { \
|
||||
struct v4l2_queryctrl m_query; \
|
||||
if (_capture_query_control(cap, &m_query, #x_field, x_cid, x_quiet) == 0) { \
|
||||
@ -1094,7 +1094,7 @@ static void _capture_apply_controls(us_capture_s *cap) {
|
||||
}
|
||||
|
||||
static int _capture_query_control(
|
||||
us_capture_s *cap, struct v4l2_queryctrl *query,
|
||||
const us_capture_s *cap, struct v4l2_queryctrl *query,
|
||||
const char *name, uint cid, bool quiet) {
|
||||
|
||||
// cppcheck-suppress redundantPointerOp
|
||||
@ -1111,7 +1111,7 @@ static int _capture_query_control(
|
||||
}
|
||||
|
||||
static void _capture_set_control(
|
||||
us_capture_s *cap, const struct v4l2_queryctrl *query,
|
||||
const us_capture_s *cap, const struct v4l2_queryctrl *query,
|
||||
const char *name, uint cid, int value, bool quiet) {
|
||||
|
||||
if (value < query->minimum || value > query->maximum || value % query->step != 0) {
|
||||
|
||||
@ -133,7 +133,7 @@ int us_capture_open(us_capture_s *cap);
|
||||
void us_capture_close(us_capture_s *cap);
|
||||
|
||||
int us_capture_hwbuf_grab(us_capture_s *cap, us_capture_hwbuf_s **hw);
|
||||
int us_capture_hwbuf_release(us_capture_s *cap, us_capture_hwbuf_s *hw);
|
||||
int us_capture_hwbuf_release(const us_capture_s *cap, us_capture_hwbuf_s *hw);
|
||||
|
||||
void us_capture_hwbuf_incref(us_capture_hwbuf_s *hw);
|
||||
void us_capture_hwbuf_decref(us_capture_hwbuf_s *hw);
|
||||
|
||||
@ -614,7 +614,7 @@ static int _drm_find_sink(us_drm_s *drm, uint width, uint height, float hz) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
drmModeModeInfo *best;
|
||||
const drmModeModeInfo *best;
|
||||
if ((best = _find_best_mode(conn, width, height, hz)) == NULL) {
|
||||
_LOG_ERROR("Can't find any appropriate display modes");
|
||||
drmModeFreeConnector(conn);
|
||||
|
||||
@ -40,7 +40,7 @@ char *us_simplify_request_path(const char *str) {
|
||||
char pre1; // The one before
|
||||
char pre2; // The one before that
|
||||
char *simplified;
|
||||
char *start;
|
||||
const char *start;
|
||||
char *out;
|
||||
char *slash;
|
||||
|
||||
|
||||
@ -353,7 +353,7 @@ int options_parse(us_options_s *options, us_capture_s *cap, us_encoder_s *enc, u
|
||||
}
|
||||
|
||||
# define ADD_SINK(x_prefix) \
|
||||
char *x_prefix##_name = NULL; \
|
||||
const char *x_prefix##_name = NULL; \
|
||||
mode_t x_prefix##_mode = 0660; \
|
||||
bool x_prefix##_rm = false; \
|
||||
unsigned x_prefix##_client_ttl = 10; \
|
||||
@ -364,7 +364,7 @@ int options_parse(us_options_s *options, us_capture_s *cap, us_encoder_s *enc, u
|
||||
# undef ADD_SINK
|
||||
|
||||
# ifdef WITH_SETPROCTITLE
|
||||
char *process_name_prefix = NULL;
|
||||
const char *process_name_prefix = NULL;
|
||||
# endif
|
||||
|
||||
char short_opts[128];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user