diff options
| author | Thomas Knudsen <lastname DOT firstname AT gmail DOT com> | 2016-05-11 08:58:28 +0200 |
|---|---|---|
| committer | Thomas Knudsen <lastname DOT firstname AT gmail DOT com> | 2016-05-11 08:58:28 +0200 |
| commit | f58ba586ebf11700317513f7bb5be84590d37a42 (patch) | |
| tree | 0961d66f6cc07f262ea45e23d55efcd4c90c25c2 | |
| parent | e8ed8e58e8f557fc6f9443a00af1e73a5956c759 (diff) | |
| download | PROJ-f58ba586ebf11700317513f7bb5be84590d37a42.tar.gz PROJ-f58ba586ebf11700317513f7bb5be84590d37a42.zip | |
Portability cleanups for the code in PR #6 (and a few additional source files)
Eliminated mixed code and declarations, converted C++ style comments and
probably did a few more things highlighted by running gcc with the "-W
-Wall -Wextra -pedantic" flags
| -rw-r--r-- | src/PJ_eqdc.c | 6 | ||||
| -rw-r--r-- | src/PJ_labrd.c | 2 | ||||
| -rw-r--r-- | src/PJ_laea.c | 2 | ||||
| -rw-r--r-- | src/PJ_lagrng.c | 2 | ||||
| -rw-r--r-- | src/PJ_lcc.c | 5 | ||||
| -rw-r--r-- | src/PJ_lcca.c | 2 | ||||
| -rw-r--r-- | src/PJ_lsat.c | 4 | ||||
| -rw-r--r-- | src/PJ_minimal.c | 16 | ||||
| -rw-r--r-- | src/PJ_misrsom.c | 6 | ||||
| -rw-r--r-- | src/PJ_mod_ster.c | 52 | ||||
| -rw-r--r-- | src/PJ_nsper.c | 4 | ||||
| -rw-r--r-- | src/PJ_ob_tran.c | 8 | ||||
| -rw-r--r-- | src/PJ_ocea.c | 4 | ||||
| -rw-r--r-- | src/PJ_omerc.c | 8 | ||||
| -rw-r--r-- | src/PJ_sch.c | 72 | ||||
| -rw-r--r-- | src/pj_fwd.c | 2 | ||||
| -rw-r--r-- | src/pj_fwd3d.c | 6 | ||||
| -rw-r--r-- | src/pj_inv.c | 2 | ||||
| -rw-r--r-- | src/pj_inv3d.c | 8 | ||||
| -rw-r--r-- | src/pj_mutex.c | 8 | ||||
| -rw-r--r-- | src/pj_transform.c | 119 | ||||
| -rw-r--r-- | src/pj_utils.c | 30 | ||||
| -rw-r--r-- | src/warnings.pj | 72 |
23 files changed, 259 insertions, 181 deletions
diff --git a/src/PJ_eqdc.c b/src/PJ_eqdc.c index a7308335..917131e1 100644 --- a/src/PJ_eqdc.c +++ b/src/PJ_eqdc.c @@ -86,14 +86,14 @@ static void freeup (PJ *P) { PJ *PROJECTION(eqdc) { + double cosphi, sinphi; + int secant; + struct pj_opaque *Q = pj_calloc (1, sizeof (struct pj_opaque)); if (0==Q) return freeup_new (P); P->opaque = Q; - double cosphi, sinphi; - int secant; - Q->phi1 = pj_param(P->ctx, P->params, "rlat_1").f; Q->phi2 = pj_param(P->ctx, P->params, "rlat_2").f; if (fabs(Q->phi1 + Q->phi2) < EPS10) E_ERROR(-21); diff --git a/src/PJ_labrd.c b/src/PJ_labrd.c index e7bca390..4c435731 100644 --- a/src/PJ_labrd.c +++ b/src/PJ_labrd.c @@ -109,11 +109,11 @@ static void freeup (PJ *P) { PJ *PROJECTION(labrd) { + double Az, sinp, R, N, t; struct pj_opaque *Q = pj_calloc (1, sizeof (struct pj_opaque)); if (0==Q) return freeup_new (P); P->opaque = Q; - double Az, sinp, R, N, t; Q->rot = pj_param(P->ctx, P->params, "bno_rot").i == 0; Az = pj_param(P->ctx, P->params, "razi").f; diff --git a/src/PJ_laea.c b/src/PJ_laea.c index 02b281a4..8393ebd0 100644 --- a/src/PJ_laea.c +++ b/src/PJ_laea.c @@ -222,11 +222,11 @@ static void freeup (PJ *P) { PJ *PROJECTION(laea) { + double t; struct pj_opaque *Q = pj_calloc (1, sizeof (struct pj_opaque)); if (0==Q) return freeup_new (P); P->opaque = Q; - double t; t = fabs(P->phi0); if (fabs(t - HALFPI) < EPS10) diff --git a/src/PJ_lagrng.c b/src/PJ_lagrng.c index 9a018808..244cf043 100644 --- a/src/PJ_lagrng.c +++ b/src/PJ_lagrng.c @@ -49,11 +49,11 @@ static void freeup (PJ *P) { PJ *PROJECTION(lagrng) { + double phi1; struct pj_opaque *Q = pj_calloc (1, sizeof (struct pj_opaque)); if (0==Q) return freeup_new (P); P->opaque = Q; - double phi1; Q->rw = pj_param(P->ctx, P->params, "dW").f; if (Q->rw <= 0) E_ERROR(-27); diff --git a/src/PJ_lcc.c b/src/PJ_lcc.c index 28275089..e7b74be4 100644 --- a/src/PJ_lcc.c +++ b/src/PJ_lcc.c @@ -98,13 +98,14 @@ static void freeup (PJ *P) { PJ *PROJECTION(lcc) { + double cosphi, sinphi; + int secant; struct pj_opaque *Q = pj_calloc (1, sizeof (struct pj_opaque)); + if (0==Q) return freeup_new (P); P->opaque = Q; - double cosphi, sinphi; - int secant; Q->phi1 = pj_param(P->ctx, P->params, "rlat_1").f; if (pj_param(P->ctx, P->params, "tlat_2").i) diff --git a/src/PJ_lcca.c b/src/PJ_lcca.c index eef46110..50c89978 100644 --- a/src/PJ_lcca.c +++ b/src/PJ_lcca.c @@ -83,11 +83,11 @@ static void freeup (PJ *P) { PJ *PROJECTION(lcca) { + double s2p0, N0, R0, tan0; struct pj_opaque *Q = pj_calloc (1, sizeof (struct pj_opaque)); if (0==Q) return freeup_new (P); P->opaque = Q; - double s2p0, N0, R0, tan0; (Q->en = pj_enfn(P->es)); if (!Q->en) E_ERROR_0; diff --git a/src/PJ_lsat.c b/src/PJ_lsat.c index 2dcdb000..fa96407b 100644 --- a/src/PJ_lsat.c +++ b/src/PJ_lsat.c @@ -158,12 +158,12 @@ static void freeup (PJ *P) { PJ *PROJECTION(lsat) { + int land, path; + double lam, alf, esc, ess; struct pj_opaque *Q = pj_calloc (1, sizeof (struct pj_opaque)); if (0==Q) return freeup_new (P); P->opaque = Q; - int land, path; - double lam, alf, esc, ess; land = pj_param(P->ctx, P->params, "ilsat").i; if (land <= 0 || land > 5) E_ERROR(-28); diff --git a/src/PJ_minimal.c b/src/PJ_minimal.c index 824d8b99..1108c4fa 100644 --- a/src/PJ_minimal.c +++ b/src/PJ_minimal.c @@ -127,7 +127,7 @@ PROJ_HEAD(minimal, "Minimal example (brief description goes here)"); /* Projection specific elements for the PJ object */ -struct opaque { +struct pj_opaque { double a; int b; }; @@ -155,7 +155,7 @@ static LP e_inverse (XY xy, PJ *P) { /* Ellipsoidal, inverse */ LP lp = {0.0,0.0}; /* Actual ellipsoidal forward code goes here */ lp.lam = xy.x - P->es; - lp.phi = xy.y - P->opaq->b; + lp.phi = xy.y - P->opaque->b; return lp; } @@ -164,7 +164,7 @@ static LP s_inverse (XY xy, PJ *P) { /* Spheroidal, inverse */ LP lp = {0.0,0.0}; /* Actual spheroidal forward code goes here */ lp.lam = xy.x - P->es; - lp.phi = xy.y - P->opaq->b; + lp.phi = xy.y - P->opaque->b; return lp; } @@ -173,21 +173,21 @@ static void freeup(PJ *P) { /* Destructor */ if (P==0) return; /* Projection specific deallocation goes here */ - pj_dealloc (P->opaq); + pj_dealloc (P->opaque); pj_dealloc (P); return; } PJ *pj_projection_specific_setup_minimal (PJ *P) { - pj_prepare (P, des_minimal, freeup, sizeof (struct opaque)); - if (0==P->opaq) { + pj_prepare (P, des_minimal, freeup, sizeof (struct pj_opaque)); + if (0==P->opaque) { freeup (P); return 0; } - P->opaq->a = 42.42; - P->opaq->b = 42; + P->opaque->a = 42.42; + P->opaque->b = 42; /* Spheroidal? */ if (0==P->es) { diff --git a/src/PJ_misrsom.c b/src/PJ_misrsom.c index fdafbd7c..c164b1c7 100644 --- a/src/PJ_misrsom.c +++ b/src/PJ_misrsom.c @@ -175,14 +175,14 @@ static void freeup (PJ *P) { PJ *PROJECTION(misrsom) { + int path; + double lam, alf, esc, ess; + struct pj_opaque *Q = pj_calloc (1, sizeof (struct pj_opaque)); if (0==Q) return freeup_new (P); P->opaque = Q; - int path; - double lam, alf, esc, ess; - path = pj_param(P->ctx, P->params, "ipath").i; if (path <= 0 || path > 233) E_ERROR(-29); P->lam0 = DEG_TO_RAD * 129.3056 - TWOPI / 233. * path; diff --git a/src/PJ_mod_ster.c b/src/PJ_mod_ster.c index 551b83bd..7de7c01b 100644 --- a/src/PJ_mod_ster.c +++ b/src/PJ_mod_ster.c @@ -85,7 +85,7 @@ static LP e_inverse (XY xy, PJ *P) { /* Ellipsoidal, inverse */ } if (nn) { lp.phi = phi; - lp.lam = atan2(p.r * sinz, rh * Q->cchio * cosz - p.i * + lp.lam = atan2(p.r * sinz, rh * Q->cchio * cosz - p.i * Q->schio * sinz); } else lp.lam = lp.phi = HUGE_VAL; @@ -129,17 +129,17 @@ static PJ *setup(PJ *P) { /* general initialization */ /* Miller Oblated Stereographic */ PJ *PROJECTION(mil_os) { - struct pj_opaque *Q = pj_calloc (1, sizeof (struct pj_opaque)); - if (0==Q) - return freeup_new (P); - P->opaque = Q; - static COMPLEX AB[] = { {0.924500, 0.}, {0., 0.}, {0.019430, 0.} }; + struct pj_opaque *Q = pj_calloc (1, sizeof (struct pj_opaque)); + if (0==Q) + return freeup_new (P); + P->opaque = Q; + Q->n = 2; P->lam0 = DEG_TO_RAD * 20.; P->phi0 = DEG_TO_RAD * 18.; @@ -152,17 +152,17 @@ PJ *PROJECTION(mil_os) { /* Lee Oblated Stereographic */ PJ *PROJECTION(lee_os) { - struct pj_opaque *Q = pj_calloc (1, sizeof (struct pj_opaque)); - if (0==Q) - return freeup_new (P); - P->opaque = Q; - static COMPLEX AB[] = { {0.721316, 0.}, {0., 0.}, {-0.0088162, -0.00617325} }; + struct pj_opaque *Q = pj_calloc (1, sizeof (struct pj_opaque)); + if (0==Q) + return freeup_new (P); + P->opaque = Q; + Q->n = 2; P->lam0 = DEG_TO_RAD * -165.; P->phi0 = DEG_TO_RAD * -10.; @@ -174,11 +174,6 @@ PJ *PROJECTION(lee_os) { PJ *PROJECTION(gs48) { - struct pj_opaque *Q = pj_calloc (1, sizeof (struct pj_opaque)); - if (0==Q) - return freeup_new (P); - P->opaque = Q; - static COMPLEX /* 48 United States */ AB[] = { {0.98879, 0.}, @@ -188,6 +183,11 @@ PJ *PROJECTION(gs48) { {0.075528, 0.} }; + struct pj_opaque *Q = pj_calloc (1, sizeof (struct pj_opaque)); + if (0==Q) + return freeup_new (P); + P->opaque = Q; + Q->n = 4; P->lam0 = DEG_TO_RAD * -96.; P->phi0 = DEG_TO_RAD * -39.; @@ -200,11 +200,6 @@ PJ *PROJECTION(gs48) { PJ *PROJECTION(alsk) { - struct pj_opaque *Q = pj_calloc (1, sizeof (struct pj_opaque)); - if (0==Q) - return freeup_new (P); - P->opaque = Q; - static COMPLEX ABe[] = { /* Alaska ellipsoid */ { .9945303, 0.}, { .0052083, -.0027404}, @@ -223,6 +218,11 @@ PJ *PROJECTION(alsk) { { .3660976, -.2937382} }; + struct pj_opaque *Q = pj_calloc (1, sizeof (struct pj_opaque)); + if (0==Q) + return freeup_new (P); + P->opaque = Q; + Q->n = 5; P->lam0 = DEG_TO_RAD * -152.; P->phi0 = DEG_TO_RAD * 64.; @@ -240,11 +240,6 @@ PJ *PROJECTION(alsk) { PJ *PROJECTION(gs50) { - struct pj_opaque *Q = pj_calloc (1, sizeof (struct pj_opaque)); - if (0==Q) - return freeup_new (P); - P->opaque = Q; - static COMPLEX ABe[] = { /* GS50 ellipsoid */ { .9827497, 0.}, { .0210669, .0053804}, @@ -271,6 +266,11 @@ PJ *PROJECTION(gs50) { {-.0225161, .0853673} }; + struct pj_opaque *Q = pj_calloc (1, sizeof (struct pj_opaque)); + if (0==Q) + return freeup_new (P); + P->opaque = Q; + Q->n = 9; P->lam0 = DEG_TO_RAD * -120.; P->phi0 = DEG_TO_RAD * 45.; diff --git a/src/PJ_nsper.c b/src/PJ_nsper.c index 2a0ea702..7e3fcda8 100644 --- a/src/PJ_nsper.c +++ b/src/PJ_nsper.c @@ -180,13 +180,13 @@ PJ *PROJECTION(nsper) { PJ *PROJECTION(tpers) { + double omega, gamma; + struct pj_opaque *Q = pj_calloc (1, sizeof (struct pj_opaque)); if (0==Q) return freeup_new (P); P->opaque = Q; - double omega, gamma; - omega = pj_param(P->ctx, P->params, "dtilt").f * DEG_TO_RAD; gamma = pj_param(P->ctx, P->params, "dazi").f * DEG_TO_RAD; Q->tilt = 1; diff --git a/src/PJ_ob_tran.c b/src/PJ_ob_tran.c index 76222fe9..634bb552 100644 --- a/src/PJ_ob_tran.c +++ b/src/PJ_ob_tran.c @@ -100,15 +100,15 @@ static void freeup (PJ *P) { PJ *PROJECTION(ob_tran) { + int i; + double phip; + char *name, *s; + struct pj_opaque *Q = pj_calloc (1, sizeof (struct pj_opaque)); if (0==Q) return freeup_new (P); P->opaque = Q; - int i; - double phip; - char *name, *s; - /* get name of projection to be translated */ if (!(name = pj_param(P->ctx, P->params, "so_proj").s)) E_ERROR(-26); for (i = 0; (s = pj_list[i].id) && strcmp(name, s) ; ++i) ; diff --git a/src/PJ_ocea.c b/src/PJ_ocea.c index 72414e7f..817f0ce6 100644 --- a/src/PJ_ocea.c +++ b/src/PJ_ocea.c @@ -62,13 +62,13 @@ static void freeup (PJ *P) { PJ *PROJECTION(ocea) { + double phi_0=0.0, phi_1, phi_2, lam_1, lam_2, lonz, alpha; + struct pj_opaque *Q = pj_calloc (1, sizeof (struct pj_opaque)); if (0==Q) return freeup_new (P); P->opaque = Q; - double phi_0=0.0, phi_1, phi_2, lam_1, lam_2, lonz, alpha; - Q->rok = P->a / P->k0; Q->rtk = P->a * P->k0; /*If the keyword "alpha" is found in the sentence then use 1point+1azimuth*/ diff --git a/src/PJ_omerc.c b/src/PJ_omerc.c index 3b25fb26..e248b8cc 100644 --- a/src/PJ_omerc.c +++ b/src/PJ_omerc.c @@ -123,15 +123,15 @@ static void freeup (PJ *P) { PJ *PROJECTION(omerc) { + double con, com, cosph0, D, F, H, L, sinph0, p, J, gamma=0, + gamma0, lamc=0, lam1=0, lam2=0, phi1=0, phi2=0, alpha_c=0; + int alp, gam, no_off = 0; + struct pj_opaque *Q = pj_calloc (1, sizeof (struct pj_opaque)); if (0==Q) return freeup_new (P); P->opaque = Q; - double con, com, cosph0, D, F, H, L, sinph0, p, J, gamma=0, - gamma0, lamc=0, lam1=0, lam2=0, phi1=0, phi2=0, alpha_c=0; - int alp, gam, no_off = 0; - Q->no_rot = pj_param(P->ctx, P->params, "tno_rot").i; if ((alp = pj_param(P->ctx, P->params, "talpha").i) != 0) alpha_c = pj_param(P->ctx, P->params, "ralpha").f; diff --git a/src/PJ_sch.c b/src/PJ_sch.c index 29b7b34c..048224ec 100644 --- a/src/PJ_sch.c +++ b/src/PJ_sch.c @@ -56,7 +56,7 @@ static LPZ inverse3d(XYZ xyz, PJ *P) { double temp[3]; double pxyz[3]; - //Local lat,lon using radius + /* Local lat,lon using radius */ pxyz[0] = xyz.y * P->a / Q->rcurv; pxyz[1] = xyz.x * P->a / Q->rcurv; pxyz[2] = xyz.z; @@ -65,17 +65,17 @@ static LPZ inverse3d(XYZ xyz, PJ *P) { temp, temp+1, temp+2) != 0) I3_ERROR; - //Apply rotation + /* Apply rotation */ pxyz[0] = Q->transMat[0] * temp[0] + Q->transMat[1] * temp[1] + Q->transMat[2] * temp[2]; pxyz[1] = Q->transMat[3] * temp[0] + Q->transMat[4] * temp[1] + Q->transMat[5] * temp[2]; pxyz[2] = Q->transMat[6] * temp[0] + Q->transMat[7] * temp[1] + Q->transMat[8] * temp[2]; - //Apply offset + /* Apply offset */ pxyz[0] += Q->xyzoff[0]; pxyz[1] += Q->xyzoff[1]; pxyz[2] += Q->xyzoff[2]; - //Convert geocentric coordinates to lat lon + /* Convert geocentric coordinates to lat lon */ pj_Convert_Geocentric_To_Geodetic( &(Q->elp_0), pxyz[0], pxyz[1], pxyz[2], temp, temp+1, temp+2); @@ -84,9 +84,11 @@ static LPZ inverse3d(XYZ xyz, PJ *P) { lpz.phi = temp[0] ; lpz.z = temp[2]; - // printf("INVERSE: \n"); - // printf("XYZ: %f %f %f \n", xyz.x, xyz.y, xyz.z); - // printf("LPZ: %f %f %f \n", lpz.lam, lpz.phi, lpz.z); +#if 0 + printf("INVERSE: \n"); + printf("XYZ: %f %f %f \n", xyz.x, xyz.y, xyz.z); + printf("LPZ: %f %f %f \n", lpz.lam, lpz.phi, lpz.z); +#endif return lpz; } @@ -97,37 +99,38 @@ static XYZ forward3d(LPZ lpz, PJ *P) { double pxyz[3]; - //Convert lat lon to geocentric coordinates + /* Convert lat lon to geocentric coordinates */ if( pj_Convert_Geodetic_To_Geocentric( &(Q->elp_0), lpz.phi, lpz.lam, lpz.z, temp, temp+1, temp+2 ) != 0 ) F3_ERROR; - //Adjust for offset + /* Adjust for offset */ temp[0] -= Q->xyzoff[0]; temp[1] -= Q->xyzoff[1]; temp[2] -= Q->xyzoff[2]; - //Apply rotation + /* Apply rotation */ pxyz[0] = Q->transMat[0] * temp[0] + Q->transMat[3] * temp[1] + Q->transMat[6] * temp[2]; pxyz[1] = Q->transMat[1] * temp[0] + Q->transMat[4] * temp[1] + Q->transMat[7] * temp[2]; pxyz[2] = Q->transMat[2] * temp[0] + Q->transMat[5] * temp[1] + Q->transMat[8] * temp[2]; - //Convert to local lat,lon + /* Convert to local lat,lon */ pj_Convert_Geocentric_To_Geodetic( &(Q->sph), pxyz[0], pxyz[1], pxyz[2], temp, temp+1, temp+2); - //Scale by radius + /* Scale by radius */ xyz.x = temp[1] * Q->rcurv / P->a; xyz.y = temp[0] * Q->rcurv / P->a; xyz.z = temp[2]; - // printf("FORWARD: \n"); - // printf("LPZ: %f %f %f \n", lpz.lam, lpz.phi, lpz.z); - // printf("XYZ: %f %f %f \n", xyz.x, xyz.y, xyz.z); - +#if 0 + printf("FORWARD: \n"); + printf("LPZ: %f %f %f \n", lpz.lam, lpz.phi, lpz.z); + printf("XYZ: %f %f %f \n", xyz.x, xyz.y, xyz.z); +#endif return xyz; } @@ -158,7 +161,7 @@ static PJ *setup(PJ *P) { /* general initialization */ temp = P->a * sqrt(1.0 - P->es); - //Setup original geocentric system + /* Setup original geocentric system */ if ( pj_Set_Geocentric_Parameters(&(Q->elp_0), P->a, temp) != 0) E_ERROR(-37); @@ -167,7 +170,7 @@ static PJ *setup(PJ *P) { /* general initialization */ clo = cos(Q->plon); slo = sin(Q->plon); - //Estimate the radius of curvature for given peg + /* Estimate the radius of curvature for given peg */ temp = sqrt(1.0 - (P->es) * slt * slt); reast = (P->a)/temp; rnorth = (P->a) * (1.0 - (P->es))/pow(temp,3); @@ -177,15 +180,17 @@ static PJ *setup(PJ *P) { /* general initialization */ Q->rcurv = Q->h0 + (reast*rnorth)/(reast * chdg * chdg + rnorth * shdg * shdg); - // printf("North Radius: %f \n", rnorth); - // printf("East Radius: %f \n", reast); - // printf("Effective Radius: %f \n", Q->rcurv); +#if 0 + printf("North Radius: %f \n", rnorth); + printf("East Radius: %f \n", reast); + printf("Effective Radius: %f \n", Q->rcurv); +#endif - //Set up local sphere at the given peg point + /* Set up local sphere at the given peg point */ if ( pj_Set_Geocentric_Parameters(&(Q->sph), Q->rcurv, Q->rcurv) != 0) E_ERROR(-37); - //Set up the transformation matrices + /* Set up the transformation matrices */ Q->transMat[0] = clt * clo; Q->transMat[1] = -shdg*slo - slt*clo * chdg; Q->transMat[2] = slo*chdg - slt*clo*shdg; @@ -208,8 +213,9 @@ static PJ *setup(PJ *P) { /* general initialization */ Q->xyzoff[1] = pxyz[1] - (Q->rcurv) * clt * slo; Q->xyzoff[2] = pxyz[2] - (Q->rcurv) * slt; - // printf("Offset: %f %f %f \n", Q->xyzoff[0], Q->xyzoff[1], Q->xyzoff[2]); - +#if 0 + printf("Offset: %f %f %f \n", Q->xyzoff[0], Q->xyzoff[1], Q->xyzoff[2]); +#endif P->fwd3d = forward3d; P->inv3d = inverse3d; @@ -225,33 +231,33 @@ PJ *PROJECTION(sch) { Q->h0 = 0.0; - //Check if peg latitude was defined + /* Check if peg latitude was defined */ if (pj_param(P->ctx, P->params, "tplat_0").i) Q->plat = pj_param(P->ctx, P->params, "rplat_0").f; else E_ERROR(-37); - //Check if peg longitude was defined + /* Check if peg longitude was defined */ if (pj_param(P->ctx, P->params, "tplon_0").i) Q->plon = pj_param(P->ctx, P->params, "rplon_0").f; else E_ERROR(-37); - //Check if peg latitude is defined + /* Check if peg latitude is defined */ if (pj_param(P->ctx, P->params, "tphdg_0").i) Q->phdg = pj_param(P->ctx, P->params, "rphdg_0").f; else E_ERROR(-37); - //Check if average height was defined - //If so read it in + /* Check if average height was defined - If so read it in */ if (pj_param(P->ctx, P->params, "th_0").i) Q->h0 = pj_param(P->ctx, P->params, "dh_0").f; - //Completed reading in the projection parameters - //printf("PSA: Lat = %f Lon = %f Hdg = %f \n", Q->plat, Q->plon, Q->phdg); - + /* Completed reading in the projection parameters */ +#if 0 + printf("PSA: Lat = %f Lon = %f Hdg = %f \n", Q->plat, Q->plon, Q->phdg); +#endif return setup(P); } diff --git a/src/pj_fwd.c b/src/pj_fwd.c index 1cd002b5..d4948d99 100644 --- a/src/pj_fwd.c +++ b/src/pj_fwd.c @@ -25,7 +25,7 @@ pj_fwd(LP lp, PJ *P) { if (!P->over) lp.lam = adjlon(lp.lam); /* adjust del longitude */ - //Check for NULL pointer + /* Check for NULL pointer */ if (P->fwd != NULL) { xy = (*P->fwd)(lp, P); /* project */ diff --git a/src/pj_fwd3d.c b/src/pj_fwd3d.c index 834746d4..9da8a482 100644 --- a/src/pj_fwd3d.c +++ b/src/pj_fwd3d.c @@ -19,13 +19,13 @@ pj_fwd3d(LPZ lpz, PJ *P) { if (fabs(t) <= EPS) lpz.phi = lpz.phi < 0. ? -HALFPI : HALFPI; - else if (P->geoc) //Maybe redundant and never used. + else if (P->geoc) /* Maybe redundant and never used. */ lpz.phi = atan(P->rone_es * tan(lpz.phi)); lpz.lam -= P->lam0; /* compute del lp.lam */ if (!P->over) lpz.lam = adjlon(lpz.lam); /* adjust del longitude */ - //Check for NULL pointer + /* Check for NULL pointer */ if (P->fwd3d != NULL) { xyz = (*P->fwd3d)(lpz, P); /* project */ @@ -35,7 +35,7 @@ pj_fwd3d(LPZ lpz, PJ *P) { else { xyz.x = P->fr_meter * (P->a * xyz.x + P->x0); xyz.y = P->fr_meter * (P->a * xyz.y + P->y0); - //z is not scaled since this handled by vto_meter outside + /* z is not scaled since this handled by vto_meter outside */ } } else diff --git a/src/pj_inv.c b/src/pj_inv.c index d77b4e56..711a0005 100644 --- a/src/pj_inv.c +++ b/src/pj_inv.c @@ -20,7 +20,7 @@ pj_inv(XY xy, PJ *P) { xy.x = (xy.x * P->to_meter - P->x0) * P->ra; /* descale and de-offset */ xy.y = (xy.y * P->to_meter - P->y0) * P->ra; - //Check for NULL pointer + /* Check for NULL pointer */ if (P->inv != NULL) { lp = (*P->inv)(xy, P); /* inverse project */ diff --git a/src/pj_inv3d.c b/src/pj_inv3d.c index de35e776..d06ed080 100644 --- a/src/pj_inv3d.c +++ b/src/pj_inv3d.c @@ -19,9 +19,9 @@ pj_inv3d(XYZ xyz, PJ *P) { xyz.x = (xyz.x * P->to_meter - P->x0) * P->ra; /* descale and de-offset */ xyz.y = (xyz.y * P->to_meter - P->y0) * P->ra; - //z is not scaled since that is handled by vto_meter before we get here - - //Check for NULL pointer + /* z is not scaled since that is handled by vto_meter before we get here */ + + /* Check for NULL pointer */ if (P->inv3d != NULL) { lpz = (*P->inv3d)(xyz, P); /* inverse project */ @@ -32,7 +32,7 @@ pj_inv3d(XYZ xyz, PJ *P) { if (!P->over) lpz.lam = adjlon(lpz.lam); /* adjust longitude to CM */ - //This maybe redundant and never user + /* This may be redundant and never used */ if (P->geoc && fabs(fabs(lpz.phi)-HALFPI) > EPS) lpz.phi = atan(P->one_es * tan(lpz.phi)); } diff --git a/src/pj_mutex.c b/src/pj_mutex.c index dc484c69..2f6533be 100644 --- a/src/pj_mutex.c +++ b/src/pj_mutex.c @@ -29,7 +29,7 @@ /* projects.h and windows.h conflict - avoid this! */ #if defined(MUTEX_pthread) && !defined(_XOPEN_SOURCE) -// For pthread_mutexattr_settype +/* For pthread_mutexattr_settype */ #define _XOPEN_SOURCE 500 #endif @@ -86,7 +86,7 @@ void pj_cleanup_lock() { } -#endif // def MUTEX_stub +#endif /* def MUTEX_stub */ /************************************************************************/ /* ==================================================================== */ @@ -154,7 +154,7 @@ void pj_cleanup_lock() { } -#endif // def MUTEX_pthread +#endif /* def MUTEX_pthread */ /************************************************************************/ /* ==================================================================== */ @@ -219,4 +219,4 @@ void pj_cleanup_lock() } } -#endif // def MUTEX_win32 +#endif /* def MUTEX_win32 */ diff --git a/src/pj_transform.c b/src/pj_transform.c index 32f14955..ce7b96a3 100644 --- a/src/pj_transform.c +++ b/src/pj_transform.c @@ -1,6 +1,6 @@ /****************************************************************************** * Project: PROJ.4 - * Purpose: Perform overall coordinate system to coordinate system + * Purpose: Perform overall coordinate system to coordinate system * transformations (pj_transform() function) including reprojection * and datum shifting. * Author: Frank Warmerdam, warmerdam@pobox.com @@ -33,7 +33,7 @@ #include "geocent.h" static int pj_adjust_axis( projCtx ctx, const char *axis, int denormalize_flag, - long point_count, int point_offset, + long point_count, int point_offset, double *x, double *y, double *z ); #ifndef SRS_WGS84_SEMIMAJOR @@ -52,23 +52,23 @@ static int pj_adjust_axis( projCtx ctx, const char *axis, int denormalize_flag, #define Rz_BF (defn->datum_params[5]) #define M_BF (defn->datum_params[6]) -/* -** This table is intended to indicate for any given error code in +/* +** This table is intended to indicate for any given error code in ** the range 0 to -44, whether that error will occur for all locations (ie. ** it is a problem with the coordinate system as a whole) in which case the ** value would be 0, or if the problem is with the point being transformed -** in which case the value is 1. +** in which case the value is 1. ** ** At some point we might want to move this array in with the error message -** list or something, but while experimenting with it this should be fine. +** list or something, but while experimenting with it this should be fine. */ static const int transient_error[50] = { /* 0 1 2 3 4 5 6 7 8 9 */ - /* 0 to 9 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - /* 10 to 19 */ 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, - /* 20 to 29 */ 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, - /* 30 to 39 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + /* 0 to 9 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + /* 10 to 19 */ 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, + /* 20 to 29 */ 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, + /* 30 to 39 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 40 to 49 */ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 }; /************************************************************************/ @@ -101,7 +101,7 @@ int pj_transform( PJ *srcdefn, PJ *dstdefn, long point_count, int point_offset, { int err; - err = pj_adjust_axis( srcdefn->ctx, srcdefn->axis, + err = pj_adjust_axis( srcdefn->ctx, srcdefn->axis, 0, point_count, point_offset, x, y, z ); if( err != 0 ) return err; @@ -140,7 +140,7 @@ int pj_transform( PJ *srcdefn, PJ *dstdefn, long point_count, int point_offset, } err = pj_geocentric_to_geodetic( srcdefn->a_orig, srcdefn->es_orig, - point_count, point_offset, + point_count, point_offset, x, y, z ); if( err != 0 ) return err; @@ -153,19 +153,19 @@ int pj_transform( PJ *srcdefn, PJ *dstdefn, long point_count, int point_offset, else if( !srcdefn->is_latlong ) { - //Check first if projection is invertible. + /* Check first if projection is invertible. */ if( (srcdefn->inv3d == NULL) && (srcdefn->inv == NULL)) { pj_ctx_set_errno( pj_get_ctx(srcdefn), -17 ); - pj_log( pj_get_ctx(srcdefn), PJ_LOG_ERROR, + pj_log( pj_get_ctx(srcdefn), PJ_LOG_ERROR, "pj_transform(): source projection not invertable" ); return -17; } - //If invertible - First try inv3d if defined + /* If invertible - First try inv3d if defined */ if (srcdefn->inv3d != NULL) { - //Three dimensions must be defined + /* Three dimensions must be defined */ if ( z == NULL) { pj_ctx_set_errno( pj_get_ctx(srcdefn), PJD_ERR_GEOCENTRIC); @@ -187,9 +187,9 @@ int pj_transform( PJ *srcdefn, PJ *dstdefn, long point_count, int point_offset, geodetic_loc = pj_inv3d(projected_loc, srcdefn); if( srcdefn->ctx->last_errno != 0 ) { - if( (srcdefn->ctx->last_errno != 33 /*EDOM*/ + if( (srcdefn->ctx->last_errno != 33 /*EDOM*/ && srcdefn->ctx->last_errno != 34 /*ERANGE*/ ) - && (srcdefn->ctx->last_errno > 0 + && (srcdefn->ctx->last_errno > 0 || srcdefn->ctx->last_errno < -44 || point_count == 1 || transient_error[-srcdefn->ctx->last_errno] == 0 ) ) return srcdefn->ctx->last_errno; @@ -210,7 +210,7 @@ int pj_transform( PJ *srcdefn, PJ *dstdefn, long point_count, int point_offset, } else { - //Fallback to the original PROJ.4 API 2d inversion- inv + /* Fallback to the original PROJ.4 API 2d inversion - inv */ for( i = 0; i < point_count; i++ ) { XY projected_loc; @@ -225,9 +225,9 @@ int pj_transform( PJ *srcdefn, PJ *dstdefn, long point_count, int point_offset, geodetic_loc = pj_inv( projected_loc, srcdefn ); if( srcdefn->ctx->last_errno != 0 ) { - if( (srcdefn->ctx->last_errno != 33 /*EDOM*/ + if( (srcdefn->ctx->last_errno != 33 /*EDOM*/ && srcdefn->ctx->last_errno != 34 /*ERANGE*/ ) - && (srcdefn->ctx->last_errno > 0 + && (srcdefn->ctx->last_errno > 0 || srcdefn->ctx->last_errno < -44 || point_count == 1 || transient_error[-srcdefn->ctx->last_errno] == 0 ) ) return srcdefn->ctx->last_errno; @@ -262,17 +262,17 @@ int pj_transform( PJ *srcdefn, PJ *dstdefn, long point_count, int point_offset, /* -------------------------------------------------------------------- */ if( srcdefn->has_geoid_vgrids && z != NULL ) { - if( pj_apply_vgridshift( srcdefn, "sgeoidgrids", - &(srcdefn->vgridlist_geoid), + if( pj_apply_vgridshift( srcdefn, "sgeoidgrids", + &(srcdefn->vgridlist_geoid), &(srcdefn->vgridlist_geoid_count), 0, point_count, point_offset, x, y, z ) != 0 ) return pj_ctx_get_errno(srcdefn->ctx); } - + /* -------------------------------------------------------------------- */ /* Convert datums if needed, and possible. */ /* -------------------------------------------------------------------- */ - if( pj_datum_transform( srcdefn, dstdefn, point_count, point_offset, + if( pj_datum_transform( srcdefn, dstdefn, point_count, point_offset, x, y, z ) != 0 ) { if( srcdefn->ctx->last_errno != 0 ) @@ -287,13 +287,13 @@ int pj_transform( PJ *srcdefn, PJ *dstdefn, long point_count, int point_offset, /* -------------------------------------------------------------------- */ if( dstdefn->has_geoid_vgrids && z != NULL ) { - if( pj_apply_vgridshift( dstdefn, "sgeoidgrids", - &(dstdefn->vgridlist_geoid), + if( pj_apply_vgridshift( dstdefn, "sgeoidgrids", + &(dstdefn->vgridlist_geoid), &(dstdefn->vgridlist_geoid_count), 1, point_count, point_offset, x, y, z ) != 0 ) return dstdefn->ctx->last_errno; } - + /* -------------------------------------------------------------------- */ /* But if they are staying lat long, adjust for the prime */ /* meridian if there is one in effect. */ @@ -348,7 +348,7 @@ int pj_transform( PJ *srcdefn, PJ *dstdefn, long point_count, int point_offset, { XYZ projected_loc; LPZ geodetic_loc; - + geodetic_loc.u = x[point_offset*i]; geodetic_loc.v = y[point_offset*i]; geodetic_loc.w = z[point_offset*i]; @@ -359,9 +359,9 @@ int pj_transform( PJ *srcdefn, PJ *dstdefn, long point_count, int point_offset, projected_loc = pj_fwd3d( geodetic_loc, dstdefn); if( dstdefn->ctx->last_errno != 0 ) { - if( (dstdefn->ctx->last_errno != 33 /*EDOM*/ + if( (dstdefn->ctx->last_errno != 33 /*EDOM*/ && dstdefn->ctx->last_errno != 34 /*ERANGE*/ ) - && (dstdefn->ctx->last_errno > 0 + && (dstdefn->ctx->last_errno > 0 || dstdefn->ctx->last_errno < -44 || point_count == 1 || transient_error[-dstdefn->ctx->last_errno] == 0 ) ) return dstdefn->ctx->last_errno; @@ -371,7 +371,7 @@ int pj_transform( PJ *srcdefn, PJ *dstdefn, long point_count, int point_offset, projected_loc.v = HUGE_VAL; projected_loc.w = HUGE_VAL; } - } + } x[point_offset*i] = projected_loc.u; y[point_offset*i] = projected_loc.v; @@ -395,9 +395,9 @@ int pj_transform( PJ *srcdefn, PJ *dstdefn, long point_count, int point_offset, projected_loc = pj_fwd( geodetic_loc, dstdefn ); if( dstdefn->ctx->last_errno != 0 ) { - if( (dstdefn->ctx->last_errno != 33 /*EDOM*/ + if( (dstdefn->ctx->last_errno != 33 /*EDOM*/ && dstdefn->ctx->last_errno != 34 /*ERANGE*/ ) - && (dstdefn->ctx->last_errno > 0 + && (dstdefn->ctx->last_errno > 0 || dstdefn->ctx->last_errno < -44 || point_count == 1 || transient_error[-dstdefn->ctx->last_errno] == 0 ) ) return dstdefn->ctx->last_errno; @@ -406,7 +406,7 @@ int pj_transform( PJ *srcdefn, PJ *dstdefn, long point_count, int point_offset, projected_loc.u = HUGE_VAL; projected_loc.v = HUGE_VAL; } - } + } x[point_offset*i] = projected_loc.u; y[point_offset*i] = projected_loc.v; @@ -449,7 +449,7 @@ int pj_transform( PJ *srcdefn, PJ *dstdefn, long point_count, int point_offset, { int err; - err = pj_adjust_axis( dstdefn->ctx, dstdefn->axis, + err = pj_adjust_axis( dstdefn->ctx, dstdefn->axis, 1, point_count, point_offset, x, y, z ); if( err != 0 ) return err; @@ -462,7 +462,7 @@ int pj_transform( PJ *srcdefn, PJ *dstdefn, long point_count, int point_offset, /* pj_geodetic_to_geocentric() */ /************************************************************************/ -int pj_geodetic_to_geocentric( double a, double es, +int pj_geodetic_to_geocentric( double a, double es, long point_count, int point_offset, double *x, double *y, double *z ) @@ -489,7 +489,7 @@ int pj_geodetic_to_geocentric( double a, double es, if( x[io] == HUGE_VAL ) continue; - if( pj_Convert_Geodetic_To_Geocentric( &gi, y[io], x[io], z[io], + if( pj_Convert_Geodetic_To_Geocentric( &gi, y[io], x[io], z[io], x+io, y+io, z+io ) != 0 ) { ret_errno = -14; @@ -505,7 +505,7 @@ int pj_geodetic_to_geocentric( double a, double es, /* pj_geodetic_to_geocentric() */ /************************************************************************/ -int pj_geocentric_to_geodetic( double a, double es, +int pj_geocentric_to_geodetic( double a, double es, long point_count, int point_offset, double *x, double *y, double *z ) @@ -531,7 +531,7 @@ int pj_geocentric_to_geodetic( double a, double es, if( x[io] == HUGE_VAL ) continue; - pj_Convert_Geocentric_To_Geodetic( &gi, x[io], y[io], z[io], + pj_Convert_Geocentric_To_Geodetic( &gi, x[io], y[io], z[io], y+io, x+io, z+io ); } @@ -552,7 +552,7 @@ int pj_compare_datums( PJ *srcdefn, PJ *dstdefn ) { return 0; } - else if( srcdefn->a_orig != dstdefn->a_orig + else if( srcdefn->a_orig != dstdefn->a_orig || ABS(srcdefn->es_orig - dstdefn->es_orig) > 0.000000000050 ) { /* the tolerence for es is to ensure that GRS80 and WGS84 are @@ -588,7 +588,7 @@ int pj_compare_datums( PJ *srcdefn, PJ *dstdefn ) /* pj_geocentic_to_wgs84() */ /************************************************************************/ -int pj_geocentric_to_wgs84( PJ *defn, +int pj_geocentric_to_wgs84( PJ *defn, long point_count, int point_offset, double *x, double *y, double *z ) @@ -600,7 +600,7 @@ int pj_geocentric_to_wgs84( PJ *defn, for( i = 0; i < point_count; i++ ) { long io = i * point_offset; - + if( x[io] == HUGE_VAL ) continue; @@ -636,7 +636,7 @@ int pj_geocentric_to_wgs84( PJ *defn, /* pj_geocentic_from_wgs84() */ /************************************************************************/ -int pj_geocentric_from_wgs84( PJ *defn, +int pj_geocentric_from_wgs84( PJ *defn, long point_count, int point_offset, double *x, double *y, double *z ) @@ -651,7 +651,7 @@ int pj_geocentric_from_wgs84( PJ *defn, if( x[io] == HUGE_VAL ) continue; - + x[io] = x[io] - Dx_BF; y[io] = y[io] - Dy_BF; z[io] = z[io] - Dz_BF; @@ -688,7 +688,7 @@ int pj_geocentric_from_wgs84( PJ *defn, /* coordinates in radians in the destination datum. */ /************************************************************************/ -int pj_datum_transform( PJ *srcdefn, PJ *dstdefn, +int pj_datum_transform( PJ *srcdefn, PJ *dstdefn, long point_count, int point_offset, double *x, double *y, double *z ) @@ -754,15 +754,15 @@ int pj_datum_transform( PJ *srcdefn, PJ *dstdefn, /* Do we need to go through geocentric coordinates? */ /* ==================================================================== */ if( src_es != dst_es || src_a != dst_a - || srcdefn->datum_type == PJD_3PARAM + || srcdefn->datum_type == PJD_3PARAM || srcdefn->datum_type == PJD_7PARAM - || dstdefn->datum_type == PJD_3PARAM + || dstdefn->datum_type == PJD_3PARAM || dstdefn->datum_type == PJD_7PARAM) { /* -------------------------------------------------------------------- */ /* Convert to geocentric coordinates. */ /* -------------------------------------------------------------------- */ - srcdefn->ctx->last_errno = + srcdefn->ctx->last_errno = pj_geodetic_to_geocentric( src_a, src_es, point_count, point_offset, x, y, z ); CHECK_RETURN(srcdefn); @@ -770,14 +770,14 @@ int pj_datum_transform( PJ *srcdefn, PJ *dstdefn, /* -------------------------------------------------------------------- */ /* Convert between datums. */ /* -------------------------------------------------------------------- */ - if( srcdefn->datum_type == PJD_3PARAM + if( srcdefn->datum_type == PJD_3PARAM || srcdefn->datum_type == PJD_7PARAM ) { pj_geocentric_to_wgs84( srcdefn, point_count, point_offset,x,y,z); CHECK_RETURN(srcdefn); } - if( dstdefn->datum_type == PJD_3PARAM + if( dstdefn->datum_type == PJD_3PARAM || dstdefn->datum_type == PJD_7PARAM ) { pj_geocentric_from_wgs84( dstdefn, point_count,point_offset,x,y,z); @@ -787,7 +787,7 @@ int pj_datum_transform( PJ *srcdefn, PJ *dstdefn, /* -------------------------------------------------------------------- */ /* Convert back to geodetic coordinates. */ /* -------------------------------------------------------------------- */ - dstdefn->ctx->last_errno = + dstdefn->ctx->last_errno = pj_geocentric_to_geodetic( dst_a, dst_es, point_count, point_offset, x, y, z ); CHECK_RETURN(dstdefn); @@ -814,9 +814,9 @@ int pj_datum_transform( PJ *srcdefn, PJ *dstdefn, /* Normalize or de-normalized the x/y/z axes. The normal form */ /* is "enu" (easting, northing, up). */ /************************************************************************/ -static int pj_adjust_axis( projCtx ctx, +static int pj_adjust_axis( projCtx ctx, const char *axis, int denormalize_flag, - long point_count, int point_offset, + long point_count, int point_offset, double *x, double *y, double *z ) { @@ -831,7 +831,7 @@ static int pj_adjust_axis( projCtx ctx, y_in = y[point_offset*i]; if( z ) z_in = z[point_offset*i]; - + for( i_axis = 0; i_axis < 3; i_axis++ ) { double value; @@ -842,7 +842,7 @@ static int pj_adjust_axis( projCtx ctx, value = y_in; else value = z_in; - + switch( axis[i_axis] ) { case 'e': @@ -873,7 +873,7 @@ static int pj_adjust_axis( projCtx ctx, y_in = y[point_offset*i]; if( z ) z_in = z[point_offset*i]; - + for( i_axis = 0; i_axis < 3; i_axis++ ) { double *target; @@ -887,7 +887,7 @@ static int pj_adjust_axis( projCtx ctx, target = y; else target = z; - + switch( axis[i_axis] ) { case 'e': @@ -909,7 +909,6 @@ static int pj_adjust_axis( projCtx ctx, } /* i_axis */ } /* i (point) */ } - + return 0; } - diff --git a/src/pj_utils.c b/src/pj_utils.c index f11081fc..203c637c 100644 --- a/src/pj_utils.c +++ b/src/pj_utils.c @@ -78,27 +78,27 @@ PJ *pj_latlong_from_proj( PJ *pj_in ) if( pj_param(pj_in->ctx, pj_in->params, "tdatum").i ) { got_datum = TRUE; - sprintf( defn+strlen(defn), " +datum=%s", + sprintf( defn+strlen(defn), " +datum=%s", pj_param(pj_in->ctx, pj_in->params,"sdatum").s ); } else if( pj_param(pj_in->ctx, pj_in->params, "tellps").i ) { - sprintf( defn+strlen(defn), " +ellps=%s", + sprintf( defn+strlen(defn), " +ellps=%s", pj_param(pj_in->ctx, pj_in->params,"sellps").s ); } else if( pj_param(pj_in->ctx,pj_in->params, "ta").i ) { - sprintf( defn+strlen(defn), " +a=%s", + sprintf( defn+strlen(defn), " +a=%s", pj_param(pj_in->ctx,pj_in->params,"sa").s ); - + if( pj_param(pj_in->ctx,pj_in->params, "tb").i ) - sprintf( defn+strlen(defn), " +b=%s", + sprintf( defn+strlen(defn), " +b=%s", pj_param(pj_in->ctx,pj_in->params,"sb").s ); else if( pj_param(pj_in->ctx,pj_in->params, "tes").i ) - sprintf( defn+strlen(defn), " +es=%s", + sprintf( defn+strlen(defn), " +es=%s", pj_param(pj_in->ctx,pj_in->params,"ses").s ); else if( pj_param(pj_in->ctx,pj_in->params, "tf").i ) - sprintf( defn+strlen(defn), " +f=%s", + sprintf( defn+strlen(defn), " +f=%s", pj_param(pj_in->ctx,pj_in->params,"sf").s ); else { @@ -121,17 +121,17 @@ PJ *pj_latlong_from_proj( PJ *pj_in ) if( !got_datum ) { if( pj_param(pj_in->ctx,pj_in->params, "ttowgs84").i ) - sprintf( defn+strlen(defn), " +towgs84=%s", + sprintf( defn+strlen(defn), " +towgs84=%s", pj_param(pj_in->ctx,pj_in->params,"stowgs84").s ); if( pj_param(pj_in->ctx,pj_in->params, "tnadgrids").i ) - sprintf( defn+strlen(defn), " +nadgrids=%s", + sprintf( defn+strlen(defn), " +nadgrids=%s", pj_param(pj_in->ctx,pj_in->params,"snadgrids").s ); } /* copy over some other information related to ellipsoid */ if( pj_param(pj_in->ctx,pj_in->params, "tR").i ) - sprintf( defn+strlen(defn), " +R=%s", + sprintf( defn+strlen(defn), " +R=%s", pj_param(pj_in->ctx,pj_in->params,"sR").s ); if( pj_param(pj_in->ctx,pj_in->params, "tR_A").i ) @@ -144,16 +144,16 @@ PJ *pj_latlong_from_proj( PJ *pj_in ) sprintf( defn+strlen(defn), " +R_a" ); if( pj_param(pj_in->ctx,pj_in->params, "tR_lat_a").i ) - sprintf( defn+strlen(defn), " +R_lat_a=%s", + sprintf( defn+strlen(defn), " +R_lat_a=%s", pj_param(pj_in->ctx,pj_in->params,"sR_lat_a").s ); if( pj_param(pj_in->ctx,pj_in->params, "tR_lat_g").i ) - sprintf( defn+strlen(defn), " +R_lat_g=%s", + sprintf( defn+strlen(defn), " +R_lat_g=%s", pj_param(pj_in->ctx,pj_in->params,"sR_lat_g").s ); /* copy over prime meridian */ if( pj_param(pj_in->ctx,pj_in->params, "tpm").i ) - sprintf( defn+strlen(defn), " +pm=%s", + sprintf( defn+strlen(defn), " +pm=%s", pj_param(pj_in->ctx,pj_in->params,"spm").s ); return pj_init_plus_ctx( pj_in->ctx, defn ); @@ -172,7 +172,7 @@ void pj_get_spheroid_defn(projPJ defn, double *major_axis, double *eccentricity_ { if ( major_axis ) *major_axis = defn->a; - + if ( eccentricity_squared ) *eccentricity_squared = defn->es; -}; +} diff --git a/src/warnings.pj b/src/warnings.pj new file mode 100644 index 00000000..4959fe1c --- /dev/null +++ b/src/warnings.pj @@ -0,0 +1,72 @@ +PJ_healpix.c: In function 'in_image': +PJ_healpix.c:187:13: warning: initializer element is not computable at load time [enabled by default] + {-1.0*PI + north_square*PI/2.0- EPS, PI/4.0 + EPS}, + ^ +PJ_healpix.c:187:13: warning: initializer element is not computable at load time [enabled by default] +PJ_healpix.c:188:13: warning: initializer element is not computable at load time [enabled by default] + {-1.0*PI + north_square*PI/2.0- EPS, 3*PI/4.0 + EPS}, + ^ +PJ_healpix.c:188:13: warning: initializer element is not computable at load time [enabled by default] +PJ_healpix.c:189:13: warning: initializer element is not computable at load time [enabled by default] + {-1.0*PI + (north_square + 1.0)*PI/2.0 + EPS, 3*PI/4.0 + EPS}, + ^ +PJ_healpix.c:189:13: warning: initializer element is not computable at load time [enabled by default] +PJ_healpix.c:190:13: warning: initializer element is not computable at load time [enabled by default] + {-1.0*PI + (north_square + 1.0)*PI/2.0 + EPS, PI/4.0 + EPS}, + ^ +PJ_healpix.c:190:13: warning: initializer element is not computable at load time [enabled by default] +PJ_healpix.c:193:13: warning: initializer element is not computable at load time [enabled by default] + {-1.0*PI + (south_square + 1.0)*PI/2.0 + EPS, -1.0*PI/4.0 - EPS}, + ^ +PJ_healpix.c:193:13: warning: initializer element is not computable at load time [enabled by default] +PJ_healpix.c:194:13: warning: initializer element is not computable at load time [enabled by default] + {-1.0*PI + (south_square + 1.0)*PI/2.0 + EPS, -3.0*PI/4.0 - EPS}, + ^ +PJ_healpix.c:194:13: warning: initializer element is not computable at load time [enabled by default] +PJ_healpix.c:195:13: warning: initializer element is not computable at load time [enabled by default] + {-1.0*PI + south_square*PI/2.0 - EPS, -3.0*PI/4.0 - EPS}, + ^ +PJ_healpix.c:195:13: warning: initializer element is not computable at load time [enabled by default] +PJ_healpix.c:196:13: warning: initializer element is not computable at load time [enabled by default] + {-1.0*PI + south_square*PI/2.0 - EPS, -1.0*PI/4.0 - EPS}, + ^ +PJ_healpix.c:196:13: warning: initializer element is not computable at load time [enabled by default] +PJ_healpix.c: In function 'combine_caps': +PJ_healpix.c:453:9: warning: initializer element is not computable at load time [enabled by default] + double c[2] = {capmap.x, capmap.y}; + ^ +PJ_healpix.c:453:9: warning: initializer element is not computable at load time [enabled by default] +PJ_healpix.c:479:9: warning: initializer element is not computable at load time [enabled by default] + double c[2] = {capmap.x, capmap.y}; + ^ +PJ_healpix.c:479:9: warning: initializer element is not computable at load time [enabled by default] +PJ_minimal.c: In function 'e_inverse': +PJ_minimal.c:158:22: error: 'PJ' has no member named 'opaq' + lp.phi = xy.y - P->opaq->b; + ^ +PJ_minimal.c: In function 's_inverse': +PJ_minimal.c:167:22: error: 'PJ' has no member named 'opaq' + lp.phi = xy.y - P->opaq->b; + ^ +PJ_minimal.c: In function 'freeup': +PJ_minimal.c:176:18: error: 'PJ' has no member named 'opaq' + pj_dealloc (P->opaq); + ^ +PJ_minimal.c: In function 'pj_projection_specific_setup_minimal': +PJ_minimal.c:184:13: error: 'PJ' has no member named 'opaq' + if (0==P->opaq) { + ^ +PJ_minimal.c:189:6: error: 'PJ' has no member named 'opaq' + P->opaq->a = 42.42; + ^ +PJ_minimal.c:190:6: error: 'PJ' has no member named 'opaq' + P->opaq->b = 42; + ^ +pj_mutex.c:89:8: warning: C++ style comments are not allowed in ISO C90 [enabled by default] + #endif // def MUTEX_stub + ^ +pj_mutex.c:89:8: warning: (this will be reported only once per input file) [enabled by default] +pj_strtod.c:35:25: fatal error: proj_config.h: No such file or directory + #include "proj_config.h" + ^ +compilation terminated. |
