[warnings] eliminate dead code

This commit is contained in:
akallabeth 2025-03-03 22:16:06 +01:00
parent 7406855337
commit 6d541c8691
35 changed files with 145 additions and 406 deletions

View File

@ -192,20 +192,6 @@ static DWORD WINAPI audin_oss_thread_func(LPVOID arg)
close(mixer_handle);
}
#if 0 /* FreeBSD OSS implementation at this moment (2015.03) does not set PCM_CAP_INPUT flag. */
tmp = 0;
if (ioctl(pcm_handle, SNDCTL_DSP_GETCAPS, &tmp) == -1)
{
OSS_LOG_ERR("SNDCTL_DSP_GETCAPS failed, try ignored", errno);
}
else if ((tmp & PCM_CAP_INPUT) == 0)
{
OSS_LOG_ERR("Device does not supports playback", EOPNOTSUPP);
goto err_out;
}
#endif
/* Set format. */
tmp = audin_oss_get_format(&oss->format);

View File

@ -123,10 +123,6 @@ static UINT encomsp_virtual_channel_write(encomspPlugin* encomsp, wStream* s)
return ERROR_INVALID_HANDLE;
}
#if 0
WLog_INFO(TAG, "EncomspWrite (%"PRIuz")", Stream_Length(s));
winpr_HexDump(Stream_Buffer(s), Stream_Length(s));
#endif
const UINT status = encomsp->channelEntryPoints.pVirtualChannelWriteEx(
encomsp->InitHandle, encomsp->OpenHandle, Stream_Buffer(s), (UINT32)Stream_Length(s), s);

View File

@ -47,36 +47,6 @@ static UINT encomsp_read_header(wStream* s, ENCOMSP_ORDER_HEADER* header)
return CHANNEL_RC_OK;
}
#if 0
static int encomsp_write_header(wStream* s, ENCOMSP_ORDER_HEADER* header)
{
Stream_Write_UINT16(s, header->Type); /* Type (2 bytes) */
Stream_Write_UINT16(s, header->Length); /* Length (2 bytes) */
return 1;
}
static int encomsp_read_unicode_string(wStream* s, ENCOMSP_UNICODE_STRING* str)
{
ZeroMemory(str, sizeof(ENCOMSP_UNICODE_STRING));
if (!Stream_CheckAndLogRequiredLength(TAG, s, 2))
return -1;
Stream_Read_UINT16(s, str->cchString); /* cchString (2 bytes) */
if (str->cchString > 1024)
return -1;
if (!Stream_CheckAndLogRequiredLengthOfSize(TAG, s, str->cchString, sizeof(WCHAR)))
return -1;
Stream_Read(s, &(str->wString), (str->cchString * 2)); /* String (variable) */
return 1;
}
#endif
/**
* Function description
*
@ -134,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,16 +204,24 @@ 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)
{
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)*/
;
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;
}
#endif
void ndr_dump_RPC_UNICODE_STRING(wLog* logger, UINT32 lvl, size_t indentLevel,
const RPC_UNICODE_STRING* obj)
@ -248,7 +256,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,
/*ndr_write_RPC_UNICODE_STRING*/ NULL,
NULL,
ndr_descr_destroy_RPC_UNICODE_STRING,
ndr_descr_dump_RPC_UNICODE_STRING };

View File

@ -785,15 +785,13 @@ 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_V10)
if (protocolVersion > RDPINPUT_PROTOCOL_V300)
{
WLog_Print(rdpei->base.log, WLOG_ERROR, "Unknown [MS-RDPEI] protocolVersion: 0x%08"PRIX32"", protocolVersion);
return -1;
WLog_Print(rdpei->base.log, WLOG_WARN,
"Unknown [MS-RDPEI] protocolVersion: 0x%08" PRIX32 "", protocolVersion);
}
#endif
return CHANNEL_RC_OK;
}

View File

