Skip to content
Commits on Source (2)
proj (5.0.0-4~exp1) experimental; urgency=medium
* Add upstream patches from 5.0 branch:
- Remove-angle-brackets-for-proj-headers.patch
- Remove-pj_-prefix-from-static-functions.patch
- Make-sure-that-transient-errors-are-returned-correctly.patch
Should fix python-mpop test failure.
-- Bas Couwenberg <sebastic@debian.org> Mon, 12 Mar 2018 15:07:18 +0100
proj (5.0.0-3) unstable; urgency=medium
* Update pj_transform-height_unit.patch which changes as applied upstream.
......
Description: Make sure that transient errors are returned correctly
Author: Kristian Evers <kristianevers@gmail.com>
Origin: https://github.com/OSGeo/proj.4/commit/c4895fdf89254e4969f474355c28d67e7dc7e74d
--- a/src/pj_fwd.c
+++ b/src/pj_fwd.c
@@ -174,11 +174,22 @@ static PJ_COORD fwd_finalize (PJ *P, PJ_
}
+static PJ_COORD error_or_coord(PJ *P, PJ_COORD coord, int last_errno) {
+ if (proj_errno(P))
+ return proj_coord_error();
+
+ proj_errno_restore(P, last_errno);
+ return coord;
+}
+
XY pj_fwd(LP lp, PJ *P) {
+ int last_errno;
PJ_COORD coo = {{0,0,0,0}};
coo.lp = lp;
+ last_errno = proj_errno_reset(P);
+
if (!P->skip_fwd_prepare)
coo = fwd_prepare (P, coo);
if (HUGE_VAL==coo.v[0])
@@ -200,15 +211,19 @@ XY pj_fwd(LP lp, PJ *P) {
if (!P->skip_fwd_finalize)
coo = fwd_finalize (P, coo);
- return coo.xy;
+
+ return error_or_coord(P, coo, last_errno).xy;
}
XYZ pj_fwd3d(LPZ lpz, PJ *P) {
+ int last_errno;
PJ_COORD coo = {{0,0,0,0}};
coo.lpz = lpz;
+ last_errno = proj_errno_reset(P);
+
if (!P->skip_fwd_prepare)
coo = fwd_prepare (P, coo);
if (HUGE_VAL==coo.v[0])
@@ -230,12 +245,15 @@ XYZ pj_fwd3d(LPZ lpz, PJ *P) {
if (!P->skip_fwd_finalize)
coo = fwd_finalize (P, coo);
- return coo.xyz;
+
+ return error_or_coord(P, coo, last_errno).xyz;
}
PJ_COORD pj_fwd4d (PJ_COORD coo, PJ *P) {
+ int last_errno = proj_errno_reset(P);
+
if (!P->skip_fwd_prepare)
coo = fwd_prepare (P, coo);
if (HUGE_VAL==coo.v[0])
@@ -257,5 +275,6 @@ PJ_COORD pj_fwd4d (PJ_COORD coo, PJ *P)
if (!P->skip_fwd_finalize)
coo = fwd_finalize (P, coo);
- return coo;
+
+ return error_or_coord(P, coo, last_errno);
}
--- a/src/pj_inv.c
+++ b/src/pj_inv.c
@@ -172,11 +172,22 @@ static PJ_COORD inv_finalize (PJ *P, PJ_
}
+static PJ_COORD error_or_coord(PJ *P, PJ_COORD coord, int last_errno) {
+ if (proj_errno(P))
+ return proj_coord_error();
+
+ proj_errno_restore(P, last_errno);
+ return coord;
+}
+
LP pj_inv(XY xy, PJ *P) {
+ int last_errno;
PJ_COORD coo = {{0,0,0,0}};
coo.xy = xy;
+ last_errno = proj_errno_reset(P);
+
if (!P->skip_inv_prepare)
coo = inv_prepare (P, coo);
if (HUGE_VAL==coo.v[0])
@@ -198,15 +209,19 @@ LP pj_inv(XY xy, PJ *P) {
if (!P->skip_inv_finalize)
coo = inv_finalize (P, coo);
- return coo.lp;
+
+ return error_or_coord(P, coo, last_errno).lp;
}
LPZ pj_inv3d (XYZ xyz, PJ *P) {
+ int last_errno;
PJ_COORD coo = {{0,0,0,0}};
coo.xyz = xyz;
+ last_errno = proj_errno_reset(P);
+
if (!P->skip_inv_prepare)
coo = inv_prepare (P, coo);
if (HUGE_VAL==coo.v[0])
@@ -228,12 +243,15 @@ LPZ pj_inv3d (XYZ xyz, PJ *P) {
if (!P->skip_inv_finalize)
coo = inv_finalize (P, coo);
- return coo.lpz;
+
+ return error_or_coord(P, coo, last_errno).lpz;
}
PJ_COORD pj_inv4d (PJ_COORD coo, PJ *P) {
+ int last_errno = proj_errno_reset(P);
+
if (!P->skip_inv_prepare)
coo = inv_prepare (P, coo);
if (HUGE_VAL==coo.v[0])
@@ -255,5 +273,6 @@ PJ_COORD pj_inv4d (PJ_COORD coo, PJ *P)
if (!P->skip_inv_finalize)
coo = inv_finalize (P, coo);
- return coo;
+
+ return error_or_coord(P, coo, last_errno);
}
--- a/test/gie/4D-API_cs2cs-style.gie
+++ b/test/gie/4D-API_cs2cs-style.gie
@@ -186,4 +186,32 @@ tolerance 20 cm
accept 7.438632495 46.951082877
expect 2600000.0 1200000.0
-------------------------------------------------------------------------------
+
+-------------------------------------------------------------------------------
+Make sure that transient errors are returned correctly.
+-------------------------------------------------------------------------------
+operation +proj=geos +lon_0=0.00 +lat_0=0.00 +a=6378169.00 +b=6356583.80 +h=35785831.0
+-------------------------------------------------------------------------------
+accept 85.05493299 46.5261074
+expect failure
+
+accept 85.05493299 46.5261074 0
+expect failure
+
+accept 85.05493299 46.5261074 0 0
+expect failure
+
+-------------------------------------------------------------------------------
+Test that Google's Web Mercator works as intended (see #834 for details).
+-------------------------------------------------------------------------------
+operation proj=pipeline step init=epsg:26915 inv step init=epsg:3857
+-------------------------------------------------------------------------------
+tolerance 20 cm
+accept 487147.594520173 4934316.46263998
+expect -10370728.80 5552839.74
+
+accept 487147.594520173 4934316.46263998 0
+expect -10370728.80 5552839.74 0
+-------------------------------------------------------------------------------
+
</gie>
This diff is collapsed.
This diff is collapsed.
0001-Revert-fix-to-22.patch
pr845_Refactor-pj_transform-reintroduce-support-for-vertical-scaling.patch
pj_transform-height_unit.patch
Remove-angle-brackets-for-proj-headers.patch
Remove-pj_-prefix-from-static-functions.patch
Make-sure-that-transient-errors-are-returned-correctly.patch