From 74c8400789133133fb35beb5d58a4fe13d1f630c Mon Sep 17 00:00:00 2001 From: Bernhard Miklautz Date: Mon, 30 Mar 2015 17:15:45 +0200 Subject: [PATCH] coding style fixes Add missing space after if --- channels/audin/client/audin_main.c | 2 +- channels/audin/server/audin.c | 4 +-- channels/cliprdr/client/cliprdr_main.c | 2 +- channels/cliprdr/server/cliprdr_main.c | 2 +- channels/drdynvc/client/drdynvc_main.c | 2 +- channels/drive/client/drive_file.c | 14 ++++---- channels/rdpdr/server/rdpdr_main.c | 20 ++++++------ channels/rdpei/server/rdpei_main.c | 2 +- channels/rdpsnd/client/pulse/rdpsnd_pulse.c | 2 +- channels/rdpsnd/server/rdpsnd_main.c | 2 +- channels/tsmf/client/tsmf_ifman.c | 18 +++++------ libfreerdp/codec/nsc_encode.c | 2 +- libfreerdp/codec/rfx.c | 12 +++---- libfreerdp/core/autodetect.c | 4 +-- libfreerdp/core/channels.c | 4 +-- libfreerdp/core/fastpath.c | 4 +-- libfreerdp/core/gateway/http.c | 4 +-- libfreerdp/core/gateway/rdg.c | 2 +- libfreerdp/core/gateway/rpc_client.c | 6 ++-- libfreerdp/core/orders.c | 36 ++++++++++----------- libfreerdp/core/peer.c | 4 +-- libfreerdp/core/rdp.c | 2 +- libfreerdp/core/transport.c | 6 ++-- libfreerdp/core/update.c | 4 +-- winpr/libwinpr/utils/test/TestStream.c | 4 +-- 25 files changed, 82 insertions(+), 82 deletions(-) diff --git a/channels/audin/client/audin_main.c b/channels/audin/client/audin_main.c index 69b3e7799..1ef7d1425 100644 --- a/channels/audin/client/audin_main.c +++ b/channels/audin/client/audin_main.c @@ -176,7 +176,7 @@ static int audin_process_formats(IWTSVirtualChannelCallback* pChannelCallback, w /* Store the agreed format in the corresponding index */ callback->formats[callback->formats_count++] = format; /* Put the format to output buffer */ - if(!Stream_EnsureRemainingCapacity(out, 18 + format.cbSize)) + if (!Stream_EnsureRemainingCapacity(out, 18 + format.cbSize)) { free(callback->formats); Stream_Free(out, TRUE); diff --git a/channels/audin/server/audin.c b/channels/audin/server/audin.c index 959187700..b5a11ad5e 100644 --- a/channels/audin/server/audin.c +++ b/channels/audin/server/audin.c @@ -118,7 +118,7 @@ static void audin_server_send_formats(audin_server* audin, wStream* s) audin->context.server_formats[i].nChannels * audin->context.server_formats[i].wBitsPerSample / 8; - if(!Stream_EnsureRemainingCapacity(s, 18)) + if (!Stream_EnsureRemainingCapacity(s, 18)) return; Stream_Write_UINT16(s, audin->context.server_formats[i].wFormatTag); @@ -131,7 +131,7 @@ static void audin_server_send_formats(audin_server* audin, wStream* s) if (audin->context.server_formats[i].cbSize) { - if(!Stream_EnsureRemainingCapacity(s, audin->context.server_formats[i].cbSize)) + if (!Stream_EnsureRemainingCapacity(s, audin->context.server_formats[i].cbSize)) return; Stream_Write(s, audin->context.server_formats[i].data, diff --git a/channels/cliprdr/client/cliprdr_main.c b/channels/cliprdr/client/cliprdr_main.c index 833d32634..6953adfe1 100644 --- a/channels/cliprdr/client/cliprdr_main.c +++ b/channels/cliprdr/client/cliprdr_main.c @@ -793,7 +793,7 @@ static void cliprdr_virtual_channel_event_data_received(cliprdrPlugin* cliprdr, } data_in = cliprdr->data_in; - if(!Stream_EnsureRemainingCapacity(data_in, (int) dataLength)) + if (!Stream_EnsureRemainingCapacity(data_in, (int) dataLength)) { Stream_Free(cliprdr->data_in, TRUE); cliprdr->data_in = NULL; diff --git a/channels/cliprdr/server/cliprdr_main.c b/channels/cliprdr/server/cliprdr_main.c index 183f6e47d..f0f4bebb5 100644 --- a/channels/cliprdr/server/cliprdr_main.c +++ b/channels/cliprdr/server/cliprdr_main.c @@ -925,7 +925,7 @@ int cliprdr_server_read(CliprdrServerContext* context) Stream_Read_UINT16(s, header.msgFlags); /* msgFlags (2 bytes) */ Stream_Read_UINT32(s, header.dataLen); /* dataLen (4 bytes) */ - if(!Stream_EnsureCapacity(s, (header.dataLen + CLIPRDR_HEADER_LENGTH))) + if (!Stream_EnsureCapacity(s, (header.dataLen + CLIPRDR_HEADER_LENGTH))) return -1; Stream_SetPosition(s, position); diff --git a/channels/drdynvc/client/drdynvc_main.c b/channels/drdynvc/client/drdynvc_main.c index 7d1c56369..3fe2192ac 100644 --- a/channels/drdynvc/client/drdynvc_main.c +++ b/channels/drdynvc/client/drdynvc_main.c @@ -970,7 +970,7 @@ static void drdynvc_virtual_channel_event_data_received(drdynvcPlugin* drdynvc, } data_in = drdynvc->data_in; - if(!Stream_EnsureRemainingCapacity(data_in, (int) dataLength)) + if (!Stream_EnsureRemainingCapacity(data_in, (int) dataLength)) { Stream_Free(drdynvc->data_in, TRUE); drdynvc->data_in = NULL; diff --git a/channels/drive/client/drive_file.c b/channels/drive/client/drive_file.c index c3b223afc..3750b37e6 100644 --- a/channels/drive/client/drive_file.c +++ b/channels/drive/client/drive_file.c @@ -419,7 +419,7 @@ BOOL drive_file_query_information(DRIVE_FILE* file, UINT32 FsInformationClass, w { case FileBasicInformation: /* http://msdn.microsoft.com/en-us/library/cc232094.aspx */ - if(!Stream_EnsureRemainingCapacity(output, 4 + 36)) + if (!Stream_EnsureRemainingCapacity(output, 4 + 36)) goto out_fail; Stream_Write_UINT32(output, 36); /* Length */ Stream_Write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_mtime)); /* CreationTime */ @@ -432,7 +432,7 @@ BOOL drive_file_query_information(DRIVE_FILE* file, UINT32 FsInformationClass, w case FileStandardInformation: /* http://msdn.microsoft.com/en-us/library/cc232088.aspx */ - if(!Stream_EnsureRemainingCapacity(output, 4 + 22)) + if (!Stream_EnsureRemainingCapacity(output, 4 + 22)) goto out_fail; Stream_Write_UINT32(output, 22); /* Length */ Stream_Write_UINT64(output, st.st_size); /* AllocationSize */ @@ -445,7 +445,7 @@ BOOL drive_file_query_information(DRIVE_FILE* file, UINT32 FsInformationClass, w case FileAttributeTagInformation: /* http://msdn.microsoft.com/en-us/library/cc232093.aspx */ - if(!Stream_EnsureRemainingCapacity(output, 4 + 8)) + if (!Stream_EnsureRemainingCapacity(output, 4 + 8)) goto out_fail; Stream_Write_UINT32(output, 8); /* Length */ Stream_Write_UINT32(output, FILE_ATTR_SYSTEM_TO_RDP(file, st)); /* FileAttributes */ @@ -688,7 +688,7 @@ BOOL drive_file_query_directory(DRIVE_FILE* file, UINT32 FsInformationClass, BYT { case FileDirectoryInformation: /* http://msdn.microsoft.com/en-us/library/cc232097.aspx */ - if(!Stream_EnsureRemainingCapacity(output, 4 + 64 + length)) + if (!Stream_EnsureRemainingCapacity(output, 4 + 64 + length)) goto out_fail; Stream_Write_UINT32(output, 64 + length); /* Length */ Stream_Write_UINT32(output, 0); /* NextEntryOffset */ @@ -706,7 +706,7 @@ BOOL drive_file_query_directory(DRIVE_FILE* file, UINT32 FsInformationClass, BYT case FileFullDirectoryInformation: /* http://msdn.microsoft.com/en-us/library/cc232068.aspx */ - if(!Stream_EnsureRemainingCapacity(output, 4 + 68 + length)) + if (!Stream_EnsureRemainingCapacity(output, 4 + 68 + length)) goto out_fail; Stream_Write_UINT32(output, 68 + length); /* Length */ Stream_Write_UINT32(output, 0); /* NextEntryOffset */ @@ -725,7 +725,7 @@ BOOL drive_file_query_directory(DRIVE_FILE* file, UINT32 FsInformationClass, BYT case FileBothDirectoryInformation: /* http://msdn.microsoft.com/en-us/library/cc232095.aspx */ - if(!Stream_EnsureRemainingCapacity(output, 4 + 93 + length)) + if (!Stream_EnsureRemainingCapacity(output, 4 + 93 + length)) goto out_fail; Stream_Write_UINT32(output, 93 + length); /* Length */ Stream_Write_UINT32(output, 0); /* NextEntryOffset */ @@ -747,7 +747,7 @@ BOOL drive_file_query_directory(DRIVE_FILE* file, UINT32 FsInformationClass, BYT case FileNamesInformation: /* http://msdn.microsoft.com/en-us/library/cc232077.aspx */ - if(!Stream_EnsureRemainingCapacity(output, 4 + 12 + length)) + if (!Stream_EnsureRemainingCapacity(output, 4 + 12 + length)) goto out_fail; Stream_Write_UINT32(output, 12 + length); /* Length */ Stream_Write_UINT32(output, 0); /* NextEntryOffset */ diff --git a/channels/rdpdr/server/rdpdr_main.c b/channels/rdpdr/server/rdpdr_main.c index e45471f30..6779df7b6 100644 --- a/channels/rdpdr/server/rdpdr_main.c +++ b/channels/rdpdr/server/rdpdr_main.c @@ -147,7 +147,7 @@ static int rdpdr_server_write_general_capability_set(RdpdrServerContext* context UINT32 SpecialTypeDeviceCap; RDPDR_CAPABILITY_HEADER header; header.CapabilityLength = RDPDR_CAPABILITY_HEADER_LENGTH + 36; - if(!Stream_EnsureRemainingCapacity(s, header.CapabilityLength)) + if (!Stream_EnsureRemainingCapacity(s, header.CapabilityLength)) return -1; header.CapabilityType = CAP_GENERAL_TYPE; @@ -204,7 +204,7 @@ static int rdpdr_server_write_printer_capability_set(RdpdrServerContext* context header.CapabilityType = CAP_PRINTER_TYPE; header.CapabilityLength = RDPDR_CAPABILITY_HEADER_LENGTH; header.Version = PRINT_CAPABILITY_VERSION_01; - if(!Stream_EnsureRemainingCapacity(s, header.CapabilityLength)) + if (!Stream_EnsureRemainingCapacity(s, header.CapabilityLength)) return -1; rdpdr_server_write_capability_set_header(s, &header); return 0; @@ -221,7 +221,7 @@ static int rdpdr_server_write_port_capability_set(RdpdrServerContext* context, w header.CapabilityType = CAP_PORT_TYPE; header.CapabilityLength = RDPDR_CAPABILITY_HEADER_LENGTH; header.Version = PORT_CAPABILITY_VERSION_01; - if(!Stream_EnsureRemainingCapacity(s, header.CapabilityLength)) + if (!Stream_EnsureRemainingCapacity(s, header.CapabilityLength)) return -1; rdpdr_server_write_capability_set_header(s, &header); return 0; @@ -238,7 +238,7 @@ static int rdpdr_server_write_drive_capability_set(RdpdrServerContext* context, header.CapabilityType = CAP_DRIVE_TYPE; header.CapabilityLength = RDPDR_CAPABILITY_HEADER_LENGTH; header.Version = DRIVE_CAPABILITY_VERSION_02; - if(!Stream_EnsureRemainingCapacity(s, header.CapabilityLength)) + if (!Stream_EnsureRemainingCapacity(s, header.CapabilityLength)) return -1; rdpdr_server_write_capability_set_header(s, &header); return 0; @@ -255,7 +255,7 @@ static int rdpdr_server_write_smartcard_capability_set(RdpdrServerContext* conte header.CapabilityType = CAP_SMARTCARD_TYPE; header.CapabilityLength = RDPDR_CAPABILITY_HEADER_LENGTH; header.Version = SMARTCARD_CAPABILITY_VERSION_01; - if(!Stream_EnsureRemainingCapacity(s, header.CapabilityLength)) + if (!Stream_EnsureRemainingCapacity(s, header.CapabilityLength)) return -1; rdpdr_server_write_capability_set_header(s, &header); return 0; @@ -279,15 +279,15 @@ static int rdpdr_server_send_core_capability_request(RdpdrServerContext* context Stream_Write_UINT16(s, header.PacketId); /* PacketId (2 bytes) */ Stream_Write_UINT16(s, numCapabilities); /* numCapabilities (2 bytes) */ Stream_Write_UINT16(s, 0); /* Padding (2 bytes) */ - if(rdpdr_server_write_general_capability_set(context, s) != 0) + if (rdpdr_server_write_general_capability_set(context, s) != 0) goto out_error; - if(rdpdr_server_write_printer_capability_set(context, s) != 0) + if (rdpdr_server_write_printer_capability_set(context, s) != 0) goto out_error; - if(rdpdr_server_write_port_capability_set(context, s) != 0) + if (rdpdr_server_write_port_capability_set(context, s) != 0) goto out_error; - if(rdpdr_server_write_drive_capability_set(context, s) != 0) + if (rdpdr_server_write_drive_capability_set(context, s) != 0) goto out_error; - if(rdpdr_server_write_smartcard_capability_set(context, s) != 0) + if (rdpdr_server_write_smartcard_capability_set(context, s) != 0) goto out_error; Stream_SealLength(s); status = WTSVirtualChannelWrite(context->priv->ChannelHandle, (PCHAR) Stream_Buffer(s), Stream_Length(s), &written); diff --git a/channels/rdpei/server/rdpei_main.c b/channels/rdpei/server/rdpei_main.c index ee3c56848..04098211d 100644 --- a/channels/rdpei/server/rdpei_main.c +++ b/channels/rdpei/server/rdpei_main.c @@ -459,7 +459,7 @@ int rdpei_server_resume(RdpeiServerContext *context) } Stream_SetPosition(priv->outputStream, 0); - if(!Stream_EnsureCapacity(priv->outputStream, RDPINPUT_HEADER_LENGTH)) + if (!Stream_EnsureCapacity(priv->outputStream, RDPINPUT_HEADER_LENGTH)) { fprintf(stderr, "%s: couldn't allocate memory for stream\n", __FUNCTION__); return -1; diff --git a/channels/rdpsnd/client/pulse/rdpsnd_pulse.c b/channels/rdpsnd/client/pulse/rdpsnd_pulse.c index 9fa8538cf..efb9660f1 100644 --- a/channels/rdpsnd/client/pulse/rdpsnd_pulse.c +++ b/channels/rdpsnd/client/pulse/rdpsnd_pulse.c @@ -515,7 +515,7 @@ static BYTE* rdpsnd_pulse_convert_audio(rdpsndDevicePlugin* device, BYTE* data, inSize -= 32; } - if(!Stream_EnsureRemainingCapacity(pulse->gsmBuffer, 160 * 2)) + if (!Stream_EnsureRemainingCapacity(pulse->gsmBuffer, 160 * 2)) return NULL; Stream_Write(pulse->gsmBuffer, (void*) gsmBlockBuffer, 160 * 2); } diff --git a/channels/rdpsnd/server/rdpsnd_main.c b/channels/rdpsnd/server/rdpsnd_main.c index 1248705bb..1a02e45dd 100644 --- a/channels/rdpsnd/server/rdpsnd_main.c +++ b/channels/rdpsnd/server/rdpsnd_main.c @@ -666,7 +666,7 @@ int rdpsnd_server_handle_messages(RdpsndServerContext *context) Stream_SetPosition(s, 0); if (priv->expectedBytes) { - if(!Stream_EnsureCapacity(s, priv->expectedBytes)) + if (!Stream_EnsureCapacity(s, priv->expectedBytes)) return -1; return 1; } diff --git a/channels/tsmf/client/tsmf_ifman.c b/channels/tsmf/client/tsmf_ifman.c index 81ee30b54..a5c65fe2f 100644 --- a/channels/tsmf/client/tsmf_ifman.c +++ b/channels/tsmf/client/tsmf_ifman.c @@ -45,7 +45,7 @@ int tsmf_ifman_rim_exchange_capability_request(TSMF_IFMAN* ifman) DEBUG_TSMF("server CapabilityValue %d", CapabilityValue); - if(!Stream_EnsureRemainingCapacity(ifman->output, 8)) + if (!Stream_EnsureRemainingCapacity(ifman->output, 8)) return -1; Stream_Write_UINT32(ifman->output, 1); /* CapabilityValue */ Stream_Write_UINT32(ifman->output, 0); /* Result */ @@ -62,7 +62,7 @@ int tsmf_ifman_exchange_capability_request(TSMF_IFMAN* ifman) UINT32 cbCapabilityLength; UINT32 numHostCapabilities; - if(!Stream_EnsureRemainingCapacity(ifman->output, ifman->input_size + 4)) + if (!Stream_EnsureRemainingCapacity(ifman->output, ifman->input_size + 4)) return -1; pos = Stream_GetPosition(ifman->output); Stream_Copy(ifman->output, ifman->input, ifman->input_size); @@ -118,7 +118,7 @@ int tsmf_ifman_check_format_support_request(TSMF_IFMAN* ifman) if (FormatSupported) DEBUG_TSMF("format ok."); - if(!Stream_EnsureRemainingCapacity(ifman->output, 12)) + if (!Stream_EnsureRemainingCapacity(ifman->output, 12)) return -1; Stream_Write_UINT32(ifman->output, FormatSupported); Stream_Write_UINT32(ifman->output, PlatformCookie); @@ -187,7 +187,7 @@ int tsmf_ifman_add_stream(TSMF_IFMAN* ifman) int tsmf_ifman_set_topology_request(TSMF_IFMAN* ifman) { DEBUG_TSMF(""); - if(!Stream_EnsureRemainingCapacity(ifman->output, 8)) + if (!Stream_EnsureRemainingCapacity(ifman->output, 8)) return -1; Stream_Write_UINT32(ifman->output, 1); /* TopologyReady */ Stream_Write_UINT32(ifman->output, 0); /* Result */ @@ -282,7 +282,7 @@ int tsmf_ifman_shutdown_presentation(TSMF_IFMAN* ifman) else WLog_ERR(TAG, "unknown presentation id"); - if(!Stream_EnsureRemainingCapacity(ifman->output, 4)) + if (!Stream_EnsureRemainingCapacity(ifman->output, 4)) return -1; Stream_Write_UINT32(ifman->output, 0); /* Result */ ifman->output_interface_id = TSMF_INTERFACE_DEFAULT | STREAM_ID_STUB; @@ -521,7 +521,7 @@ int tsmf_ifman_on_end_of_stream(TSMF_IFMAN* ifman) } DEBUG_TSMF("StreamId %d", StreamId); - if(!Stream_EnsureRemainingCapacity(ifman->output, 16)) + if (!Stream_EnsureRemainingCapacity(ifman->output, 16)) return -1; Stream_Write_UINT32(ifman->output, CLIENT_EVENT_NOTIFICATION); /* FunctionId */ Stream_Write_UINT32(ifman->output, StreamId); /* StreamId */ @@ -545,7 +545,7 @@ int tsmf_ifman_on_playback_started(TSMF_IFMAN* ifman) else WLog_ERR(TAG, "unknown presentation id"); - if(!Stream_EnsureRemainingCapacity(ifman->output, 16)) + if (!Stream_EnsureRemainingCapacity(ifman->output, 16)) return -1; Stream_Write_UINT32(ifman->output, CLIENT_EVENT_NOTIFICATION); /* FunctionId */ Stream_Write_UINT32(ifman->output, 0); /* StreamId */ @@ -605,7 +605,7 @@ int tsmf_ifman_on_playback_stopped(TSMF_IFMAN* ifman) else WLog_ERR(TAG, "unknown presentation id"); - if(!Stream_EnsureRemainingCapacity(ifman->output, 16)) + if (!Stream_EnsureRemainingCapacity(ifman->output, 16)) return -1; Stream_Write_UINT32(ifman->output, CLIENT_EVENT_NOTIFICATION); /* FunctionId */ Stream_Write_UINT32(ifman->output, 0); /* StreamId */ @@ -619,7 +619,7 @@ int tsmf_ifman_on_playback_stopped(TSMF_IFMAN* ifman) int tsmf_ifman_on_playback_rate_changed(TSMF_IFMAN* ifman) { DEBUG_TSMF(""); - if(!Stream_EnsureRemainingCapacity(ifman->output, 16)) + if (!Stream_EnsureRemainingCapacity(ifman->output, 16)) return -1; Stream_Write_UINT32(ifman->output, CLIENT_EVENT_NOTIFICATION); /* FunctionId */ Stream_Write_UINT32(ifman->output, 0); /* StreamId */ diff --git a/libfreerdp/codec/nsc_encode.c b/libfreerdp/codec/nsc_encode.c index fbf518305..c015025bb 100644 --- a/libfreerdp/codec/nsc_encode.c +++ b/libfreerdp/codec/nsc_encode.c @@ -493,7 +493,7 @@ int nsc_write_message(NSC_CONTEXT* context, wStream* s, NSC_MESSAGE* message) totalPlaneByteCount = message->LumaPlaneByteCount + message->OrangeChromaPlaneByteCount + message->GreenChromaPlaneByteCount + message->AlphaPlaneByteCount; - if(!Stream_EnsureRemainingCapacity(s, 20 + totalPlaneByteCount)) + if (!Stream_EnsureRemainingCapacity(s, 20 + totalPlaneByteCount)) return -1; Stream_Write_UINT32(s, message->LumaPlaneByteCount); /* LumaPlaneByteCount (4 bytes) */ Stream_Write_UINT32(s, message->OrangeChromaPlaneByteCount); /* OrangeChromaPlaneByteCount (4 bytes) */ diff --git a/libfreerdp/codec/rfx.c b/libfreerdp/codec/rfx.c index 9c76ecb1c..b91e2ec2e 100644 --- a/libfreerdp/codec/rfx.c +++ b/libfreerdp/codec/rfx.c @@ -1110,7 +1110,7 @@ static void rfx_write_message_context(RFX_CONTEXT* context, wStream* s) void rfx_compose_message_header(RFX_CONTEXT* context, wStream* s) { - if(!Stream_EnsureRemainingCapacity(s, 12 + 10 + 12 + 13)) + if (!Stream_EnsureRemainingCapacity(s, 12 + 10 + 12 + 13)) return; rfx_write_message_sync(context, s); @@ -1129,7 +1129,7 @@ static void rfx_write_tile(RFX_CONTEXT* context, wStream* s, RFX_TILE* tile) UINT32 blockLen; blockLen = rfx_tile_length(tile); - if(!Stream_EnsureRemainingCapacity(s, blockLen)) + if (!Stream_EnsureRemainingCapacity(s, blockLen)) return; Stream_Write_UINT16(s, CBT_TILE); /* BlockT.blockType (2 bytes) */ @@ -1516,7 +1516,7 @@ static void rfx_write_message_tileset(RFX_CONTEXT* context, wStream* s, RFX_MESS UINT32* quantVals; blockLen = 22 + (message->numQuant * 5) + message->tilesDataSize; - if(!Stream_EnsureRemainingCapacity(s, blockLen)) + if (!Stream_EnsureRemainingCapacity(s, blockLen)) return; Stream_Write_UINT16(s, WBT_EXTENSION); /* CodecChannelT.blockType (2 bytes) */ @@ -1551,7 +1551,7 @@ static void rfx_write_message_tileset(RFX_CONTEXT* context, wStream* s, RFX_MESS void rfx_write_message_frame_begin(RFX_CONTEXT* context, wStream* s, RFX_MESSAGE* message) { - if(!Stream_EnsureRemainingCapacity(s, 14)) + if (!Stream_EnsureRemainingCapacity(s, 14)) return; Stream_Write_UINT16(s, WBT_FRAME_BEGIN); /* CodecChannelT.blockType */ @@ -1568,7 +1568,7 @@ void rfx_write_message_region(RFX_CONTEXT* context, wStream* s, RFX_MESSAGE* mes UINT32 blockLen; blockLen = 15 + (message->numRects * 8); - if(!Stream_EnsureRemainingCapacity(s, blockLen)) + if (!Stream_EnsureRemainingCapacity(s, blockLen)) return; Stream_Write_UINT16(s, WBT_REGION); /* CodecChannelT.blockType (2 bytes) */ @@ -1594,7 +1594,7 @@ void rfx_write_message_region(RFX_CONTEXT* context, wStream* s, RFX_MESSAGE* mes void rfx_write_message_frame_end(RFX_CONTEXT* context, wStream* s, RFX_MESSAGE* message) { - if(!Stream_EnsureRemainingCapacity(s, 8)) + if (!Stream_EnsureRemainingCapacity(s, 8)) return; Stream_Write_UINT16(s, WBT_FRAME_END); /* CodecChannelT.blockType */ diff --git a/libfreerdp/core/autodetect.c b/libfreerdp/core/autodetect.c index 03241957e..24a9cf6b4 100644 --- a/libfreerdp/core/autodetect.c +++ b/libfreerdp/core/autodetect.c @@ -153,7 +153,7 @@ BOOL autodetect_send_bandwidth_measure_payload(rdpContext* context, UINT16 paylo /* 4-bytes aligned */ payloadLength &= ~3; - if(!Stream_EnsureRemainingCapacity(s, 8 + payloadLength)) + if (!Stream_EnsureRemainingCapacity(s, 8 + payloadLength)) { Stream_Release(s); return FALSE; @@ -196,7 +196,7 @@ static BOOL autodetect_send_bandwidth_measure_stop(rdpContext* context, UINT16 p Stream_Write_UINT16(s, payloadLength); /* payloadLength (2 bytes) */ if (payloadLength > 0) { - if(!Stream_EnsureRemainingCapacity(s, payloadLength)) + if (!Stream_EnsureRemainingCapacity(s, payloadLength)) { Stream_Release(s); return FALSE; diff --git a/libfreerdp/core/channels.c b/libfreerdp/core/channels.c index 9d9d90c69..07d5fe4d0 100644 --- a/libfreerdp/core/channels.c +++ b/libfreerdp/core/channels.c @@ -100,14 +100,14 @@ BOOL freerdp_channel_send(rdpRdp* rdp, UINT16 channelId, BYTE* data, int size) Stream_Write_UINT32(s, size); Stream_Write_UINT32(s, flags); - if(!Stream_EnsureCapacity(s, chunkSize)) + if (!Stream_EnsureCapacity(s, chunkSize)) { Stream_Release(s); return FALSE; } Stream_Write(s, data, chunkSize); - if(!rdp_send(rdp, s, channelId)) + if (!rdp_send(rdp, s, channelId)) { Stream_Release(s); return FALSE; diff --git a/libfreerdp/core/fastpath.c b/libfreerdp/core/fastpath.c index 3616045f5..128c2e0fb 100644 --- a/libfreerdp/core/fastpath.c +++ b/libfreerdp/core/fastpath.c @@ -460,7 +460,7 @@ static int fastpath_recv_update_data(rdpFastPath* fastpath, wStream* s) return -1; } - if(!Stream_EnsureCapacity(fastpath->updateData, totalSize)) + if (!Stream_EnsureCapacity(fastpath->updateData, totalSize)) { WLog_ERR(TAG, "Couldn't re-allocate memory for stream"); return -1; @@ -488,7 +488,7 @@ static int fastpath_recv_update_data(rdpFastPath* fastpath, wStream* s) return -1; } - if(!Stream_EnsureCapacity(fastpath->updateData, totalSize)) + if (!Stream_EnsureCapacity(fastpath->updateData, totalSize)) { WLog_ERR(TAG, "Couldn't re-allocate memory for stream"); return -1; diff --git a/libfreerdp/core/gateway/http.c b/libfreerdp/core/gateway/http.c index 3172729f1..4d25156da 100644 --- a/libfreerdp/core/gateway/http.c +++ b/libfreerdp/core/gateway/http.c @@ -676,7 +676,7 @@ HttpResponse* http_response_recv(rdpTls* tls) if (Stream_GetRemainingLength(s) < 1024) { - if(!Stream_EnsureRemainingCapacity(s, 1024)) + if (!Stream_EnsureRemainingCapacity(s, 1024)) goto out_error; buffer = (char*) Stream_Buffer(s); payload = &buffer[payloadOffset]; @@ -786,7 +786,7 @@ HttpResponse* http_response_recv(rdpTls* tls) if (Stream_GetRemainingLength(s) < 1024) { - if(!Stream_EnsureRemainingCapacity(s, 1024)) + if (!Stream_EnsureRemainingCapacity(s, 1024)) goto out_error; buffer = (char*) Stream_Buffer(s); payload = &buffer[payloadOffset]; diff --git a/libfreerdp/core/gateway/rdg.c b/libfreerdp/core/gateway/rdg.c index 29caf8fad..d977f11f9 100644 --- a/libfreerdp/core/gateway/rdg.c +++ b/libfreerdp/core/gateway/rdg.c @@ -104,7 +104,7 @@ wStream* rdg_receive_packet(rdpRdg* rdg) if (Stream_Capacity(s) < packet->packetLength) { - if(!Stream_EnsureCapacity(s, packet->packetLength)) + if (!Stream_EnsureCapacity(s, packet->packetLength)) { Stream_Free(s, TRUE); return NULL; diff --git a/libfreerdp/core/gateway/rpc_client.c b/libfreerdp/core/gateway/rpc_client.c index 53280dbe7..eaff47d7b 100644 --- a/libfreerdp/core/gateway/rpc_client.c +++ b/libfreerdp/core/gateway/rpc_client.c @@ -365,7 +365,7 @@ int rpc_client_recv_fragment(rdpRpc* rpc, wStream* fragment) if (call->OpNum != TsProxySetupReceivePipeOpnum) { - if(!Stream_EnsureCapacity(pdu->s, header->response.alloc_hint)) + if (!Stream_EnsureCapacity(pdu->s, header->response.alloc_hint)) return -1; Stream_Write(pdu->s, &buffer[StubOffset], StubLength); rpc->StubFragCount++; @@ -403,7 +403,7 @@ int rpc_client_recv_fragment(rdpRpc* rpc, wStream* fragment) pdu->Flags = 0; pdu->Type = header->common.ptype; pdu->CallId = header->common.call_id; - if(!Stream_EnsureCapacity(pdu->s, Stream_Length(fragment))) + if (!Stream_EnsureCapacity(pdu->s, Stream_Length(fragment))) return -1; Stream_Write(pdu->s, buffer, Stream_Length(fragment)); Stream_SealLength(pdu->s); @@ -425,7 +425,7 @@ int rpc_client_recv_fragment(rdpRpc* rpc, wStream* fragment) pdu->Flags = 0; pdu->Type = header->common.ptype; pdu->CallId = header->common.call_id; - if(Stream_EnsureCapacity(pdu->s, Stream_Length(fragment))) + if (Stream_EnsureCapacity(pdu->s, Stream_Length(fragment))) return -1; Stream_Write(pdu->s, buffer, Stream_Length(fragment)); Stream_SealLength(pdu->s); diff --git a/libfreerdp/core/orders.c b/libfreerdp/core/orders.c index f74d874cf..4716f35f5 100644 --- a/libfreerdp/core/orders.c +++ b/libfreerdp/core/orders.c @@ -844,7 +844,7 @@ int update_approximate_dstblt_order(ORDER_INFO* orderInfo, DSTBLT_ORDER* dstblt) BOOL update_write_dstblt_order(wStream* s, ORDER_INFO* orderInfo, DSTBLT_ORDER* dstblt) { - if(!Stream_EnsureRemainingCapacity(s, update_approximate_dstblt_order(orderInfo, dstblt))) + if (!Stream_EnsureRemainingCapacity(s, update_approximate_dstblt_order(orderInfo, dstblt))) return FALSE; orderInfo->fieldFlags = 0; @@ -887,7 +887,7 @@ int update_approximate_patblt_order(ORDER_INFO* orderInfo, PATBLT_ORDER* patblt) BOOL update_write_patblt_order(wStream* s, ORDER_INFO* orderInfo, PATBLT_ORDER* patblt) { - if(!Stream_EnsureRemainingCapacity(s, update_approximate_patblt_order(orderInfo, patblt))) + if (!Stream_EnsureRemainingCapacity(s, update_approximate_patblt_order(orderInfo, patblt))) return FALSE; orderInfo->fieldFlags = 0; @@ -944,7 +944,7 @@ int update_approximate_scrblt_order(ORDER_INFO* orderInfo, SCRBLT_ORDER* scrblt) BOOL update_write_scrblt_order(wStream* s, ORDER_INFO* orderInfo, SCRBLT_ORDER* scrblt) { - if(!Stream_EnsureRemainingCapacity(s, update_approximate_scrblt_order(orderInfo, scrblt))); + if (!Stream_EnsureRemainingCapacity(s, update_approximate_scrblt_order(orderInfo, scrblt))); return FALSE; orderInfo->fieldFlags = 0; @@ -1021,7 +1021,7 @@ BOOL update_write_opaque_rect_order(wStream* s, ORDER_INFO* orderInfo, OPAQUE_RE { BYTE byte; - if(!Stream_EnsureRemainingCapacity(s, update_approximate_opaque_rect_order(orderInfo, opaque_rect))) + if (!Stream_EnsureRemainingCapacity(s, update_approximate_opaque_rect_order(orderInfo, opaque_rect))) return FALSE; orderInfo->fieldFlags = 0; @@ -1281,7 +1281,7 @@ int update_approximate_line_to_order(ORDER_INFO* orderInfo, LINE_TO_ORDER* line_ BOOL update_write_line_to_order(wStream* s, ORDER_INFO* orderInfo, LINE_TO_ORDER* line_to) { - if(!Stream_EnsureRemainingCapacity(s, update_approximate_line_to_order(orderInfo, line_to))) + if (!Stream_EnsureRemainingCapacity(s, update_approximate_line_to_order(orderInfo, line_to))) return FALSE; orderInfo->fieldFlags = 0; @@ -1389,7 +1389,7 @@ BOOL update_write_memblt_order(wStream* s, ORDER_INFO* orderInfo, MEMBLT_ORDER* { UINT16 cacheId; - if(!Stream_EnsureRemainingCapacity(s, update_approximate_memblt_order(orderInfo, memblt))) + if (!Stream_EnsureRemainingCapacity(s, update_approximate_memblt_order(orderInfo, memblt))) return FALSE; cacheId = (memblt->cacheId & 0xFF) | ((memblt->colorIndex & 0xFF) << 8); @@ -1527,7 +1527,7 @@ int update_approximate_glyph_index_order(ORDER_INFO* orderInfo, GLYPH_INDEX_ORDE BOOL update_write_glyph_index_order(wStream* s, ORDER_INFO* orderInfo, GLYPH_INDEX_ORDER* glyph_index) { - if(!Stream_EnsureRemainingCapacity(s, update_approximate_glyph_index_order(orderInfo, glyph_index))) + if (!Stream_EnsureRemainingCapacity(s, update_approximate_glyph_index_order(orderInfo, glyph_index))) return FALSE; orderInfo->fieldFlags = 0; @@ -1923,7 +1923,7 @@ int update_approximate_cache_bitmap_order(CACHE_BITMAP_ORDER* cache_bitmap, BOOL BOOL update_write_cache_bitmap_order(wStream* s, CACHE_BITMAP_ORDER* cache_bitmap, BOOL compressed, UINT16* flags) { - if(!Stream_EnsureRemainingCapacity(s, update_approximate_cache_bitmap_order(cache_bitmap, compressed, flags))) + if (!Stream_EnsureRemainingCapacity(s, update_approximate_cache_bitmap_order(cache_bitmap, compressed, flags))) return FALSE; *flags = NO_BITMAP_COMPRESSION_HDR; @@ -2041,7 +2041,7 @@ BOOL update_write_cache_bitmap_v2_order(wStream* s, CACHE_BITMAP_V2_ORDER* cache { BYTE bitsPerPixelId; - if(!Stream_EnsureRemainingCapacity(s, update_approximate_cache_bitmap_v2_order(cache_bitmap_v2, compressed, flags))) + if (!Stream_EnsureRemainingCapacity(s, update_approximate_cache_bitmap_v2_order(cache_bitmap_v2, compressed, flags))) return FALSE; bitsPerPixelId = BPP_CBR2[cache_bitmap_v2->bitmapBpp]; @@ -2085,13 +2085,13 @@ BOOL update_write_cache_bitmap_v2_order(wStream* s, CACHE_BITMAP_V2_ORDER* cache cache_bitmap_v2->bitmapLength = cache_bitmap_v2->cbCompMainBodySize; } - if(!Stream_EnsureRemainingCapacity(s, cache_bitmap_v2->bitmapLength)) + if (!Stream_EnsureRemainingCapacity(s, cache_bitmap_v2->bitmapLength)) return FALSE; Stream_Write(s, cache_bitmap_v2->bitmapDataStream, cache_bitmap_v2->bitmapLength); } else { - if(!Stream_EnsureRemainingCapacity(s, cache_bitmap_v2->bitmapLength)) + if (!Stream_EnsureRemainingCapacity(s, cache_bitmap_v2->bitmapLength)) return FALSE; Stream_Write(s, cache_bitmap_v2->bitmapDataStream, cache_bitmap_v2->bitmapLength); } @@ -2160,7 +2160,7 @@ BOOL update_write_cache_bitmap_v3_order(wStream* s, CACHE_BITMAP_V3_ORDER* cache BYTE bitsPerPixelId; BITMAP_DATA_EX* bitmapData; - if(!Stream_EnsureRemainingCapacity(s, update_approximate_cache_bitmap_v3_order(cache_bitmap_v3, flags))) + if (!Stream_EnsureRemainingCapacity(s, update_approximate_cache_bitmap_v3_order(cache_bitmap_v3, flags))) return FALSE; bitmapData = &cache_bitmap_v3->bitmapData; @@ -2230,7 +2230,7 @@ BOOL update_write_cache_color_table_order(wStream* s, CACHE_COLOR_TABLE_ORDER* c if (cache_color_table->numberColors != 256) return FALSE; - if(!Stream_EnsureRemainingCapacity(s, update_approximate_cache_color_table_order(cache_color_table, flags))) + if (!Stream_EnsureRemainingCapacity(s, update_approximate_cache_color_table_order(cache_color_table, flags))) return FALSE; Stream_Write_UINT8(s, cache_color_table->cacheIndex); /* cacheIndex (1 byte) */ @@ -2302,7 +2302,7 @@ BOOL update_write_cache_glyph_order(wStream* s, CACHE_GLYPH_ORDER* cache_glyph, INT16 lsi16; GLYPH_DATA* glyph; - if(!Stream_EnsureRemainingCapacity(s, update_approximate_cache_glyph_order(cache_glyph, flags))) + if (!Stream_EnsureRemainingCapacity(s, update_approximate_cache_glyph_order(cache_glyph, flags))) return FALSE; Stream_Write_UINT8(s, cache_glyph->cacheId); /* cacheId (1 byte) */ @@ -2391,7 +2391,7 @@ BOOL update_write_cache_glyph_v2_order(wStream* s, CACHE_GLYPH_V2_ORDER* cache_g int i; GLYPH_DATA_V2* glyph; - if(!Stream_EnsureRemainingCapacity(s, update_approximate_cache_glyph_v2_order(cache_glyph_v2, flags))) + if (!Stream_EnsureRemainingCapacity(s, update_approximate_cache_glyph_v2_order(cache_glyph_v2, flags))) return FALSE; *flags = (cache_glyph_v2->cacheId & 0x000F) | @@ -2550,7 +2550,7 @@ BOOL update_write_cache_brush_order(wStream* s, CACHE_BRUSH_ORDER* cache_brush, BYTE iBitmapFormat; BOOL compressed = FALSE; - if(!Stream_EnsureRemainingCapacity(s, update_approximate_cache_brush_order(cache_brush, flags))) + if (!Stream_EnsureRemainingCapacity(s, update_approximate_cache_brush_order(cache_brush, flags))) return FALSE; iBitmapFormat = BPP_BMF[cache_brush->bpp]; @@ -2680,7 +2680,7 @@ BOOL update_write_create_offscreen_bitmap_order(wStream* s, CREATE_OFFSCREEN_BIT BOOL deleteListPresent; OFFSCREEN_DELETE_LIST* deleteList; - if(!Stream_EnsureRemainingCapacity(s, update_approximate_create_offscreen_bitmap_order(create_offscreen_bitmap))) + if (!Stream_EnsureRemainingCapacity(s, update_approximate_create_offscreen_bitmap_order(create_offscreen_bitmap))) return FALSE; deleteList = &(create_offscreen_bitmap->deleteList); @@ -2729,7 +2729,7 @@ int update_approximate_switch_surface_order(SWITCH_SURFACE_ORDER* switch_surface BOOL update_write_switch_surface_order(wStream* s, SWITCH_SURFACE_ORDER* switch_surface) { - if(!Stream_EnsureRemainingCapacity(s, update_approximate_switch_surface_order(switch_surface))) + if (!Stream_EnsureRemainingCapacity(s, update_approximate_switch_surface_order(switch_surface))) return FALSE; Stream_Write_UINT16(s, switch_surface->bitmapId); /* bitmapId (2 bytes) */ diff --git a/libfreerdp/core/peer.c b/libfreerdp/core/peer.c index 5f823d913..e93fe087a 100644 --- a/libfreerdp/core/peer.c +++ b/libfreerdp/core/peer.c @@ -163,14 +163,14 @@ static int freerdp_peer_virtual_channel_write(freerdp_peer* client, HANDLE hChan Stream_Write_UINT32(s, totalLength); Stream_Write_UINT32(s, flags); - if(!Stream_EnsureRemainingCapacity(s, chunkSize)) + if (!Stream_EnsureRemainingCapacity(s, chunkSize)) { Stream_Release(s); return -1; } Stream_Write(s, buffer, chunkSize); - if(!rdp_send(rdp, s, peerChannel->channelId)) + if (!rdp_send(rdp, s, peerChannel->channelId)) { Stream_Release(s); return -1; diff --git a/libfreerdp/core/rdp.c b/libfreerdp/core/rdp.c index cd27adf34..037065c5e 100644 --- a/libfreerdp/core/rdp.c +++ b/libfreerdp/core/rdp.c @@ -712,7 +712,7 @@ BOOL rdp_write_monitor_layout_pdu(wStream* s, UINT32 monitorCount, MONITOR_DEF* { UINT32 index; MONITOR_DEF* monitor; - if(!Stream_EnsureRemainingCapacity(s, 4 + (monitorCount * 20))) + if (!Stream_EnsureRemainingCapacity(s, 4 + (monitorCount * 20))) return FALSE; Stream_Write_UINT32(s, monitorCount); /* monitorCount (4 bytes) */ diff --git a/libfreerdp/core/transport.c b/libfreerdp/core/transport.c index a6fd41d94..0d3ae0d35 100644 --- a/libfreerdp/core/transport.c +++ b/libfreerdp/core/transport.c @@ -63,7 +63,7 @@ wStream* transport_send_stream_init(rdpTransport* transport, int size) wStream* s; if (!(s = StreamPool_Take(transport->ReceivePool, size))) return NULL; - if(!Stream_EnsureCapacity(s, size)) + if (!Stream_EnsureCapacity(s, size)) { Stream_Release(s); return NULL; @@ -450,7 +450,7 @@ int transport_read_pdu(rdpTransport* transport, wStream* s) position = Stream_GetPosition(s); /* Make sure there is enough space for the longest header within the stream */ - if(!Stream_EnsureCapacity(s, 4)) + if (!Stream_EnsureCapacity(s, 4)) return -1; /* Make sure at least two bytes are read for further processing */ @@ -557,7 +557,7 @@ int transport_read_pdu(rdpTransport* transport, wStream* s) } } - if(!Stream_EnsureCapacity(s, Stream_GetPosition(s) + pduLength)) + if (!Stream_EnsureCapacity(s, Stream_GetPosition(s) + pduLength)) return -1; status = transport_read_layer_bytes(transport, s, pduLength - Stream_GetPosition(s)); diff --git a/libfreerdp/core/update.c b/libfreerdp/core/update.c index 0dcd0d0fb..5f17ce146 100644 --- a/libfreerdp/core/update.c +++ b/libfreerdp/core/update.c @@ -114,7 +114,7 @@ BOOL update_read_bitmap_data(rdpUpdate* update, wStream* s, BITMAP_DATA* bitmapD BOOL update_write_bitmap_data(rdpUpdate* update, wStream* s, BITMAP_DATA* bitmapData) { - if(!Stream_EnsureRemainingCapacity(s, 64 + bitmapData->bitmapLength)) + if (!Stream_EnsureRemainingCapacity(s, 64 + bitmapData->bitmapLength)) return TRUE; bitmapData->flags = 0; @@ -203,7 +203,7 @@ BOOL update_write_bitmap_update(rdpUpdate* update, wStream* s, BITMAP_UPDATE* bi { int i; - if(!Stream_EnsureRemainingCapacity(s, 32)) + if (!Stream_EnsureRemainingCapacity(s, 32)) return TRUE; Stream_Write_UINT16(s, UPDATE_TYPE_BITMAP); /* updateType */ diff --git a/winpr/libwinpr/utils/test/TestStream.c b/winpr/libwinpr/utils/test/TestStream.c index 1b994c65c..d7d750934 100644 --- a/winpr/libwinpr/utils/test/TestStream.c +++ b/winpr/libwinpr/utils/test/TestStream.c @@ -149,12 +149,12 @@ static BOOL TestStream_Extent(UINT32 maxSize) { if (i % 2) { - if(!Stream_EnsureRemainingCapacity(s, i)) + if (!Stream_EnsureRemainingCapacity(s, i)) goto fail; } else { - if(!Stream_EnsureCapacity(s, i)) + if (!Stream_EnsureCapacity(s, i)) goto fail; }