[GRASS-SVN] r46326 -
grass/branches/releasebranch_6_4/raster/r.out.gdal
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue May 17 10:59:00 EDT 2011
Author: mmetz
Date: 2011-05-17 07:59:00 -0700 (Tue, 17 May 2011)
New Revision: 46326
Modified:
grass/branches/releasebranch_6_4/raster/r.out.gdal/export_band.c
Log:
do not use G_get_null_value_row()
Modified: grass/branches/releasebranch_6_4/raster/r.out.gdal/export_band.c
===================================================================
--- grass/branches/releasebranch_6_4/raster/r.out.gdal/export_band.c 2011-05-17 14:58:44 UTC (rev 46325)
+++ grass/branches/releasebranch_6_4/raster/r.out.gdal/export_band.c 2011-05-17 14:59:00 UTC (rev 46326)
@@ -65,12 +65,8 @@
G_warning(_("Unable to allocate buffer for reading raster map"));
return -1;
}
- char *nulls = (char *)G_malloc(cols);
- if (nulls == NULL) {
- G_warning(_("Unable to allocate buffer for reading raster map"));
- return -1;
- }
+ /* the following routine must be kept identical to export_band */
/* Copy data form GRASS raster to GDAL raster */
int row, col;
@@ -95,9 +91,8 @@
name, row);
return -1;
}
- G_get_null_value_row(fd, nulls, row);
for (col = 0; col < cols; col++) {
- if (nulls[col]) {
+ if (G_is_f_null_value(&(((FCELL *) bufer)[col]))) {
((FCELL *) bufer)[col] = fnullval;
n_nulls++;
}
@@ -127,9 +122,8 @@
name, row);
return -1;
}
- G_get_null_value_row(fd, nulls, row);
for (col = 0; col < cols; col++) {
- if (nulls[col]) {
+ if (G_is_d_null_value(&(((DCELL *) bufer)[col]))) {
((DCELL *) bufer)[col] = dnullval;
n_nulls++;
}
@@ -159,9 +153,8 @@
name, row);
return -1;
}
- G_get_null_value_row(fd, nulls, row);
for (col = 0; col < cols; col++) {
- if (nulls[col]) {
+ if (G_is_c_null_value(&(((CELL *) bufer)[col]))) {
((CELL *) bufer)[col] = inullval;
n_nulls++;
}
@@ -220,6 +213,8 @@
ret = -1;
}
+ G_free(bufer);
+
return ret;
}
@@ -378,12 +373,8 @@
G_warning(_("Unable to allocate buffer for reading raster map"));
return -1;
}
- char *nulls = (char *)G_malloc(cols);
- if (nulls == NULL) {
- G_warning(_("Unable to allocate buffer for reading raster map"));
- return -1;
- }
+ /* the following routine must be kept identical to export_band */
/* Copy data form GRASS raster to GDAL raster */
int row, col;
@@ -407,9 +398,8 @@
name, row);
return -1;
}
- G_get_null_value_row(fd, nulls, row);
for (col = 0; col < cols; col++) {
- if (nulls[col]) {
+ if (G_is_f_null_value(&(((FCELL *) bufer)[col]))) {
((FCELL *) bufer)[col] = fnullval;
if (n_nulls == 0) {
GDALSetRasterNoDataValue(hBand, nodataval);
@@ -441,9 +431,8 @@
name, row);
return -1;
}
- G_get_null_value_row(fd, nulls, row);
for (col = 0; col < cols; col++) {
- if (nulls[col]) {
+ if (G_is_d_null_value(&(((DCELL *) bufer)[col]))) {
((DCELL *) bufer)[col] = dnullval;
if (n_nulls == 0) {
GDALSetRasterNoDataValue(hBand, nodataval);
@@ -475,9 +464,8 @@
name, row);
return -1;
}
- G_get_null_value_row(fd, nulls, row);
for (col = 0; col < cols; col++) {
- if (nulls[col]) {
+ if (G_is_c_null_value(&(((CELL *) bufer)[col]))) {
((CELL *) bufer)[col] = inullval;
if (n_nulls == 0) {
GDALSetRasterNoDataValue(hBand, nodataval);
@@ -496,6 +484,8 @@
}
}
+ G_free(bufer);
+
return ret;
}
More information about the grass-commit
mailing list