summaryrefslogtreecommitdiffstats
path: root/include/osmocom/core/msgb.h
diff options
context:
space:
mode:
authorSteve Markgraf <steve@steve-m.de>2012-11-14 19:36:00 +0100
committerSylvain Munaut <tnt@246tNt.com>2012-11-14 20:14:33 +0100
commit5905d5be60249b2d9ca9abce4c801bc3bceed6d9 (patch)
tree6cbff75d7abe0f3c134a0ed6ad45d577cf950e7e /include/osmocom/core/msgb.h
parent866fc919acb5b8706c4814beadafe1a4da2fafd3 (diff)
msgb: fix msgb_pull_u*()
msgb_pull returns a pointer to the new begin of the buffer, unlike msgb_get(), where those functions were originally taken from. Signed-off-by: Steve Markgraf <steve@steve-m.de>
Diffstat (limited to 'include/osmocom/core/msgb.h')
-rw-r--r--include/osmocom/core/msgb.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/include/osmocom/core/msgb.h b/include/osmocom/core/msgb.h
index 36c7c0f9..a1939ab6 100644
--- a/include/osmocom/core/msgb.h
+++ b/include/osmocom/core/msgb.h
@@ -305,7 +305,7 @@ static inline unsigned char *msgb_pull(struct msgb *msgb, unsigned int len)
*/
static inline uint8_t msgb_pull_u8(struct msgb *msgb)
{
- uint8_t *space = msgb_pull(msgb, 1);
+ uint8_t *space = msgb_pull(msgb, 1) - 1;
return space[0];
}
/*! \brief remove uint16 from front of message
@@ -314,7 +314,7 @@ static inline uint8_t msgb_pull_u8(struct msgb *msgb)
*/
static inline uint16_t msgb_pull_u16(struct msgb *msgb)
{
- uint8_t *space = msgb_pull(msgb, 2);
+ uint8_t *space = msgb_pull(msgb, 2) - 2;
return space[0] << 8 | space[1];
}
/*! \brief remove uint32 from front of message
@@ -323,7 +323,7 @@ static inline uint16_t msgb_pull_u16(struct msgb *msgb)
*/
static inline uint32_t msgb_pull_u32(struct msgb *msgb)
{
- uint8_t *space = msgb_pull(msgb, 4);
+ uint8_t *space = msgb_pull(msgb, 4) - 4;
return space[0] << 24 | space[1] << 16 | space[2] << 8 | space[3];
}