Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Bug 1227907 - Support PAN feature on bluetoothd, r=tzimmermann #40

Merged
merged 1 commit into from Dec 4, 2015

Conversation

chihweitung
Copy link

No description provided.

@@ -0,0 +1,315 @@
/*
* Copyright (C) 2014-2015 Mozilla Foundation
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only '2015'

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))
Copy link
Contributor

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]|.

Copy link
Author

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.

ALOGD("strnlen < 0");
return -1;
}
else if (len < IFNAME_LEN) {
Copy link
Contributor

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.

Copy link
Author

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. "

* Protocol helper
*/

long
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make this static

@chihweitung chihweitung changed the title Bug 1227907 - Support PAN feature on bluetoothd - bluetoothd change Bug 1227907 - Support PAN feature on bluetoothd Dec 4, 2015
@chihweitung chihweitung changed the title Bug 1227907 - Support PAN feature on bluetoothd Bug 1227907 - Support PAN feature on bluetoothd, r=tzimmermann Dec 4, 2015
BavarianTomcat added a commit that referenced this pull request Dec 4, 2015
Bug 1227907 - Support PAN feature on bluetoothd. r=tzimmermann
@BavarianTomcat BavarianTomcat merged commit c7316de into mozilla-b2g:master Dec 4, 2015
KWierso added a commit that referenced this pull request Dec 4, 2015
…5l and emulator l build bustage

This reverts commit c7316de, reversing
changes made to bdb3469.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants