[OSRS-PROJ] Weirdnesses in the source code

proj at ton.iguana.be proj at ton.iguana.be
Tue Jul 8 08:23:22 PDT 2003


Hi,

I'm busy transforming some of the proj code to perl, and ran into a
number of strange things.

PJ_aeqd.c
  in PROJ_HEAD, lat_0 should be lat_0=

PJ_aitoff.c
  in PROJ_HEAD, lat_1 should be lat_1=

In PJ_imw_p.c, the function loc_for
  has a parameter double *yc that never gets actually set
  (the else branch in the code has it's own local yc)
  It is however used in e_inverse, so that basically picks up random
  garbage from memory (whatever the local yc there gets as value)

PJ_lcca.c use errors 50 and 51, which don't exist. They are positive, 
so maybe they are meant to pick up plain errno values, but in that case
i don't know which ones you mean and it's not portable

PJ_ocea.c, PROJ_HEAD basically declares Sphlonc (forgotten newline)

PJ_cea.c

	if (pj_param(P->params, "tlat_ts").i &&
		(P->k0 = cos(t = pj_param(P->params, "rlat_ts").f)) < 0.) E_ERROR(-24)
	else
		t = 0.;

  P->k0 doesn't get set if pj_param(P->params, "tlat_ts").i isn't done.
  It's however used.
  For t=0 the corresponding k0 is 1, which is the default (except when
  it gets explicitely set), so maybe it's what you want. But it at least 
  deserves a comment in that case I'd say

  PS, k0 seems nowhere explained in the docs. Shouldn't it be ?

PJ_stere.c:

	P->phits = pj_param(P->params, "tlat_ts").i ?
		P->phits = pj_param(P->params, "rlat_ts").f : HALFPI;

  Not exactly a bug, but the double assign to P->hits is weird. Probably 
  meant to be:
	P->phits = pj_param(P->params, "tlat_ts").i ?
		pj_param(P->params, "rlat_ts").f : HALFPI;

PJ_vandg2.c:
  projection vandg2 itself only supports spherical, but forgets to set 
  P->es to 0 (Yeah, i know it's not used in s_forward itself)
  
PJ_mpoly.c:
  always returns (0,0), so it doesn't do anything.
  It's still linked into the final proj though.

pj_enfn and pj_authset are handled inconsistently. Sometimes the 
returncode gets checked, other times it's just assumed it will work.
----------------------------------------
PROJ.4 Discussion List
See http://www.remotesensing.org/proj for subscription, unsubscription
and other information.



More information about the Proj mailing list