patches/eel-01-multibyte-bookmark-menu.diff
author rohinis
Tue, 29 Nov 2011 17:32:55 +0000
branchs11express-2010-11
changeset 22234 c23e64da3e06
parent 17516 f7f802c00470
permissions -rw-r--r--
2011-11-29 Rohini S <[email protected]> * patches/Python26-22-audio.diff: Fixes CVE-2010-1634 * specs/SUNWPython26.spec: Fixes CR 7085446
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5518
235b0b4aa324 merged the gnome-2-10 branch to HEAD
laca
parents: 4737
diff changeset
     1
--- eel-2.10.1/eel/eel-string.c	2002-03-19 03:05:08.000000000 +0530
235b0b4aa324 merged the gnome-2-10 branch to HEAD
laca
parents: 4737
diff changeset
     2
+++ eel-2.10.1-new/eel/eel-string.c	2005-05-13 15:09:48.219632000 +0530
11725
b731d2d412a2 2008-02-26 Damien Carbery <[email protected]>
dcarbery
parents: 11349
diff changeset
     3
@@ -29,6 +29,8 @@
4737
f4351b2cd9d7 2004-12-10 Suresh Chandrasekharan <[email protected]>
sureshc
parents:
diff changeset
     4
 #include <locale.h>
f4351b2cd9d7 2004-12-10 Suresh Chandrasekharan <[email protected]>
sureshc
parents:
diff changeset
     5
 #include <stdlib.h>
11725
b731d2d412a2 2008-02-26 Damien Carbery <[email protected]>
dcarbery
parents: 11349
diff changeset
     6
 #include <string.h>
4737
f4351b2cd9d7 2004-12-10 Suresh Chandrasekharan <[email protected]>
sureshc
parents:
diff changeset
     7
+#include <ctype.h>
f4351b2cd9d7 2004-12-10 Suresh Chandrasekharan <[email protected]>
sureshc
parents:
diff changeset
     8
+#include <glib.h>
f4351b2cd9d7 2004-12-10 Suresh Chandrasekharan <[email protected]>
sureshc
parents:
diff changeset
     9
 
f4351b2cd9d7 2004-12-10 Suresh Chandrasekharan <[email protected]>
sureshc
parents:
diff changeset
    10
 #if !defined (EEL_OMIT_SELF_CHECK)
f4351b2cd9d7 2004-12-10 Suresh Chandrasekharan <[email protected]>
sureshc
parents:
diff changeset
    11
 #include "eel-lib-self-check-functions.h"
11349
fcc038811614 2007-12-23 Damien Carbery <[email protected]>
dcarbery
parents: 5542
diff changeset
    12
@@ -326,9 +326,10 @@
fcc038811614 2007-12-23 Damien Carbery <[email protected]>
dcarbery
parents: 5542
diff changeset
    13
 			 guint truncate_length)
4737
f4351b2cd9d7 2004-12-10 Suresh Chandrasekharan <[email protected]>
sureshc
parents:
diff changeset
    14
 {
f4351b2cd9d7 2004-12-10 Suresh Chandrasekharan <[email protected]>
sureshc
parents:
diff changeset
    15
 	char *truncated;
f4351b2cd9d7 2004-12-10 Suresh Chandrasekharan <[email protected]>
sureshc
parents:
diff changeset
    16
-	guint length;
f4351b2cd9d7 2004-12-10 Suresh Chandrasekharan <[email protected]>
sureshc
parents:
diff changeset
    17
+	guint length, i;
f4351b2cd9d7 2004-12-10 Suresh Chandrasekharan <[email protected]>
sureshc
parents:
diff changeset
    18
 	guint num_left_chars;
f4351b2cd9d7 2004-12-10 Suresh Chandrasekharan <[email protected]>
sureshc
parents:
diff changeset
    19
 	guint num_right_chars;
f4351b2cd9d7 2004-12-10 Suresh Chandrasekharan <[email protected]>
sureshc
parents:
diff changeset
    20
+	gboolean is_ascii = TRUE, valid_utf8 =  TRUE;
f4351b2cd9d7 2004-12-10 Suresh Chandrasekharan <[email protected]>
sureshc
parents:
diff changeset
    21
 
f4351b2cd9d7 2004-12-10 Suresh Chandrasekharan <[email protected]>
sureshc
parents:
diff changeset
    22
 	const char delimter[] = "...";
f4351b2cd9d7 2004-12-10 Suresh Chandrasekharan <[email protected]>
sureshc
parents:
diff changeset
    23
 	const guint delimter_length = strlen (delimter);
11349
fcc038811614 2007-12-23 Damien Carbery <[email protected]>
dcarbery
parents: 5542
diff changeset
    24
@@ -353,10 +354,41 @@
4737
f4351b2cd9d7 2004-12-10 Suresh Chandrasekharan <[email protected]>
sureshc
parents:
diff changeset
    25
 		return g_strdup (string);
f4351b2cd9d7 2004-12-10 Suresh Chandrasekharan <[email protected]>
sureshc
parents:
diff changeset
    26
 	}
