Permalink
Browse files

Also made static analyzer happy and updated base SDK for Proj4.

  • Loading branch information...
1 parent ec66a94 commit 6245113cef1b1cd68d6c49dc24c1b35faedac941 Foobaz committed Jul 26, 2010
@@ -824,7 +824,7 @@
GCC_WARN_UNUSED_VARIABLE = YES;
ONLY_ACTIVE_ARCH = YES;
PREBINDING = NO;
- SDKROOT = iphonesimulator3.0;
+ SDKROOT = iphonesimulator3.2;
};
name = Debug;
};
@@ -838,7 +838,7 @@
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
PREBINDING = NO;
- SDKROOT = iphonesimulator3.0;
+ SDKROOT = iphonesimulator3.2;
};
name = Release;
};
View
@@ -11,7 +11,8 @@ static double ceval(struct PW_COEF *C, int n) {
int j;
for (C += n ; n-- ; --C ) {
- if (j = C->m) {
+ j = C->m;
+ if (j) {
vd = vdd = 0.;
for (c = C->c + --j; j ; --j ) {
vd = w2.v * (tmp = vd) - vdd + *c--;
@@ -22,7 +23,8 @@ static double ceval(struct PW_COEF *C, int n) {
d = w2.u * (tmp = d) - dd;
dd = tmp;
}
- if (j = C->m) {
+ j = C->m;
+ if (j) {
vd = vdd = 0.;
for (c = C->c + --j; j ; --j ) {
vd = w2.v * (tmp = vd) - vdd + *c--;
@@ -58,7 +60,8 @@ bpseval(projUV in, Tseries *T) {
out.u = out.v = 0.;
for (i = T->mu; i >= 0; --i) {
row = 0.;
- if (m = T->cu[i].m) {
+ m = T->cu[i].m;
+ if (m) {
c = T->cu[i].c + m;
while (m--)
row = *--c + in.v * row;
@@ -67,7 +70,8 @@ bpseval(projUV in, Tseries *T) {
}
for (i = T->mv; i >= 0; --i) {
row = 0.;
- if (m = T->cv[i].m) {
+ m = T->cv[i].m;
+ if (m) {
c = T->cv[i].c + m;
while (m--)
row = *--c + in.v * row;
View
@@ -27,7 +27,7 @@ dmstor(const char *is, char **rs) {
if (rs)
*rs = (char *)is;
/* copy sting into work space */
- while (isspace(sign = *is)) ++is;
+ while (isspace(*is)) ++is;
for (n = MAX_WORK, s = work, p = (char *)is; isgraph(*p) && --n ; )
*s++ = *p++;
*s = '\0';
View
@@ -36,11 +36,11 @@ gen_cheb(int inverse, projUV (*proj)(projUV), char *s, PJ *P, int iargc, char **
if (iargc > 0) { /* proj execution audit trail */
int n = 0, L;
- for( i = 0 ; iargc ; --iargc) {
+ while (--iargc) {
arg = *iargv++;
if (*arg != '+') {
if (!n) { putchar('#'); ++n; }
- (void)printf(" %s%n",arg, &L);
+ L = printf(" %s",arg);
if ((n += L) > 50) { putchar('\n'); n = 0; }
}
}
View
@@ -381,18 +381,15 @@ void pj_Convert_Geocentric_To_Geodetic (GeocentricInfo *gi,
double CPHI; /* cos of searched geodetic latitude */
double SPHI; /* sin of searched geodetic latitude */
double SDPHI; /* end-criterium: addition-theorem of sin(Latitude(iter)-Latitude(iter-1)) */
- int At_Pole; /* indicates location is in polar region */
int iter; /* # of continous iteration, max. 30 is always enough (s.a.) */
- At_Pole = FALSE;
P = sqrt(X*X+Y*Y);
RR = sqrt(X*X+Y*Y+Z*Z);
/* special cases for latitude and longitude */
if (P/gi->Geocent_a < genau) {
/* special case, if P=0. (X=0., Y=0.) */
- At_Pole = TRUE;
*Longitude = 0.;
/* if (X,Y,Z)=(0.,0.,0.) then Height becomes semi-minor axis
View
@@ -26,7 +26,8 @@ geod_set(int argc, char **argv) {
/* set elliptical parameters */
if (pj_ell_set(start, &geod_a, &es)) emess(1,"ellipse setup failure");
/* set units */
- if (name = pj_param(start, "sunits").s) {
+ name = pj_param(start, "sunits").s;
+ if (name) {
char *s;
struct PJ_UNITS *unit_list = pj_get_units_ref();
for (i = 0; (s = unit_list[i].id) && strcmp(name, s) ; ++i) ;
@@ -35,7 +36,8 @@ geod_set(int argc, char **argv) {
fr_meter = 1. / (to_meter = atof(unit_list[i].to_meter));
} else
to_meter = fr_meter = 1.;
- if (ellipse = es != 0.) {
+ ellipse = es != 0.;
+ if (ellipse) {
onef = sqrt(1. - es);
geod_f = 1 - onef;
f2 = geod_f/2;
@@ -56,15 +58,15 @@ geod_set(int argc, char **argv) {
lam2 = pj_param(start, "rlon_2").f;
geod_inv();
geod_pre();
- } else if (geod_S = pj_param(start, "dS").f) {
+ } else if ((geod_S = pj_param(start, "dS").f)) {
al12 = pj_param(start, "rA").f;
geod_pre();
geod_for();
} else emess(1,"incomplete geodesic/arc info");
if ((n_alpha = pj_param(start, "in_A").i) > 0) {
if (!(del_alpha = pj_param(start, "rdel_A").f))
emess(1,"del azimuth == 0");
- } else if (del_S = fabs(pj_param(start, "ddel_S").f)) {
+ } else if ((del_S = fabs(pj_param(start, "ddel_S").f))) {
n_S = geod_S / del_S + .5;
} else if ((n_S = pj_param(start, "in_S").i) <= 0)
emess(1,"no interval divisor selected");
View
@@ -49,7 +49,7 @@ mk_cheby(projUV a, projUV b, double res, projUV *resid, projUV (*func)(projUV),
ncv = ncu + nu;
if (!bchgen(a, b, nu, nv, w, func)) {
projUV *s;
- double ab, *p;
+ double *p;
/* analyse coefficients and adjust until residual OK */
cutres = res;
@@ -66,11 +66,11 @@ mk_cheby(projUV a, projUV b, double res, projUV *resid, projUV (*func)(projUV),
for (j = 0; j < nu; ++j) {
ncu[j] = ncv[j] = 0; /* clear column maxes */
for (s = w[j], i = 0; i < nv; ++i, ++s) {
- if ((ab = fabs(s->u)) < cutres) /* < resolution ? */
+ if (fabs(s->u) < cutres) /* < resolution ? */
s->u = 0.; /* clear coefficient */
else
ncu[j] = i + 1; /* update column max */
- if ((ab = fabs(s->v)) < cutres) /* same for v coef's */
+ if (fabs(s->v) < cutres) /* same for v coef's */
s->v = 0.;
else
ncv[j] = i + 1;
@@ -94,30 +94,33 @@ mk_cheby(projUV a, projUV b, double res, projUV *resid, projUV (*func)(projUV),
if (ncu[j]) nru = j + 1; /* update row max */
if (ncv[j]) nrv = j + 1;
}
- if (Ts = makeT(nru, nrv)) {
+ Ts = makeT(nru, nrv);
+ if (Ts) {
Ts->a = a;
Ts->b = b;
Ts->mu = nru - 1;
Ts->mv = nrv - 1;
Ts->power = 1;
for (i = 0; i < nru; ++i) /* store coefficient rows for u */
- if (Ts->cu[i].m = ncu[i])
+ Ts->cu[i].m = ncu[i];
+ if (Ts->cu[i].m)
if ((p = Ts->cu[i].c =
(double *)pj_malloc(sizeof(double) * ncu[i])))
for (j = 0; j < ncu[i]; ++j)
*p++ = (w[i] + j)->u;
else
goto error;
for (i = 0; i < nrv; ++i) /* same for v */
- if (Ts->cv[i].m = ncv[i])
+ Ts->cv[i].m = ncv[i];
+ if (Ts->cv[i].m)
if ((p = Ts->cv[i].c =
(double *)pj_malloc(sizeof(double) * ncv[i])))
for (j = 0; j < ncv[i]; ++j)
*p++ = (w[i] + j)->v;
else
goto error;
}
- } else if (Ts = makeT(nru, nrv)) {
+ } else if ((Ts = makeT(nru, nrv))) {
/* else make returned Chebyshev coefficient structure */
Ts->mu = nru - 1; /* save row degree */
Ts->mv = nrv - 1;
@@ -127,15 +130,17 @@ mk_cheby(projUV a, projUV b, double res, projUV *resid, projUV (*func)(projUV),
Ts->b.v = 1. / (b.v - a.v);
Ts->power = 0;
for (i = 0; i < nru; ++i) /* store coefficient rows for u */
- if (Ts->cu[i].m = ncu[i])
+ Ts->cu[i].m = ncu[i];
+ if (Ts->cu[i].m)
if ((p = Ts->cu[i].c =
(double *)pj_malloc(sizeof(double) * ncu[i])))
for (j = 0; j < ncu[i]; ++j)
*p++ = (w[i] + j)->u;
else
goto error;
for (i = 0; i < nrv; ++i) /* same for v */
- if (Ts->cv[i].m = ncv[i])
+ Ts->cv[i].m = ncv[i];
+ if (Ts->cv[i].m)
if ((p = Ts->cv[i].c =
(double *)pj_malloc(sizeof(double) * ncv[i])))
for (j = 0; j < ncv[i]; ++j)
View
@@ -18,23 +18,23 @@ p_series(Tseries *T, FILE *file, char *fmt) {
fprintf(file, "u: %d\n", T->mu+1);
for (i = 0; i <= T->mu; ++i)
if (T->cu[i].m) {
- fprintf(file, "%d %d%n", i, T->cu[i].m, &L);
+ L = fprintf(file, "%d %d", i, T->cu[i].m);
n = 0;
for (j = 0; j < T->cu[i].m; ++j) {
if ((L += n) > CUT)
- fprintf(file, "\n %n", &L);
+ L = fprintf(file, "\n ");
fprintf(file, format, T->cu[i].c[j], &n);
}
fputc('\n', file);
}
fprintf(file, "v: %d\n", T->mv+1);
for (i = 0; i <= T->mv; ++i)
if (T->cv[i].m) {
- fprintf(file, "%d %d%n", i, T->cv[i].m, &L);
+ L = fprintf(file, "%d %d", i, T->cv[i].m);
n = 0;
for (j = 0; j < T->cv[i].m; ++j) {
if ((L += n) > 60)
- fprintf(file, "\n %n", &L);
+ L = fprintf(file, "\n ");
fprintf(file, format, T->cv[i].c[j], &n);
}
fputc('\n', file);
View
@@ -14,7 +14,8 @@ static const char SCCSID[]="@(#)pj_auth.c 4.3 93/06/12 GIE REL";
pj_authset(double es) {
double t, *APA;
- if (APA = (double *)pj_malloc(APA_SIZE * sizeof(double))) {
+ APA = (double *)pj_malloc(APA_SIZE * sizeof(double));
+ if (APA) {
APA[0] = es * P00;
t = es * es;
APA[0] += t * P01;
View
@@ -55,7 +55,7 @@
int pj_datum_set(paralist *pl, PJ *projdef)
{
- const char *name, *towgs84, *nadgrids;
+ const char *name, *towgs84;
projdef->datum_type = PJD_UNKNOWN;
@@ -69,7 +69,8 @@ int pj_datum_set(paralist *pl, PJ *projdef)
/* definition will last into the pj_ell_set() function called */
/* after this one. */
/* -------------------------------------------------------------------- */
- if( (name = pj_param(pl,"sdatum").s) != NULL )
+ name = pj_param(pl,"sdatum").s;
+ if( name != NULL )
{
paralist *curr;
const char *s;
@@ -89,17 +90,24 @@ int pj_datum_set(paralist *pl, PJ *projdef)
strcpy( entry, "ellps=" );
strncat( entry, pj_datums[i].ellipse_id, 80 );
- curr = curr->next = pj_mkparam(entry);
+ if (curr)
+ {
+ curr->next = pj_mkparam(entry);
+ curr = curr->next;
+ }
}
if( pj_datums[i].defn && strlen(pj_datums[i].defn) > 0 )
- curr = curr->next = pj_mkparam(pj_datums[i].defn);
+ {
+ if (curr)
+ curr->next = pj_mkparam(pj_datums[i].defn);
+ }
}
/* -------------------------------------------------------------------- */
/* Check for nadgrids parameter. */
/* -------------------------------------------------------------------- */
- if( (nadgrids = pj_param(pl,"snadgrids").s) != NULL )
+ if( pj_param(pl,"snadgrids").s != NULL )
{
/* We don't actually save the value separately. It will continue
to exist int he param list for use in pj_apply_gridshift.c */
@@ -118,7 +126,6 @@ int pj_datum_set(paralist *pl, PJ *projdef)
memset( projdef->datum_params, 0, sizeof(double) * 7);
/* parse out the parameters */
- s = towgs84;
for( s = towgs84; *s != '\0' && parm_count < 7; )
{
projdef->datum_params[parm_count++] = atof(s);
View
@@ -24,15 +24,17 @@ pj_ell_set(paralist *pl, double *a, double *es) {
else { /* probable elliptical figure */
/* check if ellps present and temporarily append its values to pl */
- if (name = pj_param(pl, "sellps").s) {
+ name = pj_param(pl, "sellps").s;
+ if (name && pl) {
char *s;
for (start = pl; start && start->next ; start = start->next) ;
curr = start;
for (i = 0; (s = pj_ellps[i].id) && strcmp(name, s) ; ++i) ;
if (!s) { pj_errno = -9; return 1; }
- curr = curr->next = pj_mkparam(pj_ellps[i].major);
- curr = curr->next = pj_mkparam(pj_ellps[i].ell);
+ curr->next = pj_mkparam(pj_ellps[i].major);
+ curr = curr->next;
+ curr->next = pj_mkparam(pj_ellps[i].ell);
}
*a = pj_param(pl, "da").f;
if (pj_param(pl, "tes").i) /* eccentricity squared */
View
@@ -15,7 +15,8 @@ pj_factors(LP lp, PJ *P, double h, struct FACTORS *fac) {
double cosphi, t, n, r;
/* check for forward and latitude or longitude overange */
- if ((t = fabs(lp.phi)-HALFPI) > EPS || fabs(lp.lam) > 10.) {
+ t = fabs(lp.phi)-HALFPI;
+ if (t > EPS || fabs(lp.lam) > 10.) {
pj_errno = -14;
return 1;
} else { /* proceed */
View
@@ -509,8 +509,10 @@ static int pj_gridinfo_init_ntv2( FILE *fid, PJ_GRIDINFO *gilist )
"failed to find parent %8.8s for %s.\n",
(const char *) header+24, gi->ct->id );
- for( lnk = gp; lnk->next != NULL; lnk = lnk->next ) {}
- lnk->next = gi;
+ if (gp) {
+ for( lnk = gp; lnk->next != NULL; lnk = lnk->next ) {}
+ lnk->next = gi;
+ }
}
else if( gp->child == NULL )
{
Oops, something went wrong.

0 comments on commit 6245113

Please sign in to comment.