Change in libosmo-netif[master]: amr: use sizeof(struct amr_hdr) when working with amr header length
dexter
gerrit-no-reply at lists.osmocom.org
Wed Mar 20 14:45:12 UTC 2019
dexter has uploaded this change for review. ( https://gerrit.osmocom.org/13346
Change subject: amr: use sizeof(struct amr_hdr) when working with amr header length
......................................................................
amr: use sizeof(struct amr_hdr) when working with amr header length
The header of an AMR header payload is 2 bytes long. At the moment we
use just a constant of 2 when we refer to the header length, but we have a
struct amr_hdr defined. Lets use sizeof(struct amr_hdr) to make it more
clear that we are refering to the header length.
Change-Id: Ic7ca04b99a97d7d3b91717b0c3e6c55ef3001a3e
---
M src/amr.c
1 file changed, 3 insertions(+), 3 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/46/13346/1
diff --git a/src/amr.c b/src/amr.c
index 9c63f60..5609c46 100644
--- a/src/amr.c
+++ b/src/amr.c
@@ -82,7 +82,7 @@
unsigned int frame_len;
/* Broken payload? */
- if (!payload || payload_len < 2)
+ if (!payload || payload_len < sizeof(struct amr_hdr))
return false;
/* In octet aligned mode, padding bits are specified to be
@@ -106,7 +106,7 @@
if(!osmo_amr_ft_valid(oa_hdr->ft))
return false;
frame_len = osmo_amr_bytes(oa_hdr->ft);
- if (frame_len != payload_len - 2)
+ if (frame_len != payload_len - sizeof(struct amr_hdr))
return false;
return true;
@@ -119,7 +119,7 @@
int osmo_amr_oa_to_bwe(uint8_t *payload, unsigned int payload_len)
{
struct amr_hdr *oa_hdr = (struct amr_hdr *)payload;
- unsigned int frame_len = payload_len - 2;
+ unsigned int frame_len = payload_len - sizeof(struct amr_hdr);
unsigned int i;
/* This implementation is not capable to handle multi-frame
--
To view, visit https://gerrit.osmocom.org/13346
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic7ca04b99a97d7d3b91717b0c3e6c55ef3001a3e
Gerrit-Change-Number: 13346
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190320/408fbb79/attachment-0001.html>
More information about the gerrit-log
mailing list