11349
fcc038811614 2007-12-23 Damien Carbery <[email protected]>
dcarbery
parents: 5542
diff changeset
    27
 
4737
f4351b2cd9d7 2004-12-10 Suresh Chandrasekharan <[email protected]>
sureshc
parents:
diff changeset
    28
+	for (i=0; i<length; i++) {
f4351b2cd9d7 2004-12-10 Suresh Chandrasekharan <[email protected]>
sureshc
parents:
diff changeset
    29
+		if (!isascii (string[i])) {
f4351b2cd9d7 2004-12-10 Suresh Chandrasekharan <[email protected]>
sureshc
parents:
diff changeset
    30
+			is_ascii = FALSE;
f4351b2cd9d7 2004-12-10 Suresh Chandrasekharan <[email protected]>
sureshc
parents:
diff changeset
    31
+			break;
f4351b2cd9d7 2004-12-10 Suresh Chandrasekharan <[email protected]>
sureshc
parents:
diff changeset
    32
+		}
f4351b2cd9d7 2004-12-10 Suresh Chandrasekharan <[email protected]>
sureshc
parents:
diff changeset
    33
+	}
5518
235b0b4aa324 merged the gnome-2-10 branch to HEAD
laca
parents: 4737
diff changeset
    34
+
4737
f4351b2cd9d7 2004-12-10 Suresh Chandrasekharan <[email protected]>
sureshc
parents:
diff changeset
    35
+	if (!is_ascii && g_utf8_validate (string, -1, NULL)) {
f4351b2cd9d7 2004-12-10 Suresh Chandrasekharan <[email protected]>
sureshc
parents:
diff changeset
    36
+		valid_utf8 = TRUE;
f4351b2cd9d7 2004-12-10 Suresh Chandrasekharan <[email protected]>
sureshc
parents:
diff changeset
    37
+	}
11349
fcc038811614 2007-12-23 Damien Carbery <[email protected]>
dcarbery
parents: 5542
diff changeset
    38
+
4737
f4351b2cd9d7 2004-12-10 Suresh Chandrasekharan <[email protected]>
sureshc
parents:
diff changeset
    39
 	/* Find the 'middle' where the truncation will occur. */
f4351b2cd9d7 2004-12-10 Suresh Chandrasekharan <[email protected]>
sureshc
parents:
diff changeset
    40
 	num_left_chars = (truncate_length - delimter_length) / 2;
f4351b2cd9d7 2004-12-10 Suresh Chandrasekharan <[email protected]>
sureshc
parents:
diff changeset
    41
+
f4351b2cd9d7 2004-12-10 Suresh Chandrasekharan <[email protected]>
sureshc
parents:
diff changeset
    42
+	if (valid_utf8 && !g_utf8_validate (string + num_left_chars, -1, NULL)) {
11349
fcc038811614 2007-12-23 Damien Carbery <[email protected]>
dcarbery
parents: 5542
diff changeset
    43
+	gchar *tc;
fcc038811614 2007-12-23 Damien Carbery <[email protected]>
dcarbery
parents: 5542
diff changeset
    44
+	tc = g_utf8_find_next_char (string + num_left_chars, NULL);
4737
f4351b2cd9d7 2004-12-10 Suresh Chandrasekharan <[email protected]>
sureshc
parents:
diff changeset
    45
+		if (tc) {
f4351b2cd9d7 2004-12-10 Suresh Chandrasekharan <[email protected]>
sureshc
parents:
diff changeset
    46
+			num_left_chars = (gint) (tc - string);
f4351b2cd9d7 2004-12-10 Suresh Chandrasekharan <[email protected]>
sureshc
parents:
diff changeset
    47
+		}
f4351b2cd9d7 2004-12-10 Suresh Chandrasekharan <[email protected]>
sureshc
parents:
diff changeset
    48
+	}
11349
fcc038811614 2007-12-23 Damien Carbery <[email protected]>
dcarbery
parents: 5542
diff changeset
    49
