[5/5] comctl32/listview: Fix item text comparison rules
Nikolay Sivov
bunglehead at gmail.com
Sun Jun 14 17:08:17 CDT 2009
Reported to fix http://bugs.winehq.org/show_bug.cgi?id=13867
Stefan Stranz sent it about month ago, I added test for comparison change,
so it's more a resent with test passed.
Changelog:
- Setting item text to callback stub value already having it raises
item-change notifications;
- Use same new text comparison rules for both items and subitems.
>From e38496958f6a131b72889903f269e24f31e2864f Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <bunglehead at gmail.com>
Date: Mon, 15 Jun 2009 01:31:45 +0400
Subject: Setting item text to callback stub value already having it raises
item-change notifications. Use same new text comparison rules
for both items and subitems.
Based on patch by Stefan Stranz.
---
dlls/comctl32/listview.c | 13 ++++++-------
dlls/comctl32/tests/listview.c | 2 +-
2 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index d9404ba..9931c3e 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -507,7 +507,7 @@ static inline int textcmpWT(LPCWSTR aw, LPCWSTR bt, BOOL isW)
if (!aw) return bt ? -1 : 0;
if (!bt) return aw ? 1 : 0;
if (aw == LPSTR_TEXTCALLBACKW)
- return bt == LPSTR_TEXTCALLBACKW ? 0 : -1;
+ return bt == LPSTR_TEXTCALLBACKW ? 1 : -1;
if (bt != LPSTR_TEXTCALLBACKW)
{
LPWSTR bw = textdupTtoW(bt, isW);
@@ -3727,12 +3727,11 @@ static BOOL set_sub_item(const LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem,
*bChanged = TRUE;
}
- if (lpLVItem->mask & LVIF_TEXT)
- if (lpSubItem->hdr.pszText != lpLVItem->pszText)
- {
- textsetptrT(&lpSubItem->hdr.pszText, lpLVItem->pszText, isW);
- *bChanged = TRUE;
- }
+ if ((lpLVItem->mask & LVIF_TEXT) && textcmpWT(lpSubItem->hdr.pszText, lpLVItem->pszText, isW))
+ {
+ textsetptrT(&lpSubItem->hdr.pszText, lpLVItem->pszText, isW);
+ *bChanged = TRUE;
+ }
return TRUE;
}
diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c
index 3895bea..d28fc1b 100644
--- a/dlls/comctl32/tests/listview.c
+++ b/dlls/comctl32/tests/listview.c
@@ -1118,7 +1118,7 @@ static void test_items(void)
expect(TRUE, r);
ok_sequence(sequences, PARENT_SEQ_INDEX, textcallback_set_again_parent_seq,
- "check callback text comparison rule", TRUE);
+ "check callback text comparison rule", FALSE);
DestroyWindow(hwnd);
}
--
1.5.6.5
More information about the wine-patches
mailing list