FreeRDP
include/winpr/stream.h File Reference
#include <winpr/winpr.h>
#include <winpr/wtypes.h>
#include <winpr/endian.h>
#include <winpr/synch.h>
#include <winpr/assert.h>

Data Structures

struct  wStream
 

Macros

#define WINPR_STREAM_CAST(t, val)   (t)(val)
 
#define Stream_CheckAndLogRequiredCapacityOfSize(tag, s, nmemb, size)
 
#define Stream_CheckAndLogRequiredCapacity(tag, s, len)    Stream_CheckAndLogRequiredCapacityOfSize((tag), (s), (len), 1)
 
#define Stream_CheckAndLogRequiredCapacityOfSizeWLog(log, s, nmemb, size)
 
#define Stream_CheckAndLogRequiredCapacityWLog(log, s, len)    Stream_CheckAndLogRequiredCapacityOfSizeWLog((log), (s), (len), 1)
 
#define Stream_CheckAndLogRequiredLengthOfSize(tag, s, nmemb, size)
 
#define Stream_CheckAndLogRequiredLength(tag, s, len)    Stream_CheckAndLogRequiredLengthOfSize(tag, s, len, 1)
 
#define Stream_CheckAndLogRequiredLengthOfSizeWLog(log, s, nmemb, size)
 
#define Stream_CheckAndLogRequiredLengthWLog(log, s, len)    Stream_CheckAndLogRequiredLengthOfSizeWLog(log, s, len, 1)
 
#define Stream_Read_UINT8(_s, _v)
 
#define Stream_Read_INT8(_s, _v)
 
#define Stream_Read_UINT16(_s, _v)
 
#define Stream_Read_INT16(_s, _v)
 
#define Stream_Read_UINT16_BE(_s, _v)
 
#define Stream_Read_INT16_BE(_s, _v)
 
#define Stream_Read_UINT32(_s, _v)
 
#define Stream_Read_INT32(_s, _v)
 
#define Stream_Read_UINT32_BE(_s, _v)
 
#define Stream_Read_INT32_BE(_s, _v)
 
#define Stream_Read_UINT64(_s, _v)
 
#define Stream_Read_INT64(_s, _v)
 
#define Stream_Read_UINT64_BE(_s, _v)
 
#define Stream_Read_INT64_BE(_s, _v)
 
#define Stream_Peek_UINT8(_s, _v)
 
#define Stream_Peek_INT8(_s, _v)
 
#define Stream_Peek_UINT16(_s, _v)
 
#define Stream_Peek_INT16(_s, _v)
 
#define Stream_Peek_UINT16_BE(_s, _v)
 
#define Stream_Peek_INT16_BE(_s, _v)
 
#define Stream_Peek_UINT32(_s, _v)
 
#define Stream_Peek_INT32(_s, _v)
 
#define Stream_Peek_UINT32_BE(_s, _v)
 
#define Stream_Peek_INT32_BE(_s, _v)
 
#define Stream_Peek_UINT64(_s, _v)
 
#define Stream_Peek_INT64(_s, _v)
 
#define Stream_Peek_UINT64_BE(_s, _v)
 
#define Stream_Peek_INT64_BE(_s, _v)
 
#define Stream_GetBuffer(_s, _b)   _b = Stream_Buffer(_s)
 
#define Stream_PointerAs(s, type)   (type*)Stream_Pointer(s)
 
#define Stream_GetPointer(_s, _p)   _p = Stream_Pointer(_s)
 
#define Stream_GetLength(_s, _l)   _l = Stream_Length(_s)
 
#define Stream_GetCapacity(_s, _c)   _c = Stream_Capacity(_s);
 
#define Stream_SafeSeek(s, size)   Stream_SafeSeekEx(s, size, __FILE__, __LINE__, __func__)
 

Functions

static INLINE size_t Stream_Capacity (const wStream *_s)
 
WINPR_API size_t Stream_GetRemainingCapacity (const wStream *_s)
 
WINPR_API size_t Stream_GetRemainingLength (const wStream *_s)
 
WINPR_API BOOL Stream_EnsureCapacity (wStream *s, size_t size)
 
WINPR_API BOOL Stream_EnsureRemainingCapacity (wStream *s, size_t size)
 
WINPR_API BOOL Stream_CheckAndLogRequiredCapacityEx (const char *tag, DWORD level, wStream *s, size_t nmemb, size_t size, const char *fmt,...)
 
WINPR_API BOOL Stream_CheckAndLogRequiredCapacityExVa (const char *tag, DWORD level, wStream *s, size_t nmemb, size_t size, const char *fmt, va_list args)
 
WINPR_API BOOL Stream_CheckAndLogRequiredCapacityWLogEx (wLog *log, DWORD level, wStream *s, size_t nmemb, size_t size, const char *fmt,...)
 
WINPR_API BOOL Stream_CheckAndLogRequiredCapacityWLogExVa (wLog *log, DWORD level, wStream *s, size_t nmemb, size_t size, const char *fmt, va_list args)
 
WINPR_API void Stream_Free (wStream *s, BOOL bFreeBuffer)
 
WINPR_API wStreamStream_New (BYTE *buffer, size_t size)
 
WINPR_API wStreamStream_StaticConstInit (wStream *s, const BYTE *buffer, size_t size)
 
WINPR_API wStreamStream_StaticInit (wStream *s, BYTE *buffer, size_t size)
 
WINPR_API BOOL Stream_CheckAndLogRequiredLengthEx (const char *tag, DWORD level, wStream *s, size_t nmemb, size_t size, const char *fmt,...)
 
WINPR_API BOOL Stream_CheckAndLogRequiredLengthExVa (const char *tag, DWORD level, wStream *s, size_t nmemb, size_t size, const char *fmt, va_list args)
 
