[warnings] fix clang-tidy issues in libfreerdp

This commit is contained in:
akallabeth 2024-08-29 15:10:21 +02:00
parent 92e416610a
commit 36c3184a0f
No known key found for this signature in database
GPG Key ID: A49454A3FC909FD5
30 changed files with 125 additions and 113 deletions

View File

@ -72,7 +72,7 @@ static UINT32 update_glyph_offset(const BYTE* data, size_t length, UINT32 index,
}
static BOOL update_process_glyph(rdpContext* context, const BYTE* data, UINT32 cacheIndex, INT32* x,
INT32* y, UINT32 cacheId, UINT32 flAccel, BOOL fOpRedundant,
const INT32* y, UINT32 cacheId, UINT32 flAccel, BOOL fOpRedundant,
const RDP_RECT* bound)
{
INT32 sx = 0;

View File

@ -44,10 +44,10 @@
#define UNROLL_MULTIPLE(_condition, _exp, _count) \
do \
{ \
while ((_condition) >= _count) \
while ((_condition) >= (_count)) \
{ \
UNROLL_BODY(_exp, _count); \
(_condition) -= _count; \
(_condition) -= (_count); \
} \
} while (FALSE)
@ -428,14 +428,14 @@ static INLINE void write_pixel_16(BYTE* _buf, UINT16 _pix)
do \
{ \
write_pixel_8(_buf, _pix); \
_buf += 1; \
(_buf) += 1; \
} while (0)
#define DESTREADPIXEL(_pix, _buf) _pix = (_buf)[0]
#define SRCREADPIXEL(_pix, _buf) \
do \
{ \
_pix = (_buf)[0]; \
_buf += 1; \
(_pix) = (_buf)[0]; \
(_buf) += 1; \
} while (0)
#define WRITEFGBGIMAGE WriteFgBgImage8to8
@ -463,14 +463,14 @@ static INLINE void write_pixel_16(BYTE* _buf, UINT16 _pix)
do \
{ \
write_pixel_16(_buf, _pix); \
_buf += 2; \
(_buf) += 2; \
} while (0)
#define DESTREADPIXEL(_pix, _buf) _pix = ((UINT16*)(_buf))[0]
#define SRCREADPIXEL(_pix, _buf) \
do \
{ \
_pix = (_buf)[0] | ((_buf)[1] << 8); \
_buf += 2; \
(_pix) = (_buf)[0] | ((_buf)[1] << 8); \
(_buf) += 2; \
} while (0)
#define WRITEFGBGIMAGE WriteFgBgImage16to16
#define WRITEFIRSTLINEFGBGIMAGE WriteFirstLineFgBgImage16to16
@ -497,14 +497,14 @@ static INLINE void write_pixel_16(BYTE* _buf, UINT16 _pix)
do \
{ \
write_pixel_24(_buf, _pix); \
_buf += 3; \
(_buf) += 3; \
} while (0)
#define DESTREADPIXEL(_pix, _buf) _pix = (_buf)[0] | ((_buf)[1] << 8) | ((_buf)[2] << 16)
#define SRCREADPIXEL(_pix, _buf) \
do \
{ \
_pix = (_buf)[0] | ((_buf)[1] << 8) | ((_buf)[2] << 16); \
_buf += 3; \
(_pix) = (_buf)[0] | ((_buf)[1] << 8) | ((_buf)[2] << 16); \
(_buf) += 3; \
} while (0)
#define WRITEFGBGIMAGE WriteFgBgImage24to24

View File

@ -2341,7 +2341,7 @@ static int ncrush_hash_table_add(NCRUSH_CONTEXT* ncrush, const BYTE* pSrcData, U
return 1;
}
static int ncrush_find_match_length(const BYTE* Ptr1, const BYTE* Ptr2, BYTE* HistoryPtr)
static int ncrush_find_match_length(const BYTE* Ptr1, const BYTE* Ptr2, const BYTE* HistoryPtr)
{
BYTE val1 = 0;
BYTE val2 = 0;

View File

@ -589,7 +589,7 @@ int rfx_rlgr_decode(RLGR_MODE mode, const BYTE* WINPR_RESTRICT pSrcData, UINT32
#define OutputBit(count, bit) \
do \
{ \
UINT16 _b = (bit ? 0xFFFF : 0); \
UINT16 _b = ((bit) ? 0xFFFF : 0); \
int _c = (count); \
for (; _c > 0; _c -= 16) \
rfx_bitstream_put_bits(bs, _b, (_c > 16 ? 16 : _c)); \

View File

@ -54,19 +54,18 @@
#define ATTRIBUTES __gnu_inline__, __always_inline__
#endif
#define _mm_between_epi16(_val, _min, _max) \
#define mm_between_epi16(_val, _min, _max) \
do \
{ \
_val = _mm_min_epi16(_max, _mm_max_epi16(_val, _min)); \
(_val) = _mm_min_epi16(_max, _mm_max_epi16(_val, _min)); \
} while (0)
static __inline void __attribute__((ATTRIBUTES))
_mm_prefetch_buffer(char* WINPR_RESTRICT buffer, int num_bytes)
mm_prefetch_buffer(char* WINPR_RESTRICT buffer, size_t num_bytes)
{
__m128i* buf = (__m128i*)buffer;
for (unsigned int i = 0; i < (num_bytes / sizeof(__m128i));
i += (CACHE_LINE_BYTES / sizeof(__m128i)))
for (size_t i = 0; i < (num_bytes / sizeof(__m128i)); i += (CACHE_LINE_BYTES / sizeof(__m128i)))
{
_mm_prefetch((char*)(&buf[i]), _MM_HINT_NTA);
}
@ -101,7 +100,7 @@ static void rfx_quantization_decode_sse2(INT16* WINPR_RESTRICT buffer,
WINPR_ASSERT(buffer);
WINPR_ASSERT(quantVals);
_mm_prefetch_buffer((char*)buffer, 4096 * sizeof(INT16));
mm_prefetch_buffer((char*)buffer, 4096 * sizeof(INT16));
rfx_quantization_decode_block_sse2(&buffer[0], 1024, quantVals[8] - 1); /* HL1 */
rfx_quantization_decode_block_sse2(&buffer[1024], 1024, quantVals[7] - 1); /* LH1 */
rfx_quantization_decode_block_sse2(&buffer[2048], 1024, quantVals[9] - 1); /* HH1 */
@ -144,7 +143,7 @@ static void rfx_quantization_encode_sse2(INT16* WINPR_RESTRICT buffer,
WINPR_ASSERT(buffer);
WINPR_ASSERT(quantization_values);
_mm_prefetch_buffer((char*)buffer, 4096 * sizeof(INT16));
mm_prefetch_buffer((char*)buffer, 4096 * sizeof(INT16));
rfx_quantization_encode_block_sse2(buffer, 1024, quantization_values[8] - 6); /* HL1 */
rfx_quantization_encode_block_sse2(buffer + 1024, 1024, quantization_values[7] - 6); /* LH1 */
rfx_quantization_encode_block_sse2(buffer + 2048, 1024, quantization_values[9] - 6); /* HH1 */
@ -321,7 +320,7 @@ rfx_dwt_2d_decode_block_sse2(INT16* WINPR_RESTRICT buffer, INT16* WINPR_RESTRICT
INT16* ll = NULL;
INT16* l_dst = NULL;
INT16* h_dst = NULL;
_mm_prefetch_buffer((char*)idwt, 4ULL * subband_width * sizeof(INT16));
mm_prefetch_buffer((char*)idwt, 4ULL * subband_width * sizeof(INT16));
/* Inverse DWT in horizontal direction, results in 2 sub-bands in L, H order in tmp buffer idwt.
*/
/* The 4 sub-bands are stored in HL(0), LH(1), HH(2), LL(3) order. */
@ -344,7 +343,7 @@ static void rfx_dwt_2d_decode_sse2(INT16* WINPR_RESTRICT buffer, INT16* WINPR_RE
WINPR_ASSERT(buffer);
WINPR_ASSERT(dwt_buffer);
_mm_prefetch_buffer((char*)buffer, 4096 * sizeof(INT16));
mm_prefetch_buffer((char*)buffer, 4096 * sizeof(INT16));
rfx_dwt_2d_decode_block_sse2(&buffer[3840], dwt_buffer, 8);
rfx_dwt_2d_decode_block_sse2(&buffer[3072], dwt_buffer, 16);
rfx_dwt_2d_decode_block_sse2(&buffer[0], dwt_buffer, 32);
@ -461,7 +460,7 @@ rfx_dwt_2d_encode_block_sse2(INT16* WINPR_RESTRICT buffer, INT16* WINPR_RESTRICT
INT16* ll = NULL;
INT16* l_src = NULL;
INT16* h_src = NULL;
_mm_prefetch_buffer((char*)dwt, 4ULL * subband_width * sizeof(INT16));
mm_prefetch_buffer((char*)dwt, 4ULL * subband_width * sizeof(INT16));
/* DWT in vertical direction, results in 2 sub-bands in L, H order in tmp buffer dwt. */
l_src = dwt;
h_src = dwt + 2ULL * subband_width * subband_width;
@ -483,7 +482,7 @@ static void rfx_dwt_2d_encode_sse2(INT16* WINPR_RESTRICT buffer, INT16* WINPR_RE
WINPR_ASSERT(buffer);
WINPR_ASSERT(dwt_buffer);
_mm_prefetch_buffer((char*)buffer, 4096 * sizeof(INT16));
mm_prefetch_buffer((char*)buffer, 4096 * sizeof(INT16));
rfx_dwt_2d_encode_block_sse2(buffer, dwt_buffer, 32);
rfx_dwt_2d_encode_block_sse2(buffer + 3072, dwt_buffer, 16);
rfx_dwt_2d_encode_block_sse2(buffer + 3840, dwt_buffer, 8);

View File

@ -26,7 +26,7 @@ static BOOL compareRectangles(const RECTANGLE_16* src1, const RECTANGLE_16* src2
{
for (int i = 0; i < nb; i++, src1++, src2++)
{
if (memcmp(src1, src2, sizeof(RECTANGLE_16)))
if (memcmp(src1, src2, sizeof(RECTANGLE_16)) != 0)
{
(void)fprintf(stderr,
"expecting rect %d (%" PRIu16 ",%" PRIu16 "-%" PRIu16 ",%" PRIu16
@ -58,7 +58,7 @@ static int test_basic(void)
rects = region16_rects(&region, &nbRects);
if (!rects || nbRects != 1 || memcmp(rects, &r1, sizeof(RECTANGLE_16)))
if (!rects || nbRects != 1 || memcmp(rects, &r1, sizeof(RECTANGLE_16)) != 0)
goto out;
/* r1 + r2 */

View File

@ -214,7 +214,7 @@ static BOOL update_connectionstring2_wchar(rdpAssistanceFile* file, const WCHAR*
* Use the first n bytes of the result of step 5 as the derived key.
*/
static BOOL freerdp_assistance_crypt_derive_key_sha1(BYTE* hash, size_t hashLength, BYTE* key,
static BOOL freerdp_assistance_crypt_derive_key_sha1(const BYTE* hash, size_t hashLength, BYTE* key,
size_t keyLength)
{
BOOL rc = FALSE;

View File

@ -3288,8 +3288,8 @@ char* freerdp_settings_get_string_writable(rdpSettings* settings, FreeRDP_Settin
}
}
BOOL freerdp_settings_set_string_(rdpSettings* settings, FreeRDP_Settings_Keys_String id, char* val,
size_t len)
BOOL freerdp_settings_set_string_(rdpSettings* settings, FreeRDP_Settings_Keys_String id,
const char* val, size_t len)
{
union
{

View File

@ -43,7 +43,7 @@
#define TAG FREERDP_TAG("core.gateway.http")
#define RESPONSE_SIZE_LIMIT 64ULL * 1024ULL * 1024ULL
#define RESPONSE_SIZE_LIMIT (64ULL * 1024ULL * 1024ULL)
#define WEBSOCKET_MAGIC_GUID "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"

View File

@ -107,7 +107,7 @@ typedef struct
{
TRANSFER_ENCODING httpTransferEncoding;
BOOL isWebsocketTransport;
union _context
union context
{
http_encoding_chunked_context chunked;
websocket_context websocket;
@ -2070,7 +2070,7 @@ static int rdg_bio_puts(BIO* bio, const char* str)
return -2;
}
static int rdg_bio_gets(BIO* bio, char* str, int size)
static int rdg_bio_gets(BIO* bio, const char* str, int size)
{
WINPR_UNUSED(bio);
WINPR_UNUSED(str);

View File

@ -1262,7 +1262,7 @@ static BIO_METHOD* BIO_s_tsg(void);
*/
static int TsProxySendToServer(handle_t IDL_handle, const byte pRpcMessage[], UINT32 count,
UINT32* lengths)
const UINT32* lengths)
{
wStream* s = NULL;
rdpTsg* tsg = NULL;
@ -2970,7 +2970,7 @@ static int transport_bio_tsg_puts(BIO* bio, const char* str)
return 1;
}
static int transport_bio_tsg_gets(BIO* bio, char* str, int size)
static int transport_bio_tsg_gets(BIO* bio, const char* str, int size)
{
WINPR_UNUSED(bio);
WINPR_UNUSED(str);

View File

@ -767,9 +767,9 @@ static BOOL wst_parse_url(rdpWst* wst, const char* url)
return FALSE;
strncpy(port, portStart, (pos - portStart));
port[pos - portStart] = '\0';
int _p = strtol(port, &portNumberEnd, 10);
if (portNumberEnd && *portNumberEnd == '\0' && _p > 0 && _p <= UINT16_MAX)
wst->gwport = _p;
long _p = strtol(port, &portNumberEnd, 10);
if (portNumberEnd && (*portNumberEnd == '\0') && (_p > 0) && (_p <= UINT16_MAX))
wst->gwport = (uint16_t)_p;
else
return FALSE;
}

View File

@ -956,7 +956,7 @@ static INLINE BOOL update_write_brush(wStream* s, rdpBrush* brush, BYTE fieldFla
return TRUE;
}
static INLINE BOOL update_read_delta_rects(wStream* s, DELTA_RECT* rectangles, UINT32* nr)
static INLINE BOOL update_read_delta_rects(wStream* s, DELTA_RECT* rectangles, const UINT32* nr)
{
UINT32 number = *nr;
BYTE flags = 0;
@ -2246,7 +2246,7 @@ fail:
}
size_t update_approximate_cache_bitmap_order(const CACHE_BITMAP_ORDER* cache_bitmap,
BOOL compressed, UINT16* flags)
BOOL compressed, const UINT16* flags)
{
WINPR_ASSERT(cache_bitmap);
WINPR_UNUSED(compressed);
@ -2392,7 +2392,7 @@ fail:
}
size_t update_approximate_cache_bitmap_v2_order(CACHE_BITMAP_V2_ORDER* cache_bitmap_v2,
BOOL compressed, UINT16* flags)
BOOL compressed, const UINT16* flags)
{
WINPR_ASSERT(cache_bitmap_v2);
WINPR_UNUSED(flags);
@ -2620,7 +2620,7 @@ fail:
}
size_t update_approximate_cache_color_table_order(const CACHE_COLOR_TABLE_ORDER* cache_color_table,
UINT16* flags)
const UINT16* flags)
{
WINPR_UNUSED(cache_color_table);
WINPR_UNUSED(flags);
@ -2717,7 +2717,8 @@ fail:
return NULL;
}
size_t update_approximate_cache_glyph_order(const CACHE_GLYPH_ORDER* cache_glyph, UINT16* flags)
size_t update_approximate_cache_glyph_order(const CACHE_GLYPH_ORDER* cache_glyph,
const UINT16* flags)
{
WINPR_ASSERT(cache_glyph);
WINPR_UNUSED(flags);
@ -2822,7 +2823,7 @@ fail:
}
size_t update_approximate_cache_glyph_v2_order(const CACHE_GLYPH_V2_ORDER* cache_glyph_v2,
UINT16* flags)
const UINT16* flags)
{
WINPR_ASSERT(cache_glyph_v2);
WINPR_UNUSED(flags);
@ -2987,7 +2988,8 @@ fail:
return NULL;
}
size_t update_approximate_cache_brush_order(const CACHE_BRUSH_ORDER* cache_brush, UINT16* flags)
size_t update_approximate_cache_brush_order(const CACHE_BRUSH_ORDER* cache_brush,
const UINT16* flags)
{
WINPR_UNUSED(cache_brush);
WINPR_UNUSED(flags);

View File

@ -233,13 +233,13 @@ FREERDP_LOCAL BOOL update_write_glyph_index_order(wStream* s, ORDER_INFO* orderI
GLYPH_INDEX_ORDER* glyph_index);
FREERDP_LOCAL size_t update_approximate_cache_bitmap_order(const CACHE_BITMAP_ORDER* cache_bitmap,
BOOL compressed, UINT16* flags);
BOOL compressed, const UINT16* flags);
FREERDP_LOCAL BOOL update_write_cache_bitmap_order(wStream* s,
const CACHE_BITMAP_ORDER* cache_bitmap_order,
BOOL compressed, UINT16* flags);
FREERDP_LOCAL size_t update_approximate_cache_bitmap_v2_order(
CACHE_BITMAP_V2_ORDER* cache_bitmap_v2, BOOL compressed, UINT16* flags);
CACHE_BITMAP_V2_ORDER* cache_bitmap_v2, BOOL compressed, const UINT16* flags);
FREERDP_LOCAL BOOL update_write_cache_bitmap_v2_order(wStream* s,
CACHE_BITMAP_V2_ORDER* cache_bitmap_v2_order,
BOOL compressed, UINT16* flags);
@ -251,24 +251,24 @@ FREERDP_LOCAL BOOL update_write_cache_bitmap_v3_order(wStream* s,
UINT16* flags);
FREERDP_LOCAL size_t update_approximate_cache_color_table_order(
const CACHE_COLOR_TABLE_ORDER* cache_color_table, UINT16* flags);
const CACHE_COLOR_TABLE_ORDER* cache_color_table, const UINT16* flags);
FREERDP_LOCAL BOOL update_write_cache_color_table_order(
wStream* s, const CACHE_COLOR_TABLE_ORDER* cache_color_table_order, UINT16* flags);
FREERDP_LOCAL size_t update_approximate_cache_glyph_order(const CACHE_GLYPH_ORDER* cache_glyph,
UINT16* flags);
const UINT16* flags);
FREERDP_LOCAL BOOL update_write_cache_glyph_order(wStream* s,
const CACHE_GLYPH_ORDER* cache_glyph_order,
UINT16* flags);
FREERDP_LOCAL size_t
update_approximate_cache_glyph_v2_order(const CACHE_GLYPH_V2_ORDER* cache_glyph_v2, UINT16* flags);
FREERDP_LOCAL size_t update_approximate_cache_glyph_v2_order(
const CACHE_GLYPH_V2_ORDER* cache_glyph_v2, const UINT16* flags);
FREERDP_LOCAL BOOL update_write_cache_glyph_v2_order(wStream* s,
const CACHE_GLYPH_V2_ORDER* cache_glyph_v2,
UINT16* flags);
FREERDP_LOCAL size_t update_approximate_cache_brush_order(const CACHE_BRUSH_ORDER* cache_brush,
UINT16* flags);
const UINT16* flags);
FREERDP_LOCAL BOOL update_write_cache_brush_order(wStream* s,
const CACHE_BRUSH_ORDER* cache_brush_order,
UINT16* flags);

View File

@ -652,7 +652,7 @@ static BOOL http_proxy_connect(BIO* bufferedBio, const char* proxyUsername,
recv_buf[7] = 'X';
if (strncmp(recv_buf, "HTTP/1.X 200", 12))
if (strncmp(recv_buf, "HTTP/1.X 200", 12) != 0)
goto fail;
rc = TRUE;

View File

@ -692,6 +692,8 @@ static BOOL rdp_security_stream_out(rdpRdp* rdp, wStream* s, int length, UINT32
{
BOOL status = 0;
WINPR_ASSERT(rdp);
WINPR_ASSERT(length >= 0);
sec_flags |= rdp->sec_flags;
*pad = 0;
@ -709,7 +711,12 @@ static BOOL rdp_security_stream_out(rdpRdp* rdp, wStream* s, int length, UINT32
if (rdp->settings->EncryptionMethods == ENCRYPTION_METHOD_FIPS)
{
BYTE* data = Stream_PointerAs(s, BYTE) + 12;
length = length - (data - Stream_Buffer(s));
const size_t size = (data - Stream_Buffer(s));
if (size > length)
goto unlock;
length -= (int)size;
Stream_Write_UINT16(s, 0x10); /* length */
Stream_Write_UINT8(s, 0x1); /* TSFIPS_VERSION 1*/
/* handle padding */

View File

@ -250,6 +250,8 @@ static BOOL rdp_redirection_read_base64_wchar(UINT32 flag, wStream* s, UINT32* p
redirection_free_data(pData, NULL);
utf8_len = strnlen(utf8, utf8_len);
*pData = NULL;
if (utf8_len > 0)
*pData = calloc(utf8_len, sizeof(BYTE));
if (!*pData)
goto fail;

View File

@ -1558,7 +1558,8 @@ BOOL WINAPI FreeRDP_WTSVirtualChannelWrite(HANDLE hChannelHandle, PCHAR Buffer,
CopyMemory(buffer, Buffer, length);
totalWritten = Length;
ret = wts_queue_send_item(channel, buffer, length);
if (!wts_queue_send_item(channel, buffer, length))
goto fail;
}
else if (!channel->vcm->drdynvc_channel || (channel->vcm->drdynvc_state != DRDYNVC_STATE_READY))
{

View File

@ -40,7 +40,7 @@ FREERDP_LOCAL BOOL freerdp_settings_set_default_order_support(rdpSettings* setti
FREERDP_LOCAL BOOL freerdp_settings_clone_keys(rdpSettings* dst, const rdpSettings* src);
FREERDP_LOCAL void freerdp_settings_free_keys(rdpSettings* dst, BOOL cleanup);
FREERDP_LOCAL BOOL freerdp_settings_set_string_(rdpSettings* settings,
FreeRDP_Settings_Keys_String id, char* val,
FreeRDP_Settings_Keys_String id, const char* val,
size_t len);
FREERDP_LOCAL BOOL freerdp_settings_set_string_copy_(rdpSettings* settings,
FreeRDP_Settings_Keys_String id,

View File

@ -895,7 +895,7 @@ static void peer_free(t_peer* peer)
peer->s = INVALID_SOCKET;
}
static int freerdp_tcp_connect_multi(rdpContext* context, char** hostnames, UINT32* ports,
static int freerdp_tcp_connect_multi(rdpContext* context, char** hostnames, const UINT32* ports,
UINT32 count, UINT16 port, UINT32 timeout)
{
UINT32 sindex = count;

View File

@ -32,7 +32,7 @@ int TestVersion(int argc, char* argv[])
if (!git)
return -1;
if (strncmp(git, FREERDP_GIT_REVISION, sizeof(FREERDP_GIT_REVISION)))
if (strncmp(git, FREERDP_GIT_REVISION, sizeof(FREERDP_GIT_REVISION)) != 0)
return -1;
build = freerdp_get_build_config();

View File

@ -377,8 +377,8 @@ fail:
return NULL;
}
static BOOL _update_read_pointer_color(wStream* s, POINTER_COLOR_UPDATE* pointer_color, BYTE xorBpp,
UINT32 flags)
static BOOL s_update_read_pointer_color(wStream* s, POINTER_COLOR_UPDATE* pointer_color,
BYTE xorBpp, UINT32 flags)
{
BYTE* newMask = NULL;
UINT32 scanlineSize = 0;
@ -514,7 +514,7 @@ POINTER_COLOR_UPDATE* update_read_pointer_color(rdpUpdate* update, wStream* s, B
if (!pointer_color)
goto fail;
if (!_update_read_pointer_color(s, pointer_color, xorBpp,
if (!s_update_read_pointer_color(s, pointer_color, xorBpp,
update->context->settings->LargePointerFlag))
goto fail;
@ -527,7 +527,7 @@ fail:
return NULL;
}
static BOOL _update_read_pointer_large(wStream* s, POINTER_LARGE_UPDATE* pointer)
static BOOL s_update_read_pointer_large(wStream* s, POINTER_LARGE_UPDATE* pointer)
{
BYTE* newMask = NULL;
UINT32 scanlineSize = 0;
@ -644,7 +644,7 @@ POINTER_LARGE_UPDATE* update_read_pointer_large(rdpUpdate* update, wStream* s)
if (!pointer)
goto fail;
if (!_update_read_pointer_large(s, pointer))
if (!s_update_read_pointer_large(s, pointer))
goto fail;
return pointer;
@ -676,7 +676,8 @@ POINTER_NEW_UPDATE* update_read_pointer_new(rdpUpdate* update, wStream* s)
goto fail;
}
if (!_update_read_pointer_color(s, &pointer_new->colorPtrAttr, pointer_new->xorBpp,
if (!s_update_read_pointer_color(
s, &pointer_new->colorPtrAttr, pointer_new->xorBpp,
update->context->settings->LargePointerFlag)) /* colorPtrAttr */
goto fail;
@ -984,7 +985,7 @@ void update_post_disconnect(rdpUpdate* update)
up->initialState = TRUE;
}
static BOOL _update_begin_paint(rdpContext* context)
static BOOL s_update_begin_paint(rdpContext* context)
{
wStream* s = NULL;
WINPR_ASSERT(context);
@ -1011,7 +1012,7 @@ static BOOL _update_begin_paint(rdpContext* context)
return TRUE;
}
static BOOL _update_end_paint(rdpContext* context)
static BOOL s_update_end_paint(rdpContext* context)
{
wStream* s = NULL;
WINPR_ASSERT(context);
@ -3128,8 +3129,8 @@ void update_register_server_callbacks(rdpUpdate* update)
{
WINPR_ASSERT(update);
update->BeginPaint = _update_begin_paint;
update->EndPaint = _update_end_paint;
update->BeginPaint = s_update_begin_paint;
update->EndPaint = s_update_end_paint;
update->SetBounds = update_set_bounds;
update->Synchronize = update_send_synchronize;
update->DesktopResize = update_send_desktop_resize;

View File

@ -65,7 +65,7 @@ int TestBase64(int argc, char* argv[])
char* encoded = crypto_base64_encode((const BYTE*)encodeTests_base64[i].input,
encodeTests_base64[i].len);
if (strcmp(encodeTests_base64[i].output, encoded))
if (strcmp(encodeTests_base64[i].output, encoded) != 0)
{
(void)fprintf(stderr, "ko, error for string %d\n", i);
return -1;
@ -83,7 +83,7 @@ int TestBase64(int argc, char* argv[])
char* encoded = crypto_base64url_encode((const BYTE*)encodeTests_base64url[i].input,
encodeTests_base64url[i].len);
if (strcmp(encodeTests_base64url[i].output, encoded))
if (strcmp(encodeTests_base64url[i].output, encoded) != 0)
{
(void)fprintf(stderr, "ko, error for string %d\n", i);
return -1;
@ -102,7 +102,7 @@ int TestBase64(int argc, char* argv[])
&decoded, &outLen);
if (!decoded || (outLen != encodeTests_base64[i].len) ||
memcmp(encodeTests_base64[i].input, decoded, outLen))
memcmp(encodeTests_base64[i].input, decoded, outLen) != 0)
{
(void)fprintf(stderr, "ko, error for string %d\n", i);
return -1;
@ -121,7 +121,7 @@ int TestBase64(int argc, char* argv[])
strlen(encodeTests_base64url[i].output), &decoded, &outLen);
if (!decoded || (outLen != encodeTests_base64url[i].len) ||
memcmp(encodeTests_base64url[i].input, decoded, outLen))
memcmp(encodeTests_base64url[i].input, decoded, outLen) != 0)
{
(void)fprintf(stderr, "ko, error for string %d\n", i);
return -1;

View File

@ -821,7 +821,7 @@ static BOOL tls_prepare(rdpTls* tls, BIO* underlying, SSL_METHOD* method, int op
return TRUE;
}
static void adjustSslOptions(int* options)
static void adjustSslOptions(const int* options)
{
WINPR_ASSERT(options);
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)

View File

@ -177,7 +177,7 @@ HGDI_BITMAP gdi_CreateCompatibleBitmap(HGDI_DC hdc, UINT32 nWidth, UINT32 nHeigh
return hBitmap;
}
static BOOL op_not(UINT32* stack, UINT32* stackp)
static BOOL op_not(UINT32* stack, const UINT32* stackp)
{
if (!stack || !stackp)
return FALSE;

View File

@ -270,7 +270,7 @@ BOOL gdi_Polyline(HGDI_DC hdc, GDI_POINT* lppt, UINT32 cPoints)
* @param cCount count of entries in lpdwPolyPoints
* @return nonzero on success, 0 otherwise
*/
BOOL gdi_PolyPolyline(HGDI_DC hdc, GDI_POINT* lppt, UINT32* lpdwPolyPoints, DWORD cCount)
BOOL gdi_PolyPolyline(HGDI_DC hdc, GDI_POINT* lppt, const UINT32* lpdwPolyPoints, DWORD cCount)
{
DWORD j = 0;

View File

@ -33,7 +33,7 @@ extern "C"
FREERDP_LOCAL BOOL gdi_LineTo(HGDI_DC hdc, UINT32 nXEnd, UINT32 nYEnd);
FREERDP_LOCAL BOOL gdi_PolylineTo(HGDI_DC hdc, GDI_POINT* lppt, DWORD cCount);
FREERDP_LOCAL BOOL gdi_Polyline(HGDI_DC hdc, GDI_POINT* lppt, UINT32 cPoints);
FREERDP_LOCAL BOOL gdi_PolyPolyline(HGDI_DC hdc, GDI_POINT* lppt, UINT32* lpdwPolyPoints,
FREERDP_LOCAL BOOL gdi_PolyPolyline(HGDI_DC hdc, GDI_POINT* lppt, const UINT32* lpdwPolyPoints,
DWORD cCount);
FREERDP_LOCAL BOOL gdi_MoveToEx(HGDI_DC hdc, UINT32 X, UINT32 Y, HGDI_POINT lpPoint);

View File

@ -255,8 +255,8 @@ static int freerdp_detect_keyboard(DWORD* keyboardLayoutId)
return 0;
}
static int freerdp_keyboard_init_apple(DWORD* keyboardLayoutId, DWORD* x11_keycode_to_rdp_scancode,
size_t count)
static int freerdp_keyboard_init_apple(const DWORD* keyboardLayoutId,
DWORD* x11_keycode_to_rdp_scancode, size_t count)
{
WINPR_ASSERT(x11_keycode_to_rdp_scancode);
WINPR_ASSERT(keyboardLayoutId);
@ -272,7 +272,7 @@ static int freerdp_keyboard_init_apple(DWORD* keyboardLayoutId, DWORD* x11_keyco
return 0;
}
static int freerdp_keyboard_init_x11_evdev(DWORD* keyboardLayoutId,
static int freerdp_keyboard_init_x11_evdev(const DWORD* keyboardLayoutId,
DWORD* x11_keycode_to_rdp_scancode, size_t count)
{
WINPR_ASSERT(keyboardLayoutId);

View File

@ -632,7 +632,7 @@ static INLINE BYTE RGB2V(INT32 R, INT32 G, INT32 B)
static pstatus_t general_RGBToYUV444_8u_P3AC4R(const BYTE* WINPR_RESTRICT pSrc, UINT32 SrcFormat,
const UINT32 srcStep, BYTE* WINPR_RESTRICT pDst[3],
UINT32 dstStep[3],
const UINT32 dstStep[3],
const prim_size_t* WINPR_RESTRICT roi)
{
const UINT32 bpp = FreeRDPGetBytesPerPixel(SrcFormat);

View File

@ -41,10 +41,10 @@ static primitives_t* generic = NULL;
#define CACHE_LINE_BYTES 64
#define _mm_between_epi16(_val, _min, _max) \
#define mm_between_epi16(_val, _min, _max) \
do \
{ \
_val = _mm_min_epi16(_max, _mm_max_epi16(_val, _min)); \
(_val) = _mm_min_epi16(_max, _mm_max_epi16(_val, _min)); \
} while (0)
#ifdef DO_PREFETCH
@ -173,20 +173,20 @@ sse2_yCbCrToRGB_16s16s_P3P3(const INT16* const WINPR_RESTRICT pSrc[3], int srcSt
r = _mm_add_epi16(y, _mm_mulhi_epi16(cr, r_cr));
r = _mm_srai_epi16(r, 3);
/* r_buf[i] = CLIP(r); */
_mm_between_epi16(r, zero, max);
mm_between_epi16(r, zero, max);
_mm_store_si128(r_buf + i, r);
/* (y + HIWORD(cb*-5636) + HIWORD(cr*-11698)) >> 3 */
g = _mm_add_epi16(y, _mm_mulhi_epi16(cb, g_cb));
g = _mm_add_epi16(g, _mm_mulhi_epi16(cr, g_cr));
g = _mm_srai_epi16(g, 3);
/* g_buf[i] = CLIP(g); */
_mm_between_epi16(g, zero, max);
mm_between_epi16(g, zero, max);
_mm_store_si128(g_buf + i, g);
/* (y + HIWORD(cb*28999)) >> 3 */
b = _mm_add_epi16(y, _mm_mulhi_epi16(cb, b_cb));
b = _mm_srai_epi16(b, 3);
/* b_buf[i] = CLIP(b); */
_mm_between_epi16(b, zero, max);
mm_between_epi16(b, zero, max);
_mm_store_si128(b_buf + i, b);
}
@ -294,18 +294,18 @@ sse2_yCbCrToRGB_16s8u_P3AC4R_BGRX(const INT16* const WINPR_RESTRICT pSrc[3], UIN
r1 = _mm_add_epi16(y1, _mm_mulhi_epi16(cr1, r_cr));
r1 = _mm_srai_epi16(r1, 3);
/* r_buf[i] = CLIP(r); */
_mm_between_epi16(r1, zero, max);
mm_between_epi16(r1, zero, max);
/* (y + HIWORD(cb*-5636) + HIWORD(cr*-11698)) >> 3 */
g1 = _mm_add_epi16(y1, _mm_mulhi_epi16(cb1, g_cb));
g1 = _mm_add_epi16(g1, _mm_mulhi_epi16(cr1, g_cr));
g1 = _mm_srai_epi16(g1, 3);
/* g_buf[i] = CLIP(g); */
_mm_between_epi16(g1, zero, max);
mm_between_epi16(g1, zero, max);
/* (y + HIWORD(cb*28999)) >> 3 */
b1 = _mm_add_epi16(y1, _mm_mulhi_epi16(cb1, b_cb));
b1 = _mm_srai_epi16(b1, 3);
/* b_buf[i] = CLIP(b); */
_mm_between_epi16(b1, zero, max);
mm_between_epi16(b1, zero, max);
y2 = _mm_load_si128((const __m128i*)y_buf);
y_buf += step;
y2 = _mm_add_epi16(y2, c4096);
@ -320,18 +320,18 @@ sse2_yCbCrToRGB_16s8u_P3AC4R_BGRX(const INT16* const WINPR_RESTRICT pSrc[3], UIN
r2 = _mm_add_epi16(y2, _mm_mulhi_epi16(cr2, r_cr));
r2 = _mm_srai_epi16(r2, 3);
/* r_buf[i] = CLIP(r); */
_mm_between_epi16(r2, zero, max);
mm_between_epi16(r2, zero, max);
/* (y + HIWORD(cb*-5636) + HIWORD(cr*-11698)) >> 3 */
g2 = _mm_add_epi16(y2, _mm_mulhi_epi16(cb2, g_cb));
g2 = _mm_add_epi16(g2, _mm_mulhi_epi16(cr2, g_cr));
g2 = _mm_srai_epi16(g2, 3);
/* g_buf[i] = CLIP(g); */
_mm_between_epi16(g2, zero, max);
mm_between_epi16(g2, zero, max);
/* (y + HIWORD(cb*28999)) >> 3 */
b2 = _mm_add_epi16(y2, _mm_mulhi_epi16(cb2, b_cb));
b2 = _mm_srai_epi16(b2, 3);
/* b_buf[i] = CLIP(b); */
_mm_between_epi16(b2, zero, max);
mm_between_epi16(b2, zero, max);
{
__m128i R0;
__m128i R1;
@ -492,18 +492,18 @@ sse2_yCbCrToRGB_16s8u_P3AC4R_RGBX(const INT16* const WINPR_RESTRICT pSrc[3], UIN
r1 = _mm_add_epi16(y1, _mm_mulhi_epi16(cr1, r_cr));
r1 = _mm_srai_epi16(r1, 3);
/* r_buf[i] = CLIP(r); */
_mm_between_epi16(r1, zero, max);
mm_between_epi16(r1, zero, max);
/* (y + HIWORD(cb*-5636) + HIWORD(cr*-11698)) >> 3 */
g1 = _mm_add_epi16(y1, _mm_mulhi_epi16(cb1, g_cb));
g1 = _mm_add_epi16(g1, _mm_mulhi_epi16(cr1, g_cr));
g1 = _mm_srai_epi16(g1, 3);
/* g_buf[i] = CLIP(g); */
_mm_between_epi16(g1, zero, max);
mm_between_epi16(g1, zero, max);
/* (y + HIWORD(cb*28999)) >> 3 */
b1 = _mm_add_epi16(y1, _mm_mulhi_epi16(cb1, b_cb));
b1 = _mm_srai_epi16(b1, 3);
/* b_buf[i] = CLIP(b); */
_mm_between_epi16(b1, zero, max);
mm_between_epi16(b1, zero, max);
y2 = _mm_load_si128((const __m128i*)y_buf);
y_buf += step;
y2 = _mm_add_epi16(y2, c4096);
@ -518,18 +518,18 @@ sse2_yCbCrToRGB_16s8u_P3AC4R_RGBX(const INT16* const WINPR_RESTRICT pSrc[3], UIN
r2 = _mm_add_epi16(y2, _mm_mulhi_epi16(cr2, r_cr));
r2 = _mm_srai_epi16(r2, 3);
/* r_buf[i] = CLIP(r); */
_mm_between_epi16(r2, zero, max);
mm_between_epi16(r2, zero, max);
/* (y + HIWORD(cb*-5636) + HIWORD(cr*-11698)) >> 3 */
g2 = _mm_add_epi16(y2, _mm_mulhi_epi16(cb2, g_cb));
g2 = _mm_add_epi16(g2, _mm_mulhi_epi16(cr2, g_cr));
g2 = _mm_srai_epi16(g2, 3);
/* g_buf[i] = CLIP(g); */
_mm_between_epi16(g2, zero, max);
mm_between_epi16(g2, zero, max);
/* (y + HIWORD(cb*28999)) >> 3 */
b2 = _mm_add_epi16(y2, _mm_mulhi_epi16(cb2, b_cb));
b2 = _mm_srai_epi16(b2, 3);
/* b_buf[i] = CLIP(b); */
_mm_between_epi16(b2, zero, max);
mm_between_epi16(b2, zero, max);
{
__m128i R0;
__m128i R1;
@ -734,21 +734,21 @@ sse2_RGBToYCbCr_16s16s_P3P3(const INT16* const WINPR_RESTRICT pSrc[3], int srcSt
y = _mm_add_epi16(y, _mm_mulhi_epi16(b, y_b));
y = _mm_add_epi16(y, min);
/* y_r_buf[i] = MINMAX(y, 0, (255 << 5)) - (128 << 5); */
_mm_between_epi16(y, min, max);
mm_between_epi16(y, min, max);
_mm_store_si128(y_buf + i, y);
/* cb = HIWORD(r*cb_r) + HIWORD(g*cb_g) + HIWORD(b*cb_b) */
cb = _mm_mulhi_epi16(r, cb_r);
cb = _mm_add_epi16(cb, _mm_mulhi_epi16(g, cb_g));
cb = _mm_add_epi16(cb, _mm_mulhi_epi16(b, cb_b));
/* cb_g_buf[i] = MINMAX(cb, (-128 << 5), (127 << 5)); */
_mm_between_epi16(cb, min, max);
mm_between_epi16(cb, min, max);
_mm_store_si128(cb_buf + i, cb);
/* cr = HIWORD(r*cr_r) + HIWORD(g*cr_g) + HIWORD(b*cr_b) */
cr = _mm_mulhi_epi16(r, cr_r);
cr = _mm_add_epi16(cr, _mm_mulhi_epi16(g, cr_g));
cr = _mm_add_epi16(cr, _mm_mulhi_epi16(b, cr_b));
/* cr_b_buf[i] = MINMAX(cr, (-128 << 5), (127 << 5)); */
_mm_between_epi16(cr, min, max);
mm_between_epi16(cr, min, max);
_mm_store_si128(cr_buf + i, cr);
}