GRASS 8 Programmer's Manual 8.6.0dev(2026)-1878fdfec5
Loading...
Searching...
No Matches
raster/put_row.c
Go to the documentation of this file.
1/*!
2 \file lib/raster/put_row.c
3
4 \brief Raster library - Put raster row
5
6 SPDX-FileCopyrightText: 2003-2009 GRASS Development Team
7 SPDX-License-Identifier: GPL-2.0-or-later
8
9 \author Original author CERL
10 */
11
12/**********************************************************************
13
14 **********************************************************************/
15
16#include <string.h>
17
18#include <sys/types.h>
19#include <sys/stat.h>
20#include <unistd.h>
21#include <fcntl.h>
22#include <errno.h>
23
24#include <grass/config.h>
25#include <grass/raster.h>
26#include <grass/glocale.h>
27
28#include "R.h"
29
30static void put_raster_row(int, const void *, RASTER_MAP_TYPE, int);
31
32/*!
33 \brief Writes the next row for cell/fcell/dcell file
34
35 Writes the next row for the cell file opened on 'fd' from 'buf' All
36 writes go into NEW files that exactly match the current window. The
37 file must have been opened with Rast_open_new() and be written
38 sequentially, ie no skipping rows.
39
40 When the null values are embedded into the data, corresponding cells
41 are changed to 0's and the corresponding null value row is written
42 into null file.
43
44 A map cannot be copied using Rast_get_row() and
45 Rast_put_row(). The former resamples the data of the original
46 map into a row buffer that matches the current window. The later
47 writes out rows associated with the window.
48
49 Keeps track of the minimum and maximum cell value for use in
50 updating the range file upon close of the cell file. HOWEVER when
51 nulls are not embedded, the cells are considered 0's as far as
52 updating range is concerned, even if the corresponding cell is null
53 in the resulting null file, so programmer should be careful to set
54 all the null values using Rast_set_null_value() or
55 G_insert_d_null_values() or G_insert_f_null_values().
56
57 \param fd file descriptor where data is to be written
58 \param buf buffer holding data
59 \param data_type raster map type (CELL_TYPE, FCELL_TYPE, DCELL_TYPE)
60
61 \return void
62 */
63void Rast_put_row(int fd, const void *buf, RASTER_MAP_TYPE data_type)
64{
65 put_raster_row(fd, buf, data_type, 0);
66}
67
68/*!
69 \brief Writes the next row for cell file (CELL version)
70
71 See Rast_put_row() for details.
72
73 \param fd file descriptor where data is to be written
74 \param buf buffer holding data
75
76 \return void
77 */
78void Rast_put_c_row(int fd, const CELL *buf)
79{
80 Rast_put_row(fd, buf, CELL_TYPE);
81}
82
83/*!
84 \brief Writes the next row for fcell file (FCELL version)
85
86 See Rast_put_row() for details.
87
88 \param fd file descriptor where data is to be written
89 \param buf buffer holding data
90
91 \return void
92 */
93void Rast_put_f_row(int fd, const FCELL *buf)
94{
95 Rast_put_row(fd, buf, FCELL_TYPE);
96}
97
98/*!
99 \brief Writes the next row for dcell file (DCELL version)
100
101 See Rast_put_row() for details.
102
103 \param fd file descriptor where data is to be written
104 \param buf buffer holding data
105
106 \return void
107 */
108void Rast_put_d_row(int fd, const DCELL *buf)
109{
110 Rast_put_row(fd, buf, DCELL_TYPE);
111}
112
113static void write_data(int fd, int row, unsigned char *buf, int n)
114{
115 struct fileinfo *fcb = &R__.fileinfo[fd];
116 ssize_t nwrite = (ssize_t)fcb->nbytes * n;
117
118 if (write(fcb->data_fd, buf, nwrite) != nwrite)
120 _("Error writing uncompressed FP data for row %d of <%s>: %s"), row,
122}
123
124static void write_data_compressed(int fd, int row, unsigned char *buf, int n,
125 int compressor)
126{
127 struct fileinfo *fcb = &R__.fileinfo[fd];
128 int nwrite = fcb->nbytes * n;
129
130 if (G_write_compressed(fcb->data_fd, buf, nwrite, compressor) < 0)
132 _("Error writing compressed FP data for row %d of <%s>: %s"), row,
134}
135
136static void set_file_pointer(int fd, int row)
137{
138 struct fileinfo *fcb = &R__.fileinfo[fd];
139
140 fcb->row_ptr[row] = lseek(fcb->data_fd, 0L, SEEK_CUR);
141 if (fcb->row_ptr[row] == -1) {
142 int err = errno;
143 G_fatal_error(_("File read/write operation failed: %s (%d)"),
144 strerror(err), err);
145 }
146}
147
148static void convert_float(float *work_buf, char *null_buf, const FCELL *rast,
149 int n)
150{
151 int i;
152
153 for (i = 0; i < n; i++) {
154 FCELL f;
155
156 /* substitute embedded null vals by 0's */
157 if (Rast_is_f_null_value(&rast[i])) {
158 f = 0.;
159 null_buf[i] = 1;
160 }
161 else
162 f = rast[i];
163
164 G_xdr_put_float(&work_buf[i], &f);
165 }
166}
167
168static void convert_double(double *work_buf, char *null_buf, const DCELL *rast,
169 int n)
170{
171 int i;
172
173 for (i = 0; i < n; i++) {
174 DCELL d;
175
176 /* substitute embedded null vals by 0's */
177 if (Rast_is_d_null_value(&rast[i])) {
178 d = 0.;
179 null_buf[i] = 1;
180 }
181 else
182 d = rast[i];
183
184 G_xdr_put_double(&work_buf[i], &d);
185 }
186}
187
188/* writes data to fcell file for either full or partial rows */
189static void put_fp_data(int fd, char *null_buf, const void *rast, int row,
190 int n, RASTER_MAP_TYPE data_type)
191{
192 struct fileinfo *fcb = &R__.fileinfo[fd];
193 int compressed = (fcb->open_mode == OPEN_NEW_COMPRESSED);
194 int size = fcb->nbytes * fcb->cellhd.cols;
195 void *work_buf;
196
197 if (row < 0 || row >= fcb->cellhd.rows)
198 return;
199
200 if (n <= 0)
201 return;
202
203 work_buf = G_malloc(size + 1);
204
205 if (compressed)
206 set_file_pointer(fd, row);
207
208 if (data_type == FCELL_TYPE)
209 convert_float(work_buf, null_buf, rast, n);
210 else
211 convert_double(work_buf, null_buf, rast, n);
212
213 if (compressed)
214 write_data_compressed(fd, row, work_buf, n, fcb->cellhd.compressed);
215 else
216 write_data(fd, row, work_buf, n);
217
219}
220
221static void convert_int(unsigned char *wk, char *null_buf, const CELL *rast,
222 int n, int len, int zeros_r_nulls)
223{
224 int i;
225
226 /* transform CELL data into non-machine dependent multi-byte format */
227
228 for (i = 0; i < n; i++) {
229 CELL v = rast[i];
230 int neg;
231 int k;
232
233 /* substitute embedded null vals by 0's */
234 if (Rast_is_c_null_value(&v)) {
235 v = 0;
236 null_buf[i] = 1;
237 }
238 else if (zeros_r_nulls && !v)
239 null_buf[i] = 1;
240
241 /* negatives */
242 if (v < 0) {
243 neg = 1;
244 v = -v;
245 }
246 else
247 neg = 0;
248
249 /* copy byte by byte */
250 for (k = len - 1; k >= 0; k--) {
251 wk[k] = v & 0xff;
252 v >>= 8;
253 }
254
255 /* set negative bit in first byte */
256 if (neg)
257 wk[0] |= 0x80;
258
259 wk += len;
260 }
261}
262
263static int count_bytes(const unsigned char *wk, int n, int len)
264{
265 int i, j;
266
267 for (i = 0; i < len - 1; i++)
268 for (j = 0; j < n; j++)
269 if (wk[j * len + i] != 0)
270 return len - i;
271
272 return 1;
273}
274
275static void trim_bytes(unsigned char *wk, int n, int slen, int trim)
276{
277 unsigned char *wk2 = wk;
278 int i, j;
279
280 for (i = 0; i < n; i++) {
281 for (j = 0; j < trim; j++)
282 wk++;
283 for (; j < slen; j++)
284 *wk2++ = *wk++;
285 }
286}
287
288static int same(const unsigned char *x, const unsigned char *y, int n)
289{
290 return (memcmp(x, y, n) == 0);
291}
292
293static int count_run(const unsigned char *src, int n, int nbytes)
294{
295 const unsigned char *cur = src + nbytes;
296 int i;
297
298 for (i = 1; i < n; i++) {
299 if (i == 255 || !same(cur, src, nbytes))
300 return i;
301
302 cur += nbytes;
303 }
304
305 return n;
306}
307
308static int rle_compress(unsigned char *dst, unsigned char *src, int n,
309 int nbytes)
310{
311 int nwrite = 0;
312 int total = nbytes * n;
313
314 while (n > 0) {
315 int count;
316
317 nwrite += nbytes + 1;
318 if (nwrite >= total)
319 return 0;
320
321 count = count_run(src, n, nbytes);
322
323 *dst++ = count;
324 memcpy(dst, src, nbytes);
325 dst += nbytes;
326
327 src += count * nbytes;
328 n -= count;
329 }
330
331 return (nwrite >= total) ? 0 : nwrite;
332}
333
334static void put_data(int fd, char *null_buf, const CELL *cell, int row, int n,
335 int zeros_r_nulls)
336{
337 struct fileinfo *fcb = &R__.fileinfo[fd];
338 int compressed = (fcb->open_mode == OPEN_NEW_COMPRESSED);
339 int len = compressed ? (int)sizeof(CELL) : fcb->nbytes;
340 unsigned char *work_buf, *wk;
342
343 if (row < 0 || row >= fcb->cellhd.rows)
344 return;
345
346 if (n <= 0)
347 return;
348
349 work_buf = G_malloc(fcb->cellhd.cols * sizeof(CELL) + 1);
350 wk = work_buf;
351
352 if (compressed)
353 set_file_pointer(fd, row);
354
355 if (compressed)
356 wk++;
357
358 convert_int(wk, null_buf, cell, n, len, zeros_r_nulls);
359
360 if (compressed) {
361 int nbytes = count_bytes(wk, n, len);
362 unsigned char *compressed_buf;
363 int total, cmax;
364
365 if (fcb->nbytes < nbytes)
366 fcb->nbytes = nbytes;
367
368 /* first trim away zero high bytes */
369 if (nbytes < len)
370 trim_bytes(wk, n, len, len - nbytes);
371
372 total = nbytes * n;
373 /* get upper bound of compressed size */
374 if (fcb->cellhd.compressed == 1)
375 cmax = total;
376 else
377 cmax = G_compress_bound(total, fcb->cellhd.compressed);
378 compressed_buf = G_malloc(cmax + 1);
379
381
382 /* then compress the data */
383 if (fcb->cellhd.compressed == 1)
384 nwrite = rle_compress(compressed_buf + 1, work_buf + 1, n, nbytes);
385 else {
386 nwrite = G_compress(work_buf + 1, total, compressed_buf + 1, cmax,
387 fcb->cellhd.compressed);
388 }
389
390 if (nwrite >= total)
391 nwrite = 0;
392
393 if (nwrite > 0) {
394 nwrite++;
395
396 if (write(fcb->data_fd, compressed_buf, nwrite) != nwrite)
398 _("Error writing compressed data for row %d of <%s>: %s"),
399 row, fcb->name, strerror(errno));
400 }
401 else {
402 nwrite = nbytes * n + 1;
403 if (write(fcb->data_fd, work_buf, nwrite) != nwrite)
405 _("Error writing compressed data for row %d of <%s>: %s"),
406 row, fcb->name, strerror(errno));
407 }
408
410 }
411 else {
412 nwrite = (ssize_t)fcb->nbytes * n;
413
414 if (write(fcb->data_fd, work_buf, nwrite) != nwrite)
416 _("Error writing uncompressed data for row %d of <%s>: %s"),
417 row, fcb->name, strerror(errno));
418 }
419
421}
422
423static void put_data_gdal(int fd, const void *rast, int row, int n,
425{
426 struct fileinfo *fcb = &R__.fileinfo[fd];
427 int size = Rast_cell_size(map_type);
428 DCELL null_val = fcb->gdal->null_val;
429 const void *src;
430 void *work_buf, *dst;
432 CPLErr err;
433 int i;
434
435 if (row < 0 || row >= fcb->cellhd.rows)
436 return;
437
438 if (n <= 0)
439 return;
440
441 work_buf = G_malloc(n * size);
442
444 switch (map_type) {
445 case CELL_TYPE:
447 break;
448 case FCELL_TYPE:
450 break;
451 case DCELL_TYPE:
453 break;
454 }
455
456 src = rast;
457 dst = work_buf;
458
459 for (i = 0; i < n; i++) {
460 if (Rast_is_null_value(src, map_type) ||
461 (zeros_r_nulls && !*(CELL *)src))
462 Rast_set_d_value(dst, null_val, map_type);
463 else
464 memcpy(dst, src, size);
465 src = G_incr_void_ptr(src, size);
466 dst = G_incr_void_ptr(dst, size);
467 }
468
469 err = Rast_gdal_raster_IO(fcb->gdal->band, GF_Write, 0, row, n, 1, work_buf,
470 n, 1, datatype, 0, 0);
471
473
474 if (err != CE_None)
475 G_fatal_error(_("Error writing data via GDAL for row %d of <%s>"), row,
476 fcb->name);
477}
478
479static void put_raster_data(int fd, char *null_buf, const void *rast, int row,
481{
482 struct fileinfo *fcb = &R__.fileinfo[fd];
483
484 if (fcb->gdal)
485 put_data_gdal(fd, rast, row, n, zeros_r_nulls, map_type);
486 else if (map_type == CELL_TYPE)
487 put_data(fd, null_buf, rast, row, n, zeros_r_nulls);
488 else
489 put_fp_data(fd, null_buf, rast, row, n, map_type);
490}
491
492static void put_null_value_row(int fd, const char *flags)
493{
494 struct fileinfo *fcb = &R__.fileinfo[fd];
495
496 if (fcb->gdal)
498 _("GDAL output doesn't support writing null rows separately"));
499
500 if (fcb->null_fd < 0)
501 G_fatal_error(_("No null file for <%s>"), fcb->name);
502
503 Rast__convert_01_flags(flags, fcb->null_bits, fcb->cellhd.cols);
504
505 Rast__write_null_bits(fd, fcb->null_bits);
506}
507
508static void write_null_bits_compressed(const unsigned char *flags, int row,
509 size_t size, int fd)
510{
511 struct fileinfo *fcb = &R__.fileinfo[fd];
512 unsigned char *compressed_buf;
514 size_t cmax;
515 int res;
516
517 fcb->null_row_ptr[row] = lseek(fcb->null_fd, 0L, SEEK_CUR);
518 if (fcb->null_row_ptr[row] == -1) {
519 int err = errno;
520 G_fatal_error(_("File read/write operation failed: %s (%d)"),
521 strerror(err), err);
522 }
523
524 /* get upper bound of compressed size */
525 cmax = G_compress_bound(size, 3);
526 compressed_buf = G_malloc(cmax);
527
528 /* compress null bits file with LZ4, see lib/gis/compress.h */
529 nwrite = G_compress((unsigned char *)flags, size, compressed_buf, cmax, 3);
530
531 if (nwrite > 0 && (size_t)nwrite < size) {
532 if ((res = write(fcb->null_fd, compressed_buf, nwrite)) < 0 ||
533 (unsigned int)res != nwrite)
535 _("Error writing compressed null data for row %d of <%s>: %s"),
536 row, fcb->name, strerror(errno));
537 }
538 else {
539 if ((res = write(fcb->null_fd, flags, size)) < 0 ||
540 (unsigned int)res != size)
542 _("Error writing compressed null data for row %d of <%s>: %s"),
543 row, fcb->name, strerror(errno));
544 }
545
547}
548
549/*!
550 \brief Write null data
551
552 \param flags ?
553 \param row row number
554 \param col col number
555 \param fd file descriptor of cell data file
556
557 \return void
558 */
559void Rast__write_null_bits(int fd, const unsigned char *flags)
560{
561 struct fileinfo *fcb = &R__.fileinfo[fd];
562 int row = fcb->null_cur_row++;
563 off_t offset;
564 size_t size;
565 int res;
566
567 size = Rast__null_bitstream_size(fcb->cellhd.cols);
568
569 if (fcb->null_row_ptr) {
570 write_null_bits_compressed(flags, row, size, fd);
571 return;
572 }
573
574 offset = (off_t)size * row;
575
576 if (lseek(fcb->null_fd, offset, SEEK_SET) == -1)
577 G_fatal_error(_("Error writing null row %d of <%s>"), row, fcb->name);
578
579 if ((res = write(fcb->null_fd, flags, size)) < 0 ||
580 (unsigned int)res != size)
581 G_fatal_error(_("Error writing null row %d of <%s>: %s"), row,
583}
584
585static void convert_and_write_if(int fd, const void *vbuf)
586{
587 const CELL *buf = vbuf;
588 struct fileinfo *fcb = &R__.fileinfo[fd];
589 FCELL *p = (FCELL *)fcb->data;
590 int i;
591
592 for (i = 0; i < fcb->cellhd.cols; i++)
593 if (Rast_is_c_null_value(&buf[i]))
594 Rast_set_f_null_value(&p[i], 1);
595 else
596 p[i] = (FCELL)buf[i];
597
598 Rast_put_f_row(fd, p);
599}
600
601static void convert_and_write_df(int fd, const void *vbuf)
602{
603 const DCELL *buf = vbuf;
604 struct fileinfo *fcb = &R__.fileinfo[fd];
605 FCELL *p = (FCELL *)fcb->data;
606 int i;
607
608 for (i = 0; i < fcb->cellhd.cols; i++)
609 if (Rast_is_d_null_value(&buf[i]))
610 Rast_set_f_null_value(&p[i], 1);
611 else
612 p[i] = (FCELL)buf[i];
613
614 Rast_put_f_row(fd, p);
615}
616
617static void convert_and_write_id(int fd, const void *vbuf)
618{
619 const CELL *buf = vbuf;
620 struct fileinfo *fcb = &R__.fileinfo[fd];
621 DCELL *p = (DCELL *)fcb->data;
622 int i;
623
624 for (i = 0; i < fcb->cellhd.cols; i++)
625 if (Rast_is_c_null_value(&buf[i]))
626 Rast_set_d_null_value(&p[i], 1);
627 else
628 p[i] = (DCELL)buf[i];
629
630 Rast_put_d_row(fd, p);
631}
632
633static void convert_and_write_fd(int fd, const void *vbuf)
634{
635 const FCELL *buf = vbuf;
636 struct fileinfo *fcb = &R__.fileinfo[fd];
637 DCELL *p = (DCELL *)fcb->data;
638 int i;
639
640 for (i = 0; i < fcb->cellhd.cols; i++)
641 if (Rast_is_f_null_value(&buf[i]))
642 Rast_set_d_null_value(&p[i], 1);
643 else
644 p[i] = (DCELL)buf[i];
645
646 Rast_put_d_row(fd, p);
647}
648
649static void convert_and_write_fi(int fd, const void *vbuf)
650{
651 const FCELL *buf = vbuf;
652 struct fileinfo *fcb = &R__.fileinfo[fd];
653 CELL *p = (CELL *)fcb->data;
654 int i;
655
656 for (i = 0; i < fcb->cellhd.cols; i++)
657 if (Rast_is_f_null_value(&buf[i]))
658 Rast_set_c_null_value(&p[i], 1);
659 else
660 p[i] = (CELL)buf[i];
661
662 Rast_put_c_row(fd, p);
663}
664
665static void convert_and_write_di(int fd, const void *vbuf)
666{
667 const DCELL *buf = vbuf;
668 struct fileinfo *fcb = &R__.fileinfo[fd];
669 CELL *p = (CELL *)fcb->data;
670 int i;
671
672 for (i = 0; i < fcb->cellhd.cols; i++)
673 if (Rast_is_d_null_value(&buf[i]))
674 Rast_set_c_null_value(&p[i], 1);
675 else
676 p[i] = (CELL)buf[i];
677
678 Rast_put_c_row(fd, p);
679}
680
681/*!
682 \brief converts a buffer of zero's and ones to bitstream.
683
684 Stores this bitstream in memory. (the null rows from memory are
685 written into null file after the limit is reached, and the place for
686 new null rows to be kept in memory is freed. Should not be used by
687 application programs.
688
689 \param fd file descriptor where data is to be written
690 \param buf buffer holding null data
691
692 \return void
693 */
694static void put_raster_row(int fd, const void *buf, RASTER_MAP_TYPE data_type,
695 int zeros_r_nulls)
696{
697 static void (*convert_and_write_FtypeOtype[3][3])(int, const void *) = {
698 {NULL, convert_and_write_if, convert_and_write_id},
699 {convert_and_write_fi, NULL, convert_and_write_fd},
700 {convert_and_write_di, convert_and_write_df, NULL}};
701 struct fileinfo *fcb = &R__.fileinfo[fd];
702 char *null_buf;
703
704 switch (fcb->open_mode) {
705 case OPEN_OLD:
706 G_fatal_error(_("put_raster_row: raster map <%s> not open for write - "
707 "request ignored"),
708 fcb->name);
709 break;
712 break;
713 default:
715 _("put_raster_row: unopened file descriptor - request ignored"));
716 break;
717 }
718
719 if (fcb->map_type != data_type) {
720 convert_and_write_FtypeOtype[data_type][fcb->map_type](fd, buf);
721 return;
722 }
723
724 null_buf = G_malloc(fcb->cellhd.cols);
725 G_zero(null_buf, fcb->cellhd.cols);
726
727 put_raster_data(fd, null_buf, buf, fcb->cur_row, fcb->cellhd.cols,
728 zeros_r_nulls, data_type);
729
730 /* only for integer maps */
731 if (data_type == CELL_TYPE) {
732 if (fcb->want_histogram)
733 Rast_update_cell_stats(buf, fcb->cellhd.cols, &fcb->statf);
734 Rast__row_update_range(buf, fcb->cellhd.cols, &fcb->range,
736 }
737 else
738 Rast_row_update_fp_range(buf, fcb->cellhd.cols, &fcb->fp_range,
739 data_type);
740
741 fcb->cur_row++;
742
743 /* write the null row for the data row */
744 if (!fcb->gdal)
745 put_null_value_row(fd, null_buf);
746
748}
#define OPEN_NEW_COMPRESSED
Definition R.h:102
#define OPEN_NEW_UNCOMPRESSED
Definition R.h:103
#define OPEN_OLD
Definition R.h:101
#define NULL
Definition ccmath.h:32
AMI_err name(char **stream_name)
Definition ami_stream.h:426
struct compressor_list compressor[]
Definition compress.h:53
void G_xdr_put_float(void *, const float *)
Definition gis/xdr.c:82
void G_zero(void *, int)
Zero out a buffer, buf, of length i.
Definition gis/zero.c:21
void G_free(void *)
Free allocated memory.
Definition gis/alloc.c:145
void void void void G_fatal_error(const char *,...) __attribute__((format(printf
#define G_malloc(n)
Definition defs/gis.h:136
int G_compress(unsigned char *, int, unsigned char *, int, int)
Definition compress.c:215
void G_xdr_put_double(void *, const double *)
Definition gis/xdr.c:92
int G_write_compressed(int, unsigned char *, int, int)
Definition compress.c:320
#define G_incr_void_ptr(ptr, size)
Definition defs/gis.h:78
int G_compress_bound(int, int)
Definition compress.c:199
int Rast_is_null_value(const void *, RASTER_MAP_TYPE)
To check if a raster value is set to NULL.
Definition null_val.c:174
void Rast__row_update_range(const CELL *, int, struct Range *, int)
Update range structure based on raster row.
int Rast__null_bitstream_size(int)
Determines null bitstream size.
Definition alloc_cell.c:144
#define Rast_is_f_null_value(fcellVal)
void Rast_set_d_null_value(DCELL *, int)
To set a number of DCELL raster values to NULL.
Definition null_val.c:151
void Rast_set_f_null_value(FCELL *, int)
To set a number of FCELL raster values to NULL.
Definition null_val.c:136
void Rast__convert_01_flags(const char *, unsigned char *, int)
?
Definition null_val.c:418
void Rast_set_d_value(void *, DCELL, RASTER_MAP_TYPE)
Places a DCELL raster value.
void Rast_set_c_null_value(CELL *, int)
To set a number of CELL raster values to NULL.
Definition null_val.c:122
int Rast_update_cell_stats(const CELL *, int, struct Cell_stats *)
Add data to cell stats.
Definition cell_stats.c:60
size_t Rast_cell_size(RASTER_MAP_TYPE)
Returns size of a raster cell in bytes.
Definition alloc_cell.c:35
#define Rast_is_d_null_value(dcellVal)
#define Rast_is_c_null_value(cellVal)
void Rast_row_update_fp_range(const void *, int, struct FPRange *, RASTER_MAP_TYPE)
Update range structure based on raster row (floating-point)
Header file for msvc/fcntl.c.
CPLErr Rast_gdal_raster_IO(GDALRasterBandH band, GDALRWFlag rw_flag, int x_off, int y_off, int x_size, int y_size, void *buffer, int buf_x_size, int buf_y_size, GDALDataType buf_type, int pixel_size, int line_size)
Input/output function for GDAL links.
Definition gdal.c:425
float FCELL
Definition gis.h:633
double DCELL
Definition gis.h:632
int CELL
Definition gis.h:631
#define _(str)
Definition glocale.h:10
int count
void Rast_put_d_row(int fd, const DCELL *buf)
Writes the next row for dcell file (DCELL version)
void Rast_put_row(int fd, const void *buf, RASTER_MAP_TYPE data_type)
Writes the next row for cell/fcell/dcell file.
void Rast__write_null_bits(int fd, const unsigned char *flags)
Write null data.
void Rast_put_f_row(int fd, const FCELL *buf)
Writes the next row for fcell file (FCELL version)
void Rast_put_c_row(int fd, const CELL *buf)
Writes the next row for cell file (CELL version)
#define FCELL_TYPE
Definition raster.h:12
#define DCELL_TYPE
Definition raster.h:13
#define CELL_TYPE
Definition raster.h:11
int RASTER_MAP_TYPE
Definition raster.h:25
SSIZE_T ssize_t
Definition stdio.h:9
Definition R.h:82
struct fileinfo * fileinfo
Definition R.h:96
Definition R.h:48
RASTER_MAP_TYPE map_type
Definition R.h:67
int nbytes
Definition R.h:66
SYMBOL * err(FILE *fp, SYMBOL *s, char *msg)
#define write
Definition unistd.h:6