comctl32/listview: Convert item text once when looking for insertion point.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2017-05-09 22:11:56 +03:00 committed by Alexandre Julliard
parent d3d8d4f37a
commit 8ef79b023a
1 changed files with 7 additions and 1 deletions

View File

@ -7824,18 +7824,24 @@ static INT LISTVIEW_InsertItemT(LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem,
HDPA hItem;
ITEM_INFO *item_s;
INT i = 0, cmpv;
WCHAR *textW;
textW = textdupTtoW(lpLVItem->pszText, isW);
while (i < infoPtr->nItemCount)
{
hItem = DPA_GetPtr( infoPtr->hdpaItems, i);
item_s = DPA_GetPtr(hItem, 0);
cmpv = textcmpWT(item_s->hdr.pszText, lpLVItem->pszText, isW);
cmpv = textcmpWT(item_s->hdr.pszText, textW, TRUE);
if (infoPtr->dwStyle & LVS_SORTDESCENDING) cmpv *= -1;
if (cmpv >= 0) break;
i++;
}
textfreeT(textW, isW);
nItem = i;
}
else