|
@@ -16,7 +16,7 @@
|
|
|
* Return setting values in all cases.
|
|
|
*
|
|
|
* *** NOTE ***
|
|
|
- * Use only to change a default behavior for zero of G_put_map_row[_random].
|
|
|
+ * Use only to change a default behavior for zero of G_put_map_row
|
|
|
*
|
|
|
**********************************************************************
|
|
|
*
|
|
@@ -76,40 +76,11 @@
|
|
|
* Keeps track of the minimum and maximum cell value for use in updating
|
|
|
* the range file upon close of the cell file.
|
|
|
*
|
|
|
- **********************************************************************
|
|
|
- *
|
|
|
- * G_put_map_row_random(fd, buf, row, col, ncells)
|
|
|
- * int fd File descriptor where data is to be written
|
|
|
- * CELL *buf Buffer holding data
|
|
|
- * int row Map row where data is to be written
|
|
|
- * int col Column where data begins
|
|
|
- * int ncells Number of columns of data to be written
|
|
|
- *
|
|
|
- * Writes parts of rows into open cell file.
|
|
|
- *
|
|
|
- * Cell file must have been opened with G_open_cell_new_random()
|
|
|
- * except it can't write null file.
|
|
|
- *
|
|
|
- * returns: 0 if successful
|
|
|
- * -1 on fail
|
|
|
- *
|
|
|
- * behaves the same as G_put_map_row()
|
|
|
- *
|
|
|
- **********************************************************************
|
|
|
- *
|
|
|
- * Note: there is no G_put_[c/f/d]_raster_row_random() because even though
|
|
|
- * it is possible to randomly write floating and integer rows, it is not
|
|
|
- * possible to rand. write null data, so the null file can't
|
|
|
- * be updated correctly.
|
|
|
- *
|
|
|
***********************************************************************
|
|
|
*
|
|
|
- * G__put_null_value_row(fd, buf, row, col, ncells)
|
|
|
+ * G__put_null_value_row(fd, buf)
|
|
|
* int fd File descriptor where data is to be written
|
|
|
* char *buf Buffer holding null data
|
|
|
- * int row Map row where data is to be written
|
|
|
- * int col Column where data begins
|
|
|
- * int ncells Number of columns of data to be written
|
|
|
*
|
|
|
* converts a buffer of zero's and ones to bitstream and stores this
|
|
|
* bitstream in memory. (the null rows from memory are written into null
|
|
@@ -135,16 +106,14 @@
|
|
|
|
|
|
static int _zeros_r_nulls = 1;
|
|
|
|
|
|
-static int put_raster_data(int, const void *, int, int, int, int,
|
|
|
+static int put_raster_data(int, char *, const void *, int, int, int,
|
|
|
RASTER_MAP_TYPE);
|
|
|
-static int put_data(int, const CELL *, int, int, int, int);
|
|
|
-static int check_open(const char *, int, int);
|
|
|
-static int adjust(int, int *, int *);
|
|
|
+static int put_data(int, char *, const CELL *, int, int, int);
|
|
|
+static int check_open(const char *, int);
|
|
|
static void write_error(int, int);
|
|
|
static int same(const unsigned char *, const unsigned char *, int);
|
|
|
-static int seek_random(int, int, int);
|
|
|
static void set_file_pointer(int, int);
|
|
|
-static int put_fp_data(int, const void *, int, int, int, RASTER_MAP_TYPE);
|
|
|
+static int put_fp_data(int, char *, const void *, int, int, RASTER_MAP_TYPE);
|
|
|
static int put_null_data(int, const char *, int);
|
|
|
static int convert_and_write_if(int, const CELL *);
|
|
|
static int convert_and_write_id(int, const CELL *);
|
|
@@ -167,30 +136,6 @@ int G_zeros_r_nulls(int zeros_r_nulls)
|
|
|
return _zeros_r_nulls;
|
|
|
}
|
|
|
|
|
|
-int G_put_map_row_random(int fd, const CELL * buf, int row, int col, int n)
|
|
|
-{
|
|
|
- struct fileinfo *fcb = &G__.fileinfo[fd];
|
|
|
-
|
|
|
- if (!check_open("G_put_map_row_random", fd, 1))
|
|
|
- return -1;
|
|
|
-
|
|
|
- buf += adjust(fd, &col, &n);
|
|
|
- switch (put_data(fd, buf, row, col, n, _zeros_r_nulls)) {
|
|
|
- case -1:
|
|
|
- return -1;
|
|
|
- case 0:
|
|
|
- return 1;
|
|
|
- }
|
|
|
-
|
|
|
- /* only for integer maps */
|
|
|
- if (fcb->want_histogram)
|
|
|
- G_update_cell_stats(buf, n, &fcb->statf);
|
|
|
-
|
|
|
- G_row_update_range(buf, n, &fcb->range);
|
|
|
-
|
|
|
- return 1;
|
|
|
-}
|
|
|
-
|
|
|
int G__put_null_value_row(int fd, const char *buf)
|
|
|
{
|
|
|
struct fileinfo *fcb = &G__.fileinfo[fd];
|
|
@@ -242,7 +187,7 @@ int G_put_d_raster_row(int fd, const DCELL * buf)
|
|
|
|
|
|
/*--------------------------------------------------------------------------*/
|
|
|
|
|
|
-static int check_open(const char *me, int fd, int random)
|
|
|
+static int check_open(const char *me, int fd)
|
|
|
{
|
|
|
struct fileinfo *fcb = &G__.fileinfo[fd];
|
|
|
|
|
@@ -253,18 +198,7 @@ static int check_open(const char *me, int fd, int random)
|
|
|
break;
|
|
|
case OPEN_NEW_COMPRESSED:
|
|
|
case OPEN_NEW_UNCOMPRESSED:
|
|
|
- if (!random)
|
|
|
- return 1;
|
|
|
-
|
|
|
- G_warning(_("%s: map [%s] not open for random write - request ignored"),
|
|
|
- me, fcb->name);
|
|
|
- break;
|
|
|
- case OPEN_NEW_RANDOM:
|
|
|
- if (random)
|
|
|
- return 1;
|
|
|
-
|
|
|
- G_warning(_("%s: map [%s] not open for sequential write - request ignored"),
|
|
|
- me, fcb->name);
|
|
|
+ return 1;
|
|
|
break;
|
|
|
default:
|
|
|
G_warning(_("%s: unopened file descriptor - request ignored"), me);
|
|
@@ -274,32 +208,6 @@ static int check_open(const char *me, int fd, int random)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-/*******************************************************
|
|
|
-* adjust the column,n so that it is within the window
|
|
|
-* returns the adjustment to buffer that must be made
|
|
|
-* if col,n is adjusted
|
|
|
-*
|
|
|
-* if n comes back <= zero, do not write
|
|
|
-*******************************************************/
|
|
|
-static int adjust(int fd, int *col, int *n)
|
|
|
-{
|
|
|
- struct fileinfo *fcb = &G__.fileinfo[fd];
|
|
|
- int adj = 0;
|
|
|
- int last = *col + *n;
|
|
|
-
|
|
|
- if (*col < 0) {
|
|
|
- adj = -(*col);
|
|
|
- *col = 0;
|
|
|
- }
|
|
|
-
|
|
|
- if (last > fcb->cellhd.cols)
|
|
|
- last = fcb->cellhd.cols;
|
|
|
-
|
|
|
- *n = last - *col;
|
|
|
-
|
|
|
- return adj;
|
|
|
-}
|
|
|
-
|
|
|
static void write_error(int fd, int row)
|
|
|
{
|
|
|
struct fileinfo *fcb = &G__.fileinfo[fd];
|
|
@@ -316,12 +224,12 @@ static void write_error(int fd, int row)
|
|
|
|
|
|
/*--------------------------------------------------------------------------*/
|
|
|
|
|
|
-int G__write_data(int fd, int row, int n)
|
|
|
+static int write_data(int fd, int row, unsigned char *buf, int n)
|
|
|
{
|
|
|
struct fileinfo *fcb = &G__.fileinfo[fd];
|
|
|
ssize_t nwrite = fcb->nbytes * n;
|
|
|
|
|
|
- if (write(fd, G__.work_buf, nwrite) != nwrite) {
|
|
|
+ if (write(fd, buf, nwrite) != nwrite) {
|
|
|
write_error(fd, row);
|
|
|
return -1;
|
|
|
}
|
|
@@ -329,27 +237,12 @@ int G__write_data(int fd, int row, int n)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-int G__write_data_compressed(int fd, int row, int n)
|
|
|
+static int write_data_compressed(int fd, int row, unsigned char *buf, int n)
|
|
|
{
|
|
|
struct fileinfo *fcb = &G__.fileinfo[fd];
|
|
|
int nwrite = fcb->nbytes * n;
|
|
|
|
|
|
- if (G_zlib_write(fd, G__.work_buf, nwrite) < 0) {
|
|
|
- write_error(fd, row);
|
|
|
- return -1;
|
|
|
- }
|
|
|
-
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
-/*--------------------------------------------------------------------------*/
|
|
|
-
|
|
|
-static int seek_random(int fd, int row, int col)
|
|
|
-{
|
|
|
- struct fileinfo *fcb = &G__.fileinfo[fd];
|
|
|
- off_t offset = ((off_t) fcb->cellhd.cols * row + col) * fcb->nbytes;
|
|
|
-
|
|
|
- if (lseek(fd, offset, SEEK_SET) < 0) {
|
|
|
+ if (G_zlib_write(fd, buf, nwrite) < 0) {
|
|
|
write_error(fd, row);
|
|
|
return -1;
|
|
|
}
|
|
@@ -372,8 +265,8 @@ static void set_file_pointer(int fd, int row)
|
|
|
|
|
|
/*--------------------------------------------------------------------------*/
|
|
|
|
|
|
-static int convert_float(XDR * xdrs, const FCELL * rast, int row, int col,
|
|
|
- int n, int random)
|
|
|
+static int convert_float(XDR * xdrs, char *null_buf, const FCELL * rast,
|
|
|
+ int row, int n)
|
|
|
{
|
|
|
int i;
|
|
|
|
|
@@ -383,8 +276,7 @@ static int convert_float(XDR * xdrs, const FCELL * rast, int row, int col,
|
|
|
/* substitute embeded null vals by 0's */
|
|
|
if (G_is_f_null_value(&rast[i])) {
|
|
|
f = 0.;
|
|
|
- if (!random)
|
|
|
- G__.null_buf[col + i] = 1;
|
|
|
+ null_buf[i] = 1;
|
|
|
}
|
|
|
else
|
|
|
f = rast[i];
|
|
@@ -398,8 +290,8 @@ static int convert_float(XDR * xdrs, const FCELL * rast, int row, int col,
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-static int convert_double(XDR * xdrs, const DCELL * rast, int row, int col,
|
|
|
- int n, int random)
|
|
|
+static int convert_double(XDR * xdrs, char *null_buf, const DCELL * rast,
|
|
|
+ int row, int n)
|
|
|
{
|
|
|
int i;
|
|
|
|
|
@@ -409,8 +301,7 @@ static int convert_double(XDR * xdrs, const DCELL * rast, int row, int col,
|
|
|
/* substitute embeded null vals by 0's */
|
|
|
if (G_is_d_null_value(&rast[i])) {
|
|
|
d = 0.;
|
|
|
- if (!random)
|
|
|
- G__.null_buf[col + i] = 1;
|
|
|
+ null_buf[i] = 1;
|
|
|
}
|
|
|
else
|
|
|
d = rast[i];
|
|
@@ -428,13 +319,13 @@ static int convert_double(XDR * xdrs, const DCELL * rast, int row, int col,
|
|
|
|
|
|
/* writes data to fcell file for either full or partial rows */
|
|
|
|
|
|
-static int put_fp_data(int fd, const void *rast, int row, int col, int n,
|
|
|
- RASTER_MAP_TYPE data_type)
|
|
|
+static int put_fp_data(int fd, char *null_buf, const void *rast,
|
|
|
+ int row, int n, RASTER_MAP_TYPE data_type)
|
|
|
{
|
|
|
struct fileinfo *fcb = &G__.fileinfo[fd];
|
|
|
- int random = (fcb->open_mode == OPEN_NEW_RANDOM);
|
|
|
int compressed = (fcb->open_mode == OPEN_NEW_COMPRESSED);
|
|
|
XDR *xdrs = &fcb->xdrstream;
|
|
|
+ char *work_buf;
|
|
|
|
|
|
if (row < 0 || row >= fcb->cellhd.rows)
|
|
|
return 0;
|
|
@@ -442,34 +333,42 @@ static int put_fp_data(int fd, const void *rast, int row, int col, int n,
|
|
|
if (n <= 0)
|
|
|
return 0;
|
|
|
|
|
|
- if (random) {
|
|
|
- if (seek_random(fd, row, col) == -1)
|
|
|
- return -1;
|
|
|
- }
|
|
|
- else if (compressed)
|
|
|
+ work_buf = G__alloca(G__.window.cols * fcb->nbytes + 1);
|
|
|
+
|
|
|
+ if (compressed)
|
|
|
set_file_pointer(fd, row);
|
|
|
|
|
|
- xdrmem_create(xdrs, (caddr_t) G__.work_buf,
|
|
|
- (u_int) (fcb->nbytes * fcb->cellhd.cols), XDR_ENCODE);
|
|
|
+ xdrmem_create(xdrs, work_buf,
|
|
|
+ (unsigned int) fcb->nbytes * fcb->cellhd.cols, XDR_ENCODE);
|
|
|
xdr_setpos(xdrs, 0);
|
|
|
|
|
|
if (data_type == FCELL_TYPE) {
|
|
|
- if (convert_float(xdrs, rast, row, col, n, random) < 0)
|
|
|
+ if (convert_float(xdrs, null_buf, rast, row, n) < 0) {
|
|
|
+ G__freea(work_buf);
|
|
|
return -1;
|
|
|
+ }
|
|
|
}
|
|
|
else {
|
|
|
- if (convert_double(xdrs, rast, row, col, n, random) < 0)
|
|
|
+ if (convert_double(xdrs, null_buf, rast, row, n) < 0) {
|
|
|
+ G__freea(work_buf);
|
|
|
return -1;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
xdr_destroy(&fcb->xdrstream);
|
|
|
|
|
|
if (compressed) {
|
|
|
- if (G__write_data_compressed(fd, row, n) == -1)
|
|
|
+ if (write_data_compressed(fd, row, work_buf, n) == -1) {
|
|
|
+ G__freea(work_buf);
|
|
|
return -1;
|
|
|
+ }
|
|
|
}
|
|
|
- else if (G__write_data(fd, row, n) == -1)
|
|
|
+ else if (write_data(fd, row, work_buf, n) == -1) {
|
|
|
+ G__freea(work_buf);
|
|
|
return -1;
|
|
|
+ }
|
|
|
+
|
|
|
+ G__freea(work_buf);
|
|
|
|
|
|
return 1;
|
|
|
}
|
|
@@ -480,8 +379,8 @@ static int put_fp_data(int fd, const void *rast, int row, int col, int n,
|
|
|
|
|
|
/*--------------------------------------------------------------------------*/
|
|
|
|
|
|
-static void convert_int(unsigned char *wk, const CELL * rast, int col, int n,
|
|
|
- int random, int len, int zeros_r_nulls)
|
|
|
+static void convert_int(unsigned char *wk, char *null_buf, const CELL * rast,
|
|
|
+ int n, int len, int zeros_r_nulls)
|
|
|
{
|
|
|
int i;
|
|
|
|
|
@@ -495,11 +394,10 @@ static void convert_int(unsigned char *wk, const CELL * rast, int col, int n,
|
|
|
/* substitute embeded null vals by 0's */
|
|
|
if (G_is_c_null_value(&v)) {
|
|
|
v = 0;
|
|
|
- if (!random)
|
|
|
- G__.null_buf[col + i] = 1;
|
|
|
+ null_buf[i] = 1;
|
|
|
}
|
|
|
- else if (!random && zeros_r_nulls && !v)
|
|
|
- G__.null_buf[col + i] = 1;
|
|
|
+ else if (zeros_r_nulls && !v)
|
|
|
+ null_buf[i] = 1;
|
|
|
|
|
|
/* negatives */
|
|
|
if (v < 0) {
|
|
@@ -598,23 +496,20 @@ static int zlib_compress(unsigned char *dst, unsigned char *src, int n,
|
|
|
int nbytes)
|
|
|
{
|
|
|
int total = nbytes * n;
|
|
|
- int nwrite = G_zlib_compress(G__.work_buf + 1, total,
|
|
|
- G__.compressed_buf + 1,
|
|
|
- G__.compressed_buf_size - 1);
|
|
|
+ int nwrite = G_zlib_compress(src, total, dst, total);
|
|
|
|
|
|
return (nwrite >= total) ? 0 : nwrite;
|
|
|
}
|
|
|
|
|
|
/*--------------------------------------------------------------------------*/
|
|
|
|
|
|
-static int put_data(int fd, const CELL * cell, int row, int col, int n,
|
|
|
- int zeros_r_nulls)
|
|
|
+static int put_data(int fd, char *null_buf, const CELL *cell,
|
|
|
+ int row, int n, int zeros_r_nulls)
|
|
|
{
|
|
|
struct fileinfo *fcb = &G__.fileinfo[fd];
|
|
|
- int random = (fcb->open_mode == OPEN_NEW_RANDOM);
|
|
|
int compressed = fcb->cellhd.compressed;
|
|
|
int len = compressed ? sizeof(CELL) : fcb->nbytes;
|
|
|
- unsigned char *wk = G__.work_buf;
|
|
|
+ unsigned char *work_buf, *wk;
|
|
|
ssize_t nwrite;
|
|
|
|
|
|
if (row < 0 || row >= fcb->cellhd.rows)
|
|
@@ -623,21 +518,22 @@ static int put_data(int fd, const CELL * cell, int row, int col, int n,
|
|
|
if (n <= 0)
|
|
|
return 0;
|
|
|
|
|
|
- if (random) {
|
|
|
- if (seek_random(fd, row, col) == -1)
|
|
|
- return -1;
|
|
|
- }
|
|
|
- else if (compressed)
|
|
|
+ work_buf = G__alloca(G__.window.cols * sizeof(CELL) + 1);
|
|
|
+ wk = work_buf;
|
|
|
+
|
|
|
+ if (compressed)
|
|
|
set_file_pointer(fd, row);
|
|
|
|
|
|
if (compressed)
|
|
|
wk++;
|
|
|
|
|
|
- convert_int(wk, cell, col, n, random, len, zeros_r_nulls);
|
|
|
+ convert_int(wk, null_buf, cell, n, len, zeros_r_nulls);
|
|
|
|
|
|
if (compressed) {
|
|
|
- unsigned char *wk = G__.work_buf + 1;
|
|
|
+ unsigned char *wk = work_buf + 1;
|
|
|
int nbytes = count_bytes(wk, n, len);
|
|
|
+ unsigned char *compressed_buf;
|
|
|
+ int total;
|
|
|
|
|
|
if (fcb->nbytes < nbytes)
|
|
|
fcb->nbytes = nbytes;
|
|
@@ -646,40 +542,52 @@ static int put_data(int fd, const CELL * cell, int row, int col, int n,
|
|
|
if (nbytes < len)
|
|
|
trim_bytes(wk, n, len, len - nbytes);
|
|
|
|
|
|
- G__.compressed_buf[0] = G__.work_buf[0] = nbytes;
|
|
|
+ total = nbytes * n;
|
|
|
+ compressed_buf = G__alloca(total + 1);
|
|
|
+
|
|
|
+ compressed_buf[0] = work_buf[0] = nbytes;
|
|
|
|
|
|
/* then compress the data */
|
|
|
nwrite = compressed == 1
|
|
|
- ? rle_compress(G__.compressed_buf + 1, G__.work_buf + 1, n,
|
|
|
+ ? rle_compress(compressed_buf + 1, work_buf + 1, n,
|
|
|
nbytes)
|
|
|
- : zlib_compress(G__.compressed_buf + 1, G__.work_buf + 1, n,
|
|
|
+ : zlib_compress(compressed_buf + 1, work_buf + 1, n,
|
|
|
nbytes);
|
|
|
|
|
|
if (nwrite > 0) {
|
|
|
nwrite++;
|
|
|
|
|
|
- if (write(fd, G__.compressed_buf, nwrite) != nwrite) {
|
|
|
+ if (write(fd, compressed_buf, nwrite) != nwrite) {
|
|
|
write_error(fd, row);
|
|
|
+ G__freea(compressed_buf);
|
|
|
+ G__freea(work_buf);
|
|
|
return -1;
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
nwrite = nbytes * n + 1;
|
|
|
- if (write(fd, G__.work_buf, nwrite) != nwrite) {
|
|
|
+ if (write(fd, work_buf, nwrite) != nwrite) {
|
|
|
write_error(fd, row);
|
|
|
+ G__freea(compressed_buf);
|
|
|
+ G__freea(work_buf);
|
|
|
return -1;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ G__freea(compressed_buf);
|
|
|
}
|
|
|
else {
|
|
|
nwrite = fcb->nbytes * n;
|
|
|
|
|
|
- if (write(fd, G__.work_buf, nwrite) != nwrite) {
|
|
|
+ if (write(fd, work_buf, nwrite) != nwrite) {
|
|
|
write_error(fd, row);
|
|
|
+ G__freea(work_buf);
|
|
|
return -1;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ G__freea(work_buf);
|
|
|
+
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
@@ -689,12 +597,13 @@ static int put_data(int fd, const CELL * cell, int row, int col, int n,
|
|
|
|
|
|
/*--------------------------------------------------------------------------*/
|
|
|
|
|
|
-static int put_raster_data(int fd, const void *rast, int row, int col, int n,
|
|
|
+static int put_raster_data(int fd, char *null_buf, const void *rast,
|
|
|
+ int row, int n,
|
|
|
int zeros_r_nulls, RASTER_MAP_TYPE map_type)
|
|
|
{
|
|
|
return (map_type == CELL_TYPE)
|
|
|
- ? put_data(fd, rast, row, col, n, zeros_r_nulls)
|
|
|
- : put_fp_data(fd, rast, row, col, n, map_type);
|
|
|
+ ? put_data(fd, null_buf, rast, row, n, zeros_r_nulls)
|
|
|
+ : put_fp_data(fd, null_buf, rast, row, n, map_type);
|
|
|
}
|
|
|
|
|
|
/*--------------------------------------------------------------------------*/
|
|
@@ -886,30 +795,34 @@ static int convert_and_write_di(int fd, const DCELL * buf)
|
|
|
static int put_raster_row(int fd, const void *buf, RASTER_MAP_TYPE data_type,
|
|
|
int zeros_r_nulls)
|
|
|
{
|
|
|
- struct fileinfo *fcb = &G__.fileinfo[fd];
|
|
|
-
|
|
|
static int (*convert_and_write_FtypeOtype[3][3]) () = {
|
|
|
{
|
|
|
NULL, convert_and_write_if, convert_and_write_id}, {
|
|
|
convert_and_write_fi, NULL, convert_and_write_fd}, {
|
|
|
convert_and_write_di, convert_and_write_df, NULL}
|
|
|
};
|
|
|
+ struct fileinfo *fcb = &G__.fileinfo[fd];
|
|
|
+ char *null_buf;
|
|
|
+ int stat;
|
|
|
|
|
|
- if (!check_open("put_raster_row", fd, 0))
|
|
|
+ if (!check_open("put_raster_row", fd))
|
|
|
return -1;
|
|
|
|
|
|
if (fcb->map_type != data_type)
|
|
|
return convert_and_write_FtypeOtype[data_type][fcb->map_type] (fd,
|
|
|
buf);
|
|
|
|
|
|
- G_zero(G__.null_buf, fcb->cellhd.cols * sizeof(char));
|
|
|
+ null_buf = G__alloca(fcb->cellhd.cols);
|
|
|
+ G_zero(null_buf, fcb->cellhd.cols);
|
|
|
|
|
|
- switch (put_raster_data
|
|
|
- (fd, buf, fcb->cur_row, 0, fcb->cellhd.cols, zeros_r_nulls,
|
|
|
- data_type)) {
|
|
|
+ switch (put_raster_data(
|
|
|
+ fd, null_buf, buf, fcb->cur_row, fcb->cellhd.cols,
|
|
|
+ zeros_r_nulls, data_type)) {
|
|
|
case -1:
|
|
|
+ G__freea(null_buf);
|
|
|
return -1;
|
|
|
case 0:
|
|
|
+ G__freea(null_buf);
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
@@ -927,5 +840,7 @@ static int put_raster_row(int fd, const void *buf, RASTER_MAP_TYPE data_type,
|
|
|
fcb->cur_row++;
|
|
|
|
|
|
/* write the null row for the data row */
|
|
|
- return G__put_null_value_row(fd, G__.null_buf);
|
|
|
+ stat = G__put_null_value_row(fd, null_buf);
|
|
|
+ G__freea(null_buf);
|
|
|
+ return stat;
|
|
|
}
|