|
From: Peter K. <pk...@us...> - 2001-05-29 10:04:14
|
The following files were modified in apps/bluetooth/experimental:
Name Old version New version Comment
---- ----------- ----------- -------
bt_if.c 1.15 1.16=20=20=20=20=20=20=20=20=20=20=20=20
bt_if.h 1.9 1.10=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Added a hack to convert from ISO 8859-1 to UTF-8 in bt_set_local_name().
The diff of the modified file(s):
--- bt_if.c 2001/05/14 11:47:45 1.15
+++ bt_if.c 2001/05/29 10:04:12 1.16
@@ -858,17 +858,36 @@
=20
}
=20
-void bt_set_local_name(int bt_cfd, const char *name)
+void bt_set_local_name(int bt_cfd, const unsigned char *name)
{
- syslog(LOG_INFO, "bt_set_local_name %s", name);
+ unsigned char buffer[248];
+ int i =3D 0;
+
+ syslog(LOG_INFO, __FUNCTION__ ": %s", name);
+
+ /* Hack to convert ISO 8859-1 to UTF-8 */
+ for (; *name && i < sizeof buffer - 3; name++)
+ {
+ if (*name < 128)
+ {
+ buffer[i++] =3D *name;
+ }
+ else
+ {
+ buffer[i++] =3D 0xC0 | (*name >> 6);
+ buffer[i++] =3D 0x80 | (*name & 0x3F);
+ }
+ }
+ buffer[i] =3D '\0';
+
#ifndef BT_USERSTACK=20=20
- if (ioctl(bt_cfd, HCISETLOCALNAME, name) < 0)
+ if (ioctl(bt_cfd, HCISETLOCALNAME, buffer) < 0)
{
perror(__FUNCTION__);
exit(1);
}
#else
- hci_change_local_name(name);
+ hci_change_local_name(buffer);
#endif
}
=20
--- bt_if.h 2001/05/14 11:09:22 1.9
+++ bt_if.h 2001/05/29 10:04:12 1.10
@@ -326,7 +326,7 @@
void set_local_hostname(int bt_cfd, const char *local_name);
=20
/* Sets friendly name to name */
-void bt_set_local_name(int bt_cfd, const char *name);
+void bt_set_local_name(int bt_cfd, const unsigned char *name);
/*=20
* Misc functions=20
*/
|