87 |
|
return(mp->len > 0); |
88 |
|
} |
89 |
|
|
90 |
+ |
#if defined(_WIN32) || defined(_WIN64) |
91 |
+ |
/* too difficult to fix this */ |
92 |
+ |
#define load_file load_stream |
93 |
+ |
#else |
94 |
|
/* load a file into memory */ |
95 |
|
static int |
96 |
|
load_file(MEMLOAD *mp, FILE *fp) |
97 |
|
{ |
98 |
|
int fd; |
99 |
|
off_t skip, flen, fpos; |
96 |
– |
|
97 |
– |
#if defined(_WIN32) || defined(_WIN64) |
98 |
– |
/* too difficult to fix this */ |
99 |
– |
return load_stream(mp, fp); |
100 |
– |
#endif |
100 |
|
if (mp == NULL) |
101 |
|
return(-1); |
102 |
|
mp->mapped = NULL; |
111 |
|
return((int)(flen - skip)); |
112 |
|
mp->len = (size_t)(flen - skip); |
113 |
|
#ifdef MAP_FILE |
114 |
< |
if (mp->len > 1L<<20) { /* map file if > 1 MByte */ |
114 |
> |
if (mp->len >= 1L<<20) { /* map file if >= 1 MByte */ |
115 |
|
mp->mapped = mmap(NULL, flen, PROT_READ, MAP_PRIVATE, fd, 0); |
116 |
|
if (mp->mapped != MAP_FAILED) { |
117 |
|
mp->base = (char *)mp->mapped + skip; |
137 |
|
} |
138 |
|
return(1); |
139 |
|
} |
140 |
+ |
#endif |
141 |
|
|
142 |
|
/* free a record index */ |
143 |
|
#define free_records(rp) free(rp) |