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:
@@ -1319,6 +1319,20 @@ extern "C"
|
||||
return WINPR_STREAM_CAST(size_t, (_s->pointer - _s->buffer));
|
||||
}
|
||||
|
||||
/** @brief helper to reset stream read/write position to beginning of stream.
|
||||
*
|
||||
* Same as \ref Stream_SetPosition(s, 0) but does not need bounds checks.
|
||||
*
|
||||
* @param _s A stream to reset the position on. Must not be \b nullptr
|
||||
*
|
||||
* @since version 3.24.0
|
||||
*/
|
||||
static inline void Stream_ResetPosition(wStream* _s)
|
||||
{
|
||||
WINPR_ASSERT(_s);
|
||||
_s->pointer = _s->buffer;
|
||||
}
|
||||
|
||||
WINPR_API BOOL Stream_SetPosition(wStream* _s, size_t _p);
|
||||
|
||||
WINPR_API void Stream_SealLength(wStream* _s);
|
||||
|
||||
Reference in New Issue
Block a user