comparison src/libpst.c @ 266:3f323c867cb4

adding more debug code
author Carl Byington <carl@five-ten-sg.com>
date Sun, 17 Apr 2011 16:31:10 -0700
parents 2b0498c17a2f
children 3fa737c05322
comparison
equal deleted inserted replaced
265:191c1a7e769e 266:3f323c867cb4
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 { 1342 if (attach->data.data) {
1343 // fetch the actual data to determine the actual attachment size. 1343 // fetch the actual data to determine the actual attachment size.
1344 pst_index_ll *ptr; 1344 pst_index_ll *ptr;
1345 pst_binary rc; 1345 pst_binary rc;
1346 pst_holder h = {&rc.data, NULL, 0, 0, 0}; 1346 pst_holder h = {&rc.data, NULL, 0, 0, 0};
1347 rc.size = 0; 1347 rc.size = 0;
1348 rc.data = NULL; 1348 rc.data = NULL;
1349 ptr = pst_getID(pf, attach->i_id); 1349 ptr = pst_getID(pf, attach->i_id);
1350 if (ptr) { 1350 if (ptr) {
1351 rc.size = pst_ff_getID2data(pf, ptr, &h); 1351 rc.size = pst_ff_getID2data(pf, ptr, &h);
1352 DEBUG_WARN(("attachment %s size was %#"PRIx64", is now %#"PRIx64" based on size of i_id\n", attach->filename2.str, attach->data.size, rc.size)); 1352 if (rc.data) free(rc.data);
1353 attach->data.size = rc.size; 1353 if (rc.size < attach->data.size) {
1354 DEBUG_WARN(("reducing attachment %s size was %#"PRIx64", is now %#"PRIx64" based on size of i_id\n", attach->filename2.str, attach->data.size, rc.size));
1355 attach->data.size = rc.size;
1356 }
1354 } else { 1357 } else {
1355 DEBUG_WARN(("Couldn't find ID pointer. Cannot save attachment to file\n")); 1358 DEBUG_WARN(("Couldn't find ID pointer. Cannot save attachment to file\n"));
1356 } 1359 }
1357 if (rc.data) free(rc.data);
1358 } 1360 }
1359 } else { 1361 } else {
1360 DEBUG_WARN(("have not located the correct value for the attachment [%#"PRIx64"]\n", attach->id2_val)); 1362 DEBUG_WARN(("have not located the correct value for the attachment [%#"PRIx64"]\n", attach->id2_val));
1361 } 1363 }
1362 } else { 1364 } else {