GRASS GIS 7 Programmer's Manual  7.0.4(2016)-r00000
segment/put.c
Go to the documentation of this file.
1 
15 #include <string.h>
16 #include <grass/gis.h>
17 #include "local_proto.h"
18 
19 
20 /*bugfix: buf: char* vs int* -> wrong pointer arithmetics!!!. Pierre de Mouveaux - 09 april 2000 */
21 /* int Segment_put (SEGMENT *SEG,int *buf,int row,int col) */
22 
23 
45 int Segment_put(SEGMENT * SEG, const void *buf, off_t row, off_t col)
46 {
47  int index, n, i;
48 
49  SEG->address(SEG, row, col, &n, &index);
50  if ((i = seg_pagein(SEG, n)) < 0) {
51  G_warning("segment lib: put: pagein failed");
52  return -1;
53  }
54 
55  SEG->scb[i].dirty = 1;
56 
57  memcpy(&SEG->scb[i].buf[index], buf, SEG->len);
58 
59  return 1;
60 }
int Segment_put(SEGMENT *SEG, const void *buf, off_t row, off_t col)
Definition: segment/put.c:45
int seg_pagein(SEGMENT *SEG, int n)
Internal use only.
Definition: pagein.c:37
void G_warning(const char *msg,...)
Print a warning message to stderr.
Definition: gis/error.c:203