diff --git a/client/SDL/SDL3/dialogs/sdl_button.cpp b/client/SDL/SDL3/dialogs/sdl_button.cpp index 90cd39a84..b640a541d 100644 --- a/client/SDL/SDL3/dialogs/sdl_button.cpp +++ b/client/SDL/SDL3/dialogs/sdl_button.cpp @@ -19,6 +19,7 @@ */ #include +#include #include "sdl_button.hpp" @@ -27,9 +28,8 @@ static const SDL_Color buttonhighlightcolor = { 0xcd, 0xca, 0x35, 0x60 }; static const SDL_Color buttonmouseovercolor = { 0x66, 0xff, 0x66, 0x60 }; static const SDL_Color buttonfontcolor = { 0xd1, 0xcf, 0xcd, 0xff }; -SdlButton::SdlButton(SDL_Renderer* renderer, const std::string& label, int id, - const SDL_FRect& rect) - : SdlWidget(renderer, rect, false), _name(label), _id(id) +SdlButton::SdlButton(SDL_Renderer* renderer, std::string label, int id, const SDL_FRect& rect) + : SdlWidget(renderer, rect, false), _name(std::move(label)), _id(id) { assert(renderer); @@ -37,7 +37,7 @@ SdlButton::SdlButton(SDL_Renderer* renderer, const std::string& label, int id, } SdlButton::SdlButton(SdlButton&& other) noexcept - : SdlWidget(std::move(other)), _name(std::move(other._name)), _id(std::move(other._id)) + : SdlWidget(std::move(other)), _name(std::move(other._name)), _id(other._id) { } diff --git a/client/SDL/SDL3/dialogs/sdl_button.hpp b/client/SDL/SDL3/dialogs/sdl_button.hpp index aaa35c50e..668a8fe7d 100644 --- a/client/SDL/SDL3/dialogs/sdl_button.hpp +++ b/client/SDL/SDL3/dialogs/sdl_button.hpp @@ -7,7 +7,7 @@ class SdlButton : public SdlWidget { public: - SdlButton(SDL_Renderer* renderer, const std::string& label, int id, const SDL_FRect& rect); + SdlButton(SDL_Renderer* renderer, std::string label, int id, const SDL_FRect& rect); SdlButton(SdlButton&& other) noexcept; ~SdlButton() override = default; @@ -20,7 +20,6 @@ class SdlButton : public SdlWidget private: SdlButton(const SdlButton& other) = delete; - private: std::string _name; int _id; }; diff --git a/client/SDL/SDL3/dialogs/sdl_buttons.hpp b/client/SDL/SDL3/dialogs/sdl_buttons.hpp index 7f8290352..dfbd478ba 100644 --- a/client/SDL/SDL3/dialogs/sdl_buttons.hpp +++ b/client/SDL/SDL3/dialogs/sdl_buttons.hpp @@ -29,7 +29,6 @@ class SdlButtonList SdlButtonList(const SdlButtonList& other) = delete; SdlButtonList(SdlButtonList&& other) = delete; - private: std::vector _list; SdlButton* _highlighted = nullptr; size_t _highlight_index = 0; diff --git a/client/SDL/SDL3/dialogs/sdl_connection_dialog.hpp b/client/SDL/SDL3/dialogs/sdl_connection_dialog.hpp index 689bf0a2d..df233c9e7 100644 --- a/client/SDL/SDL3/dialogs/sdl_connection_dialog.hpp +++ b/client/SDL/SDL3/dialogs/sdl_connection_dialog.hpp @@ -64,7 +64,6 @@ class SDLConnectionDialog MSG_DISCARD }; - private: bool createWindow(); void destroyWindow(); @@ -72,21 +71,19 @@ class SDLConnectionDialog bool setModal(); - bool clearWindow(SDL_Renderer* renderer); + static bool clearWindow(SDL_Renderer* renderer); bool update(SDL_Renderer* renderer); bool show(MsgType type, const char* fmt, va_list ap); bool show(MsgType type); - std::string print(const char* fmt, va_list ap); + static std::string print(const char* fmt, va_list ap); bool setTimer(Uint32 timeoutMS = 15000); void resetTimer(); - private: static Uint32 timeout(void* pvthis, SDL_TimerID timerID, Uint32 intervalMS); - private: struct widget_cfg_t { SDL_Color fgcolor = {}; @@ -94,7 +91,6 @@ class SDLConnectionDialog SdlWidget widget; }; - private: rdpContext* _context = nullptr; SDL_Window* _window = nullptr; SDL_Renderer* _renderer = nullptr; @@ -121,9 +117,8 @@ class SDLConnectionDialogHider private: SDLConnectionDialog* get(freerdp* instance); - SDLConnectionDialog* get(rdpContext* context); + static SDLConnectionDialog* get(rdpContext* context); - private: SDLConnectionDialog* _dialog = nullptr; bool _visible = false; }; diff --git a/client/SDL/SDL3/dialogs/sdl_dialogs.cpp b/client/SDL/SDL3/dialogs/sdl_dialogs.cpp index 2f8502d71..3ca42fab8 100644 --- a/client/SDL/SDL3/dialogs/sdl_dialogs.cpp +++ b/client/SDL/SDL3/dialogs/sdl_dialogs.cpp @@ -331,14 +331,14 @@ static char* sdl_pem_cert(const char* pem) { rdpCertificate* cert = freerdp_certificate_new_from_pem(pem); if (!cert) - return NULL; + return nullptr; char* fp = freerdp_certificate_get_fingerprint(cert); char* start = freerdp_certificate_get_validity(cert, TRUE); char* end = freerdp_certificate_get_validity(cert, FALSE); freerdp_certificate_free(cert); - char* str = NULL; + char* str = nullptr; size_t slen = 0; winpr_asprintf(&str, &slen, "Valid from: %s\n" diff --git a/client/SDL/SDL3/dialogs/sdl_input.cpp b/client/SDL/SDL3/dialogs/sdl_input.cpp index 144100dde..c51d722bc 100644 --- a/client/SDL/SDL3/dialogs/sdl_input.cpp +++ b/client/SDL/SDL3/dialogs/sdl_input.cpp @@ -22,6 +22,7 @@ #include #include +#include #include #include @@ -39,10 +40,9 @@ static const SDL_Color labelfontcolor = { 0xd1, 0xcf, 0xcd, 0xff }; static const Uint32 vpadding = 5; static const Uint32 hpadding = 10; -SdlInputWidget::SdlInputWidget(SDL_Renderer* renderer, const std::string& label, - const std::string& initial, Uint32 flags, size_t offset, - size_t width, size_t height) - : _flags(flags), _text(initial), _text_label(label), +SdlInputWidget::SdlInputWidget(SDL_Renderer* renderer, std::string label, std::string initial, + Uint32 flags, size_t offset, size_t width, size_t height) + : _flags(flags), _text(std::move(initial)), _text_label(std::move(label)), _label(renderer, { 0, static_cast(offset * (height + vpadding)), static_cast(width), static_cast(height) }, @@ -57,7 +57,7 @@ SdlInputWidget::SdlInputWidget(SDL_Renderer* renderer, const std::string& label, } SdlInputWidget::SdlInputWidget(SdlInputWidget&& other) noexcept - : _flags(std::move(other._flags)), _text(std::move(other._text)), + : _flags(other._flags), _text(std::move(other._text)), _text_label(std::move(other._text_label)), _label(std::move(other._label)), _input(std::move(other._input)), _highlight(other._highlight), _mouseover(other._mouseover) { diff --git a/client/SDL/SDL3/dialogs/sdl_input.hpp b/client/SDL/SDL3/dialogs/sdl_input.hpp index 63479f89e..627fd60f2 100644 --- a/client/SDL/SDL3/dialogs/sdl_input.hpp +++ b/client/SDL/SDL3/dialogs/sdl_input.hpp @@ -34,9 +34,8 @@ class SdlInputWidget SDL_INPUT_READONLY = 2 }; - public: - SdlInputWidget(SDL_Renderer* renderer, const std::string& label, const std::string& initial, - Uint32 flags, size_t offset, size_t width, size_t height); + SdlInputWidget(SDL_Renderer* renderer, std::string label, std::string initial, Uint32 flags, + size_t offset, size_t width, size_t height); SdlInputWidget(SdlInputWidget&& other) noexcept; bool fill_label(SDL_Renderer* renderer, SDL_Color color); @@ -62,7 +61,6 @@ class SdlInputWidget private: SdlInputWidget(const SdlInputWidget& other) = delete; - private: Uint32 _flags; std::string _text; std::string _text_label; diff --git a/client/SDL/SDL3/dialogs/sdl_input_widgets.hpp b/client/SDL/SDL3/dialogs/sdl_input_widgets.hpp index 1d19c3d16..b477d29c9 100644 --- a/client/SDL/SDL3/dialogs/sdl_input_widgets.hpp +++ b/client/SDL/SDL3/dialogs/sdl_input_widgets.hpp @@ -24,19 +24,16 @@ class SdlInputWidgetList SdlInputWidgetList(const SdlInputWidgetList& other) = delete; SdlInputWidgetList(SdlInputWidgetList&& other) = delete; - private: enum { INPUT_BUTTON_ACCEPT = 1, INPUT_BUTTON_CANCEL = -2 }; - private: ssize_t next(ssize_t current); [[nodiscard]] bool valid(ssize_t current) const; SdlInputWidget* get(ssize_t index); - private: SDL_Window* _window; SDL_Renderer* _renderer; std::vector _list; diff --git a/client/SDL/SDL3/dialogs/sdl_select.cpp b/client/SDL/SDL3/dialogs/sdl_select.cpp index 72f6513d0..5385bbc50 100644 --- a/client/SDL/SDL3/dialogs/sdl_select.cpp +++ b/client/SDL/SDL3/dialogs/sdl_select.cpp @@ -20,6 +20,7 @@ #include #include +#include #include #include @@ -35,9 +36,8 @@ static const SDL_Color labelbackgroundcolor = { 0x69, 0x66, 0x63, 0xff }; static const SDL_Color labelhighlightcolor = { 0xcd, 0xca, 0x35, 0x60 }; static const SDL_Color labelfontcolor = { 0xd1, 0xcf, 0xcd, 0xff }; -SdlSelectWidget::SdlSelectWidget(SDL_Renderer* renderer, const std::string& label, - const SDL_FRect& rect) - : SdlWidget(renderer, rect, true), _text(label), _mouseover(false), _highlight(false) +SdlSelectWidget::SdlSelectWidget(SDL_Renderer* renderer, std::string label, const SDL_FRect& rect) + : SdlWidget(renderer, rect, true), _text(std::move(label)), _mouseover(false), _highlight(false) { update_text(renderer); } diff --git a/client/SDL/SDL3/dialogs/sdl_select.hpp b/client/SDL/SDL3/dialogs/sdl_select.hpp index 7e2929e52..c8179e15f 100644 --- a/client/SDL/SDL3/dialogs/sdl_select.hpp +++ b/client/SDL/SDL3/dialogs/sdl_select.hpp @@ -28,7 +28,7 @@ class SdlSelectWidget : public SdlWidget { public: - SdlSelectWidget(SDL_Renderer* renderer, const std::string& label, const SDL_FRect& rect); + SdlSelectWidget(SDL_Renderer* renderer, std::string label, const SDL_FRect& rect); SdlSelectWidget(SdlSelectWidget&& other) noexcept; ~SdlSelectWidget() override = default; @@ -39,7 +39,6 @@ class SdlSelectWidget : public SdlWidget private: SdlSelectWidget(const SdlSelectWidget& other) = delete; - private: std::string _text; bool _mouseover; bool _highlight; diff --git a/client/SDL/SDL3/dialogs/sdl_selectlist.hpp b/client/SDL/SDL3/dialogs/sdl_selectlist.hpp index 3b5e047cb..14a90c990 100644 --- a/client/SDL/SDL3/dialogs/sdl_selectlist.hpp +++ b/client/SDL/SDL3/dialogs/sdl_selectlist.hpp @@ -21,20 +21,17 @@ class SdlSelectList SdlSelectList(const SdlSelectList& other) = delete; SdlSelectList(SdlSelectList&& other) = delete; - private: enum { INPUT_BUTTON_ACCEPT = 0, INPUT_BUTTON_CANCEL = -2 }; - private: ssize_t get_index(const SDL_MouseButtonEvent& button); bool update_text(); void reset_mouseover(); void reset_highlight(); - private: SDL_Window* _window; SDL_Renderer* _renderer; std::vector _list; diff --git a/client/SDL/SDL3/dialogs/sdl_widget.cpp b/client/SDL/SDL3/dialogs/sdl_widget.cpp index f98644ce5..0f1660636 100644 --- a/client/SDL/SDL3/dialogs/sdl_widget.cpp +++ b/client/SDL/SDL3/dialogs/sdl_widget.cpp @@ -71,8 +71,8 @@ SdlWidget::SdlWidget(SDL_Renderer* renderer, const SDL_FRect& rect, SDL_IOStream #endif SdlWidget::SdlWidget(SdlWidget&& other) noexcept - : _font(std::move(other._font)), _image(other._image), _rect(std::move(other._rect)), - _input(other._input), _wrap(other._wrap), _text_width(other._text_width) + : _font(other._font), _image(other._image), _rect(other._rect), _input(other._input), + _wrap(other._wrap), _text_width(other._text_width) { other._font = nullptr; other._image = nullptr; diff --git a/client/SDL/SDL3/dialogs/sdl_widget.hpp b/client/SDL/SDL3/dialogs/sdl_widget.hpp index e8eaf0364..bda34ac89 100644 --- a/client/SDL/SDL3/dialogs/sdl_widget.hpp +++ b/client/SDL/SDL3/dialogs/sdl_widget.hpp @@ -59,11 +59,10 @@ class SdlWidget bool update_text(SDL_Renderer* renderer, const std::string& text, SDL_Color fgcolor, SDL_Color bgcolor); - bool wrap() const; + [[nodiscard]] bool wrap() const; bool set_wrap(bool wrap = true, size_t width = 0); - const SDL_FRect& rect() const; + [[nodiscard]] const SDL_FRect& rect() const; - public: #define widget_log_error(res, what) SdlWidget::error_ex(res, what, __FILE__, __LINE__, __func__) static bool error_ex(Uint32 res, const char* what, const char* file, size_t line, const char* fkt); @@ -76,7 +75,6 @@ class SdlWidget SDL_Texture* render_text_wrapped(SDL_Renderer* renderer, const std::string& text, SDL_Color fgcolor, SDL_FRect& src, SDL_FRect& dst); - private: TTF_Font* _font = nullptr; SDL_Texture* _image = nullptr; SDL_FRect _rect; diff --git a/client/SDL/SDL3/sdl_clip.cpp b/client/SDL/SDL3/sdl_clip.cpp index 87976fef7..5ee1f9150 100644 --- a/client/SDL/SDL3/sdl_clip.cpp +++ b/client/SDL/SDL3/sdl_clip.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include @@ -57,7 +58,7 @@ static const char* type_FileGroupDescriptorW = "FileGroupDescriptorW"; class ClipboardLockGuard { public: - ClipboardLockGuard(wClipboard* clipboard) : _clipboard(clipboard) + explicit ClipboardLockGuard(wClipboard* clipboard) : _clipboard(clipboard) { ClipboardLock(_clipboard); } @@ -155,7 +156,7 @@ bool sdlClip::handle_update() clientFormats.push_back({ CF_UNICODETEXT, nullptr }); } if (SDL_HasClipboardData(mime_html.c_str())) - clientFormatNames.push_back(type_HtmlFormat); + clientFormatNames.emplace_back(type_HtmlFormat); for (auto& mime : mime_bitmap) { @@ -311,7 +312,7 @@ uint32_t sdlClip::serverIdForMime(const std::string& mime) { if (!format.formatName()) continue; - if (cmp.compare(format.formatName()) == 0) + if (cmp == format.formatName()) return format.formatId(); } @@ -378,7 +379,7 @@ UINT sdlClip::ReceiveServerFormatList(CliprdrClientContext* context, { const CLIPRDR_FORMAT* format = &formatList->formats[i]; - clipboard->_serverFormats.push_back({ format->formatId, format->formatName }); + clipboard->_serverFormats.emplace_back(format->formatId, format->formatName); if (format->formatName) { @@ -466,7 +467,7 @@ std::shared_ptr sdlClip::ReceiveFormatDataRequestHandle( len = 0; auto localFormatId = formatId = formatDataRequest->requestedFormatId; - ClipboardLockGuard(clipboard->_system); + ClipboardLockGuard give_me_a_name(clipboard->_system); std::lock_guard lock(clipboard->_lock); const UINT32 fileFormatId = ClipboardGetFormatId(clipboard->_system, type_FileGroupDescriptorW); @@ -581,7 +582,7 @@ UINT sdlClip::ReceiveFormatDataResponse(CliprdrClientContext* context, cliprdr_file_context_get_context(static_cast(context->custom))); WINPR_ASSERT(clipboard); - ClipboardLockGuard(clipboard->_system); + ClipboardLockGuard give_me_a_name(clipboard->_system); std::lock_guard lock(clipboard->_lock); if (clipboard->_request_queue.empty()) return ERROR_INTERNAL_ERROR; @@ -615,7 +616,7 @@ UINT sdlClip::ReceiveFormatDataResponse(CliprdrClientContext* context, auto name = clipboard->getServerFormat(request.format()); if (!name.empty()) { - if (name.compare(type_FileGroupDescriptorW) == 0) + if (name == type_FileGroupDescriptorW) { srcFormatId = ClipboardGetFormatId(clipboard->_system, type_FileGroupDescriptorW); @@ -624,7 +625,7 @@ UINT sdlClip::ReceiveFormatDataResponse(CliprdrClientContext* context, clipboard->_system, data, size)) return ERROR_INTERNAL_ERROR; } - else if (name.compare(type_HtmlFormat) == 0) + else if (name == type_HtmlFormat) { srcFormatId = ClipboardGetFormatId(clipboard->_system, type_HtmlFormat); } @@ -655,7 +656,7 @@ const void* sdlClip::ClipDataCb(void* userdata, const char* mime_type, size_t* s mime_type = "text/plain"; { - ClipboardLockGuard(clip->_system); + ClipboardLockGuard give_me_a_name(clip->_system); std::lock_guard lock(clip->_lock); auto cache = clip->_cache_data.find(mime_type); if (cache != clip->_cache_data.end()) @@ -676,7 +677,7 @@ const void* sdlClip::ClipDataCb(void* userdata, const char* mime_type, size_t* s return nullptr; } { - ClipboardLockGuard(clip->_system); + ClipboardLockGuard give_me_a_name(clip->_system); std::lock_guard lock(clip->_lock); auto request = clip->_request_queue.front(); clip->_request_queue.pop(); @@ -698,7 +699,7 @@ void sdlClip::ClipCleanCb(void* userdata) { auto clip = static_cast(userdata); WINPR_ASSERT(clip); - ClipboardLockGuard(clip->_system); + ClipboardLockGuard give_me_a_name(clip->_system); std::lock_guard lock(clip->_lock); ClipboardEmpty(clip->_system); clip->_cache_data.clear(); @@ -719,7 +720,7 @@ bool sdlClip::mime_is_text(const std::string& mime) { for (size_t x = 0; x < ARRAYSIZE(mime_text); x++) { - if (mime.compare(mime_text[x]) == 0) + if (mime == mime_text[x]) return true; } @@ -730,7 +731,7 @@ bool sdlClip::mime_is_image(const std::string& mime) { for (size_t x = 0; x < ARRAYSIZE(mime_image); x++) { - if (mime.compare(mime_image[x]) == 0) + if (mime == mime_image[x]) return true; } @@ -739,13 +740,10 @@ bool sdlClip::mime_is_image(const std::string& mime) bool sdlClip::mime_is_html(const std::string& mime) { - if (mime.compare(mime_html) == 0) - return true; - - return false; + return mime.compare(mime_html) == 0; } -ClipRequest::ClipRequest(UINT32 format, const std::string& mime) : _format(format), _mime(mime) +ClipRequest::ClipRequest(UINT32 format, std::string mime) : _format(format), _mime(std::move(mime)) { } diff --git a/client/SDL/SDL3/sdl_clip.hpp b/client/SDL/SDL3/sdl_clip.hpp index 1c84a7ffe..c23e17107 100644 --- a/client/SDL/SDL3/sdl_clip.hpp +++ b/client/SDL/SDL3/sdl_clip.hpp @@ -20,6 +20,7 @@ #pragma once +#include #include #include #include @@ -36,7 +37,7 @@ class ClipRequest { public: - ClipRequest(UINT32 format, const std::string& mime); + ClipRequest(UINT32 format, std::string mime); ClipRequest(const ClipRequest& other) = default; ClipRequest(ClipRequest&& other) = default; ~ClipRequest() = default; @@ -106,7 +107,6 @@ class sdlClip std::string getServerFormat(uint32_t id); uint32_t serverIdForMime(const std::string& mime); - private: static UINT MonitorReady(CliprdrClientContext* context, const CLIPRDR_MONITOR_READY* monitorReady); @@ -131,7 +131,6 @@ class sdlClip static bool mime_is_image(const std::string& mime); static bool mime_is_html(const std::string& mime); - private: SdlContext* _sdl = nullptr; CliprdrFileContext* _file = nullptr; CliprdrClientContext* _ctx = nullptr; @@ -147,7 +146,7 @@ class sdlClip struct cache_entry { - cache_entry(size_t len, std::shared_ptr p) : size(len), ptr(p) + cache_entry(size_t len, std::shared_ptr p) : size(len), ptr(std::move(p)) { } diff --git a/client/SDL/SDL3/sdl_disp.hpp b/client/SDL/SDL3/sdl_disp.hpp index a1c182ca6..947454be7 100644 --- a/client/SDL/SDL3/sdl_disp.hpp +++ b/client/SDL/SDL3/sdl_disp.hpp @@ -36,7 +36,7 @@ class sdlDispContext BOOL init(DispClientContext* disp); BOOL uninit(DispClientContext* disp); - BOOL handle_display_event(const SDL_DisplayEvent* ev); + static BOOL handle_display_event(const SDL_DisplayEvent* ev); BOOL handle_window_event(const SDL_WindowEvent* ev); @@ -52,14 +52,12 @@ class sdlDispContext BOOL addTimer(); - private: static UINT DisplayControlCaps(DispClientContext* disp, UINT32 maxNumMonitors, UINT32 maxMonitorAreaFactorA, UINT32 maxMonitorAreaFactorB); static void OnActivated(void* context, const ActivatedEventArgs* e); static void OnGraphicsReset(void* context, const GraphicsResetEventArgs* e); static Uint32 SDLCALL OnTimer(void* param, SDL_TimerID timerID, Uint32 interval); - private: SdlContext* _sdl = nullptr; DispClientContext* _disp = nullptr; int _eventBase = -1; diff --git a/client/SDL/SDL3/sdl_freerdp.cpp b/client/SDL/SDL3/sdl_freerdp.cpp index b73dc0912..f363d224a 100644 --- a/client/SDL/SDL3/sdl_freerdp.cpp +++ b/client/SDL/SDL3/sdl_freerdp.cpp @@ -212,9 +212,9 @@ static const struct sdl_exit_code_map_t sdl_exit_code_map[] = { static const struct sdl_exit_code_map_t* sdl_map_entry_by_code(int exit_code) { - for (size_t x = 0; x < ARRAYSIZE(sdl_exit_code_map); x++) + for (const auto& x : sdl_exit_code_map) { - const struct sdl_exit_code_map_t* cur = &sdl_exit_code_map[x]; + const struct sdl_exit_code_map_t* cur = &x; if (cur->code == exit_code) return cur; } @@ -231,9 +231,9 @@ static void sdl_hide_connection_dialog(SdlContext* sdl) static const struct sdl_exit_code_map_t* sdl_map_entry_by_error(DWORD error) { - for (size_t x = 0; x < ARRAYSIZE(sdl_exit_code_map); x++) + for (const auto& x : sdl_exit_code_map) { - const struct sdl_exit_code_map_t* cur = &sdl_exit_code_map[x]; + const struct sdl_exit_code_map_t* cur = &x; if (cur->error == error) return cur; } @@ -1334,7 +1334,7 @@ terminate: /* Optional global initializer. * Here we just register a signal handler to print out stack traces * if available. */ -static BOOL sdl_client_global_init(void) +static BOOL sdl_client_global_init() { #if defined(_WIN32) WSADATA wsaData = { 0 }; @@ -1354,7 +1354,7 @@ static BOOL sdl_client_global_init(void) } /* Optional global tear down */ -static void sdl_client_global_uninit(void) +static void sdl_client_global_uninit() { #if defined(_WIN32) WSACleanup(); diff --git a/client/SDL/SDL3/sdl_freerdp.hpp b/client/SDL/SDL3/sdl_freerdp.hpp index 20711ef68..f13d15738 100644 --- a/client/SDL/SDL3/sdl_freerdp.hpp +++ b/client/SDL/SDL3/sdl_freerdp.hpp @@ -83,7 +83,6 @@ class SdlContext std::atomic rdp_thread_running; - public: BOOL update_resizeable(BOOL enable); BOOL update_fullscreen(BOOL enter); diff --git a/client/SDL/SDL3/sdl_kbd.cpp b/client/SDL/SDL3/sdl_kbd.cpp index 8439f5e24..f1f0f7a93 100644 --- a/client/SDL/SDL3/sdl_kbd.cpp +++ b/client/SDL/SDL3/sdl_kbd.cpp @@ -282,7 +282,7 @@ static const scancode_entry_t map[] = { #endif }; -static UINT32 sdl_get_kbd_flags(void) +static UINT32 sdl_get_kbd_flags() { UINT32 flags = 0; @@ -598,9 +598,10 @@ BOOL sdlInput::mouse_grab(Uint32 windowID, SDL_bool enable) return it->second.grabMouse(enable); } -sdlInput::sdlInput(SdlContext* sdl) : _sdl(sdl), _lastWindowID(UINT32_MAX) +sdlInput::sdlInput(SdlContext* sdl) + : _sdl(sdl), _lastWindowID(UINT32_MAX), _hotkeyModmask(prefToMask()) { - _hotkeyModmask = prefToMask(); + _hotkeyFullscreen = prefKeyValue("SDL_Fullscreen", SDL_SCANCODE_RETURN); _hotkeyResizable = prefKeyValue("SDL_Resizeable", SDL_SCANCODE_R); _hotkeyGrab = prefKeyValue("SDL_Grab", SDL_SCANCODE_G); diff --git a/client/SDL/SDL3/sdl_kbd.hpp b/client/SDL/SDL3/sdl_kbd.hpp index 24940a3b5..78bc5c16e 100644 --- a/client/SDL/SDL3/sdl_kbd.hpp +++ b/client/SDL/SDL3/sdl_kbd.hpp @@ -45,7 +45,6 @@ class sdlInput BOOL mouse_focus(Uint32 windowID); BOOL mouse_grab(Uint32 windowID, SDL_bool enable); - public: static BOOL keyboard_set_indicators(rdpContext* context, UINT16 led_flags); static BOOL keyboard_set_ime_status(rdpContext* context, UINT16 imeId, UINT32 imeState, UINT32 imeConvMode); @@ -61,7 +60,6 @@ class sdlInput uint32_t remapScancode(uint32_t scancode); void remapInitialize(); - private: SdlContext* _sdl; Uint32 _lastWindowID; std::map _remapList; diff --git a/client/SDL/SDL3/sdl_monitor.cpp b/client/SDL/SDL3/sdl_monitor.cpp index 4791ccf8c..3d7759de8 100644 --- a/client/SDL/SDL3/sdl_monitor.cpp +++ b/client/SDL/SDL3/sdl_monitor.cpp @@ -287,7 +287,7 @@ static BOOL sdl_detect_single_window(SdlContext* sdl, UINT32* pMaxWidth, UINT32* if (freerdp_settings_get_uint32(settings, FreeRDP_NumMonitorIds) == 0) { const size_t id = - (sdl->windows.size() > 0) ? sdl->windows.begin()->second.displayIndex() : 0; + (!sdl->windows.empty()) ? sdl->windows.begin()->second.displayIndex() : 0; if (!freerdp_settings_set_pointer_len(settings, FreeRDP_MonitorIds, &id, 1)) return FALSE; } diff --git a/client/SDL/SDL3/sdl_utils.hpp b/client/SDL/SDL3/sdl_utils.hpp index d96b646d6..7ef5b1558 100644 --- a/client/SDL/SDL3/sdl_utils.hpp +++ b/client/SDL/SDL3/sdl_utils.hpp @@ -40,7 +40,7 @@ class CriticalSection void unlock(); private: - CRITICAL_SECTION _section; + CRITICAL_SECTION _section{}; }; class WinPREvent diff --git a/client/SDL/SDL3/sdl_window.cpp b/client/SDL/SDL3/sdl_window.cpp index d9837e567..601061fd8 100644 --- a/client/SDL/SDL3/sdl_window.cpp +++ b/client/SDL/SDL3/sdl_window.cpp @@ -35,7 +35,7 @@ SdlWindow::SdlWindow(const std::string& title, Sint32 startupX, Sint32 startupY, SDL_DestroyProperties(props); } -SdlWindow::SdlWindow(SdlWindow&& other) +SdlWindow::SdlWindow(SdlWindow&& other) noexcept : _window(other._window), _offset_x(other._offset_x), _offset_y(other._offset_y) { other._window = nullptr; diff --git a/client/SDL/SDL3/sdl_window.hpp b/client/SDL/SDL3/sdl_window.hpp index d809c5961..5533edc6b 100644 --- a/client/SDL/SDL3/sdl_window.hpp +++ b/client/SDL/SDL3/sdl_window.hpp @@ -27,7 +27,7 @@ class SdlWindow public: SdlWindow(const std::string& title, Sint32 startupX, Sint32 startupY, Sint32 width, Sint32 height, Uint32 flags); - SdlWindow(SdlWindow&& other); + SdlWindow(SdlWindow&& other) noexcept; ~SdlWindow(); [[nodiscard]] Uint32 id() const; @@ -57,6 +57,5 @@ class SdlWindow Sint32 _offset_x = 0; Sint32 _offset_y = 0; - private: SdlWindow(const SdlWindow& other) = delete; }; diff --git a/client/common/cmdline.c b/client/common/cmdline.c index 686932757..5ec740e82 100644 --- a/client/common/cmdline.c +++ b/client/common/cmdline.c @@ -69,6 +69,8 @@ #include #define TAG CLIENT_TAG("common.cmdline") +static const char str_force[] = "force"; + static const char* option_starts_with(const char* what, const char* val); static BOOL option_ends_with(const char* str, const char* ext); static BOOL option_equals(const char* what, const char* val); @@ -4330,7 +4332,7 @@ static int freerdp_client_settings_parse_command_line_arguments_int( if (arg->Flags & COMMAND_LINE_VALUE_PRESENT) { - if (option_equals(arg->Value, "force")) + if (option_equals(arg->Value, str_force)) { if (!freerdp_settings_set_bool(settings, FreeRDP_ForceMultimon, TRUE)) return fail_at(arg, COMMAND_LINE_ERROR); @@ -4637,7 +4639,7 @@ static int freerdp_client_settings_parse_command_line_arguments_int( } CommandLineSwitchCase(arg, "ipv4") { - if (arg->Value != NULL && strncmp(arg->Value, "force", 6) == 0) + if (arg->Value != NULL && strncmp(arg->Value, str_force, ARRAYSIZE(str_force)) == 0) { if (!freerdp_settings_set_uint32(settings, FreeRDP_ForceIPvX, 4)) return fail_at(arg, COMMAND_LINE_ERROR); @@ -4650,7 +4652,7 @@ static int freerdp_client_settings_parse_command_line_arguments_int( } CommandLineSwitchCase(arg, "ipv6") { - if (arg->Value != NULL && strncmp(arg->Value, "force", 6) == 0) + if (arg->Value != NULL && strncmp(arg->Value, str_force, ARRAYSIZE(str_force)) == 0) { if (!freerdp_settings_set_uint32(settings, FreeRDP_ForceIPvX, 6)) return fail_at(arg, COMMAND_LINE_ERROR); @@ -4986,7 +4988,7 @@ static int freerdp_client_settings_parse_command_line_arguments_int( { if (!arg->Value) return fail_at(arg, COMMAND_LINE_ERROR_UNEXPECTED_VALUE); - promptForPassword = (option_equals(arg->Value, "force")); + promptForPassword = (option_equals(arg->Value, str_force)); if (!promptForPassword) return fail_at(arg, COMMAND_LINE_ERROR); diff --git a/server/proxy/modules/dyn-channel-dump/dyn-channel-dump.cpp b/server/proxy/modules/dyn-channel-dump/dyn-channel-dump.cpp index 772c58e18..cb5bd6bf2 100644 --- a/server/proxy/modules/dyn-channel-dump/dyn-channel-dump.cpp +++ b/server/proxy/modules/dyn-channel-dump/dyn-channel-dump.cpp @@ -70,7 +70,7 @@ static constexpr char key_channels[] = "channels"; class PluginData { public: - PluginData(proxyPluginsManager* mgr) : _mgr(mgr), _sessionid(0) + explicit PluginData(proxyPluginsManager* mgr) : _mgr(mgr) { } diff --git a/winpr/libwinpr/utils/wlog/PacketMessage.c b/winpr/libwinpr/utils/wlog/PacketMessage.c index edc3185c9..a481da4da 100644 --- a/winpr/libwinpr/utils/wlog/PacketMessage.c +++ b/winpr/libwinpr/utils/wlog/PacketMessage.c @@ -269,7 +269,7 @@ static BOOL WLog_PacketMessage_Write_EthernetHeader(wPcap* pcap, wEthernetHeader return ret; } -static UINT16 IPv4Checksum(BYTE* ipv4, int length) +static UINT16 IPv4Checksum(const BYTE* ipv4, int length) { UINT16 tmp16 = 0; long checksum = 0;