Fixed clang warnings.

This commit is contained in:
Armin Novak 2016-08-10 10:29:59 +02:00
parent ada4abc5d9
commit 64c5d78b3f
9 changed files with 168 additions and 149 deletions

View File

@ -127,7 +127,7 @@ static BOOL clear_decompress_subcode_rlex(wStream* s,
BYTE suiteIndex;
BYTE suiteDepth;
BYTE paletteCount;
UINT32 palette[128];
UINT32 palette[128] = { 0 };
if (Stream_GetRemainingLength(s) < bitmapDataByteCount)
return FALSE;
@ -193,6 +193,10 @@ static BOOL clear_decompress_subcode_rlex(wStream* s,
return FALSE;
suiteIndex = startIndex;
if (suiteIndex > 127)
return FALSE;
color = palette[suiteIndex];
if ((pixelIndex + runLengthFactor) > pixelCount)
@ -222,7 +226,12 @@ static BOOL clear_decompress_subcode_rlex(wStream* s,
{
BYTE* pTmpData = &pDstData[(nXDstRel + x) * GetBytesPerPixel(DstFormat) +
(nYDstRel + y) * nDstStep];
UINT32 color = palette[suiteIndex++];
UINT32 color = palette[suiteIndex];
if (suiteIndex > 127)
return FALSE;
suiteIndex++;
if ((nXDstRel + x < nDstWidth) && (nYDstRel + y < nDstHeight))
WriteColor(pTmpData, DstFormat, color);

View File

@ -856,7 +856,6 @@ static int openh264_decompress(H264_CONTEXT* h264, BYTE* pSrcData,
H264_CONTEXT_OPENH264* sys = (H264_CONTEXT_OPENH264*) h264->pSystemData;
UINT32* iStride = h264->iStride[plane];
BYTE** pYUVData = h264->pYUVData[plane];
sys = &((H264_CONTEXT_OPENH264*) h264->pSystemData)[0];
if (!sys->pDecoder)
return -2001;
@ -1478,7 +1477,7 @@ static BOOL avc_yuv_to_rgb(H264_CONTEXT* h264, const RECTANGLE_16* regionRects,
}
if (!check_rect(h264, rect, nDstWidth, nDstHeight))
return FALSE;
return FALSE;
width = rect->right - rect->left;
height = rect->bottom - rect->top;

View File

@ -43,7 +43,7 @@ static BOOL freerdp_bitmap_planar_delta_encode_planes(
BYTE* outPlanes[4]);
static INT32 planar_skip_plane_rle(const BYTE* pSrcData, UINT32 SrcSize,
UINT32 nWidth, UINT32 nHeight)
UINT32 nWidth, UINT32 nHeight)
{
UINT32 x, y;
int cRawBytes;
@ -92,10 +92,10 @@ static INT32 planar_skip_plane_rle(const BYTE* pSrcData, UINT32 SrcSize,
}
static INT32 planar_decompress_plane_rle(const BYTE* pSrcData, UINT32 SrcSize,
BYTE* pDstData, INT32 nDstStep,
UINT32 nXDst, UINT32 nYDst,
UINT32 nWidth, UINT32 nHeight,
UINT32 nChannel, BOOL vFlip)
BYTE* pDstData, INT32 nDstStep,
UINT32 nXDst, UINT32 nYDst,
UINT32 nWidth, UINT32 nHeight,
UINT32 nChannel, BOOL vFlip)
{
UINT32 x, y;
BYTE* dstp;
@ -227,9 +227,9 @@ static INT32 planar_decompress_plane_rle(const BYTE* pSrcData, UINT32 SrcSize,
}
static BOOL planar_decompress_planes_raw(const BYTE* pSrcData[4],
BYTE* pDstData, UINT32 DstFormat,
UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst, UINT32 nWidth, UINT32 nHeight,
BOOL alpha, BOOL vFlip)
BYTE* pDstData, UINT32 DstFormat,
UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst, UINT32 nWidth, UINT32 nHeight,
BOOL alpha, BOOL vFlip)
{
INT32 x, y;
INT32 beg, end, inc;
@ -256,7 +256,7 @@ static BOOL planar_decompress_planes_raw(const BYTE* pSrcData[4],
for (y = beg; y != end; y += inc)
{
BYTE* pRGB = &pDstData[((nYDst + y) * nDstStep) + (nXDst * GetBytesPerPixel(
DstFormat))];
DstFormat))];
for (x = 0; x < nWidth; x++)
{
@ -271,7 +271,7 @@ static BOOL planar_decompress_planes_raw(const BYTE* pSrcData[4],
for (y = beg; y != end; y += inc)
{
BYTE* pRGB = &pDstData[((nYDst + y) * nDstStep) + (nXDst * GetBytesPerPixel(
DstFormat))];
DstFormat))];
for (x = 0; x < nWidth; x++)
{
@ -286,11 +286,11 @@ static BOOL planar_decompress_planes_raw(const BYTE* pSrcData[4],
}
BOOL planar_decompress(BITMAP_PLANAR_CONTEXT* planar,
const BYTE* pSrcData, UINT32 SrcSize,
UINT32 nSrcWidth, UINT32 nSrcHeight,
BYTE* pDstData, UINT32 DstFormat,
UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
UINT32 nDstWidth, UINT32 nDstHeight, BOOL vFlip)
const BYTE* pSrcData, UINT32 SrcSize,
UINT32 nSrcWidth, UINT32 nSrcHeight,
BYTE* pDstData, UINT32 DstFormat,
UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
UINT32 nDstWidth, UINT32 nDstHeight, BOOL vFlip)
{
BOOL cs;
BOOL rle;
@ -407,28 +407,28 @@ BOOL planar_decompress(BITMAP_PLANAR_CONTEXT* planar,
{
planes[3] = srcp;
rleSizes[3] = planar_skip_plane_rle(planes[3], SrcSize - (planes[3] - pSrcData),
rawWidths[3], rawHeights[3]); /* AlphaPlane */
rawWidths[3], rawHeights[3]); /* AlphaPlane */
if (rleSizes[3] < 0)
return FALSE;
planes[0] = planes[3] + rleSizes[3];
rleSizes[0] = planar_skip_plane_rle(planes[0], SrcSize - (planes[0] - pSrcData),
rawWidths[0], rawHeights[0]); /* RedPlane */
rawWidths[0], rawHeights[0]); /* RedPlane */
if (rleSizes[0] < 0)
return FALSE;
planes[1] = planes[0] + rleSizes[0];
rleSizes[1] = planar_skip_plane_rle(planes[1], SrcSize - (planes[1] - pSrcData),
rawWidths[1], rawHeights[1]); /* GreenPlane */
rawWidths[1], rawHeights[1]); /* GreenPlane */
if (rleSizes[1] < 1)
return FALSE;
planes[2] = planes[1] + rleSizes[1];
rleSizes[2] = planar_skip_plane_rle(planes[2], SrcSize - (planes[2] - pSrcData),
rawWidths[2], rawHeights[2]); /* BluePlane */
rawWidths[2], rawHeights[2]); /* BluePlane */
if (rleSizes[2] < 1)
return FALSE;
@ -437,21 +437,21 @@ BOOL planar_decompress(BITMAP_PLANAR_CONTEXT* planar,
{
planes[0] = srcp;
rleSizes[0] = planar_skip_plane_rle(planes[0], SrcSize - (planes[0] - pSrcData),
rawWidths[0], rawHeights[0]); /* RedPlane */
rawWidths[0], rawHeights[0]); /* RedPlane */
if (rleSizes[0] < 0)
return FALSE;
planes[1] = planes[0] + rleSizes[0];
rleSizes[1] = planar_skip_plane_rle(planes[1], SrcSize - (planes[1] - pSrcData),
rawWidths[1], rawHeights[1]); /* GreenPlane */
rawWidths[1], rawHeights[1]); /* GreenPlane */
if (rleSizes[1] < 1)
return FALSE;
planes[2] = planes[1] + rleSizes[1];
rleSizes[2] = planar_skip_plane_rle(planes[2], SrcSize - (planes[2] - pSrcData),
rawWidths[2], rawHeights[2]); /* BluePlane */
rawWidths[2], rawHeights[2]); /* BluePlane */
if (rleSizes[2] < 1)
return FALSE;
@ -480,7 +480,7 @@ BOOL planar_decompress(BITMAP_PLANAR_CONTEXT* planar,
if (alpha)
{
if (!planar_decompress_planes_raw(planes, pTempData, TempFormat, nDstStep,
nXDst, nYDst, nSrcWidth, nSrcHeight, alpha, vFlip))
nXDst, nYDst, nSrcWidth, nSrcHeight, alpha, vFlip))
return FALSE;
srcp += rawSizes[0] + rawSizes[1] + rawSizes[2] + rawSizes[3];
@ -488,7 +488,7 @@ BOOL planar_decompress(BITMAP_PLANAR_CONTEXT* planar,
else /* NoAlpha */
{
if (!planar_decompress_planes_raw(planes, pTempData, TempFormat, nDstStep,
nXDst, nYDst, nSrcWidth, nSrcHeight, alpha, vFlip))
nXDst, nYDst, nSrcWidth, nSrcHeight, alpha, vFlip))
return FALSE;
srcp += rawSizes[0] + rawSizes[1] + rawSizes[2];
@ -502,29 +502,29 @@ BOOL planar_decompress(BITMAP_PLANAR_CONTEXT* planar,
if (alpha)
{
status = planar_decompress_plane_rle(planes[3], rleSizes[3],
pTempData, nTempStep, nXDst, nYDst, nSrcWidth, nSrcHeight, 3,
vFlip); /* AlphaPlane */
pTempData, nTempStep, nXDst, nYDst, nSrcWidth, nSrcHeight, 3,
vFlip); /* AlphaPlane */
if (status < 0)
return FALSE;
status = planar_decompress_plane_rle(planes[0], rleSizes[0],
pTempData, nTempStep, nXDst, nYDst, nSrcWidth, nSrcHeight, 2,
vFlip); /* RedPlane */
pTempData, nTempStep, nXDst, nYDst, nSrcWidth, nSrcHeight, 2,
vFlip); /* RedPlane */
if (status < 0)
return FALSE;
status = planar_decompress_plane_rle(planes[1], rleSizes[1],
pTempData, nTempStep, nXDst, nYDst, nSrcWidth, nSrcHeight, 1,
vFlip); /* GreenPlane */
pTempData, nTempStep, nXDst, nYDst, nSrcWidth, nSrcHeight, 1,
vFlip); /* GreenPlane */
if (status < 0)
return FALSE;
status = planar_decompress_plane_rle(planes[2], rleSizes[2],
pTempData, nTempStep, nXDst, nYDst, nSrcWidth, nSrcHeight, 0,
vFlip); /* BluePlane */
pTempData, nTempStep, nXDst, nYDst, nSrcWidth, nSrcHeight, 0,
vFlip); /* BluePlane */
if (status < 0)
return FALSE;
@ -534,22 +534,22 @@ BOOL planar_decompress(BITMAP_PLANAR_CONTEXT* planar,
else /* NoAlpha */
{
status = planar_decompress_plane_rle(planes[0], rleSizes[0],
pTempData, nTempStep, nXDst, nYDst, nSrcWidth, nSrcHeight, 2,
vFlip); /* RedPlane */
pTempData, nTempStep, nXDst, nYDst, nSrcWidth, nSrcHeight, 2,
vFlip); /* RedPlane */
if (status < 0)
return FALSE;
status = planar_decompress_plane_rle(planes[1], rleSizes[1],
pTempData, nTempStep, nXDst, nYDst, nSrcWidth, nSrcHeight, 1,
vFlip); /* GreenPlane */
pTempData, nTempStep, nXDst, nYDst, nSrcWidth, nSrcHeight, 1,
vFlip); /* GreenPlane */
if (status < 0)
return FALSE;
status = planar_decompress_plane_rle(planes[2], rleSizes[2],
pTempData, nTempStep, nXDst, nYDst, nSrcWidth, nSrcHeight, 0,
vFlip); /* BluePlane */
pTempData, nTempStep, nXDst, nYDst, nSrcWidth, nSrcHeight, 0,
vFlip); /* BluePlane */
if (status < 0)
return FALSE;
@ -561,8 +561,8 @@ BOOL planar_decompress(BITMAP_PLANAR_CONTEXT* planar,
if (pTempData != pDstData)
{
if (!freerdp_image_copy(pDstData, DstFormat, nDstStep, nXDst, nYDst, w,
h, pTempData,
TempFormat, nTempStep, nXDst, nYDst, NULL))
h, pTempData,
TempFormat, nTempStep, nXDst, nYDst, NULL))
return FALSE;
}
}
@ -586,7 +586,7 @@ BOOL planar_decompress(BITMAP_PLANAR_CONTEXT* planar,
if (alpha)
{
if (!planar_decompress_planes_raw(planes, pTempData, TempFormat, nTempStep,
nXDst, nYDst, nSrcWidth, nSrcHeight, alpha, vFlip))
nXDst, nYDst, nSrcWidth, nSrcHeight, alpha, vFlip))
return FALSE;
srcp += rawSizes[0] + rawSizes[1] + rawSizes[2] + rawSizes[3];
@ -594,7 +594,7 @@ BOOL planar_decompress(BITMAP_PLANAR_CONTEXT* planar,
else /* NoAlpha */
{
if (!planar_decompress_planes_raw(planes, pTempData, TempFormat, nTempStep,
nXDst, nYDst, nSrcWidth, nSrcHeight, alpha, vFlip))
nXDst, nYDst, nSrcWidth, nSrcHeight, alpha, vFlip))
return FALSE;
srcp += rawSizes[0] + rawSizes[1] + rawSizes[2];
@ -608,29 +608,29 @@ BOOL planar_decompress(BITMAP_PLANAR_CONTEXT* planar,
if (alpha)
{
status = planar_decompress_plane_rle(planes[3], rleSizes[3],
pTempData, nTempStep, nXDst, nYDst, nSrcWidth, nSrcHeight, 3,
vFlip); /* AlphaPlane */
pTempData, nTempStep, nXDst, nYDst, nSrcWidth, nSrcHeight, 3,
vFlip); /* AlphaPlane */
if (status < 0)
return FALSE;
status = planar_decompress_plane_rle(planes[0], rleSizes[0],
pTempData, nTempStep, nXDst, nYDst, nSrcWidth, nSrcHeight, 2,
vFlip); /* LumaPlane */
pTempData, nTempStep, nXDst, nYDst, nSrcWidth, nSrcHeight, 2,
vFlip); /* LumaPlane */
if (status < 0)
return FALSE;
status = planar_decompress_plane_rle(planes[1], rleSizes[1],
pTempData, nTempStep, nXDst, nYDst, nSrcWidth, nSrcHeight, 1,
vFlip); /* OrangeChromaPlane */
pTempData, nTempStep, nXDst, nYDst, nSrcWidth, nSrcHeight, 1,
vFlip); /* OrangeChromaPlane */
if (status < 0)
return FALSE;
status = planar_decompress_plane_rle(planes[2], rleSizes[2],
pTempData, nTempStep, nXDst, nYDst, nSrcWidth, nSrcHeight, 0,
vFlip); /* GreenChromaPlane */
pTempData, nTempStep, nXDst, nYDst, nSrcWidth, nSrcHeight, 0,
vFlip); /* GreenChromaPlane */
if (status < 0)
return FALSE;
@ -640,22 +640,22 @@ BOOL planar_decompress(BITMAP_PLANAR_CONTEXT* planar,
else /* NoAlpha */
{
status = planar_decompress_plane_rle(planes[0], rleSizes[0],
pTempData, nTempStep, nXDst, nYDst, nSrcWidth, nSrcHeight, 2,
vFlip); /* LumaPlane */
pTempData, nTempStep, nXDst, nYDst, nSrcWidth, nSrcHeight, 2,
vFlip); /* LumaPlane */
if (status < 0)
return FALSE;
status = planar_decompress_plane_rle(planes[1], rleSizes[1],
pTempData, nTempStep, nXDst, nYDst, nSrcWidth, nSrcHeight, 1,
vFlip); /* OrangeChromaPlane */
pTempData, nTempStep, nXDst, nYDst, nSrcWidth, nSrcHeight, 1,
vFlip); /* OrangeChromaPlane */
if (status < 0)
return FALSE;
status = planar_decompress_plane_rle(planes[2], rleSizes[2],
pTempData, nTempStep, nXDst, nYDst, nSrcWidth, nSrcHeight, 0,
vFlip); /* GreenChromaPlane */
pTempData, nTempStep, nXDst, nYDst, nSrcWidth, nSrcHeight, 0,
vFlip); /* GreenChromaPlane */
if (status < 0)
return FALSE;
@ -665,8 +665,8 @@ BOOL planar_decompress(BITMAP_PLANAR_CONTEXT* planar,
}
if (prims->YCoCgToRGB_8u_AC4R(pTempData, nTempStep, pDstData, DstFormat,
nDstStep,
w, h, cll, alpha) != PRIMITIVES_SUCCESS)
nDstStep,
w, h, cll, alpha) != PRIMITIVES_SUCCESS)
return FALSE;
}
@ -674,8 +674,8 @@ BOOL planar_decompress(BITMAP_PLANAR_CONTEXT* planar,
}
static BOOL freerdp_split_color_planes(const BYTE* data, UINT32 format,
UINT32 width, UINT32 height,
UINT32 scanline, BYTE** planes)
UINT32 width, UINT32 height,
UINT32 scanline, BYTE** planes)
{
INT32 i, j, k;
k = 0;
@ -692,7 +692,7 @@ static BOOL freerdp_split_color_planes(const BYTE* data, UINT32 format,
const UINT32 color = ReadColor(pixel, format);
pixel += GetBytesPerPixel(format);
SplitColor(color, format, &planes[1][k], &planes[2][k],
&planes[3][k], &planes[0][k], NULL);
&planes[3][k], &planes[0][k], NULL);
k++;
}
}
@ -815,9 +815,9 @@ static UINT32 freerdp_bitmap_planar_write_rle_bytes(
}
static UINT32 freerdp_bitmap_planar_encode_rle_bytes(const BYTE* pInBuffer,
UINT32 inBufferSize,
BYTE* pOutBuffer,
UINT32 outBufferSize)
UINT32 inBufferSize,
BYTE* pOutBuffer,
UINT32 outBufferSize)
{
BYTE symbol;
const BYTE* pInput;
@ -859,9 +859,9 @@ static UINT32 freerdp_bitmap_planar_encode_rle_bytes(const BYTE* pInBuffer,
{
pBytes = pInput - (cRawBytes + nRunLength + 1);
nBytesWritten = freerdp_bitmap_planar_write_rle_bytes(
pBytes, cRawBytes,
nRunLength, pOutput,
outBufferSize);
pBytes, cRawBytes,
nRunLength, pOutput,
outBufferSize);
nRunLength = 0;
if (!nBytesWritten || (nBytesWritten > outBufferSize))
@ -883,7 +883,7 @@ static UINT32 freerdp_bitmap_planar_encode_rle_bytes(const BYTE* pInBuffer,
{
pBytes = pInput - (cRawBytes + nRunLength);
nBytesWritten = freerdp_bitmap_planar_write_rle_bytes(pBytes,
cRawBytes, nRunLength, pOutput, outBufferSize);
cRawBytes, nRunLength, pOutput, outBufferSize);
if (!nBytesWritten)
return 0;
@ -898,8 +898,8 @@ static UINT32 freerdp_bitmap_planar_encode_rle_bytes(const BYTE* pInBuffer,
}
BYTE* freerdp_bitmap_planar_compress_plane_rle(const BYTE* inPlane,
UINT32 width, UINT32 height,
BYTE* outPlane, UINT32* dstSize)
UINT32 width, UINT32 height,
BYTE* outPlane, UINT32* dstSize)
{
UINT32 index;
const BYTE* pInput;
@ -933,7 +933,7 @@ BYTE* freerdp_bitmap_planar_compress_plane_rle(const BYTE* inPlane,
while (outBufferSize)
{
nBytesWritten = freerdp_bitmap_planar_encode_rle_bytes(
pInput, width, pOutput, outBufferSize);
pInput, width, pOutput, outBufferSize);
if ((!nBytesWritten) || (nBytesWritten > outBufferSize))
return NULL;
@ -968,7 +968,7 @@ static UINT32 freerdp_bitmap_planar_compress_planes_rle(
dstSizes[0] = outPlanesSize;
if (!freerdp_bitmap_planar_compress_plane_rle(
inPlanes[0], width, height, outPlanes, &dstSizes[0]))
inPlanes[0], width, height, outPlanes, &dstSizes[0]))
return 0;
outPlanes += dstSizes[0];
@ -979,7 +979,7 @@ static UINT32 freerdp_bitmap_planar_compress_planes_rle(
dstSizes[1] = outPlanesSize;
if (!freerdp_bitmap_planar_compress_plane_rle(inPlanes[1], width, height,
outPlanes, &dstSizes[1]))
outPlanes, &dstSizes[1]))
return 0;
outPlanes += dstSizes[1];
@ -988,7 +988,7 @@ static UINT32 freerdp_bitmap_planar_compress_planes_rle(
dstSizes[2] = outPlanesSize;
if (!freerdp_bitmap_planar_compress_plane_rle(inPlanes[2], width, height,
outPlanes, &dstSizes[2]))
outPlanes, &dstSizes[2]))
return 0;
outPlanes += dstSizes[2];
@ -997,7 +997,7 @@ static UINT32 freerdp_bitmap_planar_compress_planes_rle(
dstSizes[3] = outPlanesSize;
if (!freerdp_bitmap_planar_compress_plane_rle(inPlanes[3], width, height,
outPlanes, &dstSizes[3]))
outPlanes, &dstSizes[3]))
return 0;
outPlanes += dstSizes[3];
@ -1006,8 +1006,8 @@ static UINT32 freerdp_bitmap_planar_compress_planes_rle(
}
BYTE* freerdp_bitmap_planar_delta_encode_plane(const BYTE* inPlane,
UINT32 width, UINT32 height,
BYTE* outPlane)
UINT32 width, UINT32 height,
BYTE* outPlane)
{
char s2c;
INT32 delta;
@ -1045,15 +1045,15 @@ BYTE* freerdp_bitmap_planar_delta_encode_plane(const BYTE* inPlane,
}
BOOL freerdp_bitmap_planar_delta_encode_planes(const BYTE** inPlanes,
UINT32 width, UINT32 height,
BYTE* outPlanes[4])
UINT32 width, UINT32 height,
BYTE* outPlanes[4])
{
UINT32 i;
for (i = 0; i < 4; i++)
{
outPlanes[i] = freerdp_bitmap_planar_delta_encode_plane(
inPlanes[i], width, height, outPlanes[i]);
inPlanes[i], width, height, outPlanes[i]);
if (!outPlanes[i])
return FALSE;
@ -1063,9 +1063,9 @@ BOOL freerdp_bitmap_planar_delta_encode_planes(const BYTE** inPlanes,
}
BYTE* freerdp_bitmap_compress_planar(BITMAP_PLANAR_CONTEXT* context,
const BYTE* data, UINT32 format,
UINT32 width, UINT32 height, UINT32 scanline,
BYTE* dstData, UINT32* pDstSize)
const BYTE* data, UINT32 format,
UINT32 width, UINT32 height, UINT32 scanline,
BYTE* dstData, UINT32* pDstSize)
{
UINT32 size;
BYTE* dstp;
@ -1073,26 +1073,29 @@ BYTE* freerdp_bitmap_compress_planar(BITMAP_PLANAR_CONTEXT* context,
UINT32 dstSizes[4];
BYTE FormatHeader = 0;
if (!context || !context->rlePlanes)
return NULL;
if (context->AllowSkipAlpha)
FormatHeader |= PLANAR_FORMAT_HEADER_NA;
planeSize = width * height;
if (!freerdp_split_color_planes(data, format, width, height, scanline,
context->planes))
context->planes))
return NULL;
if (context->AllowRunLengthEncoding)
{
if (!freerdp_bitmap_planar_delta_encode_planes(
context->planes, width, height,
context->deltaPlanes))
context->planes, width, height,
context->deltaPlanes))
return NULL;;
if (freerdp_bitmap_planar_compress_planes_rle(
context->deltaPlanes, width, height,
context->rlePlanesBuffer, dstSizes,
context->AllowSkipAlpha) > 0)
context->deltaPlanes, width, height,
context->rlePlanesBuffer, dstSizes,
context->AllowSkipAlpha) > 0)
{
int offset = 0;
FormatHeader |= PLANAR_FORMAT_HEADER_RLE;
@ -1233,13 +1236,13 @@ BOOL freerdp_bitmap_planar_context_reset(
context->planes[2] = &context->planesBuffer[context->maxPlaneSize * 2];
context->planes[3] = &context->planesBuffer[context->maxPlaneSize * 3];
context->deltaPlanes[0] = &context->deltaPlanesBuffer[context->maxPlaneSize *
0];
0];
context->deltaPlanes[1] = &context->deltaPlanesBuffer[context->maxPlaneSize *
1];
1];
context->deltaPlanes[2] = &context->deltaPlanesBuffer[context->maxPlaneSize *
2];
2];
context->deltaPlanes[3] = &context->deltaPlanesBuffer[context->maxPlaneSize *
3];
3];
return TRUE;
}

