diff src/libpst.h @ 46:b2a7f2e0926a

more fixes for 64 bit format
author carl
date Sat, 12 Jan 2008 15:20:53 -0800
parents d4606d460daf
children 5fb8d997feed
line wrap: on
line diff
--- a/src/libpst.h	Tue Jan 08 16:33:23 2008 -0800
+++ b/src/libpst.h	Sat Jan 12 15:20:53 2008 -0800
@@ -2,7 +2,7 @@
  * libpst.h
  * Part of LibPST project
  * Written by David Smith
- *			  dave.s@earthcorp.com
+ *            dave.s@earthcorp.com
  */
 // LibPST - Library for Accessing Outlook .pst files
 // Dave Smith - davesmith@users.sourceforge.net
@@ -35,21 +35,21 @@
 #if BYTE_ORDER == BIG_ENDIAN
 #  define LE64_CPU(x) \
   x = ((((x) & 0xff00000000000000) >> 56) | \
-	   (((x) & 0x00ff000000000000) >> 40) | \
-	   (((x) & 0x0000ff0000000000) >> 24) | \
-	   (((x) & 0x000000ff00000000) >> 8 ) | \
-	   (((x) & 0x00000000ff000000) << 8 ) | \
-	   (((x) & 0x0000000000ff0000) << 24) | \
-	   (((x) & 0x000000000000ff00) << 40) | \
-	   (((x) & 0x00000000000000ff) << 56));
+       (((x) & 0x00ff000000000000) >> 40) | \
+       (((x) & 0x0000ff0000000000) >> 24) | \
+       (((x) & 0x000000ff00000000) >> 8 ) | \
+       (((x) & 0x00000000ff000000) << 8 ) | \
+       (((x) & 0x0000000000ff0000) << 24) | \
+       (((x) & 0x000000000000ff00) << 40) | \
+       (((x) & 0x00000000000000ff) << 56));
 #  define LE32_CPU(x) \
   x = ((((x) & 0xff000000) >> 24) | \
-	   (((x) & 0x00ff0000) >> 8 ) | \
-	   (((x) & 0x0000ff00) << 8 ) | \
-	   (((x) & 0x000000ff) << 24));
+       (((x) & 0x00ff0000) >> 8 ) | \
+       (((x) & 0x0000ff00) << 8 ) | \
+       (((x) & 0x000000ff) << 24));
 #  define LE16_CPU(x) \
   x = ((((x) & 0xff00) >> 8) | \
-	   (((x) & 0x00ff) << 8));
+       (((x) & 0x00ff) << 8));
 #elif BYTE_ORDER == LITTLE_ENDIAN
 #  define LE64_CPU(x) {}
 #  define LE32_CPU(x) {}
@@ -86,8 +86,8 @@
 #define PST_ENCRYPT 2
 
 // defines different types of mappings
-#define PST_MAP_ATTRIB 1
-#define PST_MAP_HEADER 2
+#define PST_MAP_ATTRIB (uint32_t)1
+#define PST_MAP_HEADER (uint32_t)2
 
 // define my custom email attributes.
 #define PST_ATTRIB_HEADER -1
@@ -99,21 +99,19 @@
 #define PST_FREEBUSY_OUT_OF_OFFICE 3
 
 // defines labels for appointment->label
-#define PST_APP_LABEL_NONE		  0 // None
+#define PST_APP_LABEL_NONE        0 // None
 #define PST_APP_LABEL_IMPORTANT   1 // Important
-#define PST_APP_LABEL_BUSINESS	  2 // Business
-#define PST_APP_LABEL_PERSONAL	  3 // Personal
-#define PST_APP_LABEL_VACATION	  4 // Vacation
+#define PST_APP_LABEL_BUSINESS    2 // Business
+#define PST_APP_LABEL_PERSONAL    3 // Personal
+#define PST_APP_LABEL_VACATION    4 // Vacation
 #define PST_APP_LABEL_MUST_ATTEND 5 // Must Attend
 #define PST_APP_LABEL_TRAVEL_REQ  6 // Travel Required
 #define PST_APP_LABEL_NEEDS_PREP  7 // Needs Preparation
