mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-15 00:44:19 +09:00
[winpr,stream] Add Stream_ResetPosition
A helper function that does not require return checks, in contrast to Stream_SetPosition, which might fail.
This commit is contained in:
@@ -171,7 +171,7 @@ static inline UINT16 out_copy_count_2(UINT16 in_count, wStream* WINPR_RESTRICT i
|
||||
Stream_Write(in_s, Stream_Buffer(in_data), 2ULL * in_count);
|
||||
}
|
||||
|
||||
Stream_SetPosition(in_data, 0);
|
||||
Stream_ResetPosition(in_data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -202,7 +202,7 @@ static inline UINT16 out_copy_count_3(UINT16 in_count, wStream* WINPR_RESTRICT i
|
||||
Stream_Write(in_s, Stream_Pointer(in_data), 3ULL * in_count);
|
||||
}
|
||||
|
||||
Stream_SetPosition(in_data, 0);
|
||||
Stream_ResetPosition(in_data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -696,7 +696,7 @@ static inline SSIZE_T freerdp_bitmap_compress_24(const void* WINPR_RESTRICT srcD
|
||||
lines_sent++;
|
||||
}
|
||||
|
||||
Stream_SetPosition(temp_s, 0);
|
||||
Stream_ResetPosition(temp_s);
|
||||
|
||||
if (counts.fill_count > 3 && counts.fill_count >= counts.color_count &&
|
||||
counts.fill_count >= counts.bicolor_count && counts.fill_count >= counts.mix_count &&
|
||||
@@ -1017,7 +1017,7 @@ static inline SSIZE_T freerdp_bitmap_compress_16(const void* WINPR_RESTRICT srcD
|
||||
lines_sent++;
|
||||
}
|
||||
|
||||
Stream_SetPosition(temp_s, 0);
|
||||
Stream_ResetPosition(temp_s);
|
||||
|
||||
if (counts.fill_count > 3 && counts.fill_count >= counts.color_count &&
|
||||
counts.fill_count >= counts.bicolor_count && counts.fill_count >= counts.mix_count &&
|
||||
@@ -1096,7 +1096,7 @@ SSIZE_T freerdp_bitmap_compress(const void* WINPR_RESTRICT srcData, UINT32 width
|
||||
wStream* WINPR_RESTRICT s, UINT32 bpp, UINT32 byte_limit,
|
||||
UINT32 start_line, wStream* WINPR_RESTRICT temp_s, UINT32 e)
|
||||
{
|
||||
Stream_SetPosition(temp_s, 0);
|
||||
Stream_ResetPosition(temp_s);
|
||||
|
||||
switch (bpp)
|
||||
{
|
||||
|
||||
@@ -166,7 +166,7 @@ static BOOL freerdp_dsp_channel_mix(FREERDP_DSP_CONTEXT* WINPR_RESTRICT context,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Stream_SetPosition(context->common.channelmix, 0);
|
||||
Stream_ResetPosition(context->common.channelmix);
|
||||
|
||||
/* Destination has more channels than source */
|
||||
if (context->common.format.nChannels > srcFormat->nChannels)
|
||||
@@ -600,7 +600,7 @@ static BOOL freerdp_dsp_encode_faac(FREERDP_DSP_CONTEXT* WINPR_RESTRICT context,
|
||||
return FALSE;
|
||||
if (rc > 0)
|
||||
Stream_Seek(out, (size_t)rc);
|
||||
Stream_SetPosition(context->common.buffer, 0);
|
||||
Stream_ResetPosition(context->common.buffer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -870,7 +870,7 @@ static BOOL freerdp_dsp_encode_ima_adpcm(FREERDP_DSP_CONTEXT* WINPR_RESTRICT con
|
||||
{
|
||||
BYTE* bsrc = Stream_Buffer(context->common.buffer);
|
||||
Stream_Write(out, bsrc, context->adpcm.ima.packet_size);
|
||||
Stream_SetPosition(context->common.buffer, 0);
|
||||
Stream_ResetPosition(context->common.buffer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1499,7 +1499,7 @@ BOOL freerdp_dsp_context_reset(FREERDP_DSP_CONTEXT* WINPR_RESTRICT context,
|
||||
|
||||
context->adpcm.ima.packet_size = nb_block_per_packet * context->common.format.nBlockAlign;
|
||||
Stream_EnsureCapacity(context->common.buffer, context->adpcm.ima.packet_size);
|
||||
Stream_SetPosition(context->common.buffer, 0);
|
||||
Stream_ResetPosition(context->common.buffer);
|
||||
}
|
||||
|
||||
#if defined(WITH_OPUS)
|
||||
|
||||
@@ -738,7 +738,7 @@ static BOOL freerdp_dsp_channel_mix(FREERDP_DSP_CONTEXT* WINPR_RESTRICT context,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Stream_SetPosition(context->common.channelmix, 0);
|
||||
Stream_ResetPosition(context->common.channelmix);
|
||||
|
||||
/* Destination has more channels than source */
|
||||
if (context->common.format.nChannels > srcFormat->nChannels)
|
||||
|
||||
@@ -698,7 +698,7 @@ BOOL interleaved_compress(BITMAP_INTERLEAVED_CONTEXT* WINPR_RESTRICT interleaved
|
||||
if (!s)
|
||||
return FALSE;
|
||||
|
||||
Stream_SetPosition(interleaved->bts, 0);
|
||||
Stream_ResetPosition(interleaved->bts);
|
||||
|
||||
status = (freerdp_bitmap_compress(interleaved->TempBuffer, nWidth, nHeight, s, bpp, maxSize,
|
||||
nHeight - 1, interleaved->bts, 0) >= 0);
|
||||
|
||||
@@ -2554,7 +2554,7 @@ int progressive_compress(PROGRESSIVE_CONTEXT* WINPR_RESTRICT progressive,
|
||||
}
|
||||
}
|
||||
s = progressive->buffer;
|
||||
Stream_SetPosition(s, 0);
|
||||
Stream_ResetPosition(s);
|
||||
|
||||
progressive->rfx_context->mode = RLGR1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user