comparison 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
comparison
equal deleted inserted replaced
260:156cf548c764 261:41862bddcf63
1337 if (id2_ptr) { 1337 if (id2_ptr) {
1338 DEBUG_WARN(("second pass attachment updating id2 %#"PRIx64" found i_id %#"PRIx64"\n", attach->id2_val, id2_ptr->id->i_id)); 1338 DEBUG_WARN(("second pass attachment updating id2 %#"PRIx64" found i_id %#"PRIx64"\n", attach->id2_val, id2_ptr->id->i_id));
1339 // i_id has been updated to the datablock containing the attachment data 1339 // i_id has been updated to the datablock containing the attachment data
1340 attach->i_id = id2_ptr->id->i_id; 1340 attach->i_id = id2_ptr->id->i_id;
1341 attach->id2_head = deep_copy(id2_ptr->child); 1341 attach->id2_head = deep_copy(id2_ptr->child);
1342 DEBUG_WARN(("attachment size was %#"PRIx64", is now %#"PRIx64" based on size of i_id", attach->data.size, id2_ptr->id->size)); 1342 {
1343 attach->data.size = id2_ptr->id->size; 1343 // fetch the actual data to determine the actual attachment size.
1344 pst_index_ll *ptr;
1345 pst_binary rc;
1346 pst_holder h = {&rc.data, NULL, 0, 0, 0};
1347 rc.size = 0;
1348 rc.data = NULL;
1349 ptr = pst_getID(pf, attach->i_id);
1350 if (ptr) {
1351 rc.size = pst_ff_getID2data(pf, ptr, &h);
1352 DEBUG_WARN(("attachment size was %#"PRIx64", is now %#"PRIx64" based on size of i_id\n", attach->data.size, rc.size));
1353 attach->data.size = rc.size;
1354 } else {
1355 DEBUG_WARN(("Couldn't find ID pointer. Cannot save attachment to file\n"));
1356 }
1357 if (rc.data) free(rc.data);
1358 }
1344 } else { 1359 } else {
1345 DEBUG_WARN(("have not located the correct value for the attachment [%#"PRIx64"]\n", attach->id2_val)); 1360 DEBUG_WARN(("have not located the correct value for the attachment [%#"PRIx64"]\n", attach->id2_val));
1346 } 1361 }
1347 } else { 1362 } else {
1348 DEBUG_WARN(("ERROR cannot locate id2 value %#"PRIx64"\n", attach->id2_val)); 1363 DEBUG_WARN(("ERROR cannot locate id2 value %#"PRIx64"\n", attach->id2_val));
4139 * @param h specifies the output destination (buffer, file, encoding) 4154 * @param h specifies the output destination (buffer, file, encoding)
4140 * @param size number of bytes of data already sent to h 4155 * @param size number of bytes of data already sent to h
4141 * @return updated size of the output 4156 * @return updated size of the output
4142 */ 4157 */
4143 static size_t pst_finish_cleanup_holder(pst_holder *h, size_t size) { 4158 static size_t pst_finish_cleanup_holder(pst_holder *h, size_t size) {
4144 char *t; 4159 char *t;attach->i_id = id2_ptr->id->i_id;
4145 DEBUG_ENT("pst_finish_cleanup_holder"); 4160 DEBUG_ENT("pst_finish_cleanup_holder");
4146 if ((h->base64 == 1) && h->fp && h->base64_extra) { 4161 if ((h->base64 == 1) && h->fp && h->base64_extra) {
4147 // need to encode any bytes left over 4162 // need to encode any bytes left over
4148 t = pst_base64_encode_multiple(h->base64_extra_chars, h->base64_extra, &h->base64_line_count); 4163 t = pst_base64_encode_multiple(h->base64_extra_chars, h->base64_extra, &h->base64_line_count);
4149 if (t) { 4164 if (t) {