Fixed dead store warnings

This commit is contained in:
akallabeth 2022-04-28 10:49:42 +02:00 committed by akallabeth
parent 6fd71fe737
commit 962c5c3ef0
25 changed files with 83 additions and 61 deletions

View File

@ -235,7 +235,7 @@ static DWORD WINAPI ainput_server_thread_func(LPVOID arg)
case WAIT_OBJECT_0 + 1:
case WAIT_OBJECT_0:
error = ainput_server_context_poll_int(&ainput->context);
break;
case WAIT_FAILED:
default:
error = ERROR_INTERNAL_ERROR;
@ -250,6 +250,7 @@ static DWORD WINAPI ainput_server_thread_func(LPVOID arg)
case WAIT_OBJECT_0 + 1:
case WAIT_OBJECT_0:
error = ainput_server_context_poll_int(&ainput->context);
break;
case WAIT_FAILED:
default:

View File

@ -446,6 +446,7 @@ static UINT disp_server_open(DispServerContext* context)
{
WLog_ERR(TAG, "CreateEvent failed!");
rc = ERROR_INTERNAL_ERROR;
goto out_close;
}
if (!(priv->thread =
@ -455,6 +456,7 @@ static UINT disp_server_open(DispServerContext* context)
CloseHandle(priv->stopEvent);
priv->stopEvent = NULL;
rc = ERROR_INTERNAL_ERROR;
goto out_close;
}
}

View File

