Treeview fix

Jeff Smith whydoubt at
Tue Oct 22 23:44:25 CDT 2002

Once I got wine to finally execute the native regedit,
treeview was bringing it down.

I discovered treeview uses DSA's and Dimi recently
changed the max element number in DSA's to 0x7fff (SHRT_MAX).
Note this value has the special meaning in DSA_InsertPtr
functions of 'add new element to end of array'.

INT_MAX (0x7fffffff) was being passed from treeview
to DSA_InsertPtr.  This caused failure returns and
eventually a seg fault.

This patch fixes the problem (according to the style of other
calls to DSA_InsertPtr), and native regedit now works.

Questions for further thought:
I wonder, should 0x7fff be used explicitly, or should
SHRT_MAX be used in places like this instead?

Treeview fix due to change in maximum DSA size.

-- Jeff S.

Index: dlls/comctl32/treeview.c
RCS file: /home/wine/wine/dlls/comctl32/treeview.c,v
retrieving revision 1.103
diff -u -r1.103 treeview.c
--- dlls/comctl32/treeview.c	6 Sep 2002 19:41:18 -0000	1.103
+++ dlls/comctl32/treeview.c	23 Oct 2002 04:12:53 -0000
@@ -949,7 +949,7 @@
     if (!newItem)
	return NULL;

-    if (DPA_InsertPtr(infoPtr->items, INT_MAX, newItem) == -1)
+    if (DPA_InsertPtr(infoPtr->items, 0x7fff, newItem) == -1)
	return NULL;
@@ -2885,7 +2885,7 @@

     for (child = item->firstChild; child != NULL; child = 
-	if (DPA_InsertPtr(list, INT_MAX, child) == -1)
+	if (DPA_InsertPtr(list, 0x7fff, child) == -1)
	    return NULL;

Get faster connections -- switch to MSN Internet Access!

More information about the wine-patches mailing list