2 #include <grass/glocale.h>
6 #include <grass/config.h>
69 unsigned char compress[4];
81 if (fcb->
cellhd.compressed < 0) {
82 if (read(fd, compress, 3) != 3
83 || compress[0] != 251 || compress[1] != 255 || compress[2] != 251)
84 fcb->
cellhd.compressed = 0;
87 if (!fcb->
cellhd.compressed)
100 int nrows = fcb->
cellhd.rows;
102 unsigned char *
buf, *
b;
111 if (fcb->
cellhd.compressed < 0) {
112 n = (nrows + 1) *
sizeof(off_t);
125 if (read(fd, &nbytes, 1) != 1)
130 n = (nrows + 1) * nbytes;
132 if (read(fd, buf, n) != n)
135 for (row = 0, b = buf; row <= nrows; row++) {
138 for (n = 0; n < (
int)nbytes; n++) {
139 unsigned char c = *b++;
141 if (nbytes >
sizeof(off_t) && n < nbytes -
sizeof(off_t) &&
157 G_warning(_(
"Fail of initial read of compressed file [%s in %s]"),
165 int nrows = fcb->
cellhd.rows;
166 int nbytes =
sizeof(off_t);
167 unsigned char *
buf, *
b;
168 int len, row, result;
170 lseek(fd, 0L, SEEK_SET);
172 len = (nrows + 1) * nbytes + 1;
173 b = buf = G_malloc(len);
176 for (row = 0; row <= nrows; row++) {
180 for (i = nbytes - 1; i >= 0; i--) {
188 result = (write(fd, buf, len) == len);
void G_free(void *buf)
Free allocated memory.
char buf[GNAME_MAX+sizeof(G3D_DIRECTORY)+2]
struct fileinfo * fileinfo
G_warning("category support for [%s] in mapset [%s] %s", name, mapset, type)