aboutsummaryrefslogtreecommitdiff
path: root/src/pj_malloc.c
AgeCommit message (Collapse)Author
2018-12-26cpp conversion: minimal steps to fix compilation errors, not warningsEven Rouault
2018-05-15IWYU: Partial PJ_natearth.c..rtodms.cKurt Schwehr
2018-03-11Remove angle brackets for proj headers (#849)Thomas Knudsen
* Avoid using angle brackets for PROJ headers. Switching from #include <proj.h> to #include "proj.h", and correspondingly for projects.h and proj_api.h, reduces the risk of accidentally picking up a system installed older version of the header while building a new version of PROJ. * Also handle geodesic.h
2018-02-07Shrink PJ_XXX_INFO structs, but keep same syntax. (#775)Thomas Knudsen
* Shrink PJ_XXX_INFO structs, but keep same syntax. A number of the fixed length strings in the INFO structs are simply reflections of material that already exists as static strings at a number of places in the library (or in the case of PJ_INFO, really *should* exist, and now is implemented). This PR replaces these cases of constant length strings with const char pointers. The usage syntax is unchanged, and so is the nice property of having the return value allocated on the stack, and hence not requiring explicit memory management by the caller. proj_info now only does setup once - and the searchpath entry of PJ_INFO is not arbitrarily truncated at 512 bytes. Repeated calls simply returns a copy of already prepared material. The id, description and definition entries of PJ_PROJ_INFO are now also guaranteed to hold the entire text of the corresponding static string, by being represented by a const char pointer to that actual static string. PJ_GRID_INFO and PJ_INIT_INFO (i.e. the two smallest INFO structs) are unchanged. * Eliminate pj_strlcpy - not needed anymore: Remining calls could safely be replaced by strncpy. * Extend PROJ_INFO with paths from pj_set_searchpath. NOTE: Need to call pj_set_searchpath before first call to proj_info Huge thanks to Kristian Evers and Even Rouault for comments, debugging and advice.
2018-02-06Make pj_free return with the correct errno.Kristian Evers
Error codes can't be specified directly in pj_free. With this change the error number in proj_errno() is passed on to P->destructor to ensure that we communicate the correct reason why the PJ object is being freed. This was a problem in the cs2cs_emulation setup when auxillary operations failed to create. The error was not propagated properly when destroying the parent object.
2018-01-31Introduce compatibility for cs2cs-style proj-strings into the 4D API.Thomas Knudsen
Parameters such as towgs84, nadgrids and geoidgrids was previously only handled by pj_transform(). This commit add a compatibility layer in proj_create() by calling the pj_cs2cs_emulation_setup() function. This function sets up a handful of predefined transformation objects on the PJ object that is being created. Each of these transformation objects are related to the cs2cs-style parameters we are trying to emulate in the 4D API. That is, if the +towgs84 parameters is used we create P->helmert with the parameters specified in +towgs84. Similarly for +axis, +nadgrids and +geoidgrids. When these transformation objects exists we use them in the prepare and finalize functions in pj_fwd/ pj_inv. If no cs2cs-style parametes are specified we skip those parts of the prepare and finalizing steps. Co-authored-by:Thomas Knudsen <thokn@sdfe.dk> Co-authored-by:Kristian Evers <kristianevers@gmail.com>
2017-12-17Free format everywhere (#693)Thomas Knudsen
* Free format now in cmd lines, in gie, and in init files * Corrected handling of defaults * Add demo of integrated definition and validation * Repair stack-smashing memmove in get_init * repair paralist corruption, clean up debug output * Install test files for nmake builds * Add many improvements following suggestions by @schwehr * Be consistent in requiring lower case everywhere in gie.c Also, this Fixes #703 and Fixes #697
2017-11-20Replace pj_ell_set with reimplementation... (#675)Thomas Knudsen
* Replace pj_ell_set with reimplementation supporting ellipsoid inheritance * remove unreachable code from pj_ell_set.c * Swap steps, so ellps args are read first, in accordance with historical behaviour * Add ellipsoid tests to CI targets * Reduce some optimistic tolerances OS/X appears to have a slightly off float handling, resulting in differences at the nanometer level. Switching to 10 nm.
2017-10-19Prevent crashes and leaks on allocation failure (#606)Aaron Puchert
* Prevent crashes and leaks on allocation failure Memory allocation can fail. We need to gracefully handle this case and prevent dereferencing null pointers. * Make NULL checks consistent within a file * Properly report allocation errors * Improve cleanup in pj_gc_reader.c * Implement pj_strdup and use instead of strdup The function strdup is not part of ANSI C 89, but a POSIX extension. Therefore we can not rely on it being available on all platforms.
2017-10-08Resolve #594 and OSS-Fuzz-3569 (#595)Thomas Knudsen
* Resolve #594 and OSS-Fuzz-3569 * Restructure PJ_geos opaque object: sweep_axis showed unneeded, and freeing it was wrong. Eliminate instead Resolves #594 Resolves OSS-Fuzz Issue 3569 Credit to OSS-Fuzz
2017-10-06Enable address sanitizer in linux/clang buildThomas Knudsen
Elim some leaks by initializing PJ.destructor in PJ_ob_tran.c properly Avoid tests bombing when built with address sanitizer: Repair memory leak in test228.c Avoid tests bombing when built with address sanitizer: Repair memory leak in multistresstest.c
2017-10-06Enable default destructor for all PJ objects.Thomas Knudsen
In most cases memory deallocation is completely removed from the code since it can be handled by the default destructor. In a few special cases a local destructor overrides the default destructor and makes sure that locally allocated memored is cleaned up correctly. Move all deallocation from pj_free to pj_default_destructor Rename pj_latlong.c to fit with the conventional format PJ_latlong.c - freeup was missed here due to wrong naming Clean up pj_init to avoid double deallocation; Also resolve #576 by adding z_0 and t_0 options in pj_init, while cleaning Add a prototype for dealloc_params Added missing errno.h include in pj_ctx.c Temporarily removing ob_tran from testvarious, to be sure that is where the trouble is Make PJ_ob_tran.c use proper initialization for the chained projection proj=ob_tran: make it clear, that we disallow ellipsoidal projections, and, for improved backwards compatibility, turns off default settings, which could inject unwanted ellipsoid definitions ... then also remove the ellipsoid definition from the testvarious test case - which is probably buggy anyway Work around cs2cs spherical init bug in testvarious; Forbid defs for ob_tran in pj_init
2017-09-28Support a default destructor for PJ objectsThomas Knudsen
2017-02-27Merge pull request #495 from rouault/misc_warning_fixesEven Rouault
Fix warnings related to -Wshadow -Wnull-dereference -Wfloat-conversion -Wmissing-prototypes -Wmissing-declarations
2017-02-26Typo fixesEven Rouault
2017-02-26Fix warnings related to -Wshadow -Wnull-dereference -Wfloat-conversionr ↵Even Rouault
-Wmissing-prototypes -Wmissing-declarations
2016-11-12Pipeline plus api - in continuation of the Genereic Coordinates pull request ↵Thomas Knudsen
(#445) This commit reflects continued work on the new rationalized API with geodetic extensions (see rationale in proj.h). It also reflects the parallel work on the transformation pipeline reimplementation, by introducing the PJ_cart cartesian/ellipsoidal converter. See example/pj_obs_api_test.c for demo example code
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
2011-02-08avoid cplusplus comments (#92)Frank Warmerdam
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@1965 4e78687f-474d-0410-85f9-8d5e500ac6b2
2009-01-26remove SCCSID and lint stuff from all source filesFrank Warmerdam
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@1515 4e78687f-474d-0410-85f9-8d5e500ac6b2
2005-07-16Quick bugfix to errno after malloc success problem.Marek Brudka
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@1302 4e78687f-474d-0410-85f9-8d5e500ac6b2
1999-03-18NewFrank Warmerdam
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@776 4e78687f-474d-0410-85f9-8d5e500ac6b2