diff --git a/src/algorithms/libs/rtklib/rtklib_rtkcmn.cc b/src/algorithms/libs/rtklib/rtklib_rtkcmn.cc index dbfbebdfd..8120152fa 100644 --- a/src/algorithms/libs/rtklib/rtklib_rtkcmn.cc +++ b/src/algorithms/libs/rtklib/rtklib_rtkcmn.cc @@ -1170,7 +1170,11 @@ double str2num(const char *s, int i, int n) char str[256], *p = str; if (i<0 || (int)strlen(s)= 0; s++) *p++=*s == 'd' || *s == 'D' ? 'E' : *s; *p = '\0'; + for (s += i; *s && --n >= 0; s++) + { + *p++=*s == 'd' || *s == 'D' ? 'E' : *s; + } + *p = '\0'; return sscanf(str, "%lf", &value) == 1 ? value : 0.0; } @@ -1188,7 +1192,11 @@ int str2time(const char *s, int i, int n, gtime_t *t) char str[256], *p = str; if (i<0 || (int)strlen(s)= 0;) *p++=*s++; *p = '\0'; + for (s += i; *s && --n >= 0;) + { + *p++=*s++; + } + *p = '\0'; if (sscanf(str, "%lf %lf %lf %lf %lf %lf", ep, ep+1, ep+2, ep+3, ep+4, ep+5)<6) return -1; if (ep[0]<100.0) ep[0] += ep[0]<80.0 ? 2000.0 : 1900.0; diff --git a/src/algorithms/libs/rtklib/rtklib_rtkpos.cc b/src/algorithms/libs/rtklib/rtklib_rtkpos.cc index 2ced73641..850fa37ae 100644 --- a/src/algorithms/libs/rtklib/rtklib_rtkpos.cc +++ b/src/algorithms/libs/rtklib/rtklib_rtkpos.cc @@ -585,7 +585,11 @@ void udpos(rtk_t *rtk, double tt) return; } /* check variance of estimated postion */ - for (i = 0;i<3;i++) var += rtk->P[i+i*rtk->nx]; var/=3.0; + for (i = 0;i<3;i++) + { + var += rtk->P[i+i*rtk->nx]; + } + var /= 3.0; if (var>VAR_POS) { @@ -1178,8 +1182,11 @@ int constbl(rtk_t *rtk, const double *x, const double *P, double *v, /* approximate variance of solution */ if (P) { - for (i = 0;i<3;i++) var+=P[i+i*rtk->nx]; - var/=3.0; + for (i = 0;i<3;i++) + { + var += P[i+i*rtk->nx]; + } + var /= 3.0; } /* check nonlinearity */ if (var>thres*thres*bb*bb)