On 11/17/2011 15:18, Thomas Faber wrote:
This removes the use of two Variable Length Arrays. Instead of filling a local buffer, then allocating a new one using SysAllocString[Len], the strings are now directly written to the latter buffer. Note that the 'len' variable in hunk 2 does not need to count in the terminating null in this case because SysAllocStringLen automatically adds one.
WCHAR buf[url.dwSchemeLength + 1];
WCHAR *buf;
buf = *p = SysAllocStringLen(NULL, url.dwSchemeLength + 1); memcpy(buf, url.lpszScheme, url.dwSchemeLength * sizeof(WCHAR)); buf[url.dwSchemeLength] = ':';
*p = SysAllocStringLen(buf, url.dwSchemeLength + 1);
You don't need 'buf' variable after that.