Qian Hong fracting@gmail.com writes:
@@ -304,8 +307,19 @@ static LRESULT ME_StreamInText(ME_TextEditor *editor, DWORD dwFormat, ME_InStrea
if (!(dwFormat & SF_UNICODE)) {
/* FIXME? this is doomed to fail on true MBCS like UTF-8, luckily they're unlikely to be used as CP_ACP */
nWideChars = MultiByteToWideChar(CP_ACP, 0, stream->buffer, stream->dwSize, wszText, STREAMIN_BUFFER_SIZE);
if (!is_read)
{
is_read = TRUE;
if (stream->dwSize >= 3 && !memcmp(stream->buffer, bom_utf8, 3))
{
cp = CP_UTF8;
stream->dwSize -= 3;
memmove(stream->buffer, stream->buffer + 3, stream->dwSize);
There's no reason to move the data.