bluez/0001-Handle-ISO8859-1-device-names.patch

39 lines
1.1 KiB
Diff
Raw Normal View History

2011-01-13 14:52:36 +00:00
From 1dea0eac302036bd165f9e3e386c40da25512005 Mon Sep 17 00:00:00 2001
2010-11-08 16:46:58 +00:00
From: Bastien Nocera <hadess@hadess.net>
Date: Mon, 8 Nov 2010 16:43:42 +0000
2011-01-13 14:52:36 +00:00
Subject: [PATCH 3/3] Handle ISO8859-1 device names
2010-11-08 16:46:58 +00:00
http://thread.gmane.org/gmane.linux.bluez.kernel/1687
https://bugzilla.redhat.com/show_bug.cgi?id=450081
---
src/event.c | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/src/event.c b/src/event.c
2011-01-13 14:52:36 +00:00
index 5d0bf6d..dc58dbd 100644
2010-11-08 16:46:58 +00:00
--- a/src/event.c
+++ b/src/event.c
2011-01-13 14:52:36 +00:00
@@ -652,9 +652,16 @@ void btd_event_remote_name(bdaddr_t *local, bdaddr_t *peer, uint8_t status,
2010-11-08 16:46:58 +00:00
/* It's ok to cast end between const and non-const since
* we know it points to inside of name which is non-const */
- if (!g_utf8_validate(name, -1, (const char **) &end))
- *end = '\0';
-
+ if (!g_utf8_validate(name, -1, (const char **) &end)) {
+ char *utf8_name;
+
+ utf8_name = g_convert(name, -1, "UTF-8", "ISO-8859-1", NULL, NULL, NULL);
+ if (utf8_name) {
+ memcpy(name, utf8_name, 248);
+ g_free(utf8_name);
+ } else
+ *end = '\0';
+ }
write_device_name(local, peer, name);
}
--
1.7.3.2