From fce22f0c5a755b24f5c8fa9b65d71d8143f80c08 Mon Sep 17 00:00:00 2001 From: Paul Ramsey Date: Sat, 25 Feb 2012 17:10:23 +0000 Subject: [PATCH] Correct fix for win32 crasher, it was proj returning a null error string. git-svn-id: http://svn.osgeo.org/postgis/trunk@9299 b70326c6-7e19-0410-871a-916f4a2858ee --- libpgcommon/lwgeom_transform.c | 12 +++++++----- regress/tickets_expected | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/libpgcommon/lwgeom_transform.c b/libpgcommon/lwgeom_transform.c index 2331d34d7..67953816c 100644 --- a/libpgcommon/lwgeom_transform.c +++ b/libpgcommon/lwgeom_transform.c @@ -380,9 +380,7 @@ char* GetProj4StringSPI(int srid) } else { - SPI_finish(); - pfree(proj_str); - return NULL; + proj_str[0] = 0; } } else @@ -496,9 +494,13 @@ AddToPROJ4SRSCache(PROJ4PortalCache *PROJ4Cache, int srid, int other_srid) projection = lwproj_from_string(proj_str); if ( projection == NULL ) { + char *pj_errstr = pj_strerrno(*pj_get_errno_ref()); + if ( ! pj_errstr ) + pj_errstr = ""; + elog(ERROR, - "AddToPROJ4SRSCache: couldn't parse proj4 string: '%s': %s", - proj_str, pj_strerrno(*pj_get_errno_ref())); + "AddToPROJ4SRSCache: could not parse proj4 string '%s' %s", + proj_str, pj_errstr); } /* diff --git a/regress/tickets_expected b/regress/tickets_expected index 102e475e0..8e13d75ff 100644 --- a/regress/tickets_expected +++ b/regress/tickets_expected @@ -190,7 +190,7 @@ ERROR: MultiSurface cannot contain MultiPoint element at character 8 #852.2|1|t|t #852.2|2|t|t #1489|MULTIPOINT EMPTY|0|MULTILINESTRING EMPTY|0|MULTIPOLYGON EMPTY|0|GEOMETRYCOLLECTION EMPTY|0 -ERROR: GetProj4String returned NULL for SRID (500001) +ERROR: AddToPROJ4SRSCache: could not parse proj4 string '' #1038| #1042|2 #1398a|POINT(-119.093153 45.632669) -- 2.40.0