[windows] fix deprecation and int warnings

This commit is contained in:
akallabeth
2025-03-10 17:09:35 +01:00
parent 87896e87d8
commit 918f5d5af9
2 changed files with 31 additions and 16 deletions

View File

@@ -49,6 +49,7 @@
#include <freerdp/constants.h>
#include <freerdp/settings.h>
#include <freerdp/locale/locale.h>
#include <freerdp/locale/keyboard.h>
#include <freerdp/codec/region.h>
#include <freerdp/client/cmdline.h>
@@ -211,28 +212,21 @@ static BOOL wf_desktop_resize(rdpContext* context)
static BOOL wf_pre_connect(freerdp* instance)
{
UINT32 rc;
wfContext* wfc;
UINT32 desktopWidth;
UINT32 desktopHeight;
rdpContext* context;
rdpSettings* settings;
WINPR_ASSERT(instance);
WINPR_ASSERT(instance->context);
WINPR_ASSERT(instance->context->settings);
context = instance->context;
wfc = (wfContext*)instance->context;
settings = context->settings;
rdpContext* context = instance->context;
wfContext* wfc = (wfContext*)instance->context;
rdpSettings* settings = context->settings;
if (!freerdp_settings_set_uint32(settings, FreeRDP_OsMajorType, OSMAJORTYPE_WINDOWS))
return FALSE;
if (!freerdp_settings_set_uint32(settings, FreeRDP_OsMinorType, OSMINORTYPE_WINDOWS_NT))
return FALSE;
wfc->fullscreen = freerdp_settings_get_bool(settings, FreeRDP_Fullscreen);
wfc->fullscreen_toggle = freerdp_settings_get_bool(settings, FreeRDP_ToggleFullscreen);
desktopWidth = freerdp_settings_get_uint32(settings, FreeRDP_DesktopWidth);
desktopHeight = freerdp_settings_get_uint32(settings, FreeRDP_DesktopHeight);
UINT32 desktopWidth = freerdp_settings_get_uint32(settings, FreeRDP_DesktopWidth);
UINT32 desktopHeight = freerdp_settings_get_uint32(settings, FreeRDP_DesktopHeight);
if (wfc->percentscreen > 0)
{
@@ -274,8 +268,29 @@ static BOOL wf_pre_connect(freerdp* instance)
return FALSE;
}
rc = freerdp_keyboard_init(freerdp_settings_get_uint32(settings, FreeRDP_KeyboardLayout));
if (!freerdp_settings_set_uint32(settings, FreeRDP_KeyboardLayout, rc))
uint32_t keyboardLayoutId = freerdp_settings_get_uint32(settings, FreeRDP_KeyboardLayout);
{
CHAR name[KL_NAMELENGTH + 1] = { 0 };
if (GetKeyboardLayoutNameA(name))
{
ULONG rc = 0;
errno = 0;
rc = strtoul(name, NULL, 16);
if (errno == 0)
keyboardLayoutId = rc;
}
if (keyboardLayoutId == 0)
keyboardLayoutId = ((DWORD)GetKeyboardLayout(0) >> 16) & 0x0000FFFF;
}
if (keyboardLayoutId == 0)
freerdp_detect_keyboard_layout_from_system_locale(&keyboardLayoutId);
if (keyboardLayoutId == 0)
keyboardLayoutId = ENGLISH_UNITED_STATES;
if (!freerdp_settings_set_uint32(settings, FreeRDP_KeyboardLayout, keyboardLayoutId))
return FALSE;
PubSub_SubscribeChannelConnected(instance->context->pubSub, wf_OnChannelConnectedEventHandler);
PubSub_SubscribeChannelDisconnected(instance->context->pubSub,

View File

@@ -2964,7 +2964,7 @@ static int ncrush_generate_tables(NCRUSH_CONTEXT* context)
size_t k = 0;
for (BYTE i = 0; i < 16; i++)
{
for (size_t j = 0; j < 1 << CopyOffsetBitsLUT[i]; j++)
for (size_t j = 0; j < (1ULL << CopyOffsetBitsLUT[i]); j++)
{
size_t l = k++ + 2ull;
context->HuffTableCopyOffset[l] = i;
@@ -2977,7 +2977,7 @@ static int ncrush_generate_tables(NCRUSH_CONTEXT* context)
{
const UINT32 lut = CopyOffsetBitsLUT[i];
WINPR_ASSERT(lut >= 7);
for (size_t j = 0; j < 1 << (lut - 7); j++)
for (size_t j = 0; j < 1ULL << (lut - 7ULL); j++)
{
size_t l = k++ + 2 + 256ull;
context->HuffTableCopyOffset[l] = i;