View File

@ -219,7 +219,7 @@ static BOOL op_xor(UINT32* stack, UINT32* stackp)
static UINT32 process_rop(UINT32 src, UINT32 dst, UINT32 pat, const char* rop,
UINT32 format)
{
DWORD stack[10];
DWORD stack[10] = { 0 };
DWORD stackp = 0;
while (*rop != '\0')
@ -279,7 +279,7 @@ static BOOL BitBlt_write(HGDI_DC hdcDest, HGDI_DC hdcSrc, UINT32 nXDest,
UINT32 dstColor;
UINT32 colorA;
UINT32 colorB = 0;
UINT32 colorC;
UINT32 colorC = 0;
BYTE* dstp = gdi_get_bitmap_pointer(hdcDest, nXDest + x, nYDest + y);
if (!dstp)

View File

@ -1216,12 +1216,12 @@ BOOL gdi_init_ex(freerdp* instance, UINT32 format, UINT32 stride, BYTE* buffer,
if (!gdi)
goto fail;
instance->context->gdi = gdi;
gdi->log = WLog_Get(TAG);
if (!gdi->log)
goto fail;
instance->context->gdi = gdi;
gdi->context = instance->context;
gdi->width = instance->settings->DesktopWidth;
gdi->height = instance->settings->DesktopHeight;

View File

@ -63,8 +63,8 @@ int test_gdi_FillRect(void)
int rc = -1;
HGDI_DC hdc;
HGDI_RECT hRect;
HGDI_BRUSH hBrush;
HGDI_BITMAP hBitmap;
HGDI_BRUSH hBrush = NULL;
HGDI_BITMAP hBitmap = NULL;
UINT32 color;
UINT32 pixel;
UINT32 rawPixel;

View File

@ -91,7 +91,7 @@ static pstatus_t sse2_yCbCrToRGB_16s16s_P3P3(
{
/* We can't maintain 16-byte alignment. */
return generic->yCbCrToRGB_16s16s_P3P3(pSrc, srcStep,
pDst, dstStep, roi);
pDst, dstStep, roi);
}
zero = _mm_setzero_si128();
@ -228,7 +228,7 @@ static pstatus_t sse2_RGBToYCbCr_16s16s_P3P3(
{
/* We can't maintain 16-byte alignment. */
return generic->RGBToYCbCr_16s16s_P3P3(pSrc, srcStep,
pDst, dstStep, roi);
pDst, dstStep, roi);
}
min = _mm_set1_epi16(-128 * 32);
@ -385,13 +385,12 @@ pstatus_t sse2_RGBToRGB_16s8u_P3AC4R(
|| (dstStep & 0x0f))
{
return generic->RGBToRGB_16s8u_P3AC4R(pSrc, srcStep, pDst,
dstStep, DstFormat, roi);
dstStep, DstFormat, roi);
}
// TODO: Need to update SSE code to allow color conversion!!!
return generic->RGBToRGB_16s8u_P3AC4R(pSrc, srcStep, pDst,
dstStep, DstFormat, roi);
dstStep, DstFormat, roi);
out = (BYTE*) pDst;
srcbump = (srcStep - (roi->width * sizeof(UINT16))) / sizeof(UINT16);
dstbump = (dstStep - (roi->width * sizeof(UINT32)));

View File

@ -12,14 +12,11 @@ int TestClipboardFormats(int argc, char* argv[])
const char* formatName;
wClipboard* clipboard;
UINT32 utf8StringFormatId;
clipboard = ClipboardCreate();
formatId = ClipboardRegisterFormat(clipboard, "text/html");
formatId = ClipboardRegisterFormat(clipboard, "image/bmp");
formatId = ClipboardRegisterFormat(clipboard, "image/png");
utf8StringFormatId = ClipboardRegisterFormat(clipboard, "UTF8_STRING");
pFormatIds = NULL;
count = ClipboardGetRegisteredFormatIds(clipboard, &pFormatIds);
@ -27,7 +24,6 @@ int TestClipboardFormats(int argc, char* argv[])
{
formatId = pFormatIds[index];
formatName = ClipboardGetFormatName(clipboard, formatId);
fprintf(stderr, "Format: 0x%04X %s\n", formatId, formatName);
}
@ -40,24 +36,25 @@ int TestClipboardFormats(int argc, char* argv[])
UINT32 DstSize;
char* pSrcData;
char* pDstData;
pSrcData = _strdup("this is a test string");
if (!pSrcData)
{
fprintf(stderr, "Memory allocation failed\n");
return -1;
}
SrcSize = (UINT32) (strlen(pSrcData) + 1);
bSuccess = ClipboardSetData(clipboard, utf8StringFormatId, (void*) pSrcData, SrcSize);
SrcSize = (UINT32)(strlen(pSrcData) + 1);
bSuccess = ClipboardSetData(clipboard, utf8StringFormatId, (void*) pSrcData,
SrcSize);
if (!bSuccess)
free(pSrcData);
fprintf(stderr, "ClipboardSetData: %d\n", bSuccess);
DstSize = 0;
pDstData = (char*) ClipboardGetData(clipboard, utf8StringFormatId, &DstSize);
fprintf(stderr, "ClipboardGetData: %s\n", pDstData);
free(pDstData);
}
@ -66,15 +63,11 @@ int TestClipboardFormats(int argc, char* argv[])
UINT32 DstSize;
char* pSrcData;
WCHAR* pDstData;
DstSize = 0;
pDstData = (WCHAR*) ClipboardGetData(clipboard, CF_UNICODETEXT, &DstSize);
pSrcData = NULL;
ConvertFromUnicode(CP_UTF8, 0, pDstData, -1, &pSrcData, 0, NULL, NULL);
fprintf(stderr, "ClipboardGetData (synthetic): %s\n", pSrcData);
free(pDstData);
free(pSrcData);
}
@ -86,14 +79,11 @@ int TestClipboardFormats(int argc, char* argv[])
{
formatId = pFormatIds[index];
formatName = ClipboardGetFormatName(clipboard, formatId);
fprintf(stderr, "Format: 0x%04X %s\n", formatId, formatName);
}
free(pFormatIds);
ClipboardDestroy(clipboard);
return 0;
}

