Closed Bug 1216195 Opened 4 years ago Closed 4 years ago

use mozilla/Endian.h facilities in bluetooth code

Categories

(Firefox OS Graveyard :: Bluetooth, defect)

defect
Not set

Tracking

(firefox44 fixed)

RESOLVED FIXED
FxOS-S10 (30Oct)
Tracking Status
firefox44 --- fixed

People

(Reporter: froydnj, Assigned: froydnj)

Details

Attachments

(1 file)

We have a number of functions in mozilla/Endian.h for doing endianness
conversions, and these functions should be used instead of hand-rolled
functions.  Using those functions in the bluetooth code makes the code
clearer and more portable (ReadLittleEndianUint16 won't do the right
thing if we're running on a big-endian processor, for instance).
Endian.h is also careful to avoid assumptions about memory alignment,
which utility functions like ReadLittleEndianUint16 don't do.
Comment on attachment 8675764 [details] [diff] [review]
use mozilla/Endian.h facilities in bluetooth code

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

r=me with comment addressed. Thanks for fixing this!

::: dom/bluetooth/bluedroid/BluetoothMapSmsManager.cpp
@@ +724,5 @@
>  
>    // Folder listing size
>    int foldersize = mCurrentFolder->GetSubFolderCount();
>  
>    // Convert little endian to big endian

remove this redundant comment.

::: dom/bluetooth/bluedroid/BluetoothPbapManager.cpp
@@ +11,5 @@
>  #include "BluetoothSocket.h"
>  #include "BluetoothUtils.h"
>  #include "BluetoothUuid.h"
>  
> +#include "mozilla/Endian.h"

nit: alphabetical order. move this include to right before "File.h".

::: dom/bluetooth/bluedroid/BluetoothSocketMessageWatcher.cpp
@@ +9,5 @@
>  #include <unistd.h>
>  #include <sys/socket.h>
>  #include "BluetoothInterface.h"
>  #include "nsClassHashtable.h"
> +#include "mozilla/Endian.h"

nit: alphabetical order. move this include to right before "nsClassHashtable.h".
Attachment #8675764 - Flags: review?(btian) → review+
https://hg.mozilla.org/mozilla-central/rev/38f2959a97b2
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → FxOS-S10 (30Oct)
You need to log in before you can comment on or make changes to this bug.