[Commit] Xft xftname.c,1.13,1.14
Keith Packard
commit@keithp.com
Mon, 12 May 2003 10:52:08 -0700
Committed by: keithp
Update of /local/src/CVS/Xft
In directory home.keithp.com:/tmp/cvs-serv14818
Modified Files:
xftname.c
Log Message:
Automatically trim down pattern (removing LANG and CHARSET) if it doesnt fit the fixed size XftNameUnparse buffer
Index: xftname.c
===================================================================
RCS file: /local/src/CVS/Xft/xftname.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- xftname.c 17 Apr 2003 04:29:24 -0000 1.13
+++ xftname.c 12 May 2003 17:52:06 -0000 1.14
@@ -61,7 +61,19 @@
if (strlen ((char *) name) + 1 > len)
{
free (name);
- return FcFalse;
+ FcPattern *new = FcPatternDuplicate (pat);
+ FcPatternDel (new, FC_LANG);
+ FcPatternDel (new, FC_CHARSET);
+ name = FcNameUnparse (new);
+ if (!name)
+ return FcFalse;
+ if (strlen ((char *) name) + 1 > len)
+ {
+ strncpy (dest, ((char *) name), (size_t) len - 1);
+ dest[len - 1] = '\0';
+ free (name);
+ return FcFalse;
+ }
}
strcpy (dest, ((char *) name));
free (name);