WINPR_API BOOL Stream_CheckAndLogRequiredLengthWLogEx (wLog *log, DWORD level, wStream *s, size_t nmemb, size_t size, const char *fmt,...)
 
WINPR_API BOOL Stream_CheckAndLogRequiredLengthWLogExVa (wLog *log, DWORD level, wStream *s, size_t nmemb, size_t size, const char *fmt, va_list args)
 
static INLINE void Stream_Seek (wStream *s, size_t _offset)
 
static INLINE void Stream_Rewind (wStream *s, size_t _offset)
 
static INLINE UINT8 stream_read_u8 (wStream *_s, BOOL seek)
 
static INLINE INT8 stream_read_i8 (wStream *_s, BOOL seek)
 
static INLINE UINT16 stream_read_u16_le (wStream *_s, BOOL seek)
 
static INLINE UINT16 stream_read_u16_be (wStream *_s, BOOL seek)
 
static INLINE INT16 stream_read_i16_le (wStream *_s, BOOL seek)
 
static INLINE INT16 stream_read_i16_be (wStream *_s, BOOL seek)
 
static INLINE UINT32 stream_read_u32_le (wStream *_s, BOOL seek)
 
static INLINE UINT32 stream_read_u32_be (wStream *_s, BOOL seek)
 
static INLINE INT32 stream_read_i32_le (wStream *_s, BOOL seek)
 
static INLINE INT32 stream_read_i32_be (wStream *_s, BOOL seek)
 
static INLINE UINT64 stream_read_u64_le (wStream *_s, BOOL seek)
 
static INLINE UINT64 stream_read_u64_be (wStream *_s, BOOL seek)
 
static INLINE INT64 stream_read_i64_le (wStream *_s, BOOL seek)
 
static INLINE INT64 stream_read_i64_be (wStream *_s, BOOL seek)
 
static INLINE UINT8 Stream_Get_UINT8 (wStream *_s)
 
static INLINE INT8 Stream_Get_INT8 (wStream *_s)
 
static INLINE UINT16 Stream_Get_UINT16 (wStream *_s)
 
static INLINE INT16 Stream_Get_INT16 (wStream *_s)
 
static INLINE UINT16 Stream_Get_UINT16_BE (wStream *_s)
 
static INLINE INT16 Stream_Get_INT16_BE (wStream *_s)
 
static INLINE UINT32 Stream_Get_UINT32 (wStream *_s)
 
static INLINE INT32 Stream_Get_INT32 (wStream *_s)
 
static INLINE UINT32 Stream_Get_UINT32_BE (wStream *_s)
 
static INLINE INT32 Stream_Get_INT32_BE (wStream *_s)
 
static INLINE UINT64 Stream_Get_UINT64 (wStream *_s)
 
static INLINE INT64 Stream_Get_INT64 (wStream *_s)
 
static INLINE UINT64 Stream_Get_UINT64_BE (wStream *_s)
 
static INLINE INT64 Stream_Get_INT64_BE (wStream *_s)
 
static INLINE UINT8 Stream_Peek_Get_UINT8 (wStream *_s)
 
static INLINE INT8 Stream_Peek_Get_INT8 (wStream *_s)
 
static INLINE UINT16 Stream_Peek_Get_UINT16 (wStream *_s)
 
static INLINE INT16 Stream_Peek_Get_INT16 (wStream *_s)
 
static INLINE UINT16 Stream_Peek_Get_UINT16_BE (wStream *_s)
 
static INLINE INT16 Stream_Peek_Get_INT16_BE (wStream *_s)
 
static INLINE UINT32 Stream_Peek_Get_UINT32 (wStream *_s)
 
static INLINE INT32 Stream_Peek_Get_INT32 (wStream *_s)
 
static INLINE UINT32 Stream_Peek_Get_UINT32_BE (wStream *_s)
 
static INLINE INT32 Stream_Peek_Get_INT32_BE (wStream *_s)
 
static INLINE UINT64 Stream_Peek_Get_UINT64 (wStream *_s)
 
static INLINE INT64 Stream_Peek_Get_INT64 (wStream *_s)
 
static INLINE UINT64 Stream_Peek_Get_UINT64_BE (wStream *_s)
 
static INLINE INT64 Stream_Peek_Get_INT64_BE (wStream *_s)
 
static INLINE void Stream_Read (wStream *_s, void *_b, size_t _n)
 
static INLINE void Stream_Peek (const wStream *_s, void *_b, size_t _n)
 
static INLINE void Stream_Write_UINT8 (wStream *_s, UINT8 _v)
 
static INLINE void Stream_Write_INT16 (wStream *_s, INT16 _v)
 
static INLINE void Stream_Write_UINT16 (wStream *_s, UINT16 _v)
 
static INLINE void Stream_Write_UINT16_BE (wStream *_s, UINT16 _v)
 
static INLINE void Stream_Write_UINT24_BE (wStream *_s, UINT32 _v)
 
static INLINE void Stream_Write_INT32 (wStream *_s, INT32 _v)
 
static INLINE void Stream_Write_UINT32 (wStream *_s, UINT32 _v)
 
static INLINE void Stream_Write_UINT32_BE (wStream *_s, UINT32 _v)
 
static INLINE void Stream_Write_UINT64 (wStream *_s, UINT64 _v)
 
static INLINE void Stream_Write (wStream *_s, const void *_b, size_t _n)
 
static INLINE void Stream_Seek_UINT8 (wStream *_s)
 
static INLINE void Stream_Seek_UINT16 (wStream *_s)
 
static INLINE void Stream_Seek_UINT32 (wStream *_s)
 
