mirror of
https://git.kernel.org/pub/scm/bluetooth/bluez.git
synced 2024-11-26 21:54:33 +08:00
Fix display of text strings
This commit is contained in:
parent
a330124c26
commit
4312264fa4
@ -561,7 +561,6 @@ static void print_tree_attr(sdp_record_t *rec)
|
|||||||
static void print_raw_data(sdp_data_t *data, int indent)
|
static void print_raw_data(sdp_data_t *data, int indent)
|
||||||
{
|
{
|
||||||
struct uuid_def *def;
|
struct uuid_def *def;
|
||||||
char *str;
|
|
||||||
int i, hex;
|
int i, hex;
|
||||||
|
|
||||||
if (!data)
|
if (!data)
|
||||||
@ -661,25 +660,18 @@ static void print_raw_data(sdp_data_t *data, int indent)
|
|||||||
case SDP_TEXT_STR8:
|
case SDP_TEXT_STR8:
|
||||||
case SDP_TEXT_STR16:
|
case SDP_TEXT_STR16:
|
||||||
case SDP_TEXT_STR32:
|
case SDP_TEXT_STR32:
|
||||||
str = data->val.str;
|
hex = 0;
|
||||||
if (data->unitSize > strlen(str) + 1) {
|
for (i = 0; i < data->unitSize; i++)
|
||||||
hex = 0;
|
if (!isprint(data->val.str[i])) {
|
||||||
for (i = 0; i < data->unitSize - 1; i++)
|
|
||||||
if (!isprint(str[i])) {
|
|
||||||
hex = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (str[data->unitSize - 1] != '\0')
|
|
||||||
hex = 1;
|
hex = 1;
|
||||||
} else
|
break;
|
||||||
hex = 0;
|
}
|
||||||
if (hex) {
|
for (i = 0; i < data->unitSize; i++)
|
||||||
printf("String");
|
if (hex)
|
||||||
for (i = 0; i < data->unitSize; i++)
|
printf(" %02x", (unsigned char) data->val.str[i]);
|
||||||
printf(" %02x", (unsigned char) str[i]);
|
else
|
||||||
printf("\n");
|
printf("%c", data->val.str[i]);
|
||||||
} else
|
printf("\n");
|
||||||
printf("String %s\n", str);
|
|
||||||
break;
|
break;
|
||||||
case SDP_URL_STR8:
|
case SDP_URL_STR8:
|
||||||
case SDP_URL_STR16:
|
case SDP_URL_STR16:
|
||||||
|
Loading…
Reference in New Issue
Block a user