1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-11-13 05:20:04 +00:00

Use nullptr

This commit is contained in:
Carles Fernandez 2018-12-07 21:00:30 +01:00
parent 7261bec2ad
commit 81a4d24ae9
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
3 changed files with 51 additions and 51 deletions

View File

@ -3635,7 +3635,7 @@ double satwavelen(int sat, int frq, const nav_t *nav)
return SPEED_OF_LIGHT / FREQ1_BDS; /* B1 */ return SPEED_OF_LIGHT / FREQ1_BDS; /* B1 */
if (frq == 1) if (frq == 1)
return SPEED_OF_LIGHT / FREQ2_BDS; /* B2 */ return SPEED_OF_LIGHT / FREQ2_BDS; /* B2 */
else if (frq == 2) if (frq == 2)
return SPEED_OF_LIGHT / FREQ3_BDS; /* B3 */ return SPEED_OF_LIGHT / FREQ3_BDS; /* B3 */
} }
else else
@ -3644,7 +3644,7 @@ double satwavelen(int sat, int frq, const nav_t *nav)
return SPEED_OF_LIGHT / FREQ1; /* L1/E1 */ return SPEED_OF_LIGHT / FREQ1; /* L1/E1 */
if (frq == 1) if (frq == 1)
return SPEED_OF_LIGHT / FREQ2; /* L2 */ return SPEED_OF_LIGHT / FREQ2; /* L2 */
else if (frq == 2) if (frq == 2)
return SPEED_OF_LIGHT / FREQ5; /* L5/E5a */ return SPEED_OF_LIGHT / FREQ5; /* L5/E5a */
else if (frq == 3) else if (frq == 3)
return SPEED_OF_LIGHT / FREQ6; /* L6/LEX */ return SPEED_OF_LIGHT / FREQ6; /* L6/LEX */

View File

