Mercurial > libpst
diff src/libpst.c @ 261:41862bddcf63
adding more debug code
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Sun, 17 Apr 2011 15:01:18 -0700 |
parents | 156cf548c764 |
children | da14095155a2 |
line wrap: on
line diff
--- a/src/libpst.c Sun Apr 17 14:07:25 2011 -0700 +++ b/src/libpst.c Sun Apr 17 15:01:18 2011 -0700 @@ -1339,8 +1339,23 @@ // i_id has been updated to the datablock containing the attachment data attach->i_id = id2_ptr->id->i_id; attach->id2_head = deep_copy(id2_ptr->child); - DEBUG_WARN(("attachment size was %#"PRIx64", is now %#"PRIx64" based on size of i_id", attach->data.size, id2_ptr->id->size)); - attach->data.size = id2_ptr->id->size; + { + // fetch the actual data to determine the actual attachment size. + pst_index_ll *ptr; + pst_binary rc; + pst_holder h = {&rc.data, NULL, 0, 0, 0}; + rc.size = 0; + rc.data = NULL; + ptr = pst_getID(pf, attach->i_id); + if (ptr) { + rc.size = pst_ff_getID2data(pf, ptr, &h); + DEBUG_WARN(("attachment size was %#"PRIx64", is now %#"PRIx64" based on size of i_id\n", attach->data.size, rc.size)); + attach->data.size = rc.size; + } else { + DEBUG_WARN(("Couldn't find ID pointer. Cannot save attachment to file\n")); + } + if (rc.data) free(rc.data); + } } else { DEBUG_WARN(("have not located the correct value for the attachment [%#"PRIx64"]\n", attach->id2_val)); } @@ -4141,7 +4156,7 @@ * @return updated size of the output */ static size_t pst_finish_cleanup_holder(pst_holder *h, size_t size) { - char *t; + char *t;attach->i_id = id2_ptr->id->i_id; DEBUG_ENT("pst_finish_cleanup_holder"); if ((h->base64 == 1) && h->fp && h->base64_extra) { // need to encode any bytes left over