Skip to content

Commit

Permalink
Merge fc7e28e into 0c2bf45
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronpuchert committed Dec 15, 2017
2 parents 0c2bf45 + fc7e28e commit 5252389
Show file tree
Hide file tree
Showing 34 changed files with 135 additions and 124 deletions.
10 changes: 5 additions & 5 deletions src/PJ_healpix.c
Expand Up @@ -64,7 +64,7 @@ typedef struct {
enum Region {north, south, equatorial} region;
} CapMap;

double rot[7][2][2] = ROT;
static const double rot[7][2][2] = ROT;

/**
* Returns the sign of the double.
Expand Down Expand Up @@ -310,7 +310,7 @@ static LP healpix_sphere_inverse(XY xy) {
* Return the vector sum a + b, where a and b are 2-dimensional vectors.
* @param ret holds a + b.
**/
static void vector_add(double a[2], double b[2], double *ret) {
static void vector_add(const double a[2], const double b[2], double *ret) {
int i;
for(i = 0; i < 2; i++) {
ret[i] = a[i] + b[i];
Expand All @@ -322,7 +322,7 @@ static void vector_add(double a[2], double b[2], double *ret) {
* Return the vector difference a - b, where a and b are 2-dimensional vectors.
* @param ret holds a - b.
**/
static void vector_sub(double a[2], double b[2], double*ret) {
static void vector_sub(const double a[2], const double b[2], double*ret) {
int i;
for(i = 0; i < 2; i++) {
ret[i] = a[i] - b[i];
Expand All @@ -335,7 +335,7 @@ static void vector_sub(double a[2], double b[2], double*ret) {
* b is a 2 x 1 matrix.
* @param ret holds a*b.
**/
static void dot_product(double a[2][2], double b[2], double *ret) {
static void dot_product(const double a[2][2], const double b[2], double *ret) {
int i, j;
int length = 2;
for(i = 0; i < length; i++) {
Expand Down Expand Up @@ -453,7 +453,7 @@ static XY combine_caps(double x, double y, int north_square, int south_square,
double vector[2];
double v_min_c[2];
double ret_dot[2];
double (*tmpRot)[2];
const double (*tmpRot)[2];
int pole = 0;

CapMap capmap = get_cap(x, y, north_square, south_square, inverse);
Expand Down
4 changes: 2 additions & 2 deletions src/PJ_isea.c
Expand Up @@ -159,7 +159,7 @@ struct snyder_constants {
};

/* TODO put these in radians to avoid a later conversion */
ISEA_STATIC
ISEA_STATIC const
struct snyder_constants constants[] = {
{23.80018260, 62.15458023, 60.0, 3.75, 1.033, 0.968, 5.09, 1.195, 1.0},
{20.07675127, 55.69063953, 54.0, 2.65, 1.030, 0.983, 3.59, 1.141, 1.027},
Expand Down Expand Up @@ -217,7 +217,7 @@ static int tri_v1[] = {0, 0, 0, 0, 0, 0, 6, 7, 8, 9, 10, 2, 3, 4, 5, 1, 11,
#define F_RAD 0.18871053072122403508

/* triangle Centers */
struct isea_geo icostriangles[] = {
static const struct isea_geo icostriangles[] = {
{0.0, 0.0},
{-DEG144, E_RAD},
{-DEG72, E_RAD},
Expand Down
16 changes: 8 additions & 8 deletions src/PJ_mod_ster.c
Expand Up @@ -12,7 +12,7 @@ PROJ_HEAD(gs50, "Mod. Stereographic of 50 U.S.") "\n\tAzi(mod)";
#define EPSLN 1e-12

struct pj_opaque {
COMPLEX *zcoeff; \
const COMPLEX *zcoeff; \
double cchio, schio; \
int n;
};
Expand Down Expand Up @@ -120,7 +120,7 @@ static PJ *setup(PJ *P) { /* general initialization */

/* Miller Oblated Stereographic */
PJ *PROJECTION(mil_os) {
static COMPLEX AB[] = {
static const COMPLEX AB[] = {
{0.924500, 0.},
{0., 0.},
{0.019430, 0.}
Expand All @@ -143,7 +143,7 @@ PJ *PROJECTION(mil_os) {

/* Lee Oblated Stereographic */
PJ *PROJECTION(lee_os) {
static COMPLEX AB[] = {
static const COMPLEX AB[] = {
{0.721316, 0.},
{0., 0.},
{-0.0088162, -0.00617325}
Expand All @@ -165,7 +165,7 @@ PJ *PROJECTION(lee_os) {


PJ *PROJECTION(gs48) {
static COMPLEX /* 48 United States */
static const COMPLEX /* 48 United States */
AB[] = {
{0.98879, 0.},
{0., 0.},
Expand All @@ -191,7 +191,7 @@ PJ *PROJECTION(gs48) {


PJ *PROJECTION(alsk) {
static COMPLEX ABe[] = { /* Alaska ellipsoid */
static const COMPLEX ABe[] = { /* Alaska ellipsoid */
{ .9945303, 0.},
{ .0052083, -.0027404},
{ .0072721, .0048181},
Expand All @@ -200,7 +200,7 @@ PJ *PROJECTION(alsk) {
{ .3582802, -.2884586},
};

static COMPLEX ABs[] = { /* Alaska sphere */
static const COMPLEX ABs[] = { /* Alaska sphere */
{ .9972523, 0.},
{ .0052513, -.0041175},
{ .0074606, .0048125},
Expand Down Expand Up @@ -231,7 +231,7 @@ PJ *PROJECTION(alsk) {


PJ *PROJECTION(gs50) {
static COMPLEX ABe[] = { /* GS50 ellipsoid */
static const COMPLEX ABe[] = { /* GS50 ellipsoid */
{ .9827497, 0.},
{ .0210669, .0053804},
{-.1031415, -.0571664},
Expand All @@ -244,7 +244,7 @@ PJ *PROJECTION(gs50) {
{-.0210072, .0834037}
};

static COMPLEX ABs[] = { /* GS50 sphere */
static const COMPLEX ABs[] = { /* GS50 sphere */
{ .9842990, 0.},
{ .0211642, .0037608},
{-.1036018, -.0575102},
Expand Down
17 changes: 9 additions & 8 deletions src/PJ_nzmg.c
Expand Up @@ -34,20 +34,20 @@ PROJ_HEAD(nzmg, "New Zealand Map Grid") "\n\tfixed Earth";
#define SEC5_TO_RAD 0.4848136811095359935899141023
#define RAD_TO_SEC5 2.062648062470963551564733573

static COMPLEX bf[] = {
static const COMPLEX bf[] = {
{ .7557853228, 0.0},
{ .249204646, 0.003371507},
{-.001541739, 0.041058560},
{-.10162907, 0.01727609},
{-.26623489, -0.36249218},
{-.6870983, -1.1651967} };

static double tphi[] = { 1.5627014243, .5185406398, -.03333098,
-.1052906, -.0368594, .007317,
.01220, .00394, -.0013 };
static const double tphi[] = { 1.5627014243, .5185406398, -.03333098,
-.1052906, -.0368594, .007317,
.01220, .00394, -.0013 };

static double tpsi[] = { .6399175073, -.1358797613, .063294409, -.02526853, .0117879,
-.0055161, .0026906, -.001333, .00067, -.00034 };
static const double tpsi[] = { .6399175073, -.1358797613, .063294409, -.02526853, .0117879,
-.0055161, .0026906, -.001333, .00067, -.00034 };

#define Nbf 5
#define Ntpsi 9
Expand All @@ -57,7 +57,7 @@ static double tpsi[] = { .6399175073, -.1358797613, .063294409, -.02526853, .011
static XY e_forward (LP lp, PJ *P) { /* Ellipsoidal, forward */
XY xy = {0.0,0.0};
COMPLEX p;
double *C;
const double *C;
int i;

lp.phi = (lp.phi - P->phi0) * RAD_TO_SEC5;
Expand All @@ -77,7 +77,8 @@ static LP e_inverse (XY xy, PJ *P) { /* Ellipsoidal, inverse */
LP lp = {0.0,0.0};
int nn, i;
COMPLEX p, f, fp, dp;
double den, *C;
double den;
const double *C;

p.r = xy.y;
p.i = xy.x;
Expand Down
4 changes: 2 additions & 2 deletions src/PJ_pipeline.c
Expand Up @@ -276,7 +276,7 @@ static size_t argc_params (paralist *params) {
}

/* Sentinel for argument list */
static char argv_sentinel[] = "step";
static char *argv_sentinel = "step";

/* turn paralist into argc/argv style argument list */
static char **argv_params (paralist *params, size_t argc) {
Expand Down Expand Up @@ -366,7 +366,7 @@ PJ *OPERATION(pipeline,0) {

/* Do some syntactical sanity checking */
for (i = 0; i < argc; i++) {
if (0==strcmp ("step", argv[i])) {
if (0==strcmp (argv_sentinel, argv[i])) {
if (-1==i_pipeline) {
proj_log_error (P, "Pipeline: +step before +proj=pipeline");
return destructor (P, PJD_ERR_MALFORMED_PIPELINE);
Expand Down
2 changes: 1 addition & 1 deletion src/PJ_unitconvert.c
Expand Up @@ -256,7 +256,7 @@ static double mjd_to_yyyymmdd(double mjd) {
}


struct TIME_UNITS time_units[] = {
static const struct TIME_UNITS time_units[] = {
{"mjd", mjd_to_mjd, mjd_to_mjd, "Modified julian date"},
{"decimalyear", decimalyear_to_mjd, mjd_to_decimalyear, "Decimal year"},
{"gps_week", gps_week_to_mjd, mjd_to_gps_week, "GPS Week"},
Expand Down
23 changes: 12 additions & 11 deletions src/cs2cs.c
Expand Up @@ -26,6 +26,7 @@
* DEALINGS IN THE SOFTWARE.
*****************************************************************************/

#include "proj.h"
#include "projects.h"
#include <stdio.h>
#include <stdlib.h>
Expand Down Expand Up @@ -206,11 +207,11 @@ int main(int argc, char **argv)
case 'l': /* list projections, ellipses or units */
if (!arg[1] || arg[1] == 'p' || arg[1] == 'P') {
/* list projections */
struct PJ_LIST *lp;
const struct PJ_LIST *lp;
int do_long = arg[1] == 'P', c;
char *str;

for (lp = pj_get_list_ref() ; lp->id ; ++lp) {
for (lp = proj_list_operations() ; lp->id ; ++lp) {
(void)printf("%s : ", lp->id);
if (do_long) /* possibly multiline description */
(void)puts(*lp->descr);
Expand All @@ -222,28 +223,28 @@ int main(int argc, char **argv)
}
}
} else if (arg[1] == '=') { /* list projection 'descr' */
struct PJ_LIST *lp;
const struct PJ_LIST *lp;

arg += 2;
for (lp = pj_get_list_ref() ; lp->id ; ++lp)
for (lp = proj_list_operations() ; lp->id ; ++lp)
if (!strcmp(lp->id, arg)) {
(void)printf("%9s : %s\n", lp->id, *lp->descr);
break;
}
} else if (arg[1] == 'e') { /* list ellipses */
struct PJ_ELLPS *le;
const struct PJ_ELLPS *le;

for (le = pj_get_ellps_ref(); le->id ; ++le)
for (le = proj_list_ellps(); le->id ; ++le)
(void)printf("%9s %-16s %-16s %s\n",
le->id, le->major, le->ell, le->name);
} else if (arg[1] == 'u') { /* list units */
struct PJ_UNITS *lu;
const struct PJ_UNITS *lu;

for (lu = pj_get_units_ref(); lu->id ; ++lu)
for (lu = proj_list_units(); lu->id ; ++lu)
(void)printf("%12s %-20s %s\n",
lu->id, lu->to_meter, lu->name);
} else if (arg[1] == 'd') { /* list datums */
struct PJ_DATUMS *ld;
const struct PJ_DATUMS *ld;

printf("__datum_id__ __ellipse___ __definition/comments______________________________\n" );
for (ld = pj_get_datums_ref(); ld->id ; ++ld)
Expand All @@ -254,9 +255,9 @@ int main(int argc, char **argv)
printf( "%25s %s\n", " ", ld->comments );
}
} else if( arg[1] == 'm') { /* list prime meridians */
struct PJ_PRIME_MERIDIANS *lpm;
const struct PJ_PRIME_MERIDIANS *lpm;

for (lpm = pj_get_prime_meridians_ref(); lpm->id ; ++lpm)
for (lpm = proj_list_prime_meridians(); lpm->id ; ++lpm)
(void)printf("%12s %-30s\n",
lpm->id, lpm->defn);
} else
Expand Down
2 changes: 1 addition & 1 deletion src/emess.c
Expand Up @@ -18,7 +18,7 @@
#define EMESS_ROUTINE
#include "emess.h"
void
emess(int code, char *fmt, ...) {
emess(int code, const char *fmt, ...) {
va_list args;

va_start(args, fmt);
Expand Down
2 changes: 1 addition & 1 deletion src/emess.h
Expand Up @@ -24,6 +24,6 @@ extern struct EMESS emess_dat;

#endif /* use type */

void emess(int, char *, ...);
void emess(int, const char *, ...);

#endif /* end EMESS_H */
10 changes: 6 additions & 4 deletions src/geod.c
@@ -1,4 +1,6 @@
/* <<<< Geodesic filter program >>>> */

#include "proj.h"
# include "projects.h"
# include "geod_interface.h"
# include "emess.h"
Expand Down Expand Up @@ -175,15 +177,15 @@ noargument: emess(1,"missing argument for -%c",*arg);
continue;
case 'l':
if (!arg[1] || arg[1] == 'e') { /* list of ellipsoids */
struct PJ_ELLPS *le;
const struct PJ_ELLPS *le;

for (le=pj_get_ellps_ref(); le->id ; ++le)
for (le=proj_list_ellps(); le->id ; ++le)
(void)printf("%9s %-16s %-16s %s\n",
le->id, le->major, le->ell, le->name);
} else if (arg[1] == 'u') { /* list of units */
struct PJ_UNITS *lu;
const struct PJ_UNITS *lu;

for (lu = pj_get_units_ref();lu->id ; ++lu)
for (lu = proj_list_units();lu->id ; ++lu)
(void)printf("%12s %-20s %s\n",
lu->id, lu->to_meter, lu->name);
} else
Expand Down
3 changes: 2 additions & 1 deletion src/geod_set.c
Expand Up @@ -2,6 +2,7 @@
#define _IN_GEOD_SET

#include <string.h>
#include "proj.h"
#include "projects.h"
#include "geod_interface.h"
#include "emess.h"
Expand Down Expand Up @@ -29,7 +30,7 @@ geod_set(int argc, char **argv) {
/* set units */
if ((name = pj_param(NULL,start, "sunits").s) != NULL) {
char *s;
struct PJ_UNITS *unit_list = pj_get_units_ref();
const struct PJ_UNITS *unit_list = proj_list_units();
for (i = 0; (s = unit_list[i].id) && strcmp(name, s) ; ++i) ;
if (!s)
emess(1,"%s unknown unit conversion id", name);
Expand Down
6 changes: 3 additions & 3 deletions src/geodtest.c
Expand Up @@ -20,7 +20,7 @@
# pragma warning (disable: 4706)
#endif

double wgs84_a = 6378137, wgs84_f = 1/298.257223563; /* WGS84 */
static const double wgs84_a = 6378137, wgs84_f = 1/298.257223563; /* WGS84 */

static int assertEquals(double x, double y, double d) {
if (fabs(x - y) <= d)
Expand All @@ -29,8 +29,8 @@ static int assertEquals(double x, double y, double d) {
return 1;
}

const int ncases = 20;
double testcases[20][12] = {
static const int ncases = 20;
static const double testcases[20][12] = {
{35.60777, -139.44815, 111.098748429560326,
-11.17491, -69.95921, 129.289270889708762,
8935244.5604818305, 80.50729714281974, 6273170.2055303837,
Expand Down

0 comments on commit 5252389

Please sign in to comment.