[Nautilus-list] PATCH: linefeed problem for librsvg



Hi,

I have fixed the following problems:

2001-07-18  Akira TAGOH  <tagoh redhat com>

        * rsvg-ft.c: (rsvg_ft_measure_or_render_string):
	fixed a problem which the sidebar panel shows the duplicate messages
	by linefeed code in multibyte environment.


Please commit this patch.

Cheers,
--
Akira TAGOH :: at gclab org
               tagoh gnome gr jp  / Japan GNOME Users Group
               tagoh gnome-db org / GNOME-DB Project
               tagoh redhat com   / Red Hat, Inc.
diff -ruN librsvg-1.0.0.orig/rsvg-ft.c librsvg-1.0.0/rsvg-ft.c
--- librsvg-1.0.0.orig/rsvg-ft.c	Wed Jul 18 19:49:32 2001
+++ librsvg-1.0.0/rsvg-ft.c	Wed Jul 18 19:52:52 2001
@@ -821,6 +821,7 @@
 	int pixel_underline_position, pixel_underline_thickness;
 	int wclength;
 	wchar_t *wcstr;
+	gchar *tmpstr;
 
 	g_return_val_if_fail (ctx != NULL, NULL);
 	g_return_val_if_fail (str != NULL, NULL);
@@ -869,7 +870,8 @@
 
 	/* Alloc max length of wide char */
 	wcstr = g_new0 (wchar_t, length);
-	wclength = mbstowcs (wcstr, str, length);
+	tmpstr = g_strndup (str, length);
+	wclength = mbstowcs (wcstr, tmpstr, length);
 
 	/* mbstowcs fallback.  0 means not found any wide chars.
 	 * -1 means an invalid sequence was found.  In either of 
@@ -880,7 +882,7 @@
 		length = wclength;
 	} else {
 		for (i = 0; i < length; i++) {
-			wcstr[i] = (unsigned char) str[i];
+			wcstr[i] = (unsigned char) tmpstr[i];
 		}
 	}
 	
@@ -961,7 +963,7 @@
 
 #ifdef VERBOSE
 				g_print ("char '%c' bbox: (%d, %d) - (%d, %d)\n",
-					 str[i],
+					 tmpstr[i],
 					 glyph_bbox.x0, glyph_bbox.y0,
 					 glyph_bbox.x1, glyph_bbox.y1);
 #endif
@@ -973,7 +975,7 @@
 			}
 		} else {
 			g_print ("no glyph loaded for character '%c'\n",
-				 str[i]);
+				 tmpstr[i]);
 		}
 	}
 
@@ -989,6 +991,7 @@
 	dimensions[0] = pixel_width;
 	dimensions[1] = pixel_height;
 
+	if (tmpstr != NULL) g_free (tmpstr);
 	g_free (wcstr);
 	
 	/* Skip the glyph compositing loop for the case when all we


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