| 45 |
|
long nexpected = (long)dcp->res.xr * dcp->res.yr; |
| 46 |
|
|
| 47 |
|
if (dcp->inpfmt[0]) { |
| 48 |
< |
if (strstr(dcp->inpfmt, "ascii") != NULL) |
| 48 |
> |
if (!strcmp(dcp->inpfmt, "ascii")) |
| 49 |
|
dcp->format = 'a'; |
| 50 |
< |
else if (strstr(dcp->inpfmt, "float") != NULL) |
| 50 |
> |
else if (!strcmp(dcp->inpfmt, "float")) |
| 51 |
|
dcp->format = 'f'; |
| 52 |
< |
else if (strstr(dcp->inpfmt, "double") != NULL) |
| 52 |
> |
else if (!strcmp(dcp->inpfmt, "double")) |
| 53 |
|
dcp->format = 'd'; |
| 54 |
|
else { |
| 55 |
|
fputs(dcp->inpname, stderr); |
| 59 |
|
return 0; |
| 60 |
|
} |
| 61 |
|
} |
| 62 |
+ |
if (dcp->format == 'a') |
| 63 |
+ |
SET_FILE_TEXT(dcp->finp); |
| 64 |
|
|
| 65 |
|
do { |
| 66 |
|
int ok = 0; |
| 258 |
|
} |
| 259 |
|
if (!check_decode_worldpos(dcp)) |
| 260 |
|
return 0; |
| 261 |
< |
|
| 261 |
> |
|
| 262 |
|
while (scanf("%d %d", &xy[0], &xy[1]) == 2) { |
| 263 |
|
loc2pix(xy, &dcp->res, |
| 264 |
|
(xy[0]+.5)/dcp->res.xr, (xy[1]+.5)/dcp->res.yr); |
| 418 |
|
fputs(": cannot open for writing\n", stderr); |
| 419 |
|
return 1; |
| 420 |
|
} |
| 421 |
< |
SET_FILE_BINARY(dc.finp); |
| 422 |
< |
if ((conversion != CV_FWD) | (dc.format != 'a')) |
| 421 |
< |
SET_FILE_BINARY(stdout); |
| 421 |
> |
SET_FILE_BINARY(dc.finp); /* starting assumption */ |
| 422 |
> |
SET_FILE_BINARY(stdout); |
| 423 |
|
#ifdef getc_unlocked /* avoid stupid semaphores */ |
| 424 |
|
flockfile(dc.finp); |
| 425 |
|
flockfile(stdout); |
| 427 |
|
/* read/copy header */ |
| 428 |
|
if (!process_dc_header(&dc, a, argv)) |
| 429 |
|
return 1; |
| 430 |
+ |
|
| 431 |
+ |
if ((conversion != CV_FWD) & (dc.format == 'a')) |
| 432 |
+ |
SET_FILE_TEXT(stdout); |
| 433 |
|
/* process data */ |
| 434 |
|
switch (conversion) { |
| 435 |
|
case CV_FWD: /* distance -> depth code */ |
| 436 |
+ |
if (!strcmp(dc.depth_unit, "1")) { |
| 437 |
+ |
fputs(progname, stderr); |
| 438 |
+ |
fputs(": warning - using reference depth of 1.0\n", |
| 439 |
+ |
stderr); |
| 440 |
+ |
} |
| 441 |
|
if (!encode_depths(&dc)) |
| 442 |
|
return 1; |
| 443 |
|
break; |