Fix #6373, second try
* make BDADDR_* macros refer to value types instead of addresses * adjust all interfaces using bdaddr_t* to use (mostly const) refs instead, which IMHO makes the interface & code clearer * that got rid of a couple of const incorrectness casts * some cleanup along the way git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38265 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -34,15 +34,15 @@ public:
|
||||
}
|
||||
|
||||
|
||||
static bool Compare(const bdaddr_t* ba1, const bdaddr_t* ba2)
|
||||
static bool Compare(const bdaddr_t& ba1, const bdaddr_t& ba2)
|
||||
{
|
||||
return (memcmp(ba1, ba2, sizeof(bdaddr_t)) == 0);
|
||||
return (memcmp(&ba1, &ba2, sizeof(bdaddr_t)) == 0);
|
||||
}
|
||||
|
||||
|
||||
static void Copy(bdaddr_t* dst, const bdaddr_t* src)
|
||||
static void Copy(bdaddr_t& dst, const bdaddr_t& src)
|
||||
{
|
||||
memcpy(dst, src, sizeof(bdaddr_t));
|
||||
memcpy(&dst, &src, sizeof(bdaddr_t));
|
||||
}
|
||||
|
||||
static char* ToString(const bdaddr_t bdaddr)
|
||||
|
||||
@@ -25,9 +25,9 @@ typedef struct {
|
||||
} __attribute__((packed)) bdaddr_t;
|
||||
|
||||
|
||||
#define BDADDR_NULL (&(bdaddr_t) {{0, 0, 0, 0, 0, 0}})
|
||||
#define BDADDR_LOCAL (&(bdaddr_t) {{0, 0, 0, 0xff, 0xff, 0xff}})
|
||||
#define BDADDR_BROADCAST (&(bdaddr_t) {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff}})
|
||||
#define BDADDR_NULL ((bdaddr_t) {{0, 0, 0, 0, 0, 0}})
|
||||
#define BDADDR_LOCAL ((bdaddr_t) {{0, 0, 0, 0xff, 0xff, 0xff}})
|
||||
#define BDADDR_BROADCAST ((bdaddr_t) {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff}})
|
||||
#define BDADDR_ANY BDADDR_BROADCAST
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user