r796 - /unstable/evolution-data-server/debian/patches/15_libebook-optimised-folding.patch

oysteigi-guest at users.alioth.debian.org oysteigi-guest at users.alioth.debian.org
Thu May 10 06:43:01 UTC 2007


Author: oysteigi-guest
Date: Thu May 10 06:43:00 2007
New Revision: 796

URL: http://svn.debian.org/wsvn/pkg-evolution/?sc=1&rev=796
Log:
Update vCard folding patch with improved algorithm

Modified:
    unstable/evolution-data-server/debian/patches/15_libebook-optimised-folding.patch

Modified: unstable/evolution-data-server/debian/patches/15_libebook-optimised-folding.patch
URL: http://svn.debian.org/wsvn/pkg-evolution/unstable/evolution-data-server/debian/patches/15_libebook-optimised-folding.patch?rev=796&op=diff
==============================================================================
--- unstable/evolution-data-server/debian/patches/15_libebook-optimised-folding.patch (original)
+++ unstable/evolution-data-server/debian/patches/15_libebook-optimised-folding.patch Thu May 10 06:43:00 2007
@@ -1,16 +1,16 @@
---- addressbook/libebook/e-vcard.c.orig	2007-05-01 22:30:24.000000000 +0200
-+++ addressbook/libebook/e-vcard.c	2007-05-02 00:13:59.990337883 +0200
-@@ -808,7 +808,8 @@
+diff -Nur evolution-data-server-1.10.1/addressbook/libebook/e-vcard.c evolution-data-server-1.10.1.new/addressbook/libebook/e-vcard.c
+--- evolution-data-server-1.10.1/addressbook/libebook/e-vcard.c	2007-04-09 14:42:56.000000000 +0200
++++ evolution-data-server-1.10.1.new/addressbook/libebook/e-vcard.c	2007-05-10 08:19:55.000000000 +0200
+@@ -807,7 +807,7 @@
  		GList *p;
  		EVCardAttribute *attr = l->data;
  		GString *attr_str;
 -		int l;
-+		int c;
-+		gchar *s;
++		glong len;
  
  		if (!g_ascii_strcasecmp (attr->name, "VERSION"))
  			continue;
-@@ -884,20 +885,18 @@
+@@ -883,21 +883,23 @@
  		 * When generating a content line, lines longer than 75
  		 * characters SHOULD be folded
  		 */
@@ -19,25 +19,33 @@
 -			
 -			if ((g_utf8_strlen (attr_str->str, -1) -l) > 75) {
 -				char *p;
-+		s = attr_str->str;
-+		while (TRUE)
-+		{
-+			c = 75;
-+			while (c-- > 0 && *(s = g_utf8_next_char (s)))
-+				;
- 
+-
 -				l += 75;
 -				p = g_utf8_offset_to_pointer (attr_str->str, l);
 -			
 -				g_string_insert_len (attr_str, (p - attr_str->str), CRLF " ", sizeof (CRLF " ") - 1);
 -			}
 -			else
-+			if (!*s)
- 				break;
+-				break;
 -		} while (l < g_utf8_strlen (attr_str->str, -1));
-+			g_string_insert_len (attr_str, s - attr_str->str, CRLF " ", 3);
-+			s += 2;
+-
++		len = g_utf8_strlen (attr_str->str, -1);
++		if (len > 75) {
++			GString *fold_str = g_string_sized_new (attr_str->len + len/74*3);
++			gchar *pos1 = attr_str->str;
++			gchar *pos2 = pos1;
++			pos2 = g_utf8_offset_to_pointer (pos2, 75);
++
++			do {
++				g_string_append_len (fold_str, pos1, pos2 - pos1);
++				g_string_append (fold_str, CRLF " ");
++				pos1 = pos2;
++				pos2 = g_utf8_offset_to_pointer (pos2, 74);
++			} while (pos2 < attr_str->str + attr_str->len);
++			g_string_append (fold_str, pos1);
++			g_string_free (attr_str, TRUE);
++			attr_str = fold_str;
 +		}
- 
  		g_string_append (attr_str, CRLF);
  
+ 		g_string_append (str, attr_str->str);




More information about the pkg-evolution-commits mailing list