18 #include <grass/gis.h>
19 #include "local_proto.h"
48 memcpy(buf, SEG->cache + ((
size_t)row * SEG->ncols) * SEG->len,
49 SEG->len * SEG->ncols);
54 ncols = SEG->ncols - SEG->spill;
56 size = scols * SEG->len;
58 for (col = 0; col < ncols; col += scols) {
59 SEG->address(SEG, row, col, &n, &index);
60 SEG->seek(SEG, n, index);
62 if (read(SEG->fd, buf, size) != size) {
63 G_warning(
"Segment_get_row: %s", strerror(errno));
72 buf = ((
char *)buf) + size;
74 if ((size = SEG->spill * SEG->len)) {
75 SEG->address(SEG, row, col, &n, &index);
76 SEG->seek(SEG, n, index);
78 if (read(SEG->fd, buf, size) != size) {
79 G_warning(
"Segment_get_row: %s", strerror(errno));
int Segment_get_row(const SEGMENT *SEG, void *buf, off_t row)
void G_warning(const char *msg,...)
Print a warning message to stderr.