From b22c452ef1eb663d6189e7bd2f092ae56bb5f419 Mon Sep 17 00:00:00 2001 From: Frank Warmerdam Date: Wed, 26 Jun 2013 05:33:34 +0000 Subject: ensure thread context is forwarded in pj_ell_set (#199) git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@2367 4e78687f-474d-0410-85f9-8d5e500ac6b2 --- src/pj_ell_set.c | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/pj_ell_set.c b/src/pj_ell_set.c index c0d4adcb..857bd78c 100644 --- a/src/pj_ell_set.c +++ b/src/pj_ell_set.c @@ -19,12 +19,12 @@ pj_ell_set(projCtx ctx, paralist *pl, double *a, double *es) { /* check for varying forms of ellipsoid input */ *a = *es = 0.; /* R takes precedence */ - if (pj_param(NULL, pl, "tR").i) - *a = pj_param(NULL,pl, "dR").f; + if (pj_param(ctx, pl, "tR").i) + *a = pj_param(ctx,pl, "dR").f; else { /* probable elliptical figure */ /* check if ellps present and temporarily append its values to pl */ - if ((name = pj_param(NULL,pl, "sellps").s) != NULL) { + if ((name = pj_param(ctx,pl, "sellps").s) != NULL) { char *s; for (start = pl; start && start->next ; start = start->next) ; @@ -34,50 +34,50 @@ pj_ell_set(projCtx ctx, paralist *pl, double *a, double *es) { curr = curr->next = pj_mkparam(pj_ellps[i].major); curr = curr->next = pj_mkparam(pj_ellps[i].ell); } - *a = pj_param(NULL,pl, "da").f; - if (pj_param(NULL,pl, "tes").i) /* eccentricity squared */ - *es = pj_param(NULL,pl, "des").f; - else if (pj_param(NULL,pl, "te").i) { /* eccentricity */ - e = pj_param(NULL,pl, "de").f; + *a = pj_param(ctx,pl, "da").f; + if (pj_param(ctx,pl, "tes").i) /* eccentricity squared */ + *es = pj_param(ctx,pl, "des").f; + else if (pj_param(ctx,pl, "te").i) { /* eccentricity */ + e = pj_param(ctx,pl, "de").f; *es = e * e; - } else if (pj_param(NULL,pl, "trf").i) { /* recip flattening */ - *es = pj_param(NULL,pl, "drf").f; + } else if (pj_param(ctx,pl, "trf").i) { /* recip flattening */ + *es = pj_param(ctx,pl, "drf").f; if (!*es) { pj_ctx_set_errno( ctx, -10); goto bomb; } *es = 1./ *es; *es = *es * (2. - *es); - } else if (pj_param(NULL,pl, "tf").i) { /* flattening */ - *es = pj_param(NULL,pl, "df").f; + } else if (pj_param(ctx,pl, "tf").i) { /* flattening */ + *es = pj_param(ctx,pl, "df").f; *es = *es * (2. - *es); - } else if (pj_param(NULL,pl, "tb").i) { /* minor axis */ - b = pj_param(NULL,pl, "db").f; + } else if (pj_param(ctx,pl, "tb").i) { /* minor axis */ + b = pj_param(ctx,pl, "db").f; *es = 1. - (b * b) / (*a * *a); } /* else *es == 0. and sphere of radius *a */ if (!b) b = *a * sqrt(1. - *es); /* following options turn ellipsoid into equivalent sphere */ - if (pj_param(NULL,pl, "bR_A").i) { /* sphere--area of ellipsoid */ + if (pj_param(ctx,pl, "bR_A").i) { /* sphere--area of ellipsoid */ *a *= 1. - *es * (SIXTH + *es * (RA4 + *es * RA6)); *es = 0.; - } else if (pj_param(NULL,pl, "bR_V").i) { /* sphere--vol. of ellipsoid */ + } else if (pj_param(ctx,pl, "bR_V").i) { /* sphere--vol. of ellipsoid */ *a *= 1. - *es * (SIXTH + *es * (RV4 + *es * RV6)); *es = 0.; - } else if (pj_param(NULL,pl, "bR_a").i) { /* sphere--arithmetic mean */ + } else if (pj_param(ctx,pl, "bR_a").i) { /* sphere--arithmetic mean */ *a = .5 * (*a + b); *es = 0.; - } else if (pj_param(NULL,pl, "bR_g").i) { /* sphere--geometric mean */ + } else if (pj_param(ctx,pl, "bR_g").i) { /* sphere--geometric mean */ *a = sqrt(*a * b); *es = 0.; - } else if (pj_param(NULL,pl, "bR_h").i) { /* sphere--harmonic mean */ + } else if (pj_param(ctx,pl, "bR_h").i) { /* sphere--harmonic mean */ *a = 2. * *a * b / (*a + b); *es = 0.; - } else if ((i = pj_param(NULL,pl, "tR_lat_a").i) || /* sphere--arith. */ - pj_param(NULL,pl, "tR_lat_g").i) { /* or geom. mean at latitude */ + } else if ((i = pj_param(ctx,pl, "tR_lat_a").i) || /* sphere--arith. */ + pj_param(ctx,pl, "tR_lat_g").i) { /* or geom. mean at latitude */ double tmp; - tmp = sin(pj_param(NULL,pl, i ? "rR_lat_a" : "rR_lat_g").f); + tmp = sin(pj_param(ctx,pl, i ? "rR_lat_a" : "rR_lat_g").f); if (fabs(tmp) > HALFPI) { pj_ctx_set_errno(ctx,-11); goto bomb; -- cgit v1.2.3