GRASS Programmer's Manual  6.4.2(2012)
segment/put.c
Go to the documentation of this file.
00001 
00015 #include <string.h>
00016 #include <grass/segment.h>
00017 
00018 
00019 /*bugfix: buf: char* vs int* -> wrong pointer arithmetics!!!. Pierre de Mouveaux - 09 april 2000 */
00020 /* int segment_put (SEGMENT *SEG,int *buf,int row,int col) */
00021 
00022 
00044 int segment_put(SEGMENT * SEG, const void *buf, int row, int col)
00045 {
00046     int index, n, i;
00047 
00048     segment_address(SEG, row, col, &n, &index);
00049     if ((i = segment_pagein(SEG, n)) < 0)
00050         return -1;
00051 
00052     SEG->scb[i].dirty = 1;
00053 
00054     memcpy(&SEG->scb[i].buf[index], buf, SEG->len);
00055 
00056     return 1;
00057 }
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines