mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-14 16:34:18 +09:00
[c23] simplify boolean checks
This commit is contained in:
@@ -165,11 +165,11 @@ static UINT cliprdr_process_general_capability(cliprdrPlugin* cliprdr, wStream*
|
||||
|
||||
cliprdr_print_general_capability_flags(cliprdr->log, generalFlags);
|
||||
|
||||
cliprdr->useLongFormatNames = (generalFlags & CB_USE_LONG_FORMAT_NAMES) ? TRUE : FALSE;
|
||||
cliprdr->streamFileClipEnabled = (generalFlags & CB_STREAM_FILECLIP_ENABLED) ? TRUE : FALSE;
|
||||
cliprdr->fileClipNoFilePaths = (generalFlags & CB_FILECLIP_NO_FILE_PATHS) ? TRUE : FALSE;
|
||||
cliprdr->canLockClipData = (generalFlags & CB_CAN_LOCK_CLIPDATA) ? TRUE : FALSE;
|
||||
cliprdr->hasHugeFileSupport = (generalFlags & CB_HUGE_FILE_SUPPORT_ENABLED) ? TRUE : FALSE;
|
||||
cliprdr->useLongFormatNames = (generalFlags & CB_USE_LONG_FORMAT_NAMES) != 0;
|
||||
cliprdr->streamFileClipEnabled = (generalFlags & CB_STREAM_FILECLIP_ENABLED) != 0;
|
||||
cliprdr->fileClipNoFilePaths = (generalFlags & CB_FILECLIP_NO_FILE_PATHS) != 0;
|
||||
cliprdr->canLockClipData = (generalFlags & CB_CAN_LOCK_CLIPDATA) != 0;
|
||||
cliprdr->hasHugeFileSupport = (generalFlags & CB_HUGE_FILE_SUPPORT_ENABLED) != 0;
|
||||
cliprdr->capabilitiesReceived = TRUE;
|
||||
|
||||
capabilities.common.msgType = CB_CLIP_CAPS;
|
||||
@@ -601,11 +601,11 @@ static UINT cliprdr_client_capabilities(CliprdrClientContext* context,
|
||||
if (!cliprdr->hasHugeFileSupport)
|
||||
flags &= (uint32_t)~CB_HUGE_FILE_SUPPORT_ENABLED;
|
||||
|
||||
cliprdr->useLongFormatNames = (flags & CB_USE_LONG_FORMAT_NAMES) ? TRUE : FALSE;
|
||||
cliprdr->streamFileClipEnabled = (flags & CB_STREAM_FILECLIP_ENABLED) ? TRUE : FALSE;
|
||||
cliprdr->fileClipNoFilePaths = (flags & CB_FILECLIP_NO_FILE_PATHS) ? TRUE : FALSE;
|
||||
cliprdr->canLockClipData = (flags & CB_CAN_LOCK_CLIPDATA) ? TRUE : FALSE;
|
||||
cliprdr->hasHugeFileSupport = (flags & CB_HUGE_FILE_SUPPORT_ENABLED) ? TRUE : FALSE;
|
||||
cliprdr->useLongFormatNames = (flags & CB_USE_LONG_FORMAT_NAMES) != 0;
|
||||
cliprdr->streamFileClipEnabled = (flags & CB_STREAM_FILECLIP_ENABLED) != 0;
|
||||
cliprdr->fileClipNoFilePaths = (flags & CB_FILECLIP_NO_FILE_PATHS) != 0;
|
||||
cliprdr->canLockClipData = (flags & CB_CAN_LOCK_CLIPDATA) != 0;
|
||||
cliprdr->hasHugeFileSupport = (flags & CB_HUGE_FILE_SUPPORT_ENABLED) != 0;
|
||||
|
||||
Stream_Write_UINT32(s, flags); /* generalFlags */
|
||||
WLog_Print(cliprdr->log, WLOG_DEBUG, "ClientCapabilities");
|
||||
|
||||
@@ -389,7 +389,7 @@ UINT cliprdr_read_format_list(wLog* log, wStream* s, CLIPRDR_FORMAT_LIST* format
|
||||
CLIPRDR_FORMAT* formats = NULL;
|
||||
UINT error = ERROR_INTERNAL_ERROR;
|
||||
|
||||
const BOOL asciiNames = (formatList->common.msgFlags & CB_ASCII_NAMES) ? TRUE : FALSE;
|
||||
const BOOL asciiNames = (formatList->common.msgFlags & CB_ASCII_NAMES) != 0;
|
||||
|
||||
index = 0;
|
||||
/* empty format list */
|
||||
|
||||
@@ -479,23 +479,19 @@ static UINT cliprdr_server_receive_general_capability(CliprdrServerContext* cont
|
||||
Stream_Read_UINT32(s, cap_set->generalFlags); /* generalFlags (4 bytes) */
|
||||
|
||||
if (context->useLongFormatNames)
|
||||
context->useLongFormatNames =
|
||||
(cap_set->generalFlags & CB_USE_LONG_FORMAT_NAMES) ? TRUE : FALSE;
|
||||
context->useLongFormatNames = (cap_set->generalFlags & CB_USE_LONG_FORMAT_NAMES) != 0;
|
||||
|
||||
if (context->streamFileClipEnabled)
|
||||
context->streamFileClipEnabled =
|
||||
(cap_set->generalFlags & CB_STREAM_FILECLIP_ENABLED) ? TRUE : FALSE;
|
||||
context->streamFileClipEnabled = (cap_set->generalFlags & CB_STREAM_FILECLIP_ENABLED) != 0;
|
||||
|
||||
if (context->fileClipNoFilePaths)
|
||||
context->fileClipNoFilePaths =
|
||||
(cap_set->generalFlags & CB_FILECLIP_NO_FILE_PATHS) ? TRUE : FALSE;
|
||||
context->fileClipNoFilePaths = (cap_set->generalFlags & CB_FILECLIP_NO_FILE_PATHS) != 0;
|
||||
|
||||
if (context->canLockClipData)
|
||||
context->canLockClipData = (cap_set->generalFlags & CB_CAN_LOCK_CLIPDATA) ? TRUE : FALSE;
|
||||
context->canLockClipData = (cap_set->generalFlags & CB_CAN_LOCK_CLIPDATA) != 0;
|
||||
|
||||
if (context->hasHugeFileSupport)
|
||||
context->hasHugeFileSupport =
|
||||
(cap_set->generalFlags & CB_HUGE_FILE_SUPPORT_ENABLED) ? TRUE : FALSE;
|
||||
context->hasHugeFileSupport = (cap_set->generalFlags & CB_HUGE_FILE_SUPPORT_ENABLED) != 0;
|
||||
|
||||
return CHANNEL_RC_OK;
|
||||
}
|
||||
|
||||
@@ -227,7 +227,7 @@ static BOOL drive_file_init(DRIVE_FILE* file)
|
||||
}
|
||||
else
|
||||
{
|
||||
file->is_dir = ((file->CreateOptions & FILE_DIRECTORY_FILE) ? TRUE : FALSE);
|
||||
file->is_dir = ((file->CreateOptions & FILE_DIRECTORY_FILE) != 0);
|
||||
|
||||
if (file->is_dir)
|
||||
{
|
||||
@@ -491,9 +491,8 @@ static BOOL drive_file_query_from_handle_information(const DRIVE_FILE* file,
|
||||
Stream_Write_UINT32(output, info->nFileSizeHigh); /* EndOfFile */
|
||||
Stream_Write_UINT32(output, info->nNumberOfLinks); /* NumberOfLinks */
|
||||
Stream_Write_UINT8(output, file->delete_pending ? 1 : 0); /* DeletePending */
|
||||
Stream_Write_UINT8(output, info->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY
|
||||
? TRUE
|
||||
: FALSE); /* Directory */
|
||||
Stream_Write_UINT8(output, (info->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) !=
|
||||
0); /* Directory */
|
||||
/* Reserved(2), MUST NOT be added! */
|
||||
break;
|
||||
|
||||
@@ -558,9 +557,8 @@ static BOOL drive_file_query_from_attributes(const DRIVE_FILE* file,
|
||||
Stream_Write_UINT32(output, attrib->nFileSizeHigh); /* EndOfFile */
|
||||
Stream_Write_UINT32(output, 0); /* NumberOfLinks */
|
||||
Stream_Write_UINT8(output, file->delete_pending ? 1 : 0); /* DeletePending */
|
||||
Stream_Write_UINT8(output, attrib->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY
|
||||
? TRUE
|
||||
: FALSE); /* Directory */
|
||||
Stream_Write_UINT8(output, (attrib->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) !=
|
||||
0); /* Directory */
|
||||
/* Reserved(2), MUST NOT be added! */
|
||||
break;
|
||||
|
||||
|
||||
@@ -124,7 +124,7 @@ static UINT rail_read_server_localmovesize_order(wStream* s,
|
||||
|
||||
Stream_Read_UINT32(s, localMoveSize->windowId); /* windowId (4 bytes) */
|
||||
Stream_Read_UINT16(s, isMoveSizeStart); /* isMoveSizeStart (2 bytes) */
|
||||
localMoveSize->isMoveSizeStart = (isMoveSizeStart != 0) ? TRUE : FALSE;
|
||||
localMoveSize->isMoveSizeStart = (isMoveSizeStart != 0);
|
||||
Stream_Read_UINT16(s, localMoveSize->moveSizeType); /* moveSizeType (2 bytes) */
|
||||
Stream_Read_INT16(s, localMoveSize->posX); /* posX (2 bytes) */
|
||||
Stream_Read_INT16(s, localMoveSize->posY); /* posY (2 bytes) */
|
||||
@@ -792,7 +792,7 @@ static UINT rail_read_cloak_order(wStream* s, RAIL_CLOAK* cloak)
|
||||
|
||||
Stream_Read_UINT32(s, cloak->windowId); /* WindowId (4 bytes) */
|
||||
Stream_Read_UINT8(s, cloaked); /* Cloaked (1 byte) */
|
||||
cloak->cloak = (cloaked != 0) ? TRUE : FALSE;
|
||||
cloak->cloak = (cloaked != 0);
|
||||
return CHANNEL_RC_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -586,7 +586,7 @@ UINT rail_write_sysparam_order(wStream* s, const RAIL_SYSPARAM_ORDER* sysparam,
|
||||
|
||||
BOOL rail_is_extended_spi_supported(UINT32 channelFlags)
|
||||
{
|
||||
return (channelFlags & TS_RAIL_ORDER_HANDSHAKE_EX_FLAGS_EXTENDED_SPI_SUPPORTED) ? TRUE : FALSE;
|
||||
return (channelFlags & TS_RAIL_ORDER_HANDSHAKE_EX_FLAGS_EXTENDED_SPI_SUPPORTED) != 0;
|
||||
}
|
||||
|
||||
const char* rail_handshake_ex_flags_to_string(UINT32 flags, char* buffer, size_t len)
|
||||
|
||||
@@ -715,7 +715,7 @@ static UINT rail_read_activate_order(wStream* s, RAIL_ACTIVATE_ORDER* activate)
|
||||
|
||||
Stream_Read_UINT32(s, activate->windowId); /* WindowId (4 bytes) */
|
||||
Stream_Read_UINT8(s, enabled); /* Enabled (1 byte) */
|
||||
activate->enabled = (enabled != 0) ? TRUE : FALSE;
|
||||
activate->enabled = (enabled != 0);
|
||||
return CHANNEL_RC_OK;
|
||||
}
|
||||
|
||||
@@ -884,7 +884,7 @@ static UINT rail_read_cloak_order(wStream* s, RAIL_CLOAK* cloak)
|
||||
|
||||
Stream_Read_UINT32(s, cloak->windowId); /* WindowId (4 bytes) */
|
||||
Stream_Read_UINT8(s, cloaked); /* Cloaked (1 byte) */
|
||||
cloak->cloak = (cloaked != 0) ? TRUE : FALSE;
|
||||
cloak->cloak = (cloaked != 0);
|
||||
return CHANNEL_RC_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -586,7 +586,7 @@ static UINT rdpdr_server_read_general_capability_set(RdpdrServerContext* context
|
||||
}
|
||||
|
||||
context->priv->ExtendedPDU = ExtendedPdu;
|
||||
context->priv->UserLoggedOnPdu = (ExtendedPdu & RDPDR_USER_LOGGEDON_PDU) ? TRUE : FALSE;
|
||||
context->priv->UserLoggedOnPdu = (ExtendedPdu & RDPDR_USER_LOGGEDON_PDU) != 0;
|
||||
|
||||
if (ExtraFlags2 != 0)
|
||||
{
|
||||
|
||||
@@ -213,10 +213,7 @@ BOOL ndr_read_pickle(NdrContext* context, wStream* s)
|
||||
UINT32 v = 0;
|
||||
|
||||
/* NDR format label */
|
||||
if (!ndr_read_uint32(context, s, &v) || v != 0x20000)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
return !(!ndr_read_uint32(context, s, &v) || v != 0x20000);
|
||||
}
|
||||
|
||||
BOOL ndr_write_pickle(NdrContext* context, wStream* s)
|
||||
@@ -224,10 +221,7 @@ BOOL ndr_write_pickle(NdrContext* context, wStream* s)
|
||||
WINPR_ASSERT(context);
|
||||
|
||||
/* NDR format label */
|
||||
if (!ndr_write_uint32(context, s, 0x20000))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
return ndr_write_uint32(context, s, 0x20000);
|
||||
}
|
||||
|
||||
BOOL ndr_read_constructed(NdrContext* context, wStream* s, wStream* target)
|
||||
|
||||
@@ -262,10 +262,7 @@ BOOL set_h264_muxed_format(CamV4lStream* stream, const CAM_MEDIA_TYPE_DESCRIPTIO
|
||||
|
||||
/* commit the format */
|
||||
err = uvcx_video_commit(stream, &config_probe_req);
|
||||
if (err != 0)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
return (err == 0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -93,7 +93,7 @@ BOOL rdpei_read_2byte_signed(wStream* s, INT16* value)
|
||||
|
||||
Stream_Read_UINT8(s, byte);
|
||||
|
||||
negative = (byte & 0x40) ? TRUE : FALSE;
|
||||
negative = (byte & 0x40) != 0;
|
||||
|
||||
const BYTE val = (byte & 0x3F);
|
||||
|
||||
@@ -265,7 +265,7 @@ BOOL rdpei_read_4byte_signed(wStream* s, INT32* value)
|
||||
Stream_Read_UINT8(s, byte);
|
||||
|
||||
count = (byte & 0xC0) >> 6;
|
||||
negative = (byte & 0x20) ? TRUE : FALSE;
|
||||
negative = (byte & 0x20) != 0;
|
||||
|
||||
if (!Stream_CheckAndLogRequiredLength(TAG, s, count))
|
||||
return FALSE;
|
||||
|
||||
@@ -354,10 +354,7 @@ static BOOL rdpsnd_pulse_context_connect(rdpsndDevicePlugin* device)
|
||||
|
||||
pa_context_set_state_callback(pulse->context, rdpsnd_pulse_context_state_callback, pulse);
|
||||
|
||||
if (!rdpsnd_pulse_connect((rdpsndDevicePlugin*)pulse))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
return rdpsnd_pulse_connect(&pulse->device);
|
||||
}
|
||||
|
||||
static BOOL rdpsnd_pulse_open_stream(rdpsndDevicePlugin* device)
|
||||
|
||||
@@ -97,10 +97,7 @@ static BOOL udevman_has_next(IUDEVMAN* idevman)
|
||||
{
|
||||
UDEVMAN* udevman = (UDEVMAN*)idevman;
|
||||
|
||||
if (!udevman || !udevman->idev)
|
||||
return FALSE;
|
||||
else
|
||||
return TRUE;
|
||||
return !(!udevman || !udevman->idev);
|
||||
}
|
||||
|
||||
static IUDEVICE* udevman_get_next(IUDEVMAN* idevman)
|
||||
|
||||
Reference in New Issue
Block a user