~ubuntu-branches/ubuntu/vivid/grass/vivid-proposed

« back to all changes in this revision

Viewing changes to raster/r.surf.contour/read_cell.c

  • Committer: Package Import Robot
  • Author(s): Bas Couwenberg
  • Date: 2015-02-20 23:12:08 UTC
  • mfrom: (8.2.6 experimental)
  • Revision ID: package-import@ubuntu.com-20150220231208-1u6qvqm84v430b10
Tags: 7.0.0-1~exp1
* New upstream release.
* Update python-ctypes-ternary.patch to use if/else instead of and/or.
* Drop check4dev patch, rely on upstream check.
* Add build dependency on libpq-dev to grass-dev for libpq-fe.h.
* Drop patches applied upstream, refresh remaining patches.
* Update symlinks for images switched from jpg to png.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "contour.h"
 
2
#include <grass/raster.h>
 
3
#include <grass/glocale.h>
 
4
 
 
5
DCELL **read_cell(const char *name)
 
6
{
 
7
    int nrows = Rast_window_rows();
 
8
    int ncols = Rast_window_cols();
 
9
    DCELL *buf, **idx;
 
10
    int fd;
 
11
    int row;
 
12
 
 
13
    fd = Rast_open_old(name, "");
 
14
    
 
15
    buf = G_malloc((size_t) nrows * ncols * sizeof(DCELL));
 
16
    idx = G_malloc(nrows * sizeof(DCELL *));
 
17
    
 
18
    for (row = 0; row < nrows; row++) {
 
19
        idx[row] = &buf[row * ncols];
 
20
 
 
21
        Rast_get_d_row(fd, idx[row], row);
 
22
    }
 
23
    
 
24
    Rast_close(fd);
 
25
    
 
26
    return idx;
 
27
}
 
28
 
 
29
void free_cell(DCELL **idx)
 
30
{
 
31
    G_free(idx[0]);
 
32
    G_free(idx);
 
33
}