fixeria has uploaded this change for review.
llc: gprs_llc_hdr_parse(): make the input data pointer const
Change-Id: I9757d2be5af589ccbe4d3d406637a33690284754
---
M include/osmocom/sgsn/gprs_llc.h
M src/gprs/gprs_llc_parse.c
2 files changed, 6 insertions(+), 6 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/79/29279/1
diff --git a/include/osmocom/sgsn/gprs_llc.h b/include/osmocom/sgsn/gprs_llc.h
index 2c6c98b..fb9db37 100644
--- a/include/osmocom/sgsn/gprs_llc.h
+++ b/include/osmocom/sgsn/gprs_llc.h
@@ -275,7 +275,7 @@
/* parse a GPRS LLC header, also check for invalid frames */
int gprs_llc_hdr_parse(struct gprs_llc_hdr_parsed *ghp,
- uint8_t *llc_hdr, int len);
+ const uint8_t *llc_hdr, int len);
void gprs_llc_hdr_dump(struct gprs_llc_hdr_parsed *gph, struct gprs_llc_lle *lle);
int gprs_llc_fcs(uint8_t *data, unsigned int len);
diff --git a/src/gprs/gprs_llc_parse.c b/src/gprs/gprs_llc_parse.c
index 1d97004..684252b 100644
--- a/src/gprs/gprs_llc_parse.c
+++ b/src/gprs/gprs_llc_parse.c
@@ -91,9 +91,9 @@
/* parse a GPRS LLC header, also check for invalid frames */
int gprs_llc_hdr_parse(struct gprs_llc_hdr_parsed *ghp,
- uint8_t *llc_hdr, int len)
+ const uint8_t *llc_hdr, int len)
{
- uint8_t *ctrl = llc_hdr+1;
+ const uint8_t *ctrl = llc_hdr+1;
if (len <= CRC24_LENGTH)
return -EIO;
@@ -135,7 +135,7 @@
/* I (Information transfer + Supervisory) format */
uint8_t k;
- ghp->data = ctrl + 3;
+ ghp->data = (uint8_t *)&ctrl[3];
if (ctrl[0] & 0x40)
ghp->ack_req = 1;
@@ -190,7 +190,7 @@
} else if ((ctrl[0] & 0xe0) == 0xc0) {
/* UI (Unconfirmed Inforamtion) format */
ghp->cmd = GPRS_LLC_UI;
- ghp->data = ctrl + 2;
+ ghp->data = (uint8_t *)&ctrl[2];
ghp->data_len = (llc_hdr + len - 3) - ghp->data;
ghp->seq_tx = (ctrl[0] & 0x7) << 6;
@@ -232,7 +232,7 @@
break;
case GPRS_LLC_U_XID:
ghp->cmd = GPRS_LLC_XID;
- ghp->data = ctrl + 1;
+ ghp->data = (uint8_t *)&ctrl[1];
ghp->data_len = (llc_hdr + len - 3) - ghp->data;
break;
default:
To view, visit change 29279. To unsubscribe, or for help writing mail filters, visit settings.