Merge pull request #4828 from akallabeth/warning_fixes_2_0

Compiler warning fixes
This commit is contained in:
David Fort 2018-08-27 12:10:08 +02:00 committed by GitHub
commit 595cdf2720
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 99 additions and 246 deletions

View File

@ -522,7 +522,6 @@ static UINT rdpsnd_server_send_wave2_pdu(RdpsndServerContext* context,
}
}
out:
Stream_SetPosition(s, 0);
context->priv->out_pending_frames = 0;
return error;

View File

@ -447,7 +447,6 @@ BOOL xf_keyboard_handle_special_keys(xfContext* xfc, KeySym keysym)
{
XF_MODIFIER_KEYS mod = { 0 };
xk_keyboard_get_modifier_keys(xfc, &mod);
rdpContext* ctx = &xfc->context;
// remember state of RightCtrl to ungrab keyboard if next action is release of RightCtrl
// do not return anything such that the key could be used by client if ungrab is not the goal
@ -500,6 +499,8 @@ BOOL xf_keyboard_handle_special_keys(xfContext* xfc, KeySym keysym)
if (!xfc->remote_app && xfc->settings->MultiTouchGestures)
{
rdpContext* ctx = &xfc->context;
if (mod.Ctrl && mod.Alt)
{
int pdx = 0;
@ -596,6 +597,7 @@ void xf_keyboard_handle_special_keys_release(xfContext* xfc, KeySym keysym)
{
xf_toggle_control(xfc);
}
xfc->mouse_active = FALSE;
XUngrabKeyboard(xfc->display, CurrentTime);
}

View File

@ -325,7 +325,7 @@ struct _DEVICE
UINT32 id;
UINT32 type;
char* name;
const char* name;
wStream* data;
pcIRPRequest IRPRequest;

View File

@ -426,7 +426,7 @@ static BOOL freerdp_dsp_encode_faac(FREERDP_DSP_CONTEXT* context,
if (!Stream_EnsureRemainingCapacity(out, context->faacMaxOutputBytes))
return FALSE;
outSamples = Stream_Buffer(context->buffer);
outSamples = (int32_t*)Stream_Buffer(context->buffer);
for (x = 0; x < nrSamples * context->format.nChannels; x++)
outSamples[x] = inSamples[x];

View File

@ -180,6 +180,7 @@ INT32 avc420_decompress(H264_CONTEXT* h264, const BYTE* pSrcData, UINT32 SrcSize
return -1001;
status = h264->subsystem->Decompress(h264, pSrcData, SrcSize);
if (status == 0)
return 1;
@ -216,7 +217,10 @@ INT32 avc420_compress(H264_CONTEXT* h264, const BYTE* pSrcData, DWORD SrcFormat,
&roi) != PRIMITIVES_SUCCESS)
return -1;
return h264->subsystem->Compress(h264, h264->pYUVData, h264->iStride, ppDstData, pDstSize);
{
const BYTE* pYUVData[3] = {h264->pYUVData[0], h264->pYUVData[1], h264->pYUVData[2]};
return h264->subsystem->Compress(h264, pYUVData, h264->iStride, ppDstData, pDstSize);
}
}
INT32 avc444_compress(H264_CONTEXT* h264, const BYTE* pSrcData, DWORD SrcFormat,
@ -264,16 +268,22 @@ INT32 avc444_compress(H264_CONTEXT* h264, const BYTE* pSrcData, DWORD SrcFormat,
return -1;
}
if (h264->subsystem->Compress(h264, h264->pYUV444Data, h264->iStride, &coded, &codedSize) < 0)
return -1;
{
const BYTE* pYUV444Data[3] = {h264->pYUV444Data[0], h264->pYUV444Data[1], h264->pYUV444Data[2]};
if (h264->subsystem->Compress(h264, pYUV444Data, h264->iStride, &coded, &codedSize) < 0)
return -1;
}
memcpy(h264->lumaData, coded, codedSize);
*ppDstData = h264->lumaData;
*pDstSize = codedSize;
{
const BYTE* pYUVData[3] = {h264->pYUVData[0], h264->pYUVData[1], h264->pYUVData[2]};
if (h264->subsystem->Compress(h264, h264->pYUVData, h264->iStride, &coded, &codedSize) < 0)
return -1;
if (h264->subsystem->Compress(h264, pYUVData, h264->iStride, &coded, &codedSize) < 0)
return -1;
}
*ppAuxDstData = coded;
*pAuxDstSize = codedSize;
*op = 0;

View File

@ -2795,77 +2795,6 @@ static const BYTE TEST_RLE_UNCOMPRESSED_BITMAP_16BPP[2048] =
"\x08\x42\x08\x42\x08\x42\x08\x42\x08\x42\x08\x42\x08\x42\x08\x42"
"\x08\x42\x08\x42\x08\x42\x08\x42\x08\x42\x08\x42\x08\x42\xFF\xFF";
/**
* [MS-RDPEGDI] Test Bitmap 32x32 (RLE Encoded, not RDP6)
*/
static const BYTE TEST_RLE_COMPRESSED_BITMAP[220] =
"\x85\xFF\xFF\x99\xD6\x99\xD6\x99\xD6\x99\xD6\x06\x8B\x99\xD6\x99"
"\xD6\x99\xD6\x10\x84\x08\x42\x08\x42\x10\x84\x99\xD6\x99\xD6\x99"
"\xD6\x99\xD6\x06\x84\x99\xD6\x99\xD6\x99\xD6\xFF\xFF\x16\x69\x99"
"\xD6\x06\x69\x99\xD6\x04\xCC\x89\x52\x03\x6E\xFF\xFF\x02\x6E\x08"
"\x42\x01\x70\x08\x42\x71\xFF\xFF\xCE\x18\xC6\x01\x81\x08\x42\xCE"
"\x66\x29\x02\xCD\x89\x52\x03\x88\x10\x84\x99\xD6\x99\xD6\x99\xD6"
"\x00\x00\x00\x00\x00\x00\x00\x00\xD8\x99\xD6\x03\xF8\x01\x00\x00"
"\x00\x00\xF0\x66\x99\xD6\x05\x6A\x99\xD6\x00\xC4\xCC\x89\x52\x03"
"\x6E\xFF\xFF\x02\x6E\x08\x42\x01\x70\x08\x42\x71\xFF\xFF\xCE\x18"
"\xC6\x01\x81\x08\x42\xCE\x66\x29\x02\xCD\x89\x52\x03\x00\x04\xD6"
"\x99\xD6\xC3\x80\x61\x00\xA5\x80\x40\xEC\x52\x00\x5A\x00\x2D\x00"
"\x24\x00\x12\x00\x24\x00\x12\x00\x5A\x00\x2D\x00\xA5\x80\x52\x00"
"\xC3\x80\x61\x00\x00\x00\x00\x00\xCC\x89\x52\x03\x6E\xFF\xFF\x02"
"\xCB\x18\xC6\x84\x08\x42\x08\x42\x08\x42\xFF\xFF";
static const BYTE TEST_RLE_SCANLINE_UNCOMPRESSED[12] =
"AAAABBCCCCCD";
/**
* [MS-RDPEGDI] 3.1.9.2.1 Encoding Run-Length Sequences
*/
/* Scanline Absolute Values */
static const BYTE TEST_RDP6_SCANLINES_ABSOLUTE[3][6] =
{
{ 255, 255, 255, 255, 254, 253 },
{ 254, 192, 132, 96, 75, 25 },
{ 253, 140, 62, 14, 135, 193 }
};
/* Scanline Delta Values */
static const int TEST_RDP6_SCANLINES_DELTA[3][6] =
{
{ 255, 255, 255, 255, 254, 253 },
{ -1, -63, -123, -159, -179, -228 },
{ -1, -52, -70, -82, 60, 168 }
};
/* Scanline Delta Values (1-byte two's complement) */
static const BYTE TEST_RDP6_SCANLINES_DELTA_2C[3][6] =
{
{ -1, -1, -1, -1, -2, -3 },
{ -1, -63, -123, 97, 77, 28 },
{ -1, -52, -70, -82, 60, -88 }
};
/* Scanline Delta Values (1-byte two's complement, encoded) */
static const BYTE TEST_RDP6_SCANLINES_DELTA_2C_ENCODED[3][6] =
{
{ -1, -1, -1, -1, -2, -3 },
{ -1, 125, 11, -62, -102, 56 },
{ 1, 103, -117, -93, 120, -81 }
};
/* Scanline Delta Values (1-byte two's complement, encoded, unsigned) */
static const BYTE TEST_RDP6_SCANLINES_DELTA_2C_ENCODED_UNSIGNED[3][6] =
{
{ 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFD },
{ 0x01, 0x7D, 0xF5, 0xC2, 0x9A, 0x38 },
{ 0x01, 0x67, 0x8B, 0xA3, 0x78, 0xAF }
};
static const UINT32 colorFormatList[] =
{
PIXEL_FORMAT_RGB15,
@ -3020,7 +2949,7 @@ static BOOL RunTestPlanarSingleColor(BITMAP_PLANAR_CONTEXT* planar,
UINT32 compressedSize;
const UINT32 fill = j;
const UINT32 color = FreeRDPGetColor(srcFormat, (fill >> 8) & 0xF, (fill >> 4) & 0xF,
(fill) & 0xF, 0xFF);
(fill) & 0xF, 0xFF);
const UINT32 width = i;
const UINT32 height = i;
BOOL failed = TRUE;

View File

@ -188,7 +188,7 @@ PVIRTUALCHANNELENTRY freerdp_load_dynamic_addin(LPCSTR pszFileName,
if (!pszRelativeFilePath)
goto fail;
sprintf_s(pszRelativeFilePath, relPathLen, "%s", pszRelativeFilePath);
sprintf_s(pszRelativeFilePath, relPathLen, "%s", pszPath);
NativePathCchAppendA(pszRelativeFilePath, relPathLen, pszAddinFile);
}
else
@ -245,7 +245,7 @@ PVIRTUALCHANNELENTRY freerdp_load_dynamic_channel_addin_entry(LPCSTR pszName,
if (pszName && pszSubsystem && pszType)
{
const size_t cchFileName = cchBaseFileName + strlen(pszName) + strlen(pszSubsystem) + strlen(
pszType) + strlen(pszExtension);
pszType) + strlen(pszExtension);
pszFileName = (LPSTR) malloc(cchFileName);
if (!pszFileName)
@ -256,7 +256,8 @@ PVIRTUALCHANNELENTRY freerdp_load_dynamic_channel_addin_entry(LPCSTR pszName,
}
else if (pszName && pszSubsystem)
{
const size_t cchFileName = cchBaseFileName + strlen(pszName) + strlen(pszSubsystem) + strlen(pszExtension);
const size_t cchFileName = cchBaseFileName + strlen(pszName) + strlen(pszSubsystem) + strlen(
pszExtension);
pszFileName = (LPSTR) malloc(cchFileName);
if (!pszFileName)

View File

@ -49,11 +49,6 @@
#define TAG FREERDP_TAG("core.gateway.rpc")
/* Security Verification Trailer Signature */
static const rpc_sec_verification_trailer RPC_SEC_VERIFICATION_TRAILER =
{ { 0x8a, 0xe3, 0x13, 0x71, 0x02, 0xf4, 0x36, 0x71 } };
static const char* PTYPE_STRINGS[] =
{
"PTYPE_REQUEST",
@ -80,17 +75,6 @@ static const char* PTYPE_STRINGS[] =
""
};
static const RPC_SECURITY_PROVIDER_INFO RPC_SECURITY_PROVIDER_INFO_TABLE[] =
{
{ RPC_C_AUTHN_NONE, TRUE, -1 },
{ RPC_C_AUTHN_GSS_NEGOTIATE, TRUE, -1 },
{ RPC_C_AUTHN_WINNT, FALSE, 3 },
{ RPC_C_AUTHN_GSS_SCHANNEL, TRUE, -1 },
{ RPC_C_AUTHN_GSS_KERBEROS, TRUE, -1 },
{ RPC_C_AUTHN_DEFAULT, -1, -1 },
{ 0, -1, -1 }
};
/**
* [MS-RPCH]: Remote Procedure Call over HTTP Protocol Specification:
* http://msdn.microsoft.com/en-us/library/cc243950/

View File

@ -34,25 +34,6 @@
#define TAG FREERDP_TAG("core.gateway.rts")
static const char* const RTS_CMD_STRINGS[] =
{
"ReceiveWindowSize",
"FlowControlAck",
"ConnectionTimeout",
"Cookie",
"ChannelLifetime",
"ClientKeepalive",
"Version",
"Empty",
"Padding",
"NegativeANCE",
"ANCE",
"ClientAddress",
"AssociationGroupId",
"Destination",
"PingTrafficSentNotify"
};
/**
* RTS PDU Header
*

View File

@ -1491,7 +1491,6 @@ static BOOL update_message_PointerCached(rdpContext* context,
/* Message Queue */
static BOOL update_message_free_update_class(wMessage* msg, int type)
{
int status = 0;
rdpContext* context;
if (!msg)
@ -2038,8 +2037,6 @@ static BOOL update_message_free_altsec_update_class(wMessage* msg, int type)
static BOOL update_message_process_altsec_update_class(rdpUpdateProxy* proxy, wMessage* msg,
int type)
{
int status = 0;
if (!proxy || !msg)
return FALSE;

View File

@ -1172,23 +1172,23 @@ static BOOL is_accepted(rdpTls* tls, const BYTE* pem, size_t length)
return FALSE;
}
static BOOL accept_cert(rdpTls* tls, const BYTE* pem, size_t length)
static BOOL accept_cert(rdpTls* tls, BYTE* pem, UINT32 length)
{
rdpSettings* settings = tls->settings;
if (tls->isGatewayTransport)
{
settings->GatewayAcceptedCert = pem;
settings->GatewayAcceptedCert = (char*)pem;
settings->GatewayAcceptedCertLength = length;
}
else if (is_redirected(tls))
{
settings->RedirectionAcceptedCert = pem;
settings->RedirectionAcceptedCert = (char*)pem;
settings->RedirectionAcceptedCertLength = length;
}
else
{
settings->AcceptedCert = pem;
settings->AcceptedCert = (char*)pem;
settings->AcceptedCertLength = length;
}

View File

@ -56,19 +56,6 @@ static const BYTE bmp_DST[256] =
"\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00\x00\x00\x00\x00\x00\x00\x00"
};
/* pattern bitmap (8x8) */
static const BYTE bmp_PAT[64] =
{
"\xFF\xFF\x00\x00\xFF\xFF\x00\x00"
"\xFF\xFF\x00\x00\xFF\xFF\x00\x00"
"\x00\x00\xFF\xFF\x00\x00\xFF\xFF"
"\x00\x00\xFF\xFF\x00\x00\xFF\xFF"
"\xFF\xFF\x00\x00\xFF\xFF\x00\x00"
"\xFF\xFF\x00\x00\xFF\xFF\x00\x00"
"\x00\x00\xFF\xFF\x00\x00\xFF\xFF"
"\x00\x00\xFF\xFF\x00\x00\xFF\xFF"
};
/* SRCCOPY (0x00CC0020) */
static const BYTE bmp_SRCCOPY[256] =
{

View File

@ -572,48 +572,6 @@ static const BYTE line_to_R2_WHITE[256] =
"\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
};
/* PolylineTo() Test Data */
static const BYTE polyline_to_case_1[256] =
{
"\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
"\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
"\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00\xFF\x00\xFF\xFF\xFF\xFF\xFF\xFF"
"\xFF\xFF\xFF\xFF\xFF\xFF\x00\xFF\xFF\x00\xFF\xFF\xFF\xFF\xFF\xFF"
"\xFF\xFF\xFF\xFF\xFF\xFF\x00\xFF\xFF\xFF\x00\xFF\xFF\xFF\xFF\xFF"
"\xFF\xFF\xFF\xFF\xFF\x00\xFF\xFF\xFF\xFF\x00\xFF\xFF\xFF\xFF\xFF"
"\xFF\xFF\xFF\xFF\xFF\x00\xFF\xFF\xFF\xFF\xFF\x00\xFF\xFF\xFF\xFF"
"\xFF\xFF\xFF\xFF\x00\xFF\xFF\xFF\xFF\xFF\xFF\x00\xFF\xFF\xFF\xFF"
"\xFF\xFF\xFF\xFF\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00\xFF\xFF\xFF"
"\xFF\xFF\xFF\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00\xFF\xFF\xFF"
"\xFF\xFF\xFF\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00\xFF\xFF"
"\xFF\xFF\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00\xFF\xFF"
"\xFF\xFF\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00\xFF"
"\xFF\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00\xFF"
"\xFF\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
};
static const BYTE polyline_to_case_2[256] =
{
"\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
"\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
"\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
"\xFF\xFF\xFF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\xFF"
"\xFF\xFF\xFF\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00\xFF\xFF"
"\xFF\xFF\xFF\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00\xFF\xFF"
"\xFF\xFF\xFF\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00\xFF\xFF"
"\xFF\xFF\xFF\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00\xFF\xFF"
"\xFF\xFF\xFF\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00\xFF\xFF"
"\xFF\xFF\xFF\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00\xFF\xFF"
"\xFF\xFF\xFF\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00\xFF\xFF"
"\xFF\xFF\xFF\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00\xFF\xFF"
"\xFF\xFF\xFF\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00\xFF\xFF"
"\xFF\xFF\xFF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\xFF"
"\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
"\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
};
#define LINTETO_NUMBER 11
struct ropMap
{

View File

@ -19,11 +19,6 @@
#include "prim_test.h"
static const int ALPHA_PRETEST_ITERATIONS = 5000000;
static const float TEST_TIME = 5.0;
static const int block_size[] = { 4, 64, 256 };
#define NUM_BLOCK_SIZES (sizeof(block_size)/sizeof(int))
#define MAX_BLOCK_SIZE 256
#define SIZE_SQUARED (MAX_BLOCK_SIZE*MAX_BLOCK_SIZE)
@ -36,7 +31,6 @@ static const int block_size[] = { 4, 64, 256 };
static inline const UINT32* PIXEL(const BYTE* _addr_, UINT32 _bytes_, UINT32 _x_, UINT32 _y_)
{
const BYTE* addr = _addr_ + _x_ * sizeof(UINT32) + _y_ * _bytes_;
return (const UINT32*)addr;
}
@ -51,8 +45,8 @@ static inline const UINT32* PIXEL(const BYTE* _addr_, UINT32 _bytes_, UINT32 _x_
/* ------------------------------------------------------------------------- */
static UINT32 alpha_add(
UINT32 c1,
UINT32 c2)
UINT32 c1,
UINT32 c2)
{
UINT32 a1 = ALF(c1);
UINT32 r1 = RED(c1);
@ -71,8 +65,8 @@ static UINT32 alpha_add(
/* ------------------------------------------------------------------------- */
static UINT32 colordist(
UINT32 c1,
UINT32 c2)
UINT32 c1,
UINT32 c2)
{
int d, maxd = 0;
d = ABS((INT32)(ALF(c1) - ALF(c2)));
@ -96,11 +90,12 @@ static UINT32 colordist(
/* ------------------------------------------------------------------------- */
static BOOL check(const BYTE* pSrc1, UINT32 src1Step,
const BYTE* pSrc2, UINT32 src2Step,
BYTE* pDst, UINT32 dstStep,
UINT32 width, UINT32 height)
const BYTE* pSrc2, UINT32 src2Step,
BYTE* pDst, UINT32 dstStep,
UINT32 width, UINT32 height)
{
UINT32 x, y;
for (y = 0; y < height; ++y)
{
for (x = 0; x < width; ++x)
@ -130,41 +125,39 @@ static BOOL test_alphaComp_func(void)
BYTE ALIGN(dst1[DST_WIDTH * DST_HEIGHT * 4]);
UINT32* ptr;
UINT32 i;
winpr_RAND((BYTE*)src1, sizeof(src1));
/* Special-case the first two values */
src1[0] &= 0x00FFFFFFU;
src1[1] |= 0xFF000000U;
winpr_RAND((BYTE*)src2, sizeof(src2));
/* Set the second operand to fully-opaque. */
ptr = (UINT32*)src2;
for (i = 0; i < sizeof(src2) / 4; ++i) *ptr++ |= 0xFF000000U;
memset(dst1, 0, sizeof(dst1));
status = generic->alphaComp_argb(src1, 4 * SRC1_WIDTH,
src2, 4 * SRC2_WIDTH,
dst1, 4 * DST_WIDTH, TEST_WIDTH, TEST_HEIGHT);
src2, 4 * SRC2_WIDTH,
dst1, 4 * DST_WIDTH, TEST_WIDTH, TEST_HEIGHT);
if (status != PRIMITIVES_SUCCESS)
return FALSE;
if (!check(src1, 4 * SRC1_WIDTH,
src2, 4 * SRC2_WIDTH,
dst1, 4 * DST_WIDTH, TEST_WIDTH, TEST_HEIGHT))
src2, 4 * SRC2_WIDTH,
dst1, 4 * DST_WIDTH, TEST_WIDTH, TEST_HEIGHT))
return FALSE;
status = optimized->alphaComp_argb((const BYTE*) src1, 4 * SRC1_WIDTH,
(const BYTE*) src2, 4 * SRC2_WIDTH,
(BYTE*) dst1, 4 * DST_WIDTH, TEST_WIDTH, TEST_HEIGHT);
(const BYTE*) src2, 4 * SRC2_WIDTH,
(BYTE*) dst1, 4 * DST_WIDTH, TEST_WIDTH, TEST_HEIGHT);
if (status != PRIMITIVES_SUCCESS)
return FALSE;
if (!check(src1, 4 * SRC1_WIDTH,
src2, 4 * SRC2_WIDTH,
dst1, 4 * DST_WIDTH, TEST_WIDTH, TEST_HEIGHT))
src2, 4 * SRC2_WIDTH,
dst1, 4 * DST_WIDTH, TEST_WIDTH, TEST_HEIGHT))
return FALSE;
return TRUE;
@ -184,7 +177,6 @@ static int test_alphaComp_speed(void)
src1[0] &= 0x00FFFFFFU;
src1[1] |= 0xFF000000U;
winpr_RAND((BYTE*)src2, sizeof(src2));
/* Set the second operand to fully-opaque. */
ptr = (UINT32*)src2;
@ -193,11 +185,11 @@ static int test_alphaComp_speed(void)
memset(dst1, 0, sizeof(dst1));
if (!speed_test("add16s", "aligned", g_Iterations,
(speed_test_fkt)generic->alphaComp_argb,
(speed_test_fkt)optimized->alphaComp_argb,
src1, 4 * SRC1_WIDTH,
src2, 4 * SRC2_WIDTH,
dst1, 4 * DST_WIDTH, TEST_WIDTH, TEST_HEIGHT))
(speed_test_fkt)generic->alphaComp_argb,
(speed_test_fkt)optimized->alphaComp_argb,
src1, 4 * SRC1_WIDTH,
src2, 4 * SRC2_WIDTH,
dst1, 4 * DST_WIDTH, TEST_WIDTH, TEST_HEIGHT))
return FALSE;
return TRUE;
@ -206,6 +198,7 @@ static int test_alphaComp_speed(void)
int TestPrimitivesAlphaComp(int argc, char* argv[])
{
prim_test_setup(FALSE);
if (!test_alphaComp_func())
return -1;

View File

@ -19,23 +19,17 @@
#include <winpr/sysinfo.h>
#include "prim_test.h"
static const int MEMSET8_PRETEST_ITERATIONS = 100000000;
static const int MEMSET32_PRETEST_ITERATIONS = 40000000;
static const float TEST_TIME = 1.0;
static const int set_sizes[] = { 1, 4, 16, 32, 64, 256, 1024, 4096 };
#define NUM_SET_SIZES (sizeof(set_sizes)/sizeof(int))
/* ------------------------------------------------------------------------- */
static BOOL check8(const BYTE* src, UINT32 length, UINT32 offset, BYTE value)
{
UINT32 i;
for (i = 0; i < length; ++i)
{
if (src[offset + i] != value)
{
printf("SET8U FAILED: off=%"PRIu32" len=%"PRIu32" dest[%"PRIu32"]=0x%02"PRIx8"\n",
offset, length, i + offset, src[i + offset]);
offset, length, i + offset, src[i + offset]);
return FALSE;
}
}
@ -52,11 +46,12 @@ static BOOL test_set8u_func(void)
for (off = 0; off < 16; ++off)
{
UINT32 len;
memset(dest, 3, sizeof(dest));
for (len = 1; len < 48 - off; ++len)
{
status = generic->set_8u(0xa5, dest + off, len);
if (status != PRIMITIVES_SUCCESS)
return FALSE;
@ -68,11 +63,12 @@ static BOOL test_set8u_func(void)
for (off = 0; off < 16; ++off)
{
UINT32 len;
memset(dest, 3, sizeof(dest));
for (len = 1; len < 48 - off; ++len)
{
status = optimized->set_8u(0xa5, dest + off, len);
if (status != PRIMITIVES_SUCCESS)
return FALSE;
@ -91,13 +87,14 @@ static BOOL test_set8u_speed(void)
BYTE value;
UINT32 x;
for (x=0; x<16; x++)
for (x = 0; x < 16; x++)
{
winpr_RAND(&value, sizeof(value));
if (!speed_test("set_8u", "", g_Iterations,
(speed_test_fkt)generic->set_8u,
(speed_test_fkt)optimized->set_8u,
value, dest + x, x))
(speed_test_fkt)generic->set_8u,
(speed_test_fkt)optimized->set_8u,
value, dest + x, x))
return FALSE;
}
@ -107,12 +104,13 @@ static BOOL test_set8u_speed(void)
static BOOL check32s(const INT32* src, UINT32 length, UINT32 offset, INT32 value)
{
UINT32 i;
for (i = 0; i < length; ++i)
{
if (src[offset + i] != value)
{
printf("SET8U FAILED: off=%"PRIu32" len=%"PRIu32" dest[%"PRIu32"]=0x%08"PRIx32"\n",
offset, length, i + offset, src[i + offset]);
offset, length, i + offset, src[i + offset]);
return FALSE;
}
}
@ -131,11 +129,12 @@ static BOOL test_set32s_func(void)
for (off = 0; off < 16; ++off)
{
UINT32 len;
memset(dest, 0, sizeof(dest));
for (len = 1; len < 48 - off; ++len)
{
status = generic->set_32s(value, dest + off, len);
if (status != PRIMITIVES_SUCCESS)
return FALSE;
@ -147,11 +146,12 @@ static BOOL test_set32s_func(void)
for (off = 0; off < 16; ++off)
{
UINT32 len;
memset(dest, 0, sizeof(dest));
for (len = 1; len < 48 - off; ++len)
{
status = optimized->set_32s(value, dest + off, len);
if (status != PRIMITIVES_SUCCESS)
return FALSE;
@ -166,12 +166,13 @@ static BOOL test_set32s_func(void)
static BOOL check32u(const UINT32* src, UINT32 length, UINT32 offset, UINT32 value)
{
UINT32 i;
for (i = 0; i < length; ++i)
{
if (src[offset + i] != value)
{
printf("SET8U FAILED: off=%"PRIu32" len=%"PRIu32" dest[%"PRIu32"]=0x%08"PRIx32"\n",
offset, length, i + offset, src[i + offset]);
offset, length, i + offset, src[i + offset]);
return FALSE;
}
}
@ -190,11 +191,12 @@ static BOOL test_set32u_func(void)
for (off = 0; off < 16; ++off)
{
UINT32 len;
memset(dest, 0, sizeof(dest));
for (len = 1; len < 48 - off; ++len)
{
status = generic->set_32u(value, dest + off, len);
if (status != PRIMITIVES_SUCCESS)
return FALSE;
@ -206,11 +208,12 @@ static BOOL test_set32u_func(void)
for (off = 0; off < 16; ++off)
{
UINT32 len;
memset(dest, 0, sizeof(dest));
for (len = 1; len < 48 - off; ++len)
{
status = optimized->set_32u(value, dest + off, len);
if (status != PRIMITIVES_SUCCESS)
return FALSE;
@ -229,13 +232,14 @@ static BOOL test_set32u_speed(void)
BYTE value;
UINT32 x;
for (x=0; x<16; x++)
for (x = 0; x < 16; x++)
{
winpr_RAND(&value, sizeof(value));
if (!speed_test("set_32u", "", g_Iterations,
(speed_test_fkt)generic->set_32u,
(speed_test_fkt)optimized->set_32u,
value, dest + x, x))
(speed_test_fkt)generic->set_32u,
(speed_test_fkt)optimized->set_32u,
value, dest + x, x))
return FALSE;
}
@ -249,13 +253,14 @@ static BOOL test_set32s_speed(void)
BYTE value;
UINT32 x;
for (x=0; x<16; x++)
for (x = 0; x < 16; x++)
{
winpr_RAND(&value, sizeof(value));
if (!speed_test("set_32s", "", g_Iterations,
(speed_test_fkt)generic->set_32s,
(speed_test_fkt)optimized->set_32s,
value, dest + x, x))
(speed_test_fkt)generic->set_32s,
(speed_test_fkt)optimized->set_32s,
value, dest + x, x))
return FALSE;
}
@ -268,8 +273,10 @@ int TestPrimitivesSet(int argc, char* argv[])
if (!test_set8u_func())
return -1;
if (!test_set32s_func())
return -1;
if (!test_set32u_func())
return -1;
@ -277,8 +284,10 @@ int TestPrimitivesSet(int argc, char* argv[])
{
if (!test_set8u_speed())
return -1;
if (!test_set32s_speed())
return -1;
if (!test_set32u_speed())
return -1;
}

View File

@ -216,8 +216,11 @@ static INLINE void Stream_Write_UINT64(wStream* _s, UINT64 _v)
}
static INLINE void Stream_Write(wStream* _s, const void* _b, size_t _n)
{
memcpy(_s->pointer, (_b), (_n));
Stream_Seek(_s, _n);
if (_n > 0)
{
memcpy(_s->pointer, (_b), (_n));
Stream_Seek(_s, _n);
}
}
#define Stream_Seek_UINT8(_s) Stream_Seek(_s, 1)
@ -342,7 +345,7 @@ static INLINE BOOL Stream_Read_UTF16_String(wStream* s, WCHAR* dst, size_t lengt
if (Stream_GetRemainingLength(s) / sizeof(WCHAR) < length)
return FALSE;
for (x=0; x<length; x++)
for (x = 0; x < length; x++)
Stream_Read_UINT16(s, dst[x]);
return TRUE;
@ -358,7 +361,7 @@ static INLINE BOOL Stream_Write_UTF16_String(wStream* s, const WCHAR* src, size_
if (Stream_GetRemainingCapacity(s) / sizeof(WCHAR) < length)
return FALSE;
for (x=0; x<length; x++)
for (x = 0; x < length; x++)
Stream_Write_UINT16(s, src[x]);
return TRUE;

View File

@ -936,7 +936,7 @@ HANDLE FindFirstFileA(LPCSTR lpFileName, LPWIN32_FIND_DATAA lpFindFileData)
{
if (isDir)
{
char* name = strrchr(lpFileName, '/');
const char* name = strrchr(lpFileName, '/');
if (!name)
name = lpFileName;