LISTVIEW_SetItemCount take 4

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sigh.. I guess I really should have compiled that previous version before sending it in. Sorry for the excessive traffic. So here it is fixing compiler warnings, with the missing return added in, and with the changelog. Hopefully this will be the last time.

Changelog:
Implement LISTVIEW_SetItemCount without LVS_OWNERDATA

Index: dlls/comctl32/listview.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/listview.c,v
retrieving revision 1.338
diff -u -r1.338 listview.c
--- dlls/comctl32/listview.c	24 Jan 2003 00:54:59 -0000	1.338
+++ dlls/comctl32/listview.c	3 Feb 2003 19:27:31 -0000
@@ -6657,13 +6659,30 @@
     }
     else
     {
-	/* According to MSDN for non-LVS_OWNERDATA this is just
-	 * a performance issue. The control allocates its internal
-	 * data structures for the number of items specified. It
-	 * cuts down on the number of memory allocations. Therefore
-	 * we will just issue a WARN here
-	 */
-	WARN("for non-ownerdata performance option not implemented.\n");
+        HDPA hdpaSubItems = 0;
+        ITEM_INFO *lpItem;
+        INT i;
+        INT nOldCount = infoPtr->nItemCount;
+
+        /* From the description in MSDN, it does not appear this function can
+         * be used to decrease the number of items.
+         */
+        if (nItems <= nOldCount) return TRUE;
+        
+        for (i=nOldCount; i<nItems; i++)
+        {
+            if ( !(lpItem = (ITEM_INFO *)COMCTL32_Alloc(sizeof(ITEM_INFO))) ) goto fail;
+            if ( !(hdpaSubItems = DPA_Create(8)) ) goto fail;
+            if ( !DPA_SetPtr(hdpaSubItems, 0, lpItem) ) goto fail;
+            if ( DPA_InsertPtr( infoPtr->hdpaItems, i, hdpaSubItems ) < 0) goto fail;
+            infoPtr->nItemCount++;
+        }
+        return TRUE;
+fail:
+	COMCTL32_Free(lpItem);
+	if ( (hdpaSubItems) )
+	    DPA_Destroy( hdpaSubItems );
+	return FALSE;
     }
 
     return TRUE;

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux