Fixed cast-qual warnings

This commit is contained in:
akallabeth 2022-04-28 11:41:46 +02:00 committed by akallabeth
parent 962c5c3ef0
commit 6bc7f6ca88
5 changed files with 54 additions and 29 deletions

View File

@ -1444,14 +1444,15 @@ xf_cliprdr_server_file_contents_response(CliprdrClientContext* context,
break; break;
} }
UINT64 size; UINT64 size;
wStream* s = Stream_New((BYTE*)data, data_len); wStream sbuffer = { 0 };
wStream* s = Stream_StaticConstInit(&sbuffer, data, data_len);
if (!s) if (!s)
{ {
fuse_reply_err(req, ENOMEM); fuse_reply_err(req, ENOMEM);
break; break;
} }
Stream_Read_UINT64(s, size); Stream_Read_UINT64(s, size);
Stream_Free(s, FALSE);
ArrayList_Lock(clipboard->ino_list); ArrayList_Lock(clipboard->ino_list);
ino = xf_cliprdr_fuse_util_get_inode(clipboard->ino_list, req_ino); ino = xf_cliprdr_fuse_util_get_inode(clipboard->ino_list, req_ino);
/* ino must be exists and */ /* ino must be exists and */
@ -1984,6 +1985,9 @@ error:
static BOOL xf_cliprdr_fuse_generate_list(xfClipboard* clipboard, const BYTE* data, UINT32 size) static BOOL xf_cliprdr_fuse_generate_list(xfClipboard* clipboard, const BYTE* data, UINT32 size)
{ {
BOOL status = FALSE; BOOL status = FALSE;
wStream sbuffer = { 0 };
wStream* s;
if (size < 4) if (size < 4)
{ {
WLog_ERR(TAG, "size of format data response invalid : %d", size); WLog_ERR(TAG, "size of format data response invalid : %d", size);
@ -1993,7 +1997,7 @@ static BOOL xf_cliprdr_fuse_generate_list(xfClipboard* clipboard, const BYTE* da
if (count < 1) if (count < 1)
return FALSE; return FALSE;
wStream* s = Stream_New((BYTE*)data, size); s = Stream_StaticConstInit(&sbuffer, data, size);
if (!s || !xf_cliprdr_fuse_check_stream(s, count)) if (!s || !xf_cliprdr_fuse_check_stream(s, count))
{ {
WLog_ERR(TAG, "Stream_New failed"); WLog_ERR(TAG, "Stream_New failed");
@ -2016,7 +2020,6 @@ static BOOL xf_cliprdr_fuse_generate_list(xfClipboard* clipboard, const BYTE* da
error2: error2:
ArrayList_Unlock(clipboard->ino_list); ArrayList_Unlock(clipboard->ino_list);
error: error:
Stream_Free(s, FALSE);
return status; return status;
} }
#endif #endif

View File

@ -119,6 +119,11 @@ fail:
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */
static BOOL test_RGBToRGB_16s8u_P3AC4R_speed(void) static BOOL test_RGBToRGB_16s8u_P3AC4R_speed(void)
{ {
union
{
const UINT16** cpv;
UINT16** pv;
} cnv;
const prim_size_t roi64x64 = { 64, 64 }; const prim_size_t roi64x64 = { 64, 64 };
INT16 ALIGN(r[4096 + 1]), ALIGN(g[4096 + 1]), ALIGN(b[4096 + 1]); INT16 ALIGN(r[4096 + 1]), ALIGN(g[4096 + 1]), ALIGN(b[4096 + 1]);
UINT32 ALIGN(dst[4096 + 1]); UINT32 ALIGN(dst[4096 + 1]);
@ -140,16 +145,15 @@ static BOOL test_RGBToRGB_16s8u_P3AC4R_speed(void)
ptrs[1] = g + 1; ptrs[1] = g + 1;
ptrs[2] = b + 1; ptrs[2] = b + 1;
cnv.pv = ptrs;
if (!speed_test("RGBToRGB_16s8u_P3AC4R", "aligned", g_Iterations, if (!speed_test("RGBToRGB_16s8u_P3AC4R", "aligned", g_Iterations,
(speed_test_fkt)generic->RGBToRGB_16s8u_P3AC4R, generic->RGBToRGB_16s8u_P3AC4R, optimized->RGBToRGB_16s8u_P3AC4R, cnv.cpv,
(speed_test_fkt)optimized->RGBToRGB_16s8u_P3AC4R, (const INT16**)ptrs, 64 * 2, 64 * 2, (BYTE*)dst, 64 * 4, &roi64x64))
(BYTE*)dst, 64 * 4, &roi64x64))
return FALSE; return FALSE;
if (!speed_test("RGBToRGB_16s8u_P3AC4R", "unaligned", g_Iterations, if (!speed_test("RGBToRGB_16s8u_P3AC4R", "unaligned", g_Iterations,
(speed_test_fkt)generic->RGBToRGB_16s8u_P3AC4R, generic->RGBToRGB_16s8u_P3AC4R, optimized->RGBToRGB_16s8u_P3AC4R, cnv.cpv,
(speed_test_fkt)optimized->RGBToRGB_16s8u_P3AC4R, (const INT16**)ptrs, 64 * 2, 64 * 2, ((BYTE*)dst) + 1, 64 * 4, &roi64x64))
((BYTE*)dst) + 1, 64 * 4, &roi64x64))
return FALSE; return FALSE;
return TRUE; return TRUE;

View File

@ -1562,12 +1562,17 @@ static int test_bmp_cmp_dump(const BYTE* actual, const BYTE* expected, int size,
static int test_PrimitivesYCbCr(const primitives_t* prims, UINT32 format, prim_size_t roi, static int test_PrimitivesYCbCr(const primitives_t* prims, UINT32 format, prim_size_t roi,
BOOL compare) BOOL compare)
{ {
union
{
const UINT16** cpv;
UINT16** pv;
} cnv;
pstatus_t status = -1; pstatus_t status = -1;
int cnt[3]; int cnt[3];
float err[3]; float err[3];
BYTE* actual; BYTE* actual;
BYTE* actual1; BYTE* actual1;
const BYTE* expected; const BYTE* expected = TEST_XRGB_IMAGE;
int margin = 1; int margin = 1;
INT16* pYCbCr[3] = { NULL, NULL, NULL }; INT16* pYCbCr[3] = { NULL, NULL, NULL };
const UINT32 srcStride = roi.width * 2; const UINT32 srcStride = roi.width * 2;
@ -1578,7 +1583,7 @@ static int test_PrimitivesYCbCr(const primitives_t* prims, UINT32 format, prim_s
PROFILER_DEFINE(prof1) PROFILER_DEFINE(prof1)
PROFILER_DEFINE(prof2) PROFILER_DEFINE(prof2)
// return test_YCbCr_pixels(); // return test_YCbCr_pixels();
expected = (const BYTE*)TEST_XRGB_IMAGE;
actual = _aligned_malloc(dstSize, 16); actual = _aligned_malloc(dstSize, 16);
actual1 = _aligned_malloc(dstSize, 16); actual1 = _aligned_malloc(dstSize, 16);
PROFILER_CREATE(prof, "yCbCrToRGB_16s8u") PROFILER_CREATE(prof, "yCbCrToRGB_16s8u")
@ -1610,8 +1615,9 @@ static int test_PrimitivesYCbCr(const primitives_t* prims, UINT32 format, prim_s
{ {
PROFILER_ENTER(prof) PROFILER_ENTER(prof)
status = prims->yCbCrToRGB_16s8u_P3AC4R((const INT16**)pYCbCr, srcStride, actual, dstStride, cnv.pv = pYCbCr;
format, &roi); status =
prims->yCbCrToRGB_16s8u_P3AC4R(cnv.cpv, srcStride, actual, dstStride, format, &roi);
if (status != PRIMITIVES_SUCCESS) if (status != PRIMITIVES_SUCCESS)
goto fail; goto fail;
@ -1627,16 +1633,15 @@ static int test_PrimitivesYCbCr(const primitives_t* prims, UINT32 format, prim_s
CopyMemory(pSrcDst[1], pYCbCr[1], srcSize); CopyMemory(pSrcDst[1], pYCbCr[1], srcSize);
CopyMemory(pSrcDst[2], pYCbCr[2], srcSize); CopyMemory(pSrcDst[2], pYCbCr[2], srcSize);
PROFILER_ENTER(prof1) PROFILER_ENTER(prof1)
status = prims->yCbCrToRGB_16s16s_P3P3((const INT16**)pSrcDst, srcStride, pSrcDst, cnv.pv = pSrcDst;
srcStride, &roi); status = prims->yCbCrToRGB_16s16s_P3P3(cnv.cpv, srcStride, pSrcDst, srcStride, &roi);
PROFILER_EXIT(prof1) PROFILER_EXIT(prof1)
if (status != PRIMITIVES_SUCCESS) if (status != PRIMITIVES_SUCCESS)
goto fail2; goto fail2;
PROFILER_ENTER(prof2) PROFILER_ENTER(prof2)
status = prims->RGBToRGB_16s8u_P3AC4R((const INT16**)pSrcDst, srcStride, actual1, dstStride, status = prims->RGBToRGB_16s8u_P3AC4R(cnv.pv, srcStride, actual1, dstStride, format, &roi);
format, &roi);
PROFILER_EXIT(prof2) PROFILER_EXIT(prof2)
fail2: fail2:
_aligned_free(pSrcDst[0]); _aligned_free(pSrcDst[0]);

View File

@ -174,6 +174,11 @@ static void free_padding(void* src, size_t padding)
* Combine them and check, if the data is at the expected position. */ * Combine them and check, if the data is at the expected position. */
static BOOL TestPrimitiveYUVCombine(primitives_t* prims, prim_size_t roi) static BOOL TestPrimitiveYUVCombine(primitives_t* prims, prim_size_t roi)
{ {
union
{
const UINT16** cpv;
UINT16** pv;
} cnv;
UINT32 x, y, i; UINT32 x, y, i;
UINT32 awidth, aheight; UINT32 awidth, aheight;
BOOL rc = FALSE; BOOL rc = FALSE;
@ -251,15 +256,17 @@ static BOOL TestPrimitiveYUVCombine(primitives_t* prims, prim_size_t roi)
PROFILER_ENTER(yuvCombine) PROFILER_ENTER(yuvCombine)
if (prims->YUV420CombineToYUV444(AVC444_LUMA, (const BYTE**)luma, lumaStride, roi.width, cnv.pv = luma;
roi.height, yuv, yuvStride, &rect) != PRIMITIVES_SUCCESS) if (prims->YUV420CombineToYUV444(AVC444_LUMA, cnv.cpv, lumaStride, roi.width, roi.height, yuv,
yuvStride, &rect) != PRIMITIVES_SUCCESS)
{ {
PROFILER_EXIT(yuvCombine) PROFILER_EXIT(yuvCombine)
goto fail; goto fail;
} }
if (prims->YUV420CombineToYUV444(AVC444_CHROMAv1, (const BYTE**)chroma, chromaStride, roi.width, cnv.pv = chroma;
roi.height, yuv, yuvStride, &rect) != PRIMITIVES_SUCCESS) if (prims->YUV420CombineToYUV444(AVC444_CHROMAv1, cnv.cpv, chromaStride, roi.width, roi.height,
yuv, yuvStride, &rect) != PRIMITIVES_SUCCESS)
{ {
PROFILER_EXIT(yuvCombine) PROFILER_EXIT(yuvCombine)
goto fail; goto fail;
@ -285,8 +292,9 @@ static BOOL TestPrimitiveYUVCombine(primitives_t* prims, prim_size_t roi)
PROFILER_ENTER(yuvSplit) PROFILER_ENTER(yuvSplit)
if (prims->YUV444SplitToYUV420((const BYTE**)yuv, yuvStride, pmain, lumaStride, paux, cnv.pv = yuv;
chromaStride, &roi) != PRIMITIVES_SUCCESS) if (prims->YUV444SplitToYUV420(cnv.cpv, yuvStride, pmain, lumaStride, paux, chromaStride,
&roi) != PRIMITIVES_SUCCESS)
{ {
PROFILER_EXIT(yuvSplit) PROFILER_EXIT(yuvSplit)
goto fail; goto fail;
@ -371,6 +379,11 @@ fail:
static BOOL TestPrimitiveYUV(primitives_t* prims, prim_size_t roi, BOOL use444) static BOOL TestPrimitiveYUV(primitives_t* prims, prim_size_t roi, BOOL use444)
{ {
union
{
const UINT16** cpv;
UINT16** pv;
} cnv;
BOOL res = FALSE; BOOL res = FALSE;
UINT32 x, y; UINT32 x, y;
UINT32 awidth, aheight; UINT32 awidth, aheight;
@ -501,11 +514,11 @@ static BOOL TestPrimitiveYUV(primitives_t* prims, prim_size_t roi, BOOL use444)
goto loop_fail; goto loop_fail;
} }
cnv.pv = yuv;
if (use444) if (use444)
{ {
PROFILER_ENTER(yuv444ToRGB) PROFILER_ENTER(yuv444ToRGB)
rc = prims->YUV444ToRGB_8u_P3AC4R((const BYTE**)yuv, yuv_step, rgb_dst, stride, rc = prims->YUV444ToRGB_8u_P3AC4R(cnv.cpv, yuv_step, rgb_dst, stride, DstFormat, &roi);
DstFormat, &roi);
PROFILER_EXIT(yuv444ToRGB) PROFILER_EXIT(yuv444ToRGB)
if (rc != PRIMITIVES_SUCCESS) if (rc != PRIMITIVES_SUCCESS)
@ -524,8 +537,8 @@ static BOOL TestPrimitiveYUV(primitives_t* prims, prim_size_t roi, BOOL use444)
{ {
PROFILER_ENTER(yuv420ToRGB) PROFILER_ENTER(yuv420ToRGB)
if (prims->YUV420ToRGB_8u_P3AC4R((const BYTE**)yuv, yuv_step, rgb_dst, stride, if (prims->YUV420ToRGB_8u_P3AC4R(cnv.cpv, yuv_step, rgb_dst, stride, DstFormat, &roi) !=
DstFormat, &roi) != PRIMITIVES_SUCCESS) PRIMITIVES_SUCCESS)
{ {
PROFILER_EXIT(yuv420ToRGB) PROFILER_EXIT(yuv420ToRGB)
goto fail; goto fail;

View File

@ -82,7 +82,7 @@ int TestString(int argc, char* argv[])
if (p != NULL) if (p != NULL)
{ {
printf("_wcschr error: return value mismatch: Actual: %p, Expected: NULL\n", (void*)p); printf("_wcschr error: return value mismatch: Actual: %p, Expected: NULL\n", p);
return -1; return -1;
} }