comparison src/libpst.c @ 123:ab2a11e72250

more cleanup of #include files. common.h is the only file allowed to include system .h files unprotected by autoconf HAVE_ symbols. define.h is the only other file allowed to include system .h files. define.h is never installed; common.h is installed if we are building the shared library.
author Carl Byington <carl@five-ten-sg.com>
date Tue, 03 Feb 2009 10:59:10 -0800
parents bdb38b434c0a
children 23a36ac0514d
comparison
equal deleted inserted replaced
122:bdb38b434c0a 123:ab2a11e72250
18 18
19 #define INDEX_TYPE32 0x0E 19 #define INDEX_TYPE32 0x0E
20 #define INDEX_TYPE32A 0x0F // unknown, but assumed to be similar for now 20 #define INDEX_TYPE32A 0x0F // unknown, but assumed to be similar for now
21 #define INDEX_TYPE64 0x17 21 #define INDEX_TYPE64 0x17
22 #define INDEX_TYPE64A 0x15 // http://sourceforge.net/projects/libpff/ 22 #define INDEX_TYPE64A 0x15 // http://sourceforge.net/projects/libpff/
23 #define INDEX_TYPE_OFFSET (off_t)0x0A 23 #define INDEX_TYPE_OFFSET (uint64_t)0x0A
24 24
25 #define FILE_SIZE_POINTER32 (off_t)0xA8 25 #define FILE_SIZE_POINTER32 (uint64_t)0xA8
26 #define INDEX_POINTER32 (off_t)0xC4 26 #define INDEX_POINTER32 (uint64_t)0xC4
27 #define INDEX_BACK32 (off_t)0xC0 27 #define INDEX_BACK32 (uint64_t)0xC0
28 #define SECOND_POINTER32 (off_t)0xBC 28 #define SECOND_POINTER32 (uint64_t)0xBC
29 #define SECOND_BACK32 (off_t)0xB8 29 #define SECOND_BACK32 (uint64_t)0xB8
30 #define ENC_TYPE32 (off_t)0x1CD 30 #define ENC_TYPE32 (uint64_t)0x1CD
31 31
32 #define FILE_SIZE_POINTER64 (off_t)0xB8 32 #define FILE_SIZE_POINTER64 (uint64_t)0xB8
33 #define INDEX_POINTER64 (off_t)0xF0 33 #define INDEX_POINTER64 (uint64_t)0xF0
34 #define INDEX_BACK64 (off_t)0xE8 34 #define INDEX_BACK64 (uint64_t)0xE8
35 #define SECOND_POINTER64 (off_t)0xE0 35 #define SECOND_POINTER64 (uint64_t)0xE0
36 #define SECOND_BACK64 (off_t)0xD8 36 #define SECOND_BACK64 (uint64_t)0xD8
37 #define ENC_TYPE64 (off_t)0x201 37 #define ENC_TYPE64 (uint64_t)0x201
38 38
39 #define FILE_SIZE_POINTER ((pf->do_read64) ? FILE_SIZE_POINTER64 : FILE_SIZE_POINTER32) 39 #define FILE_SIZE_POINTER ((pf->do_read64) ? FILE_SIZE_POINTER64 : FILE_SIZE_POINTER32)
40 #define INDEX_POINTER ((pf->do_read64) ? INDEX_POINTER64 : INDEX_POINTER32) 40 #define INDEX_POINTER ((pf->do_read64) ? INDEX_POINTER64 : INDEX_POINTER32)
41 #define INDEX_BACK ((pf->do_read64) ? INDEX_BACK64 : INDEX_BACK32) 41 #define INDEX_BACK ((pf->do_read64) ? INDEX_BACK64 : INDEX_BACK32)
42 #define SECOND_POINTER ((pf->do_read64) ? SECOND_POINTER64 : SECOND_POINTER32) 42 #define SECOND_POINTER ((pf->do_read64) ? SECOND_POINTER64 : SECOND_POINTER32)
811 } 811 }
812 return r; 812 return r;
813 } 813 }
814 814
815 815
816 int pst_build_id_ptr(pst_file *pf, off_t offset, int32_t depth, uint64_t linku1, uint64_t start_val, uint64_t end_val) { 816 int pst_build_id_ptr(pst_file *pf, uint64_t offset, int32_t depth, uint64_t linku1, uint64_t start_val, uint64_t end_val) {
817 struct pst_table_ptr_structn table, table2; 817 struct pst_table_ptr_structn table, table2;
818 pst_index_ll *i_ptr=NULL; 818 pst_index_ll *i_ptr=NULL;
819 pst_index index; 819 pst_index index;
820 int32_t x, item_count; 820 int32_t x, item_count;
821 uint64_t old = start_val; 821 uint64_t old = start_val;
924 DEBUG_RET(); 924 DEBUG_RET();
925 return 0; 925 return 0;
926 } 926 }
927 927
928 928
929 int pst_build_desc_ptr (pst_file *pf, off_t offset, int32_t depth, uint64_t linku1, uint64_t start_val, uint64_t end_val) { 929 int pst_build_desc_ptr (pst_file *pf, uint64_t offset, int32_t depth, uint64_t linku1, uint64_t start_val, uint64_t end_val) {
930 struct pst_table_ptr_structn table, table2; 930 struct pst_table_ptr_structn table, table2;
931 pst_descn desc_rec; 931 pst_descn desc_rec;
932 int32_t item_count; 932 int32_t item_count;
933 uint64_t old = start_val; 933 uint64_t old = start_val;
934 int x; 934 int x;
4116 * @param size size of the block to be read 4116 * @param size size of the block to be read
4117 * @param buf reference to pointer to buffer. If this pointer 4117 * @param buf reference to pointer to buffer. If this pointer
4118 is non-NULL, it will first be free()d 4118 is non-NULL, it will first be free()d
4119 * @return size of block read into memory 4119 * @return size of block read into memory
4120 */ 4120 */
4121 size_t pst_read_block_size(pst_file *pf, off_t offset, size_t size, char **buf) { 4121 size_t pst_read_block_size(pst_file *pf, uint64_t offset, size_t size, char **buf) {
4122 size_t rsize; 4122 size_t rsize;
4123 DEBUG_ENT("pst_read_block_size"); 4123 DEBUG_ENT("pst_read_block_size");
4124 DEBUG_READ(("Reading block from %#"PRIx64", %x bytes\n", offset, size)); 4124 DEBUG_READ(("Reading block from %#"PRIx64", %x bytes\n", offset, size));
4125 4125
4126 if (*buf) { 4126 if (*buf) {
4208 return buf32; 4208 return buf32;
4209 } 4209 }
4210 } 4210 }
4211 4211
4212 4212
4213 uint64_t pst_getIntAtPos(pst_file *pf, off_t pos ) { 4213 uint64_t pst_getIntAtPos(pst_file *pf, uint64_t pos ) {
4214 uint64_t buf64; 4214 uint64_t buf64;
4215 uint32_t buf32; 4215 uint32_t buf32;
4216 if (pf->do_read64) { 4216 if (pf->do_read64) {
4217 (void)pst_getAtPos(pf, pos, &buf64, sizeof(buf64)); 4217 (void)pst_getAtPos(pf, pos, &buf64, sizeof(buf64));
4218 LE64_CPU(buf64); 4218 LE64_CPU(buf64);
4233 * @param buf buffer to contain the data 4233 * @param buf buffer to contain the data
4234 * @param size size of the buffer and the amount of data to be read 4234 * @param size size of the buffer and the amount of data to be read
4235 * @return actual read size, 0 if seek error 4235 * @return actual read size, 0 if seek error
4236 */ 4236 */
4237 4237
4238 size_t pst_getAtPos(pst_file *pf, off_t pos, void* buf, size_t size) { 4238 size_t pst_getAtPos(pst_file *pf, uint64_t pos, void* buf, size_t size) {
4239 size_t rc; 4239 size_t rc;
4240 DEBUG_ENT("pst_getAtPos"); 4240 DEBUG_ENT("pst_getAtPos");
4241 // pst_block_recorder **t = &pf->block_head; 4241 // pst_block_recorder **t = &pf->block_head;
4242 // pst_block_recorder *p = pf->block_head; 4242 // pst_block_recorder *p = pf->block_head;
4243 // while (p && ((p->offset+p->size) <= pos)) { 4243 // while (p && ((p->offset+p->size) <= pos)) {