[maemo-commits] [maemo-commits] r14751 - in projects/haf/trunk/gtkhtml: debian upstream/patches

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Fri Nov 9 15:55:02 EET 2007
Author: schulhof
Date: 2007-11-09 15:54:59 +0200 (Fri, 09 Nov 2007)
New Revision: 14751

Added:
   projects/haf/trunk/gtkhtml/upstream/patches/gtkhtml_260_utf8_text_search_backport.diff
Modified:
   projects/haf/trunk/gtkhtml/debian/changelog
Log:
  * Replace substring search with UTF-8-aware upstream version
  * Fixes: NB#75033


Modified: projects/haf/trunk/gtkhtml/debian/changelog
===================================================================
--- projects/haf/trunk/gtkhtml/debian/changelog	2007-11-09 12:35:53 UTC (rev 14750)
+++ projects/haf/trunk/gtkhtml/debian/changelog	2007-11-09 13:54:59 UTC (rev 14751)
@@ -1,3 +1,10 @@
+gtkhtml (3.9.1-3osso13) unstable; urgency=low
+
+  * Replace substring search with UTF-8-aware upstream version
+  * Fixes: NB#75033
+
+ -- Gabriel Schulhof <gabriel.schulhof at nokia.com>  Fri,  9 Nov 2007 15:47:03 +0200
+
 gtkhtml (3.9.1-3osso12) unstable; urgency=low
 
   * Back out of regex search and report FALSE if regcomp fails

Added: projects/haf/trunk/gtkhtml/upstream/patches/gtkhtml_260_utf8_text_search_backport.diff
===================================================================
--- projects/haf/trunk/gtkhtml/upstream/patches/gtkhtml_260_utf8_text_search_backport.diff	2007-11-09 12:35:53 UTC (rev 14750)
+++ projects/haf/trunk/gtkhtml/upstream/patches/gtkhtml_260_utf8_text_search_backport.diff	2007-11-09 13:54:59 UTC (rev 14751)
@@ -0,0 +1,38 @@
+diff -ru gtkhtml-3.13.91/src/htmlclueflow.c gtkhtml-3.13.91-utf8-text-search-backport/src/htmlclueflow.c
+--- gtkhtml-3.13.91/src/htmlclueflow.c	2007-02-09 21:54:58.000000000 +0200
++++ gtkhtml-3.13.91-utf8-text-search-backport/src/htmlclueflow.c	2007-11-08 14:17:16.000000000 +0200
+@@ -2342,16 +2342,25 @@
+ 				/* substring search - simple one - could be improved
+ 				   go thru par and look for info->text */
+ 				while (par [index]) {
+-					if (info->trans [(guchar) info->text
+-							[(info->forward) ? eq_bytes : info->text_bytes - eq_bytes - 1]]
+-					    == info->trans [par [index]]) {
+-						eq_bytes ++;
++					gunichar unicode_info, unicode_par;
++
++					unicode_info = g_utf8_get_char (((info->forward)
++									? (info->text + eq_bytes)
++									: g_utf8_prev_char (info->text + info->text_bytes - eq_bytes)));
++					unicode_par = g_utf8_get_char ((gchar *) par + index);
++					if (!info->case_sensitive) {
++                                             unicode_info = g_unichar_toupper (unicode_info);
++				 	     unicode_par  = g_unichar_toupper (unicode_par);
++					}
++
++               				if (unicode_info == unicode_par) {
++						eq_bytes += (guchar *)g_utf8_next_char (par + index) - par - index;
++
+ 						if (eq_bytes == info->text_bytes) {
+-							search_set_info (head, info, par,
+-									 index - (info->forward
+-										  ? -(((guchar *) g_utf8_next_char (par + index - eq_bytes)) - par - index)
+-										  : 0),
+-									 info->text_bytes);
++							/* The above par + index is always at the beginning of the last character matched */
++							if (info->forward)
++								index = (guchar *) g_utf8_next_char ((gchar *) par + index) - par - eq_bytes;
++							search_set_info (head, info, par, index, info->text_bytes);
+ 							retval=TRUE;
+ 							break;
+ 						}


More information about the maemo-commits mailing list