comparison src/getidblock.c @ 46:b2a7f2e0926a

more fixes for 64 bit format
author carl
date Sat, 12 Jan 2008 15:20:53 -0800
parents 07177825c91b
children f66078abed38
comparison
equal deleted inserted replaced
45:b961bcdadd0e 46:b2a7f2e0926a
67 DEBUG_MAIN(("Loading Index\n")); 67 DEBUG_MAIN(("Loading Index\n"));
68 if (pst_load_index(&pstfile) != 0) { 68 if (pst_load_index(&pstfile) != 0) {
69 DIE(("Error loading file index\n")); 69 DIE(("Error loading file index\n"));
70 } 70 }
71 71
72 // if ((ptr = _pst_getID(&pstfile, id)) == NULL) { 72 // if ((ptr = pst_getID(&pstfile, id)) == NULL) {
73 // DIE(("id not found [%#x]\n", id)); 73 // DIE(("id not found [%#x]\n", id));
74 // } 74 // }
75 75
76 DEBUG_MAIN(("Loading block\n")); 76 DEBUG_MAIN(("Loading block\n"));
77 77
78 if ((readSize = _pst_ff_getIDblock(&pstfile, id, &buf)) <= 0 || buf == NULL) { 78 if ((readSize = pst_ff_getIDblock(&pstfile, id, &buf)) <= 0 || buf == NULL) {
79 // if ((readSize = _pst_read_block_size(&pstfile, ptr->offset, ptr->size, &buf, 1, 1)) < ptr->size) { 79 // if ((readSize = pst_read_block_size(&pstfile, ptr->offset, ptr->size, &buf, 1, 1)) < ptr->size) {
80 DIE(("Error loading block\n")); 80 DIE(("Error loading block\n"));
81 } 81 }
82 if (binary==0) printf("Block %#x, size %#x[%i]\n",id, (unsigned int)readSize, (int) readSize); 82 if (binary==0) printf("Block %#x, size %#x[%i]\n",id, (unsigned int)readSize, (int) readSize);
83 83
84 if (decrypt!=0) 84 if (decrypt!=0)
85 if (_pst_decrypt(buf, readSize, (int)pstfile.encryption) != 0) { 85 if (pst_decrypt(buf, readSize, (int)pstfile.encryption) != 0) {
86 DIE(("Error decrypting block\n")); 86 DIE(("Error decrypting block\n"));
87 } 87 }
88 88
89 DEBUG_MAIN(("Printing block... [id %#x, size %#x]\n", id, readSize)); 89 DEBUG_MAIN(("Printing block... [id %#x, size %#x]\n", id, readSize));
90 if (binary==0) { 90 if (binary==0) {
91 _pst_debug_hexdump(stdout, buf, readSize, 0x10, 0); 91 pst_debug_hexdumper(stdout, buf, readSize, 0x10, 0);
92 } else { 92 } else {
93 if (fwrite(buf, 1, readSize, stdout) != 0) { 93 if (fwrite(buf, 1, readSize, stdout) != 0) {
94 DIE(("Error occured during writing of buf to stdout\n")); 94 DIE(("Error occured during writing of buf to stdout\n"));
95 } 95 }
96 } 96 }
106 break; 106 break;
107 ptr = pst_getNextDptr(ptr); 107 ptr = pst_getNextDptr(ptr);
108 } 108 }
109 if (ptr == NULL) { 109 if (ptr == NULL) {
110 ptr = (pst_desc_ll*)xmalloc(sizeof(pst_desc_ll)); 110 ptr = (pst_desc_ll*)xmalloc(sizeof(pst_desc_ll));
111 ptr->desc = _pst_getID(&pstfile, id); 111 ptr->desc = pst_getID(&pstfile, id);
112 ptr->list_index = NULL; 112 ptr->list_index = NULL;
113 } 113 }
114 if (ptr != NULL) { 114 if (ptr != NULL) {
115 if ((item = _pst_parse_item(&pstfile, ptr)) != NULL) 115 if ((item = pst_parse_item(&pstfile, ptr)) != NULL)
116 _pst_freeItem(item); 116 pst_freeItem(item);
117 } else { 117 } else {
118 DEBUG_MAIN(("item not found with this ID\n")); 118 DEBUG_MAIN(("item not found with this ID\n"));
119 printf("Cannot find the owning Record of this ID. Cannot parse\n"); 119 printf("Cannot find the owning Record of this ID. Cannot parse\n");
120 } 120 }
121 } 121 }