[PATCH] riched20: Implement ITextSelection::GetText. (resend)

Huw Davies huw at codeweavers.com
Wed Jul 2 05:08:13 CDT 2014


On Wed, Jul 02, 2014 at 05:09:47PM +0800, Jactry Zeng wrote:
> +    buffer = heap_alloc((nChars + 1) * sizeof(WCHAR));
> +    if (!buffer)
> +        return E_OUTOFMEMORY;
> +    ME_GetTextW(This->reOle->editor, buffer, nChars, start, nChars, 0);
> +    buffer[nChars] = 0;
> +    /* FIXME: a '\r' should be appended at the end of a story */
> +    *pbstr = SysAllocString(buffer);
> +    heap_free(buffer);

There's no need for an intermediate buffer here.  Use
SysAllocStringLen() to allocate the BSTR and pass it to ME_GetTextW().

Huw.



More information about the wine-devel mailing list