comparison src/libpst.c @ 148:b47d04257b43

64 bit cleanup in debug messages
author Carl Byington <carl@five-ten-sg.com>
date Thu, 26 Feb 2009 12:42:37 -0800
parents fdc58ad2c758
children f9773b6368e0
comparison
equal deleted inserted replaced
147:369e75d2abb5 148:b47d04257b43
1357 1357
1358 if (block_hdr.type == (uint16_t)0xBCEC) { //type 1 1358 if (block_hdr.type == (uint16_t)0xBCEC) { //type 1
1359 block_type = 1; 1359 block_type = 1;
1360 1360
1361 if (pst_getBlockOffsetPointer(pf, i2_head, &subblocks, block_hdr.offset, &block_offset1)) { 1361 if (pst_getBlockOffsetPointer(pf, i2_head, &subblocks, block_hdr.offset, &block_offset1)) {
1362 DEBUG_WARN(("internal error (bc.b5 offset %#x) in reading block id %#x\n", block_hdr.offset, block_id)); 1362 DEBUG_WARN(("internal error (bc.b5 offset %#x) in reading block id %#"PRIx64"\n", block_hdr.offset, block_id));
1363 freeall(&subblocks, &block_offset1, &block_offset2, &block_offset3, &block_offset4, &block_offset5, &block_offset6, &block_offset7); 1363 freeall(&subblocks, &block_offset1, &block_offset2, &block_offset3, &block_offset4, &block_offset5, &block_offset6, &block_offset7);
1364 DEBUG_RET(); 1364 DEBUG_RET();
1365 return NULL; 1365 return NULL;
1366 } 1366 }
1367 memcpy(&table_rec, block_offset1.from, sizeof(table_rec)); 1367 memcpy(&table_rec, block_offset1.from, sizeof(table_rec));
1376 DEBUG_RET(); 1376 DEBUG_RET();
1377 return NULL; 1377 return NULL;
1378 } 1378 }
1379 1379
1380 if (pst_getBlockOffsetPointer(pf, i2_head, &subblocks, table_rec.value, &block_offset2)) { 1380 if (pst_getBlockOffsetPointer(pf, i2_head, &subblocks, table_rec.value, &block_offset2)) {
1381 DEBUG_WARN(("internal error (bc.b5.desc offset) in reading block id %#x\n", table_rec.value, block_id)); 1381 DEBUG_WARN(("internal error (bc.b5.desc offset #x) in reading block id %#"PRIx64"\n", table_rec.value, block_id));
1382 freeall(&subblocks, &block_offset1, &block_offset2, &block_offset3, &block_offset4, &block_offset5, &block_offset6, &block_offset7); 1382 freeall(&subblocks, &block_offset1, &block_offset2, &block_offset3, &block_offset4, &block_offset5, &block_offset6, &block_offset7);
1383 DEBUG_RET(); 1383 DEBUG_RET();
1384 return NULL; 1384 return NULL;
1385 } 1385 }
1386 list_start = block_offset2.from; 1386 list_start = block_offset2.from;
1390 } 1390 }
1391 else if (block_hdr.type == (uint16_t)0x7CEC) { //type 2 1391 else if (block_hdr.type == (uint16_t)0x7CEC) { //type 2
1392 block_type = 2; 1392 block_type = 2;
1393 1393
1394 if (pst_getBlockOffsetPointer(pf, i2_head, &subblocks, block_hdr.offset, &block_offset3)) { 1394 if (pst_getBlockOffsetPointer(pf, i2_head, &subblocks, block_hdr.offset, &block_offset3)) {
1395 DEBUG_WARN(("internal error (7c.7c offset %#x) in reading block id %#x\n", block_hdr.offset, block_id)); 1395 DEBUG_WARN(("internal error (7c.7c offset %#x) in reading block id %#"PRIx64"\n", block_hdr.offset, block_id));
1396 freeall(&subblocks, &block_offset1, &block_offset2, &block_offset3, &block_offset4, &block_offset5, &block_offset6, &block_offset7); 1396 freeall(&subblocks, &block_offset1, &block_offset2, &block_offset3, &block_offset4, &block_offset5, &block_offset6, &block_offset7);
1397 DEBUG_RET(); 1397 DEBUG_RET();
1398 return NULL; 1398 return NULL;
1399 } 1399 }
1400 fr_ptr = block_offset3.from; //now got pointer to "7C block" 1400 fr_ptr = block_offset3.from; //now got pointer to "7C block"
1420 1420
1421 rec_size = seven_c_blk.rec_size; 1421 rec_size = seven_c_blk.rec_size;
1422 num_list = (int32_t)(unsigned)seven_c_blk.item_count; 1422 num_list = (int32_t)(unsigned)seven_c_blk.item_count;
1423 1423
1424 if (pst_getBlockOffsetPointer(pf, i2_head, &subblocks, seven_c_blk.b_five_offset, &block_offset4)) { 1424 if (pst_getBlockOffsetPointer(pf, i2_head, &subblocks, seven_c_blk.b_five_offset, &block_offset4)) {
1425 DEBUG_WARN(("internal error (7c.b5 offset %#x) in reading block id %#x\n", seven_c_blk.b_five_offset, block_id)); 1425 DEBUG_WARN(("internal error (7c.b5 offset %#x) in reading block id %#"PRIx64"\n", seven_c_blk.b_five_offset, block_id));
1426 freeall(&subblocks, &block_offset1, &block_offset2, &block_offset3, &block_offset4, &block_offset5, &block_offset6, &block_offset7); 1426 freeall(&subblocks, &block_offset1, &block_offset2, &block_offset3, &block_offset4, &block_offset5, &block_offset6, &block_offset7);
1427 DEBUG_RET(); 1427 DEBUG_RET();
1428 return NULL; 1428 return NULL;
1429 } 1429 }
1430 memcpy(&table_rec, block_offset4.from, sizeof(table_rec)); 1430 memcpy(&table_rec, block_offset4.from, sizeof(table_rec));
1449 1449
1450 // this will give the number of records in this block 1450 // this will give the number of records in this block
1451 num_recs = (block_offset5.to - block_offset5.from) / (4 + table_rec.ref_type); 1451 num_recs = (block_offset5.to - block_offset5.from) / (4 + table_rec.ref_type);
1452 1452
1453 if (pst_getBlockOffsetPointer(pf, i2_head, &subblocks, seven_c_blk.ind2_offset, &block_offset6)) { 1453 if (pst_getBlockOffsetPointer(pf, i2_head, &subblocks, seven_c_blk.ind2_offset, &block_offset6)) {
1454 DEBUG_WARN(("internal error (7c.ind2 offset %#x) in reading block id %#x\n", seven_c_blk.ind2_offset, block_id)); 1454 DEBUG_WARN(("internal error (7c.ind2 offset %#x) in reading block id %#"PRIx64"\n", seven_c_blk.ind2_offset, block_id));
1455 freeall(&subblocks, &block_offset1, &block_offset2, &block_offset3, &block_offset4, &block_offset5, &block_offset6, &block_offset7); 1455 freeall(&subblocks, &block_offset1, &block_offset2, &block_offset3, &block_offset4, &block_offset5, &block_offset6, &block_offset7);
1456 DEBUG_RET(); 1456 DEBUG_RET();
1457 return NULL; 1457 return NULL;
1458 } 1458 }
1459 ind2_ptr = block_offset6.from; 1459 ind2_ptr = block_offset6.from;
3776 if (!head) head = i2_ptr; 3776 if (!head) head = i2_ptr;
3777 if (tail) tail->next = i2_ptr; 3777 if (tail) tail->next = i2_ptr;
3778 tail = i2_ptr; 3778 tail = i2_ptr;
3779 if (id2_rec.table2) { 3779 if (id2_rec.table2) {
3780 if ((i_ptr = pst_getID(pf, id2_rec.table2)) == NULL) { 3780 if ((i_ptr = pst_getID(pf, id2_rec.table2)) == NULL) {
3781 DEBUG_WARN(("Table2 [%#x] not found\n", id2_rec.table2)); 3781 DEBUG_WARN(("Table2 [%#"PRIi64"] not found\n", id2_rec.table2));
3782 } 3782 }
3783 else { 3783 else {
3784 DEBUG_INDEX(("Going deeper for table2 [%#x]\n", id2_rec.table2)); 3784 DEBUG_INDEX(("Going deeper for table2 [%#"PRIi64"]\n", id2_rec.table2));
3785 i2_ptr->child = pst_build_id2(pf, i_ptr); 3785 i2_ptr->child = pst_build_id2(pf, i_ptr);
3786 } 3786 }
3787 } 3787 }
3788 } 3788 }
3789 x++; 3789 x++;
4377 */ 4377 */
4378 size_t pst_ff_getIDblock_dec(pst_file *pf, uint64_t id, char **buf) { 4378 size_t pst_ff_getIDblock_dec(pst_file *pf, uint64_t id, char **buf) {
4379 size_t r; 4379 size_t r;
4380 int noenc = (int)(id & 2); // disable encryption 4380 int noenc = (int)(id & 2); // disable encryption
4381 DEBUG_ENT("pst_ff_getIDblock_dec"); 4381 DEBUG_ENT("pst_ff_getIDblock_dec");
4382 DEBUG_INDEX(("for id %#x\n", id)); 4382 DEBUG_INDEX(("for id %#"PRIi64"\n", id));
4383 r = pst_ff_getIDblock(pf, id, buf); 4383 r = pst_ff_getIDblock(pf, id, buf);
4384 if ((pf->encryption) && !(noenc)) { 4384 if ((pf->encryption) && !(noenc)) {
4385 (void)pst_decrypt(id, *buf, r, pf->encryption); 4385 (void)pst_decrypt(id, *buf, r, pf->encryption);
4386 } 4386 }
4387 DEBUG_HEXDUMPC(*buf, r, 16); 4387 DEBUG_HEXDUMPC(*buf, r, 16);
4422 pst_holder h = {buf, NULL, 0}; 4422 pst_holder h = {buf, NULL, 0};
4423 DEBUG_ENT("pst_ff_getID2block"); 4423 DEBUG_ENT("pst_ff_getID2block");
4424 ptr = pst_getID2(id2_head, id2); 4424 ptr = pst_getID2(id2_head, id2);
4425 4425
4426 if (!ptr) { 4426 if (!ptr) {
4427 DEBUG_INDEX(("Cannot find id2 value %#x\n", id2)); 4427 DEBUG_INDEX(("Cannot find id2 value %#"PRIi64"\n", id2));
4428 DEBUG_RET(); 4428 DEBUG_RET();
4429 return 0; 4429 return 0;
4430 } 4430 }
4431 ret = pst_ff_getID2data(pf, ptr->id, &h); 4431 ret = pst_ff_getID2data(pf, ptr->id, &h);
4432 DEBUG_RET(); 4432 DEBUG_RET();