Closes #4451
Closes https://github.com/postgis/postgis/pull/433
git-svn-id: http://svn.osgeo.org/postgis/trunk@17585
b70326c6-7e19-0410-871a-
916f4a2858ee
* Major highlights *
- #4433 32-bit hash fix (requires reindexing hash(geometry) indexes) (Raúl Marín)
- #4445, Fix a bug in geometry_le (Raúl Marín)
+ - #4451, Fix the calculation of gserialized_max_header_size (Raúl Marín)
PostGIS 3.0.0alpha3
uint32_t gserialized1_max_header_size(void)
{
- /* read GSERIALIZED size + max bbox according gbox_serialized_size (2 + Z + M) + 1 int for type */
- return sizeof(GSERIALIZED) + 8 * sizeof(float) + sizeof(int);
+ static const intptr_t size_of_gserialized_up_to_data = (intptr_t) & ((GSERIALIZED *)NULL)->data;
+ /* GSERIALIZED size + max bbox according gbox_serialized_size (XYZM*2) + extended flags + type */
+ return size_of_gserialized_up_to_data + 8 * sizeof(float) + sizeof(uint32_t);
}
static uint32_t gserialized1_header_size(const GSERIALIZED *gser)
uint32_t gserialized2_max_header_size(void)
{
- /* read GSERIALIZED size + max bbox according gbox_serialized_size (XYZM*2) + extended flags + 1 int for type */
- return sizeof(GSERIALIZED) + 8 * sizeof(float) + sizeof(uint64_t) + sizeof(int);
+ static const intptr_t size_of_gserialized_up_to_data = (intptr_t) & ((GSERIALIZED *)NULL)->data;
+ /* GSERIALIZED size + max bbox according gbox_serialized_size (XYZM*2) + extended flags + type */
+ return size_of_gserialized_up_to_data + 8 * sizeof(float) + sizeof(uint64_t) + sizeof(uint32_t);
}