[winpr] remove casts for winpr_RAND calls

This commit is contained in:
akallabeth 2023-06-20 09:03:21 +02:00 committed by David Fort
parent 04fa5b3033
commit 1fc0d5b4b1
17 changed files with 67 additions and 67 deletions

View File

@ -276,7 +276,7 @@ int TestClientRdpFile(int argc, char* argv[])
WINPR_UNUSED(argc); WINPR_UNUSED(argc);
WINPR_UNUSED(argv); WINPR_UNUSED(argv);
winpr_RAND((BYTE*)&id, sizeof(id)); winpr_RAND(&id, sizeof(id));
/* Unicode */ /* Unicode */
file = freerdp_client_rdp_file_new(); file = freerdp_client_rdp_file_new();

View File

@ -5656,7 +5656,7 @@ static UINT32 prand(UINT32 max)
UINT32 tmp; UINT32 tmp;
if (max <= 1) if (max <= 1)
return 1; return 1;
winpr_RAND((BYTE*)&tmp, sizeof(tmp)); winpr_RAND(&tmp, sizeof(tmp));
return tmp % (max - 1) + 1; return tmp % (max - 1) + 1;
} }

View File

@ -796,7 +796,7 @@ char* freerdp_assistance_generate_pass_stub(DWORD flags)
* *
* Example: WB^6HsrIaFmEpi * Example: WB^6HsrIaFmEpi
*/ */
winpr_RAND((BYTE*)nums, sizeof(nums)); winpr_RAND(nums, sizeof(nums));
passStub[0] = set1[nums[0] % sizeof(set1)]; /* character 0 */ passStub[0] = set1[nums[0] % sizeof(set1)]; /* character 0 */
passStub[1] = set2[nums[1] % sizeof(set2)]; /* character 1 */ passStub[1] = set2[nums[1] % sizeof(set2)]; /* character 1 */
passStub[2] = set3[nums[2] % sizeof(set3)]; /* character 2 */ passStub[2] = set3[nums[2] % sizeof(set3)]; /* character 2 */

View File

@ -19,7 +19,7 @@ static BOOL test_alloc(void)
goto fail; goto fail;
/* Test allocation without initializing arguments of random size > 0 */ /* Test allocation without initializing arguments of random size > 0 */
winpr_RAND((BYTE*)&rng, sizeof(rng)); winpr_RAND(&rng, sizeof(rng));
rng = abs(rng % 8192) + 1; rng = abs(rng % 8192) + 1;
arg2 = freerdp_addin_argv_new(rng, NULL); arg2 = freerdp_addin_argv_new(rng, NULL);

View File

