fix subheader parsing

master
Andre Puschmann 7 years ago
parent 8b04d7c308
commit c5b423ffee

@ -136,13 +136,12 @@ public:
nof_subheaders = 0;
bool ret = false;
do {
if (nof_subheaders < (int) max_subheaders) {
if (nof_subheaders < (int)max_subheaders) {
ret = subheaders[nof_subheaders].read_subheader(&ptr);
nof_subheaders++;
}
} while (ret && nof_subheaders < (int) max_subheaders);
if (nof_subheaders + 1 < (int) max_subheaders) {
nof_subheaders++;
}
} while (ret && (nof_subheaders + 1) < (int)max_subheaders);
for (int i=0;i<nof_subheaders;i++) {
subheaders[i].read_payload(&ptr);
}

@ -122,7 +122,7 @@ uint8_t* sch_pdu::write_packet(srslte::log *log_h)
sch_subh padding;
padding.set_padding();
if (nof_subheaders <= 0 && nof_subheaders < max_subheaders) {
if (nof_subheaders <= 0 && nof_subheaders < (int)max_subheaders) {
log_h->error("Trying to write packet with invalid number of subheaders (nof_subheaders=%d).\n", nof_subheaders);
log_h->console("Trying to write packet with invalid number of subheaders (nof_subheaders=%d).\n", nof_subheaders);
return NULL;

Loading…
Cancel
Save