From aa954d9be9d470de8eae9620453bc39f77ad8fa5 Mon Sep 17 00:00:00 2001 From: akallabeth Date: Tue, 29 Oct 2024 12:32:14 +0100 Subject: [PATCH] [warnings] fix various compiler warnings --- client/SDL/SDL3/sdl_freerdp.cpp | 4 ++-- client/X11/CMakeLists.txt | 2 -- client/common/cmdline.c | 2 +- client/common/file.c | 3 ++- libfreerdp/core/gateway/http.c | 4 ++-- uwac/libuwac/uwac-input.c | 6 +++--- winpr/libwinpr/crypto/cipher.c | 2 ++ winpr/libwinpr/smartcard/smartcard.c | 2 +- winpr/libwinpr/thread/thread.c | 2 +- winpr/libwinpr/timezone/TimeZoneIanaAbbrevMap.c | 2 +- winpr/libwinpr/timezone/timezone.c | 6 +++--- winpr/libwinpr/utils/wlog/JournaldAppender.c | 8 ++++++-- 12 files changed, 24 insertions(+), 19 deletions(-) diff --git a/client/SDL/SDL3/sdl_freerdp.cpp b/client/SDL/SDL3/sdl_freerdp.cpp index aec44811a..2cf91d4bd 100644 --- a/client/SDL/SDL3/sdl_freerdp.cpp +++ b/client/SDL/SDL3/sdl_freerdp.cpp @@ -1730,8 +1730,8 @@ BOOL SdlContext::update_resizeable(BOOL enable) } SdlContext::SdlContext(rdpContext* context) - : _context(context), log(WLog_Get(SDL_TAG)), update_complete(true), disp(this), clip(this), - input(this), primary(nullptr, SDL_DestroySurface), rdp_thread_running(false) + : _context(context), log(WLog_Get(SDL_TAG)), update_complete(true), disp(this), input(this), + clip(this), primary(nullptr, SDL_DestroySurface), rdp_thread_running(false) { WINPR_ASSERT(context); grab_kbd_enabled = freerdp_settings_get_bool(context->settings, FreeRDP_GrabKeyboard); diff --git a/client/X11/CMakeLists.txt b/client/X11/CMakeLists.txt index afcd02e2f..da29cc952 100644 --- a/client/X11/CMakeLists.txt +++ b/client/X11/CMakeLists.txt @@ -202,8 +202,6 @@ if (WITH_XFIXES) endif() endif() -include_directories(${PROJECT_SOURCE_DIR}/resources) - list(APPEND PUB_LIBS freerdp-client ) diff --git a/client/common/cmdline.c b/client/common/cmdline.c index 31dbf71cc..1a8d9a301 100644 --- a/client/common/cmdline.c +++ b/client/common/cmdline.c @@ -1015,7 +1015,7 @@ static int freerdp_client_command_line_post_filter_int(void* context, COMMAND_LI size_t count = 0; char** ptr = CommandLineParseCommaSeparatedValues(arg->Value, &count); - if (!freerdp_client_add_device_channel(settings, count, (const char**)ptr)) + if (!freerdp_client_add_device_channel(settings, count, (const char* const*)ptr)) status = COMMAND_LINE_ERROR_UNEXPECTED_VALUE; if (!freerdp_settings_set_bool(settings, FreeRDP_DeviceRedirection, TRUE)) status = COMMAND_LINE_ERROR; diff --git a/client/common/file.c b/client/common/file.c index b224a9f68..46244631a 100644 --- a/client/common/file.c +++ b/client/common/file.c @@ -2310,7 +2310,8 @@ BOOL freerdp_client_populate_settings_from_rdp_file(const rdpFile* file, rdpSett size_t count = 0; char** ptr = CommandLineParseCommaSeparatedValuesEx(LOCATION_CHANNEL_NAME, NULL, &count); - const BOOL rc = freerdp_client_add_dynamic_channel(settings, count, (const char**)ptr); + const BOOL rc = + freerdp_client_add_dynamic_channel(settings, count, (const char* const*)ptr); CommandLineParserFree(ptr); if (!rc) return FALSE; diff --git a/libfreerdp/core/gateway/http.c b/libfreerdp/core/gateway/http.c index 2688a3cce..447b9851d 100644 --- a/libfreerdp/core/gateway/http.c +++ b/libfreerdp/core/gateway/http.c @@ -1030,9 +1030,9 @@ static BOOL http_response_parse_header(HttpResponse* response) break; } - const int rc = http_response_parse_header_field(response, name, value); + const int res = http_response_parse_header_field(response, name, value); *end_of_header = end_of_header_char; - if (!rc) + if (!res) goto fail; } diff --git a/uwac/libuwac/uwac-input.c b/uwac/libuwac/uwac-input.c index 2234eba88..90ba46ff6 100644 --- a/uwac/libuwac/uwac-input.c +++ b/uwac/libuwac/uwac-input.c @@ -287,7 +287,7 @@ static void keyboard_handle_leave(void* data, struct wl_keyboard* keyboard, uint its.it_interval.tv_nsec = 0; its.it_value.tv_sec = 0; its.it_value.tv_nsec = 0; - timerfd_settime(input->repeat_timer_fd, 0, &its, NULL); + (void)timerfd_settime(input->repeat_timer_fd, 0, &its, NULL); UwacPointerEnterLeaveEvent* event = (UwacPointerEnterLeaveEvent*)UwacDisplayNewEvent(input->display, UWAC_EVENT_POINTER_LEAVE); @@ -403,7 +403,7 @@ static void keyboard_handle_key(void* data, struct wl_keyboard* keyboard, uint32 its.it_interval.tv_nsec = 0; its.it_value.tv_sec = 0; its.it_value.tv_nsec = 0; - timerfd_settime(input->repeat_timer_fd, 0, &its, NULL); + (void)timerfd_settime(input->repeat_timer_fd, 0, &its, NULL); } else if (state == WL_KEYBOARD_KEY_STATE_PRESSED && xkb_keymap_key_repeats(input->xkb.keymap, code)) @@ -415,7 +415,7 @@ static void keyboard_handle_key(void* data, struct wl_keyboard* keyboard, uint32 its.it_interval.tv_nsec = input->repeat_rate_nsec; its.it_value.tv_sec = input->repeat_delay_sec; its.it_value.tv_nsec = input->repeat_delay_nsec; - timerfd_settime(input->repeat_timer_fd, 0, &its, NULL); + (void)timerfd_settime(input->repeat_timer_fd, 0, &its, NULL); } keyEvent = (UwacKeyEvent*)UwacDisplayNewEvent(input->display, UWAC_EVENT_KEY); diff --git a/winpr/libwinpr/crypto/cipher.c b/winpr/libwinpr/crypto/cipher.c index ee3df9c30..65783e986 100644 --- a/winpr/libwinpr/crypto/cipher.c +++ b/winpr/libwinpr/crypto/cipher.c @@ -462,6 +462,8 @@ static const EVP_CIPHER* winpr_openssl_get_evp_cipher(WINPR_CIPHER_TYPE cipher) case WINPR_CIPHER_BLOWFISH_CTR: evp = EVP_get_cipherbyname("blowfish-ctr"); break; + default: + break; } return evp; diff --git a/winpr/libwinpr/smartcard/smartcard.c b/winpr/libwinpr/smartcard/smartcard.c index 480572150..3d052ff08 100644 --- a/winpr/libwinpr/smartcard/smartcard.c +++ b/winpr/libwinpr/smartcard/smartcard.c @@ -1100,7 +1100,7 @@ WINSCARDAPI char* WINAPI SCardGetReaderStateString(DWORD dwReaderState) return buffer; } -#define WINSCARD_LOAD_PROC(_name, ...) \ +#define WINSCARD_LOAD_PROC(_name) \ do \ { \ WINPR_PRAGMA_DIAG_PUSH \ diff --git a/winpr/libwinpr/thread/thread.c b/winpr/libwinpr/thread/thread.c index 8915012d5..f31c15d99 100644 --- a/winpr/libwinpr/thread/thread.c +++ b/winpr/libwinpr/thread/thread.c @@ -553,7 +553,7 @@ exit: set_event(thread); - signal_thread_ready(thread); + (void)signal_thread_ready(thread); if (thread->detached || !thread->started) cleanup_handle(thread); diff --git a/winpr/libwinpr/timezone/TimeZoneIanaAbbrevMap.c b/winpr/libwinpr/timezone/TimeZoneIanaAbbrevMap.c index bd4544826..f0773f444 100644 --- a/winpr/libwinpr/timezone/TimeZoneIanaAbbrevMap.c +++ b/winpr/libwinpr/timezone/TimeZoneIanaAbbrevMap.c @@ -81,7 +81,7 @@ static void append_timezone(const char* dir, const char* name) tzset(); const time_t t = time(NULL); struct tm lt = { 0 }; - localtime_r(&t, <); + (void)localtime_r(&t, <); append(tz, lt.tm_zone); if (oldtz) { diff --git a/winpr/libwinpr/timezone/timezone.c b/winpr/libwinpr/timezone/timezone.c index 2476f9479..6ab9793eb 100644 --- a/winpr/libwinpr/timezone/timezone.c +++ b/winpr/libwinpr/timezone/timezone.c @@ -393,7 +393,7 @@ static struct tm next_day(const struct tm* start) cur.tm_isdst = -1; cur.tm_mday++; const time_t t = mktime(&cur); - localtime_r(&t, &cur); + (void)localtime_r(&t, &cur); return cur; } @@ -405,7 +405,7 @@ static struct tm adjust_time(const struct tm* start, int hour, int minute) cur.tm_sec = 0; cur.tm_isdst = -1; const time_t t = mktime(&cur); - localtime_r(&t, &cur); + (void)localtime_r(&t, &cur); return cur; } @@ -426,7 +426,7 @@ static WORD get_transition_weekday_occurrence(const SYSTEMTIME* st) next.tm_mday++; struct tm cur = { 0 }; - localtime_r(&t, &cur); + (void)localtime_r(&t, &cur); if (cur.tm_mon + 1 != st->wMonth) break; diff --git a/winpr/libwinpr/utils/wlog/JournaldAppender.c b/winpr/libwinpr/utils/wlog/JournaldAppender.c index 16395a6e7..a1526b741 100644 --- a/winpr/libwinpr/utils/wlog/JournaldAppender.c +++ b/winpr/libwinpr/utils/wlog/JournaldAppender.c @@ -112,8 +112,12 @@ static BOOL WLog_JournaldAppender_WriteMessage(wLog* log, wLogAppender* appender WLog_Layout_GetMessagePrefix(log, appender->Layout, message); if (message->Level != WLOG_OFF) - (void)fprintf(journaldAppender->stream, formatStr, message->PrefixString, - message->TextString); + { + WINPR_PRAGMA_DIAG_PUSH + WINPR_PRAGMA_DIAG_IGNORED_FORMAT_NONLITERAL(void) + fprintf(journaldAppender->stream, formatStr, message->PrefixString, message->TextString); + WINPR_PRAGMA_DIAG_POP + } return TRUE; }