mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-15 00:44:19 +09:00
[winpr,stream] use Stream_BufferAs instead of casting
This commit is contained in:
@@ -97,7 +97,7 @@ static DWORD WINAPI drdynvc_server_thread(LPVOID arg)
|
||||
}
|
||||
|
||||
if (!WTSVirtualChannelRead(context->priv->ChannelHandle, 0,
|
||||
(PCHAR) Stream_Buffer(s), Stream_Capacity(s), &BytesReturned))
|
||||
Stream_BufferAs(s, char), Stream_Capacity(s), &BytesReturned))
|
||||
{
|
||||
WLog_ERR(TAG, "WTSVirtualChannelRead failed!");
|
||||
break;
|
||||
|
||||
@@ -952,7 +952,7 @@ static UINT drive_register_drive_path(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints,
|
||||
}
|
||||
Stream_Write_UINT8(drive->device.data, '\0');
|
||||
|
||||
drive->device.name = (const char*)Stream_Buffer(drive->device.data);
|
||||
drive->device.name = Stream_BufferAs(drive->device.data, char);
|
||||
if (!drive->device.name)
|
||||
goto out_error;
|
||||
|
||||
|
||||
@@ -264,8 +264,7 @@ static DWORD WINAPI echo_server_thread_func(LPVOID arg)
|
||||
break;
|
||||
}
|
||||
|
||||
IFCALLRET(echo->context.Response, error, &echo->context, (BYTE*)Stream_Buffer(s),
|
||||
BytesReturned);
|
||||
IFCALLRET(echo->context.Response, error, &echo->context, Stream_Buffer(s), BytesReturned);
|
||||
|
||||
if (error)
|
||||
{
|
||||
|
||||
@@ -261,7 +261,7 @@ static DWORD WINAPI encomsp_server_thread(LPVOID arg)
|
||||
|
||||
if (Stream_GetPosition(s) >= ENCOMSP_ORDER_HEADER_SIZE)
|
||||
{
|
||||
header = (ENCOMSP_ORDER_HEADER*)Stream_Buffer(s);
|
||||
header = Stream_BufferAs(s, ENCOMSP_ORDER_HEADER);
|
||||
|
||||
if (header->Length >= Stream_GetPosition(s))
|
||||
{
|
||||
|
||||
@@ -626,7 +626,7 @@ UINT rdpei_server_send_sc_ready(RdpeiServerContext* context, UINT32 version, UIN
|
||||
if (pos > UINT32_MAX)
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
|
||||
if (!WTSVirtualChannelWrite(priv->channelHandle, (PCHAR)Stream_Buffer(priv->outputStream),
|
||||
if (!WTSVirtualChannelWrite(priv->channelHandle, Stream_BufferAs(priv->outputStream, char),
|
||||
(ULONG)pos, &written))
|
||||
{
|
||||
WLog_ERR(TAG, "WTSVirtualChannelWrite failed!");
|
||||
@@ -673,7 +673,7 @@ UINT rdpei_server_suspend(RdpeiServerContext* context)
|
||||
if (pos > UINT32_MAX)
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
|
||||
if (!WTSVirtualChannelWrite(priv->channelHandle, (PCHAR)Stream_Buffer(priv->outputStream),
|
||||
if (!WTSVirtualChannelWrite(priv->channelHandle, Stream_BufferAs(priv->outputStream, char),
|
||||
(ULONG)pos, &written))
|
||||
{
|
||||
WLog_ERR(TAG, "WTSVirtualChannelWrite failed!");
|
||||
@@ -720,7 +720,7 @@ UINT rdpei_server_resume(RdpeiServerContext* context)
|
||||
if (pos > UINT32_MAX)
|
||||
return CHANNEL_RC_NO_BUFFER;
|
||||
|
||||
if (!WTSVirtualChannelWrite(priv->channelHandle, (PCHAR)Stream_Buffer(priv->outputStream),
|
||||
if (!WTSVirtualChannelWrite(priv->channelHandle, Stream_BufferAs(priv->outputStream, char),
|
||||
(ULONG)pos, &written))
|
||||
{
|
||||
WLog_ERR(TAG, "WTSVirtualChannelWrite failed!");
|
||||
|
||||
@@ -138,7 +138,7 @@ static UINT rdpgfx_server_packet_send(RdpgfxServerContext* context, wStream* s)
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!WTSVirtualChannelWrite(context->priv->rdpgfx_channel, (PCHAR)Stream_Buffer(fs),
|
||||
if (!WTSVirtualChannelWrite(context->priv->rdpgfx_channel, Stream_BufferAs(fs, char),
|
||||
Stream_GetPosition(fs), &written))
|
||||
{
|
||||
WLog_Print(context->priv->log, WLOG_ERROR, "WTSVirtualChannelWrite failed!");
|
||||
|
||||
@@ -613,7 +613,7 @@ static DWORD WINAPI remdesk_server_thread(LPVOID arg)
|
||||
|
||||
if (Stream_GetPosition(s) >= 8)
|
||||
{
|
||||
pHeader = (UINT32*)Stream_Buffer(s);
|
||||
pHeader = Stream_BufferAs(s, UINT32);
|
||||
PduLength = pHeader[0] + pHeader[1] + 8;
|
||||
|
||||
if (PduLength >= Stream_GetPosition(s))
|
||||
|
||||
@@ -518,8 +518,8 @@ static BOOL freerdp_dsp_decode_mp3(FREERDP_DSP_CONTEXT* WINPR_RESTRICT context,
|
||||
if (!Stream_EnsureCapacity(context->common.buffer, 2 * buffer_size))
|
||||
return FALSE;
|
||||
|
||||
pcm_l = (short*)Stream_Buffer(context->common.buffer);
|
||||
pcm_r = (short*)Stream_Buffer(context->common.buffer) + buffer_size;
|
||||
pcm_l = Stream_BufferAs(context->common.buffer, short);
|
||||
pcm_r = Stream_BufferAs(context->common.buffer, short) + buffer_size;
|
||||
rc = hip_decode(context->hip, (unsigned char*)/* API is not modifying content */ src, size,
|
||||
pcm_l, pcm_r);
|
||||
|
||||
@@ -593,7 +593,7 @@ static BOOL freerdp_dsp_encode_faac(FREERDP_DSP_CONTEXT* WINPR_RESTRICT context,
|
||||
{
|
||||
if (!Stream_EnsureRemainingCapacity(out, context->faacMaxOutputBytes))
|
||||
return FALSE;
|
||||
rc = faacEncEncode(context->faac, (int32_t*)Stream_Buffer(context->common.buffer),
|
||||
rc = faacEncEncode(context->faac, Stream_BufferAs(context->common.buffer, int32_t),
|
||||
context->faacInputSamples, Stream_Pointer(out),
|
||||
Stream_GetRemainingCapacity(out));
|
||||
if (rc < 0)
|
||||
|
||||
@@ -2523,7 +2523,7 @@ int progressive_compress(PROGRESSIVE_CONTEXT* WINPR_RESTRICT progressive,
|
||||
|
||||
if (!Stream_EnsureCapacity(progressive->rects, numRects * sizeof(RFX_RECT)))
|
||||
return -5;
|
||||
rects = (RFX_RECT*)Stream_Buffer(progressive->rects);
|
||||
rects = Stream_BufferAs(progressive->rects, RFX_RECT);
|
||||
if (invalidRegion)
|
||||
{
|
||||
const RECTANGLE_16* region_rects = region16_rects(invalidRegion, NULL);
|
||||
|
||||
@@ -1427,8 +1427,8 @@ HttpResponse* http_response_recv(rdpTls* tls, BOOL readContentLength)
|
||||
if (payloadOffset)
|
||||
{
|
||||
size_t count = 0;
|
||||
char* buffer = (char*)Stream_Buffer(response->data);
|
||||
char* line = (char*)Stream_Buffer(response->data);
|
||||
char* buffer = Stream_BufferAs(response->data, char);
|
||||
char* line = Stream_BufferAs(response->data, char);
|
||||
char* context = NULL;
|
||||
|
||||
while ((line = string_strnstr(line, "\r\n", payloadOffset - (line - buffer) - 2UL)))
|
||||
|
||||
@@ -262,7 +262,7 @@ static UINT rdpdr_seal_send_free_request(pf_channel_server_context* context, wSt
|
||||
WINPR_ASSERT(len <= UINT32_MAX);
|
||||
|
||||
rdpdr_dump_send_packet(context->log, WLOG_TRACE, s, proxy_client_tx);
|
||||
status = WTSVirtualChannelWrite(context->handle, (char*)Stream_Buffer(s), (ULONG)len, NULL);
|
||||
status = WTSVirtualChannelWrite(context->handle, Stream_BufferAs(s, char), (ULONG)len, NULL);
|
||||
return (status) ? CHANNEL_RC_OK : ERROR_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
|
||||
@@ -758,7 +758,7 @@ static BOOL kerberos_rd_tgt_token(const sspi_gss_data* token, char** target, krb
|
||||
return FALSE;
|
||||
|
||||
s = WinPrAsn1DecGetStream(&dec2);
|
||||
ticket->data = (char*)Stream_Buffer(&s);
|
||||
ticket->data = Stream_BufferAs(&s, char);
|
||||
ticket->length = Stream_Length(&s);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user