view archive/libpst.c.diff @ 360:26c48ea9d896

From Jeffrey Morlan: pst_build_id_ptr reads the Block BTree into a linked list, which pst_getID does a linear scan through. For large PSTs that have millions of blocks, this is extremely slow - almost all time is spent in pst_getID. Since the BTree entries must be in order, this can be dramatically improved by reading into an array and using binary search.
author Carl Byington <carl@five-ten-sg.com>
date Wed, 06 Jul 2016 10:21:08 -0700
parents de3753c3160a
children
line wrap: on
line source

Index: libpst.c
===================================================================
--- libpst.c	(revision 45)
+++ libpst.c	(working copy)
@@ -296,7 +296,9 @@
       size = _pst_ff_getID2data(pf, ptr, &h);
       // will need to encode any bytes left over
       c = base64_encode(h.base64_extra_chars, h.base64_extra);
-      pst_fwrite(c, 1, strlen(c), fp);
+      if(c != NULL) {
+        pst_fwrite(c, 1, strlen(c), fp);
+      }
     } else {
       DEBUG_WARN (("Couldn't find ID pointer. Cannot save attachement to Base64\n"));
     }