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

« back to all changes in this revision

Viewing changes to imagery/i.class/band_files.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 <stdlib.h>
2
 
#include <grass/gis.h>
3
 
#include <grass/glocale.h>
4
 
#include "globals.h"
5
 
 
6
 
 
7
 
/* open and allocate space for the subgroup band files */
8
 
int open_band_files(void)
9
 
{
10
 
    int n, nbands;
11
 
    char *name, *mapset;
12
 
 
13
 
    /* allocate row buffers and open raster maps */
14
 
    nbands = Refer.nfiles;
15
 
    Bandbuf = (CELL **) G_malloc(nbands * sizeof(CELL *));
16
 
    Bandfd = (int *)G_malloc(nbands * sizeof(int));
17
 
    for (n = 0; n < nbands; n++) {
18
 
        Bandbuf[n] = G_allocate_cell_buf();
19
 
        name = Refer.file[n].name;
20
 
        mapset = Refer.file[n].mapset;
21
 
        if ((Bandfd[n] = G_open_cell_old(name, mapset)) < 0)
22
 
            G_fatal_error(_("Unable to open band files."));
23
 
    }
24
 
 
25
 
    return 0;
26
 
}
27
 
 
28
 
 
29
 
/* close and free space for the subgroup band files */
30
 
int close_band_files(void)
31
 
{
32
 
    int n, nbands;
33
 
 
34
 
    nbands = Refer.nfiles;
35
 
    for (n = 0; n < nbands; n++) {
36
 
        G_free(Bandbuf[n]);
37
 
        G_close_cell(Bandfd[n]);
38
 
    }
39
 
    G_free(Bandbuf);
40
 
    G_free(Bandfd);
41
 
 
42
 
    return 0;
43
 
}