@ -588,6 +588,7 @@ static UINT rdpgfx_recv_reset_graphics_pdu(RDPGFX_CHANNEL_CALLBACK* callback, wS
"RecvResetGraphicsPdu: width: %" PRIu32 " height: %" PRIu32 " count: %" PRIu32 "",
pdu.width, pdu.height, pdu.monitorCount);
#if defined(WITH_DEBUG_RDPGFX)
for (index = 0; index < pdu.monitorCount; index++)
{
monitor = &(pdu.monitorDefArray[index]);
@ -596,6 +597,7 @@ static UINT rdpgfx_recv_reset_graphics_pdu(RDPGFX_CHANNEL_CALLBACK* callback, wS
" bottom:%" PRIi32 " flags:0x%" PRIx32 "",
monitor->left, monitor->top, monitor->right, monitor->bottom, monitor->flags);
}
#endif
if (context)
{

View File

@ -1665,6 +1665,12 @@ static UINT rdpsnd_plugin_initialize(IWTSPlugin* pPlugin, IWTSVirtualChannelMana
rdpsnd->listener_callback->channel_mgr = pChannelMgr;
status = pChannelMgr->CreateListener(pChannelMgr, RDPSND_DVC_CHANNEL_NAME, 0,
&rdpsnd->listener_callback->iface, &(rdpsnd->listener));
if (status != CHANNEL_RC_OK)
{
WLog_ERR(TAG, "%s CreateListener failed!", rdpsnd_is_dyn_str(TRUE));
return status;
}
rdpsnd->listener->pInterface = rdpsnd->iface.pInterface;
status = rdpsnd_virtual_channel_event_initialized(rdpsnd);

View File

@ -595,6 +595,7 @@ static UINT urbdrc_on_data_received(IWTSVirtualChannelCallback* pChannelCallback
default:
error = urbdrc_process_udev_data_transfer(callback, urbdrc, udevman, data);
WLog_DBG(TAG, "urbdrc_process_udev_data_transfer returned 0x%08" PRIx32, error);
error = ERROR_SUCCESS; /* Ignore errors, the device may have been unplugged. */
break;
}

View File

@ -2963,7 +2963,6 @@ xfClipboard* xf_clipboard_new(xfContext* xfc)
clientFormat = &clipboard->clientFormats[n++];
}
if (ClipboardGetFormatId(clipboard->system, "x-special/mate-copied-files"))
{
clipboard->file_formats_registered = TRUE;
@ -2973,8 +2972,6 @@ xfClipboard* xf_clipboard_new(xfContext* xfc)
if (!clientFormat->formatName)
goto error;
clientFormat = &clipboard->clientFormats[n++];
}
clipboard->numClientFormats = n;

View File

@ -308,17 +308,14 @@ void xf_adjust_coordinates_to_screen(xfContext* xfc, UINT32* x, UINT32* y)
void xf_event_adjust_coordinates(xfContext* xfc, int* x, int* y)
{
rdpSettings* settings;
if (!xfc || !xfc->common.context.settings || !y || !x)
return;
settings = xfc->common.context.settings;
if (!xfc->remote_app)
{
#ifdef WITH_XRENDER
rdpSettings* settings = xfc->common.context.settings;
if (xf_picture_transform_required(xfc))
{
double xScalingFactor = settings->DesktopWidth / (double)xfc->scaledWidth;
@ -332,6 +329,7 @@ void xf_event_adjust_coordinates(xfContext* xfc, int* x, int* y)
CLAMP_COORDINATES(*x, *y);
}
static BOOL xf_event_Expose(xfContext* xfc, const XExposeEvent* event, BOOL app)
{
int x, y;
@ -899,8 +897,6 @@ static BOOL xf_event_PropertyNotify(xfContext* xfc, const XPropertyEvent* event,
{
unsigned long i;
BOOL status;
BOOL maxVert = FALSE;
BOOL maxHorz = FALSE;
BOOL minimized = FALSE;
BOOL minimizedChanged = FALSE;
unsigned long nitems;
@ -933,7 +929,6 @@ static BOOL xf_event_PropertyNotify(xfContext* xfc, const XPropertyEvent* event,
if ((Atom)((UINT16**)prop)[i] ==
XInternAtom(xfc->display, "_NET_WM_STATE_MAXIMIZED_VERT", False))
{
maxVert = TRUE;
if (appWindow)
appWindow->maxVert = TRUE;
}
@ -941,7 +936,6 @@ static BOOL xf_event_PropertyNotify(xfContext* xfc, const XPropertyEvent* event,
if ((Atom)((UINT16**)prop)[i] ==
XInternAtom(xfc->display, "_NET_WM_STATE_MAXIMIZED_HORZ", False))
{
maxHorz = TRUE;
if (appWindow)
appWindow->maxHorz = TRUE;
}

View File

@ -248,11 +248,9 @@ void xf_keyboard_send_key(xfContext* xfc, BOOL down, const XKeyEvent* event)
}
else
{
BOOL rc;
if (freerdp_settings_get_bool(xfc->common.context.settings, FreeRDP_UnicodeInput))
{
wchar_t buffer[32] = { 0 };
int rc = 0;
int xwc = -1;
switch (rdp_scancode)
@ -280,16 +278,16 @@ void xf_keyboard_send_key(xfContext* xfc, BOOL down, const XKeyEvent* event)
if (rdp_scancode == RDP_SCANCODE_UNKNOWN)
WLog_ERR(TAG, "Unknown key with X keycode 0x%02" PRIx8 "", event->keycode);
else
rc = freerdp_input_send_keyboard_event_ex(input, down, rdp_scancode);
freerdp_input_send_keyboard_event_ex(input, down, rdp_scancode);
}
else
rc = freerdp_input_send_unicode_keyboard_event(input, down ? KBD_FLAGS_RELEASE : 0,
buffer[0]);
freerdp_input_send_unicode_keyboard_event(input, down ? KBD_FLAGS_RELEASE : 0,
buffer[0]);
}
else if (rdp_scancode == RDP_SCANCODE_UNKNOWN)
WLog_ERR(TAG, "Unknown key with X keycode 0x%02" PRIx8 "", event->keycode);
else
rc = freerdp_input_send_keyboard_event_ex(input, down, rdp_scancode);
freerdp_input_send_keyboard_event_ex(input, down, rdp_scancode);
if ((rdp_scancode == RDP_SCANCODE_CAPSLOCK) && (down == FALSE))
{

View File

@ -532,7 +532,6 @@ BOOL xf_detect_monitors(xfContext* xfc, UINT32* pMaxWidth, UINT32* pMaxHeight)
settings->MonitorDefArray[j].is_primary = TRUE;
settings->MonitorLocalShiftX = settings->MonitorDefArray[j].x;
settings->MonitorLocalShiftY = settings->MonitorDefArray[j].y;
primaryMonitorFound = TRUE;
}
else
{

View File

@ -212,9 +212,10 @@ static BOOL freerdp_dsp_resample(FREERDP_DSP_CONTEXT* context, const BYTE* src,
size_t sframes, rframes;
size_t rsize;
size_t sbytes, rbytes;
#endif
size_t dstChannels;
size_t srcChannels;
size_t srcBytesPerFrame, dstBytesPerFrame;
size_t srcChannels, dstChannels;
#endif
AUDIO_FORMAT format;
if (srcFormat->wFormatTag != WAVE_FORMAT_PCM)
@ -225,10 +226,6 @@ static BOOL freerdp_dsp_resample(FREERDP_DSP_CONTEXT* context, const BYTE* src,
return FALSE;
}
srcChannels = srcFormat->nChannels;
dstChannels = context->format.nChannels;
srcBytesPerFrame = (srcFormat->wBitsPerSample > 8) ? 2 : 1;
dstBytesPerFrame = (context->format.wBitsPerSample > 8) ? 2 : 1;
/* We want to ignore differences of source and destination format. */
format = *srcFormat;
format.wFormatTag = WAVE_FORMAT_UNKNOWN;
@ -242,6 +239,10 @@ static BOOL freerdp_dsp_resample(FREERDP_DSP_CONTEXT* context, const BYTE* src,
}
#if defined(WITH_SOXR)
srcBytesPerFrame = (srcFormat->wBitsPerSample > 8) ? 2 : 1;
dstBytesPerFrame = (context->format.wBitsPerSample > 8) ? 2 : 1;
srcChannels = srcFormat->nChannels;
dstChannels = context->format.nChannels;
sbytes = srcChannels * srcBytesPerFrame;
sframes = size / sbytes;
rbytes = dstBytesPerFrame * dstChannels;

View File

@ -300,7 +300,7 @@ PVIRTUALCHANNELENTRY freerdp_load_dynamic_channel_addin_entry(LPCSTR pszName, LP
LPCSTR pszExtension = PathGetSharedLibraryExtensionA(0);
LPCSTR pszPrefix = FREERDP_SHARED_LIBRARY_PREFIX;
LPSTR tmp;
int rc;
int rc = 0;
if (pszPrefix)
cchFileName += strnlen(pszPrefix, MAX_PATH);
@ -309,10 +309,14 @@ PVIRTUALCHANNELENTRY freerdp_load_dynamic_channel_addin_entry(LPCSTR pszName, LP
tmp = calloc(cchFileName, sizeof(CHAR));
if (tmp)
rc = sprintf_s(tmp, cchFileName, "%s%s.%s", pszPrefix, pszFileName, pszExtension);
free(pszFileName);
pszFileName = tmp;
if (!pszFileName)
if (!pszFileName || (rc < 0))
{
free(pszFileName);
return NULL;
}
}
if (pszSubsystem)

View File

@ -353,7 +353,6 @@ RDPDR_DEVICE* freerdp_device_new(UINT32 Type, size_t count, const char* args[])
if (!device.serial->Permissive)
goto fail;
}
size = sizeof(RDPDR_SERIAL);
break;
case RDPDR_DTYP_PARALLEL:
if (count > 1)

View File

@ -1673,6 +1673,8 @@ static BOOL TsProxyMakeTunnelCallReadResponse(rdpTsg* tsg, RPC_PDU* pdu)
packetStringMessage.isDisplayMandatory != 0,
packetStringMessage.isConsentMandatory != 0,
packetStringMessage.msgBytes, packetStringMessage.msgBuffer);
if (!rc)
goto fail;
}
break;
@ -1694,6 +1696,8 @@ static BOOL TsProxyMakeTunnelCallReadResponse(rdpTsg* tsg, RPC_PDU* pdu)
packetStringMessage.isDisplayMandatory != 0,
packetStringMessage.isConsentMandatory != 0,
packetStringMessage.msgBytes, packetStringMessage.msgBuffer);
if (!rc)
goto fail;
}
break;

View File

@ -911,7 +911,7 @@ fail:
if (settings->RdpVersion >= RDP_VERSION_5_PLUS)
ret = rdp_write_extended_info_packet(rdp, s); /* extraInfo */
return TRUE;
return ret;
}
/**

View File

@ -1239,8 +1239,6 @@ BOOL nego_send_negotiation_response(rdpNego* nego)
settings = context->settings;
WINPR_ASSERT(settings);
status = TRUE;
s = Stream_New(NULL, 512);
if (!s)
@ -1262,7 +1260,6 @@ BOOL nego_send_negotiation_response(rdpNego* nego)
Stream_Write_UINT16(s, 8); /* RDP_NEG_DATA length (8) */
Stream_Write_UINT32(s, errorCode);
length += 8;
status = FALSE;
}
else
{

View File

@ -846,7 +846,6 @@ BOOL ber_read_nla_TSRemoteGuardPackageCred_array(wStream* s, TSRemoteGuardPackag
}
retItems = tmpRet;
retItems = tmpRet;
memcpy(&retItems[ret], item, sizeof(*item));
free(item);
ret++;

View File

@ -313,6 +313,8 @@ static long bio_rdp_tls_ctrl(BIO* bio, int cmd, long num, void* ptr)
case BIO_CTRL_FLUSH:
BIO_clear_retry_flags(bio);
status = BIO_ctrl(ssl_wbio, cmd, num, ptr);
if (status != 1)
WLog_DBG(TAG, "BIO_ctrl returned %d", status);
BIO_copy_next_retry(bio);
status = 1;
break;
@ -377,7 +379,6 @@ static long bio_rdp_tls_ctrl(BIO* bio, int cmd, long num, void* ptr)
{
tls->ssl = (SSL*)ptr;
ssl_rbio = SSL_get_rbio(tls->ssl);
ssl_wbio = SSL_get_wbio(tls->ssl);
}
if (ssl_rbio)

View File

@ -1147,6 +1147,7 @@ static UINT gdi_DeleteSurface(RdpgfxClientContext* context,
const RDPGFX_DELETE_SURFACE_PDU* deleteSurface)
{
UINT rc = ERROR_INTERNAL_ERROR;
UINT res = ERROR_INTERNAL_ERROR;
rdpCodecs* codecs = NULL;
gdiGfxSurface* surface = NULL;
EnterCriticalSection(&context->mux);
@ -1167,7 +1168,9 @@ static UINT gdi_DeleteSurface(RdpgfxClientContext* context,
free(surface);
}
rc = context->SetSurfaceData(context, deleteSurface->surfaceId, NULL);
res = context->SetSurfaceData(context, deleteSurface->surfaceId, NULL);
if (res)
rc = res;
if (codecs && codecs->progressive)
progressive_delete_surface_context(codecs->progressive, deleteSurface->surfaceId);

View File

@ -28,12 +28,16 @@
#include <freerdp/locale/keyboard.h>
#include <freerdp/locale/locale.h>
#include <freerdp/log.h>
#include "liblocale.h"
#if defined(__MACOSX__)
#include "keyboard_apple.h"
#endif
#define TAG FREERDP_TAG("locale.keyboard")
#ifdef WITH_X11
#include "keyboard_x11.h"
@ -314,6 +318,9 @@ DWORD freerdp_keyboard_init(DWORD keyboardLayoutId)
#endif
if (status < 0)
WLog_DBG(TAG, "Failed to initialize keyboard layout, trying autodetection");
freerdp_detect_keyboard(&keyboardLayoutId);
ZeroMemory(VIRTUAL_SCANCODE_TO_X11_KEYCODE, sizeof(VIRTUAL_SCANCODE_TO_X11_KEYCODE));

View File

@ -86,6 +86,8 @@ int rdtk_nine_patch_draw(rdtkSurface* surface, int nXDst, int nYDst, int nWidth,
if (nHeight < ninePatch->height)
nHeight = ninePatch->height;
WINPR_UNUSED(nHeight);
scaleWidth = nWidth - (ninePatch->width - ninePatch->scaleWidth);
nSrcStep = ninePatch->scanline;
pSrcData = ninePatch->data;

View File

@ -687,6 +687,7 @@ static void* convert_filedescriptors_to_file_list(wClipboard* clipboard, UINT32
for (x = 0; x < count; x++)
{
BOOL fail = TRUE;
if (_wcschr(descriptors[x].cFileName, L'\\') != NULL)
{
continue;
@ -698,14 +699,14 @@ static void* convert_filedescriptors_to_file_list(wClipboard* clipboard, UINT32
const char* stop_at = NULL;
const char* previous_at = NULL;
rc = ConvertFromUnicode(CP_UTF8, 0, cur->cFileName, (int)curLen, &curName, 0, NULL, NULL);
if (rc < 0)
goto loop_fail;
rc = _snprintf(&dst[pos], alloc - pos, "%s%s/", lineprefix, clipboard->delegate.basePath);
if (rc < 0)
{
free(dst);
return NULL;
}
goto loop_fail;
pos += (size_t)rc;
previous_at = curName;
@ -713,34 +714,27 @@ static void* convert_filedescriptors_to_file_list(wClipboard* clipboard, UINT32
{
char* tmp = strndup(previous_at, stop_at - previous_at);
if (!tmp)
{
free(dst);
free(curName);
return NULL;
}
goto loop_fail;
rc = _snprintf(&dst[pos], stop_at - previous_at + 1, "%s", tmp);
free(tmp);
if (rc < 0)
{
free(dst);
free(curName);
return NULL;
}
goto loop_fail;
pos += (size_t)rc;
rc = _snprintf(&dst[pos], 4, "%%%x", *stop_at);
if (rc < 0)
{
free(dst);
free(curName);
return NULL;
}
goto loop_fail;
pos += (size_t)rc;
previous_at = stop_at + 1;
}
rc = _snprintf(&dst[pos], alloc - pos, "%s%s", previous_at, lineending);
if (rc < 0)
fail = FALSE;
loop_fail:
if ((rc < 0) || fail)
{
free(dst);
free(curName);

View File

@ -2269,9 +2269,7 @@ static LONG WINAPI PCSC_SCardControl(SCARDHANDLE hCard, DWORD dwControlCode, LPC
DWORD cbInBufferSize, LPVOID lpOutBuffer,
DWORD cbOutBufferSize, LPDWORD lpBytesReturned)
{
DWORD IoCtlMethod = 0;
DWORD IoCtlFunction = 0;
DWORD IoCtlAccess = 0;
DWORD IoCtlDeviceType = 0;
BOOL getFeatureRequest = FALSE;
PCSC_LONG status = SCARD_S_SUCCESS;
@ -2300,9 +2298,7 @@ static LONG WINAPI PCSC_SCardControl(SCARDHANDLE hCard, DWORD dwControlCode, LPC
* Converting Windows Feature Request IOCTL code to the pcsc-lite control code:
* http://musclecard.996296.n3.nabble.com/Converting-Windows-Feature-Request-IOCTL-code-to-the-pcsc-lite-control-code-td4906.html
*/
IoCtlMethod = METHOD_FROM_CTL_CODE(dwControlCode);
IoCtlFunction = FUNCTION_FROM_CTL_CODE(dwControlCode);
IoCtlAccess = ACCESS_FROM_CTL_CODE(dwControlCode);
IoCtlDeviceType = DEVICE_TYPE_FROM_CTL_CODE(dwControlCode);
if (dwControlCode == IOCTL_SMARTCARD_GET_FEATURE_REQUEST)

View File

@ -659,8 +659,10 @@ static SECURITY_STATUS SEC_ENTRY kerberos_InitializeSecurityContextA(
cnv.cpv = KRB_PACKAGE_NAME;
sspi_SecureHandleSetUpperPointer(phNewContext, cnv.pv);
}
#if defined(WITH_GSSAPI)
else
credentials = context->credentials;
#endif
if (pInput)
{

View File

@ -227,6 +227,8 @@ static NTLM_CONTEXT* ntlm_ContextNew(void)
status = RegQueryValueExA(hKey, "WorkstationName", NULL, &dwType, (BYTE*)workstation,
&dwSize);
if (status != ERROR_SUCCESS)
WLog_WARN(TAG, "[%s]: Key ''WorkstationName' not found", __FUNCTION__);
workstation[dwSize] = '\0';
if (ntlm_SetContextWorkstation(context, workstation) < 0)

View File

@ -355,6 +355,8 @@ SECURITY_STATUS schannel_openssl_client_process_tokens(SCHANNEL_OPENSSL* context
return SEC_E_INVALID_TOKEN;
status = BIO_write(context->bioRead, pBuffer->pvBuffer, pBuffer->cbBuffer);
if (status < 0)
return SEC_E_INVALID_TOKEN;
}
status = SSL_connect(context->ssl);
@ -416,18 +418,26 @@ SECURITY_STATUS schannel_openssl_server_process_tokens(SCHANNEL_OPENSSL* context
return SEC_E_INVALID_TOKEN;
status = BIO_write(context->bioRead, pBuffer->pvBuffer, pBuffer->cbBuffer);
status = SSL_accept(context->ssl);
if (status >= 0)
status = SSL_accept(context->ssl);
if (status < 0)
{
ssl_error = SSL_get_error(context->ssl, status);
WLog_ERR(TAG, "SSL_accept error: %s", openssl_get_ssl_error_string(ssl_error));
return SEC_E_INVALID_TOKEN;
}
if (status == 1)
context->connected = TRUE;
status = BIO_read(context->bioWrite, context->ReadBuffer, SCHANNEL_CB_MAX_TOKEN);
if (status < 0)
{
ssl_error = SSL_get_error(context->ssl, status);
WLog_ERR(TAG, "BIO_read: %s", openssl_get_ssl_error_string(ssl_error));
return SEC_E_INVALID_TOKEN;
}
if (pOutput->cBuffers < 1)
return SEC_E_INVALID_TOKEN;
@ -516,7 +526,8 @@ SECURITY_STATUS schannel_openssl_decrypt_message(SCHANNEL_OPENSSL* context, PSec
return SEC_E_INVALID_TOKEN;
status = BIO_write(context->bioRead, pBuffer->pvBuffer, pBuffer->cbBuffer);
status = SSL_read(context->ssl, pBuffer->pvBuffer, pBuffer->cbBuffer);
if (status > 0)
status = SSL_read(context->ssl, pBuffer->pvBuffer, pBuffer->cbBuffer);
if (status < 0)
{