From: Bborie Park Date: Mon, 22 Oct 2012 17:20:20 +0000 (+0000) Subject: Remove unused variables. X-Git-Tag: 2.1.0beta2~485 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=86e26513e51afd98a01adc59be8dc1359733d2d0;p=postgis Remove unused variables. git-svn-id: http://svn.osgeo.org/postgis/trunk@10520 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/raster/rt_core/rt_api.c b/raster/rt_core/rt_api.c index 526aa02eb..e7cff081f 100644 --- a/raster/rt_core/rt_api.c +++ b/raster/rt_core/rt_api.c @@ -2292,7 +2292,7 @@ rt_band_get_pixel( } /* band is NODATA */ - if (band->hasnodata && band->isnodata) { + if (band->isnodata) { RASTER_DEBUG(3, "Band's isnodata flag is TRUE. Returning NODATA value"); *value = band->nodataval; if (nodata != NULL) *nodata = 1; @@ -3882,8 +3882,6 @@ rt_band_get_quantiles_stream( const uint32_t MAX_VALUES = 750; uint8_t *data = NULL; - int hasnodata = FALSE; - double nodata = 0; double value; int isnodata = 0; @@ -3917,13 +3915,8 @@ rt_band_get_quantiles_stream( return NULL; } - hasnodata = rt_band_get_hasnodata_flag(band); - if (hasnodata != FALSE) - rt_band_get_nodata(band, &nodata); - else + if (!rt_band_get_hasnodata_flag(band)) exclude_nodata_value = 0; - RASTER_DEBUGF(3, "nodata = %f", nodata); - RASTER_DEBUGF(3, "hasnodata = %d", hasnodata); RASTER_DEBUGF(3, "exclude_nodata_value = %d", exclude_nodata_value); /* quantile_llist not provided */ @@ -4473,7 +4466,6 @@ rt_band_get_value_count( rt_valuecount vcnts = NULL; rt_pixtype pixtype = PT_END; uint8_t *data = NULL; - int hasnodata = FALSE; double nodata = 0; int scale = 0; @@ -4485,6 +4477,7 @@ rt_band_get_value_count( uint32_t y = 0; int rtn; double pxlval; + int isnodata = 0; double rpxlval; uint32_t total = 0; int vcnts_count = 0; @@ -4510,14 +4503,15 @@ rt_band_get_value_count( pixtype = band->pixtype; - hasnodata = rt_band_get_hasnodata_flag(band); - if (hasnodata != FALSE) + if (rt_band_get_hasnodata_flag(band)) { rt_band_get_nodata(band, &nodata); - else + RASTER_DEBUGF(3, "hasnodata, nodataval = 1, %f", nodata); + } + else { exclude_nodata_value = 0; + RASTER_DEBUG(3, "hasnodata, nodataval = 0, 0"); + } - RASTER_DEBUGF(3, "nodata = %f", nodata); - RASTER_DEBUGF(3, "hasnodata = %d", hasnodata); RASTER_DEBUGF(3, "exclude_nodata_value = %d", exclude_nodata_value); /* process roundto */ @@ -4641,20 +4635,12 @@ rt_band_get_value_count( for (x = 0; x < band->width; x++) { for (y = 0; y < band->height; y++) { - rtn = rt_band_get_pixel(band, x, y, &pxlval, NULL); + rtn = rt_band_get_pixel(band, x, y, &pxlval, &isnodata); /* error getting value, continue */ if (rtn == -1) continue; - if ( - !exclude_nodata_value || ( - exclude_nodata_value && - (hasnodata != FALSE) && ( - FLT_NEQ(pxlval, nodata) && - (rt_band_clamped_value_is_nodata(band, pxlval) != 1) - ) - ) - ) { + if (!exclude_nodata_value || (exclude_nodata_value && !isnodata)) { total++; if (doround) { rpxlval = ROUND(pxlval, scale); @@ -4742,6 +4728,7 @@ rt_band_reclass( void *mem = NULL; uint32_t src_hasnodata = 0; double src_nodataval = 0.0; + int isnodata = 0; int rtn; uint32_t x; @@ -4912,7 +4899,7 @@ rt_band_reclass( for (x = 0; x < width; x++) { for (y = 0; y < height; y++) { - rtn = rt_band_get_pixel(srcband, x, y, &ov, NULL); + rtn = rt_band_get_pixel(srcband, x, y, &ov, &isnodata); /* error getting value, skip */ if (rtn == -1) { @@ -4924,7 +4911,7 @@ rt_band_reclass( do_nv = 0; /* no data*/ - if (src_hasnodata && hasnodata && FLT_EQ(ov, src_nodataval)) { + if (hasnodata && isnodata) { do_nv = 1; break; } @@ -4983,11 +4970,7 @@ rt_band_reclass( */ /* nodata */ - if ( - src_hasnodata && - hasnodata && - FLT_EQ(ov, src_nodataval) - ) { + if (hasnodata && isnodata) { nv = nodataval; } /* diff --git a/raster/rt_pg/rt_pg.c b/raster/rt_pg/rt_pg.c index f455a16df..91375f596 100644 --- a/raster/rt_pg/rt_pg.c +++ b/raster/rt_pg/rt_pg.c @@ -2519,8 +2519,6 @@ Datum RASTER_dumpValues(PG_FUNCTION_ARGS) double val = 0; int isnodata = 0; - int hasnodata = 0; - double nodataval = 0; POSTGIS_RT_DEBUG(2, "RASTER_dumpValues first call"); @@ -2704,12 +2702,6 @@ Datum RASTER_dumpValues(PG_FUNCTION_ARGS) SRF_RETURN_DONE(funcctx); } - /* band's hasnodata and nodataval */ - hasnodata = rt_band_get_hasnodata_flag(band); - if (hasnodata) - rt_band_get_nodata(band, &nodataval); - POSTGIS_RT_DEBUGF(4, "(hasnodata, nodataval) = (%d, %f)", hasnodata, nodataval); - /* allocate memory for values and nodata flags */ arg1->values[z] = palloc(sizeof(Datum) * arg1->rows * arg1->columns); arg1->nodata[z] = palloc(sizeof(bool) * arg1->rows * arg1->columns); @@ -2747,9 +2739,6 @@ Datum RASTER_dumpValues(PG_FUNCTION_ARGS) arg1->values[z][i] = Float8GetDatum(val); POSTGIS_RT_DEBUGF(5, "arg1->values[z][i] = %f", DatumGetFloat8(arg1->values[z][i])); - if (hasnodata) { - POSTGIS_RT_DEBUGF(5, "FLT_EQ?: %d", FLT_EQ(val, nodataval) ? 1 : 0); - } POSTGIS_RT_DEBUGF(5, "clamped is?: %d", rt_band_clamped_value_is_nodata(band, val)); if (exclude_nodata_value && isnodata) { @@ -3887,8 +3876,6 @@ Datum RASTER_getPixelPolygons(PG_FUNCTION_ARGS) rt_pgraster *pgraster = NULL; rt_raster raster = NULL; rt_band band = NULL; - int hasnodata = FALSE; - double nodataval = 0; int nband = 1; int numbands; bool noband = FALSE; @@ -3983,12 +3970,7 @@ Datum RASTER_getPixelPolygons(PG_FUNCTION_ARGS) break; } - hasnodata = rt_band_get_hasnodata_flag(band); - if (hasnodata) { - rt_band_get_nodata(band, &nodataval); - POSTGIS_RT_DEBUGF(4, "(hasnodata, nodataval) = (%d, %f)", hasnodata, nodataval); - } - else + if (!rt_band_get_hasnodata_flag(band)) exclude_nodata_value = FALSE; } while (0);