diff options
author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2014-08-25 17:22:52 +0300 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2014-08-26 13:24:38 +0300 |
commit | 450f9ea3be8d61ed9e7fb96676893dca4087ae1e (patch) | |
tree | e669666cc809a8af47c57f2900c5f03ccf52dccf /monitor/l2cap.h | |
parent | 8bcfc8b71b36015093b44d0edf9d283cd21ee1a5 (diff) | |
download | bluez-450f9ea3be8d61ed9e7fb96676893dca4087ae1e.tar.gz |
monitor: Make l2cap_frame_get* function to return bool
Diffstat (limited to 'monitor/l2cap.h')
-rw-r--r-- | monitor/l2cap.h | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/monitor/l2cap.h b/monitor/l2cap.h index 645e3ef6a..5faaea610 100644 --- a/monitor/l2cap.h +++ b/monitor/l2cap.h @@ -54,38 +54,38 @@ static inline void l2cap_frame_pull(struct l2cap_frame *frame, frame->size = source->size - len; } -static inline int l2cap_frame_get_u8(struct l2cap_frame *frame, uint8_t *value) +static inline bool l2cap_frame_get_u8(struct l2cap_frame *frame, uint8_t *value) { if (frame->size < sizeof(*value)) - return -1; + return false; if (value) *value = *((uint8_t *) frame->data); l2cap_frame_pull(frame, frame, sizeof(*value)); - return 0; + return true; } -static inline int l2cap_frame_get_be16(struct l2cap_frame *frame, +static inline bool l2cap_frame_get_be16(struct l2cap_frame *frame, uint16_t *value) { if (frame->size < sizeof(*value)) - return -1; + return false; if (value) *value = get_be16(frame->data); l2cap_frame_pull(frame, frame, sizeof(*value)); - return 0; + return true; } -static inline int l2cap_frame_get_le16(struct l2cap_frame *frame, +static inline bool l2cap_frame_get_le16(struct l2cap_frame *frame, uint16_t *value) { if (frame->size < sizeof(*value)) - return -1; + return false; if (value) *value = get_le16(frame->data); @@ -95,60 +95,60 @@ static inline int l2cap_frame_get_le16(struct l2cap_frame *frame, return 0; } -static inline int l2cap_frame_get_be32(struct l2cap_frame *frame, +static inline bool l2cap_frame_get_be32(struct l2cap_frame *frame, uint32_t *value) { if (frame->size < sizeof(*value)) - return -1; + return false; if (value) *value = get_be32(frame->data); l2cap_frame_pull(frame, frame, sizeof(*value)); - return 0; + return true; } -static inline int l2cap_frame_get_le32(struct l2cap_frame *frame, +static inline bool l2cap_frame_get_le32(struct l2cap_frame *frame, uint32_t *value) { if (frame->size < sizeof(*value)) - return -1; + return false; if (value) *value = get_le32(frame->data); l2cap_frame_pull(frame, frame, sizeof(*value)); - return 0; + return true; } -static inline int l2cap_frame_get_be64(struct l2cap_frame *frame, +static inline bool l2cap_frame_get_be64(struct l2cap_frame *frame, uint64_t *value) { if (frame->size < sizeof(*value)) - return -1; + return false; if (value) *value = get_be64(frame->data); l2cap_frame_pull(frame, frame, sizeof(*value)); - return 0; + return true; } -static inline int l2cap_frame_get_le64(struct l2cap_frame *frame, +static inline bool l2cap_frame_get_le64(struct l2cap_frame *frame, uint64_t *value) { if (frame->size < sizeof(*value)) - return -1; + return false; if (value) *value = get_le64(frame->data); l2cap_frame_pull(frame, frame, sizeof(*value)); - return 0; + return true; } void l2cap_packet(uint16_t index, bool in, uint16_t handle, uint8_t flags, |