From: Anders Kjersem andersdev@proton.me
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/comctl32/listview.c | 17 +++++++---------- dlls/comctl32/tests/listview.c | 3 --- 2 files changed, 7 insertions(+), 13 deletions(-)
diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c index 1a0c919e962..8de14280575 100644 --- a/dlls/comctl32/listview.c +++ b/dlls/comctl32/listview.c @@ -5921,18 +5921,15 @@ static BOOL LISTVIEW_EndEditLabelT(LISTVIEW_INFO *infoPtr, BOOL storeText, BOOL
if (storeText) { - DWORD len = isW ? GetWindowTextLengthW(infoPtr->hwndEdit) : GetWindowTextLengthA(infoPtr->hwndEdit); + DWORD len = (isW ? GetWindowTextLengthW(infoPtr->hwndEdit) : GetWindowTextLengthA(infoPtr->hwndEdit)) + 1;
- if (len++) - { - if (!(pszText = Alloc(len * (isW ? sizeof(WCHAR) : sizeof(CHAR))))) - return FALSE; + if (!(pszText = Alloc(len * (isW ? sizeof(WCHAR) : sizeof(CHAR))))) + return FALSE;
- if (isW) - GetWindowTextW(infoPtr->hwndEdit, pszText, len); - else - GetWindowTextA(infoPtr->hwndEdit, (CHAR*)pszText, len); - } + if (isW) + GetWindowTextW(infoPtr->hwndEdit, pszText, len); + else + GetWindowTextA(infoPtr->hwndEdit, (CHAR*)pszText, len); }
TRACE("(pszText=%s, isW=%d)\n", debugtext_t(pszText, isW), isW); diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c index cf8b445c545..b0139f4edff 100644 --- a/dlls/comctl32/tests/listview.c +++ b/dlls/comctl32/tests/listview.c @@ -4716,15 +4716,12 @@ static void test_editbox(void) g_editbox_disp_info.item.pszText = NULL; r = SendMessageA(hwndedit, WM_KEYDOWN, VK_RETURN, 0); ok(!r, "Unexpected return value %d.\n", r); - todo_wine ok(g_editbox_disp_info.item.pszText != NULL, "Unexpected notification text.\n"); memset(&item, 0, sizeof(item)); item.pszText = buffer; item.cchTextMax = sizeof(buffer); r = SendMessageA(hwnd, LVM_GETITEMTEXTA, 0, (LPARAM)&item); - todo_wine ok(!r, "Unexpected return value %d.\n", r); - todo_wine ok(!*buffer, "Unexpected item text %s.\n", debugstr_a(buffer));
/* end edit with saving */