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