Changed expressions for pixel byte boundaries in assert tests of rt_raster_serialize and rt_raster_deserialize in rt_api.c. The changed expressions are based upon relative values rather than the original absolute values. This should resolve the problem defined in ticket #1061. It may also help with the crashing in ticket #1066.

Associated tickets are #1061 and possibly #1066.


git-svn-id: http://svn.osgeo.org/postgis/trunk@7597 b70326c6-7e19-0410-871a-916f4a2858ee
This commit is contained in:
Bborie Park 2011-07-06 05:18:50 +00:00
parent 3ed5ac35e7
commit 36c00735b1
2 changed files with 6 additions and 5 deletions

View file

@ -4785,7 +4785,7 @@ rt_raster_serialize(rt_raster raster) {
#endif
/* Consistency checking (ptr is pixbytes-aligned) */
assert(!(((uintptr_t) ptr) % pixbytes));
assert(!((ptr - ret) % pixbytes));
/* Add nodata value */
switch (pixtype) {
@ -4842,7 +4842,7 @@ rt_raster_serialize(rt_raster raster) {
}
/* Consistency checking (ptr is pixbytes-aligned) */
assert(!((uintptr_t) ptr % pixbytes));
assert(!((ptr - ret) % pixbytes));
#if POSTGIS_DEBUG_LEVEL > 2
d_print_binary_hex("nodata", dbg_ptr, size);
@ -4877,7 +4877,7 @@ rt_raster_serialize(rt_raster raster) {
}
/* Consistency checking (ptr is pixbytes-aligned) */
assert(!((uintptr_t) ptr % pixbytes));
assert(!((ptr - ret) % pixbytes));
} /* for-loop over bands */
@ -5037,7 +5037,7 @@ rt_raster_deserialize(void* serialized, int header_only) {
RASTER_DEBUGF(3, "rt_raster_deserialize: nodata value %g", band->nodataval);
/* Consistency checking (ptr is pixbytes-aligned) */
assert(!(((uintptr_t) ptr) % pixbytes));
assert(!((ptr - beg) % pixbytes));
if (band->offline) {
/* Read band number */
@ -5065,7 +5065,7 @@ rt_raster_deserialize(void* serialized, int header_only) {
RASTER_DEBUGF(3, "rt_raster_deserialize: skip %d bytes of 8-bytes boundary padding", ptr - padbeg);
/* Consistency checking (ptr is pixbytes-aligned) */
assert(!((uintptr_t) ptr % pixbytes));
assert(!((ptr - beg) % pixbytes));
}
return rast;

View file

@ -520,6 +520,7 @@ getSRTextSPI(int srid)
return NULL;
}
srs = strncpy(srs, tmp, len + 1);
pfree(tmp);
return srs;
}