aboutsummaryrefslogtreecommitdiff
path: root/src/gie.c
AgeCommit message (Collapse)Author
2018-08-11gie: add a require_grid keyword, and use if for DHDN_ETRS89.gie; aso fix ↵Even Rouault
DHDN_ETRS89 autoconf test
2018-06-06Correct bad use of proj_dmstor in gie.Kristian Evers
The previous commits were added way to prematurely. The code was not properly tested and it turned out to do more bad than good. This commit hopefully fixes that. And this time it is backed up by tests! DMS style coordinates should now be fully functional in gie. Finger crossed.
2018-06-06Remove leftover debugging print statementKristian Evers
2018-06-05Make gie read dms style coordinatesKristian Evers
proj_strtod doesn't read values like 123d45'678W so we need a bit of help from proj_dmstor. proj_strtod effectively ignores what comes after "d", so we use that fact that when dms is larger than d the value was stated in "dms" form. This could be avoided if proj_dmstor used the same proj_strtod() as gie, but that is not the case (yet). When we remove projects.h from the public API we can change that.
2018-05-31Fix buffer overflow in gie.c:append_args() (#1023)Kurt Schwehr
Observed a buffer overflow in append_args with autofuzz with the strcpy in append_args. I think the +2 is required to account for both a nul char and the space.
2018-05-30Merge pull request #1022 from schwehr/gie-operation-overflowKristian Evers
Ensure that operations are less than MAX_OPERATION long.
2018-05-30Merge pull request #1021 from rouault/add_test_frameworkKristian Evers
Add test framework, C++11 compilation mode and warning fixes
2018-05-30Fix warnings found by clang with new warning flags to be added in later commitEven Rouault
Fixes consist in: - no use of comma operator for multi statement purpose - avoid confusing comma in for loops first and third clauses - avoid implicit long to int casts by storing to long, or explicit bound checking before cast
2018-05-29Ensure that operations are less than MAX_OPERATION long.Kurt Schwehr
Buffer overflow found with autofuzz.
2018-05-24gie T.fout output cleanupKurt Schwehr
- printf -> fprintf in more places - puts -> fprintf - Move list_err_codes to after where T.fout is set This makes fuzzing easier by allowing more of the output to be sent to /dev/null. Found with autofuzz.
2018-05-24Merge pull request #949 from kbevers/return-nans-quicklyKristian Evers
Return NaN coordinate immediately when receiving NaN input
2018-05-24Merge pull request #1013 from schwehr/proj_strtod_headerKristian Evers
Use proj_strtod.h for proj_strtod and proj_atof
2018-05-23Use proj_strtod.h for proj_strtod and proj_atofKurt Schwehr
2018-05-23Merge branch 'master' into return-nans-quicklyKristian Evers
2018-05-22Limit the number of round trips to 1 million and check for underflowsKurt Schwehr
Why was fabs applied to ntrips? And why is it parsed as a float? Also add documentation for roundtrip. External rst docs do not match this function.
2018-05-15IWYU: Partial PJ_natearth.c..rtodms.cKurt Schwehr
2018-05-08Replace int typecasts with calls to lround to avoid bad conversions on NaN ↵Kristian Evers
input. Added test to check for those cases.
2018-05-07Clean readability-misleading-indentation clang-tidy warningsKristian Evers
2018-05-07Clean readability-redundant-declaratio clang-tidy warningsKristian Evers
Function prototypes were declared twice for the FFIO framework, probably because FFIO at some point during development existed as a separate file. With this commit the second set of function prototypes is removed leaving only the first entry at the top of the file. Similarly duplicate header inclusions has been removed.
2018-05-07Clean readability-inconsistent-declaration-parameter-name clang-tidy warningsKristian Evers
2018-04-23Merge pull request #937 from kbevers/c99-math-moduleKristian Evers
Collect custom C99 math functions in proj_math.h
2018-04-16Collect custom C99 math functions in proj_math.hKristian Evers
We are relying more and more on C99 math functions. On C89 systems where those functions are not available our own custom versions of those functions are used instead. So far these has been spread across the code base. This commit gathers them in the same file and introduces the proj_math.h header. The build system checks for C99 math functions. If not found the proj_math.h header make sure that C99 functions are defined as their pj_ equivalent. Ideally proj_math.h is included instead of math.h. This removes the need for any checks against HAVE_C99_MATH in the code making it easier to read. For this commit the functions hypot, log1p and asinh has been taken care of.
2018-04-16Silence complaints about missing </gie> tagKristian Evers
2018-03-27Merge pull request #907 from kbevers/print-helpKristian Evers
Print help
2018-03-27Print help text when callin gie without argumentsKristian Evers
Previously gie would return "Nothing to do" when called without arguments. With this change the help text is returned instead.
2018-03-27Free memory on exitKristian Evers
2018-03-27Document --version option in cct and gieKristian Evers
2018-03-26Initialize test_time other fields.Kurt Schwehr
Leaving x, y, z fields unset triggers an MSAN failure. fwd_prepare pj_fwd.c:40:9 pj_fwd4d pj_fwd.c:260:15 proj_trans proj_4D_api.c:166:20 test_time gie.c:1955:11
2018-03-19Fix spelling error in gie error code. Closes #861.Kristian Evers
2018-03-11Merge pull request #852 from kbevers/remove-pj_-prefix-from-static-functionsKristian Evers
Remove 'pj_' prefix from static functions
2018-03-11Various typo fixesEven Rouault
2018-03-11Remove 'pj_' prefix from static functionsKristian Evers
Functions should only be prefixed with 'pj_' when they can be used in other parts of the code base and not just within a single file. Takes care of the last step in #675.
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-23Don't reset errno when skipping tests.Kristian Evers
The error number should not be reset until a new instance of "operation ..." is reached. The ignore-feature initially worked by accident since pj_errno was not being reset when calling proj_errno_reset. This was fixed in #808, which subsequently caused ignored tests to fail.
2018-02-22gie expect: ignore unspecd dims, improve reporting/builtinsThomas Knudsen
In pipelines including a Helmert shift, we need to run the test through the 4D transformation interface, even though the input coordinate system may be 2D. This can be enforced by appending "0 0" to the 2D coordinate pair in the accept instruction, which is sufficiently recognizable to be considered an idiom for selecting 4D. On return, however, (i.e. in the expect instruction), the last dimensions will contain garbage, and this garbage will be compared with "0 0" when computing the deviation. This obviously leads to nonsensical results, which this commit repairs by zeroing all dimensions *not given* in expect, before computing the deviation. Additionally, the test tolerance for geo/cartesian roundtrip precision has been relaxed from picometer to nanometer level. These tests have shown to intermittently bomb, and as the pm level tolerance is probably a leftover from when deviation was computed in degrees, not meter (and hence a factor of 111000 more tight than intended at its introduction) relaxing it by a factor of 1000 makes ample sense. Also, two new features, introduced while debugging this case has been left in the code: - improved reporting, for verbosity levels higher than 2 - a "skip" instruction, forcing all remaining work to be skipped (i.e. run until something strange happens - then stop to handle debugging, while avoiding additional garbage)
2018-02-12Repair prior attempt to default to WGS84 if explicit ellps not neededThomas Knudsen
2018-02-10Make the 4D API fully 4D (#788)Thomas Knudsen
Make 4D API fully 4D: Remove PJ_XY, PJ_LP, PJ_XYZ, PJ_LPZ etc. from the API surface and make all formal parameters of the API fully 4D PJ_COORD. This operation primarily influences the proj_XXX_dist functions, which mostly work by calling Charles Karney's geodesic subsystem, keeping the distance, and throwing away the start and end azimuths for the geodesic computed. Also a PJ_GEOD(esic) persona is introduced for the PJ_COORD type. The proj_geod function returns a PJ_GEOD, representing the geodesic between the points represented by its PJ_COORD arguments. Finally, the proj_factors functions had its lp argument changed from PJ_LP to PJ_COORD.
2018-02-10Handle sign convention for vertical datum shiftsThomas Knudsen
Also make corresponding sign corrections in a number of tests, and comment out a few tests which work correctly, but report failure since gie is not yet ready to handle unusual axis orders in cases with angular output coordinates.
2018-02-10gie: repair handling of angular distancesThomas Knudsen
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-06Use a grid in API selftest that we can always rely on being present.Kristian Evers
2018-02-06Let gie skip tests when specific errors are returned.Kristian Evers
Introducing a new keyword 'skiperror' that when given a error code like pjd_err_failed_to_load_grid will skip tests if that error is returned when creating the operation. This is useful for grids that can't be located.
2018-02-04Add --version option to gie and cct.Thomas Knudsen
Additionally correct a spelling error in optargpm.h and remove two lines of leftover cruft from gie.c
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>
2018-01-09Remove or use unused macrosAaron Puchert
Some macros seemed to be leftover from earlier code, so I removed them. Others seemed like they should have been used, but weren't. There should be no functional change, except the following: in floating- point arithmetic, x / y is not the same as x * (1.0 / y). It can be argued that using the multiplication is significantly faster, and the algorithm is approximative anyway. Otherwise, the constants are obviously not required. Also fixes one location in PJ_aitoff.c, where an enumeration value should have been used.
2018-01-05Custom unit factors in unitconvert.Kristian Evers
Added the possibility to use custom unit factors. Similar to the classic +to_meter parameter the conversion factor is related to meters, i.e. the factor for conversion from kilometers meters is 1000. The custom unit factors is given using the existing xy_in, xy_out, z_in and z_out parameters, for example: proj=unitconvert xy_in=4.5 +xy_out=mm
2018-01-03Introduce preparation/finalization steps in fwd/inv subsystem, supporting ↵Thomas Knudsen
arbitrary dimensionality in test code * Call trans func of same dimensionality as input in gie * Refactor prep/fin code for pj_fwd/pj_inv 2D,3D,4D * Remove prime meridian handling from pj_transform (now handled in pj_fwd_prepare/pj_inv_finalize) * Introduce prep/fin skips, mostly in support of axisswap and pipeline drivers * Refactor fwd/inv subsystem * pj_transform: Let pj_fwd/inv handle scaling * Let pj_fwd/inv3d fall back to 2D eventually
2017-12-19Some corrections in response to a review by Kristian Evers (#718)Thomas Knudsen
* Some corrections in response to a review by Kristian Evers
2017-12-17Declare non-local variables as const where possibleAaron Puchert
Having non-const variables of static lifetime or even global scope is usually a bad idea. These variables are inherently constants, and this should be enforced. This required marking some functions as not modifying input parameters and marking some pointers as pointers to const. One advantage is that the compiler usually puts const static variables in a read-only code segment, so they can't be modified physically. This can be verified with `nm` (on POSIX systems). To avoid changes to the public API, functions returning non-const pointers to data tables were left intact, but the returned data may not be modified. Internally we prefer using the proj_list_* functions over the pj_get_*_ref functions, because the former return const pointers.
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