1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-14 04:00:34 +00:00

Improve buffer handling. Remove warnings raised by gcc 7.1

This commit is contained in:
Carles Fernandez 2017-08-06 10:26:56 +02:00
parent 727f4d7d0d
commit a7fbde50e6
2 changed files with 16 additions and 16 deletions

View File

@ -1119,7 +1119,7 @@ int outecef(unsigned char *buff, const char *s, const sol_t *sol,
trace(3,"outecef:\n");
p += sprintf(p,"%s%s%14.4f%s%14.4f%s%14.4f%s%3d%s%3d%s%8.4f%s%8.4f%s%8.4f%s%8.4f%s%8.4f%s%8.4f%s%6.2f%s%6.1f\n",
p += snprintf(p,255,"%s%s%14.4f%s%14.4f%s%14.4f%s%3d%s%3d%s%8.4f%s%8.4f%s%8.4f%s%8.4f%s%8.4f%s%8.4f%s%6.2f%s%6.1f\n",
s,sep,sol->rr[0],sep,sol->rr[1],sep,sol->rr[2],sep,sol->stat,sep,
sol->ns,sep,SQRT_SOL(sol->qr[0]),sep,SQRT_SOL(sol->qr[1]),sep,SQRT_SOL(sol->qr[2]),
sep,sqvar(sol->qr[3]),sep,sqvar(sol->qr[4]),sep,sqvar(sol->qr[5]),
@ -1634,39 +1634,39 @@ int outsols(unsigned char *buff, const sol_t *sol, const double *rb,
if (opt->posf == SOLF_NMEA)
{
if (opt->nmeaintv[0]<0.0) return 0;
if (!screent(sol->time,ts,ts,opt->nmeaintv[0])) return 0;
if (opt->nmeaintv[0] < 0.0) return 0;
if (!screent(sol->time, ts, ts, opt->nmeaintv[0])) return 0;
}
if (sol->stat <= SOLQ_NONE || (opt->posf == SOLF_ENU && norm_rtk(rb,3) <= 0.0))
{
return 0;
}
timeu = opt->timeu<0?0:(opt->timeu>20?20:opt->timeu);
timeu = opt->timeu < 0 ? 0 : (opt->timeu > 20 ? 20 : opt->timeu);
time = sol->time;
if (opt->times >= TIMES_UTC) time = gpst2utc(time);
if (opt->times == TIMES_JST) time = timeadd(time,9*3600.0);
if (opt->times == TIMES_JST) time = timeadd(time, 9*3600.0);
if (opt->timef) time2str(time,s,timeu);
if (opt->timef) time2str(time, s, timeu);
else
{
gpst = time2gpst(time,&week);
if (86400*7-gpst<0.5/pow(10.0,timeu))
gpst = time2gpst(time, &week);
if (86400 * 7 - gpst < 0.5 / pow(10.0, timeu))
{
week++;
gpst = 0.0;
}
sprintf(s,"%4d%s%*.*f",week,sep,6+(timeu <= 0?0:timeu+1),timeu,gpst);
snprintf(s, 64, "%4d%s%*.*f", week, sep, 6 + (timeu <= 0 ? 0 : timeu+1), timeu, gpst);
}
switch (opt->posf)
{
case SOLF_LLH: p += outpos (p,s,sol,opt); break;
case SOLF_XYZ: p += outecef(p,s,sol,opt); break;
case SOLF_ENU: p += outenu(p,s,sol,rb,opt); break;
case SOLF_NMEA: p += outnmea_rmc(p,sol);
p += outnmea_gga(p,sol); break;
case SOLF_LLH: p += outpos(p, s, sol, opt); break;
case SOLF_XYZ: p += outecef(p, s, sol, opt); break;
case SOLF_ENU: p += outenu(p, s, sol, rb, opt); break;
case SOLF_NMEA: p += outnmea_rmc(p, sol);
p += outnmea_gga(p, sol); break;
}
return p-buff;
return p - buff;
}

View File

@ -1127,7 +1127,7 @@ int reqntrip_s(ntrip_t *ntrip, char *msg)
tracet(3, "reqntrip_s: state=%d\n", ntrip->state);
p += sprintf(p, "SOURCE %s %s\r\n", ntrip->passwd, ntrip->mntpnt);
p += snprintf(p, 256 + NTRIP_MAXSTR, "SOURCE %s %s\r\n", ntrip->passwd, ntrip->mntpnt);
p += sprintf(p, "Source-Agent: NTRIP %s\r\n", NTRIP_AGENT);
p += sprintf(p, "STR: %s\r\n", ntrip->str);
p += sprintf(p, "\r\n");