Stream convenience functions to read/write strings.

This commit is contained in:
Armin Novak 2017-06-02 08:54:06 +02:00
parent 1dbd2d28d9
commit 2d18267538
1 changed files with 32 additions and 0 deletions

View File

@ -332,6 +332,38 @@ static INLINE BOOL Stream_SafeSeek(wStream* s, size_t size)
return TRUE;
}
static INLINE BOOL Stream_Read_UTF16_String(wStream* s, WCHAR* dst, size_t length)
{
size_t x;
if (!s || !dst)
return FALSE;
if (Stream_GetRemainingLength(s) / sizeof(WCHAR) < length)
return FALSE;
for (x=0; x<length; x++)
Stream_Read_UINT16(s, dst[x]);
return TRUE;
}
static INLINE BOOL Stream_Write_UTF16_String(wStream* s, const WCHAR* src, size_t length)
{
size_t x;
if (!s || !src)
return FALSE;
if (Stream_GetRemainingCapacity(s) / sizeof(WCHAR) < length)
return FALSE;
for (x=0; x<length; x++)
Stream_Write_UINT16(s, src[x]);
return TRUE;
}
/* StreamPool */
struct _wStreamPool