@ -129,7 +129,7 @@ void updatesvr(rtksvr_t *svr, int ret, obs_t *obs, nav_t *nav, int sat,
for (i = 0; i < obs->n; i++) for (i = 0; i < obs->n; i++)
{ {
if (svr->rtk.opt.exsats[obs->data[i].sat - 1] == 1 || if (svr->rtk.opt.exsats[obs->data[i].sat - 1] == 1 ||
!(satsys(obs->data[i].sat, NULL) & svr->rtk.opt.navsys)) continue; !(satsys(obs->data[i].sat, nullptr) & svr->rtk.opt.navsys)) continue;
svr->obs[index][iobs].data[n] = obs->data[i]; svr->obs[index][iobs].data[n] = obs->data[i];
svr->obs[index][iobs].data[n++].rcv = index + 1; svr->obs[index][iobs].data[n++].rcv = index + 1;
} }
@ -291,7 +291,7 @@ int decoderaw(rtksvr_t *svr, int index)
{ {
obs_t *obs; obs_t *obs;
nav_t *nav; nav_t *nav;
sbsmsg_t *sbsmsg = NULL; sbsmsg_t *sbsmsg = nullptr;
int i, ret = 0, sat, fobs = 0; int i, ret = 0, sat, fobs = 0;
tracet(4, "decoderaw: index=%d\n", index); tracet(4, "decoderaw: index=%d\n", index);
@ -373,8 +373,8 @@ void decodefile(rtksvr_t *svr, int index)
trop_t trop0[MAXSTA] = {{{0, 0.0}, {0.0}, {0.0}}}; trop_t trop0[MAXSTA] = {{{0, 0.0}, {0.0}, {0.0}}};
pppcorr_t pppcorr0 = {0, {{0}, {0}}, {{0.0}, {0.0}}, {0}, {0}, {0}, {0}, {stec0}, {trop0}}; pppcorr_t pppcorr0 = {0, {{0}, {0}}, {{0.0}, {0.0}}, {0}, {0}, {0}, {0}, {stec0}, {trop0}};
nav_t nav = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, nav_t nav = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
{0, 0, (erpd_t *){0}}, {0.0}, {0.0}, {0.0}, {0.0}, {0.0}, {0.0}, {0.0}, {0.0}, {0, 0, (erpd_t *){nullptr}}, {0.0}, {0.0}, {0.0}, {0.0}, {0.0}, {0.0}, {0.0}, {0.0},
{0.0}, {0.0}, {0.0}, {0.0}, 0, {{0.0}, {0.0}}, {{0.0}, {0.0}}, {{{0.0}}, {{0.0}}, {{0.0}}}, {0.0}, {0.0}, {0.0}, {0.0}, 0, {{0.0}, {0.0}}, {{0.0}, {0.0}}, {{{0.0}}, {{0.0}}, {{0.0}}},
{0.0}, {0.0}, {*glo_fcn}, {*pcvt0}, sbssat0, {*sbsion0}, {*dgps0}, {*ssr0}, {*lexeph0}, {0.0}, {0.0}, {*glo_fcn}, {*pcvt0}, sbssat0, {*sbsion0}, {*dgps0}, {*ssr0}, {*lexeph0},
{{0, 0.0}, 0.0, {0.0}, {{0.0}, {0.0}}}, pppcorr0}; {{0, 0.0}, 0.0, {0.0}, {{0.0}, {0.0}}}, pppcorr0};
@ -564,9 +564,9 @@ void *rtksvrthread(void *arg)
{ {
svr->nb[i] = svr->npb[i] = 0; svr->nb[i] = svr->npb[i] = 0;
free(svr->buff[i]); free(svr->buff[i]);
svr->buff[i] = NULL; svr->buff[i] = nullptr;
free(svr->pbuf[i]); free(svr->pbuf[i]);
svr->pbuf[i] = NULL; svr->pbuf[i] = nullptr;
//free_raw (svr->raw +i); //free_raw (svr->raw +i);
free_rtcm(svr->rtcm + i); free_rtcm(svr->rtcm + i);
} }
@ -574,9 +574,9 @@ void *rtksvrthread(void *arg)
{ {
svr->nsb[i] = 0; svr->nsb[i] = 0;
free(svr->sbuf[i]); free(svr->sbuf[i]);
svr->sbuf[i] = NULL; svr->sbuf[i] = nullptr;
} }
return 0; return nullptr;
} }
@ -610,15 +610,15 @@ int rtksvrinit(rtksvr_t *svr)
for (i = 0; i < 3; i++) svr->nb[i] = 0; for (i = 0; i < 3; i++) svr->nb[i] = 0;
for (i = 0; i < 2; i++) svr->nsb[i] = 0; for (i = 0; i < 2; i++) svr->nsb[i] = 0;
for (i = 0; i < 3; i++) svr->npb[i] = 0; for (i = 0; i < 3; i++) svr->npb[i] = 0;
for (i = 0; i < 3; i++) svr->buff[i] = NULL; for (i = 0; i < 3; i++) svr->buff[i] = nullptr;
for (i = 0; i < 2; i++) svr->sbuf[i] = NULL; for (i = 0; i < 2; i++) svr->sbuf[i] = nullptr;
for (i = 0; i < 3; i++) svr->pbuf[i] = NULL; for (i = 0; i < 3; i++) svr->pbuf[i] = nullptr;
for (i = 0; i < MAXSOLBUF; i++) svr->solbuf[i] = sol0; for (i = 0; i < MAXSOLBUF; i++) svr->solbuf[i] = sol0;
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
for (j = 0; j < 10; j++) svr->nmsg[i][j] = 0; for (j = 0; j < 10; j++) svr->nmsg[i][j] = 0;
for (i = 0; i < 3; i++) svr->ftime[i] = time0; for (i = 0; i < 3; i++) svr->ftime[i] = time0;
for (i = 0; i < 3; i++) svr->files[i][0] = '\0'; for (i = 0; i < 3; i++) svr->files[i][0] = '\0';
svr->moni = NULL; svr->moni = nullptr;
svr->tick = 0; svr->tick = 0;
svr->thread = 0; svr->thread = 0;
svr->cputime = svr->prcout = 0; svr->cputime = svr->prcout = 0;
@ -840,7 +840,7 @@ int rtksvrstart(rtksvr_t *svr, int cycle, int buffsize, int *strs,
writesolhead(svr->stream + i, svr->solopt + i - 3); writesolhead(svr->stream + i, svr->solopt + i - 3);
} }
/* create rtk server thread */ /* create rtk server thread */
if (pthread_create(&svr->thread, NULL, rtksvrthread, svr)) if (pthread_create(&svr->thread, nullptr, rtksvrthread, svr))
{ {
for (i = 0; i < MAXSTRRTK; i++) strclose(svr->stream + i); for (i = 0; i < MAXSTRRTK; i++) strclose(svr->stream + i);
return 0; return 0;
@ -876,7 +876,7 @@ void rtksvrstop(rtksvr_t *svr, char **cmds)
svr->state = 0; svr->state = 0;
/* free rtk server thread */ /* free rtk server thread */
pthread_join(svr->thread, NULL); pthread_join(svr->thread, nullptr);
} }

