Bug 459158 - XPT files contain wasted space when written on a machine with 64-bit pointers; r=benjamin
authorZack Weinberg <zweinberg@mozilla.com>
Fri, 10 Oct 2008 16:53:05 +0200
changeset 20259 95b40d8ba0e64e909da287b6ce21d4519fa4beac
parent 20258 097bf47abbcde2ba53c62212eca60c5cb5d9ce9d
child 20260 bf3f9fbfb54311c3c682d0885a2ffe251ab74af6
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbenjamin
bugs459158
milestone1.9.1b2pre
Bug 459158 - XPT files contain wasted space when written on a machine with 64-bit pointers; r=benjamin
xpcom/typelib/xpt/src/xpt_struct.c
--- a/xpcom/typelib/xpt/src/xpt_struct.c
+++ b/xpcom/typelib/xpt/src/xpt_struct.c
@@ -107,21 +107,20 @@ XPT_SizeOfHeader(XPTHeader *header)
     } while (!XPT_ANN_IS_LAST(last->flags));
         
     return size;
 }
 
 XPT_PUBLIC_API(PRUint32)
 XPT_SizeOfHeaderBlock(XPTHeader *header)
 {
-    PRUint32 size = XPT_SizeOfHeader(header);
+    PRUint32 ide_size = 16 /* IID */ + 4 /* name */ +
+        4 /* namespace */ + 4 /* descriptor */;
 
-    size += header->num_interfaces * sizeof (XPTInterfaceDirectoryEntry);
-
-    return size;
+    return XPT_SizeOfHeader(header) + header->num_interfaces * ide_size;
 }
 
 XPT_PUBLIC_API(XPTHeader *)
 XPT_NewHeader(XPTArena *arena, PRUint16 num_interfaces, PRUint8 major_version, PRUint8 minor_version)
 {
     XPTHeader *header = XPT_NEWZAP(arena, XPTHeader);
     if (!header)
         return NULL;