diff options
| -rw-r--r-- | appveyor.yml | 3 | ||||
| -rw-r--r-- | src/PJ_aeqd.c | 2 | ||||
| -rw-r--r-- | src/PJ_bipc.c | 2 | ||||
| -rw-r--r-- | src/PJ_healpix.c | 11 | ||||
| -rw-r--r-- | src/PJ_helmert.c | 47 | ||||
| -rw-r--r-- | src/PJ_horner.c | 4 | ||||
| -rw-r--r-- | src/PJ_isea.c | 18 | ||||
| -rw-r--r-- | src/PJ_lsat.c | 2 | ||||
| -rw-r--r-- | src/PJ_misrsom.c | 2 | ||||
| -rw-r--r-- | src/PJ_mod_ster.c | 2 | ||||
| -rw-r--r-- | src/cs2cs.c | 2 | ||||
| -rw-r--r-- | src/gen_cheb.c | 2 | ||||
| -rw-r--r-- | src/geod.c | 2 | ||||
| -rw-r--r-- | src/nad2bin.c | 2 | ||||
| -rw-r--r-- | src/nad_init.c | 2 | ||||
| -rw-r--r-- | src/pj_factors.c | 5 | ||||
| -rw-r--r-- | src/pj_gridinfo.c | 26 | ||||
| -rw-r--r-- | src/pj_strerrno.c | 1 | ||||
| -rw-r--r-- | src/proj.c | 10 |
19 files changed, 96 insertions, 49 deletions
diff --git a/appveyor.yml b/appveyor.yml index a203949c..e1d23025 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -40,7 +40,8 @@ build_script: - if "%BUILD_TYPE%" == "cmake" if "%platform%" == "x64" SET VS_FULL=%VS_VERSION% Win64 - if "%BUILD_TYPE%" == "cmake" if "%platform%" == "x86" SET VS_FULL=%VS_VERSION% - if "%BUILD_TYPE%" == "cmake" echo "%VS_FULL%" - - if "%BUILD_TYPE%" == "cmake" cmake -G "%VS_FULL%" . -DSELFTEST=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE=../bin -DBUILD_LIBPROJ_SHARED=ON -DCMAKE_C_FLAGS="/W3 /WX /D_CRT_SECURE_NO_WARNINGS" +# warning C4706: assignment within conditional expression + - if "%BUILD_TYPE%" == "cmake" cmake -G "%VS_FULL%" . -DSELFTEST=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE=../bin -DBUILD_LIBPROJ_SHARED=ON -DCMAKE_C_FLAGS="/W4 /wd4706 /WX /D_CRT_SECURE_NO_WARNINGS" - if "%BUILD_TYPE%" == "cmake" cmake --build . --config Release test_script: diff --git a/src/PJ_aeqd.c b/src/PJ_aeqd.c index b10bfd62..225acfdd 100644 --- a/src/PJ_aeqd.c +++ b/src/PJ_aeqd.c @@ -153,7 +153,7 @@ oblcon: static LP e_guam_inv(XY xy, PJ *P) { /* Guam elliptical */ LP lp = {0.0,0.0}; struct pj_opaque *Q = P->opaque; - double x2, t; + double x2, t = 0.0; int i; x2 = 0.5 * xy.x * xy.x; diff --git a/src/PJ_bipc.c b/src/PJ_bipc.c index f370b4f9..2d015de1 100644 --- a/src/PJ_bipc.c +++ b/src/PJ_bipc.c @@ -94,7 +94,7 @@ static XY s_forward (LP lp, PJ *P) { /* Spheroidal, forward */ static LP s_inverse (XY xy, PJ *P) { /* Spheroidal, inverse */ LP lp = {0.0,0.0}; struct pj_opaque *Q = P->opaque; - double t, r, rp, rl, al, z, fAz, Az, s, c, Av; + double t, r, rp, rl, al, z = 0.0, fAz, Az, s, c, Av; int neg, i; if (Q->noskew) { diff --git a/src/PJ_healpix.c b/src/PJ_healpix.c index 1513d455..edd0d978 100644 --- a/src/PJ_healpix.c +++ b/src/PJ_healpix.c @@ -106,7 +106,7 @@ static int get_rotate_index(int index) { * @param vert the (x, y)-coordinates of the polygon's vertices **/ static int pnpoly(int nvert, double vert[][2], double testx, double testy) { - int i, c = 0; + int i; int counter = 0; double xinters; XY p1, p2; @@ -141,7 +141,6 @@ static int pnpoly(int nvert, double vert[][2], double testx, double testy) { } else { return 1; } - return c; } @@ -517,7 +516,9 @@ static XY e_healpix_forward(LP lp, PJ *P) { /* ellipsoid */ static LP s_healpix_inverse(XY xy, PJ *P) { /* sphere */ /* Check whether (x, y) lies in the HEALPix image */ if (in_image(xy.x, xy.y, 0, 0, 0) == 0) { - LP lp = {HUGE_VAL, HUGE_VAL}; + LP lp; + lp.lam = HUGE_VAL; + lp.phi = HUGE_VAL; pj_ctx_set_errno(P->ctx, -15); return lp; } @@ -563,7 +564,9 @@ static LP s_rhealpix_inverse(XY xy, PJ *P) { /* sphere */ /* Check whether (x, y) lies in the rHEALPix image. */ if (in_image(xy.x, xy.y, 1, Q->north_square, Q->south_square) == 0) { - LP lp = {HUGE_VAL, HUGE_VAL}; + LP lp; + lp.lam = HUGE_VAL; + lp.phi = HUGE_VAL; pj_ctx_set_errno(P->ctx, -15); return lp; } diff --git a/src/PJ_helmert.c b/src/PJ_helmert.c index 8ae0a785..af35582a 100644 --- a/src/PJ_helmert.c +++ b/src/PJ_helmert.c @@ -346,7 +346,7 @@ PJ *PROJECTION(helmert) { between the conventions. ***************************************************************************/ - do { + { double f, t, p; /* phi/fi , theta, psi */ double cf, ct, cp; /* cos (fi, theta, psi) */ double sf, st, sp; /* sin (fi, theta, psi) */ @@ -368,28 +368,29 @@ PJ *PROJECTION(helmert) { R20 = t; R21 = -f; R22 = 1; - break; } - - cf = cos(f); - sf = sin(f); - ct = cos(t); - st = sin(t); - cp = cos(p); - sp = sin(p); - - - R00 = ct*cp; - R01 = cf*sp + sf*st*cp; - R02 = sf*sp - cf*st*cp; - - R10 = -ct*sp; - R11 = cf*cp - sf*st*sp; - R12 = sf*cp + cf*st*sp; - - R20 = st; - R21 = -sf*ct; - R22 = cf*ct; + else { + cf = cos(f); + sf = sin(f); + ct = cos(t); + st = sin(t); + cp = cos(p); + sp = sin(p); + + + R00 = ct*cp; + R01 = cf*sp + sf*st*cp; + R02 = sf*sp - cf*st*cp; + + R10 = -ct*sp; + R11 = cf*cp - sf*st*sp; + R12 = sf*cp + cf*st*sp; + + R20 = st; + R21 = -sf*ct; + R22 = cf*ct; + } + } /* For comparison: Description from Engsager/Poder implementation @@ -417,8 +418,6 @@ PJ *PROJECTION(helmert) { trp->scale = 1.0 + scale; */ - } while (0); - if (transpose) { double r; diff --git a/src/PJ_horner.c b/src/PJ_horner.c index 4ee2e78a..1b055a4e 100644 --- a/src/PJ_horner.c +++ b/src/PJ_horner.c @@ -396,7 +396,7 @@ static void freeup (PJ *P) { static int parse_coefs (PJ *P, double *coefs, char *param, int ncoefs) { - char *buf, *init, *next; + char *buf, *init, *next = 0; int i; buf = pj_calloc (strlen (param) + 2, sizeof(char)); @@ -414,7 +414,7 @@ static int parse_coefs (PJ *P, double *coefs, char *param, int ncoefs) { for (i = 0; i < ncoefs; i++) { if (i > 0) { - if (','!=*next) { + if ( next == 0 || ','!=*next) { pj_log_error (P, "Horner: Malformed polynomium set %s. need %d coefs", param, ncoefs); return 0; } diff --git a/src/PJ_isea.c b/src/PJ_isea.c index cd87d565..6bc6a66c 100644 --- a/src/PJ_isea.c +++ b/src/PJ_isea.c @@ -317,6 +317,12 @@ sph_azimuth(double f_lon, double f_lat, double t_lon, double t_lat) return az; } +#ifdef _MSC_VER +#pragma warning( push ) +/* disable unreachable code warning for return 0 */ +#pragma warning( disable : 4702 ) +#endif + /* coord needs to be in radians */ ISEA_STATIC int @@ -491,6 +497,10 @@ isea_snyder_forward(struct isea_geo * ll, struct isea_pt * out) return 0; /* suppresses a warning */ } +#ifdef _MSC_VER +#pragma warning( pop ) +#endif + /* * return the new coordinates of any point in original coordinate system. * Define a point (newNPold) in original coordinate system as the North Pole in @@ -911,8 +921,11 @@ ISEA_STATIC int isea_hex(struct isea_dgg *g, int tri, struct isea_pt *pt, struct isea_pt *hex) { struct isea_pt v; +#ifdef FIXME int sidelength; - int d, i, x, y, quad; + int d, i, x, y; +#endif + int quad; quad = isea_ptdi(g, tri, pt, &v); @@ -920,7 +933,7 @@ int isea_hex(struct isea_dgg *g, int tri, hex->y = v.y; return 1; - +#ifdef FIXME d = (int)v.x; i = (int)v.y; @@ -964,6 +977,7 @@ int isea_hex(struct isea_dgg *g, int tri, } return 1; +#endif } ISEA_STATIC diff --git a/src/PJ_lsat.c b/src/PJ_lsat.c index a58bb3cb..665c0662 100644 --- a/src/PJ_lsat.c +++ b/src/PJ_lsat.c @@ -41,7 +41,7 @@ static XY e_forward (LP lp, PJ *P) { /* Ellipsoidal, forward */ XY xy = {0.0,0.0}; struct pj_opaque *Q = P->opaque; int l, nn; - double lamt, xlam, sdsq, c, d, s, lamdp, phidp, lampp, tanph; + double lamt = 0.0, xlam, sdsq, c, d, s, lamdp = 0.0, phidp, lampp, tanph; double lamtp, cl, sd, sp, fac, sav, tanphi; if (lp.phi > M_HALFPI) diff --git a/src/PJ_misrsom.c b/src/PJ_misrsom.c index 4d910b4a..358c036a 100644 --- a/src/PJ_misrsom.c +++ b/src/PJ_misrsom.c @@ -59,7 +59,7 @@ static XY e_forward (LP lp, PJ *P) { /* Ellipsoidal, forward */ XY xy = {0.0,0.0}; struct pj_opaque *Q = P->opaque; int l, nn; - double lamt, xlam, sdsq, c, d, s, lamdp, phidp, lampp, tanph; + double lamt = 0.0, xlam, sdsq, c, d, s, lamdp = 0.0, phidp, lampp, tanph; double lamtp, cl, sd, sp, fac, sav, tanphi; if (lp.phi > M_HALFPI) diff --git a/src/PJ_mod_ster.c b/src/PJ_mod_ster.c index d979b41e..bcf2bf9c 100644 --- a/src/PJ_mod_ster.c +++ b/src/PJ_mod_ster.c @@ -46,7 +46,7 @@ static LP e_inverse (XY xy, PJ *P) { /* Ellipsoidal, inverse */ struct pj_opaque *Q = P->opaque; int nn; COMPLEX p, fxy, fpxy, dp; - double den, rh, z, sinz, cosz, chi, phi, dphi, esphi; + double den, rh = 0.0, z, sinz = 0.0, cosz = 0.0, chi, phi = 0.0, dphi, esphi; p.r = xy.x; p.i = xy.y; diff --git a/src/cs2cs.c b/src/cs2cs.c index ac72b0a0..7afeea73 100644 --- a/src/cs2cs.c +++ b/src/cs2cs.c @@ -100,7 +100,7 @@ static void process(FILE *fid) if (!*s && (s > line)) --s; /* assumed we gobbled \n */ if ( echoin) { - int t; + char t; t = *s; *s = '\0'; (void)fputs(line, stdout); diff --git a/src/gen_cheb.c b/src/gen_cheb.c index 6422afc9..9b2d8cb3 100644 --- a/src/gen_cheb.c +++ b/src/gen_cheb.c @@ -12,6 +12,7 @@ /* 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); +extern void p_series(Tseries *, FILE *, char *); void gen_cheb(int inverse, projUV (*proj)(projUV), char *s, PJ *P, int iargc, char **iargv) { @@ -19,7 +20,6 @@ void gen_cheb(int inverse, projUV (*proj)(projUV), char *s, PJ *P, char *arg, fmt[15]; projUV low, upp, resid; Tseries *F; - extern void p_series(Tseries *, FILE *, char *); double (*input)(const char *, char **); input = inverse ? strtod : dmstor; @@ -127,7 +127,7 @@ static char *pargv[MAX_PARGS]; static int pargc = 0; int main(int argc, char **argv) { - char *arg, **eargv = argv, *strnchr(); + char *arg, **eargv = argv; FILE *fid; static int eargc = 0, c; diff --git a/src/nad2bin.c b/src/nad2bin.c index 859134e6..0001189c 100644 --- a/src/nad2bin.c +++ b/src/nad2bin.c @@ -28,7 +28,7 @@ static void swap_words( void *data_in, int word_size, int word_count ) for( i = 0; i < word_size/2; i++ ) { - int t; + unsigned char t; t = data[i]; data[i] = data[word_size-i-1]; diff --git a/src/nad_init.c b/src/nad_init.c index 14fa5226..a84b0387 100644 --- a/src/nad_init.c +++ b/src/nad_init.c @@ -63,7 +63,7 @@ static void swap_words( void *data_in, int word_size, int word_count ) for( i = 0; i < word_size/2; i++ ) { - int t; + unsigned char t; t = data[i]; data[i] = data[word_size-i-1]; diff --git a/src/pj_factors.c b/src/pj_factors.c index d959494e..b87b49ff 100644 --- a/src/pj_factors.c +++ b/src/pj_factors.c @@ -11,6 +11,11 @@ pj_factors(LP lp, PJ *P, double h, struct FACTORS *fac) { struct DERIVS der; double cosphi, t, n, r; + der.x_l = 0.0; + der.x_p = 0.0; + der.y_l = 0.0; + der.y_p = 0.0; + /* check for forward and latitude or longitude overange */ if ((t = fabs(lp.phi)-M_HALFPI) > EPS || fabs(lp.lam) > 10.) { pj_ctx_set_errno( P->ctx, -14); diff --git a/src/pj_gridinfo.c b/src/pj_gridinfo.c index d54aadce..458f0f2b 100644 --- a/src/pj_gridinfo.c +++ b/src/pj_gridinfo.c @@ -63,7 +63,7 @@ static void swap_words( unsigned char *data, int word_size, int word_count ) for( i = 0; i < word_size/2; i++ ) { - int t; + unsigned char t; t = data[i]; data[i] = data[word_size-i-1]; @@ -427,7 +427,15 @@ static int pj_gridinfo_init_ntv2( projCtx ctx, PAFile fid, PJ_GRIDINFO *gilist ) assert( sizeof(int) == 4 ); assert( sizeof(double) == 8 ); +#ifdef _MSC_VER +#pragma warning( push ) +/* disable conditional expression is constant */ +#pragma warning( disable : 4127 ) +#endif if( sizeof(int) != 4 || sizeof(double) != 8 ) +#ifdef _MSC_VER +#pragma warning( pop ) +#endif { pj_log( ctx, PJ_LOG_ERROR, "basic types of inappropraiate size in pj_gridinfo_init_ntv2()" ); @@ -640,7 +648,15 @@ static int pj_gridinfo_init_ntv1( projCtx ctx, PAFile fid, PJ_GRIDINFO *gi ) assert( sizeof(int) == 4 ); assert( sizeof(double) == 8 ); +#ifdef _MSC_VER +#pragma warning( push ) +/* disable conditional expression is constant */ +#pragma warning( disable : 4127 ) +#endif if( sizeof(int) != 4 || sizeof(double) != 8 ) +#ifdef _MSC_VER +#pragma warning( pop ) +#endif { pj_log( ctx, PJ_LOG_ERROR, "basic types of inappropraiate size in nad_load_ntv1()" ); @@ -728,7 +744,15 @@ static int pj_gridinfo_init_gtx( projCtx ctx, PAFile fid, PJ_GRIDINFO *gi ) assert( sizeof(int) == 4 ); assert( sizeof(double) == 8 ); +#ifdef _MSC_VER +#pragma warning( push ) +/* disable conditional expression is constant */ +#pragma warning( disable : 4127 ) +#endif if( sizeof(int) != 4 || sizeof(double) != 8 ) +#ifdef _MSC_VER +#pragma warning( pop ) +#endif { pj_log( ctx, PJ_LOG_ERROR, "basic types of inappropraiate size in nad_load_gtx()" ); diff --git a/src/pj_strerrno.c b/src/pj_strerrno.c index bef42882..8a2a9c4b 100644 --- a/src/pj_strerrno.c +++ b/src/pj_strerrno.c @@ -82,5 +82,4 @@ char *pj_strerrno(int err) { return note; } } - return 0; } @@ -20,6 +20,10 @@ #define MAX_LINE 1000 #define MAX_PARGS 100 #define PJ_INVERS(P) (P->inv ? 1 : 0) + +extern void gen_cheb(int, projUV(*)(projUV), char *, PJ *, int, char **); + + static PJ *Proj; static projUV @@ -58,7 +62,7 @@ int_proj(projUV data) { } static void /* file processing function */ process(FILE *fid) { - char line[MAX_LINE+3], *s, pline[40]; + char line[MAX_LINE+3], *s = 0, pline[40]; projUV data; for (;;) { @@ -91,7 +95,7 @@ process(FILE *fid) { data.u = HUGE_VAL; if (!*s && (s > line)) --s; /* assumed we gobbled \n */ if (!bin_out && echoin) { - int t; + char t; t = *s; *s = '\0'; (void)fputs(line, stdout); @@ -440,8 +444,6 @@ int main(int argc, char **argv) { } else proj = pj_fwd; if (cheby_str) { - extern void gen_cheb(int, projUV(*)(projUV), char *, PJ *, int, char **); - gen_cheb(inverse, int_proj, cheby_str, Proj, iargc, iargv); exit(0); } |
