From b38d0143a65fff72635b95a61ed6c4c41802889e Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Wed, 11 Nov 2020 23:56:58 +0100 Subject: Polar stereographic at pole: make it return (0,0) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Due to the improved accuracy of pj_tsfn(), it no longer returns 0 when phi=90° due to the conversion in radians. Some GDAL tests are very sensitive to the pole transforming to (0,0) exactly, so add a special case for that. master only --- src/projections/stere.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/projections/stere.cpp') diff --git a/src/projections/stere.cpp b/src/projections/stere.cpp index abc4aa13..3fff722d 100644 --- a/src/projections/stere.cpp +++ b/src/projections/stere.cpp @@ -86,7 +86,10 @@ static PJ_XY stere_e_forward (PJ_LP lp, PJ *P) { /* Ellipsoidal, forwar sinphi = -sinphi; /*-fallthrough*/ case N_POLE: - xy.x = Q->akm1 * pj_tsfn (lp.phi, sinphi, P->e); + if( fabs(lp.phi - M_HALFPI) < 1e-15 ) + xy.x = 0; + else + xy.x = Q->akm1 * pj_tsfn (lp.phi, sinphi, P->e); xy.y = - xy.x * coslam; break; } -- cgit v1.2.3 From 046270a85faf20f38d01e02942d197db74bb8542 Mon Sep 17 00:00:00 2001 From: Kristian Evers Date: Fri, 20 Nov 2020 16:37:12 +0100 Subject: Remove old pj_ memory (de)allocation functions Gone are pj_malloc, pj_calloc, pj_dalloc and pj_dealloc. Their primary function as API memory functions in proj_api.h is no longer there and the other use as a workaround for old errno problems is no longer valid either. Replaced with malloc and free across the codebase. --- src/projections/stere.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/projections/stere.cpp') diff --git a/src/projections/stere.cpp b/src/projections/stere.cpp index 3fff722d..ad1caae2 100644 --- a/src/projections/stere.cpp +++ b/src/projections/stere.cpp @@ -302,7 +302,7 @@ static PJ *setup(PJ *P) { /* general initialization */ PJ *PROJECTION(stere) { - struct pj_opaque *Q = static_cast(pj_calloc (1, sizeof (struct pj_opaque))); + struct pj_opaque *Q = static_cast(calloc (1, sizeof (struct pj_opaque))); if (nullptr==Q) return pj_default_destructor (P, ENOMEM); P->opaque = Q; @@ -315,7 +315,7 @@ PJ *PROJECTION(stere) { PJ *PROJECTION(ups) { - struct pj_opaque *Q = static_cast(pj_calloc (1, sizeof (struct pj_opaque))); + struct pj_opaque *Q = static_cast(calloc (1, sizeof (struct pj_opaque))); if (nullptr==Q) return pj_default_destructor (P, ENOMEM); P->opaque = Q; -- cgit v1.2.3