static INLINE void Stream_Seek_UINT64 (wStream *_s)
 
static INLINE void Stream_Rewind_UINT8 (wStream *_s)
 
static INLINE void Stream_Rewind_UINT16 (wStream *_s)
 
static INLINE void Stream_Rewind_UINT32 (wStream *_s)
 
static INLINE void Stream_Rewind_UINT64 (wStream *_s)
 
static INLINE void Stream_Zero (wStream *_s, size_t _n)
 
static INLINE void Stream_Fill (wStream *_s, int _v, size_t _n)
 
static INLINE void Stream_Copy (wStream *_src, wStream *_dst, size_t _n)
 
static INLINE BYTEStream_Buffer (wStream *_s)
 
static INLINE const BYTEStream_ConstBuffer (const wStream *_s)
 
static INLINE void * Stream_Pointer (wStream *_s)
 
static INLINE const void * Stream_ConstPointer (const wStream *_s)
 
static INLINE size_t Stream_Length (const wStream *_s)
 
WINPR_API BOOL Stream_SetLength (wStream *_s, size_t _l)
 
static INLINE size_t Stream_GetPosition (const wStream *_s)
 
WINPR_API BOOL Stream_SetPosition (wStream *_s, size_t _p)
 
WINPR_API void Stream_SealLength (wStream *_s)
 
static INLINE void Stream_Clear (wStream *_s)
 
WINPR_API BOOL Stream_SafeSeekEx (wStream *s, size_t size, const char *file, size_t line, const char *fkt)
 
WINPR_API BOOL Stream_Read_UTF16_String (wStream *s, WCHAR *dst, size_t charLength)
 
WINPR_API BOOL Stream_Write_UTF16_String (wStream *s, const WCHAR *src, size_t charLength)
 
WINPR_API char * Stream_Read_UTF16_String_As_UTF8 (wStream *s, size_t wcharLength, size_t *pUtfCharLength)
 Reads a WCHAR string from a stream and converts it to UTF-8 and returns a newly allocated string. More...
 
WINPR_API SSIZE_T Stream_Read_UTF16_String_As_UTF8_Buffer (wStream *s, size_t wcharLength, char *utfBuffer, size_t utfBufferCharLength)
 Reads a WCHAR string from a stream and converts it to UTF-8 and writes it to the supplied buffer. More...
 
WINPR_API SSIZE_T Stream_Write_UTF16_String_From_UTF8 (wStream *s, size_t wcharLength, const char *src, size_t length, BOOL fill)
 Writes a UTF-8 string UTF16 encoded to the stream. If the UTF-8 string is short, the remainig characters are filled up with '\0'. More...
 
WINPR_API void StreamPool_Return (wStreamPool *pool, wStream *s)
 
WINPR_API wStreamStreamPool_Take (wStreamPool *pool, size_t size)
 
WINPR_API void Stream_AddRef (wStream *s)
 
WINPR_API void Stream_Release (wStream *s)
 
WINPR_API wStreamStreamPool_Find (wStreamPool *pool, BYTE *ptr)
 
WINPR_API void StreamPool_Clear (wStreamPool *pool)
 
WINPR_API void StreamPool_Free (wStreamPool *pool)
 
WINPR_API wStreamPool * StreamPool_New (BOOL synchronized, size_t defaultSize)
 
WINPR_API char * StreamPool_GetStatistics (wStreamPool *pool, char *buffer, size_t size)
 

Macro Definition Documentation

◆ Stream_CheckAndLogRequiredCapacity

#define Stream_CheckAndLogRequiredCapacity (   tag,
  s,
  len 
)     Stream_CheckAndLogRequiredCapacityOfSize((tag), (s), (len), 1)

◆ Stream_CheckAndLogRequiredCapacityOfSize

#define Stream_CheckAndLogRequiredCapacityOfSize (   tag,
  s,
  nmemb,
  size 
)
Value:
Stream_CheckAndLogRequiredCapacityEx(tag, WLOG_WARN, s, nmemb, size, "%s(%s:%" PRIuz ")", \
__func__, __FILE__, (size_t)__LINE__)
size_t size
Definition: SDL2/sdl_pointer.cpp:38
#define WLOG_WARN
Definition: dsp_fdk_impl.c:35
WINPR_API BOOL Stream_CheckAndLogRequiredCapacityEx(const char *tag, DWORD level, wStream *s, size_t nmemb, size_t size, const char *fmt,...)
Definition: stream.c:314

◆ Stream_CheckAndLogRequiredCapacityOfSizeWLog

#define Stream_CheckAndLogRequiredCapacityOfSizeWLog (   log,
  s,
  nmemb,
  size 
)
Value:
Stream_CheckAndLogRequiredCapacityWLogEx(log, WLOG_WARN, s, nmemb, size, "%s(%s:%" PRIuz ")", \
__func__, __FILE__, (size_t)__LINE__)
audin log
Definition: audin_main.c:1024
WINPR_API BOOL Stream_CheckAndLogRequiredCapacityWLogEx(wLog *log, DWORD level, wStream *s, size_t nmemb, size_t size, const char *fmt,...)

◆ Stream_CheckAndLogRequiredCapacityWLog

#define Stream_CheckAndLogRequiredCapacityWLog (   log,
  s,
  len 
)     Stream_CheckAndLogRequiredCapacityOfSizeWLog((log), (s), (len), 1)

◆ Stream_CheckAndLogRequiredLength

#define Stream_CheckAndLogRequiredLength (   tag,
  s,
  len 
)     Stream_CheckAndLogRequiredLengthOfSize(tag, s, len, 1)

◆ Stream_CheckAndLogRequiredLengthOfSize

