comparison src/readpstlog.c @ 48:f66078abed38

more fixes for 64 bit format
author carl
date Fri, 18 Jan 2008 15:07:12 -0800
parents b2a7f2e0926a
children 034641c26ab9
comparison
equal deleted inserted replaced
47:5fb8d997feed 48:f66078abed38
1 #include "define.h"
2
1 #include <stdio.h> 3 #include <stdio.h>
2 #include <ctype.h> 4 #include <ctype.h>
3 #include <string.h> 5 #include <string.h>
4 6
5 #ifndef _WIN32 7 #ifndef _WIN32
8 10
9 #ifndef __GNUC__ 11 #ifndef __GNUC__
10 # include "XGetopt.h" 12 # include "XGetopt.h"
11 #endif 13 #endif
12 14
13 #include "define.h"
14 15
15 #define BUF_SIZE 4096 16 #define BUF_SIZE 4096
16 17
17 int usage(); 18 int usage();
18 size_t get(void * buf, int size, unsigned int count, FILE *fp); 19 size_t get(void * buf, int size, unsigned int count, FILE *fp);
72 } 73 }
73 74
74 buf = (char*) xmalloc(BUF_SIZE); 75 buf = (char*) xmalloc(BUF_SIZE);
75 76
76 while (!stop) { 77 while (!stop) {
77 if (fread(&x, sizeof(int), 1, fp)<=0) break; 78 off_t temp;
79 if (fread(&temp, sizeof(off_t), 1, fp)<=0) break;
80 x = (int)temp;
78 ptr = 0; 81 ptr = 0;
79 if (x > 0) { 82 if (x > 0) {
80 if (i) free(i); 83 if (i) free(i);
81 i = (off_t*)xmalloc(sizeof(off_t)*(x+1)); 84 i = (off_t*)xmalloc(sizeof(off_t)*(x+1));
82 // plus 1 cause we want to read the offset of the next index 85 // plus 1 cause we want to read the offset of the next index