@ -227,23 +227,6 @@ static BOOL rdpsnd_oss_open(rdpsndDevicePlugin* device, const AUDIO_FORMAT* form
return FALSE;
}
#if 0 /* FreeBSD OSS implementation at this moment (2015.03) does not set PCM_CAP_OUTPUT flag. */
int mask = 0;
if (ioctl(oss->pcm_handle, SNDCTL_DSP_GETCAPS, &mask) == -1)
{
OSS_LOG_ERR("SNDCTL_DSP_GETCAPS failed, try ignored", errno);
}
else if ((mask & PCM_CAP_OUTPUT) == 0)
{
OSS_LOG_ERR("Device does not supports playback", EOPNOTSUPP);
close(oss->pcm_handle);
oss->pcm_handle = -1;
return;
}
#endif
if (ioctl(oss->pcm_handle, SNDCTL_DSP_GETFMTS, &oss->supported_formats) == -1)
{
OSS_LOG_ERR("SNDCTL_DSP_GETFMTS failed", errno);

View File

@ -632,11 +632,6 @@ static UINT remdesk_process_receive(remdeskPlugin* remdesk, wStream* s)
WINPR_ASSERT(remdesk);
WINPR_ASSERT(s);
#if 0
WLog_DBG(TAG, "RemdeskReceive: %"PRIuz"", Stream_GetRemainingLength(s));
winpr_HexDump(Stream_ConstPointer(s), Stream_GetRemainingLength(s));
#endif
if ((status = remdesk_read_channel_header(s, &header)))
{
WLog_ERR(TAG, "remdesk_read_channel_header failed with error %" PRIu32 "", status);

View File

@ -387,10 +387,6 @@ static UINT remdesk_server_receive_pdu(RemdeskServerContext* context, wStream* s
{
UINT error = CHANNEL_RC_OK;
REMDESK_CHANNEL_HEADER header;
#if 0
WLog_INFO(TAG, "RemdeskReceive: %"PRIuz"", Stream_GetRemainingLength(s));
winpr_HexDump(WCHAR* expertBlobW = NULL;(s), Stream_GetRemainingLength(s));
#endif
if ((error = remdesk_read_channel_header(s, &header)))
{

View File

@ -461,19 +461,6 @@ static BOOL tsmf_ffmpeg_decode_audio(ITSMFDecoder* decoder, const BYTE* data, UI
int len = 0;
int frame_size = 0;
#if 0
WLog_DBG(TAG, ("tsmf_ffmpeg_decode_audio: data_size %"PRIu32"", data_size));
for (int i = 0; i < data_size; i++)
{
WLog_DBG(TAG, ("%02"PRIX8"", data[i]));
if (i % 16 == 15)
WLog_DBG(TAG, ("\n"));
}
#endif
if (mdecoder->decoded_size_max == 0)
mdecoder->decoded_size_max = MAX_AUDIO_FRAME_SIZE + 16;

View File

@ -93,20 +93,6 @@ static BOOL tsmf_oss_open(ITSMFAudioDevice* audio, const char* device)
return FALSE;
}
#if 0 /* FreeBSD OSS implementation at this moment (2015.03) does not set PCM_CAP_OUTPUT flag. */
if (ioctl(oss->pcm_handle, SNDCTL_DSP_GETCAPS, &mask) == -1)
{
OSS_LOG_ERR("SNDCTL_DSP_GETCAPS failed, try ignored", errno);
}
else if ((mask & PCM_CAP_OUTPUT) == 0)
{
OSS_LOG_ERR("Device does not supports playback", EOPNOTSUPP);
close(oss->pcm_handle);
oss->pcm_handle = -1;
return FALSE;
}
#endif
const int rc = ioctl(oss->pcm_handle, SNDCTL_DSP_GETFMTS, &tmp);
if (rc == -1)
{

View File

@ -24,6 +24,7 @@
#include "sdl_freerdp.hpp"
#include "sdl_utils.hpp"
#include "sdl_prefs.hpp"
#include "sdl_touch.hpp"
#include <map>
@ -329,20 +330,24 @@ 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 */
#if 0
if (xfc->remote_app)
return;
if (XQueryPointer(xfc->display, xfc->window->handle, &w, &w, &d, &d, &x, &y, &state))
// TODO: fullscreen/remote app
int x = 0;
int y = 0;
if (_sdl->fullscreen)
{
if ((x >= 0) && (x < xfc->window->width) && (y >= 0) && (y < xfc->window->height))
SDL_GetGlobalMouseState(&x, &y);
}
else
{
xf_event_adjust_coordinates(xfc, &x, &y);
freerdp_client_send_button_event(&xfc->common, FALSE, PTR_FLAGS_MOVE, x, y);
SDL_GetMouseState(&x, &y);
}
auto w = SDL_GetMouseFocus();
if (w)
{
auto id = SDL_GetWindowID(w);
sdl_scale_coordinates(_sdl, id, &x, &y, TRUE, TRUE);
}
#endif
return TRUE;
return freerdp_client_send_button_event(_sdl->common(), FALSE, PTR_FLAGS_MOVE, x, y);
}
/* This function is called to update the keyboard indicator LED */

View File

@ -22,6 +22,7 @@
#include "sdl_freerdp.hpp"
#include "sdl_utils.hpp"
#include "sdl_prefs.hpp"
#include "sdl_touch.hpp"
#include <SDL3/SDL_oldnames.h>
@ -313,20 +314,26 @@ 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 */
#if 0
if (xfc->remote_app)
return;
if (XQueryPointer(xfc->display, xfc->window->handle, &w, &w, &d, &d, &x, &y, &state))
// TODO: fullscreen/remote app
float fx = 0.0f;
float fy = 0.0f;
if (_sdl->fullscreen)
{
if ((x >= 0) && (x < xfc->window->width) && (y >= 0) && (y < xfc->window->height))
SDL_GetGlobalMouseState(&fx, &fy);
}
else
{
xf_event_adjust_coordinates(xfc, &x, &y);
freerdp_client_send_button_event(&xfc->common, FALSE, PTR_FLAGS_MOVE, x, y);
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);
}
#endif
return TRUE;
return freerdp_client_send_button_event(_sdl->common(), FALSE, PTR_FLAGS_MOVE, x, y);
}
/* This function is called to update the keyboard indicator LED */

View File

@ -161,8 +161,6 @@ static BOOL wlf_disp_sendResize(wlfDispContext* wlfDisp)
static BOOL wlf_disp_set_window_resizable(WINPR_ATTR_UNUSED wlfDispContext* wlfDisp)
{
WLog_ERR("TODO", "TODO: implement");
#if 0 // TODO
#endif
return TRUE;
}

View File

@ -891,12 +891,6 @@ static int xf_error_handler(Display* d, XErrorEvent* ev)
WLog_ERR(TAG, "%s", buf);
winpr_log_backtrace(TAG, WLOG_ERROR, 20);
#if 0
const BOOL do_abort = TRUE;
if (do_abort)
abort();
#endif
if (def_error_handler)
return def_error_handler(d, ev);

View File

@ -203,14 +203,6 @@ static const test tests[] = {
check_settings_smartcard_no_redirection,
{ "testfreerdp", "/sound", "/drive:media,/foo/bar/blabla", "/v:test.freerdp.com", 0 },
{ { 0 } } },
#if 0
{
COMMAND_LINE_STATUS_PRINT, check_settings_smartcard_no_redirection,
{"testfreerdp", "-z", "--plugin", "cliprdr", "--plugin", "rdpsnd", "--data", "alsa", "latency:100", "--", "--plugin", "rdpdr", "--data", "disk:w7share:/home/w7share", "--", "--plugin", "drdynvc", "--data", "tsmf:decoder:gstreamer", "--", "-u", "test", "host.example.com", 0},
{{0}}
},
#endif
};
// NOLINTEND(bugprone-suspicious-missing-comma)

View File

@ -310,15 +310,6 @@ int TestClientRdpFile(int argc, char* argv[])
goto fail;
}
#if 0 /* TODO: Currently unused */
if (freerdp_settings_get_uint32(settings, FreeRDP_GatewayProfileUsageMethod) != 1)
{
printf("GatewayProfileUsageMethod mismatch: Actual: %"PRIu32", Expected: 1\n",
freerdp_settings_get_uint32(settings, FreeRDP_GatewayProfileUsageMethod));
goto fail;
}
#endif
if (strcmp(freerdp_settings_get_string(settings, FreeRDP_GatewayHostname),
"LAB1-W2K8R2-GW.lab1.awake.local") != 0)
{
@ -369,15 +360,6 @@ int TestClientRdpFile(int argc, char* argv[])
return -1;
}
#if 0 /* TODO: Currently unused */
if (freerdp_settings_get_uint32(settings, FreeRDP_GatewayProfileUsageMethod) != 1)
{
printf("GatewayProfileUsageMethod mismatch: Actual: %"PRIu32", Expected: 1\n",
freerdp_settings_get_uint32(settings, FreeRDP_GatewayProfileUsageMethod));
goto fail;
}
#endif
if (strcmp(freerdp_settings_get_string(settings, FreeRDP_ServerHostname),
"LAB1-W7-DM-01.lab1.awake.global") != 0)
{

View File

@ -90,13 +90,14 @@
WLog_VRB("com.freerdp.api", "IFCALLRET(" #_cb ") == NULL"); \
} while (0)
#if 0 // defined(__GNUC__)
#if defined(__GNUC__) || defined(__clang__)
#define IFCALLRESULT(_default_return, _cb, ...) \
({ \
(_cb != NULL) ? _cb(__VA_ARGS__) : ({ \
__extension__({ \
if (_cb == NULL) \
{ \
WLog_VRB("com.freerdp.api", "IFCALLRESULT(" #_cb ") == NULL"); \
(_default_return); \
}); \
} \
((_cb != NULL) ? _cb(__VA_ARGS__) : (_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,6 +450,31 @@ 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

@ -322,7 +322,6 @@ BOOL freerdp_image_copy_from_monochrome(BYTE* WINPR_RESTRICT pDstData, UINT32 Ds
static INLINE UINT32 freerdp_image_inverted_pointer_color(UINT32 x, UINT32 y, UINT32 format)
{
#if 1
/**
* Inverted pointer colors (where individual pixels can change their
* color to accommodate the background behind them) only seem to be
@ -333,9 +332,6 @@ static INLINE UINT32 freerdp_image_inverted_pointer_color(UINT32 x, UINT32 y, UI
* pixel's position.
*/
BYTE fill = (x + y) & 1 ? 0x00 : 0xFF;
#else
BYTE fill = 0x00;
#endif
return FreeRDPGetColor(format, fill, fill, fill, 0xFF);
}
@ -1131,6 +1127,37 @@ 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

@ -346,14 +346,6 @@ static int libavcodec_decompress(H264_CONTEXT* WINPR_RESTRICT h264,
goto fail;
}
#endif
#if 0
WLog_Print(h264->log, WLOG_INFO,
"libavcodec_decompress: frame decoded (status=%d, gotFrame=%d, width=%d, height=%d, Y=[%p,%d], U=[%p,%d], V=[%p,%d])",
status, gotFrame, sys->videoFrame->width, sys->videoFrame->height,
(void*) sys->videoFrame->data[0], sys->videoFrame->linesize[0],
(void*) sys->videoFrame->data[1], sys->videoFrame->linesize[1],
(void*) sys->videoFrame->data[2], sys->videoFrame->linesize[2]);
#endif
if (gotFrame)

View File

@ -169,14 +169,6 @@ static int openh264_decompress(H264_CONTEXT* WINPR_RESTRICT h264,
return -2003;
}
#if 0
WLog_Print(h264->log, WLOG_INFO,
"h264_decompress: state=%u, pYUVData=[%p,%p,%p], bufferStatus=%d, width=%d, height=%d, format=%d, stride=[%d,%d]",
state, (void*) pYUVData[0], (void*) pYUVData[1], (void*) pYUVData[2], sBufferInfo.iBufferStatus,
pSystemBuffer->iWidth, pSystemBuffer->iHeight, pSystemBuffer->iFormat,
pSystemBuffer->iStride[0], pSystemBuffer->iStride[1]);
#endif
if (pSystemBuffer->iFormat != videoFormatI420)
return -2004;

View File

@ -874,14 +874,6 @@ int TestFreeRDPCodecRemoteFX(int argc, char* argv[])
goto fail;
region16_print(&region);
#if 0
FILE *f = fopen("/tmp/windows.data", "w");
if (f) {
fwrite(dest, IMG_WIDTH * IMG_HEIGHT, FORMAT_SIZE, f);
fclose(f);
}
#endif
if (!fuzzyCompareImage(srefImage, dest, IMG_WIDTH * IMG_HEIGHT))
goto fail;

View File

@ -45,10 +45,8 @@
#define TAG FREERDP_TAG("core.license")
#if 0
#define LICENSE_NULL_CLIENT_RANDOM 1
#define LICENSE_NULL_PREMASTER_SECRET 1
#endif
// #define LICENSE_NULL_CLIENT_RANDOM 1
// #define LICENSE_NULL_PREMASTER_SECRET 1
// #define WITH_LICENSE_DECRYPT_CHALLENGE_RESPONSE

View File

@ -917,26 +917,7 @@ static INLINE BOOL update_read_delta(wStream* s, INT32* value)
return TRUE;
}
#if 0
static INLINE void update_read_glyph_delta(wStream* s, UINT16* value)
{
BYTE byte;
Stream_Read_UINT8(s, byte);
if (byte == 0x80)
Stream_Read_UINT16(s, *value);
else
*value = (byte & 0x3F);
}
static INLINE void update_seek_glyph_delta(wStream* s)
{
BYTE byte;
Stream_Read_UINT8(s, byte);
if (byte & 0x80)
Stream_Seek_UINT8(s);
}
#endif
static INLINE BOOL update_read_brush(wStream* s, rdpBrush* brush, BYTE fieldFlags)
{
if (fieldFlags & ORDER_FIELD_01)

View File

@ -1285,15 +1285,11 @@ static UINT gdi_SolidFill(RdpgfxClientContext* context, const RDPGFX_SOLID_FILL_
const BYTE g = solidFill->fillPixel.G;
const BYTE r = solidFill->fillPixel.R;
#if 0
/* [MS-RDPEGFX] 3.3.5.4 Processing an RDPGFX_SOLIDFILL_PDU message
* https://learn.microsoft.com/en-us/windows/win32/gdi/binary-raster-operations
*
* this sounds like the alpha value is always ignored.
*/
if (FreeRDPColorHasAlpha(surface->format))
a = solidFill->fillPixel.XA;
#endif
const UINT32 color = FreeRDPGetColor(surface->format, r, g, b, a);
@ -1307,8 +1303,9 @@ 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(surface->data, surface->format, surface->scanline, invalidRect.left,
invalidRect.top, nWidth, nHeight, color))
if (!freerdp_image_fill_ex(surface->data, surface->format, surface->scanline,
invalidRect.left, invalidRect.top, nWidth, nHeight, color,
FREERDP_IMAGE_FILL_IGNORE_ALPHA))
goto fail;
region16_union_rect(&(surface->invalidRegion), &(surface->invalidRegion), &invalidRect);

View File

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

View File

@ -205,13 +205,6 @@ static std::wstring err2wstr(LONG code)
return converter.from_bytes(str);
}
#if 0
static bool test_listreadergroups(SCARDCONTEXT hContext) {
auto rc = SCardListReaderGroupsA(hContext, &groups, &foobar);
rc = SCardListReaderGroupsW(hContext, &groups, &foobar);
}
#endif
static bool test_valid(SCARDCONTEXT context)
{
auto rc = SCardIsValidContext(context);

View File

@ -607,27 +607,6 @@ WINPR_API WINPR_CIPHER_CTX* winpr_Cipher_NewEx(WINPR_CIPHER_TYPE cipher, WINPR_C
if (!ctx->ectx)
goto fail;
#if 0
if (keylen != 0)
{
WINPR_ASSERT(keylen <= INT32_MAX);
const int len = EVP_CIPHER_CTX_key_length(ctx->ectx);
if ((len > 0) && (len != keylen))
{
if (EVP_CIPHER_CTX_set_key_length(ctx->ectx, (int)keylen) != 1)
goto fail;
}
}
if (ivlen != 0)
{
WINPR_ASSERT(ivlen <= INT32_MAX);
const int len = EVP_CIPHER_CTX_iv_length(ctx->ectx);
if ((len > 0) && (ivlen != len))
goto fail;
}
#endif
const int operation = (op == WINPR_ENCRYPT) ? 1 : 0;
if (EVP_CipherInit_ex(ctx->ectx, evp, NULL, key, iv, operation) != 1)

View File

@ -190,13 +190,8 @@ NamedPipeClientCreateFileA(LPCSTR lpFileName, WINPR_ATTR_UNUSED DWORD dwDesiredA
if (dwFlagsAndAttributes & FILE_FLAG_OVERLAPPED)
{
#if 0
int flags = fcntl(pNamedPipe->clientfd, F_GETFL);
if (flags != -1)
(void)fcntl(pNamedPipe->clientfd, F_SETFL, flags | O_NONBLOCK);
#endif
// TODO: Implement
WLog_ERR(TAG, "TODO: implement this");
}
return hNamedPipe;

View File

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

View File

@ -706,13 +706,8 @@ HANDLE CreateNamedPipeA(LPCSTR lpName, DWORD dwOpenMode, DWORD dwPipeMode, DWORD
if (dwOpenMode & FILE_FLAG_OVERLAPPED)
{
#if 0
int flags = fcntl(pNamedPipe->serverfd, F_GETFL);
if (flags != -1)
fcntl(pNamedPipe->serverfd, F_SETFL, flags | O_NONBLOCK);
#endif
// TODO: Implement
WLog_ERR(TAG, "TODO: implement this");
}
// NOLINTNEXTLINE(clang-analyzer-unix.Malloc): ArrayList_Append takes ownership of baseSocket

View File

@ -195,11 +195,6 @@ static DWORD WINAPI named_pipe_server_thread(LPVOID arg)
/* 3: connect named pipe */
#if 0
/* This sleep will most certainly cause ERROR_PIPE_CONNECTED below */
Sleep(2000);
#endif
fConnected = ConnectNamedPipe(hNamedPipe, &overlapped);
status = GetLastError();

View File

@ -56,17 +56,7 @@ static void dump_event(WINPR_EVENT* event, size_t index)
{
char** msg = NULL;
size_t used = 0;
#if 0
void* stack = winpr_backtrace(20);
WLog_DBG(TAG, "Called from:");
msg = winpr_backtrace_symbols(stack, &used);
for (size_t i = 0; i < used; i++)
WLog_DBG(TAG, "[%" PRIdz "]: %s", i, msg[i]);
free(msg);
winpr_backtrace_free(stack);
#endif
WLog_DBG(TAG, "Event handle created still not closed! [%" PRIuz ", %p]", index, event);
msg = winpr_backtrace_symbols(event->create_stack, &used);

View File

@ -41,106 +41,6 @@ static BOOL Pcap_Read_Header(wPcap* pcap, wPcapHeader* header)
return FALSE;
}
/* currently unused code */
#if 0
static BOOL Pcap_Read_RecordHeader(wPcap* pcap, wPcapRecordHeader* record)
{
if (pcap && pcap->fp && (fread((void*) record, sizeof(wPcapRecordHeader), 1, pcap->fp) == 1))
return TRUE;
return FALSE;
}
static BOOL Pcap_Read_Record(wPcap* pcap, wPcapRecord* record)
{
if (pcap && pcap->fp)
{
if (!Pcap_Read_RecordHeader(pcap, &record->header))
return FALSE;
record->length = record->header.incl_len;
record->data = malloc(record->length);
if (!record->data)
return FALSE;
if (fread(record->data, record->length, 1, pcap->fp) != 1)
{
free(record->data);
record->length = 0;
record->data = NULL;
return FALSE;
}
}
return TRUE;
}
static BOOL Pcap_Add_Record(wPcap* pcap, void* data, UINT32 length)
{
wPcapRecord* record = NULL;
if (!pcap->tail)
{
pcap->tail = (wPcapRecord*) calloc(1, sizeof(wPcapRecord));
if (!pcap->tail)
return FALSE;
pcap->head = pcap->tail;
pcap->record = pcap->head;
record = pcap->tail;
}
else
{
record = (wPcapRecord*) calloc(1, sizeof(wPcapRecord));
if (!record)
return FALSE;
pcap->tail->next = record;
pcap->tail = record;
}
if (!pcap->record)
pcap->record = record;
record->data = data;
record->length = length;
record->header.incl_len = length;
record->header.orig_len = length;
UINT64 ns = winpr_GetUnixTimeNS();
record->header.ts_sec = WINPR_TIME_NS_TO_S(ns);
record->header.ts_usec = WINPR_TIME_NS_REM_US(ns);
return TRUE;
}
static BOOL Pcap_HasNext_Record(wPcap* pcap)
{
if (pcap->file_size - (_ftelli64(pcap->fp)) <= 16)
return FALSE;
return TRUE;
}
static BOOL Pcap_GetNext_RecordHeader(wPcap* pcap, wPcapRecord* record)
{
if (!Pcap_HasNext_Record(pcap) || !Pcap_Read_RecordHeader(pcap, &record->header))
return FALSE;
record->length = record->header.incl_len;
return TRUE;
}
static BOOL Pcap_GetNext_RecordContent(wPcap* pcap, wPcapRecord* record)
{
if (pcap && pcap->fp && fread(record->data, record->length, 1, pcap->fp) == 1)
return TRUE;
return FALSE;
}
static BOOL Pcap_GetNext_Record(wPcap* pcap, wPcapRecord* record)
{
if (!Pcap_HasNext_Record(pcap))
return FALSE;
return Pcap_Read_Record(pcap, record);
}
#endif
static BOOL Pcap_Write_Header(wPcap* pcap, wPcapHeader* header)
{
if (pcap && pcap->fp && fwrite((void*)header, sizeof(wPcapHeader), 1, pcap->fp) == 1)

View File

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