#define Stream_CheckAndLogRequiredLengthOfSize (   tag,
  s,
  nmemb,
  size 
)
Value:
Stream_CheckAndLogRequiredLengthEx(tag, WLOG_WARN, s, nmemb, size, "%s(%s:%" PRIuz ")", \
__func__, __FILE__, (size_t)__LINE__)
WINPR_API BOOL Stream_CheckAndLogRequiredLengthEx(const char *tag, DWORD level, wStream *s, size_t nmemb, size_t size, const char *fmt,...)

◆ Stream_CheckAndLogRequiredLengthOfSizeWLog

#define Stream_CheckAndLogRequiredLengthOfSizeWLog (   log,
  s,
  nmemb,
  size 
)
Value:
Stream_CheckAndLogRequiredLengthWLogEx(log, WLOG_WARN, s, nmemb, size, "%s(%s:%" PRIuz ")", \
__func__, __FILE__, (size_t)__LINE__)
WINPR_API BOOL Stream_CheckAndLogRequiredLengthWLogEx(wLog *log, DWORD level, wStream *s, size_t nmemb, size_t size, const char *fmt,...)
Definition: stream.c:423

◆ Stream_CheckAndLogRequiredLengthWLog

#define Stream_CheckAndLogRequiredLengthWLog (   log,
  s,
  len 
)     Stream_CheckAndLogRequiredLengthOfSizeWLog(log, s, len, 1)

◆ Stream_GetBuffer

#define Stream_GetBuffer (   _s,
  _b 
)    _b = Stream_Buffer(_s)

◆ Stream_GetCapacity

#define Stream_GetCapacity (   _s,
  _c 
)    _c = Stream_Capacity(_s);

◆ Stream_GetLength

#define Stream_GetLength (   _s,
  _l 
)    _l = Stream_Length(_s)

◆ Stream_GetPointer

#define Stream_GetPointer (   _s,
  _p 
)    _p = Stream_Pointer(_s)

◆ Stream_Peek_INT16

#define Stream_Peek_INT16 (   _s,
  _v 
)
Value:
do \
{ \
_v = stream_read_i16_le(_s, FALSE); \
} while (0)
static INLINE INT16 stream_read_i16_le(wStream *_s, BOOL seek)
Definition: include/winpr/stream.h:191

◆ Stream_Peek_INT16_BE

#define Stream_Peek_INT16_BE (   _s,
  _v 
)
Value:
do \
{ \
_v = stream_read_i16_be(_s, FALSE); \
} while (0)
static INLINE INT16 stream_read_i16_be(wStream *_s, BOOL seek)
Definition: include/winpr/stream.h:203

◆ Stream_Peek_INT32

#define Stream_Peek_INT32 (   _s,
  _v 
)
Value:
do \
{ \
_v = stream_read_i32_le(_s, FALSE); \
} while (0)
static INLINE INT32 stream_read_i32_le(wStream *_s, BOOL seek)
Definition: include/winpr/stream.h:243

◆ Stream_Peek_INT32_BE

#define Stream_Peek_INT32_BE (   _s,
  _v 
)
Value:
do \
{ \
_v = stream_read_i32_be(_s, FALSE); \
} while (0)
static INLINE INT32 stream_read_i32_be(wStream *_s, BOOL seek)
Definition: include/winpr/stream.h:258

◆ Stream_Peek_INT64

#define Stream_Peek_INT64 (   _s,
  _v 
)
Value:
do \
{ \
_v = stream_read_i64_le(_s, FALSE); \
} while (0)
static INLINE INT64 stream_read_i64_le(wStream *_s, BOOL seek)
Definition: include/winpr/stream.h:311

◆ Stream_Peek_INT64_BE

#define Stream_Peek_INT64_BE (   _s,
  _v 
)
Value:
do \
{ \
_v = stream_read_i64_be(_s, FALSE); \
} while (0)
static INLINE INT64 stream_read_i64_be(wStream *_s, BOOL seek)
Definition: include/winpr/stream.h:331

◆ Stream_Peek_INT8

#define Stream_Peek_INT8 (   _s,
  _v 
)
Value:
do \
{ \
_v = stream_read_i8(_s, FALSE); \
} while (0)
static INLINE INT8 stream_read_i8(wStream *_s, BOOL seek)
Definition: include/winpr/stream.h:156

◆ Stream_Peek_UINT16

#define Stream_Peek_UINT16 (   _s,
  _v 
)
Value:
do \
{ \
_v = stream_read_u16_le(_s, FALSE); \
} while (0)
static INLINE UINT16 stream_read_u16_le(wStream *_s, BOOL seek)
Definition: include/winpr/stream.h:167

◆ Stream_Peek_UINT16_BE

#define Stream_Peek_UINT16_BE (   _s,
  _v 
)
Value:
do \
{ \
_v = stream_read_u16_be(_s, FALSE); \
} while (0)
static INLINE UINT16 stream_read_u16_be(wStream *_s, BOOL seek)
Definition: include/winpr/stream.h:179

◆ Stream_Peek_UINT32

#define Stream_Peek_UINT32 (   _s,
  _v 
)
Value:
do \
{ \
_v = stream_read_u32_le(_s, FALSE); \
} while (0)
static INLINE UINT32 stream_read_u32_le(wStream *_s, BOOL seek)
Definition: include/winpr/stream.h:215

◆ Stream_Peek_UINT32_BE

#define Stream_Peek_UINT32_BE (   _s,
  _v 
)
Value:
do \
{ \
_v = stream_read_u32_be(_s, FALSE); \
} while (0)
static INLINE UINT32 stream_read_u32_be(wStream *_s, BOOL seek)
Definition: include/winpr/stream.h:229

