mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-14 00:14:11 +09:00
[warnings] eliminate dead code
This commit is contained in:
@@ -43,10 +43,9 @@ using scancode_entry_t = struct
|
||||
};
|
||||
|
||||
#define STR(x) #x
|
||||
#define ENTRY(x, y) \
|
||||
{ \
|
||||
x, STR(x), y, #y \
|
||||
}
|
||||
#define ENTRY(x, y) { x, STR(x), y, #y }
|
||||
|
||||
// clang-format off
|
||||
static const scancode_entry_t map[] = {
|
||||
ENTRY(SDL_SCANCODE_UNKNOWN, RDP_SCANCODE_UNKNOWN),
|
||||
ENTRY(SDL_SCANCODE_A, RDP_SCANCODE_KEY_A),
|
||||
@@ -190,7 +189,7 @@ static const scancode_entry_t map[] = {
|
||||
ENTRY(SDL_SCANCODE_AC_FORWARD, RDP_SCANCODE_BROWSER_FORWARD),
|
||||
ENTRY(SDL_SCANCODE_AC_STOP, RDP_SCANCODE_BROWSER_STOP),
|
||||
|
||||
#if 1 // TODO: unmapped
|
||||
// TODO: unmapped
|
||||
ENTRY(SDL_SCANCODE_NONUSHASH, RDP_SCANCODE_UNKNOWN),
|
||||
ENTRY(SDL_SCANCODE_APPLICATION, RDP_SCANCODE_UNKNOWN),
|
||||
ENTRY(SDL_SCANCODE_POWER, RDP_SCANCODE_UNKNOWN),
|
||||
@@ -293,8 +292,8 @@ static const scancode_entry_t map[] = {
|
||||
ENTRY(SDL_SCANCODE_EJECT, RDP_SCANCODE_UNKNOWN),
|
||||
ENTRY(SDL_SCANCODE_AUDIOREWIND, RDP_SCANCODE_UNKNOWN),
|
||||
ENTRY(SDL_SCANCODE_AUDIOFASTFORWARD, RDP_SCANCODE_UNKNOWN)
|
||||
#endif
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
static UINT16 sdl_get_kbd_flags()
|
||||
{
|
||||
@@ -390,24 +389,17 @@ BOOL sdlInput::keyboard_set_ime_status(rdpContext* context, UINT16 imeId, UINT32
|
||||
uint32_t sdlInput::prefToMask()
|
||||
{
|
||||
const std::map<std::string, uint32_t> mapping = {
|
||||
{ "KMOD_LSHIFT", KMOD_LSHIFT },
|
||||
{ "KMOD_RSHIFT", KMOD_RSHIFT },
|
||||
{ "KMOD_LCTRL", KMOD_LCTRL },
|
||||
{ "KMOD_RCTRL", KMOD_RCTRL },
|
||||
{ "KMOD_LALT", KMOD_LALT },
|
||||
{ "KMOD_RALT", KMOD_RALT },
|
||||
{ "KMOD_LGUI", KMOD_LGUI },
|
||||
{ "KMOD_RGUI", KMOD_RGUI },
|
||||
{ "KMOD_NUM", KMOD_NUM },
|
||||
{ "KMOD_CAPS", KMOD_CAPS },
|
||||
{ "KMOD_LSHIFT", KMOD_LSHIFT }, { "KMOD_RSHIFT", KMOD_RSHIFT },
|
||||
{ "KMOD_LCTRL", KMOD_LCTRL }, { "KMOD_RCTRL", KMOD_RCTRL },
|
||||
{ "KMOD_LALT", KMOD_LALT }, { "KMOD_RALT", KMOD_RALT },
|
||||
{ "KMOD_LGUI", KMOD_LGUI }, { "KMOD_RGUI", KMOD_RGUI },
|
||||
{ "KMOD_NUM", KMOD_NUM }, { "KMOD_CAPS", KMOD_CAPS },
|
||||
{ "KMOD_MODE", KMOD_MODE },
|
||||
#if SDL_VERSION_ATLEAST(2, 0, 18)
|
||||
{ "KMOD_SCROLL", KMOD_SCROLL },
|
||||
#endif
|
||||
{ "KMOD_CTRL", KMOD_CTRL },
|
||||
{ "KMOD_SHIFT", KMOD_SHIFT },
|
||||
{ "KMOD_ALT", KMOD_ALT },
|
||||
{ "KMOD_GUI", KMOD_GUI }
|
||||
{ "KMOD_CTRL", KMOD_CTRL }, { "KMOD_SHIFT", KMOD_SHIFT },
|
||||
{ "KMOD_ALT", KMOD_ALT }, { "KMOD_GUI", KMOD_GUI }
|
||||
};
|
||||
uint32_t mod = KMOD_NONE;
|
||||
for (const auto& val : SdlPref::instance()->get_array("SDL_KeyModMask", { "KMOD_RSHIFT" }))
|
||||
|
||||
@@ -32,90 +32,6 @@
|
||||
|
||||
static primitives_t* generic = NULL;
|
||||
|
||||
static pstatus_t
|
||||
neon_yCbCrToRGB_16s16s_P3P3(const INT16* WINPR_RESTRICT pSrc[3], INT32 srcStep,
|
||||
INT16* WINPR_RESTRICT pDst[3], INT32 dstStep,
|
||||
const prim_size_t* WINPR_RESTRICT roi) /* region of interest */
|
||||
{
|
||||
/* TODO: If necessary, check alignments and call the general version. */
|
||||
int16x8_t zero = vdupq_n_s16(0);
|
||||
int16x8_t max = vdupq_n_s16(255);
|
||||
int16x8_t r_cr = vdupq_n_s16(22986); // 1.403 << 14
|
||||
int16x8_t g_cb = vdupq_n_s16(-5636); // -0.344 << 14
|
||||
int16x8_t g_cr = vdupq_n_s16(-11698); // -0.714 << 14
|
||||
int16x8_t b_cb = vdupq_n_s16(28999); // 1.770 << 14
|
||||
int16x8_t c4096 = vdupq_n_s16(4096);
|
||||
const int16x8_t* y_buf = (const int16x8_t*)pSrc[0];
|
||||
const int16x8_t* cb_buf = (const int16x8_t*)pSrc[1];
|
||||
const int16x8_t* cr_buf = (const int16x8_t*)pSrc[2];
|
||||
int16x8_t* r_buf = (int16x8_t*)pDst[0];
|
||||
int16x8_t* g_buf = (int16x8_t*)pDst[1];
|
||||
int16x8_t* b_buf = (int16x8_t*)pDst[2];
|
||||
int srcbump = srcStep / sizeof(int16x8_t);
|
||||
int dstbump = dstStep / sizeof(int16x8_t);
|
||||
int imax = roi->width * sizeof(INT16) / sizeof(int16x8_t);
|
||||
|
||||
for (int yp = 0; yp < roi->height; ++yp)
|
||||
{
|
||||
for (int i = 0; i < imax; i++)
|
||||
{
|
||||
/*
|
||||
In order to use NEON signed 16-bit integer multiplication we need to convert
|
||||
the floating point factors to signed int without losing information.
|
||||
The result of this multiplication is 32 bit and we have a NEON instruction
|
||||
that returns the hi word of the saturated double.
|
||||
Thus we will multiply the factors by the highest possible 2^n, take the
|
||||
upper 16 bits of the signed 32-bit result (vqdmulhq_s16 followed by a right
|
||||
shift by 1 to reverse the doubling) and correct this result by multiplying it
|
||||
by 2^(16-n).
|
||||
For the given factors in the conversion matrix the best possible n is 14.
|
||||
|
||||
Example for calculating r:
|
||||
r = (y>>5) + 128 + (cr*1.403)>>5 // our base formula
|
||||
r = (y>>5) + 128 + (HIWORD(cr*(1.403<<14)<<2))>>5 // see above
|
||||
r = (y+4096)>>5 + (HIWORD(cr*22986)<<2)>>5 // simplification
|
||||
r = ((y+4096)>>2 + HIWORD(cr*22986)) >> 3
|
||||
*/
|
||||
/* y = (y_buf[i] + 4096) >> 2 */
|
||||
int16x8_t y = vld1q_s16((INT16*)&y_buf[i]);
|
||||
y = vaddq_s16(y, c4096);
|
||||
y = vshrq_n_s16(y, 2);
|
||||
/* cb = cb_buf[i]; */
|
||||
int16x8_t cb = vld1q_s16((INT16*)&cb_buf[i]);
|
||||
/* cr = cr_buf[i]; */
|
||||
int16x8_t cr = vld1q_s16((INT16*)&cr_buf[i]);
|
||||
/* (y + HIWORD(cr*22986)) >> 3 */
|
||||
int16x8_t r = vaddq_s16(y, vshrq_n_s16(vqdmulhq_s16(cr, r_cr), 1));
|
||||
r = vshrq_n_s16(r, 3);
|
||||
/* r_buf[i] = CLIP(r); */
|
||||
r = vminq_s16(vmaxq_s16(r, zero), max);
|
||||
vst1q_s16((INT16*)&r_buf[i], r);
|
||||
/* (y + HIWORD(cb*-5636) + HIWORD(cr*-11698)) >> 3 */
|
||||
int16x8_t g = vaddq_s16(y, vshrq_n_s16(vqdmulhq_s16(cb, g_cb), 1));
|
||||
g = vaddq_s16(g, vshrq_n_s16(vqdmulhq_s16(cr, g_cr), 1));
|
||||
g = vshrq_n_s16(g, 3);
|
||||
/* g_buf[i] = CLIP(g); */
|
||||
g = vminq_s16(vmaxq_s16(g, zero), max);
|
||||
vst1q_s16((INT16*)&g_buf[i], g);
|
||||
/* (y + HIWORD(cb*28999)) >> 3 */
|
||||
int16x8_t b = vaddq_s16(y, vshrq_n_s16(vqdmulhq_s16(cb, b_cb), 1));
|
||||
b = vshrq_n_s16(b, 3);
|
||||
/* b_buf[i] = CLIP(b); */
|
||||
b = vminq_s16(vmaxq_s16(b, zero), max);
|
||||
vst1q_s16((INT16*)&b_buf[i], b);
|
||||
}
|
||||
|
||||
y_buf += srcbump;
|
||||
cb_buf += srcbump;
|
||||
cr_buf += srcbump;
|
||||
r_buf += dstbump;
|
||||
g_buf += dstbump;
|
||||
b_buf += dstbump;
|
||||
}
|
||||
|
||||
return PRIMITIVES_SUCCESS;
|
||||
}
|
||||
|
||||
static pstatus_t neon_yCbCrToRGB_16s8u_P3AC4R_X(const INT16* WINPR_RESTRICT pSrc[3], UINT32 srcStep,
|
||||
BYTE* WINPR_RESTRICT pDst, UINT32 dstStep,
|
||||
const prim_size_t* WINPR_RESTRICT roi, uint8_t rPos,
|
||||
@@ -351,7 +267,6 @@ void primitives_init_colors_neon_int(primitives_t* WINPR_RESTRICT prims)
|
||||
WLog_VRB(PRIM_TAG, "NEON optimizations");
|
||||
prims->RGBToRGB_16s8u_P3AC4R = neon_RGBToRGB_16s8u_P3AC4R;
|
||||
prims->yCbCrToRGB_16s8u_P3AC4R = neon_yCbCrToRGB_16s8u_P3AC4R;
|
||||
prims->yCbCrToRGB_16s16s_P3P3 = neon_yCbCrToRGB_16s16s_P3P3;
|
||||
#else
|
||||
WLog_VRB(PRIM_TAG, "undefined WITH_SIMD or neon intrinsics not available");
|
||||
WINPR_UNUSED(prims);
|
||||
|
||||
@@ -53,80 +53,9 @@ BOOL GetOverlappedResult(WINPR_ATTR_UNUSED HANDLE hFile,
|
||||
WINPR_ATTR_UNUSED LPDWORD lpNumberOfBytesTransferred,
|
||||
WINPR_ATTR_UNUSED BOOL bWait)
|
||||
{
|
||||
#if 1
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return FALSE;
|
||||
#else
|
||||
ULONG Type;
|
||||
WINPR_HANDLE* Object;
|
||||
|
||||
if (!winpr_Handle_GetInfo(hFile, &Type, &Object))
|
||||
return FALSE;
|
||||
|
||||
else if (Type == HANDLE_TYPE_NAMED_PIPE)
|
||||
{
|
||||
int status = -1;
|
||||
DWORD request;
|
||||
PVOID lpBuffer;
|
||||
DWORD nNumberOfBytes;
|
||||
WINPR_NAMED_PIPE* pipe;
|
||||
|
||||
pipe = (WINPR_NAMED_PIPE*)Object;
|
||||
|
||||
if (!(pipe->dwFlagsAndAttributes & FILE_FLAG_OVERLAPPED))
|
||||
return FALSE;
|
||||
|
||||
lpBuffer = lpOverlapped->Pointer;
|
||||
request = (DWORD)lpOverlapped->Internal;
|
||||
nNumberOfBytes = (DWORD)lpOverlapped->InternalHigh;
|
||||
|
||||
if (request == 0)
|
||||
{
|
||||
if (pipe->clientfd == -1)
|
||||
return FALSE;
|
||||
|
||||
status = read(pipe->clientfd, lpBuffer, nNumberOfBytes);
|
||||
}
|
||||
else if (request == 1)
|
||||
{
|
||||
if (pipe->clientfd == -1)
|
||||
return FALSE;
|
||||
|
||||
status = write(pipe->clientfd, lpBuffer, nNumberOfBytes);
|
||||
}
|
||||
else if (request == 2)
|
||||
{
|
||||
socklen_t length;
|
||||
struct sockaddr_un s = { 0 };
|
||||
|
||||
if (pipe->serverfd == -1)
|
||||
return FALSE;
|
||||
|
||||
length = sizeof(struct sockaddr_un);
|
||||
|
||||
status = accept(pipe->serverfd, (struct sockaddr*)&s, &length);
|
||||
|
||||
if (status < 0)
|
||||
return FALSE;
|
||||
|
||||
pipe->clientfd = status;
|
||||
pipe->ServerMode = FALSE;
|
||||
|
||||
status = 0;
|
||||
}
|
||||
|
||||
if (status < 0)
|
||||
{
|
||||
*lpNumberOfBytesTransferred = 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
*lpNumberOfBytesTransferred = status;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
#endif
|
||||
}
|
||||
|
||||
BOOL GetOverlappedResultEx(WINPR_ATTR_UNUSED HANDLE hFile,
|
||||
|
||||
@@ -147,27 +147,5 @@ int TestSynchAPC(int argc, char* argv[])
|
||||
if (!userApcArg.called)
|
||||
return 22;
|
||||
|
||||
#if 0
|
||||
/* test cleanup of timer completions */
|
||||
memset(&uncleanCloseData, 0, sizeof(uncleanCloseData));
|
||||
uncleanCloseData.timer1 = CreateWaitableTimerA(NULL, FALSE, NULL);
|
||||
if (!uncleanCloseData.timer1)
|
||||
return 31;
|
||||
|
||||
uncleanCloseData.timer2 = CreateWaitableTimerA(NULL, FALSE, NULL);
|
||||
if (!uncleanCloseData.timer2)
|
||||
return 32;
|
||||
|
||||
thread = CreateThread(NULL, 0, closeHandleTest, &uncleanCloseData, 0, NULL);
|
||||
if (!thread)
|
||||
return 33;
|
||||
|
||||
(void)WaitForSingleObject(thread, INFINITE);
|
||||
(void)CloseHandle(thread);
|
||||
|
||||
if (uncleanCloseData.timer1Calls != 1 || uncleanCloseData.timer2Calls != 0)
|
||||
return 34;
|
||||
(void)CloseHandle(uncleanCloseData.timer1);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user