From 4c489f275f2eae59f534bb3ed39af208c1b6812f Mon Sep 17 00:00:00 2001 From: "yokoyama%netscape.com" Date: Thu, 15 Nov 2001 23:42:00 +0000 Subject: [PATCH] bug 110170 IME COMPOSITION string was off by one and not to use compStrLen in NS_IMM_GETCOMPOSITIONSTRING() /r=ftang, /sr=alecf --- widget/src/windows/nsWindow.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/widget/src/windows/nsWindow.cpp b/widget/src/windows/nsWindow.cpp index 653e168d031d..a4c555902ebc 100644 --- a/widget/src/windows/nsWindow.cpp +++ b/widget/src/windows/nsWindow.cpp @@ -5051,8 +5051,9 @@ BOOL nsWindow::OnIMEComposition(LPARAM aGCS) mIMECompUnicode->SetCapacity((compStrLen / sizeof(WCHAR))+1); + long buflen = compStrLen + sizeof(WCHAR); NS_IMM_GETCOMPOSITIONSTRINGW(hIMEContext, GCS_RESULTSTR, - (LPVOID)mIMECompUnicode->get(), compStrLen, compStrLen); + (LPVOID)mIMECompUnicode->get(), buflen, compStrLen); compStrLen = compStrLen / sizeof(WCHAR); mIMECompUnicode->SetLength(compStrLen); } else { @@ -5060,8 +5061,9 @@ BOOL nsWindow::OnIMEComposition(LPARAM aGCS) mIMECompString->SetCapacity(compStrLen+1); + long buflen = compStrLen + 1; NS_IMM_GETCOMPOSITIONSTRING(hIMEContext, GCS_RESULTSTR, - (LPVOID)mIMECompString->get(), compStrLen+1, compStrLen); + (LPVOID)mIMECompString->get(), buflen, compStrLen); mIMECompString->SetLength(compStrLen); } #ifdef DEBUG_IME @@ -5185,20 +5187,22 @@ BOOL nsWindow::OnIMEComposition(LPARAM aGCS) mIMECompUnicode->SetCapacity((compStrLen / sizeof(WCHAR)) + 1); + long buflen = compStrLen + sizeof(WCHAR); NS_IMM_GETCOMPOSITIONSTRINGW(hIMEContext, GCS_COMPSTR, (LPVOID)mIMECompUnicode->get(), - compStrLen, compStrLen); + buflen, compStrLen); compStrLen = compStrLen / sizeof(WCHAR); mIMECompUnicode->SetLength(compStrLen); } else { NS_IMM_GETCOMPOSITIONSTRING(hIMEContext, GCS_COMPSTR, NULL, 0, compStrLen); mIMECompString->SetCapacity(compStrLen+1); + long buflen = compStrLen + 1; NS_IMM_GETCOMPOSITIONSTRING(hIMEContext, GCS_COMPSTR, (char*)mIMECompString->get(), - compStrLen+1, compStrLen); + buflen, compStrLen); mIMECompString->SetLength(compStrLen); } #ifdef DEBUG_IME