comparison src/readpstlog.c @ 43:f6db1f060a95

start on outlook 2003 64 bit format
author carl
date Sun, 06 Jan 2008 14:47:06 -0800
parents 6fe121a971c9
children b2a7f2e0926a
comparison
equal deleted inserted replaced
42:7a97f50c39c5 43:f6db1f060a95
75 while (!stop) { 75 while (!stop) {
76 if (fread(&x, sizeof(int), 1, fp)<=0) break; 76 if (fread(&x, sizeof(int), 1, fp)<=0) break;
77 ptr = 0; 77 ptr = 0;
78 if (x > 0) { 78 if (x > 0) {
79 if (i) free(i); 79 if (i) free(i);
80 i = (int*)xmalloc(sizeof(int)*(x+1)); 80 i = (off_t*)xmalloc(sizeof(off_t)*(x+1));
81 // plus 1 cause we want to read the offset of the next index 81 // plus 1 cause we want to read the offset of the next index
82 if (get(i, sizeof(int), x+1, fp)==0) { 82 if (get(i, sizeof(off_t), x+1, fp)==0) {
83 // we have reached the end of the debug file 83 // we have reached the end of the debug file
84 printf("oh dear. we must now end\n"); 84 printf("oh dear. we must now end\n");
85 break; 85 break;
86 } 86 }
87 while (ptr < x) { 87 while (ptr < x) {
88 fseek(fp,i[ptr++], SEEK_SET); 88 fseek(fp, i[ptr++], SEEK_SET);
89 get(&rec_type, 1, sizeof(char), fp); 89 get(&rec_type, 1, sizeof(char), fp);
90 if (rec_type == 'L') { 90 if (rec_type == 'L') {
91 get(&lfile_rec, sizeof(lfile_rec), 1, fp); 91 get(&lfile_rec, sizeof(lfile_rec), 1, fp);
92 funcname=lfile_rec.funcname; 92 funcname=lfile_rec.funcname;
93 filename=lfile_rec.filename; 93 filename=lfile_rec.filename;
183 free(buf); 183 free(buf);
184 fclose(fp); 184 fclose(fp);
185 return 0; 185 return 0;
186 } 186 }
187 187
188 size_t get(void * buf, int size, unsigned int count, FILE *fp) { 188 size_t get(void *buf, int size, unsigned int count, FILE *fp) {
189 size_t z; 189 size_t z;
190 if ((z=fread(buf,size, count, fp)) < count) { 190 if ((z=fread(buf, size, count, fp)) < count) {
191 printf("Read Failed! (size=%d, count=%d,z=%ld)\n", size, count, (long)z); 191 printf("Read Failed! (size=%d, count=%d,z=%ld)\n", size, count, (long)z);
192 exit(1); 192 exit(1);
193 } 193 }
194 return z; 194 return z;
195 } 195 }