[warnings] fix dead store

This commit is contained in:
akallabeth 2024-09-09 17:40:50 +02:00
parent 674e84cbf3
commit edf6ab89f7
No known key found for this signature in database
GPG Key ID: A49454A3FC909FD5
11 changed files with 62 additions and 57 deletions

View File

@ -1536,7 +1536,9 @@ static UINT rdpdr_server_receive_io_lock_control_request(RdpdrServerContext* con
WLog_Print(context->priv->log, WLOG_WARN,
"[MS-RDPEFS] 2.2.3.3.12 Server Drive Lock Control Request (DR_DRIVE_LOCK_REQ) "
"not implemented");
"[Lock=0x%08" PRIx32 "]"
"not implemented",
Lock);
WLog_Print(context->priv->log, WLOG_WARN, "TODO");
return CHANNEL_RC_OK;

View File

@ -91,6 +91,8 @@ bool SDLConnectionDialog::showError(const char* fmt, ...)
va_start(ap, fmt);
auto rc = show(MSG_ERROR, fmt, ap);
va_end(ap);
if (!rc)
return rc;
return setTimer();
}

View File

@ -91,6 +91,8 @@ bool SDLConnectionDialog::showError(const char* fmt, ...)
va_start(ap, fmt);
auto rc = show(MSG_ERROR, fmt, ap);
va_end(ap);
if (!rc)
return rc;
return setTimer();
}

View File

@ -1001,9 +1001,7 @@ static char* extract_authorization_code(char* url)
end = strchr(p, '&');
if (end)
*end = 0;
else
end = strchr(p, '\0');
*end = '\0';
return p;
}

View File

@ -360,7 +360,8 @@ static BOOL ffmpeg_open_context(FREERDP_DSP_CONTEXT* WINPR_RESTRICT context)
context->buffered->format = context->resampled->format;
context->buffered->nb_samples = context->context->frame_size;
if ((ret = av_frame_get_buffer(context->buffered, 1)) < 0)
ret = av_frame_get_buffer(context->buffered, 1);
if (ret < 0)
goto fail;
}

View File

@ -1065,6 +1065,8 @@ static BOOL test_encode_decode(const char* path)
rc = progressive_compress(progressiveEnc, image->data, image->scanline * image->height,
ColorFormat, image->width, image->height, image->scanline, NULL,
&dstData, &dstSize);
if (rc < 0)
goto fail;
// Progressive decode
rc = progressive_create_surface_context(progressiveDec, 0, image->width, image->height);

View File

