diff src/libpst.c @ 125:23a36ac0514d

recover dropped pragma pack line, use int64_t rather than off_t to avoid forcing users of the shared library to enable large file support.
author Carl Byington <carl@five-ten-sg.com>
date Tue, 03 Feb 2009 15:01:47 -0800
parents ab2a11e72250
children 7f747c8c9d02
line wrap: on
line diff
--- a/src/libpst.c	Tue Feb 03 11:00:16 2009 -0800
+++ b/src/libpst.c	Tue Feb 03 15:01:47 2009 -0800
@@ -20,21 +20,21 @@
 #define INDEX_TYPE32A           0x0F    // unknown, but assumed to be similar for now
 #define INDEX_TYPE64            0x17
 #define INDEX_TYPE64A           0x15    // http://sourceforge.net/projects/libpff/
-#define INDEX_TYPE_OFFSET       (uint64_t)0x0A
-
-#define FILE_SIZE_POINTER32     (uint64_t)0xA8
-#define INDEX_POINTER32         (uint64_t)0xC4
-#define INDEX_BACK32            (uint64_t)0xC0
-#define SECOND_POINTER32        (uint64_t)0xBC
-#define SECOND_BACK32           (uint64_t)0xB8
-#define ENC_TYPE32              (uint64_t)0x1CD
-
-#define FILE_SIZE_POINTER64     (uint64_t)0xB8
-#define INDEX_POINTER64         (uint64_t)0xF0
-#define INDEX_BACK64            (uint64_t)0xE8
-#define SECOND_POINTER64        (uint64_t)0xE0
-#define SECOND_BACK64           (uint64_t)0xD8
-#define ENC_TYPE64              (uint64_t)0x201
+#define INDEX_TYPE_OFFSET       (int64_t)0x0A
+
+#define FILE_SIZE_POINTER32     (int64_t)0xA8
+#define INDEX_POINTER32         (int64_t)0xC4
+#define INDEX_BACK32            (int64_t)0xC0
+#define SECOND_POINTER32        (int64_t)0xBC
+#define SECOND_BACK32           (int64_t)0xB8
+#define ENC_TYPE32              (int64_t)0x1CD
+
+#define FILE_SIZE_POINTER64     (int64_t)0xB8
+#define INDEX_POINTER64         (int64_t)0xF0
+#define INDEX_BACK64            (int64_t)0xE8
+#define SECOND_POINTER64        (int64_t)0xE0
+#define SECOND_BACK64           (int64_t)0xD8
+#define ENC_TYPE64              (int64_t)0x201
 
 #define FILE_SIZE_POINTER ((pf->do_read64) ? FILE_SIZE_POINTER64 : FILE_SIZE_POINTER32)
 #define INDEX_POINTER     ((pf->do_read64) ? INDEX_POINTER64     : INDEX_POINTER32)
@@ -813,7 +813,7 @@
 }
 
 
-int pst_build_id_ptr(pst_file *pf, uint64_t offset, int32_t depth, uint64_t linku1, uint64_t start_val, uint64_t end_val) {
+int pst_build_id_ptr(pst_file *pf, int64_t offset, int32_t depth, uint64_t linku1, uint64_t start_val, uint64_t end_val) {
     struct pst_table_ptr_structn table, table2;
     pst_index_ll *i_ptr=NULL;
     pst_index index;
@@ -926,7 +926,7 @@
 }
 
 
-int pst_build_desc_ptr (pst_file *pf, uint64_t offset, int32_t depth, uint64_t linku1, uint64_t start_val, uint64_t end_val) {
+int pst_build_desc_ptr (pst_file *pf, int64_t offset, int32_t depth, uint64_t linku1, uint64_t start_val, uint64_t end_val) {
     struct pst_table_ptr_structn table, table2;
     pst_descn desc_rec;
     int32_t item_count;
@@ -1091,8 +1091,9 @@
     list = NULL; //pst_process will free the items in the list
 
     if ((id_ptr = pst_getID2(id2_head, (uint64_t)0x671))) {
-        // attachments exist - so we will process them
+        // should not have any existing attachments anyway
         while (item->attach) {
+            DEBUG_EMAIL(("throw away existing attachment\n"));
             attach = item->attach->next;
             free(item->attach);
             item->attach = attach;
@@ -1101,10 +1102,8 @@
         DEBUG_EMAIL(("ATTACHMENT processing attachment\n"));
         if ((list = pst_parse_block(pf, id_ptr->id, id2_head, NULL)) == NULL) {
             DEBUG_WARN(("ERROR error processing main attachment record\n"));
-            //if (item) pst_freeItem(item);
             if (id2_head) pst_free_id2(id2_head);
             DEBUG_RET();
-            //return NULL;
             return item;
         }
         else {
@@ -4118,7 +4117,7 @@
                  is non-NULL, it will first be free()d
  * @return       size of block read into memory
  */
-size_t pst_read_block_size(pst_file *pf, uint64_t offset, size_t size, char **buf) {
+size_t pst_read_block_size(pst_file *pf, int64_t offset, size_t size, char **buf) {
     size_t rsize;
     DEBUG_ENT("pst_read_block_size");
     DEBUG_READ(("Reading block from %#"PRIx64", %x bytes\n", offset, size));
@@ -4210,7 +4209,7 @@
 }
 
 
-uint64_t pst_getIntAtPos(pst_file *pf, uint64_t pos ) {
+uint64_t pst_getIntAtPos(pst_file *pf, int64_t pos ) {
     uint64_t buf64;
     uint32_t buf32;
     if (pf->do_read64) {
@@ -4235,7 +4234,7 @@
  * @return     actual read size, 0 if seek error
  */
 
-size_t pst_getAtPos(pst_file *pf, uint64_t pos, void* buf, size_t size) {
+size_t pst_getAtPos(pst_file *pf, int64_t pos, void* buf, size_t size) {
     size_t rc;
     DEBUG_ENT("pst_getAtPos");
 //  pst_block_recorder **t = &pf->block_head;