GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
segment/put.c
Go to the documentation of this file.
1 
15 #include <string.h>
16 #include <grass/segment.h>
17 
18 
19 /*bugfix: buf: char* vs int* -> wrong pointer arithmetics!!!. Pierre de Mouveaux - 09 april 2000 */
20 /* int segment_put (SEGMENT *SEG,int *buf,int row,int col) */
21 
22 
44 int segment_put(SEGMENT * SEG, const void *buf, int row, int col)
45 {
46  int index, n, i;
47 
48  segment_address(SEG, row, col, &n, &index);
49  if ((i = segment_pagein(SEG, n)) < 0)
50  return -1;
51 
52  SEG->scb[i].dirty = 1;
53 
54  memcpy(&SEG->scb[i].buf[index], buf, SEG->len);
55 
56  return 1;
57 }
int segment_put(SEGMENT *SEG, const void *buf, int row, int col)
Definition: segment/debug.c:86
int segment_pagein(SEGMENT *SEG, int n)
Segment pagein.
Definition: pagein.c:39
int segment_address(const SEGMENT *SEG, int row, int col, int *n, int *index)
Definition: address.c:31
char buf[GNAME_MAX+sizeof(G3D_DIRECTORY)+2]
Definition: g3drange.c:62
int n
Definition: dataquad.c:291