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) |
456 |
|
if (o_header) { /* finish header? */ |
457 |
|
printf("NROWS=%d\n", no_rows); |
458 |
|
printf("NCOLS=%d\n", no_columns); |
459 |
+ |
fputformat(fmtid, stdout); |
460 |
|
fputc('\n', stdout); |
461 |
|
} |
462 |
|
/* reorder records */ |
501 |
|
printf("NROWS=%d\n", no_rows); |
502 |
|
if (no_columns > 0) |
503 |
|
printf("NCOLS=%d\n", no_columns); |
504 |
+ |
fputformat(fmtid, stdout); |
505 |
|
fputc('\n', stdout); |
506 |
|
} |
507 |
|
/* sanity checks */ |
730 |
|
newheader("RADIANCE", stdout); |
731 |
|
printargs(a, argv, stdout); |
732 |
|
printf("NCOMP=%d\n", n_comp); |
731 |
– |
fputformat(fmtid, stdout); |
733 |
|
} |
734 |
|
if (transpose | check | (outLevels > 1) || (o_header && no_rows <= 0)) { |
735 |
|
MEMLOAD myMem; /* need to map into memory */ |