/src/gdal/frmts/pcraster/libcsf/gminval.c
Line | Count | Source (jump to first uncovered line) |
1 | | #include "csf.h" |
2 | | #include "csfimpl.h" |
3 | | |
4 | | /* get minimum cell value |
5 | | * RgetMinVal returns the value stored in |
6 | | * the header as the minimum value. |
7 | | * If the minMaxStatus is MM_WRONGVALUE |
8 | | * then a missing value is returned. |
9 | | * returns 0 if argument minVal is returned with a missing |
10 | | * value, nonzero if not. |
11 | | * |
12 | | * example |
13 | | * .so examples/csfstat.tr |
14 | | */ |
15 | | |
16 | | int RgetMinVal( |
17 | | const MAP *map, /* map handle */ |
18 | | void *minVal) /* write-only. Minimum value or missing value */ |
19 | 0 | { |
20 | | /* use buffer that can hold largest |
21 | | * cell representation |
22 | | */ |
23 | 0 | CSF_VAR_TYPE buf_1; |
24 | 0 | void *buf = (void *)(&buf_1); |
25 | |
|
26 | 0 | CHECKHANDLE(map); |
27 | 0 | CsfGetVarType(buf, &(map->raster.minVal), RgetCellRepr(map)); |
28 | |
|
29 | 0 | map->file2app((size_t)1, buf); |
30 | |
|
31 | 0 | if (map->minMaxStatus == MM_WRONGVALUE) |
32 | 0 | SetMV(map, buf); |
33 | |
|
34 | 0 | CsfGetVarType(minVal, buf, map->appCR); |
35 | |
|
36 | 0 | return((!IsMV(map,minVal)) && |
37 | 0 | map->minMaxStatus!=MM_WRONGVALUE); |
38 | 0 | } |