|
Geometry : |
Subject: [ggl] suspicious line 320 in extensions/gis/projections/proj/stere.hpp
From: Barend Gehrels (barend.gehrels)
Date: 2010-11-11 09:09:57
hi Kris,
Good catch!
On 11-11-2010 14:28, Krzysztof Czainski wrote:
> Hello,
>
> I have been playing with converting Geographic <-> Cartesian, tried
> projections. When I tried stere_ellipsoid, I found a warning on line
> 320. That was yesterday at work, and I don't remember the warning, but
> it said something about UB.
>
> Anyway, when I look at this line in the current (r66490)
> sandbox/geometry, it looks suspicious, so I changed it locally:
> $ svn diff stere.hpp
>
> Index: stere.hpp
> ===================================================================
> --- stere.hpp (wersja 66490)
> +++ stere.hpp (kopia robocza)
> @@ -316,7 +316,7 @@
> void setup_stere(Parameters& par, par_stere& proj_parm)
> {
> proj_parm.phits = pj_param(par.params, "tlat_ts").i ?
> - proj_parm.phits = pj_param(par.params,
> "rlat_ts").f : HALFPI;
> + pj_param(par.params, "rlat_ts").f : HALFPI;
> setup(par, proj_parm);
> }
>
> What do You guys think?
See
http://svn.osgeo.org/metacrs/proj/trunk/proj/src/PJ_stere.c
Our projection sources are converted automatically from proj4. The
source of proj4 already contains this possible suspicious construct.
However, this is, though suspicious and redundant, correct C code
because "the assignment x = y returns the value of the assignment". But
indeed it looks very ugly.
I will report this to proj4, because if this is committed at our side,
the same construct will be there again after re-generation. But in the
meantime we can commit it. Will do that.
Thanks, Barend
Geometry list run by mateusz at loskot.net