diff options
82 files changed, 327 insertions, 132 deletions
diff --git a/src/PJ_natearth.c b/src/PJ_natearth.c index 10abb23c..df015222 100644 --- a/src/PJ_natearth.c +++ b/src/PJ_natearth.c @@ -13,6 +13,9 @@ and designed in collaboration with Tom Patterson. Port to PROJ.4 by Bernhard Jenny, 6 June 2011 */ #define PJ_LIB__ + +#include <math.h> + #include "projects.h" PROJ_HEAD(natearth, "Natural Earth") "\n\tPCyl., Sph."; @@ -95,4 +98,3 @@ PJ *PROJECTION(natearth) { return P; } - diff --git a/src/PJ_natearth2.c b/src/PJ_natearth2.c index dbdc8fed..0498f186 100644 --- a/src/PJ_natearth2.c +++ b/src/PJ_natearth2.c @@ -6,6 +6,9 @@ and Atmospheric Sciences, Oregon State University. Port to PROJ.4 by Bojan Savric, 4 April 2016 */ #define PJ_LIB__ + +#include <math.h> + #include "projects.h" PROJ_HEAD(natearth2, "Natural Earth 2") "\n\tPCyl., Sph."; @@ -92,4 +95,3 @@ PJ *PROJECTION(natearth2) { return P; } - diff --git a/src/PJ_nell.c b/src/PJ_nell.c index 51f9f99a..751c01c8 100644 --- a/src/PJ_nell.c +++ b/src/PJ_nell.c @@ -1,4 +1,7 @@ #define PJ_LIB__ + +#include <math.h> + #include "projects.h" PROJ_HEAD(nell, "Nell") "\n\tPCyl., Sph."; @@ -46,4 +49,3 @@ PJ *PROJECTION(nell) { return P; } - diff --git a/src/PJ_nell_h.c b/src/PJ_nell_h.c index 24957786..db9e9de0 100644 --- a/src/PJ_nell_h.c +++ b/src/PJ_nell_h.c @@ -1,4 +1,7 @@ #define PJ_LIB__ + +#include <math.h> + #include "projects.h" PROJ_HEAD(nell_h, "Nell-Hammer") "\n\tPCyl., Sph."; @@ -48,4 +51,3 @@ PJ *PROJECTION(nell_h) { return P; } - diff --git a/src/PJ_nocol.c b/src/PJ_nocol.c index 13688a9f..93e128ea 100644 --- a/src/PJ_nocol.c +++ b/src/PJ_nocol.c @@ -1,4 +1,7 @@ #define PJ_LIB__ + +#include <math.h> + #include "projects.h" PROJ_HEAD(nicol, "Nicolosi Globular") "\n\tMisc Sph, no inv."; @@ -49,4 +52,3 @@ PJ *PROJECTION(nicol) { return P; } - diff --git a/src/PJ_nzmg.c b/src/PJ_nzmg.c index b30deabf..bf0862fb 100644 --- a/src/PJ_nzmg.c +++ b/src/PJ_nzmg.c @@ -26,6 +26,9 @@ * DEALINGS IN THE SOFTWARE. *****************************************************************************/ #define PJ_LIB__ + +#include <math.h> + #include "projects.h" PROJ_HEAD(nzmg, "New Zealand Map Grid") "\n\tfixed Earth"; @@ -118,4 +121,3 @@ PJ *PROJECTION(nzmg) { return P; } - diff --git a/src/PJ_ob_tran.c b/src/PJ_ob_tran.c index 8b13eb65..f5a05cf9 100644 --- a/src/PJ_ob_tran.c +++ b/src/PJ_ob_tran.c @@ -1,8 +1,11 @@ #define PJ_LIB__ #include <errno.h> +#include <math.h> +#include <stddef.h> +#include <string.h> + #include "proj.h" #include "projects.h" -#include <string.h> struct pj_opaque { struct PJconsts *link; @@ -238,4 +241,3 @@ PJ *PROJECTION(ob_tran) { return P; } - diff --git a/src/PJ_ocea.c b/src/PJ_ocea.c index 4bd120e1..7a9353a6 100644 --- a/src/PJ_ocea.c +++ b/src/PJ_ocea.c @@ -1,5 +1,8 @@ #define PJ_LIB__ + #include <errno.h> +#include <math.h> + #include "projects.h" PROJ_HEAD(ocea, "Oblique Cylindrical Equal Area") "\n\tCyl, Sph" @@ -95,4 +98,3 @@ PJ *PROJECTION(ocea) { return P; } - diff --git a/src/PJ_omerc.c b/src/PJ_omerc.c index 32bf5c14..70c12e27 100644 --- a/src/PJ_omerc.c +++ b/src/PJ_omerc.c @@ -22,7 +22,10 @@ ** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #define PJ_LIB__ + #include <errno.h> +#include <math.h> + #include "proj.h" #include "projects.h" @@ -222,4 +225,3 @@ PJ *PROJECTION(omerc) { return P; } - diff --git a/src/PJ_patterson.c b/src/PJ_patterson.c index e58b49bd..a15c730f 100644 --- a/src/PJ_patterson.c +++ b/src/PJ_patterson.c @@ -39,6 +39,9 @@ */ #define PJ_LIB__ + +#include <math.h> + #include "projects.h" PROJ_HEAD(patterson, "Patterson Cylindrical") "\n\tCyl."; @@ -112,4 +115,3 @@ PJ *PROJECTION(patterson) { return P; } - diff --git a/src/PJ_pipeline.c b/src/PJ_pipeline.c index 4f42faed..d623423b 100644 --- a/src/PJ_pipeline.c +++ b/src/PJ_pipeline.c @@ -95,13 +95,17 @@ Thomas Knudsen, thokn@sdfe.dk, 2016-05-20 ********************************************************************************/ #define PJ_LIB__ + +#include <errno.h> +#include <math.h> +#include <stddef.h> +#include <string.h> + #include "geodesic.h" #include "proj.h" #include "proj_internal.h" #include "projects.h" -#include <stddef.h> -#include <errno.h> PROJ_HEAD(pipeline, "Transformation pipeline manager"); /* Projection specific elements for the PJ object */ diff --git a/src/PJ_poly.c b/src/PJ_poly.c index 7cf8bce1..03fa84a4 100644 --- a/src/PJ_poly.c +++ b/src/PJ_poly.c @@ -1,5 +1,8 @@ #define PJ_LIB__ + #include <errno.h> +#include <math.h> + #include "proj.h" #include "projects.h" @@ -163,4 +166,3 @@ PJ *PROJECTION(poly) { return P; } - diff --git a/src/PJ_putp2.c b/src/PJ_putp2.c index 51cf263d..0b4397e5 100644 --- a/src/PJ_putp2.c +++ b/src/PJ_putp2.c @@ -1,4 +1,7 @@ #define PJ_LIB__ + +#include <math.h> + #include "projects.h" PROJ_HEAD(putp2, "Putnins P2") "\n\tPCyl., Sph."; @@ -56,4 +59,3 @@ PJ *PROJECTION(putp2) { return P; } - diff --git a/src/PJ_putp4p.c b/src/PJ_putp4p.c index 958f9681..b716060a 100644 --- a/src/PJ_putp4p.c +++ b/src/PJ_putp4p.c @@ -1,5 +1,8 @@ #define PJ_LIB__ + #include <errno.h> +#include <math.h> + #include "projects.h" struct pj_opaque { @@ -69,4 +72,3 @@ PJ *PROJECTION(weren) { return P; } - diff --git a/src/PJ_putp5.c b/src/PJ_putp5.c index 14bfea23..6836f71d 100644 --- a/src/PJ_putp5.c +++ b/src/PJ_putp5.c @@ -1,5 +1,8 @@ #define PJ_LIB__ + #include <errno.h> +#include <math.h> + #include "projects.h" struct pj_opaque { @@ -68,4 +71,3 @@ PJ *PROJECTION(putp5p) { return P; } - diff --git a/src/PJ_putp6.c b/src/PJ_putp6.c index 938cef09..68c10701 100644 --- a/src/PJ_putp6.c +++ b/src/PJ_putp6.c @@ -1,5 +1,8 @@ #define PJ_LIB__ + #include <errno.h> +#include <math.h> + #include "projects.h" struct pj_opaque { @@ -90,4 +93,3 @@ PJ *PROJECTION(putp6p) { return P; } - diff --git a/src/PJ_qsc.c b/src/PJ_qsc.c index 0f5d2299..4b463b46 100644 --- a/src/PJ_qsc.c +++ b/src/PJ_qsc.c @@ -39,7 +39,10 @@ */ #define PJ_LIB__ + #include <errno.h> +#include <math.h> + #include "projects.h" /* The six cube faces. */ @@ -397,4 +400,3 @@ PJ *PROJECTION(qsc) { return P; } - diff --git a/src/PJ_rpoly.c b/src/PJ_rpoly.c index d7241719..57c4fc92 100644 --- a/src/PJ_rpoly.c +++ b/src/PJ_rpoly.c @@ -1,5 +1,8 @@ #define PJ_LIB__ + #include <errno.h> +#include <math.h> + #include "projects.h" struct pj_opaque { @@ -51,4 +54,3 @@ PJ *PROJECTION(rpoly) { return P; } - diff --git a/src/PJ_sch.c b/src/PJ_sch.c index e9e67ff8..64e5cdb8 100644 --- a/src/PJ_sch.c +++ b/src/PJ_sch.c @@ -31,7 +31,10 @@ ****************************************************************************/ #define PJ_LIB__ + #include <errno.h> +#include <math.h> + #include "proj.h" #include "projects.h" #include "geocent.h" @@ -225,4 +228,3 @@ PJ *PROJECTION(sch) { return setup(P); } - diff --git a/src/PJ_somerc.c b/src/PJ_somerc.c index 02df5868..c6c3ff21 100644 --- a/src/PJ_somerc.c +++ b/src/PJ_somerc.c @@ -1,5 +1,8 @@ #define PJ_LIB__ + #include <errno.h> +#include <math.h> + #include "proj.h" #include "projects.h" @@ -87,4 +90,3 @@ PJ *PROJECTION(somerc) { P->fwd = e_forward; return P; } - diff --git a/src/PJ_sts.c b/src/PJ_sts.c index d8866b66..8409d86a 100644 --- a/src/PJ_sts.c +++ b/src/PJ_sts.c @@ -1,5 +1,8 @@ #define PJ_LIB__ + #include <errno.h> +#include <math.h> + #include "projects.h" PROJ_HEAD(kav5, "Kavraisky V") "\n\tPCyl., Sph."; @@ -102,4 +105,3 @@ PJ *PROJECTION(mbt_s) { P->opaque = Q; return setup(P, 1.48875, 1.36509, 0); } - diff --git a/src/PJ_tcc.c b/src/PJ_tcc.c index c355a602..14255325 100644 --- a/src/PJ_tcc.c +++ b/src/PJ_tcc.c @@ -1,4 +1,7 @@ #define PJ_LIB__ + +#include <math.h> + #include "proj.h" #include "projects.h" @@ -29,4 +32,3 @@ PJ *PROJECTION(tcc) { return P; } - diff --git a/src/PJ_tcea.c b/src/PJ_tcea.c index 415b42de..d30f3df0 100644 --- a/src/PJ_tcea.c +++ b/src/PJ_tcea.c @@ -1,5 +1,8 @@ #define PJ_LIB__ -#include "projects.h" + +#include <math.h> + +#include "projects.h" PROJ_HEAD(tcea, "Transverse Cylindrical Equal Area") "\n\tCyl, Sph"; @@ -31,4 +34,3 @@ PJ *PROJECTION(tcea) { P->es = 0.; return P; } - diff --git a/src/PJ_times.c b/src/PJ_times.c index 18fe7233..e8b4499f 100644 --- a/src/PJ_times.c +++ b/src/PJ_times.c @@ -30,6 +30,9 @@ *****************************************************************************/ #define PJ_LIB__ + +#include <math.h> + #include "projects.h" PROJ_HEAD(times, "Times") "\n\tCyl, Sph"; @@ -74,4 +77,3 @@ PJ *PROJECTION(times) { return P; } - diff --git a/src/PJ_tmerc.c b/src/PJ_tmerc.c index f0f34c93..069cdc2c 100644 --- a/src/PJ_tmerc.c +++ b/src/PJ_tmerc.c @@ -1,5 +1,8 @@ #define PJ_LIB__ + #include <errno.h> +#include <math.h> + #include "proj.h" #include "projects.h" @@ -203,4 +206,3 @@ PJ *PROJECTION(tmerc) { return setup(P); } - diff --git a/src/PJ_unitconvert.c b/src/PJ_unitconvert.c index a076b76c..5c25a16b 100644 --- a/src/PJ_unitconvert.c +++ b/src/PJ_unitconvert.c @@ -64,8 +64,12 @@ Last update: 2017-05-16 ***********************************************************************/ #define PJ_LIB__ -#include <time.h> + #include <errno.h> +#include <math.h> +#include <string.h> +#include <time.h> + #include "proj_internal.h" #include "projects.h" diff --git a/src/PJ_urm5.c b/src/PJ_urm5.c index 091fe9d6..416cb866 100644 --- a/src/PJ_urm5.c +++ b/src/PJ_urm5.c @@ -1,5 +1,8 @@ #define PJ_LIB__ + #include <errno.h> +#include <math.h> + #include "proj.h" #include "projects.h" @@ -49,4 +52,3 @@ PJ *PROJECTION(urm5) { return P; } - diff --git a/src/PJ_urmfps.c b/src/PJ_urmfps.c index bbceab51..5749059b 100644 --- a/src/PJ_urmfps.c +++ b/src/PJ_urmfps.c @@ -1,5 +1,8 @@ #define PJ_LIB__ + #include <errno.h> +#include <math.h> + #include "proj.h" #include "projects.h" @@ -69,4 +72,3 @@ PJ *PROJECTION(wag1) { P->opaque->n = 0.8660254037844386467637231707; return setup(P); } - diff --git a/src/PJ_vandg2.c b/src/PJ_vandg2.c index 81f28a74..20b7601a 100644 --- a/src/PJ_vandg2.c +++ b/src/PJ_vandg2.c @@ -1,5 +1,8 @@ #define PJ_LIB__ + #include <errno.h> +#include <math.h> + #include "projects.h" struct pj_opaque { @@ -69,4 +72,3 @@ PJ *PROJECTION(vandg3) { return P; } - diff --git a/src/PJ_vandg4.c b/src/PJ_vandg4.c index afffe41f..770594f1 100644 --- a/src/PJ_vandg4.c +++ b/src/PJ_vandg4.c @@ -1,4 +1,7 @@ #define PJ_LIB__ + +#include <math.h> + #include "projects.h" PROJ_HEAD(vandg4, "van der Grinten IV") "\n\tMisc Sph, no inv."; @@ -50,4 +53,3 @@ PJ *PROJECTION(vandg4) { return P; } - diff --git a/src/PJ_vgridshift.c b/src/PJ_vgridshift.c index bb8b4d4d..205806b2 100644 --- a/src/PJ_vgridshift.c +++ b/src/PJ_vgridshift.c @@ -1,4 +1,7 @@ #define PJ_LIB__ + +#include <stddef.h> + #include "proj_internal.h" #include "projects.h" @@ -74,4 +77,3 @@ PJ *TRANSFORMATION(vgridshift,0) { return P; } - diff --git a/src/PJ_wag2.c b/src/PJ_wag2.c index 059494d7..d12cade1 100644 --- a/src/PJ_wag2.c +++ b/src/PJ_wag2.c @@ -1,6 +1,11 @@ #define PJ_LIB__ + +#include <math.h> + #include "projects.h" + PROJ_HEAD(wag2, "Wagner II") "\n\tPCyl., Sph."; + #define C_x 0.92483 #define C_y 1.38725 #define C_p1 0.88022 @@ -31,4 +36,3 @@ PJ *PROJECTION(wag2) { P->fwd = s_forward; return P; } - diff --git a/src/PJ_wag3.c b/src/PJ_wag3.c index 5db1e50f..6ae9ad28 100644 --- a/src/PJ_wag3.c +++ b/src/PJ_wag3.c @@ -1,6 +1,9 @@ #define PJ_LIB__ -#include "projects.h" + #include <errno.h> +#include <math.h> + +#include "projects.h" PROJ_HEAD(wag3, "Wagner III") "\n\tPCyl., Sph.\n\tlat_ts="; @@ -43,4 +46,3 @@ PJ *PROJECTION(wag3) { return P; } - diff --git a/src/PJ_wag7.c b/src/PJ_wag7.c index a820b2cd..3cd332ad 100644 --- a/src/PJ_wag7.c +++ b/src/PJ_wag7.c @@ -1,5 +1,8 @@ #define PJ_LIB__ -#include "projects.h" + +#include <math.h> + +#include "projects.h" PROJ_HEAD(wag7, "Wagner VII") "\n\tMisc Sph, no inv."; @@ -25,4 +28,3 @@ PJ *PROJECTION(wag7) { P->es = 0.; return P; } - diff --git a/src/PJ_wink1.c b/src/PJ_wink1.c index f64f97d2..10392fe9 100644 --- a/src/PJ_wink1.c +++ b/src/PJ_wink1.c @@ -1,6 +1,9 @@ #define PJ_LIB__ -#include "projects.h" + #include <errno.h> +#include <math.h> + +#include "projects.h" PROJ_HEAD(wink1, "Winkel I") "\n\tPCyl., Sph.\n\tlat_ts="; @@ -39,4 +42,3 @@ PJ *PROJECTION(wink1) { return P; } - diff --git a/src/PJ_wink2.c b/src/PJ_wink2.c index d715074e..d02ca567 100644 --- a/src/PJ_wink2.c +++ b/src/PJ_wink2.c @@ -1,6 +1,9 @@ #define PJ_LIB__ -#include "projects.h" + #include <errno.h> +#include <math.h> + +#include "projects.h" PROJ_HEAD(wink2, "Winkel II") "\n\tPCyl., Sph., no inv.\n\tlat_1="; @@ -47,4 +50,3 @@ PJ *PROJECTION(wink2) { return P; } - diff --git a/src/aasincos.c b/src/aasincos.c index c3915613..4f9ea25f 100644 --- a/src/aasincos.c +++ b/src/aasincos.c @@ -1,34 +1,38 @@ /* arc sin, cosine, tan2 and sqrt that will NOT fail */ + +#include <math.h> + #include "projects.h" + #define ONE_TOL 1.00000000000001 #define ATOL 1e-50 - double + double aasin(projCtx ctx,double v) { - double av; - - if ((av = fabs(v)) >= 1.) { - if (av > ONE_TOL) + double av; + + if ((av = fabs(v)) >= 1.) { + if (av > ONE_TOL) pj_ctx_set_errno( ctx, PJD_ERR_ACOS_ASIN_ARG_TOO_LARGE ); - return (v < 0. ? -M_HALFPI : M_HALFPI); - } - return asin(v); + return (v < 0. ? -M_HALFPI : M_HALFPI); + } + return asin(v); } - double + double aacos(projCtx ctx, double v) { - double av; + double av; - if ((av = fabs(v)) >= 1.) { - if (av > ONE_TOL) + if ((av = fabs(v)) >= 1.) { + if (av > ONE_TOL) pj_ctx_set_errno( ctx, PJD_ERR_ACOS_ASIN_ARG_TOO_LARGE ); - return (v < 0. ? M_PI : 0.); - } - return acos(v); + return (v < 0. ? M_PI : 0.); + } + return acos(v); } - double + double asqrt(double v) { return ((v <= 0) ? 0. : sqrt(v)); } - double + double aatan2(double n, double d) { - return ((fabs(n) < ATOL && fabs(d) < ATOL) ? 0. : atan2(n,d)); + return ((fabs(n) < ATOL && fabs(d) < ATOL) ? 0. : atan2(n,d)); } diff --git a/src/cs2cs.c b/src/cs2cs.c index de3259d2..167eafa3 100644 --- a/src/cs2cs.c +++ b/src/cs2cs.c @@ -26,15 +26,16 @@ * DEALINGS IN THE SOFTWARE. *****************************************************************************/ -#include "proj.h" -#include "projects.h" +#include <ctype.h> +#include <locale.h> +#include <math.h> #include <stdio.h> #include <stdlib.h> -#include <ctype.h> #include <string.h> -#include <math.h> + +#include "proj.h" +#include "projects.h" #include "emess.h" -#include <locale.h> #define MAX_LINE 1000 #define MAX_PARGS 100 diff --git a/src/dmstor.c b/src/dmstor.c index 23871a85..d3496cd9 100644 --- a/src/dmstor.c +++ b/src/dmstor.c @@ -1,7 +1,11 @@ /* Convert DMS string to radians */ -#include "projects.h" -#include <string.h> + #include <ctype.h> +#include <math.h> +#include <stdlib.h> +#include <string.h> + +#include "projects.h" static double proj_strtod(char *nptr, char **endptr); diff --git a/src/emess.c b/src/emess.c index a645bac9..330b8412 100644 --- a/src/emess.c +++ b/src/emess.c @@ -9,14 +9,16 @@ # endif #endif +#include <errno.h> +#include <stdarg.h> #include <stdio.h> #include <stdlib.h> -#include <stdarg.h> -#include <errno.h> #include <string.h> + #include "proj_api.h" #define EMESS_ROUTINE #include "emess.h" + void emess(int code, const char *fmt, ...) { va_list args; diff --git a/src/geod_set.c b/src/geod_set.c index 571a7d20..479f18da 100644 --- a/src/geod_set.c +++ b/src/geod_set.c @@ -1,11 +1,14 @@ - #define _IN_GEOD_SET +#include <math.h> +#include <stdlib.h> #include <string.h> + #include "proj.h" #include "projects.h" #include "geod_interface.h" #include "emess.h" + void geod_set(int argc, char **argv) { paralist *start = 0, *curr; @@ -108,6 +108,7 @@ Thomas Knudsen, thokn@sdfe.dk, 2017-10-01/2017-10-08 #include <errno.h> #include <math.h> #include <stdarg.h> +#include <stddef.h> #include <stdio.h> #include <stdlib.h> #include <string.h> diff --git a/src/nad_cvt.c b/src/nad_cvt.c index d4330d54..ec4a2b47 100644 --- a/src/nad_cvt.c +++ b/src/nad_cvt.c @@ -1,6 +1,11 @@ #define PJ_LIB__ + +#include <stdio.h> +#include <stdlib.h> + #include "projects.h" #include "proj_math.h" + #define MAX_ITERATIONS 10 #define TOL 1e-12 diff --git a/src/nad_init.c b/src/nad_init.c index 844dcad2..8b024ac7 100644 --- a/src/nad_init.c +++ b/src/nad_init.c @@ -27,11 +27,14 @@ #define PJ_LIB__ -#include "projects.h" -#include <stdio.h> #include <errno.h> +#include <stddef.h> +#include <stdio.h> +#include <stdlib.h> #include <string.h> +#include "projects.h" + /************************************************************************/ /* swap_words() */ /* */ diff --git a/src/pj_apply_gridshift.c b/src/pj_apply_gridshift.c index 424dfb11..31e0124e 100644 --- a/src/pj_apply_gridshift.c +++ b/src/pj_apply_gridshift.c @@ -30,8 +30,10 @@ #define PJ_LIB__ -#include <string.h> #include <math.h> +#include <stdio.h> +#include <string.h> + #include "proj_internal.h" #include "projects.h" diff --git a/src/pj_apply_vgridshift.c b/src/pj_apply_vgridshift.c index e7106b25..58605df8 100644 --- a/src/pj_apply_vgridshift.c +++ b/src/pj_apply_vgridshift.c @@ -28,7 +28,9 @@ #define PJ_LIB__ +#include <stdio.h> #include <string.h> + #include "proj_math.h" #include "proj_internal.h" #include "projects.h" @@ -292,4 +294,3 @@ double proj_vgrid_value(PJ *P, LP lp){ return value; } - diff --git a/src/pj_auth.c b/src/pj_auth.c index ed716fde..d6024671 100644 --- a/src/pj_auth.c +++ b/src/pj_auth.c @@ -1,5 +1,10 @@ /* determine latitude from authalic latitude */ + +#include <math.h> +#include <stddef.h> + #include "projects.h" + # define P00 .33333333333333333333 /* 1 / 3 */ # define P01 .17222222222222222222 /* 31 / 180 */ # define P02 .10257936507936507937 /* 517 / 5040 */ @@ -7,6 +12,7 @@ # define P11 .06640211640211640212 /* 251 / 3780 */ # define P20 .01677689594356261023 /* 761 / 45360 */ #define APA_SIZE 3 + double * pj_authset(double es) { double t, *APA; diff --git a/src/pj_ctx.c b/src/pj_ctx.c index 1b2aea27..d77bc88a 100644 --- a/src/pj_ctx.c +++ b/src/pj_ctx.c @@ -25,9 +25,11 @@ * DEALINGS IN THE SOFTWARE. *****************************************************************************/ -#include "projects.h" -#include <string.h> #include <errno.h> +#include <stdlib.h> +#include <string.h> + +#include "projects.h" static projCtx_t default_context; static volatile int default_context_initialized = 0; diff --git a/src/pj_datum_set.c b/src/pj_datum_set.c index e527ff84..466b56c5 100644 --- a/src/pj_datum_set.c +++ b/src/pj_datum_set.c @@ -26,9 +26,10 @@ *****************************************************************************/ #include <errno.h> -#include "projects.h" #include <string.h> +#include "projects.h" + /* SEC_TO_RAD = Pi/180/3600 */ #define SEC_TO_RAD 4.84813681109535993589914102357e-6 diff --git a/src/pj_datums.c b/src/pj_datums.c index 4bb23f24..2011d1bb 100644 --- a/src/pj_datums.c +++ b/src/pj_datums.c @@ -25,6 +25,8 @@ * DEALINGS IN THE SOFTWARE. *****************************************************************************/ +#include <stddef.h> + #include "proj.h" #define PJ_DATUMS__ diff --git a/src/pj_deriv.c b/src/pj_deriv.c index 7c1fcded..2c91e0cc 100644 --- a/src/pj_deriv.c +++ b/src/pj_deriv.c @@ -1,5 +1,8 @@ /* dervative of (*P->fwd) projection */ #define PJ_LIB__ + +#include <math.h> + #include "projects.h" int pj_deriv(LP lp, double h, const PJ *P, struct DERIVS *der) { diff --git a/src/pj_ell_set.c b/src/pj_ell_set.c index fc655289..fd27bd9d 100644 --- a/src/pj_ell_set.c +++ b/src/pj_ell_set.c @@ -1,6 +1,9 @@ /* set ellipsoid parameters a and es */ + +#include <math.h> +#include <stddef.h> #include <string.h> -#include <errno.h> + #include "proj.h" #include "proj_internal.h" #include "projects.h" diff --git a/src/pj_ellps.c b/src/pj_ellps.c index 4005d1ce..2bc1e2bb 100644 --- a/src/pj_ellps.c +++ b/src/pj_ellps.c @@ -1,5 +1,7 @@ /* definition of standard geoids */ +#include <stddef.h> + #include "proj.h" #define PJ_ELLPS__ diff --git a/src/pj_fileapi.c b/src/pj_fileapi.c index d7d3f00b..b08a8b95 100644 --- a/src/pj_fileapi.c +++ b/src/pj_fileapi.c @@ -27,9 +27,13 @@ *****************************************************************************/ #include <errno.h> -#include "projects.h" +#include <stddef.h> +#include <stdio.h> +#include <stdlib.h> #include <string.h> +#include "projects.h" + static PAFile stdio_fopen(projCtx ctx, const char *filename, const char *access); static size_t stdio_fread(void *buffer, size_t size, size_t nmemb, diff --git a/src/pj_fwd.c b/src/pj_fwd.c index 347f8334..fe04f733 100644 --- a/src/pj_fwd.c +++ b/src/pj_fwd.c @@ -27,7 +27,9 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. *****************************************************************************/ + #include <errno.h> +#include <math.h> #include "proj_internal.h" #include "projects.h" diff --git a/src/pj_gauss.c b/src/pj_gauss.c index 108ac059..4520bb39 100644 --- a/src/pj_gauss.c +++ b/src/pj_gauss.c @@ -24,6 +24,10 @@ ** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #define PJ_LIB__ + +#include <math.h> +#include <stdlib.h> + #include "projects.h" #define MAX_ITER 20 diff --git a/src/pj_gc_reader.c b/src/pj_gc_reader.c index c38cbf17..493fc075 100644 --- a/src/pj_gc_reader.c +++ b/src/pj_gc_reader.c @@ -27,10 +27,12 @@ #define PJ_LIB__ +#include <ctype.h> #include <errno.h> -#include "projects.h" +#include <stdlib.h> #include <string.h> -#include <ctype.h> + +#include "projects.h" static int gc_readentry(projCtx ctx, PAFile fid, PJ_GridCatalogEntry *entry); @@ -46,7 +48,7 @@ PJ_GridCatalog *pj_gc_readcatalog( projCtx ctx, const char *catalog_name ) PJ_GridCatalog *catalog; int entry_max; char line[302]; - + fid = pj_open_lib( ctx, catalog_name, "r" ); if (fid == NULL) return NULL; diff --git a/src/pj_gridcatalog.c b/src/pj_gridcatalog.c index 45876ead..ea9c4aa1 100644 --- a/src/pj_gridcatalog.c +++ b/src/pj_gridcatalog.c @@ -27,9 +27,12 @@ #define PJ_LIB__ -#include "projects.h" -#include <string.h> #include <assert.h> +#include <math.h> +#include <stdlib.h> +#include <string.h> + +#include "projects.h" static PJ_GridCatalog *grid_catalog_list = NULL; diff --git a/src/pj_gridinfo.c b/src/pj_gridinfo.c index 442b3fe6..f201f39e 100644 --- a/src/pj_gridinfo.c +++ b/src/pj_gridinfo.c @@ -28,11 +28,15 @@ #define PJ_LIB__ +#include <errno.h> +#include <math.h> +#include <stddef.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + #include "proj_internal.h" #include "projects.h" -#include <string.h> -#include <math.h> -#include <errno.h> /************************************************************************/ /* swap_words() */ diff --git a/src/pj_gridlist.c b/src/pj_gridlist.c index 9daabbe1..332de8dd 100644 --- a/src/pj_gridlist.c +++ b/src/pj_gridlist.c @@ -29,9 +29,10 @@ #define PJ_LIB__ #include <errno.h> -#include "projects.h" +#include <stddef.h> #include <string.h> -#include <math.h> + +#include "projects.h" static PJ_GRIDINFO *grid_list = NULL; #define PJ_MAX_PATH_LENGTH 1024 diff --git a/src/pj_init.c b/src/pj_init.c index bdaf64f7..c5e92105 100644 --- a/src/pj_init.c +++ b/src/pj_init.c @@ -27,14 +27,16 @@ * DEALINGS IN THE SOFTWARE. *****************************************************************************/ - - #define PJ_LIB__ -#include "geodesic.h" + +#include <ctype.h> +#include <errno.h> +#include <math.h> +#include <stddef.h> #include <stdio.h> #include <string.h> -#include <errno.h> -#include <ctype.h> + +#include "geodesic.h" #include "proj.h" #include "proj_internal.h" #include "proj_math.h" diff --git a/src/pj_initcache.c b/src/pj_initcache.c index a0593138..3c347e4b 100644 --- a/src/pj_initcache.c +++ b/src/pj_initcache.c @@ -25,9 +25,10 @@ * DEALINGS IN THE SOFTWARE. *****************************************************************************/ -#include "projects.h" #include <string.h> +#include "projects.h" + static int cache_count = 0; static int cache_alloc = 0; static char **cache_key = NULL; @@ -51,7 +52,7 @@ paralist *pj_clone_paralist( const paralist *list) newitem->used = 0; newitem->next = 0; strcpy( newitem->param, list->param ); - + if( list_copy == NULL ) list_copy = newitem; else diff --git a/src/pj_internal.c b/src/pj_internal.c index a6093c40..58ea9b48 100644 --- a/src/pj_internal.c +++ b/src/pj_internal.c @@ -28,10 +28,14 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. *****************************************************************************/ + #include <ctype.h> -#include <stddef.h> -#include <stdarg.h> #include <errno.h> +#include <math.h> +#include <stdarg.h> +#include <stddef.h> +#include <stdlib.h> +#include <string.h> #include "geodesic.h" #include "proj_internal.h" diff --git a/src/pj_inv.c b/src/pj_inv.c index 327fef9f..72e06fe0 100644 --- a/src/pj_inv.c +++ b/src/pj_inv.c @@ -28,6 +28,7 @@ * DEALINGS IN THE SOFTWARE. *****************************************************************************/ #include <errno.h> +#include <math.h> #include "proj_internal.h" #include "projects.h" diff --git a/src/pj_log.c b/src/pj_log.c index 19151800..6654691c 100644 --- a/src/pj_log.c +++ b/src/pj_log.c @@ -25,10 +25,13 @@ * DEALINGS IN THE SOFTWARE. *****************************************************************************/ +#include <stdarg.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + #include "proj.h" #include "projects.h" -#include <string.h> -#include <stdarg.h> /************************************************************************/ /* pj_stderr_logger() */ diff --git a/src/pj_malloc.c b/src/pj_malloc.c index 2d670ae2..c45da85d 100644 --- a/src/pj_malloc.c +++ b/src/pj_malloc.c @@ -34,15 +34,18 @@ * DEALINGS IN THE SOFTWARE. *****************************************************************************/ - /* allocate and deallocate memory */ /* These routines are used so that applications can readily replace ** projection system memory allocation/deallocation call with custom ** application procedures. */ +#include <errno.h> +#include <stddef.h> +#include <stdlib.h> +#include <string.h> + #include "proj.h" #include "projects.h" -#include <errno.h> /**********************************************************************/ void *pj_malloc(size_t size) { diff --git a/src/pj_mlfn.c b/src/pj_mlfn.c index 24e7b63a..02e05c3a 100644 --- a/src/pj_mlfn.c +++ b/src/pj_mlfn.c @@ -1,4 +1,7 @@ +#include <math.h> + #include "projects.h" + /* meridional distance for ellipsoid and inverse ** 8th degree - accurate to < 1e-5 meters when used in conjunction ** with typical major axis values. diff --git a/src/pj_open_lib.c b/src/pj_open_lib.c index 8ecbbd79..6b908360 100644 --- a/src/pj_open_lib.c +++ b/src/pj_open_lib.c @@ -29,11 +29,15 @@ *****************************************************************************/ #define PJ_LIB__ -#include "proj_internal.h" -#include "projects.h" + +#include <errno.h> +#include <stddef.h> #include <stdio.h> +#include <stdlib.h> #include <string.h> -#include <errno.h> + +#include "proj_internal.h" +#include "projects.h" static const char *(*pj_finder)(const char *) = NULL; static int path_count = 0; diff --git a/src/pj_param.c b/src/pj_param.c index b52ac940..6cee4d1f 100644 --- a/src/pj_param.c +++ b/src/pj_param.c @@ -1,6 +1,9 @@ /* put parameters in linked list and retrieve */ + #include <ctype.h> +#include <stddef.h> #include <stdio.h> +#include <stdlib.h> #include <string.h> #include "projects.h" diff --git a/src/pj_pr_list.c b/src/pj_pr_list.c index baf8125f..4e71e471 100644 --- a/src/pj_pr_list.c +++ b/src/pj_pr_list.c @@ -1,7 +1,11 @@ /* print projection's list of parameters */ -#include "projects.h" + +#include <stddef.h> #include <stdio.h> #include <string.h> + +#include "projects.h" + #define LINE_LEN 72 static int pr_list(PJ *P, int not_used) { diff --git a/src/pj_strerrno.c b/src/pj_strerrno.c index d881ae7b..e06ea58b 100644 --- a/src/pj_strerrno.c +++ b/src/pj_strerrno.c @@ -1,7 +1,9 @@ /* list of projection system pj_errno values */ + +#include <stddef.h> #include <stdio.h> -#include <errno.h> #include <string.h> + #include "proj.h" #include "projects.h" diff --git a/src/pj_strtod.c b/src/pj_strtod.c index 1cf94c9b..45159d11 100644 --- a/src/pj_strtod.c +++ b/src/pj_strtod.c @@ -27,6 +27,11 @@ * DEALINGS IN THE SOFTWARE. ****************************************************************************/ +#include <errno.h> +#include <locale.h> +#include <stdlib.h> +#include <string.h> + #include "projects.h" /* Windows nmake build doesn't have a proj_config.h, but HAVE_LOCALECONV */ @@ -35,10 +40,6 @@ #include "proj_config.h" #endif -#include <stdlib.h> -#include <locale.h> -#include <errno.h> - #define PJ_STRTOD_WORK_BUFFER_SIZE 64 /************************************************************************/ @@ -193,4 +194,3 @@ double pj_strtod( const char *nptr, char **endptr ) errno = nError; return dfValue; } - diff --git a/src/pj_transform.c b/src/pj_transform.c index 3d7bd5c8..5863b39e 100644 --- a/src/pj_transform.c +++ b/src/pj_transform.c @@ -27,9 +27,10 @@ * DEALINGS IN THE SOFTWARE. *****************************************************************************/ -#include "projects.h" -#include <string.h> #include <math.h> +#include <string.h> + +#include "projects.h" #include "geocent.h" diff --git a/src/pj_units.c b/src/pj_units.c index 84b8894e..59ff1ebe 100644 --- a/src/pj_units.c +++ b/src/pj_units.c @@ -1,5 +1,7 @@ /* definition of standard cartesian units */ +#include <stddef.h> + #include "proj.h" #define PJ_UNITS__ diff --git a/src/pj_utils.c b/src/pj_utils.c index 5a1faf72..3f18cc7e 100644 --- a/src/pj_utils.c +++ b/src/pj_utils.c @@ -28,9 +28,10 @@ #define PJ_LIB__ -#include "projects.h" +#include <stdio.h> #include <string.h> -#include <math.h> + +#include "projects.h" /************************************************************************/ /* pj_is_latlong() */ diff --git a/src/proj_4D_api.c b/src/proj_4D_api.c index 70110746..bd27cc17 100644 --- a/src/proj_4D_api.c +++ b/src/proj_4D_api.c @@ -26,8 +26,13 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. *****************************************************************************/ -#include <stddef.h> + #include <errno.h> +#include <stddef.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + #include "proj.h" #include "proj_internal.h" #include "proj_math.h" @@ -1080,4 +1085,3 @@ PJ_FACTORS proj_factors(PJ *P, PJ_COORD lp) { return factors; } - diff --git a/src/proj_api.h b/src/proj_api.h index 5bba5887..36187441 100644 --- a/src/proj_api.h +++ b/src/proj_api.h @@ -25,16 +25,16 @@ * DEALINGS IN THE SOFTWARE. *****************************************************************************/ - /* +/* * This version number should be updated with every release! * * This file is expected to be removed from the PROJ distribution * when a few minor-version releases has been made. * */ - #ifndef PJ_VERSION - #define PJ_VERSION 500 - #endif +#ifndef PJ_VERSION +#define PJ_VERSION 500 +#endif /* If we're not asked for PJ_VERSION only, give them everything */ @@ -43,16 +43,17 @@ #ifndef PROJ_API_H #define PROJ_API_H -#ifdef __cplusplus -extern "C" { -#endif - - /* standard inclusions */ #include <math.h> +#include <stddef.h> #include <stdlib.h> +#ifdef __cplusplus +extern "C" { +#endif + + /* pj_init() and similar functions can be used with a non-C locale */ /* Can be detected too at runtime if the symbol pj_atof exists */ #define PJ_LOCALE_SAFE 1 diff --git a/src/proj_etmerc.c b/src/proj_etmerc.c index 9a89e2b0..06da604d 100644 --- a/src/proj_etmerc.c +++ b/src/proj_etmerc.c @@ -38,10 +38,10 @@ * */ - #define PJ_LIB__ #include <errno.h> + #include "proj.h" #include "projects.h" #include "proj_math.h" @@ -349,4 +349,3 @@ PJ *PROJECTION(utm) { return setup (P); } - diff --git a/src/proj_internal.h b/src/proj_internal.h index 30a4a89e..bd289419 100644 --- a/src/proj_internal.h +++ b/src/proj_internal.h @@ -31,7 +31,9 @@ #define _USE_MATH_DEFINES #endif #endif + #include <math.h> /* For M_PI */ +#include <stddef.h> #include "proj.h" diff --git a/src/proj_mdist.c b/src/proj_mdist.c index 02d9ebee..777f704d 100644 --- a/src/proj_mdist.c +++ b/src/proj_mdist.c @@ -28,7 +28,12 @@ ** Precision commensurate with double precision. */ #define PJ_LIB__ + +#include <math.h> +#include <stdlib.h> + #include "projects.h" + #define MAX_ITER 20 #define TOL 1e-14 diff --git a/src/proj_rouss.c b/src/proj_rouss.c index bbf6ff0f..ca4476bb 100644 --- a/src/proj_rouss.c +++ b/src/proj_rouss.c @@ -24,7 +24,10 @@ ** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #define PJ_LIB__ + #include <errno.h> +#include <math.h> + #include "proj.h" #include "projects.h" @@ -151,4 +154,3 @@ PJ *PROJECTION(rouss) { return P; } - diff --git a/src/rtodms.c b/src/rtodms.c index 77d438b7..f0e2f675 100644 --- a/src/rtodms.c +++ b/src/rtodms.c @@ -1,7 +1,12 @@ /* Convert radian argument to DMS ascii format */ -#include "projects.h" + +#include <math.h> +#include <stddef.h> #include <stdio.h> #include <string.h> + +#include "projects.h" + /* ** RES is fractional second figures ** RES60 = 60 * RES |
