From: Jerzy Kasenberg <jerzy.kasenberg@tieto.com>
To: <linux-bluetooth@vger.kernel.org>
Cc: Jerzy Kasenberg <jerzy.kasenberg@tieto.com>
Subject: [PATCH] android/client: Fix incorrect casts of addresses
Date: Fri, 25 Oct 2013 10:51:10 +0200 [thread overview]
Message-ID: <1382691070-24358-1-git-send-email-jerzy.kasenberg@tieto.com> (raw)
This fixes printing of addresses.
If char is set to be signed (as it should) some addresses were
printed with leading FFFFFF.
---
This issue did not showed up before due to unsigned char for Android build
on Qualcomm platform.
android/client/textconv.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/android/client/textconv.c b/android/client/textconv.c
index 1188477..bcdf4d9 100644
--- a/android/client/textconv.c
+++ b/android/client/textconv.c
@@ -137,7 +137,7 @@ int int2str_findstr(const char *str, const struct int2str m[])
*/
char *bt_bdaddr_t2str(const bt_bdaddr_t *bd_addr, char *buf)
{
- const char *p = (const char *) bd_addr;
+ const uint8_t *p = bd_addr->address;
snprintf(buf, MAX_ADDR_STR_LEN, "%02x:%02x:%02x:%02x:%02x:%02x",
p[0], p[1], p[2], p[3], p[4], p[5]);
@@ -148,7 +148,7 @@ char *bt_bdaddr_t2str(const bt_bdaddr_t *bd_addr, char *buf)
/* converts string to bt_bdaddr_t */
void str2bt_bdaddr_t(const char *str, bt_bdaddr_t *bd_addr)
{
- char *p = (char *) bd_addr;
+ uint8_t *p = bd_addr->address;
sscanf(str, "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx",
&p[0], &p[1], &p[2], &p[3], &p[4], &p[5]);
--
1.7.9.5
next reply other threads:[~2013-10-25 8:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-25 8:51 Jerzy Kasenberg [this message]
2013-10-25 9:32 ` [PATCH] android/client: Fix incorrect casts of addresses Andrei Emeltchenko
2013-10-25 9:50 ` Jerzy Kasenberg
2013-10-25 10:08 ` Andrei Emeltchenko
2013-10-25 10:34 ` Luiz Augusto von Dentz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1382691070-24358-1-git-send-email-jerzy.kasenberg@tieto.com \
--to=jerzy.kasenberg@tieto.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox