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

xprint: Changes to 'upstream-unstable'



 dix/dixfonts.c |   29 ++++++++++++++++++++++++++---
 1 file changed, 26 insertions(+), 3 deletions(-)

New commits:
commit 6f47f7c0585c2b621c39cae9eef2a04d7f81bcc0
Author: Drew Parsons <dparsons@debian.org>
Date:   Wed Oct 14 21:11:04 2009 +1100

    dix: append "built-ins" to the font path in SetDefaultFontPath
    
    With this commit, Xprt gets "built-ins" appended to its FontPath.
    Fixes the "could not open default font 'fixed'" problem; required now
    that libxfont 1.4 does not support Xprint.
    
    Adapted from xserver-xorg commit f56cbe1ef24415d0142b9a7d0ab0a031069ccb52

diff --git a/dix/dixfonts.c b/dix/dixfonts.c
index 6fb29de..a3f8b76 100644
--- a/dix/dixfonts.c
+++ b/dix/dixfonts.c
@@ -1806,6 +1806,9 @@ SetFontPath(ClientPtr client, int npaths, unsigned char *paths, int *error)
 int
 SetDefaultFontPath(char *path)
 {
+    char       *temp_path,
+               *start,
+               *end;
     unsigned char *cp,
                *pp,
                *nump,
@@ -1816,12 +1819,31 @@ SetDefaultFontPath(char *path)
                 size = 0,
                 bad;
 
+    /* ensure temp_path contains "built-ins" */
+    start = path;
+    while (1) {
+	start = strstr(start, "built-ins");
+	if (start == NULL)
+	    break;
+	end = start + strlen("built-ins");
+	if ((start == path || start[-1] == ',') && (!*end || *end == ','))
+	    break;
+	start = end;
+    }
+    if (!start) {
+	temp_path = Xprintf("%s%sbuilt-ins", path, *path ? "," : "");
+    } else {
+	temp_path = Xstrdup(path);
+    }
+    if (!temp_path)
+        return BadAlloc;
+
     /* get enough for string, plus values -- use up commas */
-    len = strlen(path) + 1;
-    nump = cp = newpath = (unsigned char *) xalloc(len);
+    len = strlen(temp_path) + 1;
+    nump = cp = newpath = xalloc(len);
     if (!newpath)
 	return BadAlloc;
-    pp = (unsigned char *) path;
+    pp = (unsigned char *) temp_path;
     cp++;
     while (*pp) {
 	if (*pp == ',') {
@@ -1840,6 +1862,7 @@ SetDefaultFontPath(char *path)
     err = SetFontPathElements(num, newpath, &bad, TRUE);
 
     xfree(newpath);
+    xfree(temp_path);
 
     return err;
 }


Reply to: