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/pj_internal.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/pj_internal.c')
| -rw-r--r-- | src/pj_internal.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/pj_internal.c b/src/pj_internal.c index 58ea9b48..7eb917be 100644 --- a/src/pj_internal.c +++ b/src/pj_internal.c @@ -209,7 +209,9 @@ consuming their surrounding whitespace. n = strlen (c); /* First collapse repeated whitespace (including +/;) */ - for (i = j = 0, ws = 0; j < n; j++) { + i = 0; + ws = 0; + for (j = 0; j < n; j++) { /* Eliminate prefix '+', only if preceded by whitespace */ /* (i.e. keep it in 1.23e+08) */ @@ -233,7 +235,8 @@ consuming their surrounding whitespace. n = strlen(c); /* Then make ',' and '=' greedy */ - for (i = j = 0; j < n; j++) { + i = 0; + for (j = 0; j < n; j++) { if (i==0) { c[i++] = c[j]; continue; @@ -311,7 +314,8 @@ It is the duty of the caller to free this array. if (0==argv) return 0; argv[0] = args; - for (i = 0, j = 1; ; i++) { + j = 1; + for (i = 0; ; i++) { if (0==args[i]) { argv[j++] = args + (i + 1); } |
