aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas Knudsen <busstoptaktik@users.noreply.github.com>2017-11-08 12:41:09 +0100
committerGitHub <noreply@github.com>2017-11-08 12:41:09 +0100
commit70550ae21c653cceefc2142fa89d0fb6c99101d9 (patch)
treef68fff29602e3868a7f2e8d6acb7e935d3ccecb4 /src
parent3ff9899dd4407877ace4daf2794cb759ccdbc235 (diff)
downloadPROJ-70550ae21c653cceefc2142fa89d0fb6c99101d9.tar.gz
PROJ-70550ae21c653cceefc2142fa89d0fb6c99101d9.zip
minor clean ups in and around proj_4D_api (#649)
Diffstat (limited to 'src')
-rw-r--r--src/proj_4D_api.c24
-rw-r--r--src/proj_internal.h8
-rw-r--r--src/projects.h2
3 files changed, 22 insertions, 12 deletions
diff --git a/src/proj_4D_api.c b/src/proj_4D_api.c
index 07208698..aa076f0f 100644
--- a/src/proj_4D_api.c
+++ b/src/proj_4D_api.c
@@ -294,27 +294,29 @@ size_t proj_trans_generic (
else
coord = pj_inv4d (coord, P);
- /* in all full length cases, we overwrite the input with the output */
+ /* in all full length cases, we overwrite the input with the output, */
+ /* and step on to the next element. */
+ /* The casts are somewhat funky, but they compile down to no-ops and */
+ /* they tell compilers and static analyzers that we know what we do */
if (nx > 1) {
- *x = coord.xyzt.x;
- x = (double *) ( ((char *) x) + sx);
+ *x = coord.xyzt.x;
+ x = (double *) ((void *) ( ((char *) x) + sx));
}
if (ny > 1) {
- *y = coord.xyzt.y;
- y = (double *) ( ((char *) y) + sy);
+ *y = coord.xyzt.y;
+ y = (double *) ((void *) ( ((char *) y) + sy));
}
if (nz > 1) {
- *z = coord.xyzt.z;
- z = (double *) ( ((char *) z) + sz);
+ *z = coord.xyzt.z;
+ z = (double *) ((void *) ( ((char *) z) + sz));
}
if (nt > 1) {
- *t = coord.xyzt.t;
- t = (double *) ( ((char *) t) + st);
+ *t = coord.xyzt.t;
+ t = (double *) ((void *) ( ((char *) t) + st));
}
}
+
/* Last time around, we update the length 1 cases with their transformed alter egos */
- /* ... or would we rather not? Then what about the nmin==1 case? */
- /* perhaps signalling the non-array case by setting all strides to 0? */
if (nx==1)
*x = coord.xyzt.x;
if (ny==1)
diff --git a/src/proj_internal.h b/src/proj_internal.h
index 2d6a2406..95f34994 100644
--- a/src/proj_internal.h
+++ b/src/proj_internal.h
@@ -55,7 +55,13 @@ extern "C" {
#define PJ_TORAD(deg) ((deg)*M_PI/180.0)
#endif
-
+/* This enum is also conditionally defined in projects.h - but we need it here */
+/* for the pj_left/right prototypes, and enums cannot be forward declared */
+enum pj_io_units {
+ PJ_IO_UNITS_CLASSIC = 0, /* Scaled meters (right) */
+ PJ_IO_UNITS_METERS = 1, /* Meters */
+ PJ_IO_UNITS_RADIANS = 2 /* Radians */
+};
enum pj_io_units pj_left (PJ *P);
enum pj_io_units pj_right (PJ *P);
diff --git a/src/projects.h b/src/projects.h
index fad5c7bc..a43826d2 100644
--- a/src/projects.h
+++ b/src/projects.h
@@ -182,11 +182,13 @@ struct FACTORS;
struct PJ_REGION_S;
typedef struct PJ_REGION_S PJ_Region;
typedef struct ARG_list paralist; /* parameter list */
+#ifndef PROJ_INTERNAL_H
enum pj_io_units {
PJ_IO_UNITS_CLASSIC = 0, /* Scaled meters (right) */
PJ_IO_UNITS_METERS = 1, /* Meters */
PJ_IO_UNITS_RADIANS = 2 /* Radians */
};
+#endif
#ifndef PROJ_H
typedef struct PJconsts PJ; /* the PJ object herself */
typedef union PJ_COORD PJ_COORD;