View File

@ -29,6 +29,12 @@ DWORD WINAPI test_synch_barrier_thread(LPVOID lpParam)
struct test_params* p = (struct test_params*)lpParam;
DWORD i, tnum = InterlockedIncrement(&p->threadCount) - 1;
if (tnum != p->threadCount)
{
InterlockedIncrement(&p->falseCount);
goto out;
}
//printf("Thread #%03u entered.\n", tnum);
/* wait for start event from main */
@ -45,12 +51,14 @@ DWORD WINAPI test_synch_barrier_thread(LPVOID lpParam)
/* simulate different execution times before the barrier */
Sleep(rand() % MAX_SLEEP_MS);
status = EnterSynchronizationBarrier(&gBarrier, p->flags);
//printf("Thread #%03u status: %s\n", tnum, status ? "TRUE" : "FALSE");
if (status)
InterlockedIncrement(&p->trueCount);
else
InterlockedIncrement(&p->falseCount);
}
out:
//printf("Thread #%03u leaving.\n", tnum);
return 0;
@ -59,22 +67,19 @@ out:
BOOL TestSynchBarrierWithFlags(DWORD dwFlags, DWORD dwThreads, DWORD dwLoops)
{
HANDLE *threads;
HANDLE* threads;
struct test_params p;
DWORD dwStatus, expectedTrueCount, expectedFalseCount;
int i;
p.threadCount = 0;
p.trueCount = 0;
p.falseCount = 0;
p.loops = dwLoops;
p.flags = dwFlags;
expectedTrueCount = dwLoops;
expectedFalseCount = dwLoops * (dwThreads - 1);
printf("%s: >> Testing with flags 0x%08x. Using %u threads performing %u loops\n",
__FUNCTION__, dwFlags, dwThreads, dwLoops);
__FUNCTION__, dwFlags, dwThreads, dwLoops);
if (!(threads = calloc(dwThreads, sizeof(HANDLE))))
{
@ -84,7 +89,8 @@ BOOL TestSynchBarrierWithFlags(DWORD dwFlags, DWORD dwThreads, DWORD dwLoops)
if (!InitializeSynchronizationBarrier(&gBarrier, dwThreads, -1))
{
printf("%s: InitializeSynchronizationBarrier failed. GetLastError() = 0x%08x", __FUNCTION__, GetLastError());
printf("%s: InitializeSynchronizationBarrier failed. GetLastError() = 0x%08x",
__FUNCTION__, GetLastError());
free(threads);
DeleteSynchronizationBarrier(&gBarrier);
return FALSE;
@ -92,7 +98,8 @@ BOOL TestSynchBarrierWithFlags(DWORD dwFlags, DWORD dwThreads, DWORD dwLoops)
if (!(gStartEvent = CreateEvent(NULL, TRUE, FALSE, NULL)))
{
printf("%s: CreateEvent failed with error 0x%08x", __FUNCTION__, GetLastError());
printf("%s: CreateEvent failed with error 0x%08x", __FUNCTION__,
GetLastError());
free(threads);
DeleteSynchronizationBarrier(&gBarrier);
return FALSE;
@ -100,9 +107,11 @@ BOOL TestSynchBarrierWithFlags(DWORD dwFlags, DWORD dwThreads, DWORD dwLoops)
for (i = 0; i < dwThreads; i++)
{
if (!(threads[i] = CreateThread(NULL, 0, test_synch_barrier_thread, &p, 0, NULL)))
if (!(threads[i] = CreateThread(NULL, 0, test_synch_barrier_thread, &p, 0,
NULL)))
{
printf("%s: CreateThread failed for thread #%u with error 0x%08x\n", __FUNCTION__, i, GetLastError());
printf("%s: CreateThread failed for thread #%u with error 0x%08x\n",
__FUNCTION__, i, GetLastError());
InterlockedIncrement(&gErrorCount);
break;
}
@ -113,7 +122,7 @@ BOOL TestSynchBarrierWithFlags(DWORD dwFlags, DWORD dwThreads, DWORD dwLoops)
if (!SetEvent(gStartEvent))
{
printf("%s: SetEvent(gStartEvent) failed with error = 0x%08x)\n",
__FUNCTION__, GetLastError());
__FUNCTION__, GetLastError());
InterlockedIncrement(&gErrorCount);
}
@ -122,13 +131,14 @@ BOOL TestSynchBarrierWithFlags(DWORD dwFlags, DWORD dwThreads, DWORD dwLoops)
if (WAIT_OBJECT_0 != (dwStatus = WaitForSingleObject(threads[i], INFINITE)))
{
printf("%s: WaitForSingleObject(thread[%d] unexpectedly returned %u (error = 0x%08x)\n",
__FUNCTION__, i, dwStatus, GetLastError());
__FUNCTION__, i, dwStatus, GetLastError());
InterlockedIncrement(&gErrorCount);
}
if (!CloseHandle(threads[i]))
{
printf("%s: CloseHandle(thread[%d]) failed with error = 0x%08x)\n",
__FUNCTION__, i, GetLastError());
__FUNCTION__, i, GetLastError());
InterlockedIncrement(&gErrorCount);
}
}
@ -139,7 +149,7 @@ BOOL TestSynchBarrierWithFlags(DWORD dwFlags, DWORD dwThreads, DWORD dwLoops)
if (!CloseHandle(gStartEvent))
{
printf("%s: CloseHandle(gStartEvent) failed with error = 0x%08x)\n",
__FUNCTION__, GetLastError());
__FUNCTION__, GetLastError());
InterlockedIncrement(&gErrorCount);
}
@ -155,13 +165,17 @@ BOOL TestSynchBarrierWithFlags(DWORD dwFlags, DWORD dwThreads, DWORD dwLoops)
InterlockedIncrement(&gErrorCount);
printf("%s: error count: %d\n", __FUNCTION__, gErrorCount);
printf("%s: thread count: %d (expected %u)\n", __FUNCTION__, p.threadCount, dwThreads);
printf("%s: true count: %d (expected %d)\n", __FUNCTION__, p.trueCount, expectedTrueCount);
printf("%s: false count: %d (expected %d)\n", __FUNCTION__, p.falseCount, expectedFalseCount);
printf("%s: thread count: %d (expected %u)\n", __FUNCTION__, p.threadCount,
dwThreads);
printf("%s: true count: %d (expected %d)\n", __FUNCTION__, p.trueCount,
expectedTrueCount);
printf("%s: false count: %d (expected %d)\n", __FUNCTION__, p.falseCount,
expectedFalseCount);
if (gErrorCount > 0)
{
printf("%s: Error test failed with %d reported errors\n", __FUNCTION__, gErrorCount);
printf("%s: Error test failed with %d reported errors\n", __FUNCTION__,
gErrorCount);
return FALSE;
}
@ -175,30 +189,34 @@ int TestSynchBarrier(int argc, char* argv[])
DWORD dwMaxThreads;
DWORD dwMinThreads;
DWORD dwNumLoops = 200;
GetNativeSystemInfo(&sysinfo);
printf("%s: Number of processors: %u\n", __FUNCTION__, sysinfo.dwNumberOfProcessors);
printf("%s: Number of processors: %u\n", __FUNCTION__,
sysinfo.dwNumberOfProcessors);
dwMinThreads = sysinfo.dwNumberOfProcessors;
dwMaxThreads = sysinfo.dwNumberOfProcessors * 4;
if (dwMaxThreads > 32)
dwMaxThreads = 32;
/* Test invalid parameters */
if (InitializeSynchronizationBarrier(&gBarrier, 0, -1))
{
printf("%s: InitializeSynchronizationBarrier unecpectedly succeeded with lTotalThreads = 0\n", __FUNCTION__);
printf("%s: InitializeSynchronizationBarrier unecpectedly succeeded with lTotalThreads = 0\n",
__FUNCTION__);
return -1;
}
if (InitializeSynchronizationBarrier(&gBarrier, -1, -1))
{
printf("%s: InitializeSynchronizationBarrier unecpectedly succeeded with lTotalThreads = -1\n", __FUNCTION__);
printf("%s: InitializeSynchronizationBarrier unecpectedly succeeded with lTotalThreads = -1\n",
__FUNCTION__);
return -1;
}
if (InitializeSynchronizationBarrier(&gBarrier, 1, -2))
{
printf("%s: InitializeSynchronizationBarrier unecpectedly succeeded with lSpinCount = -2\n", __FUNCTION__);
printf("%s: InitializeSynchronizationBarrier unecpectedly succeeded with lSpinCount = -2\n",
__FUNCTION__);
return -1;
}
@ -207,13 +225,14 @@ int TestSynchBarrier(int argc, char* argv[])
if (!TestSynchBarrierWithFlags(0, dwMaxThreads, dwNumLoops))
return -1;
if (!TestSynchBarrierWithFlags(SYNCHRONIZATION_BARRIER_FLAGS_SPIN_ONLY, dwMinThreads, dwNumLoops))
if (!TestSynchBarrierWithFlags(SYNCHRONIZATION_BARRIER_FLAGS_SPIN_ONLY,
dwMinThreads, dwNumLoops))
return -1;
if (!TestSynchBarrierWithFlags(SYNCHRONIZATION_BARRIER_FLAGS_BLOCK_ONLY, dwMaxThreads, dwNumLoops))
if (!TestSynchBarrierWithFlags(SYNCHRONIZATION_BARRIER_FLAGS_BLOCK_ONLY,
dwMaxThreads, dwNumLoops))
return -1;
printf("%s: Test successfully completed\n", __FUNCTION__);
return 0;
}