Closed Bug 1027552 Opened 10 years ago Closed 10 years ago

Align values in BluetoothAttributeEvent.attrs with webidl

Categories

(Firefox OS Graveyard :: Bluetooth, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
2.0 S5 (4july)

People

(Reporter: yrliou, Assigned: yrliou)

References

Details

(Whiteboard: webbt-api)

Attachments

(1 file, 3 obsolete files)

Align the character cases with webidl enumeration.
This patch convert the value to lowercase to align with webidl enumeration definition.
Attachment #8442720 - Flags: review?(btian)
Comment on attachment 8442720 [details] [diff] [review]
Bug 1027552 - Patch : Align values in BluetoothAttributeEvent.attrs with webidl

Review of attachment 8442720 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/bluetooth2/BluetoothAdapter.cpp
@@ +840,2 @@
>      if (IsAdapterAttributeChanged(type, arr[i].value())) {
>        SetPropertyByValue(arr[i]);

nit: newline here to separate |SetPropertyByValue| and appending lower-cased attribute name.

@@ +840,4 @@
>      if (IsAdapterAttributeChanged(type, arr[i].value())) {
>        SetPropertyByValue(arr[i]);
> +      ToLowerCase(arr[i].name(), name);
> +      types.AppendElement(name);

Only the first character instead of whole string should be lower-cased, even though current attributes are all single word.
* Define a macro for converting web enum values to strings
Attachment #8442720 - Attachment is obsolete: true
Attachment #8442720 - Flags: review?(btian)
Attachment #8443223 - Flags: review?(btian)
Whiteboard: webbt-api
Comment on attachment 8443223 [details] [diff] [review]
Bug 1027552 - Patch(v2) : Align values in BluetoothAttributeEvent.attrs with webidl

Review of attachment 8443223 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/bluetooth2/BluetoothCommon.h
@@ +90,5 @@
> +  uint32_t index = uint32_t(_enum);                                  \
> +  _string.AssignASCII(_enumType##Values::strings[index].value,       \
> +                      _enumType##Values::strings[index].length);     \
> +}
> +

Also append to array in this marco since the string is always appended to an array afterwards. And use |do {...} while(0)| for macro of multiple lines.
Hi Ben,

Thanks for your comment!
I have updated the patch to address them.

Thanks,
Jocelyn
Attachment #8443223 - Attachment is obsolete: true
Attachment #8443223 - Flags: review?(btian)
Attachment #8443262 - Flags: review?(btian)
Comment on attachment 8443262 [details] [diff] [review]
Bug 1027552 - Patch(v3) : Align values in BluetoothAttributeEvent.attrs with webidl

Review of attachment 8443262 [details] [diff] [review]:
-----------------------------------------------------------------

r=me. Thanks.
Attachment #8443262 - Flags: review?(btian) → review+
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/58d386cbfe55
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → 2.0 S5 (4july)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: