mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-01-31 11:19:18 +00:00
Replace deprecated vsprintf by vsnprintf
This commit is contained in:
parent
64b285751b
commit
f7c1d9bf91
@ -229,7 +229,7 @@ void fatalerr(const char *format, ...)
|
|||||||
char msg[1024];
|
char msg[1024];
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, format);
|
va_start(ap, format);
|
||||||
vsprintf(msg, format, ap);
|
vsnprintf(msg, 1024, format, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
fprintf(stderr, "%s", msg);
|
fprintf(stderr, "%s", msg);
|
||||||
exit(-9);
|
exit(-9);
|
||||||
@ -4084,7 +4084,7 @@ void trace(int level, const char *format, ...)
|
|||||||
va_list ap;
|
va_list ap;
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
va_start(ap, format);
|
va_start(ap, format);
|
||||||
vsprintf(buffer, format, ap);
|
vsnprintf(buffer, 256, format, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
std::string str(buffer);
|
std::string str(buffer);
|
||||||
VLOG(level) << "RTKLIB TRACE[" << level << "]:" << str;
|
VLOG(level) << "RTKLIB TRACE[" << level << "]:" << str;
|
||||||
|
@ -504,7 +504,7 @@ void errmsg(rtk_t *rtk, const char *format, ...)
|
|||||||
time2str(rtk->sol.time, tstr, 2);
|
time2str(rtk->sol.time, tstr, 2);
|
||||||
n = std::snprintf(buff, sizeof(buff), "%s: ", tstr + 11);
|
n = std::snprintf(buff, sizeof(buff), "%s: ", tstr + 11);
|
||||||
va_start(ap, format);
|
va_start(ap, format);
|
||||||
n += vsprintf(buff + n, format, ap);
|
n += vsnprintf(buff + n, 256, format, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
n = n < MAXERRMSG - rtk->neb ? n : MAXERRMSG - rtk->neb;
|
n = n < MAXERRMSG - rtk->neb ? n : MAXERRMSG - rtk->neb;
|
||||||
memcpy(rtk->errbuf + rtk->neb, buff, n);
|
memcpy(rtk->errbuf + rtk->neb, buff, n);
|
||||||
|
Loading…
Reference in New Issue
Block a user