[warnings] eliminate dead code

This commit is contained in:
akallabeth 2025-03-04 09:39:01 +01:00
parent 6d541c8691
commit 41b0598fc1
No known key found for this signature in database
GPG Key ID: A49454A3FC909FD5
12 changed files with 59 additions and 139 deletions

View File

@ -104,10 +104,10 @@ static UINT encomsp_recv_change_participant_control_level_pdu(EncomspServerConte
static UINT encomsp_server_receive_pdu(EncomspServerContext* context, wStream* s)
{
UINT error = CHANNEL_RC_OK;
ENCOMSP_ORDER_HEADER header;
while (Stream_GetRemainingLength(s) > 0)
{
ENCOMSP_ORDER_HEADER header = { 0 };
if ((error = encomsp_read_header(s, &header)))
{
WLog_ERR(TAG, "encomsp_read_header failed with error %" PRIu32 "!", error);

View File

@ -204,24 +204,16 @@ static BOOL ndr_descr_read_RPC_UNICODE_STRING(NdrContext* context, wStream* s, c
return ndr_read_RPC_UNICODE_STRING(context, s, hints, res);
}
#if 0
BOOL ndr_write_RPC_UNICODE_STRING(NdrContext* context, wStream* s, const void* hints,
const RPC_UNICODE_STRING* res)
{
WINPR_ASSERT(res);
if (!ndr_write_uint32(context, s, res->lenHints.length))
return FALSE;
if (!ndr_write_uint32(context, s, res->lenHints.maxLength))
return FALSE;
const BYTE* ptr = WINPR_CXX_COMPAT_CAST(const BYTE*, res->Buffer);
for (size_t x = 0; x < res->strLength; x++)
{
if (!ndr_write_uint8(context, s, ptr[x]))
return FALSE;
}
return TRUE;
return ndr_write_uint32(context, s, res->lenHints.length) &&
ndr_write_uint32(context, s, res->lenHints.maxLength) /*&&
ndr_write_BYTE_ptr(context, s, (BYTE*)res->Buffer, res->Length)*/
;
}
#endif
void ndr_dump_RPC_UNICODE_STRING(wLog* logger, UINT32 lvl, size_t indentLevel,
const RPC_UNICODE_STRING* obj)
@ -256,7 +248,7 @@ static void ndr_descr_destroy_RPC_UNICODE_STRING(NdrContext* context, const void
static const NdrMessageDescr RPC_UNICODE_STRING_descr_s = { NDR_ARITY_SIMPLE,
sizeof(RPC_UNICODE_STRING),
ndr_descr_read_RPC_UNICODE_STRING,
NULL,
/*ndr_write_RPC_UNICODE_STRING*/ NULL,
ndr_descr_destroy_RPC_UNICODE_STRING,
ndr_descr_dump_RPC_UNICODE_STRING };

View File

@ -785,13 +785,15 @@ static UINT rdpei_recv_sc_ready_pdu(GENERIC_CHANNEL_CALLBACK* callback, wStream*
if (rdpei->version > protocolVersion)
rdpei->version = protocolVersion;
rdpei->features = features;
#if 0
if (protocolVersion > RDPINPUT_PROTOCOL_V300)
if (protocolVersion != RDPINPUT_PROTOCOL_V10)
{
WLog_Print(rdpei->base.log, WLOG_WARN,
"Unknown [MS-RDPEI] protocolVersion: 0x%08" PRIX32 "", protocolVersion);
WLog_Print(rdpei->base.log, WLOG_ERROR, "Unknown [MS-RDPEI] protocolVersion: 0x%08"PRIX32"", protocolVersion);
return -1;
}
#endif
return CHANNEL_RC_OK;
}

View File

@ -24,7 +24,6 @@
#include "sdl_freerdp.hpp"
#include "sdl_utils.hpp"
#include "sdl_prefs.hpp"
#include "sdl_touch.hpp"
#include <map>
@ -330,24 +329,20 @@ BOOL sdlInput::keyboard_focus_in()
freerdp_input_send_focus_in_event(input, WINPR_ASSERTING_INT_CAST(UINT16, syncFlags));
/* finish with a mouse pointer position like mstsc.exe if required */
// TODO: fullscreen/remote app
int x = 0;
int y = 0;
if (_sdl->fullscreen)
{
SDL_GetGlobalMouseState(&x, &y);
}
else
{
SDL_GetMouseState(&x, &y);
}
auto w = SDL_GetMouseFocus();
if (w)
{
auto id = SDL_GetWindowID(w);
sdl_scale_coordinates(_sdl, id, &x, &y, TRUE, TRUE);
}
return freerdp_client_send_button_event(_sdl->common(), FALSE, PTR_FLAGS_MOVE, x, y);
#if 0
if (xfc->remote_app)
return;
if (XQueryPointer(xfc->display, xfc->window->handle, &w, &w, &d, &d, &x, &y, &state))
{
if ((x >= 0) && (x < xfc->window->width) && (y >= 0) && (y < xfc->window->height))
{
xf_event_adjust_coordinates(xfc, &x, &y);
freerdp_client_send_button_event(&xfc->common, FALSE, PTR_FLAGS_MOVE, x, y);
}
}
#endif
return TRUE;
}
/* This function is called to update the keyboard indicator LED */

View File

@ -22,7 +22,6 @@
#include "sdl_freerdp.hpp"
#include "sdl_utils.hpp"
#include "sdl_prefs.hpp"
#include "sdl_touch.hpp"
#include <SDL3/SDL_oldnames.h>
@ -314,26 +313,20 @@ BOOL sdlInput::keyboard_focus_in()
freerdp_input_send_focus_in_event(input, WINPR_ASSERTING_INT_CAST(uint16_t, syncFlags));
/* finish with a mouse pointer position like mstsc.exe if required */
// TODO: fullscreen/remote app
float fx = 0.0f;
float fy = 0.0f;
if (_sdl->fullscreen)
{
SDL_GetGlobalMouseState(&fx, &fy);
}
else
{
SDL_GetMouseState(&fx, &fy);
}
auto x = static_cast<int32_t>(fx);
auto y = static_cast<int32_t>(fy);
auto w = SDL_GetMouseFocus();
if (w)
{
auto id = SDL_GetWindowID(w);
sdl_scale_coordinates(_sdl, id, &x, &y, TRUE, TRUE);
}
return freerdp_client_send_button_event(_sdl->common(), FALSE, PTR_FLAGS_MOVE, x, y);
#if 0
if (xfc->remote_app)
return;
if (XQueryPointer(xfc->display, xfc->window->handle, &w, &w, &d, &d, &x, &y, &state))
{
if ((x >= 0) && (x < xfc->window->width) && (y >= 0) && (y < xfc->window->height))
{
xf_event_adjust_coordinates(xfc, &x, &y);
freerdp_client_send_button_event(&xfc->common, FALSE, PTR_FLAGS_MOVE, x, y);
}
}
#endif
return TRUE;
}
/* This function is called to update the keyboard indicator LED */

View File

@ -90,14 +90,13 @@
WLog_VRB("com.freerdp.api", "IFCALLRET(" #_cb ") == NULL"); \
} while (0)
#if defined(__GNUC__) || defined(__clang__)
#if 0 // defined(__GNUC__)
#define IFCALLRESULT(_default_return, _cb, ...) \
__extension__({ \
if (_cb == NULL) \
{ \
({ \
(_cb != NULL) ? _cb(__VA_ARGS__) : ({ \
WLog_VRB("com.freerdp.api", "IFCALLRESULT(" #_cb ") == NULL"); \
} \
((_cb != NULL) ? _cb(__VA_ARGS__) : (_default_return)); \
(_default_return); \
}); \
})
#else
#define IFCALLRESULT(_default_return, _cb, ...) \

View File

@ -432,7 +432,7 @@ typedef struct gdi_palette gdiPalette;
UINT32 nSrcStep, UINT32 nXSrc, UINT32 nYSrc,
UINT32 nSrcWidth, UINT32 nSrcHeight);
/** @brief fill an area with the color provided.
/***
*
* @param pDstData destination buffer
* @param DstFormat destination buffer format
@ -450,31 +450,6 @@ typedef struct gdi_palette gdiPalette;
UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst, UINT32 nWidth,
UINT32 nHeight, UINT32 color);
#define FREERDP_IMAGE_FILL_IGNORE_ALPHA 1 /** @since version 3.13.0 */
/** @brief fill an area with the color provided. If flag \b FREERDP_IMAGE_FILL_IGNORE_ALPHA is
* set the destination alpha value will be kept.
*
* @param pDstData destination buffer
* @param DstFormat destination buffer format
* @param nDstStep destination buffer stride (line in bytes) 0 for default
* @param nXDst destination buffer offset x
* @param nYDst destination buffer offset y
* @param nWidth width to copy in pixels
* @param nHeight height to copy in pixels
* @param color Pixel color in DstFormat (internal representation format,
* use FreeRDPGetColor to create)
* @param flags \b FREERDP_IMAGE_FILL_* flags
*
* @return TRUE if success, FALSE otherwise
*
* @since version 3.13.0
*/
FREERDP_API BOOL freerdp_image_fill_ex(BYTE* WINPR_RESTRICT pDstData, DWORD DstFormat,
UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
UINT32 nWidth, UINT32 nHeight, UINT32 color,
UINT32 flags);
#ifdef __cplusplus
}
#endif

View File

@ -1127,37 +1127,6 @@ BOOL freerdp_image_fill(BYTE* WINPR_RESTRICT pDstData, DWORD DstFormat, UINT32 n
return TRUE;
}
BOOL freerdp_image_fill_ex(BYTE* pDstData, DWORD DstFormat, UINT32 nDstStep, UINT32 nXDst,
UINT32 nYDst, UINT32 nWidth, UINT32 nHeight, UINT32 color, UINT32 flags)
{
if (FreeRDPColorHasAlpha(DstFormat) && ((flags & FREERDP_IMAGE_FILL_IGNORE_ALPHA) != 0))
{
const UINT32 bpp = FreeRDPGetBytesPerPixel(DstFormat);
BYTE r = 0;
BYTE g = 0;
BYTE b = 0;
FreeRDPSplitColor(color, DstFormat, &r, &g, &b, NULL, NULL);
for (size_t y = 0; y < nHeight; y++)
{
BYTE* WINPR_RESTRICT line = &pDstData[(y + nYDst) * nDstStep];
for (size_t x = 0; x < nWidth; x++)
{
BYTE* WINPR_RESTRICT dst = &line[x * bpp];
const UINT32 dcolor = FreeRDPReadColor_int(dst, DstFormat);
BYTE a = 0;
FreeRDPSplitColor(dcolor, DstFormat, NULL, NULL, NULL, &a, NULL);
const UINT32 scolor = FreeRDPGetColor(DstFormat, r, g, b, a);
if (!FreeRDPWriteColor_int(dst, DstFormat, scolor))
return FALSE;
}
}
return TRUE;
}
return freerdp_image_fill(pDstData, DstFormat, nDstStep, nXDst, nYDst, nWidth, nHeight, color);
}
#if defined(WITH_SWSCALE)
static int av_format_for_buffer(UINT32 format)
{

View File

@ -1303,9 +1303,8 @@ static UINT gdi_SolidFill(RdpgfxClientContext* context, const RDPGFX_SOLID_FILL_
const UINT32 nWidth = invalidRect.right - invalidRect.left;
const UINT32 nHeight = invalidRect.bottom - invalidRect.top;
if (!freerdp_image_fill_ex(surface->data, surface->format, surface->scanline,
invalidRect.left, invalidRect.top, nWidth, nHeight, color,
FREERDP_IMAGE_FILL_IGNORE_ALPHA))
if (!freerdp_image_fill(surface->data, surface->format, surface->scanline, invalidRect.left,
invalidRect.top, nWidth, nHeight, color))
goto fail;
region16_union_rect(&(surface->invalidRegion), &(surface->invalidRegion), &invalidRect);

View File

@ -192,9 +192,11 @@ BOOL pcap_get_next_record(rdpPcap* pcap, pcap_record* record)
rdpPcap* pcap_open(const char* name, BOOL write)
{
rdpPcap* pcap = NULL;
WINPR_ASSERT(name);
rdpPcap* pcap = (rdpPcap*)calloc(1, sizeof(rdpPcap));
pcap = (rdpPcap*)calloc(1, sizeof(rdpPcap));
if (!pcap)
goto fail;
@ -240,7 +242,7 @@ void pcap_flush(rdpPcap* pcap)
while (pcap->record != NULL)
{
(void)pcap_write_record(pcap, pcap->record);
pcap_write_record(pcap, pcap->record);
pcap->record = pcap->record->next;
}

View File

@ -23,8 +23,6 @@
#include <winpr/crt.h>
#include <winpr/nt.h>
#define HAVE_SORTED_STRUCT 1
struct ntstatus_map
{
DWORD code;
@ -4618,7 +4616,7 @@ static int ntstatus_compare(const void* pKey, const void* pValue)
const char* NtStatus2Tag(NTSTATUS ntstatus)
{
#if defined(HAVE_SORTED_STRUCT) /* Requires sorted struct */
#if 1 /* Requires sorted struct */
size_t count = ARRAYSIZE(ntstatusmap);
size_t base = sizeof(ntstatusmap[0]);
const struct ntstatus_map* found =
@ -4640,7 +4638,7 @@ const char* NtStatus2Tag(NTSTATUS ntstatus)
const char* Win32ErrorCode2Tag(UINT16 code)
{
#if defined(HAVE_SORTED_STRUCT) /* Requires sorted struct */
#if 1 /* Requires sorted struct */
DWORD ntstatus = code;
size_t count = ARRAYSIZE(win32errmap);
size_t base = sizeof(win32errmap[0]);

View File

@ -35,19 +35,15 @@ int TestWtsApiEnumerateProcesses(int argc, char* argv[])
return -1;
}
int rc = 0;
#if 0
{
printf("WTSEnumerateProcesses enumerated %"PRIu32" process:\n", count);
for (DWORD i = 0; i < count; i++)
{
const WTS_PROCESS_INFOA* cur = &pProcessInfo[i];
if (!cur->pProcessName)
rc = -1;
printf("\t[%" PRIu32 "]: %s (%" PRIu32 ")\n", i, cur->pProcessName, cur->ProcessId);
}
printf("\t[%"PRIu32"]: %s (%"PRIu32")\n", i, pProcessInfo[i].pProcessName, pProcessInfo[i].ProcessId);
}
#endif
WTSFreeMemory(pProcessInfo);
return rc;
return 0;
}