]> granicus.if.org Git - postgis/commitdiff
Increase double printing buffer, and strip out assertion that buffer is never filled
authorPaul Ramsey <pramsey@cleverelephant.ca>
Thu, 6 Sep 2018 20:17:00 +0000 (20:17 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Thu, 6 Sep 2018 20:17:00 +0000 (20:17 +0000)
(References #4165)

git-svn-id: http://svn.osgeo.org/postgis/branches/2.5@16716 b70326c6-7e19-0410-871a-916f4a2858ee

liblwgeom/lwout_wkt.c
liblwgeom/lwprint.c

index 88106578605b96234398b57740eaff6785ec5fc2..ab05f6b3f93da4195dfe132617a80c7a07442f52 100644 (file)
@@ -85,7 +85,8 @@ static void ptarray_to_wkt_sb(const POINTARRAY *ptarray, stringbuffer_t *sb, int
        /* 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 @@ static void ptarray_to_wkt_sb(const POINTARRAY *ptarray, stringbuffer_t *sb, int
                        lwprint_double(dbl_ptr[j],
                                       precision,
                                       coord,
-                                      OUT_DOUBLE_BUFFER_SIZE);
+                                      buffer_size);
                        stringbuffer_append(sb, coord);
                }
        }
index c588871c43207112431ed623c85bc9917cbdf593..af56c4c2772f4ceeaaa0fc14d4597d1c29dc38fc 100644 (file)
@@ -507,7 +507,6 @@ lwprint_double(double d, int maxdd, char* buf, size_t bufsize)
        {
                length = snprintf(buf, bufsize, "%g", d);
        }
-       assert(length < (int) bufsize);
        trim_trailing_zeros(buf);
        return length;
 }
\ No newline at end of file