View File

@ -94,7 +94,7 @@ serial_t *openserial(const char *path, int mode, char *msg)
int rw = 0; int rw = 0;
tracet(3, "openserial: path=%s mode=%d\n", path, mode); tracet(3, "openserial: path=%s mode=%d\n", path, mode);
if (!(serial = (serial_t *)malloc(sizeof(serial_t)))) return NULL; if (!(serial = (serial_t *)malloc(sizeof(serial_t)))) return nullptr;
if ((p = strchr((char *)path, ':'))) if ((p = strchr((char *)path, ':')))
{ {
@ -112,7 +112,7 @@ serial_t *openserial(const char *path, int mode, char *msg)
sprintf(msg, "bitrate error (%d)", brate); sprintf(msg, "bitrate error (%d)", brate);
tracet(1, "openserial: %s path=%s\n", msg, path); tracet(1, "openserial: %s path=%s\n", msg, path);
free(serial); free(serial);
return NULL; return nullptr;
} }
parity = (char)toupper((int)parity); parity = (char)toupper((int)parity);
@ -135,7 +135,7 @@ serial_t *openserial(const char *path, int mode, char *msg)
sprintf(msg, "device open error (%d)", errno); sprintf(msg, "device open error (%d)", errno);
tracet(1, "openserial: %s dev=%s\n", msg, dev); tracet(1, "openserial: %s dev=%s\n", msg, dev);
free(serial); free(serial);
return NULL; return nullptr;
} }
tcgetattr(serial->dev, &ios); tcgetattr(serial->dev, &ios);
ios.c_iflag = 0; ios.c_iflag = 0;
@ -295,7 +295,7 @@ void closefile_(file_t *file)
if (file->fp_tag) fclose(file->fp_tag); if (file->fp_tag) fclose(file->fp_tag);
if (file->fp_tmp) fclose(file->fp_tmp); if (file->fp_tmp) fclose(file->fp_tmp);
if (file->fp_tag_tmp) fclose(file->fp_tag_tmp); if (file->fp_tag_tmp) fclose(file->fp_tag_tmp);
file->fp = file->fp_tag = file->fp_tmp = file->fp_tag_tmp = NULL; file->fp = file->fp_tag = file->fp_tmp = file->fp_tag_tmp = nullptr;
} }
@ -310,7 +310,7 @@ file_t *openfile(const char *path, int mode, char *msg)
tracet(3, "openfile: path=%s mode=%d\n", path, mode); tracet(3, "openfile: path=%s mode=%d\n", path, mode);
if (!(mode & (STR_MODE_R | STR_MODE_W))) return NULL; if (!(mode & (STR_MODE_R | STR_MODE_W))) return nullptr;
/* file options */ /* file options */
for (p = (char *)path; (p = strstr(p, "::")); p += 2) for (p = (char *)path; (p = strstr(p, "::")); p += 2)
@ -327,9 +327,9 @@ file_t *openfile(const char *path, int mode, char *msg)
if (start <= 0.0) start = 0.0; if (start <= 0.0) start = 0.0;
if (swapintv <= 0.0) swapintv = 0.0; if (swapintv <= 0.0) swapintv = 0.0;
if (!(file = (file_t *)malloc(sizeof(file_t)))) return NULL; if (!(file = (file_t *)malloc(sizeof(file_t)))) return nullptr;
file->fp = file->fp_tag = file->fp_tmp = file->fp_tag_tmp = NULL; file->fp = file->fp_tag = file->fp_tmp = file->fp_tag_tmp = nullptr;
if (strlen(path) < MAXSTRPATH) strcpy(file->path, path); if (strlen(path) < MAXSTRPATH) strcpy(file->path, path);
if ((p = strstr(file->path, "::"))) *p = '\0'; if ((p = strstr(file->path, "::"))) *p = '\0';
file->openpath[0] = '\0'; file->openpath[0] = '\0';
@ -350,7 +350,7 @@ file_t *openfile(const char *path, int mode, char *msg)
if (!openfile_(file, time, msg)) if (!openfile_(file, time, msg))
{ {
free(file); free(file);
return NULL; return nullptr;
} }
return file; return file;
} }
@ -399,7 +399,7 @@ void swapclose(file_t *file)
tracet(3, "swapclose: fp_tmp=%d\n", file->fp_tmp); tracet(3, "swapclose: fp_tmp=%d\n", file->fp_tmp);
if (file->fp_tmp) fclose(file->fp_tmp); if (file->fp_tmp) fclose(file->fp_tmp);
if (file->fp_tag_tmp) fclose(file->fp_tag_tmp); if (file->fp_tag_tmp) fclose(file->fp_tag_tmp);
file->fp_tmp = file->fp_tag_tmp = NULL; file->fp_tmp = file->fp_tag_tmp = nullptr;
} }
@ -427,7 +427,7 @@ int readfile(file_t *file, unsigned char *buff, int nmax, char *msg)
/* input from stdin */ /* input from stdin */
FD_ZERO(&rs); FD_ZERO(&rs);
FD_SET(0, &rs); FD_SET(0, &rs);
if (!select(1, &rs, NULL, NULL, &tv)) return 0; if (!select(1, &rs, nullptr, nullptr, &tv)) return 0;
if ((nr = read(0, buff, nmax)) < 0) return 0; if ((nr = read(0, buff, nmax)) < 0) return 0;
return nr; return nr;
} }
@ -652,7 +652,7 @@ socket_t accept_nb(socket_t sock, struct sockaddr *addr, socklen_t *len)
fd_set rs; fd_set rs;
FD_ZERO(&rs); FD_ZERO(&rs);
FD_SET(sock, &rs); FD_SET(sock, &rs);
if (!select(sock + 1, &rs, NULL, NULL, &tv)) return 0; if (!select(sock + 1, &rs, nullptr, nullptr, &tv)) return 0;
return accept(sock, addr, len); return accept(sock, addr, len);
} }
@ -673,7 +673,7 @@ int connect_nb(socket_t sock, struct sockaddr *addr, socklen_t len)
FD_ZERO(&rs); FD_ZERO(&rs);
FD_SET(sock, &rs); FD_SET(sock, &rs);
ws = rs; ws = rs;
if (select(sock + 1, &rs, &ws, NULL, &tv) == 0) return 0; if (select(sock + 1, &rs, &ws, nullptr, &tv) == 0) return 0;
} }
return 1; return 1;
} }
@ -686,7 +686,7 @@ int recv_nb(socket_t sock, unsigned char *buff, int n)
fd_set rs; fd_set rs;
FD_ZERO(&rs); FD_ZERO(&rs);
FD_SET(sock, &rs); FD_SET(sock, &rs);
if (!select(sock + 1, &rs, NULL, NULL, &tv)) return 0; if (!select(sock + 1, &rs, nullptr, nullptr, &tv)) return 0;
return recv(sock, (char *)buff, n, 0); return recv(sock, (char *)buff, n, 0);
} }
@ -698,7 +698,7 @@ int send_nb(socket_t sock, unsigned char *buff, int n)
fd_set ws; fd_set ws;
FD_ZERO(&ws); FD_ZERO(&ws);
FD_SET(sock, &ws); FD_SET(sock, &ws);
if (!select(sock + 1, NULL, &ws, NULL, &tv)) return 0; if (!select(sock + 1, nullptr, &ws, nullptr, &tv)) return 0;
return send(sock, (char *)buff, n, 0); return send(sock, (char *)buff, n, 0);
} }
@ -788,20 +788,20 @@ tcpsvr_t *opentcpsvr(const char *path, char *msg)
tcpsvr0 = {{0, {0}, 0, {0, 0, 0, {0}}, 0, 0, 0, 0}, {{0, {0}, 0, {0, 0, 0, {0}}, 0, 0, 0, 0}}}; tcpsvr0 = {{0, {0}, 0, {0, 0, 0, {0}}, 0, 0, 0, 0}, {{0, {0}, 0, {0, 0, 0, {0}}, 0, 0, 0, 0}}};
tracet(3, "opentcpsvr: path=%s\n", path); tracet(3, "opentcpsvr: path=%s\n", path);
if (!(tcpsvr = (tcpsvr_t *)malloc(sizeof(tcpsvr_t)))) return NULL; if (!(tcpsvr = (tcpsvr_t *)malloc(sizeof(tcpsvr_t)))) return nullptr;
*tcpsvr = tcpsvr0; *tcpsvr = tcpsvr0;
decodetcppath(path, tcpsvr->svr.saddr, port, NULL, NULL, NULL, NULL); decodetcppath(path, tcpsvr->svr.saddr, port, nullptr, nullptr, nullptr, nullptr);
if (sscanf(port, "%d", &tcpsvr->svr.port) < 1) if (sscanf(port, "%d", &tcpsvr->svr.port) < 1)
{ {
sprintf(msg, "port error: %s", port); sprintf(msg, "port error: %s", port);
tracet(1, "opentcpsvr: port error port=%s\n", port); tracet(1, "opentcpsvr: port error port=%s\n", port);
free(tcpsvr); free(tcpsvr);
return NULL; return nullptr;
} }
if (!gentcp(&tcpsvr->svr, 0, msg)) if (!gentcp(&tcpsvr->svr, 0, msg))
{ {
free(tcpsvr); free(tcpsvr);
return NULL; return nullptr;
} }
tcpsvr->svr.tcon = 0; tcpsvr->svr.tcon = 0;
return tcpsvr; return tcpsvr;
@ -1018,15 +1018,15 @@ tcpcli_t *opentcpcli(const char *path, char *msg)
tracet(3, "opentcpcli: path=%s\n", path); tracet(3, "opentcpcli: path=%s\n", path);
if (!(tcpcli = (tcpcli_t *)malloc(sizeof(tcpcli_t)))) return NULL; if (!(tcpcli = (tcpcli_t *)malloc(sizeof(tcpcli_t)))) return nullptr;
*tcpcli = tcpcli0; *tcpcli = tcpcli0;
decodetcppath(path, tcpcli->svr.saddr, port, NULL, NULL, NULL, NULL); decodetcppath(path, tcpcli->svr.saddr, port, nullptr, nullptr, nullptr, nullptr);
if (sscanf(port, "%d", &tcpcli->svr.port) < 1) if (sscanf(port, "%d", &tcpcli->svr.port) < 1)
{ {
sprintf(msg, "port error: %s", port); sprintf(msg, "port error: %s", port);
tracet(1, "opentcp: port error port=%s\n", port); tracet(1, "opentcp: port error port=%s\n", port);
free(tcpcli); free(tcpcli);
return NULL; return nullptr;
} }
tcpcli->svr.tcon = 0; tcpcli->svr.tcon = 0;
tcpcli->toinact = toinact; tcpcli->toinact = toinact;
@ -1367,7 +1367,7 @@ ntrip_t *openntrip(const char *path, int type, char *msg)
tracet(3, "openntrip: path=%s type=%d\n", path, type); tracet(3, "openntrip: path=%s type=%d\n", path, type);
if (!(ntrip = (ntrip_t *)malloc(sizeof(ntrip_t)))) return NULL; if (!(ntrip = (ntrip_t *)malloc(sizeof(ntrip_t)))) return nullptr;
ntrip->state = 0; ntrip->state = 0;
ntrip->type = type; /* 0:server, 1:client */ ntrip->type = type; /* 0:server, 1:client */
@ -1402,7 +1402,7 @@ ntrip_t *openntrip(const char *path, int type, char *msg)
{ {
tracet(1, "openntrip: opentcp error\n"); tracet(1, "openntrip: opentcp error\n");
free(ntrip); free(ntrip);
return NULL; return nullptr;
} }
return ntrip; return ntrip;
} }
@ -1548,7 +1548,7 @@ void *ftpthread(void *arg)
tracet(1, "no local directory\n"); tracet(1, "no local directory\n");
ftp->error = 11; ftp->error = 11;
ftp->state = 3; ftp->state = 3;
return 0; return nullptr;
} }
/* replace keyword in file path and local path */ /* replace keyword in file path and local path */
time = timeadd(utc2gpst(timeget()), ftp->topts[0]); time = timeadd(utc2gpst(timeget()), ftp->topts[0]);
@ -1584,7 +1584,7 @@ void *ftpthread(void *arg)
strcpy(ftp->local, tmpfile); strcpy(ftp->local, tmpfile);
tracet(3, "ftpthread: file exists %s\n", ftp->local); tracet(3, "ftpthread: file exists %s\n", ftp->local);
ftp->state = 2; ftp->state = 2;
return 0; return nullptr;
} }
/* proxy settings for wget (ref [2]) */ /* proxy settings for wget (ref [2]) */
if (*proxyaddr) if (*proxyaddr)
@ -1633,7 +1633,7 @@ void *ftpthread(void *arg)
tracet(1, "execcmd error: cmd=%s ret=%d\n", cmd, ret); tracet(1, "execcmd error: cmd=%s ret=%d\n", cmd, ret);
ftp->error = ret; ftp->error = ret;
ftp->state = 3; ftp->state = 3;
return 0; return nullptr;
} }
if (remove(errfile) != 0) trace(1, "Error removing file"); if (remove(errfile) != 0) trace(1, "Error removing file");
@ -1652,14 +1652,14 @@ void *ftpthread(void *arg)
tracet(1, "file uncompact error: %s\n", local); tracet(1, "file uncompact error: %s\n", local);
ftp->error = 12; ftp->error = 12;
ftp->state = 3; ftp->state = 3;
return 0; return nullptr;
} }
} }
if (strlen(local) < 1024) strcpy(ftp->local, local); if (strlen(local) < 1024) strcpy(ftp->local, local);
ftp->state = 2; /* ftp completed */ ftp->state = 2; /* ftp completed */
tracet(3, "ftpthread: complete cmd=%s\n", cmd); tracet(3, "ftpthread: complete cmd=%s\n", cmd);
return 0; return nullptr;
} }
@ -1672,7 +1672,7 @@ ftp_t *openftp(const char *path, int type, char *msg)
msg[0] = '\0'; msg[0] = '\0';
if (!(ftp = (ftp_t *)malloc(sizeof(ftp_t)))) return NULL; if (!(ftp = (ftp_t *)malloc(sizeof(ftp_t)))) return nullptr;
ftp->state = 0; ftp->state = 0;
ftp->proto = type; ftp->proto = type;
@ -1718,7 +1718,7 @@ int readftp(ftp_t *ftp, unsigned char *buff, int n, char *msg)
ftp->state = 1; ftp->state = 1;
sprintf(msg, "%s://%s", ftp->proto ? "http" : "ftp", ftp->addr); sprintf(msg, "%s://%s", ftp->proto ? "http" : "ftp", ftp->addr);
if (pthread_create(&ftp->thread, NULL, ftpthread, ftp)) if (pthread_create(&ftp->thread, nullptr, ftpthread, ftp))
{ {
tracet(1, "readftp: ftp thread create error\n"); tracet(1, "readftp: ftp thread create error\n");
ftp->state = 3; ftp->state = 3;
@ -1786,7 +1786,7 @@ void strinit(stream_t *stream)
stream->inb = stream->inr = stream->outb = stream->outr = 0; stream->inb = stream->inr = stream->outb = stream->outr = 0;
stream->tick = stream->tact = stream->inbt = stream->outbt = 0; stream->tick = stream->tact = stream->inbt = stream->outbt = 0;
initlock(&stream->lock); initlock(&stream->lock);
stream->port = NULL; stream->port = nullptr;
stream->path[0] = '\0'; stream->path[0] = '\0';
stream->msg[0] = '\0'; stream->msg[0] = '\0';
} }
@ -1838,7 +1838,7 @@ int stropen(stream_t *stream, int type, int mode, const char *path)
stream->tick = tickget(); stream->tick = tickget();
stream->inbt = stream->outbt = 0; stream->inbt = stream->outbt = 0;
stream->msg[0] = '\0'; stream->msg[0] = '\0';
stream->port = NULL; stream->port = nullptr;
switch (type) switch (type)
{ {
case STR_SERIAL: case STR_SERIAL:
@ -1870,7 +1870,7 @@ int stropen(stream_t *stream, int type, int mode, const char *path)
return 1; return 1;
} }
stream->state = !stream->port ? -1 : 1; stream->state = !stream->port ? -1 : 1;
return stream->port != NULL; return stream->port != nullptr;
} }
@ -1923,7 +1923,7 @@ void strclose(stream_t *stream)
stream->inr = stream->outr = 0; stream->inr = stream->outr = 0;
stream->path[0] = '\0'; stream->path[0] = '\0';
stream->msg[0] = '\0'; stream->msg[0] = '\0';
stream->port = NULL; stream->port = nullptr;
} }
@ -2286,7 +2286,7 @@ int gen_hex(const char *msg, unsigned char *buff)
trace(4, "gen_hex: msg=%s\n", msg); trace(4, "gen_hex: msg=%s\n", msg);
strncpy(mbuff, msg, 1023); strncpy(mbuff, msg, 1023);
for (p = strtok(mbuff, " "); p && narg < 256; p = strtok(NULL, " ")) for (p = strtok(mbuff, " "); p && narg < 256; p = strtok(nullptr, " "))
{ {
args[narg++] = p; args[narg++] = p;
} }