Added Stream_PointerAs

This macro allows retrieving the stream pointer casted to correct
type.
This commit is contained in:
Armin Novak 2022-04-27 18:50:37 +02:00 committed by akallabeth
parent ee243d17aa
commit 5482607b15
2 changed files with 7 additions and 6 deletions

View File

@ -2009,9 +2009,9 @@ BOOL nla_read_ts_password_creds(rdpNla* nla, wStream* s)
size_t userLen = 0;
size_t domainLen = 0;
size_t passwordLen = 0;
WCHAR* user = NULL;
WCHAR* domain = NULL;
WCHAR* password = NULL;
const WCHAR* user = NULL;
const WCHAR* domain = NULL;
const WCHAR* password = NULL;
WINPR_ASSERT(nla);
WINPR_ASSERT(s);
@ -2044,7 +2044,7 @@ BOOL nla_read_ts_password_creds(rdpNla* nla, wStream* s)
domainLen = length / sizeof(WCHAR);
if (length > 0)
domain = Stream_Pointer(s);
domain = Stream_PointerAs(s, const WCHAR);
if (!Stream_SafeSeek(s, length))
return FALSE;
@ -2055,7 +2055,7 @@ BOOL nla_read_ts_password_creds(rdpNla* nla, wStream* s)
userLen = length / sizeof(WCHAR);
if (length > 0)
user = Stream_Pointer(s);
user = Stream_PointerAs(s, const WCHAR);
if (!Stream_SafeSeek(s, length))
return FALSE;
@ -2066,7 +2066,7 @@ BOOL nla_read_ts_password_creds(rdpNla* nla, wStream* s)
passwordLen = length / sizeof(WCHAR);
if (length > 0)
password = Stream_Pointer(s);
password = Stream_PointerAs(s, const WCHAR);
if (!Stream_SafeSeek(s, length))
return FALSE;

View File

@ -394,6 +394,7 @@ extern "C"
}
#define Stream_GetBuffer(_s, _b) _b = Stream_Buffer(_s)
#define Stream_PointerAs(s, type) (type*)Stream_Pointer(s)
static INLINE BYTE* Stream_Pointer(wStream* _s)
{