From 5c0fddcc54c4606b91bf0d7f074a62b70974355c Mon Sep 17 00:00:00 2001 From: Bborie Park Date: Tue, 5 Mar 2013 16:57:49 +0000 Subject: [PATCH] Minor code cleanup in raster2pgsql and additional debug output for rt_api git-svn-id: http://svn.osgeo.org/postgis/trunk@11145 b70326c6-7e19-0410-871a-916f4a2858ee --- raster/loader/raster2pgsql.c | 8 +++++--- raster/rt_core/rt_api.c | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/raster/loader/raster2pgsql.c b/raster/loader/raster2pgsql.c index a293fc3bc..e556cf254 100644 --- a/raster/loader/raster2pgsql.c +++ b/raster/loader/raster2pgsql.c @@ -78,9 +78,11 @@ raster_destroy(rt_raster raster) { uint16_t nbands = rt_raster_get_num_bands(raster); for (i = 0; i < nbands; i++) { rt_band band = rt_raster_get_band(raster, i); + if (band == NULL) continue; + if (!rt_band_is_offline(band) && !rt_band_get_ownsdata_flag(band)) { - void* mem = rt_band_get_data(band); - if (mem) rtdealloc(mem); + void* mem = rt_band_get_data(band); + if (mem) rtdealloc(mem); } rt_band_destroy(band); } @@ -648,7 +650,7 @@ diff_rastinfo(RASTERINFO *x, RASTERINFO *ref) { err = rt_raster_same_alignment(rx, rref, &aligned, NULL); rt_raster_destroy(rx); rt_raster_destroy(rref); - if (!err) { + if (err != ES_NONE) { rterror(_("diff_rastinfo: Could not run raster alignment test")); return; } diff --git a/raster/rt_core/rt_api.c b/raster/rt_core/rt_api.c index 8f124ff07..fe01b398b 100644 --- a/raster/rt_core/rt_api.c +++ b/raster/rt_core/rt_api.c @@ -7587,7 +7587,8 @@ rt_raster_from_hexwkb(const char* hexwkb, uint32_t hexwkbsize) { assert(NULL != hexwkb); - RASTER_DEBUGF(3, "rt_raster_from_hexwkb: input wkb: %s", hexwkb); + RASTER_DEBUGF(3, "input wkb: %s", hexwkb); + RASTER_DEBUGF(3, "input wkbsize: %s", hexwkbsize); if (hexwkbsize % 2) { rterror("rt_raster_from_hexwkb: Raster HEXWKB input must have an even number of characters"); -- 2.50.1