[PATCH obexd 1/6] Support for semicolon escaping

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

 



According to specification of vcard 2.1, semicolon is only character
which is escaped with a backslash character (in vcard's property field
content). This patch provides "escape_semicolon" function which handles
this issue.
---
 plugins/vcard.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/plugins/vcard.c b/plugins/vcard.c
index b997fc4..4f61368 100644
--- a/plugins/vcard.c
+++ b/plugins/vcard.c
@@ -149,6 +149,20 @@ static void get_escaped_fields(char **fields, ...)
 	*fields = g_string_free(line, FALSE);
 }
 
+static void escape_semicolon(char *dest, const char *src, int len_max, int len)
+{
+	int i, j;
+
+	for (i = 0, j = 0; i < len && j < len_max - 1; i++, j++) {
+		if (src[i] == ';')
+			dest[j++] = '\\';
+
+		dest[j] = src[i];
+	}
+
+	dest[j] = 0;
+}
+
 static void vcard_printf_begin(GString *vcards, uint8_t format)
 {
 	vcard_printf(vcards, "BEGIN:VCARD");
-- 
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