[postgis-tickets] r16717 - Increase double printing buffer, and strip out assertion that buffer is never filled

Paul Ramsey pramsey at cleverelephant.ca
Thu Sep 6 01:17:50 PDT 2018


Author: pramsey
Date: 2018-09-06 13:17:50 -0700 (Thu, 06 Sep 2018)
New Revision: 16717

Modified:
   trunk/liblwgeom/lwout_wkt.c
   trunk/liblwgeom/lwprint.c
Log:
Increase double printing buffer, and strip out assertion that buffer is never filled
(References #4165)



Modified: trunk/liblwgeom/lwout_wkt.c
===================================================================
--- trunk/liblwgeom/lwout_wkt.c	2018-09-06 20:17:00 UTC (rev 16716)
+++ trunk/liblwgeom/lwout_wkt.c	2018-09-06 20:17:50 UTC (rev 16717)
@@ -85,7 +85,8 @@
 	/* OGC only includes X/Y */
 	uint32_t dimensions = 2;
 	uint32_t i, j;
-	char coord[OUT_DOUBLE_BUFFER_SIZE];
+	static size_t buffer_size = 128;
+	char coord[buffer_size];
 
 	/* ISO and extended formats include all dimensions */
 	if ( variant & ( WKT_ISO | WKT_EXTENDED ) )
@@ -112,7 +113,7 @@
 			lwprint_double(dbl_ptr[j],
 				       precision,
 				       coord,
-				       OUT_DOUBLE_BUFFER_SIZE);
+				       buffer_size);
 			stringbuffer_append(sb, coord);
 		}
 	}

Modified: trunk/liblwgeom/lwprint.c
===================================================================
--- trunk/liblwgeom/lwprint.c	2018-09-06 20:17:00 UTC (rev 16716)
+++ trunk/liblwgeom/lwprint.c	2018-09-06 20:17:50 UTC (rev 16717)
@@ -507,7 +507,6 @@
 	{
 		length = snprintf(buf, bufsize, "%g", d);
 	}
-	assert(length < (int) bufsize);
 	trim_trailing_zeros(buf);
 	return length;
 }
\ No newline at end of file



More information about the postgis-tickets mailing list