You can now initialize a cwmsg with radioinfo = NULL.

FossilOrigin-Name: 39679f35349c4300c42d957d60c431260cf1b71f75abc99d324244250df81658
This commit is contained in:
7u83@mail.ru 2014-08-15 10:47:33 +00:00
parent 2e88be5bec
commit 5eb00fb6c8
1 changed files with 10 additions and 11 deletions

View File

@ -29,19 +29,18 @@ void cwmsg_init(struct cwmsg * cwmsg, uint8_t *buffer, int type, int seqnum, str
cwmsg->trnsprthdr=buffer;
int rmaclen=0;
cwmsg->flags=0;
int rmaclen;
if (radioinfo->rmac[0]){
/* we assume the radio mac is already aligned */
rmaclen=(*radioinfo->rmac);
memcpy(buffer+8,radioinfo->rmac,rmaclen/8+8);
cwmsg->flags=CWTH_FLAGS_M;
}
else
{
cwmsg->flags=0;
rmaclen=0;
if (radioinfo){
if (radioinfo->rmac[0]){
/* we assume the radio mac is already aligned */
rmaclen=(*radioinfo->rmac);
memcpy(buffer+8,radioinfo->rmac,rmaclen/8+8);
cwmsg->flags=CWTH_FLAGS_M;
}
}
hlen+=rmaclen;
if (hlen%4)
hlen = (hlen>>2)*4+4;