aboutsummaryrefslogtreecommitdiff
path: root/src/pj_fwd.c
diff options
context:
space:
mode:
authorThomas Knudsen <busstoptaktik@users.noreply.github.com>2017-07-07 17:14:28 +0200
committerGitHub <noreply@github.com>2017-07-07 17:14:28 +0200
commite09e24eddbd49cd802ac1334f229f1698ea0b755 (patch)
tree5578b6a9356486b26354288d1f09f990d4fb4134 /src/pj_fwd.c
parentced55e88a7f50205d57ddf8ed77d601daa8c5bfd (diff)
downloadPROJ-e09e24eddbd49cd802ac1334f229f1698ea0b755.tar.gz
PROJ-e09e24eddbd49cd802ac1334f229f1698ea0b755.zip
obs_api revision and improvements: new namespace etc. (#530)
* obs_api revision and improvements: new namespace etc. * Minor corrections: use unused functions, add missing prototype, added fwd/invcoord to PJ * Minor correction: MSVC barfs on va_arg type specification. Trying once more with added parens * Reverting paren correction, which appears to be a non-solution * Significant improvements to the OBS_API, plus a number of corrections, mostly in test code, to reflect API changes * Added two missing prototypes * Adding the proj_transform function and some related checks * Improvements to proj_transform etc. based on suggestions from Even Rouault * Reducing the libc include footprint of proj.h - again based on suggestions from Even Rouault * A few minor corrections * Eliminate a MSVC warning about non-initialized usage. Not an actual issue, as another check has locked the path, but at least this should calm down MSVC * Improved support for the errno reset/restore paradigm * Introduced the internal header proj_internal.h; Moved most non-API stuff from pj_obs_api.c to pj_internal.c * Adding proj_internal.h to HEADERS_LIBPROJ to solve build problems * Correcting a few pj...proj blunders in PJ_pipeline.c * Correcting a few additional blunders in PJ_pipeline.c * Changed angle-brackets to quotation marks in includes of proj_internal.h * Some minor build system repairs * Some PJ_CONTEXT usage simplifications following suggestions by Kristian Evers @kbevers * Added version numbering to proj.h - Fixes #529 * remove proj_errno_restore macro, provide function implementation * Add proj_get_definition. Fixes #538 * Added library specific deallocator proj_buffer_free, eliminating a potential cross heap issues on Windows. Thx to Even Rouault for spotting this * Got rid of a meaningless cast in proj_buffer_free * Added some missing functions to proj.def (again spotted by @rouault); removed some not-yet-implemented material from proj.h * Renamed proj_get_definition/proj_buffer_free to proj_definition_create/proj_definition_destroy, for symmetry and clarity * Renaming the definition handlers to proj_definition_retrieve / proj_free * Renaming proj_free to proj_release
Diffstat (limited to 'src/pj_fwd.c')
-rw-r--r--src/pj_fwd.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/pj_fwd.c b/src/pj_fwd.c
index 598c6dd2..02f18d1c 100644
--- a/src/pj_fwd.c
+++ b/src/pj_fwd.c
@@ -1,21 +1,21 @@
/* general forward projection */
#define PJ_LIB__
+#include <proj.h>
#include <projects.h>
-#include <errno.h>
# define EPS 1.0e-12
XY /* forward projection entry */
pj_fwd(LP lp, PJ *P) {
XY xy;
XY err;
double t;
+ int last_errno;
/* cannot const-initialize this due to MSVC's broken (non const) HUGE_VAL */
err.x = err.y = HUGE_VAL;
if (0==P->fwd)
return err;
-
- P->ctx->last_errno = pj_errno = errno = 0;
+ last_errno = proj_errno_reset (P);
/* Check input coordinates if angular */
if ((P->left==PJ_IO_UNITS_CLASSIC)||(P->left==PJ_IO_UNITS_RADIANS)) {
@@ -39,7 +39,7 @@ pj_fwd(LP lp, PJ *P) {
/* Do the transformation */
xy = (*P->fwd)(lp, P);
- if ( P->ctx->last_errno )
+ if ( proj_errno (P) )
return err;
/* Classic proj.4 functions return plane coordinates in units of the semimajor axis */
@@ -53,5 +53,6 @@ pj_fwd(LP lp, PJ *P) {
xy.y = P->fr_meter * (xy.y + P->y0);
/* z is not scaled since this is handled by vto_meter outside */
+ proj_errno_restore (P, last_errno);
return xy;
}