+
fcc038811614 2007-12-23 Damien Carbery <[email protected]>
dcarbery
parents: 5542
diff changeset
    50
 	num_right_chars = truncate_length - num_left_chars - delimter_length;
4737
f4351b2cd9d7 2004-12-10 Suresh Chandrasekharan <[email protected]>
sureshc
parents:
diff changeset
    51
 
11349
fcc038811614 2007-12-23 Damien Carbery <[email protected]>
dcarbery
parents: 5542
diff changeset
    52
+	if (valid_utf8 && !g_utf8_validate (string + length - num_right_chars +1, -1, NULL)) {
4737
f4351b2cd9d7 2004-12-10 Suresh Chandrasekharan <[email protected]>
sureshc
parents:
diff changeset
    53
+		gchar *tc;
f4351b2cd9d7 2004-12-10 Suresh Chandrasekharan <[email protected]>
sureshc
parents:
diff changeset
    54
+		tc = g_utf8_find_prev_char (string, string + length - num_right_chars + 1);
f4351b2cd9d7 2004-12-10 Suresh Chandrasekharan <[email protected]>
sureshc
parents:
diff changeset
    55
+		if (tc) {
f4351b2cd9d7 2004-12-10 Suresh Chandrasekharan <[email protected]>
sureshc
parents:
diff changeset
    56
+			num_right_chars = strlen (tc) + 1;
f4351b2cd9d7 2004-12-10 Suresh Chandrasekharan <[email protected]>
sureshc
parents:
diff changeset
    57
+		}
f4351b2cd9d7 2004-12-10 Suresh Chandrasekharan <[email protected]>
sureshc
parents:
diff changeset
    58
+	}
f4351b2cd9d7 2004-12-10 Suresh Chandrasekharan <[email protected]>
sureshc
parents:
diff changeset
    59
+
f4351b2cd9d7 2004-12-10 Suresh Chandrasekharan <[email protected]>
sureshc
parents:
diff changeset
    60
+	if (valid_utf8)
f4351b2cd9d7 2004-12-10 Suresh Chandrasekharan <[email protected]>
sureshc
parents:
diff changeset
    61
+		truncate_length = num_left_chars + num_right_chars + delimter_length;
f4351b2cd9d7 2004-12-10 Suresh Chandrasekharan <[email protected]>
sureshc
parents:
diff changeset
    62
+
11349
fcc038811614 2007-12-23 Damien Carbery <[email protected]>
dcarbery
parents: 5542
diff changeset
    63
 	truncated = g_new (char, strlen (string) + 1);
4737
f4351b2cd9d7 2004-12-10 Suresh Chandrasekharan <[email protected]>
sureshc
parents:
diff changeset
    64
 
11349
fcc038811614 2007-12-23 Damien Carbery <[email protected]>
dcarbery
parents: 5542
diff changeset
    65
 	g_utf8_strncpy (truncated, string, num_left_chars);
17516
f7f802c00470 2010-02-08 Christian Kelly <[email protected]>
chrisk
parents: 11725
diff changeset
    66
diff -ruN eel-2.26.0.orig/eel/eel-background.c eel-2.26.0/eel/eel-background.c
f7f802c00470 2010-02-08 Christian Kelly <[email protected]>
chrisk
parents: 11725
diff changeset
    67
--- eel-2.26.0.orig/eel/eel-background.c	2010-02-01 21:50:54.619020341 +0000
f7f802c00470 2010-02-08 Christian Kelly <[email protected]>
chrisk
parents: 11725
diff changeset
    68
+++ eel-2.26.0/eel/eel-background.c	2010-02-01 21:51:12.253255236 +0000
f7f802c00470 2010-02-08 Christian Kelly <[email protected]>
chrisk
parents: 11725
diff changeset
    69
@@ -1000,7 +1000,7 @@
f7f802c00470 2010-02-08 Christian Kelly <[email protected]>
chrisk
parents: 11725
diff changeset
    70
 gboolean
f7f802c00470 2010-02-08 Christian Kelly <[email protected]>
chrisk
parents: 11725
diff changeset
    71
 eel_background_is_dark (EelBackground *background)
f7f802c00470 2010-02-08 Christian Kelly <[email protected]>
chrisk
parents: 11725
diff changeset
    72
 {
f7f802c00470 2010-02-08 Christian Kelly <[email protected]>
chrisk
parents: 11725
diff changeset
    73
-	return gnome_bg_is_dark (background->details->bg);
f7f802c00470 2010-02-08 Christian Kelly <[email protected]>
chrisk
parents: 11725
diff changeset
    74
+	return gnome_bg_is_dark (background->details->bg, NULL, NULL);
f7f802c00470 2010-02-08 Christian Kelly <[email protected]>
chrisk
parents: 11725
diff changeset
    75
 }
