-
Notifications
You must be signed in to change notification settings - Fork 16
Bug 1227907 - Support PAN feature on bluetoothd, r=tzimmermann #40
Conversation
@@ -0,0 +1,315 @@ | |||
/* | |||
* Copyright (C) 2014-2015 Mozilla Foundation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only '2015'
aad7a3b
to
a8e1962
Compare
if ((append_to_pdu(&wbuf->buf.pdu, "C", (uint8_t)state) < 0) || | ||
(append_to_pdu(&wbuf->buf.pdu, "C", (uint8_t)error) < 0) || | ||
(append_to_pdu(&wbuf->buf.pdu, "C", (uint8_t)local_role) < 0) || | ||
(append_to_pdu(&wbuf->buf.pdu, "0", ifname) < 0)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a function |append_ifname| that packs the name and the padding. Call it from here.
This function's implementation should have less overhead than the current one. The format code "0" calls |strlen| internally and you're call |strnlen| below. Please don't do this. Instead:
- check the length if |ifname| first
- write the bytes using "m"
- write the remaining padding bytes using "m"
Please don't call |malloc|. The padding buffer is 17 bytes at most, so allocated it in the heap with |static const uint8_t padding[IFNAME_LEN]|.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK! I will write a function |append_bt_ifname| in file src/bt_proto.c to deal with interface name and padding problems.
a8e1962
to
193d06d
Compare
ALOGD("strnlen < 0"); | ||
return -1; | ||
} | ||
else if (len < IFNAME_LEN) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please put the error handling into this branch and move the 'real' code out of it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. Sorry for my bad coding style. "
193d06d
to
9e9ca34
Compare
* Protocol helper | ||
*/ | ||
|
||
long |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make this static
9e9ca34
to
26be3d3
Compare
26be3d3
to
9f27023
Compare
Bug 1227907 - Support PAN feature on bluetoothd. r=tzimmermann
No description provided.