-#define PST_APP_LABEL_BIRTHDAY	  8 // Birthday
+#define PST_APP_LABEL_BIRTHDAY    8 // Birthday
 #define PST_APP_LABEL_ANNIVERSARY 9 // Anniversary
 #define PST_APP_LABEL_PHONE_CALL  10// Phone Call
 
-extern int do_read64;
-
-typedef struct _pst_misc_6_struct {
+typedef struct pst_misc_6_struct {
   int32_t i1;
   int32_t i2;
   int32_t i3;
@@ -122,20 +120,20 @@
   int32_t i6;
 } pst_misc_6;
 
-typedef struct _pst_entryid_struct {
+typedef struct pst_entryid_struct {
   int32_t u1;
   char entryid[16];
   uint32_t id;
 } pst_entryid;
 
-typedef struct _pst_desc_struct32 {
+typedef struct pst_desc_struct32 {
   uint32_t d_id;
   uint32_t desc_id;
   uint32_t list_id;
   uint32_t parent_id;
 } pst_desc32;
 
-typedef struct _pst_desc_structn {
+typedef struct pst_desc_structn {
   uint64_t d_id;
   uint64_t desc_id;
   uint64_t list_id;
@@ -143,127 +141,127 @@
   uint32_t u1;         // padding
 } pst_descn;
 
-typedef struct _pst_index_struct32 {
+typedef struct pst_index_struct32 {
   uint32_t id;
-  int32_t  offset;
+  uint32_t offset;
   uint16_t size;
   int16_t  u1;
 } pst_index32;
 
-typedef struct _pst_index_struct {
+typedef struct pst_index_struct {
   uint64_t id;
-  int64_t  offset;
+  uint64_t offset;
   uint16_t size;
   int16_t  u0;
   int32_t  u1;
 } pst_index;
 
-typedef struct _pst_index_tree32 {
+typedef struct pst_index_tree32 {
   uint32_t id;
-  int32_t  offset;
-  int32_t  size;
+  uint32_t offset;
+  uint32_t size;
   int32_t  u1;
-  struct _pst_index_tree * next;
+  struct pst_index_tree * next;
 } pst_index_ll32;
 
-typedef struct _pst_index_tree {
+typedef struct pst_index_tree {
   uint64_t id;
-  int64_t  offset;
-  int64_t  size;
+  uint64_t offset;
+  uint64_t size;
   int64_t  u1;
-  struct _pst_index_tree * next;
+  struct pst_index_tree * next;
 } pst_index_ll;
 
-typedef struct _pst_index2_tree {
-  uint32_t id2;
+typedef struct pst_index2_tree {
+  uint64_t id2;
   pst_index_ll *id;
-  struct _pst_index2_tree * next;
+  struct pst_index2_tree * next;
 } pst_index2_ll;
 
-typedef struct _pst_desc_tree {
-  uint32_t id;
+typedef struct pst_desc_tree {
+  uint64_t id;
   pst_index_ll * list_index;
   pst_index_ll * desc;
   int32_t no_child;
-  struct _pst_desc_tree * prev;
-  struct _pst_desc_tree * next;
-  struct _pst_desc_tree * parent;
-  struct _pst_desc_tree * child;
-  struct _pst_desc_tree * child_tail;
+  struct pst_desc_tree * prev;
+  struct pst_desc_tree * next;
+  struct pst_desc_tree * parent;
+  struct pst_desc_tree * child;
+  struct pst_desc_tree * child_tail;
 } pst_desc_ll;
 
-typedef struct _pst_item_email_subject {
+typedef struct pst_item_email_subject {
   int32_t off1;
   int32_t off2;
   char   *subj;
 } pst_item_email_subject;
 
-typedef struct _pst_item_email {
+typedef struct pst_item_email {
   FILETIME *arrival_date;
-  int32_t	autoforward; // 1 = true, 0 = not set, -1 = false
-  char	   *body;
-  char	   *cc_address;
-  char	   *common_name;
-  int32_t	conv_index;
-  int32_t	conversion_prohib;
-  int32_t	delete_after_submit; // 1 = true, 0 = false
-  int32_t	delivery_report; // 1 = true, 0 = false
-  char	   *encrypted_body;
-  int32_t	encrypted_body_size;
-  char	   *encrypted_htmlbody;
-  int32_t	encrypted_htmlbody_size;
-  int32_t	flag;
-  char	   *header;
-  char	   *htmlbody;
-  int32_t	importance;
-  char	   *in_reply_to;
-  int32_t	message_cc_me; // 1 = true, 0 = false
-  int32_t	message_recip_me; // 1 = true, 0 = false
-  int32_t	message_to_me; // 1 = true, 0 = false
-  char	   *messageid;
-  int32_t	orig_sensitivity;
-  char	   *outlook_recipient;
-  char	   *outlook_recipient2;
-  char	   *outlook_sender;
-  char	   *outlook_sender_name;
-  char	   *outlook_sender2;
-  int32_t	priority;
-  char	   *proc_subject;
-  int32_t	read_receipt;
-  char	   *recip_access;
-  char	   *recip_address;
-  char	   *recip2_access;
-  char	   *recip2_address;
-  int32_t	reply_requested;
-  char	   *reply_to;
-  char	   *return_path_address;
-  int32_t	rtf_body_char_count;
-  int32_t	rtf_body_crc;
-  char	   *rtf_body_tag;
-  char	   *rtf_compressed;
+  int32_t   autoforward; // 1 = true, 0 = not set, -1 = false
+  char     *body;
+  char     *cc_address;
+  char     *common_name;
+  int32_t   conv_index;
+  int32_t   conversion_prohib;
+  int32_t   delete_after_submit; // 1 = true, 0 = false
+  int32_t   delivery_report; // 1 = true, 0 = false
+  char     *encrypted_body;
+  int32_t   encrypted_body_size;
+  char     *encrypted_htmlbody;
+  int32_t   encrypted_htmlbody_size;
+  int32_t   flag;
+  char     *header;
+  char     *htmlbody;
+  int32_t   importance;
+  char     *in_reply_to;
+  int32_t   message_cc_me; // 1 = true, 0 = false
+  int32_t   message_recip_me; // 1 = true, 0 = false
+  int32_t   message_to_me; // 1 = true, 0 = false
+  char     *messageid;
+  int32_t   orig_sensitivity;
+  char     *outlook_recipient;
+  char     *outlook_recipient2;
+  char     *outlook_sender;
+  char     *outlook_sender_name;
+  char     *outlook_sender2;
+  int32_t   priority;
+  char     *proc_subject;
+  int32_t   read_receipt;
+  char     *recip_access;
+  char     *recip_address;
+  char     *recip2_access;
+  char     *recip2_address;
+  int32_t   reply_requested;
+  char     *reply_to;
+  char     *return_path_address;
+  int32_t   rtf_body_char_count;
+  int32_t   rtf_body_crc;
+  char     *rtf_body_tag;
+  char     *rtf_compressed;
   uint32_t rtf_compressed_size;
-  int32_t	rtf_in_sync; // 1 = true, 0 = doesn't exist, -1 = false
-  int32_t	rtf_ws_prefix_count;
-  int32_t	rtf_ws_trailing_count;
-  char	   *sender_access;
-  char	   *sender_address;
-  char	   *sender2_access;
-  char	   *sender2_address;
-  int32_t	sensitivity;
+  int32_t   rtf_in_sync; // 1 = true, 0 = doesn't exist, -1 = false
+  int32_t   rtf_ws_prefix_count;
+  int32_t   rtf_ws_trailing_count;
+  char     *sender_access;
+  char     *sender_address;
+  char     *sender2_access;
+  char     *sender2_address;
+  int32_t   sensitivity;
   FILETIME *sent_date;
   pst_entryid *sentmail_folder;
-  char		  *sentto_address;
+  char        *sentto_address;
   pst_item_email_subject *subject;
 } pst_item_email;
 
-typedef struct _pst_item_folder {
+typedef struct pst_item_folder {
   int32_t  email_count;
   int32_t  unseen_email_count;
   int32_t  assoc_count;
   char subfolder;
 } pst_item_folder;
 
-typedef struct _pst_item_message_store {
+typedef struct pst_item_message_store {
   pst_entryid *deleted_items_folder;
   pst_entryid *search_root_folder;
   pst_entryid *top_of_personal_folder;
@@ -272,7 +270,7 @@
   int32_t pwd_chksum;
 } pst_item_message_store;
 
-typedef struct _pst_item_contact {
+typedef struct pst_item_contact {
   char *access_method;
   char *account_name;
   char *address1;
@@ -368,33 +366,33 @@
   FILETIME *wedding_anniversary;
 } pst_item_contact;
 
-typedef struct _pst_item_attach {
+typedef struct pst_item_attach {
   char *filename1;
   char *filename2;
   char *mimetype;
   char *data;
   size_t   size;
-  int32_t  id2_val;
-  int32_t  id_val; // calculated from id2_val during creation of record
+  uint64_t id2_val;
+  uint64_t id_val; // calculated from id2_val during creation of record
   int32_t  method;
   int32_t  position;
   int32_t  sequence;
-  struct _pst_item_attach *next;
+  struct pst_item_attach *next;
 } pst_item_attach;
 
-typedef struct _pst_item_extra_field {
+typedef struct pst_item_extra_field {
   char *field_name;
   char *value;
-  struct _pst_item_extra_field *next;
+  struct pst_item_extra_field *next;
 } pst_item_extra_field;
 
-typedef struct _pst_item_journal {
+typedef struct pst_item_journal {
   FILETIME *end;
   FILETIME *start;
   char *type;
 } pst_item_journal;
 
-typedef struct _pst_item_appointment {
+typedef struct pst_item_appointment {
   FILETIME *end;
   char *location;
   FILETIME *reminder;
@@ -405,15 +403,15 @@
   int32_t all_day;
 } pst_item_appointment;
 
-typedef struct _pst_item {
-  struct _pst_item_email         *email;            // data reffering to email
-  struct _pst_item_folder        *folder;           // data reffering to folder
-  struct _pst_item_contact       *contact;          // data reffering to contact
-  struct _pst_item_attach        *attach;           // linked list of attachments
-  struct _pst_item_message_store *message_store;    // data referring to the message store
-  struct _pst_item_extra_field   *extra_fields;     // linked list of extra headers and such
-  struct _pst_item_journal       *journal;          // data reffering to a journal entry
-  struct _pst_item_appointment   *appointment;      // data reffering to a calendar entry
+typedef struct pst_item {
+  struct pst_item_email         *email;            // data reffering to email
+  struct pst_item_folder        *folder;           // data reffering to folder
+  struct pst_item_contact       *contact;          // data reffering to contact
+  struct pst_item_attach        *attach;           // linked list of attachments
+  struct pst_item_message_store *message_store;    // data referring to the message store
+  struct pst_item_extra_field   *extra_fields;     // linked list of extra headers and such
+  struct pst_item_journal       *journal;          // data reffering to a journal entry
+  struct pst_item_appointment   *appointment;      // data reffering to a calendar entry
   int32_t   type;
   char     *ascii_type;
   char     *file_as;
@@ -428,124 +426,122 @@
   int32_t   private_member;
 } pst_item;
 
-typedef struct _pst_x_attrib_ll {
-  int32_t type;
-  int32_t mytype;
-  int32_t map;
+typedef struct pst_x_attrib_ll {
+  uint32_t type;
+  uint32_t mytype;
+  uint32_t map;
   void *data;
-  struct _pst_x_attrib_ll *next;
+  struct pst_x_attrib_ll *next;
 } pst_x_attrib_ll;
 
-typedef struct _pst_file {
+typedef struct pst_file {
   pst_index_ll *i_head, *i_tail;
   pst_index2_ll *i2_head;
   pst_desc_ll *d_head, *d_tail;
   pst_x_attrib_ll *x_head;
-  int32_t index1;
-  int32_t index1_count;
-  int32_t index2;
-  int32_t index2_count;
-  int64_t index1_64;
-  int64_t index1_count_64;
-  int64_t index2_64;
-  int64_t index2_count_64;
-  FILE * fp;				// file pointer to opened PST file
-  size_t size;				// pst file size
+
+  //set this to 0 to read 32-bit pst files (pre Outlook 2003)
+  //set this to 1 to read 64-bit pst files (Outlook 2003 and later)
+  int do_read64;
+
+  uint64_t index1;
+  uint64_t index1_back;
+  uint64_t index2;
+  uint64_t index2_back;
+  FILE * fp;                // file pointer to opened PST file
+  uint64_t size;            // pst file size
   unsigned char encryption; // pst encryption setting
-  unsigned char ind_type;	// pst index type
+  unsigned char ind_type;   // pst index type
 } pst_file;
 
-typedef struct _pst_block_offset {
+typedef struct pst_block_offset {
   int16_t from;
   int16_t to;
 } pst_block_offset;
 
-typedef struct _pst_block_offset_pointer {
+typedef struct pst_block_offset_pointer {
   unsigned char *from;
   unsigned char *to;
-  int			needfree;
+  int           needfree;
 } pst_block_offset_pointer;
 
-struct _pst_num_item {
+struct pst_num_item {
   uint32_t id;
   unsigned char *data;
-  int32_t type;
-  size_t size;
-  char *extra;
+  uint32_t type;
+  size_t  size;
+  char   *extra;
 };
 
-typedef struct _pst_num_array {
+typedef struct pst_num_array {
   int32_t count_item;
   int32_t orig_count;
   int32_t count_array;
-  struct _pst_num_item ** items;
-  struct _pst_num_array *next;
+  struct pst_num_item ** items;
+  struct pst_num_array *next;
 } pst_num_array;
 
 struct holder {
   unsigned char **buf;
-  FILE * fp;
-  int32_t base64;
-  char base64_extra_chars[3];
-  int32_t base64_extra;
+  FILE *    fp;
+  int       base64;
+  char      base64_extra_chars[3];
+  uint32_t  base64_extra;
 };
 
 // prototypes
-void set_read64();
-int32_t pst_open(pst_file *pf, char *name, char *mode);
-int32_t pst_close(pst_file *pf);
-pst_desc_ll * pst_getTopOfFolders(pst_file *pf, pst_item *root);
-int32_t pst_attach_to_mem(pst_file *pf, pst_item_attach *attach, unsigned char **b);
-int32_t pst_attach_to_file(pst_file *pf, pst_item_attach *attach, FILE* fp);
-int32_t pst_attach_to_file_base64(pst_file *pf, pst_item_attach *attach, FILE* fp);
-int32_t pst_load_index (pst_file *pf);
-pst_desc_ll* pst_getNextDptr(pst_desc_ll* d);
-int32_t pst_load_extended_attributes(pst_file *pf);
+int            pst_open(pst_file *pf, char *name, char *mode);
+int            pst_close(pst_file *pf);
+pst_desc_ll *  pst_getTopOfFolders(pst_file *pf, pst_item *root);
+size_t         pst_attach_to_mem(pst_file *pf, pst_item_attach *attach, unsigned char **b);
+size_t         pst_attach_to_file(pst_file *pf, pst_item_attach *attach, FILE* fp);
+size_t         pst_attach_to_file_base64(pst_file *pf, pst_item_attach *attach, FILE* fp);
+int            pst_load_index (pst_file *pf);
+pst_desc_ll*   pst_getNextDptr(pst_desc_ll* d);
+int            pst_load_extended_attributes(pst_file *pf);
 
-int32_t _pst_build_id_ptr(pst_file *pf, off_t offset, int32_t depth, int64_t linku1, uint64_t start_val, uint64_t end_val);
-int32_t _pst_build_desc_ptr (pst_file *pf, off_t offset, int32_t depth, int64_t linku1, uint64_t *high_id, uint64_t start_id, uint64_t end_val);
-pst_item* _pst_getItem(pst_file *pf, pst_desc_ll *d_ptr);
-pst_item* _pst_parse_item (pst_file *pf, pst_desc_ll *d_ptr);
-pst_num_array * _pst_parse_block(pst_file *pf, uint32_t block_id, pst_index2_ll *i2_head);
-int32_t _pst_process(pst_num_array *list, pst_item *item, pst_item_attach *attach);
-int32_t _pst_free_list(pst_num_array *list);
-void _pst_freeItem(pst_item *item);
-int32_t _pst_free_id2(pst_index2_ll * head);
-int32_t _pst_free_id (pst_index_ll *head);
-int32_t _pst_free_desc (pst_desc_ll *head);
-int32_t _pst_free_xattrib(pst_x_attrib_ll *x);
-int32_t _pst_getBlockOffsetPointer(pst_file *pf, pst_index2_ll *i2_head, unsigned char *buf, int32_t read_size, int32_t i_offset, int32_t offset, pst_block_offset_pointer *p);
-int32_t _pst_getBlockOffset(unsigned char *buf, int32_t read_size, int32_t i_offset, int32_t offset, pst_block_offset *p);
-pst_index2_ll * _pst_build_id2(pst_file *pf, pst_index_ll* list, pst_index2_ll* head_ptr);
-pst_index_ll * _pst_getID(pst_file* pf, uint64_t id);
-pst_index_ll * _pst_getID2(pst_index2_ll * ptr, uint32_t id);
-pst_desc_ll * _pst_getDptr(pst_file *pf, uint32_t id);
-size_t _pst_read_block_size(pst_file *pf, off_t offset, size_t size, char **buf, int32_t do_enc, unsigned char is_index);
-int32_t _pst_decrypt(unsigned char *buf, size_t size, int32_t type);
-int64_t _getIntAt(char *buf);
-int64_t _pst_getIntAtPos(FILE *fp, off_t pos);
-int32_t _pst_getAtPos(FILE *fp, off_t pos, void* buf, uint32_t size);
-int32_t _pst_get (FILE *fp, void *buf, uint32_t size);
-size_t _pst_ff_getIDblock_dec(pst_file *pf, uint32_t id, unsigned char **b);
-size_t _pst_ff_getIDblock(pst_file *pf, uint32_t id, unsigned char** b);
-size_t _pst_ff_getID2block(pst_file *pf, uint32_t id2, pst_index2_ll *id2_head, unsigned char** buf);
-size_t _pst_ff_getID2data(pst_file *pf, pst_index_ll *ptr, struct holder *h);
-size_t _pst_ff_compile_ID(pst_file *pf, uint32_t id, struct holder *h, int32_t size);
+int            pst_build_id_ptr(pst_file *pf, off_t offset, int32_t depth, uint64_t linku1, uint64_t start_val, uint64_t end_val);
+int            pst_build_desc_ptr (pst_file *pf, off_t offset, int32_t depth, uint64_t linku1, uint64_t *high_id, uint64_t start_val, uint64_t end_val);
+pst_item*      pst_getItem(pst_file *pf, pst_desc_ll *d_ptr);
+pst_item*      pst_parse_item (pst_file *pf, pst_desc_ll *d_ptr);
+pst_num_array* pst_parse_block(pst_file *pf, uint64_t block_id, pst_index2_ll *i2_head);
+int            pst_process(pst_num_array *list, pst_item *item, pst_item_attach *attach);
+void           pst_free_list(pst_num_array *list);
+void           pst_freeItem(pst_item *item);
+void           pst_free_id2(pst_index2_ll * head);
+void           pst_free_id (pst_index_ll *head);
+void           pst_free_desc (pst_desc_ll *head);
+void           pst_free_xattrib(pst_x_attrib_ll *x);
+int            pst_getBlockOffsetPointer(pst_file *pf, pst_index2_ll *i2_head, unsigned char *buf, size_t read_size, uint32_t i_offset, uint32_t offset, pst_block_offset_pointer *p);
+int            pst_getBlockOffset(unsigned char *buf, size_t read_size, uint32_t i_offset, uint32_t offset, pst_block_offset *p);
+pst_index2_ll* pst_build_id2(pst_file *pf, pst_index_ll* list, pst_index2_ll* head_ptr);
+pst_index_ll*  pst_getID(pst_file* pf, uint64_t id);
+pst_index_ll*  pst_getID2(pst_index2_ll * ptr, uint64_t id);
+pst_desc_ll*   pst_getDptr(pst_file *pf, uint64_t id);
+size_t         pst_read_block_size(pst_file *pf, off_t offset, size_t size, char **buf, int32_t do_enc, unsigned char is_index);
+int            pst_decrypt(unsigned char *buf, size_t size, unsigned char type);
+uint64_t       pst_getIntAt(pst_file *pf, char *buf);
+uint64_t       pst_getIntAtPos(pst_file *pf, off_t pos);
+int            pst_getAtPos(FILE *fp, off_t pos, void* buf, size_t size);
+int            pst_get (FILE *fp, void *buf, size_t size);
+size_t         pst_ff_getIDblock_dec(pst_file *pf, uint64_t id, unsigned char **b);
+size_t         pst_ff_getIDblock(pst_file *pf, uint64_t id, unsigned char** b);
+size_t         pst_ff_getID2block(pst_file *pf, uint64_t id2, pst_index2_ll *id2_head, unsigned char** buf);
+size_t         pst_ff_getID2data(pst_file *pf, pst_index_ll *ptr, struct holder *h);
+size_t         pst_ff_compile_ID(pst_file *pf, uint64_t id, struct holder *h, size_t size);
 
-int32_t pst_strincmp(char *a, char *b, int32_t x);
-int32_t pst_stricmp(char *a, char *b);
-size_t  pst_fwrite(const void*ptr, size_t size, size_t nmemb, FILE*stream);
-char * _pst_wide_to_single(char *wt, int32_t size);
+int            pst_strincmp(char *a, char *b, size_t x);
+int            pst_stricmp(char *a, char *b);
+size_t         pst_fwrite(const void*ptr, size_t size, size_t nmemb, FILE*stream);
+char *         pst_wide_to_single(char *wt, int32_t size);
 
-char *pst_rfc2426_escape(char *str);
-int   pst_chr_count(char *str, char x);
-char *pst_rfc2425_datetime_format(FILETIME *ft);
-char *pst_rfc2445_datetime_format(FILETIME *ft);
+char *         pst_rfc2426_escape(char *str);
+int            pst_chr_count(char *str, char x);
+char *         pst_rfc2425_datetime_format(FILETIME *ft);
+char *         pst_rfc2445_datetime_format(FILETIME *ft);
 
-// DEBUG functions
-int32_t _pst_printDptr(pst_file *pf);
-int32_t _pst_printIDptr(pst_file* pf);
-int32_t _pst_printID2ptr(pst_index2_ll *ptr);
-void * xmalloc(size_t size);
+int32_t        pst_printDptr(pst_file *pf);
+int32_t        pst_printIDptr(pst_file* pf);
+int32_t        pst_printID2ptr(pst_index2_ll *ptr);
 
 #endif // defined LIBPST_H