|
FreeRDP
|
#include <winpr/config.h>#include <winpr/assert.h>#include <winpr/crt.h>#include <winpr/stream.h>#include "stream.h"#include "../log.h"Macros | |
| #define | STREAM_TAG WINPR_TAG("wStream") |
| #define | STREAM_ASSERT(cond) |
Functions | |
| BOOL | Stream_EnsureCapacity (wStream *s, size_t size) |
| BOOL | Stream_EnsureRemainingCapacity (wStream *s, size_t size) |
| wStream * | Stream_New (BYTE *buffer, size_t size) |
| wStream * | Stream_StaticConstInit (wStream *s, const BYTE *buffer, size_t size) |
| wStream * | Stream_StaticInit (wStream *s, BYTE *buffer, size_t size) |
| void | Stream_EnsureValidity (wStream *s) |
| void | Stream_Free (wStream *s, BOOL bFreeBuffer) |
| BOOL | Stream_SetLength (wStream *_s, size_t _l) |
| BOOL | Stream_SetPosition (wStream *_s, size_t _p) |
| void | Stream_SealLength (wStream *_s) |
| size_t | Stream_GetRemainingCapacity (const wStream *_s) |
| size_t | Stream_GetRemainingLength (const wStream *_s) |
| BOOL | Stream_Write_UTF16_String (wStream *s, const WCHAR *src, size_t length) |
| BOOL | Stream_Read_UTF16_String (wStream *s, WCHAR *dst, size_t length) |
| BOOL | Stream_CheckAndLogRequiredCapacityEx (const char *tag, DWORD level, wStream *s, size_t nmemb, size_t size, const char *fmt,...) |
| BOOL | Stream_CheckAndLogRequiredCapacityExVa (const char *tag, DWORD level, wStream *s, size_t nmemb, size_t size, const char *fmt, va_list args) |
| BOOL | Stream_CheckAndLogRequiredCapacityWLogExVa (wLog *log, DWORD level, wStream *s, size_t nmemb, size_t size, WINPR_FORMAT_ARG const char *fmt, va_list args) |
| BOOL | Stream_CheckAndLogRequiredCapacityWLogEx (wLog *log, DWORD level, wStream *s, size_t nmemb, size_t size, WINPR_FORMAT_ARG const char *fmt,...) |
| BOOL | Stream_CheckAndLogRequiredLengthEx (const char *tag, DWORD level, wStream *s, size_t nmemb, size_t size, WINPR_FORMAT_ARG const char *fmt,...) |
| BOOL | Stream_CheckAndLogRequiredLengthExVa (const char *tag, DWORD level, wStream *s, size_t nmemb, size_t size, const char *fmt, va_list args) |
| BOOL | Stream_CheckAndLogRequiredLengthWLogEx (wLog *log, DWORD level, wStream *s, size_t nmemb, size_t size, const char *fmt,...) |
| BOOL | Stream_CheckAndLogRequiredLengthWLogExVa (wLog *log, DWORD level, wStream *s, size_t nmemb, size_t size, WINPR_FORMAT_ARG const char *fmt, va_list args) |
| SSIZE_T | Stream_Write_UTF16_String_From_UTF8 (wStream *s, size_t dlen, 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... | |
| char * | Stream_Read_UTF16_String_As_UTF8 (wStream *s, size_t dlen, size_t *psize) |
| Reads a WCHAR string from a stream and converts it to UTF-8 and returns a newly allocated string. More... | |
| 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... | |
| BOOL | Stream_SafeSeekEx (wStream *s, size_t size, const char *file, size_t line, const char *fkt) |
| #define STREAM_ASSERT | ( | cond | ) |
| #define STREAM_TAG WINPR_TAG("wStream") |
| BOOL Stream_CheckAndLogRequiredCapacityEx | ( | const char * | tag, |
| DWORD | level, | ||
| wStream * | s, | ||
| size_t | nmemb, | ||
| size_t | size, | ||
| const char * | fmt, | ||
| ... | |||
| ) |


| BOOL Stream_CheckAndLogRequiredCapacityExVa | ( | const char * | tag, |
| DWORD | level, | ||
| wStream * | s, | ||
| size_t | nmemb, | ||
| size_t | size, | ||
| const char * | fmt, | ||
| va_list | args | ||
| ) |


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

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


| BOOL Stream_CheckAndLogRequiredLengthEx | ( | const char * | tag, |
| DWORD | level, | ||
| wStream * | s, | ||
| size_t | nmemb, | ||
| size_t | size, | ||
| WINPR_FORMAT_ARG const char * | fmt, | ||
| ... | |||
| ) |


| BOOL Stream_CheckAndLogRequiredLengthExVa | ( | const char * | tag, |
| DWORD | level, | ||
| wStream * | s, | ||
| size_t | nmemb, | ||
| size_t | size, | ||
| const char * | fmt, | ||
| va_list | args | ||
| ) |


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


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


| BOOL Stream_EnsureCapacity | ( | wStream * | s, |
| size_t | size | ||
| ) |


| BOOL Stream_EnsureRemainingCapacity | ( | wStream * | s, |
| size_t | size | ||
| ) |

| void Stream_EnsureValidity | ( | wStream * | s | ) |

| void Stream_Free | ( | wStream * | s, |
| BOOL | bFreeBuffer | ||
| ) |

| size_t Stream_GetRemainingCapacity | ( | const wStream * | _s | ) |


| size_t Stream_GetRemainingLength | ( | const wStream * | _s | ) |

| BOOL Stream_Read_UTF16_String | ( | wStream * | s, |
| WCHAR * | dst, | ||
| size_t | length | ||
| ) |

| 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.
| s | The stream to read data from |
| wcharLength | The number of WCHAR characters to read (NOT the size in bytes!) |
| pUtfCharLength | Ignored if NULL, otherwise will be set to the number of characters in the resulting UTF-8 string |


| 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.
| s | The stream to read data from |
| wcharLength | The number of WCHAR characters to read (NOT the size in bytes!) |
| utfBuffer | A pointer to a buffer holding the result string |
| utfBufferCharLength | The size of the result buffer |


| BOOL Stream_SafeSeekEx | ( | wStream * | s, |
| size_t | size, | ||
| const char * | file, | ||
| size_t | line, | ||
| const char * | fkt | ||
| ) |


| void Stream_SealLength | ( | wStream * | _s | ) |

| BOOL Stream_SetLength | ( | wStream * | _s, |
| size_t | _l | ||
| ) |


| BOOL Stream_SetPosition | ( | wStream * | _s, |
| size_t | _p | ||
| ) |




| BOOL Stream_Write_UTF16_String | ( | wStream * | s, |
| const WCHAR * | src, | ||
| size_t | length | ||
| ) |


| 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'.
| s | The stream to write to |
| wcharLength | the length (in WCHAR characters) to write |
| src | The source data buffer with the UTF-8 data |
| length | The length in bytes of the UTF-8 buffer |
| fill | If TRUE fill the unused parts of the wcharLength with 0 |
return number of used characters for success, /b -1 for failure

