[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:
Armin Novak
2026-02-27 20:04:43 +01:00
parent 41c9286c3c
commit 92ab55c5e1
65 changed files with 175 additions and 171 deletions

View File

@@ -975,7 +975,7 @@ static UINT encomsp_virtual_channel_event_data_received(encomspPlugin* encomsp,
encomsp->data_in = nullptr;
Stream_SealLength(data_in);
Stream_SetPosition(data_in, 0);
Stream_ResetPosition(data_in);
if (!MessageQueue_Post(encomsp->queue, nullptr, 0, (void*)data_in, nullptr))
{

View File

@@ -239,7 +239,7 @@ static DWORD WINAPI encomsp_server_thread(LPVOID arg)
if (header->Length >= Stream_GetPosition(s))
{
Stream_SealLength(s);
Stream_SetPosition(s, 0);
Stream_ResetPosition(s);
if ((error = encomsp_server_receive_pdu(context, s)))
{
@@ -248,7 +248,7 @@ static DWORD WINAPI encomsp_server_thread(LPVOID arg)
break;
}
Stream_SetPosition(s, 0);
Stream_ResetPosition(s);
}
}
}