aboutsummaryrefslogtreecommitdiff
path: root/src/pj_init.c
AgeCommit message (Collapse)Author
2017-05-24Merge pull request #519 from kbevers/avoid-zero-divisionKristian Evers
Handle zero division errors reported by OSS-Fuzz
2017-05-24Avoid zero division in pj_init_ctx().Kristian Evers
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=1793 Credit to OSS-Fuzz.
2017-05-23Avoid potentially very long loop when normalizing longitudes around ↵Even Rouault
long_wrap_center Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=1809 Credit to OSS Fuzz
2017-05-22pj_init(): fix memory leak of pj->geodEven Rouault
Whe PIN = (*proj)(PIN) fails, it doesn't free the geod member. So allocate it afterwards. Credit to OSS Fuzz
2017-02-28Enable cppcheck and fix related mostly false-positive warningsEven Rouault
2017-02-26Fix MSVC warnings and add /Wx to appveyor.ymlEven Rouault
2017-02-26Recent clang (e.g MacOSX) warning fixes related to double to _Bool implicit ↵Even Rouault
conversions
2016-12-15Horner and helmert (#456)Thomas Knudsen
Introducing the Horner polynomial evaluator also introduces the need for very long +init:tag arguments (a n'th order 2D polynomium has (n+1)(n+2)/2 coefficients, and n is typically in the range 5-10, i.e. up to around 60 coefficients for each polynomium, and there are 4 polynomia in a complete back/forward transformation set). Hence, in this commit, along with the first part of the Horner code, the code for reading +init files has been modified in a (for all practical purposes) backwards compatible way, by making it possible to introduce line continuations by escaping line breaks, i.e. preceding them with a backslash. An escaped line break works (as it would in TeX), by skipping all following whitespace, including interspersed #-comments. This simple extension makes it possible to create very long initialization elements without losing track of the structure (cf. s45b.pol and pj_init_test.c in the examples-directory for a demo). The s45b.pol file was created by hand-editing the output of the software doing the original constrained adjustment for the polynomial coefficients. The simple adding of the “skip following whitespace and comments” feature has made it possible to retain almost all metadata from the source material. This is considered very important, since 1) For the lack of a prior common file format for geodetic polynomial coefficients, there is a good chance that this will become THE standard, at least for the time being, and 2) Without the metadata represented, it will be very hard for a human to debug code involving a slightly misrepresented polynomium. Due to the current architecture of the pj_init.c code (mostly around the fill_buffer() function), it is next to impossible to implement the line continuation functionality in full generality. Hence, it has been necessary to limit this format extension to files smaller than 64 kB. * Correction of spherical HEALpix test case The first HEALpix test case in nad/testvarious is clearly intended to invoke the spherical form of HEALpix. It does, however, specify the spheroid using the +a=1 size parameter, without specifying any shape parameter. But since +no_defs is not specified either, a shape parameter is picked up from the nad/proj_def.dat file (where ellps=WGS84 is given in the <general> section). It appears that this has not happened before I updated the pj_init code to support projection pipelines (see below). I do, however, believe that the present behaviour is the correct one, and rather than retrohacking the pj_init code, to (incorrectly, I believe) reproduce the prior behaviour, I have corrected the test case invocation in nad/testvarious to specify the spheroid using the +R=1 size parameter (which was already used in the following test case). * Repair scaling of projections stomping on value of semimajor axis * Workaround MSVC HUGE_VAL misimplementation. The "return const err object" idiom (i.e. const <type> err = {HUGE_VAL,...}; ... if (bad) return err) is problematic to implement due to MSVC's misimplementation of HUGE_VAL as a non-const. Hence, we need to run-time initialize these. In the pj_inv functions, this was mistakenly done to the wrong object. For pj_fwdobs/invobs and the remaining part of the obs-based API, this is now worked around by providing functions returning a run time HUGE_VAL initialized PJ_OBS or PJ_COO resp. Obnoxious, but given MSVC's market penetration there is really not much else we can do.
2016-12-12Add a scripts/fix_typos.sh script and correct reported errorsEven Rouault
2016-11-20Plumbing for pipelines (#453)Thomas Knudsen
* re-enter pipeline The pipeline interface is now internally based on the pj_obs_api, which simplifies the implementation significantly. This is the first mock up - it compiles fine, but is currently untested * pipeline code cleaned up The pipeline code is now based on the PJ_OBS api (although you can still invoke a pipeline through pj_fwd/pj_inv and their 3D brethren). This has made it possible to eliminate scores of funky casts and convoluted workarounds. The code is now way more straightforward and mostly conforming with common C idioms.. Also, the proj.h / obs_api interface to the logging system has been streamlined through the introduction of the pj_log_error, pj_log_debug, and pj_log_trace functions. * Geodesics + minor changes First proj.h style interface to Charles Karney's geodesics code: pj_lp_dist. Also, renamed pj_apply -> pj_trans * Extended Ellipsoidal Parameters Second eccentricity, second and third flattening etc. * Rename pj_debug_set -> pj_log_level ... and add self test code for PJ_pipeline * Clean up missing pj_apply->pj_trans * Clean up missing pj_obs_dist_2d rename * pj_strerrno bug fixed. Some doc/comments added (In response to a review by @kbevers)
2016-04-05Some initial work on internal regression testsThomas Knudsen
Need these to reduce the chance I'm screwing up something during this rather intrusive code surgery
2016-04-01First steps toward simplified macros/internalsThomas Knudsen
The brief version:: In an attempt to make proj.4 code slightly more secure and much easier to read and maintain, I'm trying to eliminate a few unfortunate design decisions from the early days of proj.4 The work will be *very* intrusive, especially in the PJ_xxx segment of the code tree, but great care has been taken to design a process that can be implemented stepwise and localized, one projection at a time, then finalized with a relatively small and concentrated work package. The (very) long version: See the comments in PJ_minimal.c
2015-07-07Make pj_init() locale safe and no longer modify locale (#226)Even Rouault
Remove setlocale() use in pj_init_ctx(), and replace uses of atof() & strtod() by their locale safe variants pj_atof() and pj_strtod(). Proj versions from now advertize #define PJ_LOCALE_SAFE 1 in proj_api.h and export pj_atof() & pj_strtod()
2015-06-28Merge branch '4-warning-fixes' of github.com:QuLogic/proj.4Even Rouault
2015-06-20Remove dead assignments.Elliott Sales de Andrade
These variables are re-written immediately after.
2015-06-20Fix possibly-uninitialized variable warnings.Elliott Sales de Andrade
Some of these should be false positives, but I re-wrote them anyway because they were unclear.
2015-05-31Remove unused $Id$ keywords.Elliott Sales de Andrade
2015-05-30Fix signed/unsigned comparison warnings.Elliott Sales de Andrade
2015-05-30Remove unused variables.Elliott Sales de Andrade
2015-05-29Fix small memory leak in pj_init.Didier Richard
2015-02-16apply patch for #237 to fix initialization ordering around setlocaleHoward Butler
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@2604 4e78687f-474d-0410-85f9-8d5e500ac6b2
2014-08-18apply fix specified in #229 -- pj_init_plus() with init and other parms ↵Howard Butler
fails in 4.9.0beta git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@2482 4e78687f-474d-0410-85f9-8d5e500ac6b2
2014-02-07avoid mistaken error about missing init file entry (#229)Frank Warmerdam
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@2418 4e78687f-474d-0410-85f9-8d5e500ac6b2
2013-10-20add inline warning about locale issue on windows (#226)Frank Warmerdam
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@2393 4e78687f-474d-0410-85f9-8d5e500ac6b2
2013-06-22bulk of file api implementation complete and workingFrank Warmerdam
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@2345 4e78687f-474d-0410-85f9-8d5e500ac6b2
2012-12-18recover gracefully if setlocale() returns NULL like on Android (#204)Frank Warmerdam
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@2305 4e78687f-474d-0410-85f9-8d5e500ac6b2
2012-06-19first nearly working grid catalog implementationFrank Warmerdam
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@2219 4e78687f-474d-0410-85f9-8d5e500ac6b2
2012-06-08avoid leak of vgridlist_geoid (#175)Frank Warmerdam
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@2215 4e78687f-474d-0410-85f9-8d5e500ac6b2
2012-02-21Use parenthesis around assignments in if statements (#123).Frank Warmerdam
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@2163 4e78687f-474d-0410-85f9-8d5e500ac6b2
2011-12-23only split keywords on pluses following spaces (#132)Frank Warmerdam
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@2131 4e78687f-474d-0410-85f9-8d5e500ac6b2
2011-11-14avoid casting warning with old_localeFrank Warmerdam
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@2117 4e78687f-474d-0410-85f9-8d5e500ac6b2
2011-07-06adjust error handling for missing grid shift files (#116)Frank Warmerdam
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@2067 4e78687f-474d-0410-85f9-8d5e500ac6b2
2011-06-09fix for +axis validation (#87)Frank Warmerdam
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@2049 4e78687f-474d-0410-85f9-8d5e500ac6b2
2011-05-10default vertical units to horizontal unitsFrank Warmerdam
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@2001 4e78687f-474d-0410-85f9-8d5e500ac6b2
2011-05-10add support for vunits/vto_meter parameters to specify vertical unitsFrank Warmerdam
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@2000 4e78687f-474d-0410-85f9-8d5e500ac6b2
2011-02-21fix locale handling, we need to copy the old locale. Avoid too much ↵Frank Warmerdam
altering of locale. git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@1977 4e78687f-474d-0410-85f9-8d5e500ac6b2
2011-02-08avoid cplusplus comments (#92)Frank Warmerdam
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@1965 4e78687f-474d-0410-85f9-8d5e500ac6b2
2010-09-20ensure geoidgrids is marked as usedFrank Warmerdam
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@1902 4e78687f-474d-0410-85f9-8d5e500ac6b2
2010-08-31fix commentFrank Warmerdam
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@1887 4e78687f-474d-0410-85f9-8d5e500ac6b2
2010-06-11roll projCtx through various other low level functionsFrank Warmerdam
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@1856 4e78687f-474d-0410-85f9-8d5e500ac6b2
2010-06-11preliminary implementation of projCtx APIFrank Warmerdam
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@1854 4e78687f-474d-0410-85f9-8d5e500ac6b2
2010-06-01rework indentationFrank Warmerdam
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@1848 4e78687f-474d-0410-85f9-8d5e500ac6b2
2010-05-11preliminary addition of vertical datum shifting capabilityFrank Warmerdam
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@1839 4e78687f-474d-0410-85f9-8d5e500ac6b2
2010-03-16Rework the translation of nadgrids parameters into a list of gridshift files Frank Warmerdam
to avoid use of static "lastnadgrids" information which screws up multithreading. Changes the PJ structure. git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@1831 4e78687f-474d-0410-85f9-8d5e500ac6b2
2010-03-03avoid warningsFrank Warmerdam
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@1827 4e78687f-474d-0410-85f9-8d5e500ac6b2
2010-03-01added preliminary support for +axis (#18)Frank Warmerdam
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@1825 4e78687f-474d-0410-85f9-8d5e500ac6b2
2010-01-24fix seriously broken lon_wrap support (#62)Frank Warmerdam
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@1789 4e78687f-474d-0410-85f9-8d5e500ac6b2
2009-09-24temporarily set locale to C to avoid locale numeric issues (#49)Frank Warmerdam
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@1630 4e78687f-474d-0410-85f9-8d5e500ac6b2
2009-03-09added initial init file cachingFrank Warmerdam
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@1542 4e78687f-474d-0410-85f9-8d5e500ac6b2
2009-01-06removed CVS log messages since they are not maintained by subversionFrank Warmerdam
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@1504 4e78687f-474d-0410-85f9-8d5e500ac6b2