◆ Stream_Peek_UINT64

#define Stream_Peek_UINT64 (   _s,
  _v 
)
Value:
do \
{ \
_v = stream_read_u64_le(_s, FALSE); \
} while (0)
static INLINE UINT64 stream_read_u64_le(wStream *_s, BOOL seek)
Definition: include/winpr/stream.h:273

◆ Stream_Peek_UINT64_BE

#define Stream_Peek_UINT64_BE (   _s,
  _v 
)
Value:
do \
{ \
_v = stream_read_u64_be(_s, FALSE); \
} while (0)
static INLINE UINT64 stream_read_u64_be(wStream *_s, BOOL seek)
Definition: include/winpr/stream.h:292

◆ Stream_Peek_UINT8

#define Stream_Peek_UINT8 (   _s,
  _v 
)
Value:
do \
{ \
_v = stream_read_u8(_s, FALSE); \
} while (0)
static INLINE UINT8 stream_read_u8(wStream *_s, BOOL seek)
Definition: include/winpr/stream.h:145

◆ Stream_PointerAs

#define Stream_PointerAs (   s,
  type 
)    (type*)Stream_Pointer(s)

◆ Stream_Read_INT16

#define Stream_Read_INT16 (   _s,
  _v 
)
Value:
do \
{ \
_v = stream_read_i16_le(_s, TRUE); \
} while (0)

◆ Stream_Read_INT16_BE

#define Stream_Read_INT16_BE (   _s,
  _v 
)
Value:
do \
{ \
_v = stream_read_i16_be(_s, TRUE); \
} while (0)

◆ Stream_Read_INT32

#define Stream_Read_INT32 (   _s,
  _v 
)
Value:
do \
{ \
_v = stream_read_i32_le(_s, TRUE); \
} while (0)

◆ Stream_Read_INT32_BE

#define Stream_Read_INT32_BE (   _s,
  _v 
)
Value:
do \
{ \
_v = stream_read_i32_be(_s, TRUE); \
} while (0)

◆ Stream_Read_INT64

#define Stream_Read_INT64 (   _s,
  _v 
)
Value:
do \
{ \
_v = stream_read_i64_le(_s, TRUE); \
} while (0)

◆ Stream_Read_INT64_BE

#define Stream_Read_INT64_BE (   _s,
  _v 
)
Value:
do \
{ \
_v = stream_read_i64_be(_s, TRUE); \
} while (0)

◆ Stream_Read_INT8

#define Stream_Read_INT8 (   _s,
  _v 
)
Value:
do \
{ \
_v = stream_read_i8(_s, TRUE); \
} while (0)

◆ Stream_Read_UINT16

#define Stream_Read_UINT16 (   _s,
  _v 
)
Value:
do \
{ \
_v = stream_read_u16_le(_s, TRUE); \
} while (0)

◆ Stream_Read_UINT16_BE

#define Stream_Read_UINT16_BE (   _s,
  _v 
)
Value:
do \
{ \
_v = stream_read_u16_be(_s, TRUE); \
} while (0)

◆ Stream_Read_UINT32

#define Stream_Read_UINT32 (   _s,
  _v 
)
Value:
do \
{ \
_v = stream_read_u32_le(_s, TRUE); \
} while (0)

◆ Stream_Read_UINT32_BE

#define Stream_Read_UINT32_BE (   _s,
  _v 
)
Value:
do \
{ \
_v = stream_read_u32_be(_s, TRUE); \
} while (0)

◆ Stream_Read_UINT64

#define Stream_Read_UINT64 (   _s,
  _v 
)
Value:
do \
{ \
_v = stream_read_u64_le(_s, TRUE); \
} while (0)

◆ Stream_Read_UINT64_BE

#define Stream_Read_UINT64_BE (   _s,
  _v 
)
Value:
do \
{ \
_v = stream_read_u64_be(_s, TRUE); \
} while (0)

◆ Stream_Read_UINT8

#define Stream_Read_UINT8 (   _s,
  _v 
)
Value:
do \
{ \
_v = stream_read_u8(_s, TRUE); \
} while (0)

◆ Stream_SafeSeek

#define Stream_SafeSeek (   s,
  size 
)    Stream_SafeSeekEx(s, size, __FILE__, __LINE__, __func__)

◆ WINPR_STREAM_CAST

#define WINPR_STREAM_CAST (   t,
  val 
)    (t)(val)

Function Documentation

◆ Stream_AddRef()

WINPR_API void Stream_AddRef ( wStream s)

Increment stream reference count

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Stream_Buffer()

static INLINE BYTE* Stream_Buffer ( wStream _s)
static

◆ Stream_Capacity()

static INLINE size_t Stream_Capacity ( const wStream _s)
static
Here is the caller graph for this function:

◆ Stream_CheckAndLogRequiredCapacityEx()

