diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2018-05-29 22:45:18 +0200 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2018-05-30 11:48:28 +0200 |
| commit | f773897a3025438326c1131e1586d9ddae080c4f (patch) | |
| tree | 989e9619ac1f1ad140298bef5327df3f2d417d92 /src/gie.c | |
| parent | e692e1567fb6117bd3e1380a80e10b72b7af3710 (diff) | |
| download | PROJ-f773897a3025438326c1131e1586d9ddae080c4f.tar.gz PROJ-f773897a3025438326c1131e1586d9ddae080c4f.zip | |
Fix warnings found by clang with new warning flags to be added in later commit
Fixes consist in:
- no use of comma operator for multi statement purpose
- avoid confusing comma in for loops first and third clauses
- avoid implicit long to int casts by storing to long, or explicit bound checking before cast
Diffstat (limited to 'src/gie.c')
| -rw-r--r-- | src/gie.c | 24 |
1 files changed, 17 insertions, 7 deletions
@@ -386,8 +386,11 @@ static int process_file (const char *fname) { T.op_ko = T.total_ko = 0; T.op_skip = T.total_skip = 0; - if (T.skip) - return proj_destroy (T.P), T.P = 0, 0; + if (T.skip) { + proj_destroy (T.P); + T.P = 0; + return 0; + } f = fopen (fname, "rt"); if (0==f) { @@ -404,8 +407,11 @@ static int process_file (const char *fname) { T.curr_file = fname; while (get_inp(F)) { - if (SKIP==dispatch (F->tag, F->args)) - return proj_destroy (T.P), T.P = 0, 0; + if (SKIP==dispatch (F->tag, F->args)) { + proj_destroy (T.P); + T.P = 0; + return 0; + } } fclose (f); @@ -639,7 +645,8 @@ static PJ_COORD torad_coord (PJ *P, PJ_DIRECTION dir, PJ_COORD a) { paralist *l = pj_param_exists (P->params, "axis"); if (l && dir==PJ_INV) axis = l->param + strlen ("axis="); - for (i = 0, n = strlen (axis); i < n; i++) + n = strlen (axis); + for (i = 0; i < n; i++) if (strchr ("news", axis[i])) a.v[i] = proj_torad (a.v[i]); return a; @@ -652,7 +659,8 @@ static PJ_COORD todeg_coord (PJ *P, PJ_DIRECTION dir, PJ_COORD a) { paralist *l = pj_param_exists (P->params, "axis"); if (l && dir==PJ_FWD) axis = l->param + strlen ("axis="); - for (i = 0, n = strlen (axis); i < n; i++) + n = strlen (axis); + for (i = 0; i < n; i++) if (strchr ("news", axis[i])) a.v[i] = proj_todeg (a.v[i]); return a; @@ -669,7 +677,8 @@ Attempt to interpret args as a PJ_COORD. const char *endp, *prev = args; PJ_COORD a = proj_coord (0,0,0,0); - for (i = 0, T.dimensions_given = 0; i < 4; i++, T.dimensions_given++) { + T.dimensions_given = 0; + for (i = 0; i < 4; i++) { double d = proj_strtod (prev, (char **) &endp); /* Break out if there were no more numerals */ @@ -678,6 +687,7 @@ Attempt to interpret args as a PJ_COORD. a.v[i] = d; prev = endp; + T.dimensions_given++; } return a; |