@ -133,7 +133,6 @@ static BOOL gdi_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap, const
UINT32 DstWidth, UINT32 DstHeight, UINT32 bpp, UINT32 length,
BOOL compressed, UINT32 codecId)
{
int status = 0;
UINT32 SrcSize = length;
rdpGdi* gdi = context->gdi;
UINT32 size = DstWidth * DstHeight;
@ -169,14 +168,12 @@ static BOOL gdi_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap, const
WLog_ERR(TAG, "rfx_process_message failed");
return FALSE;
}
status = 1;
}
else if (codecId == RDP_CODEC_ID_NSCODEC)
{
status = nsc_process_message(context->codecs->nsc, 32, DstWidth, DstHeight, pSrcData,
SrcSize, bitmap->data, bitmap->format, 0, 0, 0, DstWidth,
DstHeight, FREERDP_FLIP_VERTICAL);
const int status = nsc_process_message(
context->codecs->nsc, 32, DstWidth, DstHeight, pSrcData, SrcSize, bitmap->data,
bitmap->format, 0, 0, 0, DstWidth, DstHeight, FREERDP_FLIP_VERTICAL);
if (status < 1)
{

View File

@ -96,8 +96,6 @@ static WINPR_NORETURN(void buildconfig(const char* app))
int main(int argc, char* argv[])
{
proxyConfig* config = NULL;
char* config_path = "config.ini";
int status = -1;
pf_server_register_signal_handlers();
@ -110,31 +108,29 @@ int main(int argc, char* argv[])
if (argc < 2)
usage(argv[0]);
const char* arg = argv[1];
if (_stricmp(arg, "-h") == 0)
usage(argv[0]);
else if (_stricmp(arg, "--help") == 0)
usage(argv[0]);
else if (_stricmp(arg, "--buildconfig") == 0)
buildconfig(argv[0]);
else if (_stricmp(arg, "--dump-config") == 0)
{
const char* arg = argv[1];
if (_stricmp(arg, "-h") == 0)
if (argc <= 2)
usage(argv[0]);
else if (_stricmp(arg, "--help") == 0)
usage(argv[0]);
else if (_stricmp(arg, "--buildconfig") == 0)
buildconfig(argv[0]);
else if (_stricmp(arg, "--dump-config") == 0)
{
if (argc <= 2)
usage(argv[0]);
pf_server_config_dump(argv[2]);
status = 0;
goto fail;
}
else if (_stricmp(arg, "-v") == 0)
version(argv[0]);
else if (_stricmp(arg, "--version") == 0)
version(argv[0]);
config_path = argv[1];
pf_server_config_dump(argv[2]);
status = 0;
goto fail;
}
else if (_stricmp(arg, "-v") == 0)
version(argv[0]);
else if (_stricmp(arg, "--version") == 0)
version(argv[0]);
const char* config_path = argv[1];
config = pf_server_config_load_file(config_path);
proxyConfig* config = pf_server_config_load_file(config_path);
if (!config)
goto fail;

View File

@ -4,6 +4,8 @@
#include <winpr/windows.h>
#include <winpr/interlocked.h>
#define ITEM_COUNT 23
typedef struct
{
WINPR_SLIST_ENTRY ItemEntry;
@ -12,14 +14,14 @@ typedef struct
int TestInterlockedSList(int argc, char* argv[])
{
ULONG Count = 0;
WINPR_PSLIST_ENTRY pFirstEntry = NULL;
WINPR_PSLIST_HEADER pListHead = NULL;
int rc = -1;
WINPR_UNUSED(argc);
WINPR_UNUSED(argv);
/* Initialize the list header to a MEMORY_ALLOCATION_ALIGNMENT boundary. */
pListHead = (WINPR_PSLIST_HEADER)winpr_aligned_malloc(sizeof(WINPR_SLIST_HEADER),
MEMORY_ALLOCATION_ALIGNMENT);
WINPR_PSLIST_HEADER pListHead = (WINPR_PSLIST_HEADER)winpr_aligned_malloc(
sizeof(WINPR_SLIST_HEADER), MEMORY_ALLOCATION_ALIGNMENT);
if (!pListHead)
{
@ -30,7 +32,7 @@ int TestInterlockedSList(int argc, char* argv[])
InitializeSListHead(pListHead);
/* Insert 10 items into the list. */
for (Count = 1; Count <= 10; Count += 1)
for (ULONG Count = 0; Count < ITEM_COUNT; Count++)
{
PPROGRAM_ITEM pProgramItem =
(PPROGRAM_ITEM)winpr_aligned_malloc(sizeof(PROGRAM_ITEM), MEMORY_ALLOCATION_ALIGNMENT);
@ -38,26 +40,32 @@ int TestInterlockedSList(int argc, char* argv[])
if (!pProgramItem)
{
printf("Memory allocation failed.\n");
return -1;
goto fail;
}
pProgramItem->Signature = Count;
pFirstEntry = InterlockedPushEntrySList(pListHead, &(pProgramItem->ItemEntry));
pProgramItem->Signature = Count + 1UL;
WINPR_PSLIST_ENTRY pFirstEntry =
InterlockedPushEntrySList(pListHead, &(pProgramItem->ItemEntry));
if (((Count == 0) && pFirstEntry) || ((Count != 0) && !pFirstEntry))
{
printf("Error: List is empty.\n");
winpr_aligned_free(pProgramItem);
goto fail;
}
}
/* Remove 10 items from the list and display the signature. */
for (Count = 10; Count >= 1; Count -= 1)
for (ULONG Count = 0; Count < ITEM_COUNT; Count++)
{
PPROGRAM_ITEM pProgramItem = NULL;
WINPR_PSLIST_ENTRY pListEntry = InterlockedPopEntrySList(pListHead);
if (!pListEntry)
{
printf("List is empty.\n");
return -1;
goto fail;
}
pProgramItem = (PPROGRAM_ITEM)pListEntry;
PPROGRAM_ITEM pProgramItem = (PPROGRAM_ITEM)pListEntry;
printf("Signature is %" PRIu32 "\n", pProgramItem->Signature);
/*
@ -71,15 +79,17 @@ int TestInterlockedSList(int argc, char* argv[])
}
/* Flush the list and verify that the items are gone. */
pFirstEntry = InterlockedPopEntrySList(pListHead);
WINPR_PSLIST_ENTRY pFirstEntry = InterlockedPopEntrySList(pListHead);
if (pFirstEntry)
{
printf("Error: List is not empty.\n");
return -1;
goto fail;
}
rc = 0;
fail:
winpr_aligned_free(pListHead);
return 0;
return rc;
}

View File

@ -608,7 +608,6 @@ static SECURITY_STATUS SEC_ENTRY ntlm_InitializeSecurityContextW(
SSPI_CREDENTIALS* credentials = NULL;
PSecBuffer input_buffer = NULL;
PSecBuffer output_buffer = NULL;
PSecBuffer channel_bindings = NULL;
/* behave like windows SSPIs that don't want empty context */
if (phContext && !phContext->dwLower && !phContext->dwUpper)
@ -619,7 +618,6 @@ static SECURITY_STATUS SEC_ENTRY ntlm_InitializeSecurityContextW(
if (pInput)
{
input_buffer = sspi_FindSecBuffer(pInput, SECBUFFER_TOKEN);
channel_bindings = sspi_FindSecBuffer(pInput, SECBUFFER_CHANNEL_BINDINGS);
}
if (!context)
@ -686,7 +684,7 @@ static SECURITY_STATUS SEC_ENTRY ntlm_InitializeSecurityContextW(
if (input_buffer->cbBuffer < 1)
return SEC_E_INVALID_TOKEN;
channel_bindings = sspi_FindSecBuffer(pInput, SECBUFFER_CHANNEL_BINDINGS);
PSecBuffer channel_bindings = sspi_FindSecBuffer(pInput, SECBUFFER_CHANNEL_BINDINGS);
if (channel_bindings)
{

View File

@ -396,7 +396,6 @@ static int test_ntlm_server_authenticate(TEST_NTLM_SERVER* ntlm)
ntlm->outputBuffer[0].BufferType = SECBUFFER_TOKEN;
ntlm->outputBuffer[0].cbBuffer = ntlm->cbMaxToken;
ntlm->outputBuffer[0].pvBuffer = malloc(ntlm->outputBuffer[0].cbBuffer);
BOOL hash_set = FALSE;
if (!ntlm->outputBuffer[0].pvBuffer)
return -1;
@ -406,7 +405,7 @@ static int test_ntlm_server_authenticate(TEST_NTLM_SERVER* ntlm)
ntlm->fContextReq, SECURITY_NATIVE_DREP, &ntlm->context, &ntlm->outputBufferDesc,
&ntlm->pfContextAttr, &ntlm->expiration);
if (!hash_set && status == SEC_I_CONTINUE_NEEDED)
if (status == SEC_I_CONTINUE_NEEDED)
{
SecPkgContext_AuthNtlmHash AuthNtlmHash = { 0 };
@ -424,8 +423,6 @@ static int test_ntlm_server_authenticate(TEST_NTLM_SERVER* ntlm)
status =
ntlm->table->SetContextAttributes(&ntlm->context, SECPKG_ATTR_AUTH_NTLM_HASH,
&AuthNtlmHash, sizeof(SecPkgContext_AuthNtlmHash));
hash_set = TRUE;
}
if ((status != SEC_E_OK) && (status != SEC_I_CONTINUE_NEEDED))