linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH obexd 1/6] Support for semicolon escaping
@ 2011-07-20  7:11 Rafal Michalski
  2011-07-20  7:11 ` [PATCH obexd 2/6] Add escaping selection method Rafal Michalski
  2011-07-26 10:13 ` [PATCH obexd 1/6] Support for semicolon escaping Johan Hedberg
  0 siblings, 2 replies; 7+ messages in thread
From: Rafal Michalski @ 2011-07-20  7:11 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Rafal Michalski

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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-07-26 10:13 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-20  7:11 [PATCH obexd 1/6] Support for semicolon escaping Rafal Michalski
2011-07-20  7:11 ` [PATCH obexd 2/6] Add escaping selection method Rafal Michalski
2011-07-20  7:11   ` [PATCH obexd 3/6] Support for "quoted printable" encoding Rafal Michalski
2011-07-20  7:11     ` [PATCH obexd 4/6] Add encoding selection method Rafal Michalski
2011-07-20  7:11       ` [PATCH obexd 5/6] Fix phone number printing Rafal Michalski
2011-07-20  7:11         ` [PATCH obexd 6/6] Adjust escaping and encoding in vcard module Rafal Michalski
2011-07-26 10:13 ` [PATCH obexd 1/6] Support for semicolon escaping Johan Hedberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).