@ -405,7 +405,7 @@ static BOOL rdg_write_websocket(BIO* bio, wStream* sPacket, WEBSOCKET_OPCODE opc
if (!sWS) if (!sWS)
return FALSE; return FALSE;
winpr_RAND((BYTE*)&maskingKey, 4); winpr_RAND(&maskingKey, 4);
Stream_Write_UINT8(sWS, WEBSOCKET_FIN_BIT | opcode); Stream_Write_UINT8(sWS, WEBSOCKET_FIN_BIT | opcode);
if (len < 126) if (len < 126)
@ -575,8 +575,8 @@ static BOOL rdg_websocket_reply_close(BIO* bio, wStream* s)
Stream_Write_UINT8(closeFrame, WEBSOCKET_FIN_BIT | WebsocketPongOpcode); Stream_Write_UINT8(closeFrame, WEBSOCKET_FIN_BIT | WebsocketPongOpcode);
Stream_Write_UINT8(closeFrame, closeDataLen | WEBSOCKET_MASK_BIT); /* no payload */ Stream_Write_UINT8(closeFrame, closeDataLen | WEBSOCKET_MASK_BIT); /* no payload */
winpr_RAND((BYTE*)&maskingKey1, 2); winpr_RAND(&maskingKey1, 2);
winpr_RAND((BYTE*)&maskingKey2, 2); winpr_RAND(&maskingKey2, 2);
Stream_Write_UINT16(closeFrame, maskingKey1); Stream_Write_UINT16(closeFrame, maskingKey1);
Stream_Write_UINT16(closeFrame, maskingKey2); /* unused half, max 2 bytes of data */ Stream_Write_UINT16(closeFrame, maskingKey2); /* unused half, max 2 bytes of data */
@ -614,7 +614,7 @@ static BOOL rdg_websocket_reply_pong(BIO* bio, wStream* s)
Stream_Write_UINT8(closeFrame, WEBSOCKET_FIN_BIT | WebsocketPongOpcode); Stream_Write_UINT8(closeFrame, WEBSOCKET_FIN_BIT | WebsocketPongOpcode);
Stream_Write_UINT8(closeFrame, 0 | WEBSOCKET_MASK_BIT); /* no payload */ Stream_Write_UINT8(closeFrame, 0 | WEBSOCKET_MASK_BIT); /* no payload */
winpr_RAND((BYTE*)&maskingKey, 4); winpr_RAND(&maskingKey, 4);
Stream_Write_UINT32(closeFrame, maskingKey); /* dummy masking key. */ Stream_Write_UINT32(closeFrame, maskingKey); /* dummy masking key. */
Stream_SealLength(closeFrame); Stream_SealLength(closeFrame);
@ -2126,7 +2126,7 @@ static int rdg_write_websocket_data_packet(rdpRdg* rdg, const BYTE* buf, int isi
int streamPos; int streamPos;
winpr_RAND((BYTE*)&maskingKey, 4); winpr_RAND(&maskingKey, 4);
payloadSize = isize + 10; payloadSize = isize + 10;
if ((isize < 0) || (isize > UINT16_MAX)) if ((isize < 0) || (isize > UINT16_MAX))

View File

@ -317,7 +317,7 @@ int TestConnect(int argc, char* argv[])
int random; int random;
WINPR_UNUSED(argc); WINPR_UNUSED(argc);
WINPR_UNUSED(argv); WINPR_UNUSED(argv);
winpr_RAND((BYTE*)&random, sizeof(random)); winpr_RAND(&random, sizeof(random));
randomPort = 3389 + (random % 200); randomPort = 3389 + (random % 200);
/* Test connect to not existing server, /* Test connect to not existing server,

View File

@ -400,7 +400,7 @@ LONG WINAPI Emulate_SCardEstablishContext(SmartcardEmulationContext* smartcard,
{ {
SCARDCONTEXT context = { 0 }; SCARDCONTEXT context = { 0 };
winpr_RAND((BYTE*)&context, sizeof(SCARDCONTEXT)); winpr_RAND(&context, sizeof(SCARDCONTEXT));
if (HashTable_Insert(smartcard->contexts, (const void*)context, ctx)) if (HashTable_Insert(smartcard->contexts, (const void*)context, ctx))
{ {
*phContext = context; *phContext = context;
@ -1219,7 +1219,7 @@ HANDLE WINAPI Emulate_SCardAccessStartedEvent(SmartcardEmulationContext* smartca
WLog_Print(smartcard->log, smartcard->log_default_level, "SCardAccessStartedEvent {"); WLog_Print(smartcard->log, smartcard->log_default_level, "SCardAccessStartedEvent {");
/* Not required, return random */ /* Not required, return random */
winpr_RAND((BYTE*)&hEvent, sizeof(hEvent)); winpr_RAND(&hEvent, sizeof(hEvent));
WLog_Print(smartcard->log, smartcard->log_default_level, "SCardAccessStartedEvent } hEvent: %p", WLog_Print(smartcard->log, smartcard->log_default_level, "SCardAccessStartedEvent } hEvent: %p",
hEvent); hEvent);
@ -1551,7 +1551,7 @@ static SCardHandle* reader2handle(SmartcardEmulationContext* smartcard, SCARDCON
hdl = scard_handle_new(smartcard, hContext, szReader, unicode); hdl = scard_handle_new(smartcard, hContext, szReader, unicode);
if (hdl) if (hdl)
{ {
winpr_RAND((BYTE*)&hdl->card, sizeof(hdl->card)); winpr_RAND(&hdl->card, sizeof(hdl->card));
hdl->dwActiveProtocol = SCARD_PROTOCOL_T1; hdl->dwActiveProtocol = SCARD_PROTOCOL_T1;
hdl->dwShareMode = dwShareMode; hdl->dwShareMode = dwShareMode;

View File

@ -27,8 +27,8 @@ static BOOL test_add16s_func(void)
ALIGN(d1[FUNC_TEST_SIZE + 3]) = { 0 }, ALIGN(d1[FUNC_TEST_SIZE + 3]) = { 0 },
ALIGN(d2[FUNC_TEST_SIZE + 3]) = { 0 }; ALIGN(d2[FUNC_TEST_SIZE + 3]) = { 0 };
winpr_RAND((BYTE*)src1, sizeof(src1)); winpr_RAND(src1, sizeof(src1));
winpr_RAND((BYTE*)src2, sizeof(src2)); winpr_RAND(src2, sizeof(src2));
status = generic->add_16s(src1 + 1, src2 + 1, d1 + 1, FUNC_TEST_SIZE); status = generic->add_16s(src1 + 1, src2 + 1, d1 + 1, FUNC_TEST_SIZE);
if (status != PRIMITIVES_SUCCESS) if (status != PRIMITIVES_SUCCESS)
return FALSE; return FALSE;

View File

@ -123,11 +123,11 @@ static BOOL test_alphaComp_func(void)
BYTE ALIGN(dst1[DST_WIDTH * DST_HEIGHT * 4]) = { 0 }; BYTE ALIGN(dst1[DST_WIDTH * DST_HEIGHT * 4]) = { 0 };
UINT32* ptr; UINT32* ptr;
UINT32 i; UINT32 i;
winpr_RAND((BYTE*)src1, sizeof(src1)); winpr_RAND(src1, sizeof(src1));
/* Special-case the first two values */ /* Special-case the first two values */
src1[0] &= 0x00FFFFFFU; src1[0] &= 0x00FFFFFFU;
src1[1] |= 0xFF000000U; src1[1] |= 0xFF000000U;
winpr_RAND((BYTE*)src2, sizeof(src2)); winpr_RAND(src2, sizeof(src2));
/* Set the second operand to fully-opaque. */ /* Set the second operand to fully-opaque. */
ptr = (UINT32*)src2; ptr = (UINT32*)src2;
@ -167,11 +167,11 @@ static int test_alphaComp_speed(void)
UINT32* ptr; UINT32* ptr;
UINT32 i; UINT32 i;
testStr[0] = '\0'; testStr[0] = '\0';
winpr_RAND((BYTE*)src1, sizeof(src1)); winpr_RAND(src1, sizeof(src1));
/* Special-case the first two values */ /* Special-case the first two values */
src1[0] &= 0x00FFFFFFU; src1[0] &= 0x00FFFFFFU;
src1[1] |= 0xFF000000U; src1[1] |= 0xFF000000U;
winpr_RAND((BYTE*)src2, sizeof(src2)); winpr_RAND(src2, sizeof(src2));
/* Set the second operand to fully-opaque. */ /* Set the second operand to fully-opaque. */
ptr = (UINT32*)src2; ptr = (UINT32*)src2;

View File

@ -52,7 +52,7 @@ static BOOL test_and_32u_func(void)
UINT32 ALIGN(src[FUNC_TEST_SIZE + 3]) = { 0 }; UINT32 ALIGN(src[FUNC_TEST_SIZE + 3]) = { 0 };
UINT32 ALIGN(dst[FUNC_TEST_SIZE + 3]) = { 0 }; UINT32 ALIGN(dst[FUNC_TEST_SIZE + 3]) = { 0 };
winpr_RAND((BYTE*)src, sizeof(src)); winpr_RAND(src, sizeof(src));
if (!test_and_32u_impl("generic->andC_32u aligned", generic->andC_32u, src + 1, VALUE, dst + 1, if (!test_and_32u_impl("generic->andC_32u aligned", generic->andC_32u, src + 1, VALUE, dst + 1,
FUNC_TEST_SIZE)) FUNC_TEST_SIZE))
@ -76,7 +76,7 @@ static BOOL test_and_32u_speed(void)
UINT32 ALIGN(src[MAX_TEST_SIZE + 3]) = { 0 }; UINT32 ALIGN(src[MAX_TEST_SIZE + 3]) = { 0 };
UINT32 ALIGN(dst[MAX_TEST_SIZE + 3]) = { 0 }; UINT32 ALIGN(dst[MAX_TEST_SIZE + 3]) = { 0 };
winpr_RAND((BYTE*)src, sizeof(src)); winpr_RAND(src, sizeof(src));
if (!speed_test("andC_32u", "aligned", g_Iterations, (speed_test_fkt)generic->andC_32u, if (!speed_test("andC_32u", "aligned", g_Iterations, (speed_test_fkt)generic->andC_32u,
(speed_test_fkt)optimized->andC_32u, src + 1, VALUE, dst + 1, MAX_TEST_SIZE)) (speed_test_fkt)optimized->andC_32u, src + 1, VALUE, dst + 1, MAX_TEST_SIZE))
@ -113,7 +113,7 @@ static BOOL test_or_32u_func(void)
UINT32 ALIGN(src[FUNC_TEST_SIZE + 3]) = { 0 }; UINT32 ALIGN(src[FUNC_TEST_SIZE + 3]) = { 0 };
UINT32 ALIGN(dst[FUNC_TEST_SIZE + 3]) = { 0 }; UINT32 ALIGN(dst[FUNC_TEST_SIZE + 3]) = { 0 };
winpr_RAND((BYTE*)src, sizeof(src)); winpr_RAND(src, sizeof(src));
status = generic->orC_32u(src + 1, VALUE, dst + 1, FUNC_TEST_SIZE); status = generic->orC_32u(src + 1, VALUE, dst + 1, FUNC_TEST_SIZE);
if (status != PRIMITIVES_SUCCESS) if (status != PRIMITIVES_SUCCESS)
@ -139,7 +139,7 @@ static BOOL test_or_32u_speed(void)
UINT32 ALIGN(dst[FUNC_TEST_SIZE + 3]) = { 0 }; UINT32 ALIGN(dst[FUNC_TEST_SIZE + 3]) = { 0 };
char testStr[256]; char testStr[256];
testStr[0] = '\0'; testStr[0] = '\0';
winpr_RAND((BYTE*)src, sizeof(src)); winpr_RAND(src, sizeof(src));
if (!speed_test("add16s", "aligned", g_Iterations, (speed_test_fkt)generic->orC_32u, if (!speed_test("add16s", "aligned", g_Iterations, (speed_test_fkt)generic->orC_32u,
(speed_test_fkt)optimized->orC_32u, src + 1, VALUE, dst + 1, FUNC_TEST_SIZE)) (speed_test_fkt)optimized->orC_32u, src + 1, VALUE, dst + 1, FUNC_TEST_SIZE))

View File

@ -60,9 +60,9 @@ static BOOL test_RGBToRGB_16s8u_P3AC4R_func(prim_size_t roi, DWORD DstFormat)
} }
} }
#else #else
winpr_RAND((BYTE*)r, rgbStride * roi.height); winpr_RAND(r, rgbStride * roi.height);
winpr_RAND((BYTE*)g, rgbStride * roi.height); winpr_RAND(g, rgbStride * roi.height);
winpr_RAND((BYTE*)b, rgbStride * roi.height); winpr_RAND(b, rgbStride * roi.height);
#endif #endif
ptrs[0] = r; ptrs[0] = r;
ptrs[1] = g; ptrs[1] = g;
@ -129,9 +129,9 @@ static BOOL test_RGBToRGB_16s8u_P3AC4R_speed(void)
UINT32 ALIGN(dst[4096 + 1]); UINT32 ALIGN(dst[4096 + 1]);
int i; int i;
INT16* ptrs[3]; INT16* ptrs[3];
winpr_RAND((BYTE*)r, sizeof(r)); winpr_RAND(r, sizeof(r));
winpr_RAND((BYTE*)g, sizeof(g)); winpr_RAND(g, sizeof(g));
winpr_RAND((BYTE*)b, sizeof(b)); winpr_RAND(b, sizeof(b));
/* clear upper bytes */ /* clear upper bytes */
for (i = 0; i < 4096; ++i) for (i = 0; i < 4096; ++i)
@ -171,9 +171,9 @@ static BOOL test_yCbCrToRGB_16s16s_P3P3_func(void)
INT16* out1[3]; INT16* out1[3];
INT16* out2[3]; INT16* out2[3];
prim_size_t roi = { 64, 64 }; prim_size_t roi = { 64, 64 };
winpr_RAND((BYTE*)y, sizeof(y)); winpr_RAND(y, sizeof(y));
winpr_RAND((BYTE*)cb, sizeof(cb)); winpr_RAND(cb, sizeof(cb));
winpr_RAND((BYTE*)cr, sizeof(cr)); winpr_RAND(cr, sizeof(cr));
/* Normalize to 11.5 fixed radix */ /* Normalize to 11.5 fixed radix */
for (i = 0; i < 4096; ++i) for (i = 0; i < 4096; ++i)
@ -225,9 +225,9 @@ static int test_yCbCrToRGB_16s16s_P3P3_speed(void)
int i; int i;
const INT16* input[3]; const INT16* input[3];
INT16* output[3]; INT16* output[3];
winpr_RAND((BYTE*)y, sizeof(y)); winpr_RAND(y, sizeof(y));
winpr_RAND((BYTE*)cb, sizeof(cb)); winpr_RAND(cb, sizeof(cb));
winpr_RAND((BYTE*)cr, sizeof(cr)); winpr_RAND(cr, sizeof(cr));
/* Normalize to 11.5 fixed radix */ /* Normalize to 11.5 fixed radix */
for (i = 0; i < 4096; ++i) for (i = 0; i < 4096; ++i)

View File

@ -25,8 +25,8 @@ static BOOL test_lShift_16s_func(void)
INT16 ALIGN(src[FUNC_TEST_SIZE + 3]); INT16 ALIGN(src[FUNC_TEST_SIZE + 3]);
INT16 ALIGN(d1[FUNC_TEST_SIZE + 3]); INT16 ALIGN(d1[FUNC_TEST_SIZE + 3]);
UINT32 val; UINT32 val;
winpr_RAND((BYTE*)&val, sizeof(val)); winpr_RAND(&val, sizeof(val));
winpr_RAND((BYTE*)src, sizeof(src)); winpr_RAND(src, sizeof(src));
val = val % 16; val = val % 16;
/* Negative tests */ /* Negative tests */
status = generic->lShiftC_16s(src + 1, 16, d1 + 1, FUNC_TEST_SIZE); status = generic->lShiftC_16s(src + 1, 16, d1 + 1, FUNC_TEST_SIZE);
@ -70,8 +70,8 @@ static BOOL test_lShift_16u_func(void)
UINT16 ALIGN(src[FUNC_TEST_SIZE + 3]); UINT16 ALIGN(src[FUNC_TEST_SIZE + 3]);
UINT16 ALIGN(d1[FUNC_TEST_SIZE + 3]); UINT16 ALIGN(d1[FUNC_TEST_SIZE + 3]);
UINT32 val; UINT32 val;
winpr_RAND((BYTE*)&val, sizeof(val)); winpr_RAND(&val, sizeof(val));
winpr_RAND((BYTE*)src, sizeof(src)); winpr_RAND(src, sizeof(src));
val = val % 16; val = val % 16;
/* Negative tests */ /* Negative tests */
@ -116,8 +116,8 @@ static BOOL test_rShift_16s_func(void)
INT16 ALIGN(src[FUNC_TEST_SIZE + 3]); INT16 ALIGN(src[FUNC_TEST_SIZE + 3]);
INT16 ALIGN(d1[FUNC_TEST_SIZE + 3]); INT16 ALIGN(d1[FUNC_TEST_SIZE + 3]);
UINT32 val; UINT32 val;
winpr_RAND((BYTE*)&val, sizeof(val)); winpr_RAND(&val, sizeof(val));
winpr_RAND((BYTE*)src, sizeof(src)); winpr_RAND(src, sizeof(src));
val = val % 16; val = val % 16;
/* Negative Tests */ /* Negative Tests */
@ -162,8 +162,8 @@ static BOOL test_rShift_16u_func(void)
UINT16 ALIGN(src[FUNC_TEST_SIZE + 3]); UINT16 ALIGN(src[FUNC_TEST_SIZE + 3]);
UINT16 ALIGN(d1[FUNC_TEST_SIZE + 3]); UINT16 ALIGN(d1[FUNC_TEST_SIZE + 3]);
UINT32 val; UINT32 val;
winpr_RAND((BYTE*)&val, sizeof(val)); winpr_RAND(&val, sizeof(val));
winpr_RAND((BYTE*)src, sizeof(src)); winpr_RAND(src, sizeof(src));
val = val % 16; val = val % 16;
/* Negative tests */ /* Negative tests */
status = generic->rShiftC_16u(src + 1, 16, d1 + 1, FUNC_TEST_SIZE); status = generic->rShiftC_16u(src + 1, 16, d1 + 1, FUNC_TEST_SIZE);
@ -208,8 +208,8 @@ static BOOL test_ShiftWrapper_16s_func(void)
INT16 ALIGN(d1[FUNC_TEST_SIZE + 3]); INT16 ALIGN(d1[FUNC_TEST_SIZE + 3]);
UINT32 tmp; UINT32 tmp;
INT32 val; INT32 val;
winpr_RAND((BYTE*)&tmp, sizeof(tmp)); winpr_RAND(&tmp, sizeof(tmp));
winpr_RAND((BYTE*)src, sizeof(src)); winpr_RAND(src, sizeof(src));
val = tmp % 16; val = tmp % 16;
/* Negative tests */ /* Negative tests */
@ -275,8 +275,8 @@ static BOOL test_ShiftWrapper_16u_func(void)
UINT16 ALIGN(d1[FUNC_TEST_SIZE + 3]); UINT16 ALIGN(d1[FUNC_TEST_SIZE + 3]);
UINT32 tmp; UINT32 tmp;
INT32 val; INT32 val;
winpr_RAND((BYTE*)&tmp, sizeof(tmp)); winpr_RAND(&tmp, sizeof(tmp));
winpr_RAND((BYTE*)src, sizeof(src)); winpr_RAND(src, sizeof(src));
val = tmp % 16; val = tmp % 16;
/* Negative */ /* Negative */
@ -339,8 +339,8 @@ static BOOL test_lShift_16s_speed(void)
{ {
UINT32 val; UINT32 val;
INT16 ALIGN(src[MAX_TEST_SIZE + 1]), ALIGN(dst[MAX_TEST_SIZE + 1]); INT16 ALIGN(src[MAX_TEST_SIZE + 1]), ALIGN(dst[MAX_TEST_SIZE + 1]);
winpr_RAND((BYTE*)src, sizeof(src)); winpr_RAND(src, sizeof(src));
winpr_RAND((BYTE*)&val, sizeof(val)); winpr_RAND(&val, sizeof(val));
val = val % 16; val = val % 16;
if (!speed_test("lShift_16s", "aligned", g_Iterations, (speed_test_fkt)generic->lShiftC_16s, if (!speed_test("lShift_16s", "aligned", g_Iterations, (speed_test_fkt)generic->lShiftC_16s,
@ -359,8 +359,8 @@ static BOOL test_lShift_16u_speed(void)
{ {
UINT32 val; UINT32 val;
UINT16 ALIGN(src[MAX_TEST_SIZE + 1]), ALIGN(dst[MAX_TEST_SIZE + 1]); UINT16 ALIGN(src[MAX_TEST_SIZE + 1]), ALIGN(dst[MAX_TEST_SIZE + 1]);
winpr_RAND((BYTE*)&val, sizeof(val)); winpr_RAND(&val, sizeof(val));
winpr_RAND((BYTE*)src, sizeof(src)); winpr_RAND(src, sizeof(src));
val = val % 16; val = val % 16;
if (!speed_test("lShift_16u", "aligned", g_Iterations, (speed_test_fkt)generic->lShiftC_16u, if (!speed_test("lShift_16u", "aligned", g_Iterations, (speed_test_fkt)generic->lShiftC_16u,
@ -379,8 +379,8 @@ static BOOL test_rShift_16s_speed(void)
{ {
UINT32 val; UINT32 val;
INT16 ALIGN(src[MAX_TEST_SIZE + 1]), ALIGN(dst[MAX_TEST_SIZE + 1]); INT16 ALIGN(src[MAX_TEST_SIZE + 1]), ALIGN(dst[MAX_TEST_SIZE + 1]);
winpr_RAND((BYTE*)src, sizeof(src)); winpr_RAND(src, sizeof(src));
winpr_RAND((BYTE*)&val, sizeof(val)); winpr_RAND(&val, sizeof(val));
val = val % 16; val = val % 16;
if (!speed_test("rShift_16s", "aligned", g_Iterations, (speed_test_fkt)generic->rShiftC_16s, if (!speed_test("rShift_16s", "aligned", g_Iterations, (speed_test_fkt)generic->rShiftC_16s,
@ -399,8 +399,8 @@ static BOOL test_rShift_16u_speed(void)
{ {
UINT32 val; UINT32 val;
UINT16 ALIGN(src[MAX_TEST_SIZE + 1]), ALIGN(dst[MAX_TEST_SIZE + 1]); UINT16 ALIGN(src[MAX_TEST_SIZE + 1]), ALIGN(dst[MAX_TEST_SIZE + 1]);
winpr_RAND((BYTE*)&val, sizeof(val)); winpr_RAND(&val, sizeof(val));
winpr_RAND((BYTE*)src, sizeof(src)); winpr_RAND(src, sizeof(src));
val = val % 16; val = val % 16;
if (!speed_test("rShift_16u", "aligned", g_Iterations, (speed_test_fkt)generic->rShiftC_16u, if (!speed_test("rShift_16u", "aligned", g_Iterations, (speed_test_fkt)generic->rShiftC_16u,

View File

@ -26,7 +26,7 @@ static BOOL test_sign16s_func(void)
INT16 ALIGN(src[TEST_BUFFER_SIZE + 16]) = { 0 }; INT16 ALIGN(src[TEST_BUFFER_SIZE + 16]) = { 0 };
INT16 ALIGN(d1[TEST_BUFFER_SIZE + 16]) = { 0 }; INT16 ALIGN(d1[TEST_BUFFER_SIZE + 16]) = { 0 };
INT16 ALIGN(d2[TEST_BUFFER_SIZE + 16]) = { 0 }; INT16 ALIGN(d2[TEST_BUFFER_SIZE + 16]) = { 0 };
winpr_RAND((BYTE*)src, sizeof(src)); winpr_RAND(src, sizeof(src));
status = generic->sign_16s(src + 1, d1 + 1, TEST_BUFFER_SIZE); status = generic->sign_16s(src + 1, d1 + 1, TEST_BUFFER_SIZE);
if (status != PRIMITIVES_SUCCESS) if (status != PRIMITIVES_SUCCESS)
@ -60,7 +60,7 @@ static int test_sign16s_speed(void)
{ {
INT16 ALIGN(src[MAX_TEST_SIZE + 3]) = { 0 }; INT16 ALIGN(src[MAX_TEST_SIZE + 3]) = { 0 };
INT16 ALIGN(dst[MAX_TEST_SIZE + 3]) = { 0 }; INT16 ALIGN(dst[MAX_TEST_SIZE + 3]) = { 0 };
winpr_RAND((BYTE*)src, sizeof(src)); winpr_RAND(src, sizeof(src));
if (!speed_test("sign16s", "aligned", g_Iterations, (speed_test_fkt)generic->sign_16s, if (!speed_test("sign16s", "aligned", g_Iterations, (speed_test_fkt)generic->sign_16s,
(speed_test_fkt)optimized->sign_16s, src + 1, dst + 1, MAX_TEST_SIZE)) (speed_test_fkt)optimized->sign_16s, src + 1, dst + 1, MAX_TEST_SIZE))

View File

@ -1604,9 +1604,9 @@ static int test_PrimitivesYCbCr(const primitives_t* prims, UINT32 format, prim_s
if (!pYCbCr[0] || !pYCbCr[1] || !pYCbCr[2]) if (!pYCbCr[0] || !pYCbCr[1] || !pYCbCr[2])
goto fail; goto fail;
winpr_RAND((BYTE*)pYCbCr[0], srcSize); winpr_RAND(pYCbCr[0], srcSize);
winpr_RAND((BYTE*)pYCbCr[1], srcSize); winpr_RAND(pYCbCr[1], srcSize);
winpr_RAND((BYTE*)pYCbCr[2], srcSize); winpr_RAND(pYCbCr[2], srcSize);
if (compare) if (compare)
{ {
@ -1763,13 +1763,13 @@ int TestPrimitivesYCbCr(int argc, char* argv[])
do do
{ {
winpr_RAND((BYTE*)&roi.width, sizeof(roi.width)); winpr_RAND(&roi.width, sizeof(roi.width));
roi.width %= 2048 / 4; roi.width %= 2048 / 4;
} while (roi.width < 16); } while (roi.width < 16);
do do
{ {
winpr_RAND((BYTE*)&roi.height, sizeof(roi.height)); winpr_RAND(&roi.height, sizeof(roi.height));
roi.height %= 2048 / 4; roi.height %= 2048 / 4;
} while (roi.height < 16); } while (roi.height < 16);

View File

@ -124,13 +124,13 @@ int TestPrimitivesYCoCg(int argc, char* argv[])
do do
{ {
winpr_RAND((BYTE*)&w, sizeof(w)); winpr_RAND(&w, sizeof(w));
w %= 2048 / 4; w %= 2048 / 4;
} while (w < 16); } while (w < 16);
do do
{ {
winpr_RAND((BYTE*)&h, sizeof(h)); winpr_RAND(&h, sizeof(h));
h %= 2048 / 4; h %= 2048 / 4;
} while (h < 16); } while (h < 16);

View File

@ -80,8 +80,8 @@ static BOOL similarRGB(const BYTE* src, const BYTE* dst, size_t size, UINT32 for
static void get_size(BOOL large, UINT32* width, UINT32* height) static void get_size(BOOL large, UINT32* width, UINT32* height)
{ {
UINT32 shift = large ? 8 : 1; UINT32 shift = large ? 8 : 1;
winpr_RAND((BYTE*)width, sizeof(*width)); winpr_RAND(width, sizeof(*width));
winpr_RAND((BYTE*)height, sizeof(*height)); winpr_RAND(height, sizeof(*height));
// TODO: Algorithm only works on even resolutions... // TODO: Algorithm only works on even resolutions...
*width = (*width % 64 + 1) << shift; *width = (*width % 64 + 1) << shift;
*height = (*height % 64 + 1) << shift; *height = (*height % 64 + 1) << shift;

View File

@ -302,7 +302,7 @@ proxyData* proxy_data_new(void)
if (!(pdata->gfx_server_ready = CreateEvent(NULL, TRUE, FALSE, NULL))) if (!(pdata->gfx_server_ready = CreateEvent(NULL, TRUE, FALSE, NULL)))
goto error; goto error;
winpr_RAND((BYTE*)&temp, 16); winpr_RAND(&temp, 16);
hex = winpr_BinToHexString(temp, 16, FALSE); hex = winpr_BinToHexString(temp, 16, FALSE);
if (!hex) if (!hex)
goto error; goto error;