WINPR_API BOOL Stream_CheckAndLogRequiredCapacityEx ( const char *  tag,
DWORD  level,
wStream s,
size_t  nmemb,
size_t  size,
const char *  fmt,
  ... 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Stream_CheckAndLogRequiredCapacityExVa()

WINPR_API BOOL Stream_CheckAndLogRequiredCapacityExVa ( const char *  tag,
DWORD  level,
wStream s,
size_t  nmemb,
size_t  size,
const char *  fmt,
va_list  args 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Stream_CheckAndLogRequiredCapacityWLogEx()

WINPR_API BOOL Stream_CheckAndLogRequiredCapacityWLogEx ( wLog *  log,
DWORD  level,
wStream s,
size_t  nmemb,
size_t  size,
const char *  fmt,
  ... 
)

◆ Stream_CheckAndLogRequiredCapacityWLogExVa()

WINPR_API BOOL Stream_CheckAndLogRequiredCapacityWLogExVa ( wLog *  log,
DWORD  level,
wStream s,
size_t  nmemb,
size_t  size,
const char *  fmt,
va_list  args 
)

◆ Stream_CheckAndLogRequiredLengthEx()

WINPR_API BOOL Stream_CheckAndLogRequiredLengthEx ( const char *  tag,
DWORD  level,
wStream s,
size_t  nmemb,
size_t  size,
const char *  fmt,
  ... 
)
Here is the caller graph for this function:

◆ Stream_CheckAndLogRequiredLengthExVa()

WINPR_API BOOL Stream_CheckAndLogRequiredLengthExVa ( const char *  tag,
DWORD  level,
wStream s,
size_t  nmemb,
size_t  size,
const char *  fmt,
va_list  args 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Stream_CheckAndLogRequiredLengthWLogEx()

WINPR_API BOOL Stream_CheckAndLogRequiredLengthWLogEx ( wLog *  log,
DWORD  level,
wStream s,
size_t  nmemb,
size_t  size,
const char *  fmt,
  ... 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Stream_CheckAndLogRequiredLengthWLogExVa()

WINPR_API BOOL Stream_CheckAndLogRequiredLengthWLogExVa ( wLog *  log,
DWORD  level,
wStream s,
size_t  nmemb,
size_t  size,
const char *  fmt,
va_list  args 
)

◆ Stream_Clear()

static INLINE void Stream_Clear ( wStream _s)
static
Here is the caller graph for this function:

◆ Stream_ConstBuffer()

static INLINE const BYTE* Stream_ConstBuffer ( const wStream _s)
static
Here is the caller graph for this function:

◆ Stream_ConstPointer()

static INLINE const void* Stream_ConstPointer ( const wStream _s)
static

◆ Stream_Copy()

static INLINE void Stream_Copy ( wStream _src,
wStream _dst,
size_t  _n 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Stream_EnsureCapacity()

WINPR_API BOOL Stream_EnsureCapacity ( wStream s,
size_t  size 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Stream_EnsureRemainingCapacity()

WINPR_API BOOL Stream_EnsureRemainingCapacity ( wStream s,
size_t  size 
)
Here is the call graph for this function:

◆ Stream_Fill()

static INLINE void Stream_Fill ( wStream _s,
int  _v,
size_t  _n 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Stream_Free()

WINPR_API void Stream_Free ( wStream s,
BOOL  bFreeBuffer 
)
Here is the call graph for this function:

◆ Stream_Get_INT16()

static INLINE INT16 Stream_Get_INT16 ( wStream _s)
static
Here is the call graph for this function:

◆ Stream_Get_INT16_BE()

static INLINE INT16 Stream_Get_INT16_BE ( wStream _s)
static
Here is the call graph for this function:

◆ Stream_Get_INT32()

static INLINE INT32 Stream_Get_INT32 ( wStream _s)
static
Here is the call graph for this function:

◆ Stream_Get_INT32_BE()

static INLINE INT32 Stream_Get_INT32_BE ( wStream _s)
static
Here is the call graph for this function:

◆ Stream_Get_INT64()

static INLINE INT64 Stream_Get_INT64 ( wStream _s)
static
Here is the call graph for this function:

◆ Stream_Get_INT64_BE()

static INLINE INT64 Stream_Get_INT64_BE ( wStream _s)
static
Here is the call graph for this function:

◆ Stream_Get_INT8()

static INLINE INT8 Stream_Get_INT8 ( wStream _s)
static
Here is the call graph for this function:

◆ Stream_Get_UINT16()

static INLINE UINT16 Stream_Get_UINT16 ( wStream _s)
static
Here is the call graph for this function:

◆ Stream_Get_UINT16_BE()

static INLINE UINT16 Stream_Get_UINT16_BE ( wStream _s)
static
Here is the call graph for this function:

◆ Stream_Get_UINT32()

static INLINE UINT32 Stream_Get_UINT32 ( wStream _s)
static
Here is the call graph for this function:

◆ Stream_Get_UINT32_BE()

static INLINE UINT32 Stream_Get_UINT32_BE ( wStream _s)
static
Here is the call graph for this function:

◆ Stream_Get_UINT64()

static INLINE UINT64 Stream_Get_UINT64 ( wStream _s)
static
Here is the call graph for this function:

◆ Stream_Get_UINT64_BE()

static INLINE UINT64 Stream_Get_UINT64_BE ( wStream _s)
static
Here is the call graph for this function:

◆ Stream_Get_UINT8()

static INLINE UINT8 Stream_Get_UINT8 ( wStream _s)
static
Here is the call graph for this function:

◆ Stream_GetPosition()

static INLINE size_t Stream_GetPosition ( const wStream _s)
static

◆ Stream_GetRemainingCapacity()

WINPR_API size_t Stream_GetRemainingCapacity ( const wStream _s)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Stream_GetRemainingLength()

WINPR_API size_t Stream_GetRemainingLength ( const wStream _s)
Here is the call graph for this function:

◆ Stream_Length()

static INLINE size_t Stream_Length ( const wStream _s)
static

◆ Stream_New()

WINPR_API wStream* Stream_New ( BYTE buffer,
size_t  size 
)

◆ Stream_Peek()

static INLINE void Stream_Peek ( const wStream _s,
void *  _b,
size_t  _n 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Stream_Peek_Get_INT16()

static INLINE INT16 Stream_Peek_Get_INT16 ( wStream _s)
static
Here is the call graph for this function:

◆ Stream_Peek_Get_INT16_BE()

static INLINE INT16 Stream_Peek_Get_INT16_BE ( wStream _s)
static
Here is the call graph for this function:

◆ Stream_Peek_Get_INT32()

static INLINE INT32 Stream_Peek_Get_INT32 ( wStream _s)
static
Here is the call graph for this function:

◆ Stream_Peek_Get_INT32_BE()

static INLINE INT32 Stream_Peek_Get_INT32_BE ( wStream _s)
static
Here is the call graph for this function:

◆ Stream_Peek_Get_INT64()

static INLINE INT64 Stream_Peek_Get_INT64 ( wStream _s)
static
Here is the call graph for this function:

◆ Stream_Peek_Get_INT64_BE()

static INLINE INT64 Stream_Peek_Get_INT64_BE ( wStream _s)
static
Here is the call graph for this function:

◆ Stream_Peek_Get_INT8()

static INLINE INT8 Stream_Peek_Get_INT8 ( wStream _s)
static
Here is the call graph for this function:

◆ Stream_Peek_Get_UINT16()

static INLINE UINT16 Stream_Peek_Get_UINT16 ( wStream _s)
static
Here is the call graph for this function:

◆ Stream_Peek_Get_UINT16_BE()

static INLINE UINT16 Stream_Peek_Get_UINT16_BE ( wStream _s)
static
Here is the call graph for this function:

◆ Stream_Peek_Get_UINT32()

static INLINE UINT32 Stream_Peek_Get_UINT32 ( wStream _s)
static
Here is the call graph for this function:

◆ Stream_Peek_Get_UINT32_BE()

static INLINE UINT32 Stream_Peek_Get_UINT32_BE ( wStream _s)
static
Here is the call graph for this function:

◆ Stream_Peek_Get_UINT64()

static INLINE UINT64 Stream_Peek_Get_UINT64 ( wStream _s)
static
Here is the call graph for this function:

◆ Stream_Peek_Get_UINT64_BE()

static INLINE UINT64 Stream_Peek_Get_UINT64_BE ( wStream _s)
static
Here is the call graph for this function:

◆ Stream_Peek_Get_UINT8()

static INLINE UINT8 Stream_Peek_Get_UINT8 ( wStream _s)
static
Here is the call graph for this function:

◆ Stream_Pointer()

static INLINE void* Stream_Pointer ( wStream _s)
static

◆ Stream_Read()

static INLINE void Stream_Read ( wStream _s,
void *  _b,
size_t  _n 
)
static
Here is the call graph for this function:

◆ stream_read_i16_be()

static INLINE INT16 stream_read_i16_be ( wStream _s,
BOOL  seek 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ stream_read_i16_le()

static INLINE INT16 stream_read_i16_le ( wStream _s,
BOOL  seek 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ stream_read_i32_be()

static INLINE INT32 stream_read_i32_be ( wStream _s,
BOOL  seek 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ stream_read_i32_le()

static INLINE INT32 stream_read_i32_le ( wStream _s,
BOOL  seek 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ stream_read_i64_be()

static INLINE INT64 stream_read_i64_be ( wStream _s,
BOOL  seek 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ stream_read_i64_le()

static INLINE INT64 stream_read_i64_le ( wStream _s,
BOOL  seek 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ stream_read_i8()

static INLINE INT8 stream_read_i8 ( wStream _s,
BOOL  seek 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ stream_read_u16_be()

static INLINE UINT16 stream_read_u16_be ( wStream _s,
BOOL  seek 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ stream_read_u16_le()

static INLINE UINT16 stream_read_u16_le ( wStream _s,
BOOL  seek 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ stream_read_u32_be()

static INLINE UINT32 stream_read_u32_be ( wStream _s,
BOOL  seek 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ stream_read_u32_le()

static INLINE UINT32 stream_read_u32_le ( wStream _s,
BOOL  seek 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ stream_read_u64_be()

static INLINE UINT64 stream_read_u64_be ( wStream _s,
BOOL  seek 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ stream_read_u64_le()

static INLINE UINT64 stream_read_u64_le ( wStream _s,
BOOL  seek 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ stream_read_u8()

static INLINE UINT8 stream_read_u8 ( wStream _s,
BOOL  seek 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Stream_Read_UTF16_String()

WINPR_API BOOL Stream_Read_UTF16_String ( wStream s,
WCHAR *  dst,
size_t  charLength 
)
Here is the caller graph for this function:

◆ Stream_Read_UTF16_String_As_UTF8()

WINPR_API char* Stream_Read_UTF16_String_As_UTF8 ( wStream s,
size_t  wcharLength,
size_t *  pUtfCharLength 
)

Reads a WCHAR string from a stream and converts it to UTF-8 and returns a newly allocated string.

Parameters
sThe stream to read data from
wcharLengthThe number of WCHAR characters to read (NOT the size in bytes!)
pUtfCharLengthIgnored if NULL, otherwise will be set to the number of characters in the resulting UTF-8 string
Returns
A '\0' terminated UTF-8 encoded string or NULL for any failure.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Stream_Read_UTF16_String_As_UTF8_Buffer()

WINPR_API SSIZE_T Stream_Read_UTF16_String_As_UTF8_Buffer ( wStream s,
size_t  wcharLength,
char *  utfBuffer,
size_t  utfBufferCharLength 
)

Reads a WCHAR string from a stream and converts it to UTF-8 and writes it to the supplied buffer.

Parameters
sThe stream to read data from
wcharLengthThe number of WCHAR characters to read (NOT the size in bytes!)
utfBufferA pointer to a buffer holding the result string
utfBufferCharLengthThe size of the result buffer
Returns
The char length (strlen) of the result string or -1 for failure
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Stream_Release()

WINPR_API void Stream_Release ( wStream s)

Decrement stream reference count

Here is the call graph for this function:

◆ Stream_Rewind()

static INLINE void Stream_Rewind ( wStream s,
size_t  _offset 
)
static
Here is the caller graph for this function:

◆ Stream_Rewind_UINT16()

static INLINE void Stream_Rewind_UINT16 ( wStream _s)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Stream_Rewind_UINT32()

static INLINE void Stream_Rewind_UINT32 ( wStream _s)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Stream_Rewind_UINT64()

static INLINE void Stream_Rewind_UINT64 ( wStream _s)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Stream_Rewind_UINT8()

static INLINE void Stream_Rewind_UINT8 ( wStream _s)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Stream_SafeSeekEx()

WINPR_API BOOL Stream_SafeSeekEx ( wStream s,
size_t  size,
const char *  file,
size_t  line,
const char *  fkt 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Stream_SealLength()

WINPR_API void Stream_SealLength ( wStream _s)
Here is the call graph for this function:

◆ Stream_Seek()

static INLINE void Stream_Seek ( wStream s,
size_t  _offset 
)
static
Here is the call graph for this function:

◆ Stream_Seek_UINT16()

static INLINE void Stream_Seek_UINT16 ( wStream _s)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Stream_Seek_UINT32()

static INLINE void Stream_Seek_UINT32 ( wStream _s)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Stream_Seek_UINT64()

static INLINE void Stream_Seek_UINT64 ( wStream _s)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Stream_Seek_UINT8()

static INLINE void Stream_Seek_UINT8 ( wStream _s)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Stream_SetLength()

WINPR_API BOOL Stream_SetLength ( wStream _s,
size_t  _l 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Stream_SetPosition()

WINPR_API BOOL Stream_SetPosition ( wStream _s,
size_t  _p 
)
Here is the call graph for this function:

◆ Stream_StaticConstInit()

WINPR_API wStream* Stream_StaticConstInit ( wStream s,
const BYTE buffer,
size_t  size 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Stream_StaticInit()

WINPR_API wStream* Stream_StaticInit ( wStream s,
BYTE buffer,
size_t  size 
)
Here is the caller graph for this function:

◆ Stream_Write()

static INLINE void Stream_Write ( wStream _s,
const void *  _b,
size_t  _n 
)
static
Here is the call graph for this function:

◆ Stream_Write_INT16()

static INLINE void Stream_Write_INT16 ( wStream _s,
INT16  _v 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Stream_Write_INT32()

static INLINE void Stream_Write_INT32 ( wStream _s,
INT32  _v 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Stream_Write_UINT16()

static INLINE void Stream_Write_UINT16 ( wStream _s,
UINT16  _v 
)
static
Here is the call graph for this function:

◆ Stream_Write_UINT16_BE()

static INLINE void Stream_Write_UINT16_BE ( wStream _s,
UINT16  _v 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Stream_Write_UINT24_BE()

static INLINE void Stream_Write_UINT24_BE ( wStream _s,
UINT32  _v 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Stream_Write_UINT32()

static INLINE void Stream_Write_UINT32 ( wStream _s,
UINT32  _v 
)
static
Here is the call graph for this function:

◆ Stream_Write_UINT32_BE()

static INLINE void Stream_Write_UINT32_BE ( wStream _s,
UINT32  _v 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Stream_Write_UINT64()

static INLINE void Stream_Write_UINT64 ( wStream _s,
UINT64  _v 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Stream_Write_UINT8()

static INLINE void Stream_Write_UINT8 ( wStream _s,
UINT8  _v 
)
static
Here is the call graph for this function:

◆ Stream_Write_UTF16_String()

WINPR_API BOOL Stream_Write_UTF16_String ( wStream s,
const WCHAR *  src,
size_t  charLength 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Stream_Write_UTF16_String_From_UTF8()

WINPR_API SSIZE_T Stream_Write_UTF16_String_From_UTF8 ( wStream s,
size_t  wcharLength,
const char *  src,
size_t  length,
BOOL  fill 
)

Writes a UTF-8 string UTF16 encoded to the stream. If the UTF-8 string is short, the remainig characters are filled up with '\0'.

Parameters
sThe stream to write to
wcharLengththe length (in WCHAR characters) to write
srcThe source data buffer with the UTF-8 data
lengthThe length in bytes of the UTF-8 buffer
fillIf TRUE fill the unused parts of the wcharLength with 0

return number of used characters for success, /b -1 for failure

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Stream_Zero()

static INLINE void Stream_Zero ( wStream _s,
size_t  _n 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ StreamPool_Clear()

WINPR_API void StreamPool_Clear ( wStreamPool *  pool)

Releases the streams currently cached in the pool.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ StreamPool_Find()

WINPR_API wStream* StreamPool_Find ( wStreamPool *  pool,
BYTE ptr 
)

Find stream in pool using pointer inside buffer

Here is the call graph for this function:

◆ StreamPool_Free()

WINPR_API void StreamPool_Free ( wStreamPool *  pool)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ StreamPool_GetStatistics()

WINPR_API char* StreamPool_GetStatistics ( wStreamPool *  pool,
char *  buffer,
size_t  size 
)
Here is the caller graph for this function:

◆ StreamPool_New()

WINPR_API wStreamPool* StreamPool_New ( BOOL  synchronized,
size_t  defaultSize 
)

Construction, Destruction

Here is the call graph for this function:
Here is the caller graph for this function:

◆ StreamPool_Return()

WINPR_API void StreamPool_Return ( wStreamPool *  pool,
wStream s 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ StreamPool_Take()

WINPR_API wStream* StreamPool_Take ( wStreamPool *  pool,
size_t  size 
)

Gets a stream from the pool.

Here is the call graph for this function:
Here is the caller graph for this function: