[GRASS-SVN] r46325 - grass/branches/develbranch_6/raster/r.out.gdal
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue May 17 10:58:45 EDT 2011
Author: mmetz
Date: 2011-05-17 07:58:44 -0700 (Tue, 17 May 2011)
New Revision: 46325
Modified:
grass/branches/develbranch_6/raster/r.out.gdal/export_band.c
Log:
do not use G_get_null_value_row()
Modified: grass/branches/develbranch_6/raster/r.out.gdal/export_band.c
===================================================================
--- grass/branches/develbranch_6/raster/r.out.gdal/export_band.c 2011-05-17 14:58:26 UTC (rev 46324)
+++ grass/branches/develbranch_6/raster/r.out.gdal/export_band.c 2011-05-17 14:58:44 UTC (rev 46325)
@@ -67,12 +67,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;
@@ -97,9 +93,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++;
}
@@ -129,9 +124,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++;
}
@@ -161,9 +155,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++;
}
@@ -222,6 +215,8 @@
ret = -1;
}
+ G_free(bufer);
+
return ret;
}
@@ -380,12 +375,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;
@@ -409,9 +400,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);
@@ -443,9 +433,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);
@@ -477,9 +466,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);
@@ -498,6 +486,8 @@
}
}
+ G_free(bufer);
+
return ret;
}
More information about the grass-commit
mailing list