[warnings] fix compiler and clang-tidy issues

This commit is contained in:
akallabeth
2026-01-23 20:42:32 +01:00
parent 4c15ec1b99
commit 2bbe3310ba
8 changed files with 39 additions and 48 deletions

View File

@@ -354,16 +354,15 @@ bool SDLConnectionDialog::createWindow()
break;
}
const auto height = (total_height - 3ul * vpadding) / 2ul;
SDL_FRect iconRect{ hpadding, vpadding, widget_width / 4ul - 2ul * hpadding,
static_cast<float>(height) };
const auto height = (total_height - 3.0f * vpadding) / 2.0f;
SDL_FRect iconRect{ hpadding, vpadding, widget_width / 4.0f - 2.0f * hpadding, height };
widget_cfg_t icon{ textcolor,
res_bgcolor,
{ _renderer, iconRect,
SDL3ResourceManager::get(SDLResourceManager::typeImages(), res_name) } };
_list.emplace_back(std::move(icon));
iconRect.y += static_cast<float>(height);
iconRect.y += height;
widget_cfg_t logo{ textcolor,
_backgroundcolor,
@@ -372,7 +371,7 @@ bool SDLConnectionDialog::createWindow()
"FreeRDP_Icon.svg") } };
_list.emplace_back(std::move(logo));
SDL_FRect rect = { widget_width / 4ul, vpadding, widget_width * 3ul / 4ul,
SDL_FRect rect = { widget_width / 4.0f, vpadding, widget_width * 3.0f / 4.0f,
total_height - 3ul * vpadding - widget_height };
#else
SDL_FRect rect = { hpadding, vpadding, widget_width - 2ul * hpadding,

View File

@@ -69,7 +69,7 @@ SdlWidget::SdlWidget(std::shared_ptr<SDL_Renderer>& renderer, const SDL_FRect& r
{
if (ops)
{
_image = std::shared_ptr<SDL_Texture>(IMG_LoadTexture_IO(renderer.get(), ops, 1),
_image = std::shared_ptr<SDL_Texture>(IMG_LoadTexture_IO(renderer.get(), ops, true),
SDL_DestroyTexture);
if (!_image)
(void)widget_log_error(false, "IMG_LoadTexture_IO");

View File

@@ -964,10 +964,6 @@ ClipRequest::ClipRequest(UINT32 format, const std::string& mime)
{
}
ClipRequest::~ClipRequest()
{
}
uint32_t ClipRequest::format() const
{
return _format;

View File

@@ -41,7 +41,7 @@ class ClipRequest
ClipRequest(UINT32 format, const std::string& mime);
ClipRequest(const ClipRequest& other) = default;
ClipRequest(ClipRequest&& other) = default;
virtual ~ClipRequest();
~ClipRequest() = default;
ClipRequest& operator=(const ClipRequest& other) = delete;
ClipRequest& operator=(ClipRequest&& other) = delete;
@@ -130,14 +130,13 @@ class sdlClip
[[nodiscard]] static bool mime_is_bmp(const std::string& mime);
[[nodiscard]] static bool mime_is_html(const std::string& mime);
private:
SdlContext* _sdl = nullptr;
CliprdrFileContext* _file = nullptr;
CliprdrClientContext* _ctx = nullptr;
wLog* _log = nullptr;
wClipboard* _system = nullptr;
std::atomic<bool> _sync = false;
HANDLE _event;
HANDLE _event = nullptr;
Uint64 _last_timestamp = 0;
std::vector<CliprdrFormat> _serverFormats;

View File

@@ -61,10 +61,6 @@ SdlContext::SdlContext(rdpContext* context)
/* TODO: Client display set up */
}
SdlContext::~SdlContext()
{
}
void SdlContext::setHasCursor(bool val)
{
this->_cursor_visible = val;

View File

@@ -46,7 +46,7 @@ class SdlContext
explicit SdlContext(rdpContext* context);
SdlContext(const SdlContext& other) = delete;
SdlContext(SdlContext&& other) = delete;
virtual ~SdlContext();
~SdlContext() = default;
SdlContext& operator=(const SdlContext& other) = delete;
SdlContext& operator=(SdlContext&& other) = delete;
@@ -147,9 +147,9 @@ class SdlContext
std::atomic<bool> _connected = false;
bool _cursor_visible = true;
rdpPointer* _cursor = nullptr;
std::vector<SDL_DisplayID> _monitorIds{};
std::mutex _queue_mux{};
std::queue<std::vector<SDL_Rect>> _queue{};
std::vector<SDL_DisplayID> _monitorIds;
std::mutex _queue_mux;
std::queue<std::vector<SDL_Rect>> _queue;
/* SDL */
bool _fullscreen = false;
bool _resizeable = false;
@@ -159,7 +159,7 @@ class SdlContext
std::atomic<bool> _rdpThreadRunning = false;
SDL_PixelFormat _sdlPixelFormat = SDL_PIXELFORMAT_UNKNOWN;
CriticalSection _critical{};
CriticalSection _critical;
using SDLSurfacePtr = std::unique_ptr<SDL_Surface, decltype(&SDL_DestroySurface)>;
@@ -171,8 +171,8 @@ class SdlContext
SdlConnectionDialogWrapper _dialog;
std::map<Uint32, SdlWindow> _windows{};
std::map<Uint32, SdlWindow> _windows;
WinPREvent _windowsCreatedEvent{};
std::thread _thread{};
WinPREvent _windowsCreatedEvent;
std::thread _thread;
};

View File

@@ -530,29 +530,30 @@ namespace sdl::error
}
return nullptr;
}
}
int sdl::error::errorToExitCode(DWORD error)
{
auto entry = mapEntryByError(error);
if (entry)
return entry->code;
int errorToExitCode(DWORD error)
{
auto entry = mapEntryByError(error);
if (entry)
return entry->code;
return CONN_FAILED;
}
return CONN_FAILED;
}
const char* sdl::error::errorToExitCodeTag(UINT32 error)
{
auto entry = mapEntryByError(error);
if (entry)
return entry->code_tag;
return nullptr;
}
const char* errorToExitCodeTag(UINT32 error)
{
auto entry = mapEntryByError(error);
if (entry)
return entry->code_tag;
return nullptr;
}
const char* sdl::error::exitCodeToTag(int code)
{
auto entry = mapEntryByCode(code);
if (entry)
return entry->code_tag;
return nullptr;
}
const char* exitCodeToTag(int code)
{
auto entry = mapEntryByCode(code);
if (entry)
return entry->code_tag;
return nullptr;
}
} // namespace sdl::error

View File

@@ -177,4 +177,4 @@ namespace sdl::error
[[nodiscard]] int errorToExitCode(DWORD error);
[[nodiscard]] const char* errorToExitCodeTag(UINT32 error);
[[nodiscard]] const char* exitCodeToTag(int code);
}
} // namespace sdl::error