67 unsigned char compress[4];
80 if (read(fcb->
data_fd, compress, 3) != 3 || compress[0] != 251 ||
81 compress[1] != 255 || compress[2] != 251)
95 static int read_row_ptrs(
int nrows,
int old, off_t *
row_ptr,
int fd)
98 unsigned char *buf, *
b;
110 n = ((
unsigned int)nrows + 1) *
sizeof(off_t);
123 if (read(fd, &
nbytes, 1) != 1)
128 n = ((
unsigned int)nrows + 1) *
nbytes;
130 if (read(fd, buf, n) != n)
133 for (row = 0,
b = buf; row <= (
unsigned int)nrows; row++) {
136 for (n = 0; n <
nbytes; n++) {
137 unsigned char c = *
b++;
139 if (
nbytes >
sizeof(off_t) && n <
nbytes -
sizeof(off_t) && c != 0)
164 G_warning(
_(
"Fail of initial read of compressed file [%s in %s]"),
178 G_warning(
_(
"Fail of initial read of compressed null file [%s in %s]"),
186 static int write_row_ptrs(
int nrows, off_t *
row_ptr,
int fd)
188 int nbytes =
sizeof(off_t);
189 unsigned char *buf, *
b;
190 int len, row, result;
192 lseek(fd, 0L, SEEK_SET);
194 len = (nrows + 1) *
nbytes + 1;
198 for (row = 0; row <= nrows; row++) {
202 for (i =
nbytes - 1; i >= 0; i--) {
210 result = (write(fd, buf, len) == len);
void G_free(void *)
Free allocated memory.
void G_warning(const char *,...) __attribute__((format(printf
#define assert(condition)
int compressed
Compression mode (raster header only)
int rows
Number of rows for 2D data.
struct fileinfo * fileinfo