From: Regina Obe Date: Thu, 28 Mar 2013 09:30:19 +0000 (+0000) Subject: #1668: if mingw64 and it returns <0 switch to _vscprintf native windows implementatio... X-Git-Tag: 2.1.0beta2~138 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1aa9515cfc2c44377d663e3e1d80b44062444f88;p=postgis #1668: if mingw64 and it returns <0 switch to _vscprintf native windows implementation. Thanks to swoodbridge for pointing out the define to use. git-svn-id: http://svn.osgeo.org/postgis/trunk@11217 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/liblwgeom/stringbuffer.c b/liblwgeom/stringbuffer.c index d74dd0d72..e06f291d4 100644 --- a/liblwgeom/stringbuffer.c +++ b/liblwgeom/stringbuffer.c @@ -209,7 +209,11 @@ stringbuffer_avprintf(stringbuffer_t *s, const char *fmt, va_list ap) /* Propogate errors up */ if ( len < 0 ) + #if defined(__MINGW64__) + len = _vscprintf(fmt, ap2);/**Assume windows flaky vsnprintf that returns -1 if initial buffer to small and add more space **/ + #else return len; + #endif /* We didn't have enough space! */ /* Either Unix vsnprint returned write length larger than our buffer */