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

« back to all changes in this revision

Viewing changes to raster/r.buffer/read_map.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:
21
21
 
22
22
#include <stdlib.h>
23
23
#include "distance.h"
 
24
#include <grass/raster.h>
24
25
#include <grass/glocale.h>
25
26
 
26
27
 
35
36
    register CELL *cell;
36
37
    register MAPTYPE *ptr;
37
38
 
38
 
    map = (MAPTYPE *) G_malloc(window.rows * window.cols * sizeof(MAPTYPE));
39
 
 
40
 
    fd = G_open_cell_old(input, mapset);
41
 
    if (fd < 0)
42
 
        G_fatal_error(_("Unable to open raster map <%s>"), input);
43
 
 
44
 
    cell = G_allocate_cell_buf();
 
39
    map = (MAPTYPE *) G_malloc((size_t) window.rows * window.cols * sizeof(MAPTYPE));
 
40
 
 
41
    fd = Rast_open_old(input, mapset);
 
42
 
 
43
    cell = Rast_allocate_c_buf();
45
44
 
46
45
    ptr = map;
47
46
 
59
58
        hit = 0;
60
59
        G_percent(row, window.rows, 2);
61
60
 
62
 
        if (G_get_c_raster_row(fd, cell, row) < 0)
63
 
            G_fatal_error(_("Unable to read raster map <%s> row %d"),
64
 
                          G_fully_qualified_name(input, mapset), row);
 
61
        Rast_get_c_row(fd, cell, row);
65
62
 
66
63
        for (col = 0; col < window.cols; col++) {
67
64
            if (ZEROFLAG) {
81
78
            }
82
79
            else {              /* use NULL */
83
80
 
84
 
                if ((*ptr++ = !G_is_c_null_value(cell++))) {
 
81
                if ((*ptr++ = !Rast_is_c_null_value(cell++))) {
85
82
                    if (minrow < 0)
86
83
                        minrow = row;
87
84
                    maxrow = row;
99
96
        cell -= window.cols;
100
97
    }
101
98
    G_percent(row, window.rows, 2);
102
 
    G_close_cell(fd);
 
99
    Rast_close(fd);
103
100
    G_free(cell);
104
101
 
105
102
    return 0;