diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2005-12-09 09:09:33 +0000 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2005-12-09 09:09:33 +0000 |
commit | 4312264fa42014771b188da1d61c3911026390e8 (patch) | |
tree | 2095efbefb48d4c6d62c1b76cfb9f29a154814c0 /tools/sdptool.c | |
parent | a330124c26567659f373575e48d63852a96a18b3 (diff) |
Fix display of text strings
Diffstat (limited to 'tools/sdptool.c')
-rw-r--r-- | tools/sdptool.c | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/tools/sdptool.c b/tools/sdptool.c index 6074ef77..2fcd0c7a 100644 --- a/tools/sdptool.c +++ b/tools/sdptool.c @@ -561,7 +561,6 @@ static void print_tree_attr(sdp_record_t *rec) static void print_raw_data(sdp_data_t *data, int indent) { struct uuid_def *def; - char *str; int i, hex; if (!data) @@ -661,25 +660,18 @@ static void print_raw_data(sdp_data_t *data, int indent) case SDP_TEXT_STR8: case SDP_TEXT_STR16: case SDP_TEXT_STR32: - str = data->val.str; - if (data->unitSize > strlen(str) + 1) { - hex = 0; - for (i = 0; i < data->unitSize - 1; i++) - if (!isprint(str[i])) { - hex = 1; - break; - } - if (str[data->unitSize - 1] != '\0') + hex = 0; + for (i = 0; i < data->unitSize; i++) + if (!isprint(data->val.str[i])) { hex = 1; - } else - hex = 0; - if (hex) { - printf("String"); - for (i = 0; i < data->unitSize; i++) - printf(" %02x", (unsigned char) str[i]); - printf("\n"); - } else - printf("String %s\n", str); + break; + } + for (i = 0; i < data->unitSize; i++) + if (hex) + printf(" %02x", (unsigned char) data->val.str[i]); + else + printf("%c", data->val.str[i]); + printf("\n"); break; case SDP_URL_STR8: case SDP_URL_STR16: |