diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2017-02-26 00:22:03 +0100 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2017-02-26 11:25:14 +0100 |
| commit | 66e04bf4e5cdb27a44e9bea6bacad22c02df2f0d (patch) | |
| tree | f148438285557a491088b4042a1dfab80f80d577 | |
| parent | b288ee6bbc345baf2ef56aaec49184c34a6cd0dd (diff) | |
| download | PROJ-66e04bf4e5cdb27a44e9bea6bacad22c02df2f0d.tar.gz PROJ-66e04bf4e5cdb27a44e9bea6bacad22c02df2f0d.zip | |
Fix warnings related to -Wshadow -Wnull-dereference -Wfloat-conversionr -Wmissing-prototypes -Wmissing-declarations
| -rw-r--r-- | src/PJ_healpix.c | 11 | ||||
| -rw-r--r-- | src/PJ_horner.c | 4 | ||||
| -rw-r--r-- | src/PJ_isea.c | 17 | ||||
| -rw-r--r-- | src/PJ_qsc.c | 2 | ||||
| -rw-r--r-- | src/PJ_robin.c | 82 | ||||
| -rw-r--r-- | src/cs2cs.c | 9 | ||||
| -rw-r--r-- | src/emess.h | 3 | ||||
| -rw-r--r-- | src/gen_cheb.c | 9 | ||||
| -rw-r--r-- | src/nad2bin.c | 14 | ||||
| -rw-r--r-- | src/nad_intr.c | 4 | ||||
| -rw-r--r-- | src/p_series.c | 7 | ||||
| -rw-r--r-- | src/pj_apply_gridshift.c | 2 | ||||
| -rw-r--r-- | src/pj_fileapi.c | 2 | ||||
| -rw-r--r-- | src/pj_gridinfo.c | 8 | ||||
| -rw-r--r-- | src/pj_log.c | 1 | ||||
| -rw-r--r-- | src/pj_malloc.c | 2 | ||||
| -rw-r--r-- | src/pj_obs_api.c | 8 | ||||
| -rw-r--r-- | src/pj_transform.c | 4 | ||||
| -rw-r--r-- | src/proj.c | 7 | ||||
| -rw-r--r-- | src/proj_api.h | 2 | ||||
| -rw-r--r-- | src/projects.h | 2 | ||||
| -rw-r--r-- | src/rtodms.c | 6 |
22 files changed, 115 insertions, 91 deletions
diff --git a/src/PJ_healpix.c b/src/PJ_healpix.c index 781fbb7a..fc2122c5 100644 --- a/src/PJ_healpix.c +++ b/src/PJ_healpix.c @@ -68,7 +68,7 @@ double rot[7][2][2] = ROT; * @param v the parameter whose sign is returned. * @return 1 for positive number, -1 for negative, and 0 for zero. **/ -double pj_sign (double v) { +static double pj_sign (double v) { return v > 0 ? 1 : (v < 0 ? -1 : 0); } @@ -152,7 +152,8 @@ static int pnpoly(int nvert, double vert[][2], double testx, double testy) { * @param north_square the position of the north polar square (rHEALPix only) * @param south_square the position of the south polar square (rHEALPix only) **/ -int in_image(double x, double y, int proj, int north_square, int south_square) { +static int in_image(double x, double y, int proj, int north_square, + int south_square) { if (proj == 0) { double healpixVertsJit[][2] = { {-M_PI - EPS, M_FORTPI}, @@ -223,7 +224,7 @@ int in_image(double x, double y, int proj, int north_square, int south_square) { * return the approximate latitude of authalic latitude alpha (if inverse=1). * P contains the relevant ellipsoid parameters. **/ -double auth_lat(PJ *P, double alpha, int inverse) { +static double auth_lat(PJ *P, double alpha, int inverse) { struct pj_opaque *Q = P->opaque; if (inverse == 0) { /* Authalic latitude. */ @@ -247,7 +248,7 @@ double auth_lat(PJ *P, double alpha, int inverse) { * Return the HEALPix projection of the longitude-latitude point lp on * the unit sphere. **/ -XY healpix_sphere(LP lp) { +static XY healpix_sphere(LP lp) { double lam = lp.lam; double phi = lp.phi; double phi0 = asin(2.0/3.0); @@ -275,7 +276,7 @@ XY healpix_sphere(LP lp) { /** * Return the inverse of healpix_sphere(). **/ -LP healpix_sphere_inverse(XY xy) { +static LP healpix_sphere_inverse(XY xy) { LP lp; double x = xy.x; double y = xy.y; diff --git a/src/PJ_horner.c b/src/PJ_horner.c index 08b64ab9..3dde29c8 100644 --- a/src/PJ_horner.c +++ b/src/PJ_horner.c @@ -451,6 +451,10 @@ PJ *PROJECTION(horner) { complex_horner = 1; Q = horner_alloc (degree, complex_horner); + if (Q == 0) + { + return horner_freeup (P); + } P->opaque = (void *) Q; if (complex_horner) { diff --git a/src/PJ_isea.c b/src/PJ_isea.c index ab9a5a8c..cd87d565 100644 --- a/src/PJ_isea.c +++ b/src/PJ_isea.c @@ -75,9 +75,12 @@ int hexbin2(double width, double x, double y, z = -x - y; - ix = rx = floor(x + 0.5); - iy = ry = floor(y + 0.5); - iz = rz = floor(z + 0.5); + rx = floor(x + 0.5); + ix = (int)rx; + ry = floor(y + 0.5); + iy = (int)ry; + rz = floor(z + 0.5); + iz = (int)rz; s = ix + iy + iz; @@ -126,7 +129,7 @@ struct isea_dgg { int triangle; /* triangle of last transformed point */ int quad; /* quad of last transformed point */ unsigned long serial; -};
+}; struct isea_pt { double x, y; @@ -892,7 +895,7 @@ int isea_disn(struct isea_dgg *g, int quad, struct isea_pt *di) { sn += 2; } else { sidelength = (int) (pow(g->aperture, g->resolution / 2.0) + 0.5); - sn = (quad - 1) * hexes + sidelength * di->x + di->y + 2; + sn = (int) ((quad - 1) * hexes + sidelength * di->x + di->y + 2); } g->serial = sn; @@ -918,8 +921,8 @@ int isea_hex(struct isea_dgg *g, int tri, return 1; - d = v.x; - i = v.y; + d = (int)v.x; + i = (int)v.y; /* Aperture 3 odd resolutions */ if (g->aperture == 3 && g->resolution % 2 != 0) { diff --git a/src/PJ_qsc.c b/src/PJ_qsc.c index 5881290b..faf60114 100644 --- a/src/PJ_qsc.c +++ b/src/PJ_qsc.c @@ -292,7 +292,7 @@ static LP e_inverse (XY xy, PJ *P) { /* Ellipsoidal, inverse */ } } else { /* Compute phi and lam via cartesian unit sphere coordinates. */ - double q, r, s, t; + double q, r, s; q = cosphi; t = q * q; if (t >= 1.0) { diff --git a/src/PJ_robin.c b/src/PJ_robin.c index 8f6371e7..93330072 100644 --- a/src/PJ_robin.c +++ b/src/PJ_robin.c @@ -20,47 +20,47 @@ struct COEFS { }; static const struct COEFS X[] = { - {1, 2.2199e-17, -7.15515e-05, 3.1103e-06}, - {0.9986, -0.000482243, -2.4897e-05, -1.3309e-06}, - {0.9954, -0.00083103, -4.48605e-05, -9.86701e-07}, - {0.99, -0.00135364, -5.9661e-05, 3.6777e-06}, - {0.9822, -0.00167442, -4.49547e-06, -5.72411e-06}, - {0.973, -0.00214868, -9.03571e-05, 1.8736e-08}, - {0.96, -0.00305085, -9.00761e-05, 1.64917e-06}, - {0.9427, -0.00382792, -6.53386e-05, -2.6154e-06}, - {0.9216, -0.00467746, -0.00010457, 4.81243e-06}, - {0.8962, -0.00536223, -3.23831e-05, -5.43432e-06}, - {0.8679, -0.00609363, -0.000113898, 3.32484e-06}, - {0.835, -0.00698325, -6.40253e-05, 9.34959e-07}, - {0.7986, -0.00755338, -5.00009e-05, 9.35324e-07}, - {0.7597, -0.00798324, -3.5971e-05, -2.27626e-06}, - {0.7186, -0.00851367, -7.01149e-05, -8.6303e-06}, - {0.6732, -0.00986209, -0.000199569, 1.91974e-05}, - {0.6213, -0.010418, 8.83923e-05, 6.24051e-06}, - {0.5722, -0.00906601, 0.000182, 6.24051e-06}, - {0.5322, -0.00677797, 0.000275608, 6.24051e-06} + {1.0f, 2.2199e-17f, -7.15515e-05f, 3.1103e-06f}, + {0.9986f, -0.000482243f, -2.4897e-05f, -1.3309e-06f}, + {0.9954f, -0.00083103f, -4.48605e-05f, -9.86701e-07f}, + {0.99f, -0.00135364f, -5.9661e-05f, 3.6777e-06f}, + {0.9822f, -0.00167442f, -4.49547e-06f, -5.72411e-06f}, + {0.973f, -0.00214868f, -9.03571e-05f, 1.8736e-08f}, + {0.96f, -0.00305085f, -9.00761e-05f, 1.64917e-06f}, + {0.9427f, -0.00382792f, -6.53386e-05f, -2.6154e-06f}, + {0.9216f, -0.00467746f, -0.00010457f, 4.81243e-06f}, + {0.8962f, -0.00536223f, -3.23831e-05f, -5.43432e-06f}, + {0.8679f, -0.00609363f, -0.000113898f, 3.32484e-06f}, + {0.835f, -0.00698325f, -6.40253e-05f, 9.34959e-07f}, + {0.7986f, -0.00755338f, -5.00009e-05f, 9.35324e-07f}, + {0.7597f, -0.00798324f, -3.5971e-05f, -2.27626e-06f}, + {0.7186f, -0.00851367f, -7.01149e-05f, -8.6303e-06f}, + {0.6732f, -0.00986209f, -0.000199569f, 1.91974e-05f}, + {0.6213f, -0.010418f, 8.83923e-05f, 6.24051e-06f}, + {0.5722f, -0.00906601f, 0.000182f, 6.24051e-06f}, + {0.5322f, -0.00677797f, 0.000275608f, 6.24051e-06f} }; static const struct COEFS Y[] = { - {-5.20417e-18, 0.0124, 1.21431e-18, -8.45284e-11}, - {0.062, 0.0124, -1.26793e-09, 4.22642e-10}, - {0.124, 0.0124, 5.07171e-09, -1.60604e-09}, - {0.186, 0.0123999, -1.90189e-08, 6.00152e-09}, - {0.248, 0.0124002, 7.10039e-08, -2.24e-08}, - {0.31, 0.0123992, -2.64997e-07, 8.35986e-08}, - {0.372, 0.0124029, 9.88983e-07, -3.11994e-07}, - {0.434, 0.0123893, -3.69093e-06, -4.35621e-07}, - {0.4958, 0.0123198, -1.02252e-05, -3.45523e-07}, - {0.5571, 0.0121916, -1.54081e-05, -5.82288e-07}, - {0.6176, 0.0119938, -2.41424e-05, -5.25327e-07}, - {0.6769, 0.011713, -3.20223e-05, -5.16405e-07}, - {0.7346, 0.0113541, -3.97684e-05, -6.09052e-07}, - {0.7903, 0.0109107, -4.89042e-05, -1.04739e-06}, - {0.8435, 0.0103431, -6.4615e-05, -1.40374e-09}, - {0.8936, 0.00969686, -6.4636e-05, -8.547e-06}, - {0.9394, 0.00840947, -0.000192841, -4.2106e-06}, - {0.9761, 0.00616527, -0.000256, -4.2106e-06}, - {1, 0.00328947, -0.000319159, -4.2106e-06} + {-5.20417e-18f, 0.0124f, 1.21431e-18f, -8.45284e-11f}, + {0.062f, 0.0124f, -1.26793e-09f, 4.22642e-10f}, + {0.124f, 0.0124f, 5.07171e-09f, -1.60604e-09f}, + {0.186f, 0.0123999f, -1.90189e-08f, 6.00152e-09f}, + {0.248f, 0.0124002f, 7.10039e-08f, -2.24e-08f}, + {0.31f, 0.0123992f, -2.64997e-07f, 8.35986e-08f}, + {0.372f, 0.0124029f, 9.88983e-07f, -3.11994e-07f}, + {0.434f, 0.0123893f, -3.69093e-06f, -4.35621e-07f}, + {0.4958f, 0.0123198f, -1.02252e-05f, -3.45523e-07f}, + {0.5571f, 0.0121916f, -1.54081e-05f, -5.82288e-07f}, + {0.6176f, 0.0119938f, -2.41424e-05f, -5.25327e-07f}, + {0.6769f, 0.011713f, -3.20223e-05f, -5.16405e-07f}, + {0.7346f, 0.0113541f, -3.97684e-05f, -6.09052e-07f}, + {0.7903f, 0.0109107f, -4.89042e-05f, -1.04739e-06f}, + {0.8435f, 0.0103431f, -6.4615e-05f, -1.40374e-09f}, + {0.8936f, 0.00969686f, -6.4636e-05f, -8.547e-06f}, + {0.9394f, 0.00840947f, -0.000192841f, -4.2106e-06f}, + {0.9761f, 0.00616527f, -0.000256f, -4.2106e-06f}, + {1.0f, 0.00328947f, -0.000319159f, -4.2106e-06f} }; #define FXC 0.8487 @@ -78,7 +78,7 @@ static XY s_forward (LP lp, PJ *P) { /* Spheroidal, forward */ double dphi; (void) P; - i = floor((dphi = fabs(lp.phi)) * C1); + i = (int)floor((dphi = fabs(lp.phi)) * C1); if( i < 0 ) F_ERROR; if (i >= NODES) i = NODES - 1; @@ -107,7 +107,7 @@ static LP s_inverse (XY xy, PJ *P) { /* Spheroidal, inverse */ } } else { /* general problem */ /* in Y space, reduce to table interval */ - i = floor(lp.phi * NODES); + i = (int)floor(lp.phi * NODES); if( i < 0 || i >= NODES ) I_ERROR; for (;;) { @@ -119,7 +119,7 @@ static LP s_inverse (XY xy, PJ *P) { /* Spheroidal, inverse */ /* first guess, linear interp */ t = 5. * (lp.phi - T.c0)/(Y[i+1].c0 - T.c0); /* make into root */ - T.c0 -= lp.phi; + T.c0 = (float)(T.c0 - lp.phi); for (;;) { /* Newton-Raphson reduction */ t -= t1 = V(T,t) / DV(T,t); if (fabs(t1) < EPS) diff --git a/src/cs2cs.c b/src/cs2cs.c index 83e2d3f0..ac72b0a0 100644 --- a/src/cs2cs.c +++ b/src/cs2cs.c @@ -166,7 +166,7 @@ int main(int argc, char **argv) { char *arg, **eargv = argv, *from_argv[MAX_PARGS], *to_argv[MAX_PARGS]; FILE *fid; - int from_argc=0, to_argc=0, eargc = 0, c, mon = 0; + int from_argc=0, to_argc=0, eargc = 0, mon = 0; int have_to_flag = 0, inverse = 0, i; int use_env_locale = 0; @@ -271,12 +271,15 @@ int main(int argc, char **argv) continue; case 'W': /* specify seconds precision */ case 'w': /* -W for constant field width */ - if ((c = arg[1]) != 0 && isdigit(c)) { + { + char c = arg[1]; + if (c != 0 && isdigit(c)) { set_rtodms(c - '0', *arg == 'W'); ++arg; } else emess(1,"-W argument missing or non-digit"); continue; + } case 'f': /* alternate output format degrees or xy */ if (--argc <= 0) goto noargument; oform = *++argv; @@ -331,8 +334,6 @@ int main(int argc, char **argv) for( i = 0; i < MAX_PARGS; i++ ) { - char *arg; - arg = from_argv[i]; from_argv[i] = to_argv[i]; to_argv[i] = arg; diff --git a/src/emess.h b/src/emess.h index b8203246..b694d61e 100644 --- a/src/emess.h +++ b/src/emess.h @@ -21,8 +21,9 @@ extern char *sys_errlist[]; #else /* for for calling procedures */ extern struct EMESS emess_dat; -void emess(int, char *, ...); #endif /* use type */ +void emess(int, char *, ...); + #endif /* end EMESS_H */ diff --git a/src/gen_cheb.c b/src/gen_cheb.c index b7c41d82..6422afc9 100644 --- a/src/gen_cheb.c +++ b/src/gen_cheb.c @@ -8,8 +8,13 @@ #ifndef COEF_LINE_MAX #define COEF_LINE_MAX 60 #endif - void -gen_cheb(int inverse, projUV (*proj)(projUV), char *s, PJ *P, int iargc, char **iargv) { + +/* FIXME: put the declaration in a header. Also used in proj.c */ +void gen_cheb(int inverse, projUV (*proj)(projUV), char *s, PJ *P, + int iargc, char **iargv); + +void gen_cheb(int inverse, projUV (*proj)(projUV), char *s, PJ *P, + int iargc, char **iargv) { int NU = 15, NV = 15, res = -1, errin = 0, pwr; char *arg, fmt[15]; projUV low, upp, resid; diff --git a/src/nad2bin.c b/src/nad2bin.c index 59ec1658..859134e6 100644 --- a/src/nad2bin.c +++ b/src/nad2bin.c @@ -127,16 +127,16 @@ int main(int argc, char **argv) { fprintf(stderr,"format check on row\n"); exit(1); } - t.lam = laml * U_SEC_TO_RAD; - t.phi = phil * U_SEC_TO_RAD; + t.lam = (float) (laml * U_SEC_TO_RAD); + t.phi = (float) (phil * U_SEC_TO_RAD); *p++ = t; for (j = 1; j < ct.lim.lam; ++j) { if ( EOF == scanf("%ld %ld", &lam, &phi) ) { perror("scanf on column"); exit(1); } - t.lam = (laml += lam) * U_SEC_TO_RAD; - t.phi = (phil += phi) * U_SEC_TO_RAD; + t.lam = (float) ((laml += lam) * U_SEC_TO_RAD); + t.phi = (float) ((phil += phi) * U_SEC_TO_RAD); *p++ = t; } } @@ -342,16 +342,14 @@ int main(int argc, char **argv) { for( row = 0; row < ct.lim.phi; row++ ) { - int i; - for( i = 0; i < ct.lim.lam; i++ ) { FLP *cvs = ct.cvs + (row) * ct.lim.lam + (ct.lim.lam - i - 1); /* convert radians to seconds */ - row_buf[i*4+0] = cvs->phi * (3600.0 / (M_PI/180.0)); - row_buf[i*4+1] = cvs->lam * (3600.0 / (M_PI/180.0)); + row_buf[i*4+0] = (float) (cvs->phi * (3600.0 / (M_PI/180.0))); + row_buf[i*4+1] = (float) (cvs->lam * (3600.0 / (M_PI/180.0))); /* We leave the accuracy values as zero */ } diff --git a/src/nad_intr.c b/src/nad_intr.c index 299f1806..37b628b5 100644 --- a/src/nad_intr.c +++ b/src/nad_intr.c @@ -10,8 +10,8 @@ nad_intr(LP t, struct CTABLE *ct) { long index; int in; - indx.lam = floor(t.lam /= ct->del.lam); - indx.phi = floor(t.phi /= ct->del.phi); + indx.lam = (int)floor(t.lam /= ct->del.lam); + indx.phi = (int)floor(t.phi /= ct->del.phi); frct.lam = t.lam - indx.lam; frct.phi = t.phi - indx.phi; val.lam = val.phi = HUGE_VAL; diff --git a/src/p_series.c b/src/p_series.c index 7499ab49..cddea888 100644 --- a/src/p_series.c +++ b/src/p_series.c @@ -4,8 +4,11 @@ #include <string.h> #define NF 20 /* length of final format string */ #define CUT 60 /* check length of line */ - void -p_series(Tseries *T, FILE *file, char *fmt) { + +/* FIXME: put the declaration in a header. Also used in gen_cheb.c */ +void p_series(Tseries *T, FILE *file, char *fmt); + +void p_series(Tseries *T, FILE *file, char *fmt) { int i, j, n, L; char format[NF+1]; diff --git a/src/pj_apply_gridshift.c b/src/pj_apply_gridshift.c index 40fe7cdc..91e2de26 100644 --- a/src/pj_apply_gridshift.c +++ b/src/pj_apply_gridshift.c @@ -162,7 +162,7 @@ int pj_apply_gridshift_3( projCtx ctx, PJ_GRIDINFO **tables, int grid_count, for( child = gi->child; child != NULL; child = child->next ) { struct CTABLE *ct1 = child->ct; - double epsilon = + epsilon = (fabs(ct1->del.phi)+fabs(ct1->del.lam))/10000.0; if( ct1->ll.phi - epsilon > input.phi diff --git a/src/pj_fileapi.c b/src/pj_fileapi.c index fa35f30a..1e5bfa51 100644 --- a/src/pj_fileapi.c +++ b/src/pj_fileapi.c @@ -54,7 +54,7 @@ typedef struct { /* pj_get_default_fileapi() */ /************************************************************************/ -projFileAPI *pj_get_default_fileapi() +projFileAPI *pj_get_default_fileapi(void) { return &default_fileapi; } diff --git a/src/pj_gridinfo.c b/src/pj_gridinfo.c index 5f528de1..d54aadce 100644 --- a/src/pj_gridinfo.c +++ b/src/pj_gridinfo.c @@ -244,8 +244,8 @@ int pj_gridinfo_load( projCtx ctx, PJ_GRIDINFO *gi ) cvs = ct_tmp.cvs + (row) * gi->ct->lim.lam + (gi->ct->lim.lam - i - 1); - cvs->phi = *(diff_seconds++) * ((M_PI/180.0) / 3600.0); - cvs->lam = *(diff_seconds++) * ((M_PI/180.0) / 3600.0); + cvs->phi = (float) (*(diff_seconds++) * ((M_PI/180.0) / 3600.0)); + cvs->lam = (float) (*(diff_seconds++) * ((M_PI/180.0) / 3600.0)); } } @@ -324,8 +324,8 @@ int pj_gridinfo_load( projCtx ctx, PJ_GRIDINFO *gi ) cvs = ct_tmp.cvs + (row) * gi->ct->lim.lam + (gi->ct->lim.lam - i - 1); - cvs->phi = *(diff_seconds++) * ((M_PI/180.0) / 3600.0); - cvs->lam = *(diff_seconds++) * ((M_PI/180.0) / 3600.0); + cvs->phi = (float) (*(diff_seconds++) * ((M_PI/180.0) / 3600.0)); + cvs->lam = (float) (*(diff_seconds++) * ((M_PI/180.0) / 3600.0)); diff_seconds += 2; /* skip accuracy values */ } } diff --git a/src/pj_log.c b/src/pj_log.c index 0c711e52..5b59e7a5 100644 --- a/src/pj_log.c +++ b/src/pj_log.c @@ -25,6 +25,7 @@ * DEALINGS IN THE SOFTWARE. *****************************************************************************/ +#include "proj.h" #include <projects.h> #include <string.h> #include <stdarg.h> diff --git a/src/pj_malloc.c b/src/pj_malloc.c index b9d8f825..9dd4e405 100644 --- a/src/pj_malloc.c +++ b/src/pj_malloc.c @@ -115,7 +115,7 @@ pointer" to signal an error in a multi level allocation: /*****************************************************************************/ -void *pj_freeup_msg_plain (PJ *P, int errlev) { /* Destructor */ +static void *pj_freeup_msg_plain (PJ *P, int errlev) { /* Destructor */ /***************************************************************************** Does memory deallocation for "plain" PJ objects, i.e. that vast majority of PJs where the opaque object does not contain any additionally diff --git a/src/pj_obs_api.c b/src/pj_obs_api.c index 4a6e98a5..37e55bc3 100644 --- a/src/pj_obs_api.c +++ b/src/pj_obs_api.c @@ -71,13 +71,13 @@ double pj_xyz_dist (XYZ a, XYZ b) { /* Work around non-constness of MSVC HUGE_VAL by providing functions rather than constants */ -PJ_COORD pj_coo_error (void) { +static PJ_COORD pj_coo_error (void) { PJ_COORD c; c.v[0] = c.v[1] = c.v[2] = c.v[3] = HUGE_VAL; return c; } -PJ_OBS pj_obs_error (void) { +static PJ_OBS pj_obs_error (void) { PJ_OBS obs; obs.coo = pj_coo_error (); obs.anc.v[0] = obs.anc.v[1] = obs.anc.v[2] = HUGE_VAL; @@ -87,7 +87,7 @@ PJ_OBS pj_obs_error (void) { -PJ_OBS pj_fwdobs (PJ_OBS obs, PJ *P) { +static PJ_OBS pj_fwdobs (PJ_OBS obs, PJ *P) { if (0!=P->fwdobs) { obs = P->fwdobs (obs, P); return obs; @@ -105,7 +105,7 @@ PJ_OBS pj_fwdobs (PJ_OBS obs, PJ *P) { } -PJ_OBS pj_invobs (PJ_OBS obs, PJ *P) { +static PJ_OBS pj_invobs (PJ_OBS obs, PJ *P) { if (0!=P->invobs) { obs = P->invobs (obs, P); return obs; diff --git a/src/pj_transform.c b/src/pj_transform.c index 26a22ab9..86e0e70f 100644 --- a/src/pj_transform.c +++ b/src/pj_transform.c @@ -85,7 +85,6 @@ int pj_transform( PJ *srcdefn, PJ *dstdefn, long point_count, int point_offset, { long i; - int err; srcdefn->ctx->last_errno = 0; dstdefn->ctx->last_errno = 0; @@ -121,6 +120,7 @@ int pj_transform( PJ *srcdefn, PJ *dstdefn, long point_count, int point_offset, /* -------------------------------------------------------------------- */ if( srcdefn->is_geocent ) { + int err; if( z == NULL ) { pj_ctx_set_errno( pj_get_ctx(srcdefn), PJD_ERR_GEOCENTRIC); @@ -588,6 +588,7 @@ int pj_compare_datums( PJ *srcdefn, PJ *dstdefn ) /* pj_geocentic_to_wgs84() */ /************************************************************************/ +static int pj_geocentric_to_wgs84( PJ *defn, long point_count, int point_offset, double *x, double *y, double *z ) @@ -636,6 +637,7 @@ int pj_geocentric_to_wgs84( PJ *defn, /* pj_geocentic_from_wgs84() */ /************************************************************************/ +static int pj_geocentric_from_wgs84( PJ *defn, long point_count, int point_offset, double *x, double *y, double *z ) @@ -247,7 +247,7 @@ vprocess(FILE *fid) { int main(int argc, char **argv) { char *arg, **eargv = argv, *pargv[MAX_PARGS], **iargv = argv; FILE *fid; - int pargc = 0, iargc = argc, eargc = 0, c, mon = 0; + int pargc = 0, iargc = argc, eargc = 0, mon = 0; if ( (emess_dat.Prog_name = strrchr(*argv,DIR_CHAR)) != NULL) ++emess_dat.Prog_name; @@ -381,12 +381,15 @@ int main(int argc, char **argv) { continue; case 'W': /* specify seconds precision */ case 'w': /* -W for constant field width */ - if ((c = arg[1]) != 0 && isdigit(c)) { + { + int c = arg[1]; + if (c != 0 && isdigit(c)) { set_rtodms(c - '0', *arg == 'W'); ++arg; } else emess(1,"-W argument missing or non-digit"); continue; + } case 'f': /* alternate output format degrees or xy */ if (--argc <= 0) goto noargument; oform = *++argv; diff --git a/src/proj_api.h b/src/proj_api.h index 863795f0..033c1282 100644 --- a/src/proj_api.h +++ b/src/proj_api.h @@ -192,7 +192,7 @@ void pj_log( projCtx ctx, int level, const char *fmt, ... ); void pj_stderr_logger( void *, int, const char * ); /* file api */ -projFileAPI *pj_get_default_fileapi(); +projFileAPI *pj_get_default_fileapi(void); PAFile pj_ctx_fopen(projCtx ctx, const char *filename, const char *access); size_t pj_ctx_fread(projCtx ctx, void *buffer, size_t size, size_t nmemb, PAFile file); diff --git a/src/projects.h b/src/projects.h index 33af9ca7..be10268c 100644 --- a/src/projects.h +++ b/src/projects.h @@ -512,6 +512,8 @@ extern struct PJ_PRIME_MERIDIANS pj_prime_meridians[]; #define PROJECTION(name) \ pj_projection_specific_setup_##name (PJ *P); \ C_NAMESPACE_VAR const char * const pj_s_##name = des_##name; \ +C_NAMESPACE PJ *pj_##name (PJ *P); \ +int pj_ ## name ## _selftest (void); \ C_NAMESPACE PJ *pj_##name (PJ *P) { \ if (P) \ return pj_projection_specific_setup_##name (P); \ diff --git a/src/rtodms.c b/src/rtodms.c index fa5c3cd1..5e88ca14 100644 --- a/src/rtodms.c +++ b/src/rtodms.c @@ -49,9 +49,9 @@ rtodms(char *s, double r, int pos, int neg) { r = floor(r * CONV + .5); sec = fmod(r / RES, 60.); r = floor(r / RES60); - min = fmod(r, 60.); - r = floor(r / 60.); - deg = r; + min = (int)fmod(r, 60.); + r = floor(r / 60.); + deg = (int)r; if (dolong) (void)sprintf(ss,format,deg,min,sec,sign); |
