[warnings] fix SDL3 related issues

This commit is contained in:
akallabeth 2024-08-29 16:00:42 +02:00
parent cc626276d0
commit 500495dc00
No known key found for this signature in database
GPG Key ID: A49454A3FC909FD5
27 changed files with 67 additions and 91 deletions

View File

@ -19,6 +19,7 @@
*/
#include <cassert>
#include <utility>
#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)
{
}

View File

@ -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;
};

View File

@ -29,7 +29,6 @@ class SdlButtonList
SdlButtonList(const SdlButtonList& other) = delete;
SdlButtonList(SdlButtonList&& other) = delete;
private:
std::vector<SdlButton> _list;
SdlButton* _highlighted = nullptr;
size_t _highlight_index = 0;

View File

@ -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;
};

View File

@ -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"

View File

@ -22,6 +22,7 @@
#include <cassert>
#include <string>
#include <utility>
#include <SDL3/SDL.h>
#include <SDL3_ttf/SDL_ttf.h>
@ -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<float>(offset * (height + vpadding)), static_cast<float>(width),
static_cast<float>(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)
{

View File

@ -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;

View File

@ -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<SdlInputWidget> _list;

View File

@ -20,6 +20,7 @@
#include <cassert>
#include <string>
#include <utility>
#include <SDL3/SDL.h>
#include <SDL3_ttf/SDL_ttf.h>
@ -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);
}

View File

@ -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;

View File

@ -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<SdlSelectWidget> _list;

View File

@ -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;

View File

@ -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;

View File

@ -22,6 +22,7 @@
#include <mutex>
#include <iterator>
#include <algorithm>
#include <utility>
#include <winpr/wlog.h>
@ -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<BYTE> sdlClip::ReceiveFormatDataRequestHandle(
len = 0;
auto localFormatId = formatId = formatDataRequest->requestedFormatId;
ClipboardLockGuard(clipboard->_system);
ClipboardLockGuard give_me_a_name(clipboard->_system);
std::lock_guard<CriticalSection> 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<CliprdrFileContext*>(context->custom)));
WINPR_ASSERT(clipboard);
ClipboardLockGuard(clipboard->_system);
ClipboardLockGuard give_me_a_name(clipboard->_system);
std::lock_guard<CriticalSection> 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<CriticalSection> 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<CriticalSection> 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<sdlClip*>(userdata);
WINPR_ASSERT(clip);
ClipboardLockGuard(clip->_system);
ClipboardLockGuard give_me_a_name(clip->_system);
std::lock_guard<CriticalSection> 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))
{
}

View File

@ -20,6 +20,7 @@
#pragma once
#include <utility>
#include <vector>
#include <atomic>
#include <queue>
@ -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<void> p) : size(len), ptr(p)
cache_entry(size_t len, std::shared_ptr<void> p) : size(len), ptr(std::move(p))
{
}

View File

@ -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;

View File

@ -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();

View File

@ -83,7 +83,6 @@ class SdlContext
std::atomic<bool> rdp_thread_running;
public:
BOOL update_resizeable(BOOL enable);
BOOL update_fullscreen(BOOL enter);

View File

@ -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);

View File

@ -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<uint32_t, uint32_t> _remapList;

View File

@ -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;
}

View File

@ -40,7 +40,7 @@ class CriticalSection
void unlock();
private:
CRITICAL_SECTION _section;
CRITICAL_SECTION _section{};
};
class WinPREvent

View File

@ -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;

View File

@ -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;
};

View File

@ -69,6 +69,8 @@
#include <freerdp/log.h>
#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);

View File

@ -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)
{
}

View File

@ -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;