[PATCH obexd 5/6] Fix phone number printing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Previously, it was trynig to create string (stored in "buf" buffer)
containing "%s" formatting piece for "vcard_printf" function and "number"
field. In this case "\%" is not valid escape sequence (for percent
character, "%%" is a valid sequence) - backslash is ignored, so sequence
"\%s" is treated as "%s" and replaced by string for "number" field,
hence "vcard_printf" function has nothing to do with "number" field, since
"buf" does not contain any "%s" formatting sequence (to get this
formatting sequence "buf" should contain "%%s" sequence).
However, this patch make simplification for printing phone number field by
avoiding storing formatting pieces (for instance "%%s") in "buf".
Now string for phone number field is stored directly in "buf" which is
simply passed to "vcard_printf" function (which uses "%s" formatting
string for this purpose).
---
 plugins/vcard.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/plugins/vcard.c b/plugins/vcard.c
index 88851a6..3e978ee 100644
--- a/plugins/vcard.c
+++ b/plugins/vcard.c
@@ -434,10 +434,10 @@ static void vcard_printf_number(GString *vcards, uint8_t format,
 	if ((type == TYPE_INTERNATIONAL) && (number[0] != '+'))
 		intl = "+";
 
-	snprintf(buf, sizeof(buf), "TEL;%s:%s\%s", category_string,
+	snprintf(buf, sizeof(buf), "TEL;%s:%s%s", category_string,
 								intl, number);
 
-	vcard_printf(vcards, buf, number);
+	vcard_printf(vcards, "%s", buf);
 }
 
 static void vcard_printf_tag(GString *vcards, uint8_t format,
-- 
1.6.3.3

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux