Two simple fixes for ListView

Austin English austinenglish at gmail.com
Mon Jan 26 16:38:51 CST 2009


On Mon, Jan 26, 2009 at 4:29 PM, Michael James <james.me at gmail.com> wrote:
> Here are two simple fixes before I attempt anything more complex here.
>
> Michael James
>
> From d978eb3c3eff3b44fce6257892749c2c1c34277d Mon Sep 17 00:00:00 2001
> From: Michael James <james.me at gmail.com>
> Date: Sun, 25 Jan 2009 20:09:33 -0800
> Subject: [PATCH 1/2] Added logic to eliminate a valgrind warning in
> LISTVIEW_GetItemExtT
>
> The original code used correct but somewhat obscure logic.  Added a test to
> avoid testing uninitialized pointer for pszText when LVIF_TEXT is not indicated
> in the flags.  With this change, the code functions identically to what it was
> doing before but will not cause a warning from valgrind.
> ---
>  dlls/comctl32/listview.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
> index 172925f..f28a70e 100644
> --- a/dlls/comctl32/listview.c
> +++ b/dlls/comctl32/listview.c
> @@ -5685,7 +5685,7 @@ static BOOL LISTVIEW_GetItemExtT(const
> LISTVIEW_INFO *infoPtr, LPLVITEMW lpLVIte
>
>     pszText = lpLVItem->pszText;
>     bResult = LISTVIEW_GetItemT(infoPtr, lpLVItem, isW);
> -    if (bResult && lpLVItem->pszText != pszText)
> +    if (bResult && (lpLVItem->mask & LVIF_TEXT) && lpLVItem->pszText
> != pszText)
>        textcpynT(pszText, isW, lpLVItem->pszText, isW, lpLVItem->cchTextMax);
>     lpLVItem->pszText = pszText;
>
> --
> 1.6.1
>
> From 8f05ae1ceca1b787f09ede7e7ab0883ee38c63b9 Mon Sep 17 00:00:00 2001
> From: Michael James <james.me at gmail.com>
> Date: Sun, 25 Jan 2009 21:09:42 -0800
> Subject: [PATCH 2/2] Defined missing macro ListView_GetCheckState
>
> ---
>  include/commctrl.h |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/include/commctrl.h b/include/commctrl.h
> index 426d70a..9cea03c 100644
> --- a/include/commctrl.h
> +++ b/include/commctrl.h
> @@ -3715,6 +3715,8 @@ typedef struct NMLVSCROLL
>   SNDMSGA(hwnd, LVM_SETITEMSTATE, (WPARAM)(UINT)i, (LPARAM) (LPLVITEMA)&_LVi);}
>  #define ListView_GetItemState(hwnd,i,mask) \
>     (BOOL)SNDMSGA((hwnd),LVM_GETITEMSTATE,(WPARAM)(UINT)(i),(LPARAM)(UINT)(mask))
> +#define ListView_GetCheckState(hwnd,i) \
> +    ((ListView_GetItemState(hwnd,i,LVIS_STATEIMAGEMASK)>>12)-1)
>  #define ListView_GetCountPerPage(hwnd) \
>     (BOOL)SNDMSGW((hwnd),LVM_GETCOUNTPERPAGE,0,0L)
>  #define ListView_GetImageList(hwnd,iImageList) \
> --
> 1.6.1
>
>
>

One patch per e-mail please.

-- 
-Austin



More information about the wine-devel mailing list