f7f802c00470 2010-02-08 Christian Kelly <[email protected]>
chrisk
parents: 11725
diff changeset
    76
    
f7f802c00470 2010-02-08 Christian Kelly <[email protected]>
chrisk
parents: 11725
diff changeset
    77
 /* handle dropped colors */
f7f802c00470 2010-02-08 Christian Kelly <[email protected]>
chrisk
parents: 11725
diff changeset
    78
diff -ruN eel-2.26.0.orig/eel/eel-background.c eel-2.26.0/eel/eel-background.c
f7f802c00470 2010-02-08 Christian Kelly <[email protected]>
chrisk
parents: 11725
diff changeset
    79
--- eel-2.26.0.orig/eel/eel-background.c	2010-02-01 22:50:43.603262566 +0000
f7f802c00470 2010-02-08 Christian Kelly <[email protected]>
chrisk
parents: 11725
diff changeset
    80
+++ eel-2.26.0/eel/eel-background.c	2010-02-01 22:51:24.969133823 +0000
f7f802c00470 2010-02-08 Christian Kelly <[email protected]>
chrisk
parents: 11725
diff changeset
    81
@@ -368,7 +368,7 @@
f7f802c00470 2010-02-08 Christian Kelly <[email protected]>
chrisk
parents: 11725
diff changeset
    82
 
f7f802c00470 2010-02-08 Christian Kelly <[email protected]>
chrisk
parents: 11725
diff changeset
    83
 	set_image_properties (background);
f7f802c00470 2010-02-08 Christian Kelly <[email protected]>
chrisk
parents: 11725
diff changeset
    84
 
f7f802c00470 2010-02-08 Christian Kelly <[email protected]>
chrisk
parents: 11725
diff changeset
    85
-	background->details->background_changes_with_size = gnome_bg_changes_with_size (background->details->bg);
f7f802c00470 2010-02-08 Christian Kelly <[email protected]>
chrisk
parents: 11725
diff changeset
    86
+	//background->details->background_changes_with_size = gnome_bg_changes_with_size (background->details->bg);
f7f802c00470 2010-02-08 Christian Kelly <[email protected]>
chrisk
parents: 11725
diff changeset
    87
 	background->details->background_pixmap = gnome_bg_create_pixmap (background->details->bg,
f7f802c00470 2010-02-08 Christian Kelly <[email protected]>
chrisk
parents: 11725
diff changeset
    88
 									 window,
f7f802c00470 2010-02-08 Christian Kelly <[email protected]>
chrisk
parents: 11725
diff changeset
    89
 									 entire_width, entire_height,
f7f802c00470 2010-02-08 Christian Kelly <[email protected]>
chrisk
parents: 11725
diff changeset
    90
@@ -746,8 +746,8 @@
f7f802c00470 2010-02-08 Christian Kelly <[email protected]>
chrisk
parents: 11725
diff changeset
    91
 	}
f7f802c00470 2010-02-08 Christian Kelly <[email protected]>
chrisk
parents: 11725
diff changeset
    92
         }
f7f802c00470 2010-02-08 Christian Kelly <[email protected]>
chrisk
parents: 11725
diff changeset
    93
 	
f7f802c00470 2010-02-08 Christian Kelly <[email protected]>
chrisk
parents: 11725
diff changeset
    94
-	background->details->background_changes_with_size =
f7f802c00470 2010-02-08 Christian Kelly <[email protected]>
chrisk
parents: 11725
diff changeset
    95
-		gnome_bg_changes_with_size (background->details->bg);
f7f802c00470 2010-02-08 Christian Kelly <[email protected]>
chrisk
parents: 11725
diff changeset
    96
+	//background->details->background_changes_with_size =
f7f802c00470 2010-02-08 Christian Kelly <[email protected]>
chrisk
parents: 11725
diff changeset
    97
+	//	gnome_bg_changes_with_size (background->details->bg);
f7f802c00470 2010-02-08 Christian Kelly <[email protected]>
chrisk
parents: 11725
diff changeset
    98
 	
f7f802c00470 2010-02-08 Christian Kelly <[email protected]>
chrisk
parents: 11725
diff changeset
    99
 	if (background->details->is_desktop && !in_fade) {
f7f802c00470 2010-02-08 Christian Kelly <[email protected]>
chrisk
parents: 11725
diff changeset
   100
 		set_root_pixmap (background, window);