diff --git a/.clang-tidy b/.clang-tidy index 4a4459c57..fe29ae249 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,4 +1,4 @@ -Checks: '*,-clang-analyzer-optin.core.EnumCastOutOfRange,-readability-avoid-nested-conditional-operator,-bugprone-switch-missing-default-case,-misc-include-cleaner,-altera-*,-clang-analyzer-optin.performance.Padding,-bugprone-easily-swappable-parameters,-bugprone-assignment-in-if-condition,-clang-diagnostic-invalid-command-line-argument,-concurrency-mt-unsafe,-cppcoreguidelines*,-hicpp-*,-llvmlibc-restrict-system-libc-headers,-readability-identifier-length,-readability-function-cognitive-complexity,-google-readability-function-size,-readability-function-size,-readability-magic-numbers,-readability-non-const-parameter,-google-readability-todo' +Checks: '*,-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,-clang-analyzer-optin.core.EnumCastOutOfRange,-readability-avoid-nested-conditional-operator,-bugprone-switch-missing-default-case,-misc-include-cleaner,-altera-*,-clang-analyzer-optin.performance.Padding,-bugprone-easily-swappable-parameters,-bugprone-assignment-in-if-condition,-clang-diagnostic-invalid-command-line-argument,-concurrency-mt-unsafe,-cppcoreguidelines*,-hicpp-*,-llvmlibc-restrict-system-libc-headers,-readability-identifier-length,-readability-function-cognitive-complexity,-google-readability-function-size,-readability-function-size,-readability-magic-numbers,-readability-non-const-parameter,-google-readability-todo' WarningsAsErrors: '' HeaderFilterRegex: '' FormatStyle: none diff --git a/src/lib/cache_rax_album.c b/src/lib/cache_rax_album.c index 5ffa591b7..5152bae33 100644 --- a/src/lib/cache_rax_album.c +++ b/src/lib/cache_rax_album.c @@ -576,7 +576,7 @@ void album_cache_set_uri(struct mpd_song *album, const char *uri) { free(album->uri); size_t len = strlen(uri); album->uri = malloc_assert(len + 1); - snprintf(album->uri, len, "%s", uri); + (void)snprintf(album->uri, len, "%s", uri); } /** diff --git a/src/lib/datetime.c b/src/lib/datetime.c index f8c8a6084..5d9c95c8f 100644 --- a/src/lib/datetime.c +++ b/src/lib/datetime.c @@ -39,7 +39,8 @@ time_t parse_date(const char *str) { */ void readable_time(char *buf, time_t timestamp) { if (timestamp == 0) { - snprintf(buf, 2, "0"); + buf[0] = '0'; + buf[1] = '\0'; } else { struct tm *tmp = localtime(×tamp); diff --git a/src/lib/handle_options.c b/src/lib/handle_options.c index 68bbc7a40..514ed27a4 100644 --- a/src/lib/handle_options.c +++ b/src/lib/handle_options.c @@ -38,7 +38,7 @@ static struct option long_options[] = { * @param cmd argv[0] from main function */ static void print_usage(struct t_config *config, const char *cmd) { - fprintf(stderr, "\nUsage: %s [OPTION]...\n\n" + (void)fprintf(stderr, "\nUsage: %s [OPTION]...\n\n" "myMPD %s\n" "(c) 2018-2024 Juergen Mang \n" "https://github.com/jcorporation/myMPD\n\n" diff --git a/src/lib/msg_queue.c b/src/lib/msg_queue.c index f9a5e84c4..68fc04988 100644 --- a/src/lib/msg_queue.c +++ b/src/lib/msg_queue.c @@ -353,7 +353,7 @@ static void set_wait_time(int timeout_ms, struct timespec *max_wait) { MYMPD_LOG_ERRNO(NULL, errno); assert(NULL); } - int64_t timeout_ns = (int64_t)max_wait->tv_nsec + (int64_t)timeout_ms * MSEC_NSEC; + int64_t timeout_ns = (int64_t)max_wait->tv_nsec + ((int64_t)timeout_ms * MSEC_NSEC); if (timeout_ns > NSEC_MAX) { max_wait->tv_sec += (time_t)(timeout_ns / SEC_NSEC); max_wait->tv_nsec = (long)(timeout_ns % SEC_NSEC); diff --git a/src/lib/utility.h b/src/lib/utility.h index 7316c6047..2e7c0e67f 100644 --- a/src/lib/utility.h +++ b/src/lib/utility.h @@ -41,12 +41,12 @@ bool get_ipv6_support(void); /** * Start measurement */ -#define MEASURE_START clock_gettime(CLOCK_MONOTONIC, &tic); +#define MEASURE_START (void)clock_gettime(CLOCK_MONOTONIC, &tic); /** * Stop measurement */ -#define MEASURE_END clock_gettime(CLOCK_MONOTONIC, &toc); +#define MEASURE_END (void)clock_gettime(CLOCK_MONOTONIC, &toc); /** * Print measurement result diff --git a/src/mympd_api/status.c b/src/mympd_api/status.c index 040c5a8ad..643f34d7b 100644 --- a/src/mympd_api/status.c +++ b/src/mympd_api/status.c @@ -186,7 +186,7 @@ sds mympd_api_status_get(struct t_partition_state *partition_state, struct t_cac //scrobble time is half length of song or SCROBBLE_TIME_MAX (4 minutes) whatever is shorter time_t scrobble_offset = partition_state->song_duration > SCROBBLE_TIME_TOTAL ? SCROBBLE_TIME_MAX - elapsed_time - : partition_state->song_duration / 2 - elapsed_time; + : (partition_state->song_duration / 2) - elapsed_time; if (scrobble_offset > 0) { MYMPD_LOG_DEBUG(partition_state->name, "Setting scrobble timer"); mympd_timer_set(partition_state->timer_fd_scrobble, (int)scrobble_offset, 0); diff --git a/src/mympd_api/timer.c b/src/mympd_api/timer.c index 49d3e2795..9b1f49197 100644 --- a/src/mympd_api/timer.c +++ b/src/mympd_api/timer.c @@ -356,7 +356,7 @@ struct t_timer_definition *mympd_api_timer_parse(sds str, const char *partition, int mympd_api_timer_calc_starttime(int start_hour, int start_minute, int interval) { time_t now = time(NULL); struct tm tms; - localtime_r(&now, &tms); + (void)localtime_r(&now, &tms); tms.tm_hour = start_hour; tms.tm_min = start_minute; tms.tm_sec = 0;