Piotr Caban : oleaut32: Make typeinfo offsets table dynamic.

Alexandre Julliard julliard at winehq.org
Thu Apr 11 13:32:20 CDT 2013


Module: wine
Branch: master
Commit: b0dcf32b85f945de2644e71ee2412fff43156163
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=b0dcf32b85f945de2644e71ee2412fff43156163

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Thu Apr 11 13:55:30 2013 +0200

oleaut32: Make typeinfo offsets table dynamic.

---

 dlls/oleaut32/typelib2.c |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/dlls/oleaut32/typelib2.c b/dlls/oleaut32/typelib2.c
index a7815a9..df25271 100644
--- a/dlls/oleaut32/typelib2.c
+++ b/dlls/oleaut32/typelib2.c
@@ -178,7 +178,8 @@ typedef struct tagICreateTypeLib2Impl
     int typelib_guids; /* Number of defined typelib guids */
     int typeinfo_guids; /* Number of defined typeinfo guids */
 
-    INT typelib_typeinfo_offsets[0x200]; /* Hope that's enough. */
+    INT *typelib_typeinfo_offsets;
+    int typeinfo_offsets_size;
 
     INT *typelib_namehash_segment;
     INT *typelib_guidhash_segment;
@@ -621,6 +622,21 @@ static int ctl2_alloc_typeinfo(
     int offset;
     MSFT_TypeInfoBase *typeinfo;
 
+    if (!This->typeinfo_offsets_size) {
+        This->typelib_typeinfo_offsets = heap_alloc(8*sizeof(INT));
+        if(!This->typelib_typeinfo_offsets)
+            return -1;
+        This->typeinfo_offsets_size = 8;
+    }else if (This->typelib_header.nrtypeinfos == This->typeinfo_offsets_size) {
+        INT *new_offsets = heap_realloc(This->typelib_typeinfo_offsets,
+                2*This->typeinfo_offsets_size*sizeof(INT));
+        if(!new_offsets)
+            return -1;
+
+        This->typelib_typeinfo_offsets = new_offsets;
+        This->typeinfo_offsets_size *= 2;
+    }
+
     offset = ctl2_alloc_segment(This, MSFT_SEG_TYPEINFO, sizeof(MSFT_TypeInfoBase), 0);
     if (offset == -1) return -1;
 
@@ -4338,6 +4354,7 @@ static ULONG WINAPI ICreateTypeLib2_fnRelease(ICreateTypeLib2 *iface)
             heap_free(This->typelib_segment_data[i]);
             This->typelib_segment_data[i] = NULL;
 	}
+        heap_free(This->typelib_typeinfo_offsets);
 
         SysFreeString(This->filename);
         This->filename = NULL;




More information about the wine-cvs mailing list