[TREELIST] Fix 64 bit warnings
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Fri, 4 Jan 2019 13:48:25 +0000 (14:48 +0100)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Sat, 13 Apr 2019 12:07:50 +0000 (14:07 +0200)
base/setup/reactos/treelist.c
base/setup/reactos/treelist.h

index 1681b61..d39924e 100644 (file)
 #define        FIRST_LINE                      0xFFFFFFFE
 #define        FROM_HEADER                     0x88776655
 #define        I_CCB                           I_CHILDRENCALLBACK
-#define        U(h)                            ((unsigned)(h))
+#define        U(h)                            ((unsigned)(ULONG_PTR)(h))
 #define        THEMEIMGLIST            ((HIMAGELIST)1)
 #define        GetHandle(h)            ((TreeListData*)GetWindowLongPtr(h,0))
 #define        TVIF_ALL                        (TVIF_CHILDREN|TVIF_HANDLE|TVIF_IMAGE|TVIF_PARAM|TVIF_SELECTEDIMAGE|TVIF_STATE|TVIF_TEXT)
@@ -553,7 +553,7 @@ static void CallbackEntry(TreeListData *pData, BaseItem *pEntry, unsigned uItem,
 
        sInfo.item.mask                         = TVIF_HANDLE | TVIF_PARAM | TVIF_STATE | uFlags;
        sInfo.item.lParam                       = pEntry->lParam;
-       sInfo.item.hItem                        = (HTREEITEM)uItem;
+       sInfo.item.hItem                        = (HTREEITEM)(ULONG_PTR)uItem;
        sInfo.item.state                        = pEntry->uState;
        sInfo.item.stateMask            = 0xFFFFFFFF;
        sInfo.item.iImage                       = I_IMAGECALLBACK;
@@ -642,7 +642,7 @@ static void CallbackExtra(TreeListData *pData, BaseItem *pEntry, ExtraItem *pExt
 
        sInfo.item.mask                         = TVIF_HANDLE | TVIF_PARAM | TVIF_STATE | TVIF_SUBITEM | uFlags;
        sInfo.item.lParam                       = pEntry->lParam;
-       sInfo.item.hItem                        = (HTREEITEM)uItem;
+       sInfo.item.hItem                        = (HTREEITEM)(ULONG_PTR)uItem;
        sInfo.item.state                        = pExtra->uState;
        sInfo.item.state                   |= (pEntry->uState & TVIS_BASEFLAGS);
        sInfo.item.stateMask            = 0xFFFFFFFF;
@@ -1813,7 +1813,7 @@ static void UpdateToolTip(TreeListData *pData, unsigned uItem, unsigned uFlags)
                                sNotify.hdr.code                        = TVN_ITEMTOOLTIP;
                                sNotify.action                          = 0;
                                sNotify.itemNew.mask            = TVIF_HANDLE | TVIF_PARAM | TVIF_STATE | TVIF_SUBITEM;
-                               sNotify.itemNew.hItem           = (HTREEITEM)uItem;
+                               sNotify.itemNew.hItem           = (HTREEITEM)(ULONG_PTR)uItem;
                                sNotify.itemNew.stateMask       = 0xFFFFFFFF;
                                sNotify.itemNew.state           = pEntry->uState;
                                sNotify.itemNew.lParam          = pEntry->lParam;
@@ -1834,7 +1834,7 @@ static void UpdateToolTip(TreeListData *pData, unsigned uItem, unsigned uFlags)
                                if(pData->uStyle & TVS_INFOTIP) {                               // Tooltip-Daten via normalem Notify holen
                                        sToolNv.hdr.code                        = TVN_GETINFOTIP;
                                        sToolNv.cchTextMax                      = INFOTIPSIZE;
-                                       sToolNv.hItem                           = (HTREEITEM)uItem;
+                                       sToolNv.hItem                           = (HTREEITEM)(ULONG_PTR)uItem;
                                        sToolNv.lParam                          = pEntry->lParam;
                                        sToolNv.pszText                         = cTemp;
 
@@ -1846,7 +1846,7 @@ static void UpdateToolTip(TreeListData *pData, unsigned uItem, unsigned uFlags)
                                        LOCK(pData);
 
                                        sNotify.itemNew.mask            = TVIF_HANDLE | TVIF_PARAM | TVIF_STATE | TVIF_SUBITEM;
-                                       sNotify.itemNew.hItem           = (HTREEITEM)uItem;
+                                       sNotify.itemNew.hItem           = (HTREEITEM)(ULONG_PTR)uItem;
                                        sNotify.itemNew.pszText         = sToolNv.pszText;
                                        sNotify.itemNew.cchTextMax      = str_len(sToolNv.pszText);
                                        sNotify.itemNew.cChildren       = 0;
@@ -1945,7 +1945,7 @@ static void UpdateToolTip(TreeListData *pData, unsigned uItem, unsigned uFlags)
                                sNotify.action                          = 0;
                                sNotify.itemNew.lParam          = pEntry->lParam;
                                sNotify.itemNew.mask            = TVIF_HANDLE | TVIF_PARAM | TVIF_STATE | TVIF_SUBITEM;
-                               sNotify.itemNew.hItem           = (HTREEITEM)uItem;
+                               sNotify.itemNew.hItem           = (HTREEITEM)(ULONG_PTR)uItem;
                                sNotify.itemNew.stateMask       = 0xFFFFFFFF;
                                sNotify.itemNew.cChildren       = uCol;
                                sNotify.itemOld.mask            = 0;
@@ -2618,7 +2618,7 @@ static int TreeListToggleItem(TreeListData *pData, unsigned uItem, unsigned uAdd
        sNotify.action                          =  uAction;
        sNotify.hdr.code                        =  TVN_ITEMEXPANDING;
        sNotify.itemNew.mask            =  TVIF_HANDLE | TVIF_PARAM | TVIF_STATE;
-       sNotify.itemNew.hItem           = (HTREEITEM)uItem;
+       sNotify.itemNew.hItem           = (HTREEITEM)(ULONG_PTR)uItem;
        sNotify.itemNew.stateMask       =  0xFFFFFFFF;
        sNotify.itemNew.state           =  pEntry->uState;
        sNotify.itemNew.lParam          =  pEntry->lParam;
@@ -2691,7 +2691,7 @@ static int TreeListToggleItem(TreeListData *pData, unsigned uItem, unsigned uAdd
        sNotify.action                          =  uAction;
        sNotify.hdr.code                        =  TVN_ITEMEXPANDED;
        sNotify.itemNew.mask            =  TVIF_HANDLE | TVIF_PARAM | TVIF_STATE;
-       sNotify.itemNew.hItem           = (HTREEITEM)uItem;
+       sNotify.itemNew.hItem           = (HTREEITEM)(ULONG_PTR)uItem;
        sNotify.itemNew.stateMask       =  0xFFFFFFFF;
        sNotify.itemNew.state           =  pEntry->uState;
        sNotify.itemNew.lParam          =  pEntry->lParam;
@@ -3145,7 +3145,7 @@ static int TreeListDeleteItem(TreeListData *pData, unsigned uItem, int iMode) {
                sNotify.hdr.code                        = TVN_SELCHANGED;
                sNotify.action                          = TVC_UNKNOWN;
                sNotify.itemOld.mask            = TVIF_HANDLE | TVIF_PARAM | TVIF_STATE | TVIF_SUBITEM | TVIF_PARAM;
-               sNotify.itemOld.hItem           = (HTREEITEM)uItem;
+               sNotify.itemOld.hItem           = (HTREEITEM)(ULONG_PTR)uItem;
                sNotify.itemOld.stateMask       = 0xFFFFFFFF;
                sNotify.itemOld.state           = pEntry->uState&~TVIS_SELECTED;
                sNotify.itemOld.lParam          = pEntry->lParam;
@@ -3174,7 +3174,7 @@ static int TreeListDeleteItem(TreeListData *pData, unsigned uItem, int iMode) {
        sNotify.hdr.code                        = TVN_DELETEITEM;
        sNotify.itemNew.mask            = 0;
        sNotify.itemOld.mask            = TVIF_HANDLE | TVIF_PARAM | TVIF_STATE;
-       sNotify.itemOld.hItem           = (HTREEITEM)uItem;
+       sNotify.itemOld.hItem           = (HTREEITEM)(ULONG_PTR)uItem;
        sNotify.itemOld.lParam          = pEntry->lParam;
        sNotify.itemOld.pszText         = (LPTSTR) - 1;
        sNotify.itemNew.stateMask       = 0xFFFFFFFF;
@@ -3332,7 +3332,7 @@ static int TreeListXorSelectItem(TreeListData *pData, unsigned uItem, int iMode)
        sNotify.hdr.code                        = TVN_SELCHANGING;
        sNotify.action                          = iMode;
        sNotify.itemNew.mask            = TVIF_HANDLE | TVIF_PARAM | TVIF_STATE | TVIF_SUBITEM | TVIF_PARAM;
-       sNotify.itemNew.hItem           = (HTREEITEM)uItem;
+       sNotify.itemNew.hItem           = (HTREEITEM)(ULONG_PTR)uItem;
        sNotify.itemNew.stateMask       = 0xFFFFFFFF;
        sNotify.itemNew.state           = pEntry->uState;
        sNotify.itemNew.lParam          = pEntry->lParam;
@@ -3365,7 +3365,7 @@ static int TreeListXorSelectItem(TreeListData *pData, unsigned uItem, int iMode)
        sNotify.hdr.code                        = TVN_SELCHANGED;
        sNotify.action                          = iMode;
        sNotify.itemNew.mask            = TVIF_HANDLE | TVIF_PARAM | TVIF_STATE | TVIF_SUBITEM | TVIF_PARAM;
-       sNotify.itemNew.hItem           = (HTREEITEM)uItem;
+       sNotify.itemNew.hItem           = (HTREEITEM)(ULONG_PTR)uItem;
        sNotify.itemNew.stateMask       = 0xFFFFFFFF;
        sNotify.itemNew.state           = pEntry->uState;
        sNotify.itemNew.lParam          = pEntry->lParam;
@@ -3683,7 +3683,7 @@ static int TreeListSelectItem(TreeListData *pData, unsigned uItem, unsigned uSub
        sNotify.hdr.code                        = TVN_SELCHANGING;
        sNotify.action                          = iMode;
        sNotify.itemNew.mask            = TVIF_HANDLE | TVIF_PARAM | TVIF_STATE | TVIF_SUBITEM | TVIF_PARAM;
-       sNotify.itemNew.hItem           = (HTREEITEM)uItem;
+       sNotify.itemNew.hItem           = (HTREEITEM)(ULONG_PTR)uItem;
        sNotify.itemNew.stateMask       = 0xFFFFFFFF;
        sNotify.itemNew.state           = uState;
        sNotify.itemNew.lParam          = lParam;
@@ -3691,7 +3691,7 @@ static int TreeListSelectItem(TreeListData *pData, unsigned uItem, unsigned uSub
        sNotify.itemNew.pszText         = (LPTSTR) - 1;
        sNotify.itemNew.cchTextMax      = -1;
        sNotify.itemOld.mask            = TVIF_HANDLE | TVIF_PARAM | TVIF_STATE | TVIF_SUBITEM | TVIF_PARAM;
-       sNotify.itemOld.hItem           = (HTREEITEM)uOld;
+       sNotify.itemOld.hItem           = (HTREEITEM)(ULONG_PTR)uOld;
        sNotify.itemOld.stateMask       = 0xFFFFFFFF;
        sNotify.itemOld.state           = uStOld;
        sNotify.itemNew.lParam          = lPaOld;
@@ -3797,7 +3797,7 @@ static int TreeListSelectItem(TreeListData *pData, unsigned uItem, unsigned uSub
        sNotify.hdr.code                        = TVN_SELCHANGED;
        sNotify.action                          = iMode;
        sNotify.itemNew.mask            = TVIF_HANDLE | TVIF_PARAM | TVIF_STATE | TVIF_SUBITEM | TVIF_PARAM;
-       sNotify.itemNew.hItem           = (HTREEITEM)uItem;
+       sNotify.itemNew.hItem           = (HTREEITEM)(ULONG_PTR)uItem;
        sNotify.itemNew.stateMask       = 0xFFFFFFFF;
        sNotify.itemNew.state           = uState;
        sNotify.itemNew.lParam          = lParam;
@@ -3805,7 +3805,7 @@ static int TreeListSelectItem(TreeListData *pData, unsigned uItem, unsigned uSub
        sNotify.itemNew.pszText         = (LPTSTR) - 1;
        sNotify.itemNew.cchTextMax      = -1;
        sNotify.itemOld.mask            = TVIF_HANDLE | TVIF_PARAM | TVIF_STATE | TVIF_SUBITEM | TVIF_PARAM;
-       sNotify.itemOld.hItem           = (HTREEITEM)uOld;
+       sNotify.itemOld.hItem           = (HTREEITEM)(ULONG_PTR)uOld;
        sNotify.itemOld.stateMask       = 0xFFFFFFFF;
        sNotify.itemOld.state           = uStOld;
        sNotify.itemOld.lParam          = lPaOld;
@@ -3835,14 +3835,14 @@ static int TreeListSelectItem(TreeListData *pData, unsigned uItem, unsigned uSub
        sNotify.hdr.code                        = TVN_SINGLEEXPAND;
        sNotify.action                          = iMode;
        sNotify.itemNew.mask            = TVIF_HANDLE | TVIF_PARAM | TVIF_STATE;
-       sNotify.itemNew.hItem           = (HTREEITEM)uItem;
+       sNotify.itemNew.hItem           = (HTREEITEM)(ULONG_PTR)uItem;
        sNotify.itemNew.stateMask       = 0xFFFFFFFF;
        sNotify.itemNew.state           = (pEntry) ? pEntry->uState : 0;
        sNotify.itemNew.cChildren       = 0;
        sNotify.itemNew.pszText         = (LPTSTR) - 1;
        sNotify.itemNew.cchTextMax      = -1;
        sNotify.itemOld.mask            = TVIF_HANDLE | TVIF_PARAM | TVIF_STATE;
-       sNotify.itemOld.hItem           = (HTREEITEM)uOld;
+       sNotify.itemOld.hItem           = (HTREEITEM)(ULONG_PTR)uOld;
        sNotify.itemOld.stateMask       = 0xFFFFFFFF;
        sNotify.itemOld.state           = (pTemp) ? pTemp->uState : 0;
        sNotify.itemOld.cChildren       = 0;
@@ -4342,7 +4342,7 @@ static unsigned TreeListInsertItem(TreeListData *pData, TV_INSERTSTRUCT *pInsert
                                        pTextTemp = pEntry->pText;
                                }
 
-                               iCmp = pCompare(pData->hWnd, (HTREEITEM)uNext, pTextTemp, pText, pEntry->lParam, pInsert->item.lParam);
+                               iCmp = pCompare(pData->hWnd, (HTREEITEM)(ULONG_PTR)uNext, pTextTemp, pText, pEntry->lParam, pInsert->item.lParam);
                                if(iCmp < 0) {
                                        iCount -= (iCount + 1) / 2;
                                        continue;
@@ -5604,7 +5604,7 @@ static int TreeListInsertColumn(TreeListData *pData, unsigned uCol, TV_COLUMN *p
                ExtraItem  *pExtra;
 
                sSet.mask               = TVIF_SUBITEM;
-               sSet.hItem              = (HTREEITEM)pData->uInsertMark;
+               sSet.hItem              = (HTREEITEM)(ULONG_PTR)pData->uInsertMark;
                sSet.cChildren  = uCol;
 
                TreeListSetItem(pData, &sSet);
@@ -5766,7 +5766,7 @@ static unsigned TreeListHitTest(TreeListData *pData, TV_HITTESTINFO *pInfo) {
        iXpos           += pData->uScrollX;
        uItem            = pData->pItemPos  [iZpos];
        pEntry           = pData->pTreeItems[uItem];
-       pInfo->hItem = (HTREEITEM)uItem;
+       pInfo->hItem = (HTREEITEM)(ULONG_PTR)uItem;
 
        if(!pEntry)
                return 0;
@@ -5950,8 +5950,8 @@ static unsigned TreeListSetInsertMark(TreeListData *pData, unsigned uItem, int i
                        uItem = U(TVI_FIRST);
        }
 
-       sInsert.hParent                         = (HTREEITEM)pEntry->uParent;
-       sInsert.hInsertAfter            = (HTREEITEM)uItem;
+       sInsert.hParent                         = (HTREEITEM)(ULONG_PTR)pEntry->uParent;
+       sInsert.hInsertAfter            = (HTREEITEM)(ULONG_PTR)uItem;
        sInsert.item.mask                       = TVIF_SELECTEDIMAGE | TVIF_IMAGE;
        sInsert.item.iImage                     = TV_NOIMAGE;
        sInsert.item.iSelectedImage     = TV_NOIMAGE;
@@ -5964,7 +5964,7 @@ static unsigned TreeListSetInsertMark(TreeListData *pData, unsigned uItem, int i
        pEntry->uColorBk        = pData->uColors[TVC_INSERT];
        pEntry->bFlags     |= TVIX_BKCOLOR;
        sInsert.item.mask  |= TVIF_SUBITEM;
-       sInsert.item.hItem      = (HTREEITEM)uItem;
+       sInsert.item.hItem      = (HTREEITEM)(ULONG_PTR)uItem;
 
        for(uSub = 1; uSub < pData->uColumnCount; uSub++) {
                sInsert.item.cChildren  = uSub;
@@ -6070,7 +6070,7 @@ static COLORREF TreeListSetItemColor(TreeListData *pData, unsigned uItem, unsign
                pExtra = pData->pExtraItems[uSub - 1][uItem];
                if(!pExtra) {                                                                                   // Extra-Eintrag erzeugen
                        sSet.mask               = TVIF_SUBITEM;
-                       sSet.hItem              = (HTREEITEM)uItem;
+                       sSet.hItem              = (HTREEITEM)(ULONG_PTR)uItem;
                        sSet.cChildren  = uSub;
 
                        if(!TreeListSetItem(pData, &sSet))
@@ -6822,7 +6822,7 @@ static void TreeListChangeCheckbox(TreeListData *pData, UINT uItem, int iPosX, i
                        }
                } else
                        if(pData->uSingleSel && pTemp) {                                // Anderer Eintrag gewählt
-                               sItem.hItem             = (HTREEITEM)pData->uSingleSel;
+                               sItem.hItem             = (HTREEITEM)(ULONG_PTR)pData->uSingleSel;
                                sItem.mask              = TVIF_STATE;
                                sItem.stateMask = TVIS_STATEIMAGEMASK;
                                sItem.state             = (pData->uStyleEx & TVS_EX_BITCHECKBOX) ?      0x0000 : 0x1000;
@@ -6830,7 +6830,7 @@ static void TreeListChangeCheckbox(TreeListData *pData, UINT uItem, int iPosX, i
                                TreeListSetItem(pData, &sItem);
 
                                sNotify.itemOld.mask            = TVIF_HANDLE | TVIF_PARAM | TVIF_STATE | TVIF_TEXT;
-                               sNotify.itemOld.hItem           = (HTREEITEM)pData->uSingleSel;
+                               sNotify.itemOld.hItem           = (HTREEITEM)(ULONG_PTR)pData->uSingleSel;
                                sNotify.itemOld.stateMask       = 0xFFFFFFFF;
                                sNotify.itemOld.state           = pTemp->uState;
                                sNotify.itemOld.lParam          = pTemp->lParam;
@@ -6840,7 +6840,7 @@ static void TreeListChangeCheckbox(TreeListData *pData, UINT uItem, int iPosX, i
                        }
        }
 
-       sItem.hItem             = (HTREEITEM)uItem;
+       sItem.hItem             = (HTREEITEM)(ULONG_PTR)uItem;
        sItem.mask              = TVIF_STATE;
        sItem.stateMask = TVIS_STATEIMAGEMASK;
 
@@ -6855,7 +6855,7 @@ static void TreeListChangeCheckbox(TreeListData *pData, UINT uItem, int iPosX, i
        sNotify.hdr.code                        = TVN_CBSTATECHANGED;
        sNotify.action                          = VK_DBLCLK;
        sNotify.itemNew.mask            = TVIF_HANDLE | TVIF_PARAM | TVIF_STATE | TVIF_TEXT;
-       sNotify.itemNew.hItem           = (HTREEITEM)uItem;
+       sNotify.itemNew.hItem           = (HTREEITEM)(ULONG_PTR)uItem;
        sNotify.itemNew.stateMask       = 0xFFFFFFFF;
        sNotify.itemNew.state           = pEntry->uState;
        sNotify.itemNew.lParam          = pEntry->lParam;
@@ -6907,7 +6907,7 @@ static void TreeListMouseNotify(TreeListData *pData, UINT uMsg, WPARAM wParam, L
        sNotify.action                                  = 0;
        sNotify.hdr.code                                = uMsg;
        sNotify.itemNew.mask                    = TVIF_HANDLE | TVIF_PARAM | TVIF_STATE | TVIF_SUBNUMBER;
-       sNotify.itemNew.hItem                   = (HTREEITEM)uItem;
+       sNotify.itemNew.hItem                   = (HTREEITEM)(ULONG_PTR)uItem;
        sNotify.itemNew.pszText                 = (LPTSTR) - 1;
        sNotify.itemNew.cchTextMax              = -1;
        sNotify.itemOld.mask                    = 0;
@@ -7461,7 +7461,7 @@ End:
 
        sNotify.action                                  = 0;
        sNotify.itemNew.mask                    = TVIF_HANDLE | TVIF_PARAM | TVIF_STATE | TVIF_SUBNUMBER;
-       sNotify.itemNew.hItem                   = (HTREEITEM)uItem;
+       sNotify.itemNew.hItem                   = (HTREEITEM)(ULONG_PTR)uItem;
        sNotify.itemNew.pszText                 = (LPTSTR) - 1;
        sNotify.itemNew.cchTextMax              = -1;
        sNotify.itemOld.mask                    = 0;
@@ -8140,7 +8140,7 @@ static int TreeListSortItemsEx(TreeListData *pData, TV_SORTEX *pSortData, int iM
                        if(!pNext->uFirstChild)
                                return 1;
 
-                       sSort.hParent           = (HTREEITEM)uFirst;
+                       sSort.hParent           = (HTREEITEM)(ULONG_PTR)uFirst;
                        sSort.lParam            = pSortData->lParam;
                        sSort.lpfnCompare       = pSortData->lpfnCompare;
                        TreeListSortItemsEx(pData, &sSort, iMode);
@@ -8163,7 +8163,7 @@ static int TreeListSortItemsEx(TreeListData *pData, TV_SORTEX *pSortData, int iM
                        if(!pNext->uFirstChild)
                                return 1;
 
-                       sSort.hParent           = (HTREEITEM)uFirst;
+                       sSort.hParent           = (HTREEITEM)(ULONG_PTR)uFirst;
                        sSort.lParam            = pSortData->lParam;
                        sSort.lpfnCompare       = pSortData->lpfnCompare;
                        TreeListSortItemsEx(pData, &sSort, iMode);
@@ -8173,7 +8173,7 @@ static int TreeListSortItemsEx(TreeListData *pData, TV_SORTEX *pSortData, int iM
 
        if(iMode) {                                                                                     // Sortiere die Untereinträge
                pNext                           = pList[uFirst];
-               sSort.hParent           = (HTREEITEM)uFirst;
+               sSort.hParent           = (HTREEITEM)(ULONG_PTR)uFirst;
                sSort.lParam            = pSortData->lParam;
                sSort.lpfnCompare       = pSortData->lpfnCompare;
 
@@ -8182,7 +8182,7 @@ static int TreeListSortItemsEx(TreeListData *pData, TV_SORTEX *pSortData, int iM
                                TreeListSortItemsEx(pData, &sSort, SORT_NOUPDATE);
                        }
 
-                       sSort.hParent   = (HTREEITEM)pNext->uNextItem;
+                       sSort.hParent   = (HTREEITEM)(ULONG_PTR)pNext->uNextItem;
                        pNext                   = pList[pNext->uNextItem];
                }
        }
@@ -8234,7 +8234,7 @@ static int TreeListSortItemsEx(TreeListData *pData, TV_SORTEX *pSortData, int iM
                XCHANGE_MEM(iMiddle, iLower);
 
                uItem      = pItemList[iStart];
-               hItemTemp  = (HTREEITEM)uItem;
+               hItemTemp  = (HTREEITEM)(ULONG_PTR)uItem;
                lParamTemp = pList[uItem]->lParam;
 
                for(;;) {
@@ -8243,7 +8243,7 @@ static int TreeListSortItemsEx(TreeListData *pData, TV_SORTEX *pSortData, int iM
                                if(iLower > iLast)
                                        break;
                                uItem = pItemList[iLower];
-                               iCmp = pCompare(hTreeWnd, (HTREEITEM)uItem, hItemTemp, pList[uItem]->lParam, lParamTemp, lParamSort);
+                               iCmp = pCompare(hTreeWnd, (HTREEITEM)(ULONG_PTR)uItem, hItemTemp, pList[uItem]->lParam, lParamTemp, lParamSort);
                        } while(iCmp <= 0);
 
                        do  {
@@ -8251,7 +8251,7 @@ static int TreeListSortItemsEx(TreeListData *pData, TV_SORTEX *pSortData, int iM
                                if(iUpper <= iStart)
                                        break;
                                uItem = pItemList[iUpper];
-                               iCmp = pCompare(hTreeWnd, (HTREEITEM)uItem, hItemTemp, pList[uItem]->lParam, lParamTemp, lParamSort);
+                               iCmp = pCompare(hTreeWnd, (HTREEITEM)(ULONG_PTR)uItem, hItemTemp, pList[uItem]->lParam, lParamTemp, lParamSort);
                        } while(iCmp >= 0);
 
                        if(iUpper < iLower)
@@ -8399,7 +8399,7 @@ static int TreeListSortItemsCb(TreeListData *pData, TV_SORTCB *pSortData, int iM
                        if(!pNext->uFirstChild)
                                return 1;
 
-                       sSort.hParent           = (HTREEITEM)uFirst;
+                       sSort.hParent           = (HTREEITEM)(ULONG_PTR)uFirst;
                        sSort.lParam            = pSortData->lParam;
                        sSort.lpfnCompare       = pSortData->lpfnCompare;
                        TreeListSortItemsCb(pData, &sSort, iMode);
@@ -8422,7 +8422,7 @@ static int TreeListSortItemsCb(TreeListData *pData, TV_SORTCB *pSortData, int iM
                        if(!pNext->uFirstChild)
                                return 1;
 
-                       sSort.hParent           = (HTREEITEM)uFirst;
+                       sSort.hParent           = (HTREEITEM)(ULONG_PTR)uFirst;
                        sSort.lParam            = pSortData->lParam;
                        sSort.lpfnCompare       = pSortData->lpfnCompare;
                        TreeListSortItemsCb(pData, &sSort, iMode);
@@ -8432,7 +8432,7 @@ static int TreeListSortItemsCb(TreeListData *pData, TV_SORTCB *pSortData, int iM
 
        if(iMode) {                                                                                     // Sortiere die Untereinträge
                pNext                           = pList[uFirst];
-               sSort.hParent           = (HTREEITEM)uFirst;
+               sSort.hParent           = (HTREEITEM)(ULONG_PTR)uFirst;
                sSort.lParam            = pSortData->lParam;
                sSort.lpfnCompare       = pSortData->lpfnCompare;
 
@@ -8441,7 +8441,7 @@ static int TreeListSortItemsCb(TreeListData *pData, TV_SORTCB *pSortData, int iM
                                TreeListSortItemsCb(pData, &sSort, SORT_NOUPDATE);
                        }
 
-                       sSort.hParent   = (HTREEITEM)pNext->uNextItem;
+                       sSort.hParent   = (HTREEITEM)(ULONG_PTR)pNext->uNextItem;
                        pNext                   = pList[pNext->uNextItem];
                }
        }
@@ -8946,7 +8946,7 @@ static int TreeListEndLabelEdit(TreeListData *pData, int iMode) {
        }
 
        sNotify.hdr.code                        = TVN_ENDLABELEDIT;
-       sNotify.item.hItem                      = (HTREEITEM)uItem;
+       sNotify.item.hItem                      = (HTREEITEM)(ULONG_PTR)uItem;
        sNotify.item.stateMask          = 0xFFFFFFFF;
        sNotify.item.cChildren          = uSub;
 
@@ -8977,7 +8977,7 @@ static int TreeListEndLabelEdit(TreeListData *pData, int iMode) {
                sNotify.hdr.code                = TVN_SETDISPINFO;
                sNotify.item.mask               = TVIF_HANDLE | TVIF_PARAM | TVIF_STATE | TVIF_TEXT | TVIF_SUBITEM;
                sNotify.item.stateMask  = (UINT)~TVIS_BASEFLAGS;
-               sNotify.item.hItem              = (HTREEITEM)uItem;
+               sNotify.item.hItem              = (HTREEITEM)(ULONG_PTR)uItem;
                sNotify.item.cChildren  = uSub;
 
                UNLOCK(pData);
@@ -8987,7 +8987,7 @@ static int TreeListEndLabelEdit(TreeListData *pData, int iMode) {
                pGetT                   = sNotify.item.pszText;
                sSet.mask               = TVIF_SUBITEM | TVIF_TEXT;
                sSet.cchTextMax = sNotify.item.cchTextMax;
-               sSet.hItem              = (HTREEITEM)uItem;
+               sSet.hItem              = (HTREEITEM)(ULONG_PTR)uItem;
                sSet.pszText    = pGetT;
                sSet.cChildren  = uSub;
 
@@ -9342,7 +9342,7 @@ static HWND TreeListEditLabel(TreeListData *pData, unsigned uItem, unsigned uSub
 
        sNotify.hdr.code                        = TVN_BEGINLABELEDIT;
        sNotify.item.mask                       = TVIF_HANDLE | TVIF_PARAM | TVIF_STATE | TVIF_TEXT | TVIF_SUBITEM;
-       sNotify.item.hItem                      = (HTREEITEM)uItem;
+       sNotify.item.hItem                      = (HTREEITEM)(ULONG_PTR)uItem;
        sNotify.item.pszText            = (LPTSTR)pText;
        sNotify.item.lParam                     = lParam;
        sNotify.item.state                      = uState;
@@ -9523,7 +9523,7 @@ static int TreeListStartNotifyEdit(TreeListData *pData, unsigned uItem, unsigned
        sNotify.hdr.code                        = TVN_STARTEDIT;
        sNotify.uAction                         = (UINT)wParam;
        sNotify.item.mask                       = TVIF_HANDLE | TVIF_PARAM | TVIF_STATE | TVIF_SUBITEM;
-       sNotify.item.hItem                      = (HTREEITEM)uItem;
+       sNotify.item.hItem                      = (HTREEITEM)(ULONG_PTR)uItem;
        sNotify.item.stateMask          = 0xFFFFFFFF;
        sNotify.item.lParam                     = pEntry->lParam;
        sNotify.item.cChildren          = uSub;
@@ -9760,7 +9760,7 @@ static int TreeListStartAutoEdit(TreeListData *pData, unsigned uColumn, WPARAM w
        if(uMode >= TVAX_STEP) {
                sItem.mask               = TVIF_TEXT | TVIF_SUBITEM | TVIF_TEXTPTR | ((uMode < TVAX_CHECK) ? 0 : TVIF_STATE | TVIF_PARAM);
                sItem.stateMask  = 0xFFFFFFFF;
-               sItem.hItem              = (HTREEITEM)pData->uSelectedItem;
+               sItem.hItem              = (HTREEITEM)(ULONG_PTR)pData->uSelectedItem;
                sItem.cChildren  = uColumn;
 
                if(!TreeListGetItem(pData, &sItem))
@@ -9890,7 +9890,7 @@ NoTextChange:
 
                sItem.mask              &= ~TVIF_TEXTPTR;
                sItem.stateMask &=  TVIS_STATEIMAGEMASK;
-               sItem.hItem              = (HTREEITEM)pData->uSelectedItem;
+               sItem.hItem              = (HTREEITEM)(ULONG_PTR)pData->uSelectedItem;
                sItem.pszText    =  pText;
                sItem.cchTextMax =  256;
                sItem.cChildren  =  uColumn;
@@ -9948,7 +9948,7 @@ EditField:
        if(uMode != TVAX_EDIT) {
                iSel                     = (uMode != TVAX_CBLIST) ? -1 : 0;
                sItem.mask               = TVIF_TEXT | TVIF_SUBITEM | TVIF_TEXTPTR;
-               sItem.hItem              = (HTREEITEM)pData->uSelectedItem;
+               sItem.hItem              = (HTREEITEM)(ULONG_PTR)pData->uSelectedItem;
                sItem.cChildren  = uColumn;
 
                if(!TreeListGetItem(pData, &sItem))
@@ -10494,7 +10494,7 @@ static LRESULT CALLBACK TreeListProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM
                                        sNotify.hdr.code                        = TVN_BEGINDRAG;
                                        sNotify.action                          = (pEntry->uState & TVIS_EXPANDED) ? TVE_COLLAPSE : TVE_EXPAND;
                                        sNotify.itemNew.mask            = TVIF_HANDLE | TVIF_PARAM | TVIF_STATE | TVIF_SUBNUMBER;
-                                       sNotify.itemNew.hItem           = (HTREEITEM)pData->uDragItem;
+                                       sNotify.itemNew.hItem           = (HTREEITEM)(ULONG_PTR)pData->uDragItem;
                                        sNotify.itemNew.stateMask       = 0xFFFFFFFF;
                                        sNotify.itemNew.state           = pEntry->uState;
                                        sNotify.itemNew.lParam          = pEntry->lParam;
index c6dd4db..c37993c 100644 (file)
@@ -112,10 +112,10 @@ typedef           TVSORTEX                                TV_SORTEX;
 #define        TVE_EXPANDNEXT                  (0x20000000)
 #define        TVE_ALLCHILDS                   (0x10000000)
 #define        TVE_ONLYCHILDS                  (0x00000008)
-#define        TVI_SORTEX                              ((HTREEITEM) 0xFFFF0007)
-#define        TVI_BEFORE                              ((HTREEITEM) 0xFFFF0006)
-#define        TVI_AFTER                               ((HTREEITEM) 0xFFFF0005)
-#define                TVI_ROW(n)                      ((HTREEITEM)(0xFFE00000+(n)))
+#define        TVI_SORTEX                              ((HTREEITEM)(ULONG_PTR)0xFFFF0007)
+#define        TVI_BEFORE                              ((HTREEITEM)(ULONG_PTR)0xFFFF0006)
+#define        TVI_AFTER                               ((HTREEITEM)(ULONG_PTR)0xFFFF0005)
+#define                TVI_ROW(n)                      ((HTREEITEM)(ULONG_PTR)(0xFFE00000+(n)))
 #ifndef                VK_DBLCLK
 #define        VK_DBLCLK                               0x10000                         // Edit with doubleclick
 #endif
@@ -404,7 +404,7 @@ typedef             TVSORTEX                                TV_SORTEX;
 #define                TreeList_FindItem(h,p,f)                                        ((HTREEITEM )SNDMSG(h,TVM_FINDITEM ,(WPARAM)p,(LPARAM)f))
 #define                TreeList_CreateDragImage(h,i)                           ((HIMAGELIST)SNDMSG(h,TVM_CREATEDRAGIMAGE, 0, (LPARAM)(HTREEITEM)(i)))
 #define                TreeList_CreateDragImageEx(h,i,s)                       ((HIMAGELIST)SNDMSG(h,TVM_CREATEDRAGIMAGE, s, (LPARAM)(HTREEITEM)(i)))
-#define                TreeList_SetImageList(h,l,i)                            ((HIMAGELIST)SNDMSG(h,TVM_SETIMAGELIST,i,(LPARAM)(UINT)(HIMAGELIST)(l)))
+#define                TreeList_SetImageList(h,l,i)                            ((HIMAGELIST)SNDMSG(h,TVM_SETIMAGELIST,i,(LPARAM)(HIMAGELIST)(l)))
 #define                TreeList_SetIndent(h,i)                                     ((BOOL      )SNDMSG(h,TVM_SETINDENT,(WPARAM)(i),0))
 #define                TreeList_SetItem(h,p)                                       ((BOOL      )SNDMSG(h,TVM_SETITEM,0,(LPARAM)(const TV_ITEM*)(p)))
 #define                TreeList_SortChildren(h,i,r)                            ((BOOL      )SNDMSG(h,TVM_SORTCHILDREN  ,(WPARAM)r,(LPARAM)(HTREEITEM)(i)))
@@ -484,7 +484,7 @@ extern BOOL TreeListUnregister(HINSTANCE hInstance);
     _ms_tvi.hItem       = (hItem_); \
     _ms_tvi.stateMask   = 0; \
     _ms_tvi.pszText     = _my_pszText; \
-    _ms_tvi.cchTextMax  = _my_pszText ? wcslen(_my_pszText) : 0; \
+    _ms_tvi.cchTextMax  = _my_pszText ? (int)wcslen(_my_pszText) : 0; \
     _ms_tvi.cChildren   = (iSubItem_); \
     TreeList_SetItem((hwndLV), &_ms_tvi); \
 }