Merge pull request #11275 from akallabeth/dead-code-eliminate

[warnings] eliminate dead code
This commit is contained in:
akallabeth
2025-03-04 10:20:53 +01:00
committed by GitHub
26 changed files with 6 additions and 347 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
*

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

@@ -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

@@ -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);
}

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);

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

@@ -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)