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