Fixed compilation warnings

Try to get the number of warnings down
This commit is contained in:
Armin Novak 2021-07-28 15:18:03 +02:00 committed by akallabeth
parent 0c81c73c8d
commit 610396e197
55 changed files with 277 additions and 239 deletions

View File

@ -250,7 +250,7 @@ static FREERDP_ADDIN** freerdp_channels_list_dynamic_addins(LPCSTR pszName, LPCS
/* <name>-client.<extension> */
p[0] = FindData.cFileName;
p[1] = strchr(p[0], '-') + 1;
strncpy(pAddin->cName, p[0], (p[1] - p[0]) - 1);
strncpy(pAddin->cName, p[0], (size_t)((p[1] - p[0]) - 1));
pAddin->dwFlags = FREERDP_ADDIN_CLIENT;
pAddin->dwFlags |= FREERDP_ADDIN_DYNAMIC;
pAddin->dwFlags |= FREERDP_ADDIN_NAME;
@ -263,8 +263,8 @@ static FREERDP_ADDIN** freerdp_channels_list_dynamic_addins(LPCSTR pszName, LPCS
p[1] = strchr(p[0], '-') + 1;
p[2] = strchr(p[1], '-') + 1;
p[3] = strchr(p[2], '.') + 1;
strncpy(pAddin->cName, p[0], (p[1] - p[0]) - 1);
strncpy(pAddin->cSubsystem, p[2], (p[3] - p[2]) - 1);
strncpy(pAddin->cName, p[0], (size_t)((p[1] - p[0]) - 1));
strncpy(pAddin->cSubsystem, p[2], (size_t)((p[3] - p[2]) - 1));
pAddin->dwFlags = FREERDP_ADDIN_CLIENT;
pAddin->dwFlags |= FREERDP_ADDIN_DYNAMIC;
pAddin->dwFlags |= FREERDP_ADDIN_NAME;
@ -279,9 +279,9 @@ static FREERDP_ADDIN** freerdp_channels_list_dynamic_addins(LPCSTR pszName, LPCS
p[2] = strchr(p[1], '-') + 1;
p[3] = strchr(p[2], '-') + 1;
p[4] = strchr(p[3], '.') + 1;
strncpy(pAddin->cName, p[0], (p[1] - p[0]) - 1);
strncpy(pAddin->cSubsystem, p[2], (p[3] - p[2]) - 1);
strncpy(pAddin->cType, p[3], (p[4] - p[3]) - 1);
strncpy(pAddin->cName, p[0], (size_t)((p[1] - p[0]) - 1));
strncpy(pAddin->cSubsystem, p[2], (size_t)((p[3] - p[2]) - 1));
strncpy(pAddin->cType, p[3], (size_t)((p[4] - p[3]) - 1));
pAddin->dwFlags = FREERDP_ADDIN_CLIENT;
pAddin->dwFlags |= FREERDP_ADDIN_DYNAMIC;
pAddin->dwFlags |= FREERDP_ADDIN_NAME;

View File

@ -376,7 +376,7 @@ BOOL rdpei_write_4byte_signed(wStream* s, INT32 value)
BOOL rdpei_read_8byte_unsigned(wStream* s, UINT64* value)
{
BYTE byte;
UINT64 byte;
BYTE count;
if (Stream_GetRemainingLength(s) < 1)
@ -396,85 +396,85 @@ BOOL rdpei_read_8byte_unsigned(wStream* s, UINT64* value)
break;
case 1:
*value = (byte & 0x1F) << 8;
*value = (byte & 0x1FU) << 8U;
Stream_Read_UINT8(s, byte);
*value |= byte;
break;
case 2:
*value = (byte & 0x1F) << 16;
*value = (byte & 0x1FU) << 16U;
Stream_Read_UINT8(s, byte);
*value |= (byte << 8);
*value |= (byte << 8U);
Stream_Read_UINT8(s, byte);
*value |= byte;
break;
case 3:
*value = (byte & 0x1F) << 24;
*value = (byte & 0x1FU) << 24U;
Stream_Read_UINT8(s, byte);
*value |= (byte << 16);
*value |= (byte << 16U);
Stream_Read_UINT8(s, byte);
*value |= (byte << 8);
*value |= (byte << 8U);
Stream_Read_UINT8(s, byte);
*value |= byte;
break;
case 4:
*value = ((UINT64)(byte & 0x1F)) << 32;
*value = ((byte & 0x1FU)) << 32U;
Stream_Read_UINT8(s, byte);
*value |= (byte << 24);
*value |= (byte << 24U);
Stream_Read_UINT8(s, byte);
*value |= (byte << 16);
*value |= (byte << 16U);
Stream_Read_UINT8(s, byte);
*value |= (byte << 8);
*value |= (byte << 8U);
Stream_Read_UINT8(s, byte);
*value |= byte;
break;
case 5:
*value = ((UINT64)(byte & 0x1F)) << 40;
*value = ((byte & 0x1FU)) << 40U;
Stream_Read_UINT8(s, byte);
*value |= (((UINT64)byte) << 32);
*value |= ((byte) << 32U);
Stream_Read_UINT8(s, byte);
*value |= (byte << 24);
*value |= (byte << 24U);
Stream_Read_UINT8(s, byte);
*value |= (byte << 16);
*value |= (byte << 16U);
Stream_Read_UINT8(s, byte);
*value |= (byte << 8);
*value |= (byte << 8U);
Stream_Read_UINT8(s, byte);
*value |= byte;
break;
case 6:
*value = ((UINT64)(byte & 0x1F)) << 48;
*value = ((byte & 0x1FU)) << 48U;
Stream_Read_UINT8(s, byte);
*value |= (((UINT64)byte) << 40);
*value |= ((byte) << 40U);
Stream_Read_UINT8(s, byte);
*value |= (((UINT64)byte) << 32);
*value |= ((byte) << 32U);
Stream_Read_UINT8(s, byte);
*value |= (byte << 24);
*value |= (byte << 24U);
Stream_Read_UINT8(s, byte);
*value |= (byte << 16);
*value |= (byte << 16U);
Stream_Read_UINT8(s, byte);
*value |= (byte << 8);
*value |= (byte << 8U);
Stream_Read_UINT8(s, byte);
*value |= byte;
break;
case 7:
*value = ((UINT64)(byte & 0x1F)) << 56;
*value = ((byte & 0x1FU)) << 56U;
Stream_Read_UINT8(s, byte);
*value |= (((UINT64)byte) << 48);
*value |= ((byte) << 48U);
Stream_Read_UINT8(s, byte);
*value |= (((UINT64)byte) << 40);
*value |= ((byte) << 40U);
Stream_Read_UINT8(s, byte);
*value |= (((UINT64)byte) << 32);
*value |= ((byte) << 32U);
Stream_Read_UINT8(s, byte);
*value |= (byte << 24);
*value |= (byte << 24U);
Stream_Read_UINT8(s, byte);
*value |= (byte << 16);
*value |= (byte << 16U);
Stream_Read_UINT8(s, byte);
*value |= (byte << 8);
*value |= (byte << 8U);
Stream_Read_UINT8(s, byte);
*value |= byte;
break;

View File

@ -85,7 +85,7 @@ static void request_free(void* value);
static struct libusb_transfer* list_contains(wArrayList* list, UINT32 streamID)
{
int x, count;
size_t x, count;
if (!list)
return NULL;
count = ArrayList_Count(list);
@ -204,9 +204,13 @@ static ASYNC_TRANSFER_USER_DATA* async_transfer_user_data_new(IUDEVICE* idev, UI
BOOL NoAck, t_isoch_transfer_cb cb,
URBDRC_CHANNEL_CALLBACK* callback)
{
ASYNC_TRANSFER_USER_DATA* user_data = calloc(1, sizeof(ASYNC_TRANSFER_USER_DATA));
ASYNC_TRANSFER_USER_DATA* user_data;
UDEVICE* pdev = (UDEVICE*)idev;
if (BufferSize > UINT32_MAX)
return NULL;
user_data = calloc(1, sizeof(ASYNC_TRANSFER_USER_DATA));
if (!user_data)
return NULL;
@ -222,7 +226,7 @@ static ASYNC_TRANSFER_USER_DATA* async_transfer_user_data_new(IUDEVICE* idev, UI
if (data)
memcpy(Stream_Pointer(user_data->data), data, BufferSize);
else
user_data->OutputBufferSize = BufferSize;
user_data->OutputBufferSize = (UINT32)BufferSize;
user_data->noack = NoAck;
user_data->cb = cb;
@ -1382,7 +1386,7 @@ static int func_cancel_xact_request(URBDRC_PLUGIN* urbdrc, struct libusb_transfe
static void libusb_udev_cancel_all_transfer_request(IUDEVICE* idev)
{
UDEVICE* pdev = (UDEVICE*)idev;
int count, x;
size_t count, x;
if (!pdev || !pdev->request_queue || !pdev->urbdrc)
return;

View File

@ -307,7 +307,7 @@ static int xf_tsmf_xv_video_frame_event(TsmfClientContext* tsmf, TSMF_VIDEO_FRAM
return 1;
}
int xf_tsmf_xv_init(xfContext* xfc, TsmfClientContext* tsmf)
static int xf_tsmf_xv_init(xfContext* xfc, TsmfClientContext* tsmf)
{
int ret;
unsigned int i;
@ -424,7 +424,7 @@ int xf_tsmf_xv_init(xfContext* xfc, TsmfClientContext* tsmf)
return 1;
}
int xf_tsmf_xv_uninit(xfContext* xfc, TsmfClientContext* tsmf)
static int xf_tsmf_xv_uninit(xfContext* xfc, TsmfClientContext* tsmf)
{
xfXvContext* xv = (xfXvContext*)xfc->xv_context;

View File

@ -503,6 +503,7 @@ static DWORD client_cli_accept_certificate(rdpSettings* settings)
* @param host_mismatch Indicates the certificate host does not match.
* @return 1 if the certificate is trusted, 2 if temporary trusted, 0 otherwise.
*/
#if defined(WITH_FREERDP_DEPRECATED)
DWORD client_cli_verify_certificate(freerdp* instance, const char* common_name, const char* subject,
const char* issuer, const char* fingerprint, BOOL host_mismatch)
{
@ -519,6 +520,7 @@ DWORD client_cli_verify_certificate(freerdp* instance, const char* common_name,
"Please look at the OpenSSL documentation on how to add a private CA to the store.\n");
return client_cli_accept_certificate(instance->settings);
}
#endif
/** Callback set in the rdp_freerdp structure, and used to make a certificate validation
* when the connection requires it.
@ -583,6 +585,7 @@ DWORD client_cli_verify_certificate_ex(freerdp* instance, const char* host, UINT
* @param old_fingerprint
* @return 1 if the certificate is trusted, 2 if temporary trusted, 0 otherwise.
*/
#if defined(WITH_FREERDP_DEPRECATED)
DWORD client_cli_verify_changed_certificate(freerdp* instance, const char* common_name,
const char* subject, const char* issuer,
const char* fingerprint, const char* old_subject,
@ -610,6 +613,7 @@ DWORD client_cli_verify_changed_certificate(freerdp* instance, const char* commo
"Please contact the administrator of the RDP server and clarify.\n");
return client_cli_accept_certificate(instance->settings);
}
#endif
/** Callback set in the rdp_freerdp structure, and used to make a certificate validation
* when a stored certificate does not match the remote counterpart.

View File

@ -287,7 +287,7 @@ static int freerdp_client_old_command_line_pre_filter(void* context, int index,
if (strcmp("--plugin", argv[index]) == 0)
{
int args_handled = 0;
int length;
size_t length;
char *a, *p;
int i, j, t;
int old_index;
@ -341,7 +341,7 @@ static int freerdp_client_old_command_line_pre_filter(void* context, int index,
if (p != NULL)
{
length = (int)(p - a);
length = (size_t)(p - a);
if (!freerdp_addin_argv_add_argument_ex(args, a, length))
{

View File

@ -213,7 +213,7 @@ static test tests[] = {
#endif
};
void check_modified_arguments(test* test, char** command_line, int* rc)
static void check_modified_arguments(test* test, char** command_line, int* rc)
{
int k;
const char* expected_argument;

View File

@ -46,7 +46,7 @@ extern "C"
FREERDP_API BOOL per_read_enumerated(wStream* s, BYTE* enumerated, BYTE count);
FREERDP_API BOOL per_write_enumerated(wStream* s, BYTE enumerated, BYTE count);
FREERDP_API BOOL per_write_object_identifier(wStream* s, const BYTE oid[6]);
FREERDP_API BOOL per_read_object_identifier(wStream* s, BYTE oid[6]);
FREERDP_API BOOL per_read_object_identifier(wStream* s, const BYTE oid[6]);
FREERDP_API BOOL per_read_octet_string(wStream* s, BYTE* oct_str, UINT16 length, UINT16 min);
FREERDP_API BOOL per_write_octet_string(wStream* s, const BYTE* oct_str, UINT16 length,
UINT16 min);

View File

@ -384,10 +384,12 @@ void nsc_context_free(NSC_CONTEXT* context)
free(context);
}
#if defined(WITH_FREERDP_DEPRECATED)
BOOL nsc_context_set_pixel_format(NSC_CONTEXT* context, UINT32 pixel_format)
{
return nsc_context_set_parameters(context, NSC_COLOR_FORMAT, pixel_format);
}
#endif
BOOL nsc_context_set_parameters(NSC_CONTEXT* context, NSC_PARAMETER what, UINT32 value)
{

View File

@ -3100,7 +3100,7 @@ static const BYTE TEST_RLE_BITMAP_EXPERIMENTAL_03[16384] =
"\x57\xCD\x98\xFF\x57\xCD\x98\xFF\x56\xCD\x98\xFF\x57\xCD\x98\xFF\x57\xCD\x98\xFF\x57\xCD\x98"
"\xFF\x56\xCB\x96\xFF\x51\xB7\x88\xFF";
BYTE TEST_RLE_BITMAP_EXPERIMENTAL_03_RLE[11160] =
static const BYTE TEST_RLE_BITMAP_EXPERIMENTAL_03_RLE[11160] =
"\x30\xF0\x23\x1F\x1E\x1D\x1D\x1E\x1D\x1F\x23\x4A\x78\x71\x64\x58\x4B\xF0\x3E\x30\x29\x26\x24"
"\x22\x21\x20\x20\x20\x1D\x1E\x20\x1E"
"\x1F\x86\x20\x20\x1F\x20\x21\x22\x1E\x1F\xF0\x1E\x1D\x1F\x20\x1F\x1F\x1F\x1E\x1E\x1F\x1F\x20"
@ -3800,7 +3800,7 @@ BYTE TEST_RLE_BITMAP_EXPERIMENTAL_03_RLE[11160] =
"\x37\x2D\x1F\x11\x03\x00\x00\x00\x02\x24\x02\x00\x23\x02\x00\x80\x02\x02\x00\x02\x02\x12\x2E"
"\x3C";
BYTE TEST_64X64_RED_PLANE[4096] =
static const BYTE TEST_64X64_RED_PLANE[4096] =
"\x23\x1F\x1E\x1D\x1D\x1E\x1D\x1F\x23\x4A\x78\x71\x64\x58\x4B\x3E\x30\x29\x26\x24\x22\x21\x20"
"\x20\x20\x1D\x1E\x20\x1E\x1F\x20\x20"
"\x1F\x20\x21\x22\x1E\x1F\x1F\x1F\x1F\x1F\x1F\x1F\x1E\x1D\x1F\x20\x1F\x1F\x1F\x1E\x1E\x1F\x1F"
@ -4058,7 +4058,7 @@ BYTE TEST_64X64_RED_PLANE[4096] =
"\x24\x25\x29\x2D\x43\x59\x6E\x81\x93\x98\x98\x98\x98\x98\x98\x98\x97\x98\x98\x98\x98\x98\x98"
"\x98\x98\x98\x98\x98\x98\x98\x96\x88";
BYTE TEST_64X64_RED_PLANE_RLE[3739] =
static const BYTE TEST_64X64_RED_PLANE_RLE[3739] =
"\xF0\x23\x1F\x1E\x1D\x1D\x1E\x1D\x1F\x23\x4A\x78\x71\x64\x58\x4B\xF0\x3E\x30\x29\x26\x24\x22"
"\x21\x20\x20\x20\x1D\x1E\x20\x1E\x1F"
"\x86\x20\x20\x1F\x20\x21\x22\x1E\x1F\xF0\x1E\x1D\x1F\x20\x1F\x1F\x1F\x1E\x1E\x1F\x1F\x20\x1E"
@ -4294,7 +4294,7 @@ BYTE TEST_64X64_RED_PLANE_RLE[3739] =
"\xF0\x0D\x15\x19\x41\x69\x93\x89\x71\x51\x2D\x09\x02\x02\x00\x02\x2A\x02\x00\x70\x02\x00\x02"
"\x04\x26\x70\x8C";
BYTE TEST_64X64_GREEN_PLANE[4096] =
static const BYTE TEST_64X64_GREEN_PLANE[4096] =
"\x2A\x25\x23\x23\x23\x23\x23\x24\x2B\x60\xA2\x97\x84\x75\x62\x50\x3C\x34\x30\x2C\x29\x28\x26"
"\x25\x25\x23\x23\x25\x24\x24\x25\x25"
"\x25\x25\x26\x27\x25\x24\x25\x25\x27\x24\x24\x24\x24\x24\x25\x25\x24\x25\x26\x25\x23\x24\x24"
@ -4552,7 +4552,7 @@ BYTE TEST_64X64_GREEN_PLANE[4096] =
"\x2A\x2C\x31\x38\x57\x74\x91\xAD\xC7\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCC\xCD\xCD\xCD\xCD\xCD\xCD"
"\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCB\xB7";
BYTE TEST_64X64_GREEN_PLANE_RLE[3696] =
static const BYTE TEST_64X64_GREEN_PLANE_RLE[3696] =
"\x34\x2A\x25\x23\xF0\x24\x2B\x60\xA2\x97\x84\x75\x62\x50\x3C\x34\x30\x2C\x29\x28\x93\x26\x25"
"\x25\x23\x23\x25\x24\x24\x25\x84\x26"
"\x27\x25\x24\x25\x25\x27\x24\xC3\x25\x25\x24\x25\x26\x25\x23\x24\x24\x25\x23\x24\x30\x22\x23"
@ -4785,7 +4785,7 @@ BYTE TEST_64X64_GREEN_PLANE_RLE[3696] =
"\xF0\x13\x19\x29\x5B\x97\xCF\xC1\xA1"
"\x75\x3F\x0B\x02\x02\x00\x02\x2C\x02\x00\x50\x02\x06\x36\x9C\xC4";
BYTE TEST_64X64_BLUE_PLANE[4096] =
static const BYTE TEST_64X64_BLUE_PLANE[4096] =
"\x27\x23\x23\x24\x25\x25\x25\x25\x28\x37\x4A\x47\x41\x3D\x38\x33\x2E\x2A\x28\x27\x26\x27\x27"
"\x27\x25\x24\x26\x28\x26\x27\x28\x28"
"\x26\x28\x28\x2A\x26\x27\x27\x28\x27\x27\x25\x26\x24\x25\x27\x28\x27\x28\x27\x27\x25\x26\x27"
@ -5043,7 +5043,7 @@ BYTE TEST_64X64_BLUE_PLANE[4096] =
"\x28\x28\x2A\x2C\x35\x3E\x46\x4E\x55\x57\x57\x57\x57\x57\x57\x57\x56\x57\x57\x57\x57\x57\x57"
"\x57\x57\x57\x56\x57\x57\x57\x56\x51";
BYTE TEST_64X64_BLUE_PLANE_RLE[3724] =
static const BYTE TEST_64X64_BLUE_PLANE_RLE[3724] =
"\x53\x27\x23\x23\x24\x25\xF0\x28\x37\x4A\x47\x41\x3D\x38\x33\x2E\x2A\x28\x27\x26\x27\x27\xF0"
"\x27\x25\x24\x26\x28\x26\x27\x28\x28"
"\x26\x28\x28\x2A\x26\x27\xF0\x27\x28\x27\x27\x25\x26\x24\x25\x27\x28\x27\x28\x27\x27\x25\xB0"

View File

@ -42,7 +42,7 @@ static const BYTE TEST_ISLAND_DATA_XCRUSH[] =
"\x03\xbb\x43\x7b\x6f\xa8\xe5\x8b\xd0\xf0\xe8\xde\xd8\xd8\xe7\xec"
"\xf3\xa7\xe4\x7c\xa7\xe2\x9f\x01\x99\x4b\x80";
int test_XCrushCompressBells()
static int test_XCrushCompressBells(void)
{
int status;
UINT32 Flags;
@ -89,7 +89,7 @@ int test_XCrushCompressBells()
return 1;
}
int test_XCrushCompressIsland()
static int test_XCrushCompressIsland(void)
{
int status;
UINT32 Flags;

View File

@ -837,6 +837,7 @@ void freerdp_update_gateway_usage_method(rdpSettings* settings, UINT32 GatewayEn
freerdp_set_gateway_usage_method(settings, GatewayUsageMethod);
}
#if defined(WITH_FREERDP_DEPRECATED)
BOOL freerdp_get_param_bool(const rdpSettings* settings, int id)
{
return freerdp_settings_get_bool(settings, (size_t)id);
@ -886,6 +887,7 @@ int freerdp_set_param_string(rdpSettings* settings, int id, const char* param)
{
return freerdp_settings_set_string(settings, (size_t)id, param) ? 0 : -1;
}
#endif
static BOOL value_to_uint(const char* value, ULONGLONG* result, ULONGLONG min, ULONGLONG max)
{
@ -1263,6 +1265,7 @@ UINT32 freerdp_settings_get_codecs_flags(const rdpSettings* settings)
return flags;
}
#if defined(WITH_FREERDP_DEPRECATED)
ADDIN_ARGV* freerdp_static_channel_clone(ADDIN_ARGV* channel)
{
return freerdp_addin_argv_clone(channel);
@ -1272,3 +1275,4 @@ ADDIN_ARGV* freerdp_dynamic_channel_clone(ADDIN_ARGV* channel)
{
return freerdp_addin_argv_clone(channel);
}
#endif

View File

@ -191,10 +191,10 @@ static DWORD rdp_version_common(DWORD serverVersion, DWORD clientVersion)
* { itu-t(0) recommendation(0) t(20) t124(124) version(0) 1 }
* v.1 of ITU-T Recommendation T.124 (Feb 1998): "Generic Conference Control"
*/
BYTE t124_02_98_oid[6] = { 0, 0, 20, 124, 0, 1 };
static const BYTE t124_02_98_oid[6] = { 0, 0, 20, 124, 0, 1 };
BYTE h221_cs_key[4] = "Duca";
BYTE h221_sc_key[4] = "McDn";
static const BYTE h221_cs_key[4] = "Duca";
static const BYTE h221_sc_key[4] = "McDn";
/**
* Read a GCC Conference Create Request.\n

View File

@ -347,7 +347,7 @@ BOOL per_write_enumerated(wStream* s, BYTE enumerated, BYTE count)
* @return
*/
BOOL per_read_object_identifier(wStream* s, BYTE oid[6])
BOOL per_read_object_identifier(wStream* s, const BYTE oid[6])
{
BYTE t12;
UINT16 length;

View File

@ -62,7 +62,7 @@ fail:
return rc;
}
int test_gdi_FillRect(void)
static int test_gdi_FillRect(void)
{
int rc = -1;
HGDI_DC hdc = NULL;

View File

@ -50,7 +50,7 @@ struct LanguageIdentifier
const char* SublanguageSymbol;
};
const struct LanguageIdentifier language_identifiers[] = {
static const struct LanguageIdentifier language_identifiers[] = {
/* [Language identifier] [Primary language] [Prim. lang. identifier] [Prim.
lang. symbol] [Sublanguage] [Sublang. identifier] [Sublang. symbol] */
{ "", 0xc00, "Default custom locale language", 0x0, "LANG_NEUTRAL",

View File

@ -76,23 +76,23 @@ static void fatal_handler(int signum)
raise(signum);
}
const int fatal_signals[] = { SIGABRT, SIGALRM, SIGBUS, SIGFPE, SIGHUP, SIGILL,
SIGINT, SIGKILL, SIGQUIT, SIGSEGV, SIGSTOP, SIGTERM,
SIGTSTP, SIGTTIN, SIGTTOU, SIGUSR1, SIGUSR2,
static const int fatal_signals[] = { SIGABRT, SIGALRM, SIGBUS, SIGFPE, SIGHUP, SIGILL,
SIGINT, SIGKILL, SIGQUIT, SIGSEGV, SIGSTOP, SIGTERM,
SIGTSTP, SIGTTIN, SIGTTOU, SIGUSR1, SIGUSR2,
#ifdef SIGPOLL
SIGPOLL,
SIGPOLL,
#endif
#ifdef SIGPROF
SIGPROF,
SIGPROF,
#endif
#ifdef SIGSYS
SIGSYS,
SIGSYS,
#endif
SIGTRAP,
SIGTRAP,
#ifdef SIGVTALRM
SIGVTALRM,
SIGVTALRM,
#endif
SIGXCPU, SIGXFSZ };
SIGXCPU, SIGXFSZ };
int freerdp_handle_signals(void)
{

View File

@ -168,10 +168,10 @@ static int shadow_encoder_init_nsc(rdpShadowEncoder* encoder)
settings->NSCodecColorLossLevel))
goto fail;
if (!nsc_context_set_parameters(encoder->nsc, NSC_ALLOW_SUBSAMPLING,
settings->NSCodecAllowSubsampling))
(UINT32)settings->NSCodecAllowSubsampling))
goto fail;
if (!nsc_context_set_parameters(encoder->nsc, NSC_DYNAMIC_COLOR_FIDELITY,
settings->NSCodecAllowDynamicColorFidelity))
(UINT32)settings->NSCodecAllowDynamicColorFidelity))
goto fail;
if (!nsc_context_set_parameters(encoder->nsc, NSC_COLOR_FORMAT, PIXEL_FORMAT_BGRX32))
goto fail;

View File

@ -84,7 +84,7 @@ static void cb_shm_format(void* data, struct wl_shm* wl_shm, uint32_t format)
d->shm_formats[d->shm_formats_nb - 1] = format;
}
struct wl_shm_listener shm_listener = { cb_shm_format };
static struct wl_shm_listener shm_listener = { cb_shm_format };
static void xdg_shell_ping(void* data, struct xdg_wm_base* xdg_wm_base, uint32_t serial)
{

View File

@ -87,7 +87,7 @@ static void on_buffer_release(void* data, struct wl_buffer* wl_buffer)
wl_buffer_destroy(wl_buffer);
}
const struct wl_buffer_listener buffer_release_listener = { on_buffer_release };
static const struct wl_buffer_listener buffer_release_listener = { on_buffer_release };
static UwacReturnCode set_cursor_image(UwacSeat* seat, uint32_t serial)
{

View File

@ -98,6 +98,7 @@ void CommLog_Print(DWORD wlog_level, ...);
BOOL CommIsHandled(HANDLE handle);
BOOL CommCloseHandle(HANDLE handle);
HANDLE_CREATOR* GetCommHandleCreator(void);
#ifndef WITH_EVENTFD_READ_WRITE
int eventfd_read(int fd, eventfd_t* value);

View File

@ -16,7 +16,7 @@
#define WINPR_TOUPPERW(_wch) \
(_wch + winpr_casemap_upper[winpr_casemap_upper[_wch >> 8] + (_wch & 0xFF)])
const WCHAR winpr_casemap_lower[3807] = {
static const WCHAR winpr_casemap_lower[3807] = {
/* index */
0x01bf, 0x02bf, 0x03bf, 0x044f, 0x054f, 0x064f, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
0x0100, 0x0100, 0x0100, 0x0100, 0x06af, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
@ -361,7 +361,7 @@ const WCHAR winpr_casemap_lower[3807] = {
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
};
const WCHAR winpr_casemap_upper[3994] = {
static const WCHAR winpr_casemap_upper[3994] = {
/* index */
0x019f, 0x029f, 0x039f, 0x045a, 0x0556, 0x0656, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,

View File

@ -43,6 +43,10 @@
* HMAC
*/
#ifdef WITH_OPENSSL
extern const EVP_MD* winpr_openssl_get_evp_md(WINPR_MD_TYPE md);
#endif
#ifdef WITH_OPENSSL
const EVP_MD* winpr_openssl_get_evp_md(WINPR_MD_TYPE md)
{

View File

@ -28,8 +28,8 @@
static int status = 0;
LONG* pLoopCount = NULL;
BOOL bStopTest = FALSE;
static LONG* pLoopCount = NULL;
static BOOL bStopTest = FALSE;
static DWORD WINAPI test_error_thread(LPVOID arg)
{

View File

@ -320,7 +320,7 @@ static DWORD FileGetFileSize(HANDLE Object, LPDWORD lpFileSizeHigh)
if (lpFileSizeHigh)
*lpFileSizeHigh = (UINT32)(size >> 32);
return size & 0xFFFFFFFFUL;
return (UINT32)(size & 0xFFFFFFFF);
}
static BOOL FileLockFileEx(HANDLE hFile, DWORD dwFlags, DWORD dwReserved,
@ -653,7 +653,7 @@ static const char* FileGetMode(DWORD dwDesiredAccess, DWORD dwCreationDispositio
UINT32 map_posix_err(int fs_errno)
{
UINT32 rc;
NTSTATUS rc;
/* try to return NTSTATUS version of error code */
@ -702,7 +702,7 @@ UINT32 map_posix_err(int fs_errno)
break;
}
return rc;
return (UINT32)rc;
}
static HANDLE FileCreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode,
@ -868,7 +868,7 @@ static BOOL IsFileDevice(LPCTSTR lpDeviceName)
return TRUE;
}
HANDLE_CREATOR _FileHandleCreator = { IsFileDevice, FileCreateFileA };
static HANDLE_CREATOR _FileHandleCreator = { IsFileDevice, FileCreateFileA };
HANDLE_CREATOR* GetFileHandleCreator(void)
{

View File

@ -186,7 +186,7 @@ static pthread_once_t _HandleCreatorsInitialized = PTHREAD_ONCE_INIT;
extern HANDLE_CREATOR* GetNamedPipeClientHandleCreator(void);
#if defined __linux__ && !defined ANDROID
extern HANDLE_CREATOR* GetCommHandleCreator(void);
#include "../comm/comm.h"
#endif /* __linux__ && !defined ANDROID */
static void _HandleCreatorsInit()

View File

@ -235,6 +235,7 @@ static HANDLE NamedPipeClientCreateFileA(LPCSTR lpFileName, DWORD dwDesiredAcces
return hNamedPipe;
}
extern HANDLE_CREATOR* GetNamedPipeClientHandleCreator(void);
HANDLE_CREATOR* GetNamedPipeClientHandleCreator(void)
{
_NamedPipeClientHandleCreator.IsHandled = IsNamedPipeFileNameA;

View File

@ -33,7 +33,7 @@
* Mac OS X
*/
DWORD KEYCODE_TO_VKCODE_APPLE[256] = {
static DWORD KEYCODE_TO_VKCODE_APPLE[256] = {
0, /* 0 */
0, /* 1 */
0, /* 2 */
@ -301,7 +301,7 @@ DWORD KEYCODE_TO_VKCODE_APPLE[256] = {
/* TODO: Finish Japanese Keyboard */
DWORD KEYCODE_TO_VKCODE_EVDEV[256] = {
static DWORD KEYCODE_TO_VKCODE_EVDEV[256] = {
0, /* 0 */
0, /* 1 */
0, /* 2 */

View File

@ -135,7 +135,7 @@ DWORD GetVirtualKeyCodeFromVirtualScanCode(DWORD scancode, DWORD dwKeyboardType)
DWORD GetVirtualScanCodeFromVirtualKeyCode(DWORD vkcode, DWORD dwKeyboardType)
{
int i;
size_t i;
DWORD scancode;
DWORD codeIndex;

View File

@ -302,7 +302,7 @@ struct _XKB_KEYNAME
};
typedef struct _XKB_KEYNAME XKB_KEYNAME;
XKB_KEYNAME XKB_KEYNAME_TABLE[] = {
static XKB_KEYNAME XKB_KEYNAME_TABLE[] = {
{ "BKSP", VK_BACK },
{ "TAB", VK_TAB },
{ "RTRN", VK_RETURN },

View File

@ -154,7 +154,7 @@ static BOOL PipeRead(PVOID Object, LPVOID lpBuffer, DWORD nNumberOfBytesToRead,
}
if (lpNumberOfBytesRead)
*lpNumberOfBytesRead = io_status;
*lpNumberOfBytesRead = (DWORD)io_status;
return status;
}
@ -182,7 +182,7 @@ static BOOL PipeWrite(PVOID Object, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrit
if ((io_status < 0) && (errno == EWOULDBLOCK))
io_status = 0;
*lpNumberOfBytesWritten = io_status;
*lpNumberOfBytesWritten = (DWORD)io_status;
return TRUE;
}
@ -308,7 +308,7 @@ BOOL NamedPipeRead(PVOID Object, LPVOID lpBuffer, DWORD nNumberOfBytesToRead,
}
if (lpNumberOfBytesRead)
*lpNumberOfBytesRead = io_status;
*lpNumberOfBytesRead = (DWORD)io_status;
}
else
{
@ -395,7 +395,7 @@ BOOL NamedPipeWrite(PVOID Object, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite,
}
}
*lpNumberOfBytesWritten = io_status;
*lpNumberOfBytesWritten = (DWORD)io_status;
return status;
}
else

View File

@ -42,7 +42,7 @@ static BOOL CALLBACK init_module(PINIT_ONCE once, PVOID param, PVOID* context)
}
#endif
BOOL CallbackMayRunLong(PTP_CALLBACK_INSTANCE pci)
BOOL winpr_CallbackMayRunLong(PTP_CALLBACK_INSTANCE pci)
{
#ifdef _WIN32
InitOnceExecuteOnce(&init_once_module, init_module, NULL, NULL);

View File

@ -244,8 +244,8 @@ static void NdrPrintExtFlags(INTERPRETER_OPT_FLAGS2 extFlags)
WLog_INFO(TAG, "HasNotify2, ");
}
CLIENT_CALL_RETURN NdrClientCall(PMIDL_STUB_DESC pStubDescriptor, PFORMAT_STRING pFormat,
void** stackTop, void** fpuStack)
static CLIENT_CALL_RETURN NdrClientCall(PMIDL_STUB_DESC pStubDescriptor, PFORMAT_STRING pFormat,
void** stackTop, void** fpuStack)
{
RPC_MESSAGE rpcMsg;
unsigned short procNum;

View File

@ -33,4 +33,9 @@ typedef struct _CREDSSP_CONTEXT CREDSSP_CONTEXT;
CREDSSP_CONTEXT* credssp_ContextNew(void);
void credssp_ContextFree(CREDSSP_CONTEXT* context);
extern const SecPkgInfoA CREDSSP_SecPkgInfoA;
extern const SecPkgInfoW CREDSSP_SecPkgInfoW;
extern const SecurityFunctionTableA CREDSSP_SecurityFunctionTableA;
extern const SecurityFunctionTableW CREDSSP_SecurityFunctionTableW;
#endif /* WINPR_SSPI_CREDSSP_PRIVATE_H */

View File

@ -34,4 +34,9 @@
typedef struct _KRB_CONTEXT KRB_CONTEXT;
extern const SecPkgInfoA KERBEROS_SecPkgInfoA;
extern const SecPkgInfoW KERBEROS_SecPkgInfoW;
extern const SecurityFunctionTableA KERBEROS_SecurityFunctionTableA;
extern const SecurityFunctionTableW KERBEROS_SecurityFunctionTableW;
#endif /* WINPR_SSPI_KERBEROS_PRIVATE_H */

View File

@ -50,4 +50,9 @@ struct _NEGOTIATE_CONTEXT
};
typedef struct _NEGOTIATE_CONTEXT NEGOTIATE_CONTEXT;
extern const SecPkgInfoA NEGOTIATE_SecPkgInfoA;
extern const SecPkgInfoW NEGOTIATE_SecPkgInfoW;
extern const SecurityFunctionTableA NEGOTIATE_SecurityFunctionTableA;
extern const SecurityFunctionTableW NEGOTIATE_SecurityFunctionTableW;
#endif /* WINPR_SSPI_NEGOTIATE_PRIVATE_H */

View File

@ -430,11 +430,11 @@ const SecPkgInfoA SCHANNEL_SecPkgInfoA = {
"Schannel Security Package" /* Comment */
};
WCHAR SCHANNEL_SecPkgInfoW_Name[] = { 'S', 'c', 'h', 'a', 'n', 'n', 'e', 'l', '\0' };
static WCHAR SCHANNEL_SecPkgInfoW_Name[] = { 'S', 'c', 'h', 'a', 'n', 'n', 'e', 'l', '\0' };
WCHAR SCHANNEL_SecPkgInfoW_Comment[] = { 'S', 'c', 'h', 'a', 'n', 'n', 'e', 'l', ' ',
'S', 'e', 'c', 'u', 'r', 'i', 't', 'y', ' ',
'P', 'a', 'c', 'k', 'a', 'g', 'e', '\0' };
static WCHAR SCHANNEL_SecPkgInfoW_Comment[] = { 'S', 'c', 'h', 'a', 'n', 'n', 'e', 'l', ' ',
'S', 'e', 'c', 'u', 'r', 'i', 't', 'y', ' ',
'P', 'a', 'c', 'k', 'a', 'g', 'e', '\0' };
const SecPkgInfoW SCHANNEL_SecPkgInfoW = {
0x000107B3, /* fCapabilities */

View File

@ -45,4 +45,9 @@ typedef struct _SCHANNEL_CONTEXT SCHANNEL_CONTEXT;
SCHANNEL_CONTEXT* schannel_ContextNew(void);
void schannel_ContextFree(SCHANNEL_CONTEXT* context);
extern const SecPkgInfoA SCHANNEL_SecPkgInfoA;
extern const SecPkgInfoW SCHANNEL_SecPkgInfoW;
extern const SecurityFunctionTableA SCHANNEL_SecurityFunctionTableA;
extern const SecurityFunctionTableW SCHANNEL_SecurityFunctionTableW;
#endif /* WINPR_SSPI_SCHANNEL_PRIVATE_H */

View File

@ -1067,7 +1067,7 @@ SECURITY_STATUS SEC_ENTRY sspi_VerifySignature(PCtxtHandle phContext, PSecBuffer
return status;
}
SecurityFunctionTableA sspi_SecurityFunctionTableA = {
static const SecurityFunctionTableA sspi_SecurityFunctionTableA = {
1, /* dwVersion */
sspi_EnumerateSecurityPackagesA, /* EnumerateSecurityPackages */
sspi_QueryCredentialsAttributesA, /* QueryCredentialsAttributes */
@ -1098,7 +1098,7 @@ SecurityFunctionTableA sspi_SecurityFunctionTableA = {
sspi_SetContextAttributesA, /* SetContextAttributes */
};
SecurityFunctionTableW sspi_SecurityFunctionTableW = {
static const SecurityFunctionTableW sspi_SecurityFunctionTableW = {
1, /* dwVersion */
sspi_EnumerateSecurityPackagesW, /* EnumerateSecurityPackages */
sspi_QueryCredentialsAttributesW, /* QueryCredentialsAttributes */

View File

@ -39,26 +39,10 @@
/* Authentication Functions: http://msdn.microsoft.com/en-us/library/windows/desktop/aa374731/ */
#include "NTLM/ntlm_export.h"
extern const SecPkgInfoA KERBEROS_SecPkgInfoA;
extern const SecPkgInfoW KERBEROS_SecPkgInfoW;
extern const SecurityFunctionTableA KERBEROS_SecurityFunctionTableA;
extern const SecurityFunctionTableW KERBEROS_SecurityFunctionTableW;
extern const SecPkgInfoA NEGOTIATE_SecPkgInfoA;
extern const SecPkgInfoW NEGOTIATE_SecPkgInfoW;
extern const SecurityFunctionTableA NEGOTIATE_SecurityFunctionTableA;
extern const SecurityFunctionTableW NEGOTIATE_SecurityFunctionTableW;
extern const SecPkgInfoA CREDSSP_SecPkgInfoA;
extern const SecPkgInfoW CREDSSP_SecPkgInfoW;
extern const SecurityFunctionTableA CREDSSP_SecurityFunctionTableA;
extern const SecurityFunctionTableW CREDSSP_SecurityFunctionTableW;
extern const SecPkgInfoA SCHANNEL_SecPkgInfoA;
extern const SecPkgInfoW SCHANNEL_SecPkgInfoW;
extern const SecurityFunctionTableA SCHANNEL_SecurityFunctionTableA;
extern const SecurityFunctionTableW SCHANNEL_SecurityFunctionTableW;
#include "CredSSP/credssp.h"
#include "Kerberos/kerberos.h"
#include "Negotiate/negotiate.h"
#include "Schannel/schannel.h"
static const SecPkgInfoA* SecPkgInfoA_LIST[] = { &NTLM_SecPkgInfoA, &KERBEROS_SecPkgInfoA,
&NEGOTIATE_SecPkgInfoA, &CREDSSP_SecPkgInfoA,
@ -93,18 +77,18 @@ static const SecurityFunctionTableA_NAME SecurityFunctionTableA_NAME_LIST[] = {
{ "Schannel", &SCHANNEL_SecurityFunctionTableA }
};
static const WCHAR NTLM_NAME_W[] = { 'N', 'T', 'L', 'M', '\0' };
static const WCHAR KERBEROS_NAME_W[] = { 'K', 'e', 'r', 'b', 'e', 'r', 'o', 's', '\0' };
static const WCHAR NEGOTIATE_NAME_W[] = { 'N', 'e', 'g', 'o', 't', 'i', 'a', 't', 'e', '\0' };
static const WCHAR CREDSSP_NAME_W[] = { 'C', 'r', 'e', 'd', 'S', 'S', 'P', '\0' };
static const WCHAR SCHANNEL_NAME_W[] = { 'S', 'c', 'h', 'a', 'n', 'n', 'e', 'l', '\0' };
static const WCHAR _NTLM_NAME_W[] = { 'N', 'T', 'L', 'M', '\0' };
static const WCHAR _KERBEROS_NAME_W[] = { 'K', 'e', 'r', 'b', 'e', 'r', 'o', 's', '\0' };
static const WCHAR _NEGOTIATE_NAME_W[] = { 'N', 'e', 'g', 'o', 't', 'i', 'a', 't', 'e', '\0' };
static const WCHAR _CREDSSP_NAME_W[] = { 'C', 'r', 'e', 'd', 'S', 'S', 'P', '\0' };
static const WCHAR _SCHANNEL_NAME_W[] = { 'S', 'c', 'h', 'a', 'n', 'n', 'e', 'l', '\0' };
static const SecurityFunctionTableW_NAME SecurityFunctionTableW_NAME_LIST[] = {
{ NTLM_NAME_W, &NTLM_SecurityFunctionTableW },
{ KERBEROS_NAME_W, &KERBEROS_SecurityFunctionTableW },
{ NEGOTIATE_NAME_W, &NEGOTIATE_SecurityFunctionTableW },
{ CREDSSP_NAME_W, &CREDSSP_SecurityFunctionTableW },
{ SCHANNEL_NAME_W, &SCHANNEL_SecurityFunctionTableW }
{ _NTLM_NAME_W, &NTLM_SecurityFunctionTableW },
{ _KERBEROS_NAME_W, &KERBEROS_SecurityFunctionTableW },
{ _NEGOTIATE_NAME_W, &NEGOTIATE_SecurityFunctionTableW },
{ _CREDSSP_NAME_W, &CREDSSP_SecurityFunctionTableW },
{ _SCHANNEL_NAME_W, &SCHANNEL_SecurityFunctionTableW }
};
#define SecHandle_LOWER_MAX 0xFFFFFFFF

View File

@ -97,8 +97,8 @@ struct _TEST_NTLM_CLIENT
};
typedef struct _TEST_NTLM_CLIENT TEST_NTLM_CLIENT;
int test_ntlm_client_init(TEST_NTLM_CLIENT* ntlm, const char* user, const char* domain,
const char* password)
static int test_ntlm_client_init(TEST_NTLM_CLIENT* ntlm, const char* user, const char* domain,
const char* password)
{
SECURITY_STATUS status;
SecInvalidateHandle(&(ntlm->context));
@ -141,7 +141,7 @@ int test_ntlm_client_init(TEST_NTLM_CLIENT* ntlm, const char* user, const char*
return 1;
}
void test_ntlm_client_uninit(TEST_NTLM_CLIENT* ntlm)
static void test_ntlm_client_uninit(TEST_NTLM_CLIENT* ntlm)
{
if (!ntlm)
return;
@ -203,7 +203,7 @@ void test_ntlm_client_uninit(TEST_NTLM_CLIENT* ntlm)
* --------------
*/
int test_ntlm_client_authenticate(TEST_NTLM_CLIENT* ntlm)
static int test_ntlm_client_authenticate(TEST_NTLM_CLIENT* ntlm)
{
SECURITY_STATUS status;
@ -264,7 +264,7 @@ int test_ntlm_client_authenticate(TEST_NTLM_CLIENT* ntlm)
return (status == SEC_I_CONTINUE_NEEDED) ? 1 : 0;
}
TEST_NTLM_CLIENT* test_ntlm_client_new()
static TEST_NTLM_CLIENT* test_ntlm_client_new(void)
{
TEST_NTLM_CLIENT* ntlm;
ntlm = (TEST_NTLM_CLIENT*)calloc(1, sizeof(TEST_NTLM_CLIENT));
@ -275,7 +275,7 @@ TEST_NTLM_CLIENT* test_ntlm_client_new()
return ntlm;
}
void test_ntlm_client_free(TEST_NTLM_CLIENT* ntlm)
static void test_ntlm_client_free(TEST_NTLM_CLIENT* ntlm)
{
if (!ntlm)
return;
@ -308,7 +308,7 @@ struct _TEST_NTLM_SERVER
};
typedef struct _TEST_NTLM_SERVER TEST_NTLM_SERVER;
int test_ntlm_server_init(TEST_NTLM_SERVER* ntlm)
static int test_ntlm_server_init(TEST_NTLM_SERVER* ntlm)
{
SECURITY_STATUS status;
ntlm->UseNtlmV2Hash = TRUE;
@ -351,7 +351,7 @@ int test_ntlm_server_init(TEST_NTLM_SERVER* ntlm)
return 1;
}
void test_ntlm_server_uninit(TEST_NTLM_SERVER* ntlm)
static void test_ntlm_server_uninit(TEST_NTLM_SERVER* ntlm)
{
if (!ntlm)
return;
@ -375,7 +375,7 @@ void test_ntlm_server_uninit(TEST_NTLM_SERVER* ntlm)
}
}
int test_ntlm_server_authenticate(TEST_NTLM_SERVER* ntlm)
static int test_ntlm_server_authenticate(TEST_NTLM_SERVER* ntlm)
{
SECURITY_STATUS status;
ntlm->inputBufferDesc.ulVersion = SECBUFFER_VERSION;
@ -447,7 +447,7 @@ int test_ntlm_server_authenticate(TEST_NTLM_SERVER* ntlm)
return (status == SEC_I_CONTINUE_NEEDED) ? 1 : 0;
}
TEST_NTLM_SERVER* test_ntlm_server_new()
static TEST_NTLM_SERVER* test_ntlm_server_new(void)
{
TEST_NTLM_SERVER* ntlm;
ntlm = (TEST_NTLM_SERVER*)calloc(1, sizeof(TEST_NTLM_SERVER));
@ -458,7 +458,7 @@ TEST_NTLM_SERVER* test_ntlm_server_new()
return ntlm;
}
void test_ntlm_server_free(TEST_NTLM_SERVER* ntlm)
static void test_ntlm_server_free(TEST_NTLM_SERVER* ntlm)
{
if (!ntlm)
return;

View File

@ -26,7 +26,7 @@ typedef struct
BOOL called;
} UserApcArg;
void CALLBACK userApc(ULONG_PTR arg)
static void CALLBACK userApc(ULONG_PTR arg)
{
UserApcArg* userArg = (UserApcArg*)arg;
userArg->called = TRUE;

View File

@ -3,33 +3,34 @@
#include <winpr/crt.h>
#include <winpr/thread.h>
const char* test_args_line_1 = "app.exe abc d e";
static const char* test_args_line_1 = "app.exe abc d e";
const char* test_args_list_1[] = { "app.exe", "abc", "d", "e", NULL };
static const char* test_args_list_1[] = { "app.exe", "abc", "d", "e", NULL };
const char* test_args_line_2 = "app.exe abc \t def";
static const char* test_args_line_2 = "app.exe abc \t def";
const char* test_args_list_2[] = { "app.exe", "abc", "def", NULL };
static const char* test_args_list_2[] = { "app.exe", "abc", "def", NULL };
const char* test_args_line_3 = "app.exe \"abc\" d e";
static const char* test_args_line_3 = "app.exe \"abc\" d e";
const char* test_args_list_3[] = { "app.exe", "abc", "d", "e", NULL };
static const char* test_args_list_3[] = { "app.exe", "abc", "d", "e", NULL };
const char* test_args_line_4 = "app.exe a\\\\b d\"e f\"g h";
static const char* test_args_line_4 = "app.exe a\\\\b d\"e f\"g h";
const char* test_args_list_4[] = { "app.exe", "a\\\\b", "de fg", "h", NULL };
static const char* test_args_list_4[] = { "app.exe", "a\\\\b", "de fg", "h", NULL };
const char* test_args_line_5 = "app.exe a\\\\\\\"b c d";
static const char* test_args_line_5 = "app.exe a\\\\\\\"b c d";
const char* test_args_list_5[] = { "app.exe", "a\\\"b", "c", "d", NULL };
static const char* test_args_list_5[] = { "app.exe", "a\\\"b", "c", "d", NULL };
const char* test_args_line_6 = "app.exe a\\\\\\\\\"b c\" d e";
static const char* test_args_line_6 = "app.exe a\\\\\\\\\"b c\" d e";
const char* test_args_list_6[] = { "app.exe", "a\\\\b c", "d", "e", NULL };
static const char* test_args_list_6[] = { "app.exe", "a\\\\b c", "d", "e", NULL };
const char* test_args_line_7 = "app.exe a\\\\\\\\\"b c\" d e f\\\\\\\\\"g h\" i j";
static const char* test_args_line_7 = "app.exe a\\\\\\\\\"b c\" d e f\\\\\\\\\"g h\" i j";
const char* test_args_list_7[] = { "app.exe", "a\\\\b c", "d", "e", "f\\\\g h", "i", "j", NULL };
static const char* test_args_list_7[] = { "app.exe", "a\\\\b c", "d", "e",
"f\\\\g h", "i", "j", NULL };
static int test_command_line_parsing_case(const char* line, const char** list)
{

View File

@ -280,6 +280,7 @@ BOOL ArrayList_Contains(wArrayList* arrayList, const void* obj)
return rc;
}
#if defined(WITH_WINPR_DEPRECATED)
int ArrayList_Add(wArrayList* arrayList, const void* obj)
{
WINPR_ASSERT(arrayList);
@ -287,6 +288,7 @@ int ArrayList_Add(wArrayList* arrayList, const void* obj)
return -1;
return (int)ArrayList_Count(arrayList) - 1;
}
#endif
/**
* Adds an object to the end of the ArrayList.

View File

@ -284,12 +284,14 @@ size_t HashTable_Count(wHashTable* table)
/**
* Adds an element with the specified key and value into the HashTable.
*/
#if defined(WITH_WINPR_DEPRECATED)
int HashTable_Add(wHashTable* table, const void* key, const void* value)
{
if (!HashTable_Insert(table, key, value))
return -1;
return 0;
}
#endif
BOOL HashTable_Insert(wHashTable* table, const void* key, const void* value)
{

View File

@ -106,8 +106,11 @@ BYTE* winpr_bitmap_construct_header(size_t width, size_t height, size_t bpp)
WINPR_BITMAP_FILE_HEADER bf;
WINPR_BITMAP_INFO_HEADER bi;
wStream s;
size_t imgSize;
BYTE* buffer = NULL;
if ((width > INT32_MAX) || (height > INT32_MAX) || (bpp > UINT16_MAX))
imgSize = width * height * (bpp / 8);
if ((width > INT32_MAX) || (height > INT32_MAX) || (bpp > UINT16_MAX) || (imgSize > UINT32_MAX))
return NULL;
buffer = malloc(WINPR_IMAGE_BMP_HEADER_LEN);
@ -121,7 +124,7 @@ BYTE* winpr_bitmap_construct_header(size_t width, size_t height, size_t bpp)
bf.bfReserved1 = 0;
bf.bfReserved2 = 0;
bf.bfOffBits = (UINT32)sizeof(WINPR_BITMAP_FILE_HEADER) + sizeof(WINPR_BITMAP_INFO_HEADER);
bi.biSizeImage = (UINT32)width * height * (bpp / 8);
bi.biSizeImage = (UINT32)imgSize;
bf.bfSize = bf.bfOffBits + bi.biSizeImage;
bi.biWidth = (INT32)width;
bi.biHeight = -1 * (INT32)height;
@ -170,7 +173,7 @@ int winpr_bitmap_write(const char* filename, const BYTE* data, size_t width, siz
goto fail;
if (fwrite(bmp_header, WINPR_IMAGE_BMP_HEADER_LEN, 1, fp) != 1 ||
fwrite((void*)data, img_size, 1, fp) != 1)
fwrite((const void*)data, img_size, 1, fp) != 1)
goto fail;
ret = 1;
@ -205,7 +208,7 @@ static int winpr_image_png_read_fp(wImage* image, FILE* fp)
BYTE* data;
UINT32 width;
UINT32 height;
int lodepng_status;
unsigned lodepng_status;
_fseeki64(fp, 0, SEEK_END);
size = _ftelli64(fp);
_fseeki64(fp, 0, SEEK_SET);
@ -241,8 +244,7 @@ static int winpr_image_png_read_buffer(wImage* image, const BYTE* buffer, size_t
{
UINT32 width;
UINT32 height;
int lodepng_status;
lodepng_status = lodepng_decode32(&(image->data), &width, &height, buffer, size);
unsigned lodepng_status = lodepng_decode32(&(image->data), &width, &height, buffer, size);
if (lodepng_status)
return -1;
@ -258,7 +260,7 @@ static int winpr_image_png_read_buffer(wImage* image, const BYTE* buffer, size_t
static int winpr_image_bitmap_read_fp(wImage* image, FILE* fp)
{
int rc = -1;
int index;
UINT32 index;
BOOL vFlip;
BYTE* pDstData;
wStream* s;
@ -289,17 +291,20 @@ static int winpr_image_bitmap_read_fp(wImage* image, FILE* fp)
if (_ftelli64(fp) != bf.bfOffBits)
_fseeki64(fp, bf.bfOffBits, SEEK_SET);
image->width = bi.biWidth;
if (bi.biWidth < 0)
goto fail;
image->width = (UINT32)bi.biWidth;
if (bi.biHeight < 0)
{
vFlip = FALSE;
image->height = -1 * bi.biHeight;
image->height = (UINT32)(-1 * bi.biHeight);
}
else
{
vFlip = TRUE;
image->height = bi.biHeight;
image->height = (UINT32)bi.biHeight;
}
image->bitsPerPixel = bi.biBitCount;
@ -344,7 +349,7 @@ fail:
static int winpr_image_bitmap_read_buffer(wImage* image, const BYTE* buffer, size_t size)
{
int rc = -1;
int index;
UINT32 index;
BOOL vFlip;
BYTE* pDstData;
WINPR_BITMAP_FILE_HEADER bf;
@ -369,17 +374,20 @@ static int winpr_image_bitmap_read_buffer(wImage* image, const BYTE* buffer, siz
if (Stream_GetRemainingCapacity(s) < bi.biSizeImage)
goto fail;
image->width = bi.biWidth;
if (bi.biWidth < 0)
goto fail;
image->width = (UINT32)bi.biWidth;
if (bi.biHeight < 0)
{
vFlip = FALSE;
image->height = -1 * bi.biHeight;
image->height = (UINT32)(-1 * bi.biHeight);
}
else
{
vFlip = TRUE;
image->height = bi.biHeight;
image->height = (UINT32)bi.biHeight;
}
image->bitsPerPixel = bi.biBitCount;

View File

@ -4,7 +4,7 @@
#include <winpr/stream.h>
#include <winpr/bitstream.h>
void BitStrGen()
static void BitStrGen(void)
{
DWORD i, j;
char str[64];

View File

@ -14,7 +14,7 @@ static char* val3 = "val3";
static int test_hash_table_pointer(void)
{
int rc = -1;
int count;
size_t count;
char* value;
wHashTable* table;
table = HashTable_New(TRUE);
@ -32,7 +32,7 @@ static int test_hash_table_pointer(void)
if (count != 3)
{
printf("HashTable_Count: Expected : 3, Actual: %d\n", count);
printf("HashTable_Count: Expected : 3, Actual: %" PRIuz "\n", count);
goto fail;
}
@ -42,7 +42,7 @@ static int test_hash_table_pointer(void)
if (count != 2)
{
printf("HashTable_Count: Expected : 2, Actual: %d\n", count);
printf("HashTable_Count: Expected : 2, Actual: %" PRIuz "\n", count);
goto fail;
}
@ -52,7 +52,7 @@ static int test_hash_table_pointer(void)
if (count != 1)
{
printf("HashTable_Count: Expected : 1, Actual: %d\n", count);
printf("HashTable_Count: Expected : 1, Actual: %" PRIuz "\n", count);
goto fail;
}
@ -62,7 +62,7 @@ static int test_hash_table_pointer(void)
if (count != 0)
{
printf("HashTable_Count: Expected : 0, Actual: %d\n", count);
printf("HashTable_Count: Expected : 0, Actual: %" PRIuz "\n", count);
goto fail;
}
@ -76,7 +76,7 @@ static int test_hash_table_pointer(void)
if (count != 3)
{
printf("HashTable_Count: Expected : 3, Actual: %d\n", count);
printf("HashTable_Count: Expected : 3, Actual: %" PRIuz "\n", count);
goto fail;
}
@ -137,7 +137,7 @@ static int test_hash_table_pointer(void)
if (count != 0)
{
printf("HashTable_Count: Expected : 0, Actual: %d\n", count);
printf("HashTable_Count: Expected : 0, Actual: %" PRIuz "\n", count);
goto fail;
}
@ -150,7 +150,7 @@ fail:
static int test_hash_table_string(void)
{
int rc = -1;
int count;
size_t count;
char* value;
wHashTable* table = HashTable_New(TRUE);
@ -170,7 +170,7 @@ static int test_hash_table_string(void)
if (count != 3)
{
printf("HashTable_Count: Expected : 3, Actual: %d\n", count);
printf("HashTable_Count: Expected : 3, Actual: %" PRIuz "\n", count);
goto fail;
}
@ -180,7 +180,7 @@ static int test_hash_table_string(void)
if (count != 2)
{
printf("HashTable_Count: Expected : 3, Actual: %d\n", count);
printf("HashTable_Count: Expected : 3, Actual: %" PRIuz "\n", count);
goto fail;
}
@ -190,7 +190,7 @@ static int test_hash_table_string(void)
if (count != 1)
{
printf("HashTable_Count: Expected : 1, Actual: %d\n", count);
printf("HashTable_Count: Expected : 1, Actual: %" PRIuz "\n", count);
goto fail;
}
@ -200,7 +200,7 @@ static int test_hash_table_string(void)
if (count != 0)
{
printf("HashTable_Count: Expected : 0, Actual: %d\n", count);
printf("HashTable_Count: Expected : 0, Actual: %" PRIuz "\n", count);
goto fail;
}
@ -214,7 +214,7 @@ static int test_hash_table_string(void)
if (count != 3)
{
printf("HashTable_Count: Expected : 3, Actual: %d\n", count);
printf("HashTable_Count: Expected : 3, Actual: %" PRIuz "\n", count);
goto fail;
}
@ -275,7 +275,7 @@ static int test_hash_table_string(void)
if (count != 0)
{
printf("HashTable_Count: Expected : 0, Actual: %d\n", count);
printf("HashTable_Count: Expected : 0, Actual: %" PRIuz "\n", count);
goto fail;
}
@ -294,7 +294,7 @@ typedef struct
BOOL test3error;
} ForeachData;
BOOL foreachFn1(const void* key, void* value, void* arg)
static BOOL foreachFn1(const void* key, void* value, void* arg)
{
ForeachData* d = (ForeachData*)arg;
WINPR_UNUSED(key);
@ -302,7 +302,7 @@ BOOL foreachFn1(const void* key, void* value, void* arg)
return TRUE;
}
BOOL foreachFn2(const void* key, void* value, void* arg)
static BOOL foreachFn2(const void* key, void* value, void* arg)
{
ForeachData* d = (ForeachData*)arg;
WINPR_UNUSED(key);
@ -314,9 +314,9 @@ BOOL foreachFn2(const void* key, void* value, void* arg)
return TRUE;
}
BOOL foreachFn3(const void* key, void* value, void* arg)
static BOOL foreachFn3(const void* key, void* value, void* arg)
{
char* keyStr = (char*)key;
const char* keyStr = (const char*)key;
ForeachData* d = (ForeachData*)arg;
ForeachData d2;
@ -365,7 +365,7 @@ BOOL foreachFn3(const void* key, void* value, void* arg)
return TRUE;
}
int test_hash_foreach(void)
static int test_hash_foreach(void)
{
ForeachData foreachData;
wHashTable* table;

View File

@ -2,39 +2,39 @@
#include <winpr/crt.h>
#include <winpr/ini.h>
const char TEST_INI_01[] = "; This is a sample .ini config file\n"
"\n"
"[first_section]\n"
"one = 1\n"
"five = 5\n"
"animal = BIRD\n"
"\n"
"[second_section]\n"
"path = \"/usr/local/bin\"\n"
"URL = \"http://www.example.com/~username\"\n"
"\n";
static const char TEST_INI_01[] = "; This is a sample .ini config file\n"
"\n"
"[first_section]\n"
"one = 1\n"
"five = 5\n"
"animal = BIRD\n"
"\n"
"[second_section]\n"
"path = \"/usr/local/bin\"\n"
"URL = \"http://www.example.com/~username\"\n"
"\n";
const char TEST_INI_02[] = "[FreeRDS]\n"
"prefix=\"/usr/local\"\n"
"bindir=\"bin\"\n"
"sbindir=\"sbin\"\n"
"libdir=\"lib\"\n"
"datarootdir=\"share\"\n"
"localstatedir=\"var\"\n"
"sysconfdir=\"etc\"\n"
"\n";
static const char TEST_INI_02[] = "[FreeRDS]\n"
"prefix=\"/usr/local\"\n"
"bindir=\"bin\"\n"
"sbindir=\"sbin\"\n"
"libdir=\"lib\"\n"
"datarootdir=\"share\"\n"
"localstatedir=\"var\"\n"
"sysconfdir=\"etc\"\n"
"\n";
const char TEST_INI_03[] = "[FreeRDS]\n"
"prefix=\"/usr/local\"\n"
"bindir=\"bin\"\n"
"# some illegal string\n"
"sbindir=\"sbin\"\n"
"libdir=\"lib\"\n"
"invalid key-value pair\n"
"datarootdir=\"share\"\n"
"localstatedir=\"var\"\n"
"sysconfdir=\"etc\"\n"
"\n";
static const char TEST_INI_03[] = "[FreeRDS]\n"
"prefix=\"/usr/local\"\n"
"bindir=\"bin\"\n"
"# some illegal string\n"
"sbindir=\"sbin\"\n"
"libdir=\"lib\"\n"
"invalid key-value pair\n"
"datarootdir=\"share\"\n"
"localstatedir=\"var\"\n"
"sysconfdir=\"etc\"\n"
"\n";
int TestIni(int argc, char* argv[])
{

View File

@ -15,12 +15,12 @@ int flags;
int button;
DEFINE_EVENT_END(MouseButton)
void MouseMotionEventHandler(void* context, MouseMotionEventArgs* e)
static void MouseMotionEventHandler(void* context, MouseMotionEventArgs* e)
{
printf("MouseMotionEvent: x: %d y: %d\n", e->x, e->y);
}
void MouseButtonEventHandler(void* context, MouseButtonEventArgs* e)
static void MouseButtonEventHandler(void* context, MouseButtonEventArgs* e)
{
printf("MouseButtonEvent: x: %d y: %d flags: %d button: %d\n", e->x, e->y, e->flags, e->button);
}

View File

@ -40,8 +40,6 @@
#include <sys/syscall.h>
#endif
extern const char* WLOG_LEVELS[7];
/**
* Log Layout
*/

View File

@ -1049,6 +1049,7 @@ wLog* WLog_Get(LPCSTR name)
return WLog_Get_int(root, name);
}
#if defined(WITH_WINPR_DEPRECATED)
BOOL WLog_Init(void)
{
return WLog_GetRoot() != NULL;
@ -1077,3 +1078,4 @@ BOOL WLog_Uninit(void)
return TRUE;
}
#endif

View File

@ -81,6 +81,7 @@ struct _wLog
CRITICAL_SECTION lock;
};
extern const char* WLOG_LEVELS[7];
BOOL WLog_Layout_GetMessagePrefix(wLog* log, wLogLayout* layout, wLogMessage* message);
#include "wlog/Layout.h"

View File

@ -5,19 +5,19 @@
#include <winpr/wtsapi.h>
#include <winpr/library.h>
const char* WM_WTS_STRINGS[] = { "",
"WTS_CONSOLE_CONNECT",
"WTS_CONSOLE_DISCONNECT",
"WTS_REMOTE_CONNECT",
"WTS_REMOTE_DISCONNECT",
"WTS_SESSION_LOGON",
"WTS_SESSION_LOGOFF",
"WTS_SESSION_LOCK",
"WTS_SESSION_UNLOCK",
"WTS_SESSION_REMOTE_CONTROL",
"WTS_SESSION_CREATE",
"WTS_SESSION_TERMINATE",
"" };
static const char* WM_WTS_STRINGS[] = { "",
"WTS_CONSOLE_CONNECT",
"WTS_CONSOLE_DISCONNECT",
"WTS_REMOTE_CONNECT",
"WTS_REMOTE_DISCONNECT",
"WTS_SESSION_LOGON",
"WTS_SESSION_LOGOFF",
"WTS_SESSION_LOCK",
"WTS_SESSION_UNLOCK",
"WTS_SESSION_REMOTE_CONTROL",
"WTS_SESSION_CREATE",
"WTS_SESSION_TERMINATE",
"" };
static LRESULT CALLBACK TestWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{

View File

@ -48,7 +48,7 @@ static INLINE UINT32 lzcnt_s(UINT32 x)
return __lzcnt(x);
}
int test_lzcnt()
static int test_lzcnt(void)
{
if (lzcnt_s(0x1) != 31)
{
@ -83,7 +83,7 @@ int test_lzcnt()
return 0;
}
int test_lzcnt16()
static int test_lzcnt16(void)
{
if (__lzcnt16(0x1) != 15)
{