Coverage Report

Created: 2026-09-26 08:22

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/gdal/frmts/pcraster/libcsf/cellsize.c
Line
Count
Source
1
#include "csf.h"
2
#include "csfimpl.h"
3
4
/* global header (opt.) and cellsize's prototypes "" */
5
6
7
/* headers of this app. modules called */ 
8
9
/***************/
10
/* EXTERNALS   */
11
/***************/
12
13
/**********************/ 
14
/* LOCAL DECLARATIONS */
15
/**********************/ 
16
17
/*********************/ 
18
/* LOCAL DEFINITIONS */
19
/*********************/ 
20
21
/******************/
22
/* IMPLEMENTATION */
23
/******************/
24
25
26
/* get cell size 
27
 * returns the cell size or -1 in case of an error
28
 *
29
 * Merrno
30
 *  ILL_CELLSIZE
31
 *  ILLHANDLE
32
 */
33
REAL8 RgetCellSize(
34
  const MAP *map) /* map handle */
35
1
{
36
1
  CHECKHANDLE(map);
37
1
  if ( map->raster.cellSize != map->raster.cellSizeDupl)
38
1
  {
39
1
    M_ERROR(ILL_CELLSIZE);
40
1
    return -1;
41
1
  }
42
43
0
  return(map->raster.cellSize);
44
1
}
45
46
/* put cell size
47
 * returns the new cell size or -1
48
 * in case of an error.
49
 *
50
 * Merrno
51
 * ILLHANDLE
52
 * NOACCESS
53
 * ILL_CELLSIZE
54
 */
55
REAL8 RputCellSize(
56
  MAP *map, /* map handle */
57
  REAL8 cellSize) /* new cell size */
58
0
{
59
0
  CHECKHANDLE_GOTO(map, error);
60
0
  if(! WRITE_ENABLE(map))
61
0
  {
62
0
    M_ERROR(NOACCESS);
63
0
    goto error;
64
0
  }
65
0
  if (cellSize <= 0.0)
66
0
  {
67
0
    M_ERROR(ILL_CELLSIZE);
68
0
    goto error;
69
0
  }
70
0
  map->raster.cellSize     = cellSize;
71
0
  map->raster.cellSizeDupl = cellSize;
72
0
  return(cellSize);
73
0
error:  return(-1.0);
74
0
}